From 1aa0215b6e3139c6f1ea49e9a9b1266f5850b51b Mon Sep 17 00:00:00 2001 From: zinc Date: Thu, 15 Oct 2026 02:42:53 +0330 Subject: o3: an o3 function called from normal code as a receiver method (run.method) enters and leaves the region and fattens its result, like a direct call; spec 4.10.3, o3_receiver_method_enter.zc --- src/compiler/types.zc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/compiler/types.zc b/src/compiler/types.zc index ca31248..81547a5 100644 --- a/src/compiler/types.zc +++ b/src/compiler/types.zc @@ -873,7 +873,8 @@ int methcall(int s, word rst, word receiver_fact, int receiver, word receiver_ma } if ((sflag[s] & F_SIG) && np != ((ssig[s] >> 1) & 31)) serrn(sname[s], "wrong number of arguments"); if (sflag[s] & F_GEN) { s = ginstance(s, bs); effect_specialize(original, s, requirements, edges); } - fnref(s); op(O_CALL); + if (!o3on && (sflag[s] & F_O3)) { o3_enter_code(); fnref(s); op(O_CALL); callname(intern("rt.o3_leave")); op(O_DROP); } // into o3 from normal code, as call() does + else { fnref(s); op(O_CALL); } lv = 0; lvk = LV_NONE; xzero = 0; @@ -885,6 +886,7 @@ int methcall(int s, word rst, word receiver_fact, int receiver, word receiver_ma xstamp = 0; xty = tword; if (ft) xty = subst(ft[4], bs); + if (!o3on && (sflag[s] & F_O3) && ft && hasptr(xty)) { lit(xty); callname(s_fatten); } // non-o3 called o3: fatten the result here if (isfl(xty)) xfloat = 1; effect_value = 0; if (!ret && (isptr(xty) || xty == tword)) { -- cgit v1.2.3