From c9060c985d97f06855bc380fe79b82c2d37cd262 Mon Sep 17 00:00:00 2001 From: Anna Antipina Date: Thu, 22 Sep 2022 12:31:23 +0300 Subject: [PATCH] Fix saving acc in handle_return Signed-off-by: Anna Antipina --- irtoc_scripts/interpreter_handlers.irt | 6 ++++++ irtoc_scripts/interpreter_main_loop.irt | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/irtoc_scripts/interpreter_handlers.irt b/irtoc_scripts/interpreter_handlers.irt index f6e3d50be..4d5cf40d8 100644 --- a/irtoc_scripts/interpreter_handlers.irt +++ b/irtoc_scripts/interpreter_handlers.irt @@ -34,6 +34,12 @@ macro(:ecma_intrinsic_check_setacc) do |sym, size, *args| acc := Phi(acc_eh, acc.u64).u64 end +macro(:handle_return_stackfull) do + save_acc_tag(acc_tag) + save_acc_value(acc) + Intrinsic(:INTERPRETER_RETURN).ptr.Terminator +end + macro(:ecma_intrinsic_invoke) do |sym, *args| Call(*args).Method(sym).any end diff --git a/irtoc_scripts/interpreter_main_loop.irt b/irtoc_scripts/interpreter_main_loop.irt index d48f17572..b24c2f363 100644 --- a/irtoc_scripts/interpreter_main_loop.irt +++ b/irtoc_scripts/interpreter_main_loop.irt @@ -310,7 +310,7 @@ ecma_intrinsic_setacc("CreateGeneratorObj", vreg_value(op[0]).any) when "ECMA_SUSPENDGENERATOR_PREF_V8" ecma_intrinsic_setacc("SuspendGeneratorInterp", vreg_value(op[0]).any, acc.any, ins_offset.u64) - handle_return() + handle_return_stackfull() when "ECMA_SETGENERATORSTATE_PREF_V8_IMM8" ecma_intrinsic_invoke("SetGeneratorState", vreg_value(op[0]).any, i8tou16(as_imm(op[1]))) when "ECMA_RESUMEGENERATOR_PREF_V8" @@ -328,7 +328,7 @@ ecma_intrinsic_setacc("AsyncGeneratorResolve", vreg_value(op[0]).any, acc.any) when "ECMA_SUSPENDASYNCGENERATOR_PREF_V8" ecma_intrinsic_setacc("SuspendAsyncGeneratorInterp", vreg_value(op[0]).any, acc.any, ins_offset.u64) - handle_return() + handle_return_stackfull() when "ECMA_ASYNCGENERATORREJECT_PREF_V8" ecma_intrinsic_setacc("AsyncGeneratorReject", vreg_value(op[0]).any, acc.any) -- Gitee