From 660f8ae4a3869129ed0a35b83a8a87ef2c042fdf Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 16 Dec 2023 22:14:06 +0000 Subject: Garbage collect on function exit --- ...mpiler.testing.snapshots.Snapshotter)].expected | 12 ++++++-- ...mpiler.testing.snapshots.Snapshotter)].expected | 30 +++++++++++++++++++- ...mpiler.testing.snapshots.Snapshotter)].expected | 30 +++++++++++++++++++- ...mpiler.testing.snapshots.Snapshotter)].expected | 30 +++++++++++++++++++- ...mpiler.testing.snapshots.Snapshotter)].expected | 30 +++++++++++++++++++- ...mpiler.testing.snapshots.Snapshotter)].expected | 30 +++++++++++++++++++- ...mpiler.testing.snapshots.Snapshotter)].expected | 30 +++++++++++++++++++- ...mpiler.testing.snapshots.Snapshotter)].expected | 9 +++++- ...mpiler.testing.snapshots.Snapshotter)].expected | 4 +-- ...mpiler.testing.snapshots.Snapshotter)].expected | 4 +-- ...mpiler.testing.snapshots.Snapshotter)].expected | 32 ++++++++++++++++++++-- ...mpiler.testing.snapshots.Snapshotter)].expected | 21 ++++++++++++++ ...mpiler.testing.snapshots.Snapshotter)].expected | 21 ++++++++++++++ 13 files changed, 268 insertions(+), 15 deletions(-) (limited to 'snapshots') diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 4591b5f8..844a8520 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,6 +1,12 @@ Compilation unit elements: (exception-type "shed__effect__exception__Example_Project__State" int) +( + function-decl + "shed__runtime__gc_get_root_stack_index" + params=() + return-type=int +) ( function-decl "shed__runtime__effects_find_handler_method" @@ -11,9 +17,10 @@ Compilation unit elements: function "shed__function__read__0" visibility=private - locals=((param "closurePointer__0" data-ptr) (param "local__fence" int) (val "effectHandlerMethod__0" int) (val "tmp__0" int) (val "closurePointer__1" data-ptr) (val "callFunctionPointer__0" function-ptr)) + locals=((param "closurePointer__0" data-ptr) (param "local__fence" int) (val "gcRootStackIndex__0" int) (val "effectHandlerMethod__0" int) (val "tmp__0" int) (val "closurePointer__1" data-ptr) (val "callFunctionPointer__0" function-ptr)) return-type=int body=( + (call (local "gcRootStackIndex__0") "shed__runtime__gc_get_root_stack_index" ()) (call (local "effectHandlerMethod__0") "shed__runtime__effects_find_handler_method" ((int 0) (int 0))) (int-to-data-ptr (local "closurePointer__1") (local "effectHandlerMethod__0")) ( @@ -31,9 +38,10 @@ Compilation unit elements: function "shed__function__write__0" visibility=private - locals=((param "closurePointer__0" data-ptr) (param "local__arg0" int) (val "effectHandlerMethod__0" int) (val "tmp__0" int) (val "closurePointer__1" data-ptr) (val "callFunctionPointer__0" function-ptr)) + locals=((param "closurePointer__0" data-ptr) (param "local__arg0" int) (val "gcRootStackIndex__0" int) (val "effectHandlerMethod__0" int) (val "tmp__0" int) (val "closurePointer__1" data-ptr) (val "callFunctionPointer__0" function-ptr)) return-type=int body=( + (call (local "gcRootStackIndex__0") "shed__runtime__gc_get_root_stack_index" ()) (call (local "effectHandlerMethod__0") "shed__runtime__effects_find_handler_method" ((int 0) (int 1))) (int-to-data-ptr (local "closurePointer__1") (local "effectHandlerMethod__0")) ( diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:canCaptureFreeVariablesThatAreSetAfterDefinition(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:canCaptureFreeVariablesThatAreSetAfterDefinition(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index c6d0cf8a..2d07d2bb 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:canCaptureFreeVariablesThatAreSetAfterDefinition(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:canCaptureFreeVariablesThatAreSetAfterDefinition(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,10 +1,34 @@ Compilation unit elements: +( + function-decl + "shed__runtime__gc_get_root_stack_index" + params=() + return-type=int +) +( + function-decl + "shed__runtime__gc_set_root_stack_index" + params=((param "gc_root_stack_index" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_push_root" + params=((param "gc_root" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_collect" + params=() + return-type=void +) ( function "shed__function__f__0" visibility=private - locals=((param "closurePointer__0" data-ptr) (val "local__a" int) (val "local__b" int)) + locals=((param "closurePointer__0" data-ptr) (val "local__a" int) (val "local__b" int) (val "gcRootStackIndex__0" int)) return-type=int body=( ( @@ -21,6 +45,10 @@ Compilation unit elements: layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct (int int)))))) offset=(1 2 1) ) + (call (local "gcRootStackIndex__0") "shed__runtime__gc_get_root_stack_index" ()) + (call _ "shed__runtime__gc_set_root_stack_index" ((local "gcRootStackIndex__0"))) + (call _ "shed__runtime__gc_push_root" ((local "local__a"))) + (call _ "shed__runtime__gc_collect" ()) (return (local "local__a")) ) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:canDefineMinimalFunction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:canDefineMinimalFunction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 65d67506..01828098 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:canDefineMinimalFunction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:canDefineMinimalFunction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,13 +1,41 @@ Compilation unit elements: +( + function-decl + "shed__runtime__gc_get_root_stack_index" + params=() + return-type=int +) +( + function-decl + "shed__runtime__gc_set_root_stack_index" + params=((param "gc_root_stack_index" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_push_root" + params=((param "gc_root" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_collect" + params=() + return-type=void +) ( function "shed__function__f__0" visibility=private - locals=((param "closurePointer__0" data-ptr) (val "tmp__0" int)) + locals=((param "closurePointer__0" data-ptr) (val "gcRootStackIndex__0" int) (val "tmp__0" int)) return-type=int body=( + (call (local "gcRootStackIndex__0") "shed__runtime__gc_get_root_stack_index" ()) (local-store (local "tmp__0") (int 0)) + (call _ "shed__runtime__gc_set_root_stack_index" ((local "gcRootStackIndex__0"))) + (call _ "shed__runtime__gc_push_root" ((local "tmp__0"))) + (call _ "shed__runtime__gc_collect" ()) (return (local "tmp__0")) ) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:effectHandlerMethodSwapsEffectHandlerInBody(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:effectHandlerMethodSwapsEffectHandlerInBody(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index f764af61..040ae764 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:effectHandlerMethodSwapsEffectHandlerInBody(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:effectHandlerMethodSwapsEffectHandlerInBody(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -12,13 +12,38 @@ Compilation unit elements: params=((param "effectHandler" data-ptr)) return-type=void ) +( + function-decl + "shed__runtime__gc_get_root_stack_index" + params=() + return-type=int +) +( + function-decl + "shed__runtime__gc_set_root_stack_index" + params=((param "gc_root_stack_index" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_push_root" + params=((param "gc_root" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_collect" + params=() + return-type=void +) ( function "shed__effectHandlerMethod__f__0" visibility=private - locals=((param "closurePointer__0" data-ptr) (val "effectHandler__0" data-ptr) (val "effectHandler__1" data-ptr) (val "tmp__0" int)) + locals=((param "closurePointer__0" data-ptr) (val "gcRootStackIndex__0" int) (val "effectHandler__0" data-ptr) (val "effectHandler__1" data-ptr) (val "tmp__0" int)) return-type=int body=( + (call (local "gcRootStackIndex__0") "shed__runtime__gc_get_root_stack_index" ()) (call (local "effectHandler__0") "shed__runtime__effects_get_handler" ()) ( memory-load @@ -29,6 +54,9 @@ Compilation unit elements: ) (call _ "shed__runtime__effects_set_handler" ((local "effectHandler__1"))) (local-store (local "tmp__0") (int 0)) + (call _ "shed__runtime__gc_set_root_stack_index" ((local "gcRootStackIndex__0"))) + (call _ "shed__runtime__gc_push_root" ((local "tmp__0"))) + (call _ "shed__runtime__gc_collect" ()) (call _ "shed__runtime__effects_set_handler" ((local "effectHandler__0"))) (resume (local "tmp__0")) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:immutableFreeVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:immutableFreeVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index a528eb05..35b32735 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:immutableFreeVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:immutableFreeVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,10 +1,34 @@ Compilation unit elements: +( + function-decl + "shed__runtime__gc_get_root_stack_index" + params=() + return-type=int +) +( + function-decl + "shed__runtime__gc_set_root_stack_index" + params=((param "gc_root_stack_index" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_push_root" + params=((param "gc_root" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_collect" + params=() + return-type=void +) ( function "shed__function__f__0" visibility=private - locals=((param "closurePointer__0" data-ptr) (val "local__a" int) (val "local__b" int)) + locals=((param "closurePointer__0" data-ptr) (val "local__a" int) (val "local__b" int) (val "gcRootStackIndex__0" int)) return-type=int body=( ( @@ -21,6 +45,10 @@ Compilation unit elements: layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct (int int)))))) offset=(1 2 1) ) + (call (local "gcRootStackIndex__0") "shed__runtime__gc_get_root_stack_index" ()) + (call _ "shed__runtime__gc_set_root_stack_index" ((local "gcRootStackIndex__0"))) + (call _ "shed__runtime__gc_push_root" ((local "local__a"))) + (call _ "shed__runtime__gc_collect" ()) (return (local "local__a")) ) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:pointersToFreeMutableVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:pointersToFreeMutableVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 70ee5036..8f0b9f0f 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:pointersToFreeMutableVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:pointersToFreeMutableVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,10 +1,34 @@ Compilation unit elements: +( + function-decl + "shed__runtime__gc_get_root_stack_index" + params=() + return-type=int +) +( + function-decl + "shed__runtime__gc_set_root_stack_index" + params=((param "gc_root_stack_index" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_push_root" + params=((param "gc_root" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_collect" + params=() + return-type=void +) ( function "shed__function__f__0" visibility=private - locals=((param "closurePointer__0" data-ptr) (val "local__a" data-ptr) (val "local__b" data-ptr)) + locals=((param "closurePointer__0" data-ptr) (val "local__a" data-ptr) (val "local__b" data-ptr) (val "gcRootStackIndex__0" int)) return-type=int body=( ( @@ -21,6 +45,10 @@ Compilation unit elements: layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct (data-ptr data-ptr)))))) offset=(1 2 1) ) + (call (local "gcRootStackIndex__0") "shed__runtime__gc_get_root_stack_index" ()) + (call _ "shed__runtime__gc_set_root_stack_index" ((local "gcRootStackIndex__0"))) + (call _ "shed__runtime__gc_push_root" ((local "local__a"))) + (call _ "shed__runtime__gc_collect" ()) (return (local "local__a")) ) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:positionalAndNamedParamsAreDefined(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:positionalAndNamedParamsAreDefined(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index bda47107..ba98ae45 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:positionalAndNamedParamsAreDefined(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineFunctionTests]/[method:positionalAndNamedParamsAreDefined(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,16 +1,40 @@ Compilation unit elements: +( + function-decl + "shed__runtime__gc_get_root_stack_index" + params=() + return-type=int +) ( function-decl "shed__runtime__int_add" params=((param "left" int) (param "right" int)) return-type=int ) +( + function-decl + "shed__runtime__gc_set_root_stack_index" + params=((param "gc_root_stack_index" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_push_root" + params=((param "gc_root" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_collect" + params=() + return-type=void +) ( function "shed__function__f__0" visibility=private - locals=((param "closurePointer__0" data-ptr) (param "local__param1" int) (param "local__param2" int) (param "local__paramA" int) (param "local__paramB" int) (param "local__paramC" int) (val "local__a" int) (val "local__b" int) (val "binaryOpResult__0" int) (val "binaryOpResult__1" int)) + locals=((param "closurePointer__0" data-ptr) (param "local__param1" int) (param "local__param2" int) (param "local__paramA" int) (param "local__paramB" int) (param "local__paramC" int) (val "local__a" int) (val "local__b" int) (val "gcRootStackIndex__0" int) (val "binaryOpResult__0" int) (val "binaryOpResult__1" int)) return-type=int body=( ( @@ -27,8 +51,12 @@ Compilation unit elements: layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct (int int)))))) offset=(1 2 1) ) + (call (local "gcRootStackIndex__0") "shed__runtime__gc_get_root_stack_index" ()) (call (local "binaryOpResult__0") "shed__runtime__int_add" ((local "local__a") (local "local__param1"))) (call (local "binaryOpResult__1") "shed__runtime__int_add" ((local "binaryOpResult__0") (local "local__paramA"))) + (call _ "shed__runtime__gc_set_root_stack_index" ((local "gcRootStackIndex__0"))) + (call _ "shed__runtime__gc_push_root" ((local "binaryOpResult__1"))) + (call _ "shed__runtime__gc_collect" ()) (return (local "binaryOpResult__1")) ) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineStructTests]/[method:canGenerateCodeForDefineStruct(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineStructTests]/[method:canGenerateCodeForDefineStruct(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 5c789ad6..84129f10 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineStructTests]/[method:canGenerateCodeForDefineStruct(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenDefineStructTests]/[method:canGenerateCodeForDefineStruct(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,12 +1,19 @@ Compilation unit elements: +( + function-decl + "shed__runtime__gc_get_root_stack_index" + params=() + return-type=int +) ( function "shed__function__User__0" visibility=private - locals=((param "closurePointer__0" data-ptr) (param "local__isActive" int) (param "local__name" int) (val "structValuePointer__0" data-ptr) (val "structValue__0" int)) + locals=((param "closurePointer__0" data-ptr) (param "local__isActive" int) (param "local__name" int) (val "gcRootStackIndex__0" int) (val "structValuePointer__0" data-ptr) (val "structValue__0" int)) return-type=int body=( + (call (local "gcRootStackIndex__0") "shed__runtime__gc_get_root_stack_index" ()) (alloc-heap (local "structValuePointer__0") (struct ((struct (data-ptr int int int)) (struct (int (struct (int int))))))) ( memory-store diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenFieldLoadTests]/[method:canGenerateCodeForNamespaceFieldLoad(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenFieldLoadTests]/[method:canGenerateCodeForNamespaceFieldLoad(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 3e1630bf..db8a3491 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenFieldLoadTests]/[method:canGenerateCodeForNamespaceFieldLoad(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenFieldLoadTests]/[method:canGenerateCodeForNamespaceFieldLoad(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -13,8 +13,8 @@ Instructions: memory-load (local "tmp__y__0") pointer=(local "namespacePointer__Example_Project__0") - layout=(struct (int int int)) - offset=(1) + layout=(struct ((struct (int int int int)) (struct (int int int)))) + offset=(1 1) ) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenNamespaceFieldStoreTests]/[method:canGenerateCodeForNamespaceFieldStore(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenNamespaceFieldStoreTests]/[method:canGenerateCodeForNamespaceFieldStore(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 2408d323..affb898f 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenNamespaceFieldStoreTests]/[method:canGenerateCodeForNamespaceFieldStore(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenNamespaceFieldStoreTests]/[method:canGenerateCodeForNamespaceFieldStore(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -15,8 +15,8 @@ Instructions: ( memory-store pointer=(data-ptr "shed__namespace__Example_Project") - layout=(struct (int int int)) - offset=(1) + layout=(struct ((struct (int int int int)) (struct (int int int)))) + offset=(1 1) value=(local "b") ) (call _ "shed__runtime__gc_add_perm_root" ((local "b"))) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenNamespaceTests]/[method:canDefineNamespace(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenNamespaceTests]/[method:canDefineNamespace(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 54b131be..f886961d 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenNamespaceTests]/[method:canDefineNamespace(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenNamespaceTests]/[method:canDefineNamespace(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,14 +1,42 @@ ( - (data-mutable "shed__namespace__An_Example" (struct ((int 0) (int 0)))) + (data-mutable "shed__namespace__An_Example" (struct ((struct ((int 0) (int 6) (int 0) (int 0))) (struct ((int 0) (int 0)))))) (data-mutable "shed__namespaceIsInited__An_Example" (bool false)) + ( + function-decl + "shed__runtime__gc_get_root_stack_index" + params=() + return-type=int + ) + ( + function-decl + "shed__runtime__gc_set_root_stack_index" + params=((param "gc_root_stack_index" int)) + return-type=void + ) + ( + function-decl + "shed__runtime__gc_push_root" + params=((param "gc_root" int)) + return-type=void + ) + ( + function-decl + "shed__runtime__gc_collect" + params=() + return-type=void + ) ( function "shed__function__f__0" visibility=private - locals=((param "closurePointer__0" data-ptr) (val "tmp__0" int)) + locals=((param "closurePointer__0" data-ptr) (val "gcRootStackIndex__0" int) (val "tmp__0" int)) return-type=int body=( + (call (local "gcRootStackIndex__0") "shed__runtime__gc_get_root_stack_index" ()) (local-store (local "tmp__0") (int 0)) + (call _ "shed__runtime__gc_set_root_stack_index" ((local "gcRootStackIndex__0"))) + (call _ "shed__runtime__gc_push_root" ((local "tmp__0"))) + (call _ "shed__runtime__gc_collect" ()) (return (local "tmp__0")) ) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenResumeTests]/[method:resumeInstructionGeneratesResumeInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenResumeTests]/[method:resumeInstructionGeneratesResumeInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index cc3c3c45..de8cd9a9 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenResumeTests]/[method:resumeInstructionGeneratesResumeInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenResumeTests]/[method:resumeInstructionGeneratesResumeInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,11 +1,32 @@ Compilation unit elements: +( + function-decl + "shed__runtime__gc_set_root_stack_index" + params=((param "gc_root_stack_index" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_push_root" + params=((param "gc_root" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_collect" + params=() + return-type=void +) Locals: Instructions: ( + (call _ "shed__runtime__gc_set_root_stack_index" ((local "gc_root_stack_index"))) + (call _ "shed__runtime__gc_push_root" ((local "b"))) + (call _ "shed__runtime__gc_collect" ()) (call _ "shed__runtime__effects_set_handler" ((local "effect_handler"))) (resume (local "b")) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenReturnTests]/[method:returnInstructionGeneratesReturnInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenReturnTests]/[method:returnInstructionGeneratesReturnInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index f7d7a17e..6f20081e 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenReturnTests]/[method:returnInstructionGeneratesReturnInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenReturnTests]/[method:returnInstructionGeneratesReturnInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -1,11 +1,32 @@ Compilation unit elements: +( + function-decl + "shed__runtime__gc_set_root_stack_index" + params=((param "gc_root_stack_index" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_push_root" + params=((param "gc_root" int)) + return-type=void +) +( + function-decl + "shed__runtime__gc_collect" + params=() + return-type=void +) Locals: Instructions: ( + (call _ "shed__runtime__gc_set_root_stack_index" ((local "gc_root_stack_index"))) + (call _ "shed__runtime__gc_push_root" ((local "b"))) + (call _ "shed__runtime__gc_collect" ()) (return (local "b")) ) -- cgit v1.2.3