finish basic function of repl

This commit is contained in:
ValKmjolnir
2023-09-17 17:56:59 +08:00
parent b77d7fafb1
commit 3e01239722
8 changed files with 63 additions and 32 deletions

View File

@@ -75,7 +75,6 @@ bool repl::run() {
auto nasal_linker = std::unique_ptr<linker>(new linker);
auto nasal_opt = std::unique_ptr<optimizer>(new optimizer);
auto nasal_codegen = std::unique_ptr<codegen>(new codegen);
auto nasal_runtime = std::unique_ptr<vm>(new vm);
if (nasal_lexer->scan("<nasal-repl>").geterr()) {
return false;
@@ -96,7 +95,11 @@ bool repl::run() {
auto end = clk::now();
std::clog << "[compile time: " << (end-start).count()*1000.0/den << " ms]\n";
nasal_runtime->run(*nasal_codegen, *nasal_linker, {}, false);
runtime->set_detail_report_info(false);
// TODO: gc init stage in this run may cause memory leak,
// because constant strings will be generated again.
// but we could not delete old strings, they maybe still on stack.
runtime->run(*nasal_codegen, *nasal_linker, {});
return true;
}