From eefcf44946b306122e17216fd984749b56f5be3a Mon Sep 17 00:00:00 2001 From: Drahflow Date: Thu, 11 Jun 2015 11:27:25 +0200 Subject: Fix GC killing to-be-emitted reference targets --- elymas/lib/sys/opt.ey | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'elymas') diff --git a/elymas/lib/sys/opt.ey b/elymas/lib/sys/opt.ey index 3c7e19c..29e6d26 100644 --- a/elymas/lib/sys/opt.ey +++ b/elymas/lib/sys/opt.ey @@ -295,13 +295,16 @@ } /holdsInt deffd [ - "|" "=" "/" "?" "[" "]" /cat /dearray /def /die /len + "/" "?" "[" "]" /cat /dearray /die /len /quoted /range "''" ".?" ".?'" ".|" ";" + /keys /dom /add /and /band /bor /bxor /div /eq /ge /gt /le /lt + /mod /mul /neq /or /sub /udiv /umod /xor /bnot /neg /not + ] { | ::rawCodeAddress } [ 0 ] [ 0 ] '' * ==:SCOPEIGNORANTFUNCTIONS + [ + "|" "=" /def /defv /deff /defq /defm /defvs /deffs /defms /defvt /defft /defmt /defvst /deffst /defmst /defvc /deffc /defmc /defvd /deffd /defmd - /keys /dom /add /and /band /bor /bxor /div /eq /ge /gt /le /lt - /mod /mul /neq /or /sub /udiv /umod /xor /bnot /neg /not ] { | ::rawCodeAddress } [ 0 ] [ 0 ] '' * ==:SCOPETIGHTFUNCTIONS [ /defvs /deffs /defms /defvst /deffst /defmst @@ -329,29 +332,37 @@ 0 ==allocatedScopeMightEscape { _ ==logic + 0 ==needsAScope + logic { ==entry 0 entry * ==action [ { action NOP eq }' { } { action PUSH eq }' { } { action CALLSCOPED eq }' { } - { action STATIC eq }' { } - { action STATICTYPED eq }' { } - { action STATICWRITE eq }' { } - { action STATICDOT eq }' { } + { action STATIC eq }' { 1 =needsAScope } + { action STATICTYPED eq }' { 1 =needsAScope } + { action STATICWRITE eq }' { 1 =needsAScope } + { action STATICDOT eq }' { 1 =needsAScope } { action ARRAYSTAR eq }' { } { action UNTYPEDSCOPEDSTAR eq }' { } { action STRINGSTAR eq }' { } - { action NATIVENOSCOPE eq }' { } - { action CONDITIONALTAIL eq }' { } + { action NATIVENOSCOPE eq }' { 1 =needsAScope } + { action CONDITIONALTAIL eq }' { 1 =needsAScope } - { action CALL eq { 1 entry * SCOPETIGHTFUNCTIONS eq any } andif }' { } + { action CALL eq { 1 entry * SCOPEIGNORANTFUNCTIONS eq any } andif }' { } + { action CALL eq { 1 entry * SCOPETIGHTFUNCTIONS eq any } andif }' { 1 =needsAScope } # TODO handle more known-harmless unscoped global functions { 1 }' { 1 =allocatedScopeMightEscape + 1 =needsAScope } ] conds } each + + needsAScope not isScoping and { + 0 =isScoping + } rep } /testAllocatedScopeEscape deffst 0 ==templateNametable @@ -1816,7 +1827,7 @@ [ { ref 105553116266496 lt } { } # HEAPBASE # FIXME: use a global constant { ref 123145302310912 ge } { } # %700000000000 - { 1 } { newReferences [ ref ] cat =newReferences } + { 1 } { newReferences [ ref ::rawObject ] cat =newReferences } ] conds } /emitReference deffst -- cgit v1.2.3