From 99dca532f65fab3589c167a8961cb9bc9d83a98f Mon Sep 17 00:00:00 2001 From: ValKmjolnir Date: Sat, 21 May 2022 14:22:54 +0800 Subject: [PATCH] :memo: add notes in nasal_codegen.h and nasal_vm.h. add register_info() in debugger. --- nasal_codegen.h | 8 ++++++++ nasal_dbg.h | 25 +++++++++++++----------- nasal_vm.h | 51 +++++++++++++++++++++++++++---------------------- 3 files changed, 50 insertions(+), 34 deletions(-) diff --git a/nasal_codegen.h b/nasal_codegen.h index 3240e7b..463f006 100644 --- a/nasal_codegen.h +++ b/nasal_codegen.h @@ -540,6 +540,14 @@ void nasal_codegen::call_func(const nasal_ast& ast) } } +/* mcall should run after calc_gen because this operation may trigger gc. +* to avoid gc incorrectly collecting values that include the memory space(which will cause SIGSEGV), +* we must run ast[1] then we run ast[0] to get the memory space. +* at this time the value including the memory space can must be found alive. +* BUT in fact this method does not make much safety. +* so we use another way to avoid gc-caused SIGSEGV: reserve m-called value on stack. +* you could see the notes in `nasal_vm::opr_mcallv()`. +*/ void nasal_codegen::mcall(const nasal_ast& ast) { if(ast.type()==ast_id) diff --git a/nasal_dbg.h b/nasal_dbg.h index a0e0703..f78c096 100644 --- a/nasal_dbg.h +++ b/nasal_dbg.h @@ -65,18 +65,19 @@ void nasal_dbg::help() { std::cout <<"