From 6d380ac1b8aefb00e6be1655a416588e5559bfa0 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 22 Jan 2024 18:52:29 +0000 Subject: Rename const operands to with const suffix --- ...mpiler.testing.snapshots.Snapshotter)].expected | 14 +-- ...mpiler.testing.snapshots.Snapshotter)].expected | 8 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 6 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 6 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 4 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 4 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 4 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 8 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 8 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 4 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 8 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 2 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 2 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 18 ++-- ...mpiler.testing.snapshots.Snapshotter)].expected | 2 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 2 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 2 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 4 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 2 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 2 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 8 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 10 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 6 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 2 +- ...mpiler.testing.snapshots.Snapshotter)].expected | 2 +- .../backends/llvm/codegen/PatioToLlvm.java | 24 ++--- .../compiler/backends/wasm/PatioToWasm.java | 24 ++--- .../shedlang/compiler/patio/PatioSerializer.java | 16 ++-- .../compiler/patio/operands/PatioBool.java | 4 - .../compiler/patio/operands/PatioBoolConst.java | 4 + .../compiler/patio/operands/PatioDataPtr.java | 4 - .../compiler/patio/operands/PatioDataPtrConst.java | 4 + .../compiler/patio/operands/PatioFunctionPtr.java | 4 - .../patio/operands/PatioFunctionPtrConst.java | 4 + .../shedlang/compiler/patio/operands/PatioInt.java | 4 - .../compiler/patio/operands/PatioIntConst.java | 4 + .../compiler/patio/operands/PatioOperand.java | 2 +- .../shedlang/compiler/shidtopatio/ShidToPatio.java | 4 +- .../compiler/shidtopatio/ShidToPatioClosures.java | 4 +- .../compiler/shidtopatio/ShidToPatioEffects.java | 12 +-- .../compiler/shidtopatio/ShidToPatioGc.java | 4 +- .../compiler/shidtopatio/ShidToPatioInts.java | 4 +- .../shidtopatio/ShidToPatioNamespaces.java | 16 ++-- .../compiler/shidtopatio/ShidToPatioStrings.java | 6 +- .../compiler/shidtopatio/ShidToPatioStructs.java | 4 +- .../compiler/shidtopatio/ShidToPatioTuples.java | 4 +- .../shedlang/compiler/patio/PatioExampleTests.java | 92 +++++++++--------- .../compiler/patio/PatioSerializerTests.java | 104 ++++++++++----------- .../compiler/patio/instructions/Patio.java | 16 ++-- .../ShidToPatioDefineFunctionTests.java | 4 +- 50 files changed, 255 insertions(+), 255 deletions(-) delete mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioBool.java create mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioBoolConst.java delete mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtr.java create mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtrConst.java delete mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtr.java create mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtrConst.java delete mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioInt.java create mode 100644 src/main/java/org/shedlang/compiler/patio/operands/PatioIntConst.java diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index c2d04d59..2d5b83ca 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineEffectTests]/[method:canGenerateCodeForDefineEffect(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -27,7 +27,7 @@ Compilation unit elements: 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))) + (call (local "effectHandlerMethod__0") "shed__runtime__effects_find_handler_method" ((int-const 0) (int-const 0))) (int-to-data-ptr (local "closurePointer__1") (local "effectHandlerMethod__0")) ( memory-load @@ -48,7 +48,7 @@ Compilation unit elements: 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))) + (call (local "effectHandlerMethod__0") "shed__runtime__effects_find_handler_method" ((int-const 0) (int-const 1))) (int-to-data-ptr (local "closurePointer__1") (local "effectHandlerMethod__0")) ( memory-load @@ -90,7 +90,7 @@ Instructions: (struct ((struct (data-ptr int int int)) (struct (int int)))) (1) ) - (call (local "userDefinedEffectPointer__State__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int 2))) + (call (local "userDefinedEffectPointer__State__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int-const 2))) ( byte-size-of (local "byteSize__1") @@ -102,13 +102,13 @@ Instructions: (struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct ()))))) (1 2) ) - (call (local "closurePointer__read__0") "shed__runtime__gc_alloc" ((local "byteSize__1") (local "byteOffset__1") (int 0))) + (call (local "closurePointer__read__0") "shed__runtime__gc_alloc" ((local "byteSize__1") (local "byteOffset__1") (int-const 0))) ( memory-store pointer=(local "closurePointer__read__0") layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct ()))))) offset=(1 0) - value=(function-ptr "shed__function__read__0") + value=(function-ptr-const "shed__function__read__0") ) (data-ptr-to-int (local "userDefinedMethod__read__0") (local "closurePointer__read__0")) ( @@ -129,13 +129,13 @@ Instructions: (struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct ()))))) (1 2) ) - (call (local "closurePointer__write__0") "shed__runtime__gc_alloc" ((local "byteSize__2") (local "byteOffset__2") (int 0))) + (call (local "closurePointer__write__0") "shed__runtime__gc_alloc" ((local "byteSize__2") (local "byteOffset__2") (int-const 0))) ( memory-store pointer=(local "closurePointer__write__0") layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct ()))))) offset=(1 0) - value=(function-ptr "shed__function__write__0") + value=(function-ptr-const "shed__function__write__0") ) (data-ptr-to-int (local "userDefinedMethod__write__0") (local "closurePointer__write__0")) ( diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:canCaptureFreeVariablesThatAreSetAfterDefinition(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:canCaptureFreeVariablesThatAreSetAfterDefinition(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 81a874fb..49b4d239 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:canCaptureFreeVariablesThatAreSetAfterDefinition(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:canCaptureFreeVariablesThatAreSetAfterDefinition(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -81,16 +81,16 @@ Instructions: (struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct (int int)))))) (1 2) ) - (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int 2))) + (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int-const 2))) ( memory-store pointer=(local "closurePointer__f__0") layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct (int int)))))) offset=(1 0) - value=(function-ptr "shed__function__f__0") + value=(function-ptr-const "shed__function__f__0") ) (data-ptr-to-int (local "closure__f__0") (local "closurePointer__f__0")) - (local-store (local "a") (int 42)) + (local-store (local "a") (int-const 42)) ( memory-store pointer=(local "closurePointer__f__0") @@ -98,7 +98,7 @@ Instructions: offset=(1 2 0) value=(local "local__a") ) - (local-store (local "b") (int 47)) + (local-store (local "b") (int-const 47)) ( memory-store pointer=(local "closurePointer__f__0") diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:canDefineMinimalFunction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:canDefineMinimalFunction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index e780fa4e..f05227e0 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:canDefineMinimalFunction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:canDefineMinimalFunction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -32,7 +32,7 @@ Compilation unit elements: return-type=int body=( (call (local "gcRootStackIndex__0") "shed__runtime__gc_get_root_stack_index" ()) - (local-store (local "tmp__0") (int 0)) + (local-store (local "tmp__0") (int-const 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" ()) @@ -66,13 +66,13 @@ Instructions: (struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct ()))))) (1 2) ) - (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int 0))) + (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int-const 0))) ( memory-store pointer=(local "closurePointer__f__0") layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct ()))))) offset=(1 0) - value=(function-ptr "shed__function__f__0") + value=(function-ptr-const "shed__function__f__0") ) (data-ptr-to-int (local "closure__f__0") (local "closurePointer__f__0")) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:effectHandlerMethodSwapsEffectHandlerInBody(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:effectHandlerMethodSwapsEffectHandlerInBody(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 10b0cc46..1ad789a7 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:effectHandlerMethodSwapsEffectHandlerInBody(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:effectHandlerMethodSwapsEffectHandlerInBody(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -53,7 +53,7 @@ Compilation unit elements: offset=(1 1 0) ) (call _ "shed__runtime__effects_set_handler" ((local "effectHandler__1"))) - (local-store (local "tmp__0") (int 0)) + (local-store (local "tmp__0") (int-const 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" ()) @@ -89,13 +89,13 @@ Instructions: (struct ((struct (data-ptr int int int)) (struct (function-ptr (struct (data-ptr)) (struct ()))))) (1 2) ) - (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int 0))) + (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int-const 0))) ( memory-store pointer=(local "closurePointer__f__0") layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct (data-ptr)) (struct ()))))) offset=(1 0) - value=(function-ptr "shed__effectHandlerMethod__f__0") + value=(function-ptr-const "shed__effectHandlerMethod__f__0") ) (call (local "effectHandlerCurrent__0") "shed__runtime__effects_get_handler" ()) ( diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:immutableFreeVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:immutableFreeVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 8a16de71..81db6f22 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:immutableFreeVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:immutableFreeVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -81,13 +81,13 @@ Instructions: (struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct (int int)))))) (1 2) ) - (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int 2))) + (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int-const 2))) ( memory-store pointer=(local "closurePointer__f__0") layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct (int int)))))) offset=(1 0) - value=(function-ptr "shed__function__f__0") + value=(function-ptr-const "shed__function__f__0") ) ( memory-store diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:pointersToFreeMutableVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:pointersToFreeMutableVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 879f72ac..22a8dc57 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:pointersToFreeMutableVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:pointersToFreeMutableVariablesAreStoredInAndLoadedFromEnvironment(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -81,13 +81,13 @@ Instructions: (struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct (data-ptr data-ptr)))))) (1 2) ) - (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int 2))) + (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int-const 2))) ( memory-store pointer=(local "closurePointer__f__0") layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct (data-ptr data-ptr)))))) offset=(1 0) - value=(function-ptr "shed__function__f__0") + value=(function-ptr-const "shed__function__f__0") ) ( memory-store diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:positionalAndNamedParamsAreDefined(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:positionalAndNamedParamsAreDefined(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index b52149d9..1742639f 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:positionalAndNamedParamsAreDefined(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineFunctionTests]/[method:positionalAndNamedParamsAreDefined(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -89,13 +89,13 @@ Instructions: (struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct (int int)))))) (1 2) ) - (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int 2))) + (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int-const 2))) ( memory-store pointer=(local "closurePointer__f__0") layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct (int int)))))) offset=(1 0) - value=(function-ptr "shed__function__f__0") + value=(function-ptr-const "shed__function__f__0") ) ( memory-store diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineStructTests]/[method:canGenerateCodeForDefineStruct(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineStructTests]/[method:canGenerateCodeForDefineStruct(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 9150ee75..d6b9ad98 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineStructTests]/[method:canGenerateCodeForDefineStruct(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioDefineStructTests]/[method:canGenerateCodeForDefineStruct(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -31,13 +31,13 @@ Compilation unit elements: (struct ((struct (data-ptr int int int)) (struct (int (struct (int int)))))) (1 1) ) - (call (local "structValuePointer__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int 2))) + (call (local "structValuePointer__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int-const 2))) ( memory-store pointer=(local "structValuePointer__0") layout=(struct ((struct (data-ptr int int int)) (struct (int (struct (int int)))))) offset=(1 0) - value=(int 0) + value=(int-const 0) ) ( memory-store @@ -78,13 +78,13 @@ Instructions: (struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct ()))))) (1 2) ) - (call (local "closurePointer__User__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int 0))) + (call (local "closurePointer__User__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int-const 0))) ( memory-store pointer=(local "closurePointer__User__0") layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct ()))))) offset=(1 0) - value=(function-ptr "shed__function__User__0") + value=(function-ptr-const "shed__function__User__0") ) (data-ptr-to-int (local "structType__User__0") (local "closurePointer__User__0")) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioIfTests]/[method:canGenerateCodeForIfWithMultipleResults(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioIfTests]/[method:canGenerateCodeForIfWithMultipleResults(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 26b88216..83e422da 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioIfTests]/[method:canGenerateCodeForIfWithMultipleResults(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioIfTests]/[method:canGenerateCodeForIfWithMultipleResults(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -29,16 +29,16 @@ Instructions: ( block ( - (call (local "int__0") "shed__runtime__int_create" ((int 1))) - (call (local "int__1") "shed__runtime__int_create" ((int 2))) + (call (local "int__0") "shed__runtime__int_create" ((int-const 1))) + (call (local "int__1") "shed__runtime__int_create" ((int-const 2))) ) results=((local "int__0") (local "int__1")) ) ( block ( - (call (local "int__2") "shed__runtime__int_create" ((int 101))) - (call (local "int__3") "shed__runtime__int_create" ((int 102))) + (call (local "int__2") "shed__runtime__int_create" ((int-const 101))) + (call (local "int__3") "shed__runtime__int_create" ((int-const 102))) ) results=((local "int__2") (local "int__3")) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioIfTests]/[method:canGenerateCodeForIfWithNoResults(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioIfTests]/[method:canGenerateCodeForIfWithNoResults(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index e19dd75b..7073d213 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioIfTests]/[method:canGenerateCodeForIfWithNoResults(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioIfTests]/[method:canGenerateCodeForIfWithNoResults(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -25,14 +25,14 @@ Instructions: ( block ( - (call (local "int__0") "shed__runtime__int_create" ((int 1))) + (call (local "int__0") "shed__runtime__int_create" ((int-const 1))) ) results=() ) ( block ( - (call (local "int__1") "shed__runtime__int_create" ((int 101))) + (call (local "int__1") "shed__runtime__int_create" ((int-const 101))) ) results=() ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioIfTests]/[method:canGenerateCodeForIfWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioIfTests]/[method:canGenerateCodeForIfWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index e8ed6200..a07c0caa 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioIfTests]/[method:canGenerateCodeForIfWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioIfTests]/[method:canGenerateCodeForIfWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -36,8 +36,8 @@ Instructions: ( block ( - (call (local "int__0") "shed__runtime__int_create" ((int 1))) - (call (local "int__1") "shed__runtime__int_create" ((int 2))) + (call (local "int__0") "shed__runtime__int_create" ((int-const 1))) + (call (local "int__1") "shed__runtime__int_create" ((int-const 2))) (call (local "binaryOpResult__0") "shed__runtime__int_add" ((local "int__0") (local "int__1"))) ) results=((local "binaryOpResult__0")) @@ -45,8 +45,8 @@ Instructions: ( block ( - (call (local "int__2") "shed__runtime__int_create" ((int 101))) - (call (local "int__3") "shed__runtime__int_create" ((int 102))) + (call (local "int__2") "shed__runtime__int_create" ((int-const 101))) + (call (local "int__3") "shed__runtime__int_create" ((int-const 102))) (call (local "binaryOpResult__1") "shed__runtime__int_add" ((local "int__2") (local "int__3"))) ) results=((local "binaryOpResult__1")) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioLoopTests]/[method:canGenerateCodeForLoop(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioLoopTests]/[method:canGenerateCodeForLoop(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index cc33a70a..edce67ab 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioLoopTests]/[method:canGenerateCodeForLoop(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioLoopTests]/[method:canGenerateCodeForLoop(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -16,7 +16,7 @@ Instructions: ( loop ( - (call (local "int__0") "shed__runtime__int_create" ((int 1))) + (call (local "int__0") "shed__runtime__int_create" ((int-const 1))) ) ) ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioNamespaceFieldStoreTests]/[method:canGenerateCodeForNamespaceFieldStore(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioNamespaceFieldStoreTests]/[method:canGenerateCodeForNamespaceFieldStore(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 70e255a1..5a63880d 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioNamespaceFieldStoreTests]/[method:canGenerateCodeForNamespaceFieldStore(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioNamespaceFieldStoreTests]/[method:canGenerateCodeForNamespaceFieldStore(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -10,7 +10,7 @@ Instructions: ( memory-load (local "namespaceValue__0") - pointer=(data-ptr "shed__namespace__Example_Project") + pointer=(data-ptr-const "shed__namespace__Example_Project") layout=data-ptr offset=() ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioNamespaceTests]/[method:canDefineNamespace(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioNamespaceTests]/[method:canDefineNamespace(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 8d1c3148..3489b77c 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioNamespaceTests]/[method:canDefineNamespace(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioNamespaceTests]/[method:canDefineNamespace(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -39,7 +39,7 @@ return-type=int body=( (call (local "gcRootStackIndex__0") "shed__runtime__gc_get_root_stack_index" ()) - (local-store (local "tmp__0") (int 0)) + (local-store (local "tmp__0") (int-const 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" ()) @@ -64,10 +64,10 @@ (struct ((struct (data-ptr int int int)) (struct (int int)))) (1) ) - (call (local "namespaceValue__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int 2))) + (call (local "namespaceValue__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int-const 2))) ( memory-store - pointer=(data-ptr "shed__namespace__An_Example") + pointer=(data-ptr-const "shed__namespace__An_Example") layout=data-ptr offset=() value=(local "namespaceValue__0") @@ -83,21 +83,21 @@ (struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct ()))))) (1 2) ) - (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__1") (local "byteOffset__1") (int 0))) + (call (local "closurePointer__f__0") "shed__runtime__gc_alloc" ((local "byteSize__1") (local "byteOffset__1") (int-const 0))) ( memory-store pointer=(local "closurePointer__f__0") layout=(struct ((struct (data-ptr int int int)) (struct (function-ptr (struct ()) (struct ()))))) offset=(1 0) - value=(function-ptr "shed__function__f__0") + value=(function-ptr-const "shed__function__f__0") ) (data-ptr-to-int (local "closure__f__0") (local "closurePointer__f__0")) ( memory-store - pointer=(data-ptr "shed__namespaceIsInited__An_Example") + pointer=(data-ptr-const "shed__namespaceIsInited__An_Example") layout=bool offset=() - value=(bool true) + value=(bool-const true) ) (return-void) ) @@ -112,7 +112,7 @@ ( memory-load (local "tmp__0") - pointer=(data-ptr "shed__namespaceIsInited__An_Example") + pointer=(data-ptr-const "shed__namespaceIsInited__An_Example") layout=bool offset=() ) @@ -137,7 +137,7 @@ ( memory-load (local "namespacePointer__0") - pointer=(data-ptr "shed__namespace__An_Example") + pointer=(data-ptr-const "shed__namespace__An_Example") layout=data-ptr offset=() ) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushBoolTests]/[method:pushBoolFalseInstructionGeneratesIntGetZeroInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushBoolTests]/[method:pushBoolFalseInstructionGeneratesIntGetZeroInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index b13fc1f7..5f3af19a 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushBoolTests]/[method:pushBoolFalseInstructionGeneratesIntGetZeroInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushBoolTests]/[method:pushBoolFalseInstructionGeneratesIntGetZeroInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -7,7 +7,7 @@ Locals: Instructions: ( - (local-store (local "tmp__0") (int 0)) + (local-store (local "tmp__0") (int-const 0)) ) Temporary stack: diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushBoolTests]/[method:pushBoolTrueInstructionGeneratesIntGetOneInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushBoolTests]/[method:pushBoolTrueInstructionGeneratesIntGetOneInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 85e4b8c2..46e3fc53 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushBoolTests]/[method:pushBoolTrueInstructionGeneratesIntGetOneInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushBoolTests]/[method:pushBoolTrueInstructionGeneratesIntGetOneInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -7,7 +7,7 @@ Locals: Instructions: ( - (local-store (local "tmp__0") (int 1)) + (local-store (local "tmp__0") (int-const 1)) ) Temporary stack: diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushIntTests]/[method:pushIntInstructionGeneratesIntGetInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushIntTests]/[method:pushIntInstructionGeneratesIntGetInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 24502c39..680f7db8 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushIntTests]/[method:pushIntInstructionGeneratesIntGetInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushIntTests]/[method:pushIntInstructionGeneratesIntGetInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -13,7 +13,7 @@ Locals: Instructions: ( - (call (local "int__0") "shed__runtime__int_create" ((int 42))) + (call (local "int__0") "shed__runtime__int_create" ((int-const 42))) ) Temporary stack: diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushStringTests]/[method:canHaveMultipleStrings(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushStringTests]/[method:canHaveMultipleStrings(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 0ef06178..0af67baa 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushStringTests]/[method:canHaveMultipleStrings(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushStringTests]/[method:canHaveMultipleStrings(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -10,8 +10,8 @@ Locals: Instructions: ( - (data-ptr-to-int (local "string__0") (data-ptr "shed__string__0")) - (data-ptr-to-int (local "string__1") (data-ptr "shed__string__1")) + (data-ptr-to-int (local "string__0") (data-ptr-const "shed__string__0")) + (data-ptr-to-int (local "string__1") (data-ptr-const "shed__string__1")) ) Temporary stack: diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushStringTests]/[method:pushStringIsCompiledToDataAndIndexToData(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushStringTests]/[method:pushStringIsCompiledToDataAndIndexToData(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 0bb00212..a90ae386 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushStringTests]/[method:pushStringIsCompiledToDataAndIndexToData(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushStringTests]/[method:pushStringIsCompiledToDataAndIndexToData(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -8,7 +8,7 @@ Locals: Instructions: ( - (data-ptr-to-int (local "string__0") (data-ptr "shed__string__0")) + (data-ptr-to-int (local "string__0") (data-ptr-const "shed__string__0")) ) Temporary stack: diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushUnitTests]/[method:pushUnitInstructionGeneratesIntGetInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushUnitTests]/[method:pushUnitInstructionGeneratesIntGetInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index b13fc1f7..5f3af19a 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushUnitTests]/[method:pushUnitInstructionGeneratesIntGetInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioPushUnitTests]/[method:pushUnitInstructionGeneratesIntGetInstruction(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -7,7 +7,7 @@ Locals: Instructions: ( - (local-store (local "tmp__0") (int 0)) + (local-store (local "tmp__0") (int-const 0)) ) Temporary stack: diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioSwitchTests]/[method:canGenerateCodeForSwitchWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioSwitchTests]/[method:canGenerateCodeForSwitchWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 0c51dc6c..6f2db02d 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioSwitchTests]/[method:canGenerateCodeForSwitchWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioSwitchTests]/[method:canGenerateCodeForSwitchWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -46,8 +46,8 @@ Instructions: ( block ( - (call (local "int__0") "shed__runtime__int_create" ((int 1))) - (call (local "int__1") "shed__runtime__int_create" ((int 2))) + (call (local "int__0") "shed__runtime__int_create" ((int-const 1))) + (call (local "int__1") "shed__runtime__int_create" ((int-const 2))) (call (local "binaryOpResult__0") "shed__runtime__int_add" ((local "int__0") (local "int__1"))) ) results=((local "binaryOpResult__0")) @@ -59,8 +59,8 @@ Instructions: ( block ( - (call (local "int__2") "shed__runtime__int_create" ((int 101))) - (call (local "int__3") "shed__runtime__int_create" ((int 102))) + (call (local "int__2") "shed__runtime__int_create" ((int-const 101))) + (call (local "int__3") "shed__runtime__int_create" ((int-const 102))) (call (local "binaryOpResult__1") "shed__runtime__int_add" ((local "int__2") (local "int__3"))) ) results=((local "binaryOpResult__1")) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTryTests]/[method:canGenerateCodeForTry(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTryTests]/[method:canGenerateCodeForTry(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index e0d7c0f6..e0515b1d 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTryTests]/[method:canGenerateCodeForTry(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTryTests]/[method:canGenerateCodeForTry(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -34,10 +34,10 @@ Locals: Instructions: ( - (call (local "effectHandler__0") "shed__runtime__effects_push_handler" ((int 0) (int 3))) - (call _ "shed__runtime__effects_set_handler_method" ((local "effectHandler__0") (int 0) (local "handlerC"))) - (call _ "shed__runtime__effects_set_handler_method" ((local "effectHandler__0") (int 1) (local "handlerA"))) - (call _ "shed__runtime__effects_set_handler_method" ((local "effectHandler__0") (int 2) (local "handlerB"))) + (call (local "effectHandler__0") "shed__runtime__effects_push_handler" ((int-const 0) (int-const 3))) + (call _ "shed__runtime__effects_set_handler_method" ((local "effectHandler__0") (int-const 0) (local "handlerC"))) + (call _ "shed__runtime__effects_set_handler_method" ((local "effectHandler__0") (int-const 1) (local "handlerA"))) + (call _ "shed__runtime__effects_set_handler_method" ((local "effectHandler__0") (int-const 2) (local "handlerB"))) ( try ((local "tmp__0")) @@ -57,7 +57,7 @@ Instructions: ( block ( - (call (local "int__0") "shed__runtime__int_create" ((int 42))) + (call (local "int__0") "shed__runtime__int_create" ((int-const 42))) (call _ "shed__runtime__effects_pop_handler" ()) ) results=((local "int__0")) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTryTests]/[method:effectHandlerIsPoppedBeforeReturn(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTryTests]/[method:effectHandlerIsPoppedBeforeReturn(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index e491da56..c568ac60 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTryTests]/[method:effectHandlerIsPoppedBeforeReturn(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTryTests]/[method:effectHandlerIsPoppedBeforeReturn(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -52,8 +52,8 @@ Locals: Instructions: ( - (call (local "effectHandler__0") "shed__runtime__effects_push_handler" ((int 0) (int 1))) - (call _ "shed__runtime__effects_set_handler_method" ((local "effectHandler__0") (int 0) (local "handlerA"))) + (call (local "effectHandler__0") "shed__runtime__effects_push_handler" ((int-const 0) (int-const 1))) + (call _ "shed__runtime__effects_set_handler_method" ((local "effectHandler__0") (int-const 0) (local "handlerA"))) ( try ((local "tmp__0")) @@ -73,7 +73,7 @@ Instructions: ( block ( - (call (local "int__0") "shed__runtime__int_create" ((int 42))) + (call (local "int__0") "shed__runtime__int_create" ((int-const 42))) (call _ "shed__runtime__effects_pop_handler" ()) (call _ "shed__runtime__gc_set_root_stack_index" ((local "gcRootStackIndex"))) (call _ "shed__runtime__gc_push_root" ((local "int__0"))) diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTupleCreateTests]/[method:canGenerateCodeForTupleCreate(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTupleCreateTests]/[method:canGenerateCodeForTupleCreate(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index 8a270308..c89cd89d 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTupleCreateTests]/[method:canGenerateCodeForTupleCreate(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTupleCreateTests]/[method:canGenerateCodeForTupleCreate(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -33,7 +33,7 @@ Instructions: (struct ((struct (data-ptr int int int)) (struct (int int int)))) (1) ) - (call (local "tuplePointer__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int 3))) + (call (local "tuplePointer__0") "shed__runtime__gc_alloc" ((local "byteSize__0") (local "byteOffset__0") (int-const 3))) ( memory-store pointer=(local "tuplePointer__0") diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTupleCreateTests]/[method:zeroElementTupleIsCreatedWithoutAlloc(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTupleCreateTests]/[method:zeroElementTupleIsCreatedWithoutAlloc(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected index b3daba7e..61409b47 100644 --- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTupleCreateTests]/[method:zeroElementTupleIsCreatedWithoutAlloc(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected +++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.shidtopatio.ShidToPatioTupleCreateTests]/[method:zeroElementTupleIsCreatedWithoutAlloc(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected @@ -7,7 +7,7 @@ Locals: Instructions: ( - (local-store (local "tuple__0") (int 0)) + (local-store (local "tuple__0") (int-const 0)) ) Temporary stack: diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java b/src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java index 7d70a90b..71212189 100644 --- a/src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java +++ b/src/main/java/org/shedlang/compiler/backends/llvm/codegen/PatioToLlvm.java @@ -1118,16 +1118,16 @@ public class PatioToLlvm { PatioToLlvmFunctionContext context ) { return switch (patioOperand) { - case PatioBool patioBool -> + case PatioBoolConst patioBoolConst -> LlvmTypes.INT_1; - case PatioDataPtr patioDataPtr -> + case PatioDataPtrConst patioDataPtrConst -> LlvmTypes.pointer(LlvmTypes.VOID); - case PatioFunctionPtr patioFunctionPtr -> + case PatioFunctionPtrConst patioFunctionPtrConst -> LlvmTypes.pointer(LlvmTypes.VOID); - case PatioInt patioInt -> + case PatioIntConst patioIntConst -> context.target().patioIntType(); case PatioLocalRef patioLocalRef -> @@ -1140,17 +1140,17 @@ public class PatioToLlvm { PatioToLlvmFunctionContext context ) { return switch (patioOperand) { - case PatioBool patioBool -> - new LlvmOperandInt(patioBool.value() ? 1 : 0); + case PatioBoolConst patioBoolConst -> + new LlvmOperandInt(patioBoolConst.value() ? 1 : 0); - case PatioDataPtr patioDataPtr -> - new LlvmVariableGlobal(patioDataPtr.name()); + case PatioDataPtrConst patioDataPtrConst -> + new LlvmVariableGlobal(patioDataPtrConst.name()); - case PatioFunctionPtr patioFunctionPtr -> - new LlvmVariableGlobal(patioFunctionPtr.name()); + case PatioFunctionPtrConst patioFunctionPtrConst -> + new LlvmVariableGlobal(patioFunctionPtrConst.name()); - case PatioInt patioInt -> - new LlvmOperandInt(patioInt.value()); + case PatioIntConst patioIntConst -> + new LlvmOperandInt(patioIntConst.value()); case PatioLocalRef patioLocalRef -> context.patioLocalToOperand(patioLocalRef); diff --git a/src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java b/src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java index fcf55e79..66519767 100644 --- a/src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java +++ b/src/main/java/org/shedlang/compiler/backends/wasm/PatioToWasm.java @@ -554,19 +554,19 @@ public class PatioToWasm { Context context ) { return switch (patioOperand) { - case PatioBool patioBool -> - context.addInstruction(new WasmI32Const(patioBool.value() ? 1 : 0)); + case PatioBoolConst patioBoolConst -> + context.addInstruction(new WasmI32Const(patioBoolConst.value() ? 1 : 0)); - case PatioDataPtr patioDataPtr -> { - var wasmMemoryAddress = new WasmMemoryAddress(patioDataPtr.name()); + case PatioDataPtrConst patioDataPtrConst -> { + var wasmMemoryAddress = new WasmMemoryAddress(patioDataPtrConst.name()); yield context.addInstruction(new WasmMemoryAddressConst( context.target.indexType(), wasmMemoryAddress )); } - case PatioFunctionPtr patioFunctionPtr -> { - var wasmFuncName = new WasmFuncName(patioFunctionPtr.name()); + case PatioFunctionPtrConst patioFunctionPtrConst -> { + var wasmFuncName = new WasmFuncName(patioFunctionPtrConst.name()); context = context .addInstruction(new WasmTableElementIndexConst(wasmFuncName)); @@ -577,10 +577,10 @@ public class PatioToWasm { yield context; } - case PatioInt patioInt -> + case PatioIntConst patioIntConst -> context.addInstruction(wasmIntConst( context.target.patioIntType(), - patioInt.value() + patioIntConst.value() )); case PatioLocalRef patioLocalRef -> { @@ -752,13 +752,13 @@ public class PatioToWasm { ) { // TODO: push into PatioOperand? return switch (operand) { - case PatioBool patioBool -> + case PatioBoolConst patioBoolConst -> patioTypeToWasmValueType(PatioTypes.BOOL, context.target); - case PatioDataPtr patioDataPtr -> + case PatioDataPtrConst patioDataPtrConst -> patioTypeToWasmValueType(PatioTypes.DATA_POINTER, context.target); - case PatioFunctionPtr patioFunctionPtr -> + case PatioFunctionPtrConst patioFunctionPtrConst -> patioTypeToWasmValueType(PatioTypes.FUNCTION_POINTER, context.target); - case PatioInt patioInt -> + case PatioIntConst patioIntConst -> patioTypeToWasmValueType(PatioTypes.INT, context.target); case PatioLocalRef patioLocalRef -> context.wasmLocalType(patioLocalRef); diff --git a/src/main/java/org/shedlang/compiler/patio/PatioSerializer.java b/src/main/java/org/shedlang/compiler/patio/PatioSerializer.java index 3203993b..c770cd21 100644 --- a/src/main/java/org/shedlang/compiler/patio/PatioSerializer.java +++ b/src/main/java/org/shedlang/compiler/patio/PatioSerializer.java @@ -421,17 +421,17 @@ public class PatioSerializer { private static Tree operandToTree(PatioOperand operand) { return switch (operand) { - case PatioBool bool -> - treeList(treeIdentifier("bool"), treeBool(bool.value())); + case PatioBoolConst bool -> + treeList(treeIdentifier("bool-const"), treeBool(bool.value())); - case PatioDataPtr dataPtr -> - treeList(treeIdentifier("data-ptr"), treeString(dataPtr.name())); + case PatioDataPtrConst dataPtr -> + treeList(treeIdentifier("data-ptr-const"), treeString(dataPtr.name())); - case PatioFunctionPtr functionPtr -> - treeList(treeIdentifier("function-ptr"), treeString(functionPtr.name())); + case PatioFunctionPtrConst functionPtr -> + treeList(treeIdentifier("function-ptr-const"), treeString(functionPtr.name())); - case PatioInt int_ -> - treeList(treeIdentifier("int"), treeInt(int_.value())); + case PatioIntConst int_ -> + treeList(treeIdentifier("int-const"), treeInt(int_.value())); case PatioLocalRef localRef -> treeList(treeIdentifier("local"), treeString(localRef.name())); diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioBool.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioBool.java deleted file mode 100644 index 769667c1..00000000 --- a/src/main/java/org/shedlang/compiler/patio/operands/PatioBool.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.shedlang.compiler.patio.operands; - -public record PatioBool(boolean value) implements PatioOperand { -} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioBoolConst.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioBoolConst.java new file mode 100644 index 00000000..eadb7e1c --- /dev/null +++ b/src/main/java/org/shedlang/compiler/patio/operands/PatioBoolConst.java @@ -0,0 +1,4 @@ +package org.shedlang.compiler.patio.operands; + +public record PatioBoolConst(boolean value) implements PatioOperand { +} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtr.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtr.java deleted file mode 100644 index 9907733b..00000000 --- a/src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtr.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.shedlang.compiler.patio.operands; - -public record PatioDataPtr(String name) implements PatioOperand { -} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtrConst.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtrConst.java new file mode 100644 index 00000000..3899b380 --- /dev/null +++ b/src/main/java/org/shedlang/compiler/patio/operands/PatioDataPtrConst.java @@ -0,0 +1,4 @@ +package org.shedlang.compiler.patio.operands; + +public record PatioDataPtrConst(String name) implements PatioOperand { +} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtr.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtr.java deleted file mode 100644 index b025089e..00000000 --- a/src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtr.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.shedlang.compiler.patio.operands; - -public record PatioFunctionPtr(String name) implements PatioOperand { -} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtrConst.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtrConst.java new file mode 100644 index 00000000..2457163f --- /dev/null +++ b/src/main/java/org/shedlang/compiler/patio/operands/PatioFunctionPtrConst.java @@ -0,0 +1,4 @@ +package org.shedlang.compiler.patio.operands; + +public record PatioFunctionPtrConst(String name) implements PatioOperand { +} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioInt.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioInt.java deleted file mode 100644 index 4191def2..00000000 --- a/src/main/java/org/shedlang/compiler/patio/operands/PatioInt.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.shedlang.compiler.patio.operands; - -public record PatioInt(int value) implements PatioOperand { -} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioIntConst.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioIntConst.java new file mode 100644 index 00000000..d7734096 --- /dev/null +++ b/src/main/java/org/shedlang/compiler/patio/operands/PatioIntConst.java @@ -0,0 +1,4 @@ +package org.shedlang.compiler.patio.operands; + +public record PatioIntConst(int value) implements PatioOperand { +} diff --git a/src/main/java/org/shedlang/compiler/patio/operands/PatioOperand.java b/src/main/java/org/shedlang/compiler/patio/operands/PatioOperand.java index 3bd1849c..17ffb0e4 100644 --- a/src/main/java/org/shedlang/compiler/patio/operands/PatioOperand.java +++ b/src/main/java/org/shedlang/compiler/patio/operands/PatioOperand.java @@ -1,5 +1,5 @@ package org.shedlang.compiler.patio.operands; -public sealed interface PatioOperand permits PatioBool, PatioDataPtr, PatioFunctionPtr, PatioInt, PatioLocalRef { +public sealed interface PatioOperand permits PatioBoolConst, PatioDataPtrConst, PatioFunctionPtrConst, PatioIntConst, PatioLocalRef { } diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java index 66d9c3be..438ebac3 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatio.java @@ -3,7 +3,7 @@ package org.shedlang.compiler.shidtopatio; import org.shedlang.compiler.patio.PatioCompilationUnit; import org.shedlang.compiler.patio.PatioVisibility; import org.shedlang.compiler.patio.instructions.*; -import org.shedlang.compiler.patio.operands.PatioInt; +import org.shedlang.compiler.patio.operands.PatioIntConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioTypes; @@ -1008,7 +1008,7 @@ public class ShidToPatio { context = localResult.context(); return context - .addInstruction(new PatioLocalStore(local, new PatioInt(value), source)) + .addInstruction(new PatioLocalStore(local, new PatioIntConst(value), source)) .temporaryPush(local); } } diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java index 43b19744..b1d40a87 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioClosures.java @@ -4,7 +4,7 @@ import org.shedlang.compiler.ast.typed.FreeVariable; import org.shedlang.compiler.ast.typed.FreeVariables; import org.shedlang.compiler.patio.PatioVisibility; import org.shedlang.compiler.patio.instructions.*; -import org.shedlang.compiler.patio.operands.PatioFunctionPtr; +import org.shedlang.compiler.patio.operands.PatioFunctionPtrConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioDataLayout; @@ -176,7 +176,7 @@ class ShidToPatioClosures { closurePointer, layout, FUNCTION_POINTER_OFFSET, - new PatioFunctionPtr(functionName), + new PatioFunctionPtrConst(functionName), source )); diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java index fb113850..51f198e3 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioEffects.java @@ -5,7 +5,7 @@ import org.shedlang.compiler.patio.PatioExceptionTypeDefinition; import org.shedlang.compiler.patio.PatioFunctionDeclaration; import org.shedlang.compiler.patio.PatioLocal; import org.shedlang.compiler.patio.instructions.*; -import org.shedlang.compiler.patio.operands.PatioInt; +import org.shedlang.compiler.patio.operands.PatioIntConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioDataLayout; @@ -187,8 +187,8 @@ public class ShidToPatioEffects { Optional.of(handlerMethod), FIND_HANDLER_METHOD_DECLARATION.name(), List.of( - new PatioInt(bodyContext.effectTag(effect)), - new PatioInt(method.fieldIndex()) + new PatioIntConst(bodyContext.effectTag(effect)), + new PatioIntConst(method.fieldIndex()) ), source )); @@ -307,8 +307,8 @@ public class ShidToPatioEffects { Optional.of(effectHandler), PUSH_HANDLER_DECLARATION.name(), List.of( - new PatioInt(context.effectTag(effect)), - new PatioInt(effectInfo.methodCount()) + new PatioIntConst(context.effectTag(effect)), + new PatioIntConst(effectInfo.methodCount()) ), source )); @@ -319,7 +319,7 @@ public class ShidToPatioEffects { SET_HANDLER_METHOD_DECLARATION.name(), List.of( effectHandler, - new PatioInt(handlerMethodInfo.fieldIndex()), + new PatioIntConst(handlerMethodInfo.fieldIndex()), handlerMethodsByName.get(handlerMethodInfo.name()) ), source diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java index 8dd36463..32971b8b 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioGc.java @@ -5,7 +5,7 @@ import org.shedlang.compiler.patio.PatioLocal; import org.shedlang.compiler.patio.instructions.PatioByteOffsetOf; import org.shedlang.compiler.patio.instructions.PatioByteSizeOf; import org.shedlang.compiler.patio.instructions.PatioCall; -import org.shedlang.compiler.patio.operands.PatioInt; +import org.shedlang.compiler.patio.operands.PatioIntConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.*; @@ -164,7 +164,7 @@ public class ShidToPatioGc { return context.addInstruction(new PatioCall( Optional.of(destination), ALLOC.name(), - List.of(size, offset, new PatioInt(childrenCount)), + List.of(size, offset, new PatioIntConst(childrenCount)), source )); } diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java index 77dada45..fee88bec 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioInts.java @@ -3,7 +3,7 @@ package org.shedlang.compiler.shidtopatio; import org.shedlang.compiler.patio.PatioFunctionDeclaration; import org.shedlang.compiler.patio.PatioLocal; import org.shedlang.compiler.patio.instructions.PatioCall; -import org.shedlang.compiler.patio.operands.PatioInt; +import org.shedlang.compiler.patio.operands.PatioIntConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioType; @@ -81,7 +81,7 @@ public class ShidToPatioInts { .addInstruction(new PatioCall( Optional.of(destination), INT_CREATE_DECLARATION.name(), - List.of(new PatioInt(value.intValueExact())), + List.of(new PatioIntConst(value.intValueExact())), source )); } diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java index c12a25bb..913bb966 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioNamespaces.java @@ -3,8 +3,8 @@ package org.shedlang.compiler.shidtopatio; import org.shedlang.compiler.patio.PatioFunctionDeclaration; import org.shedlang.compiler.patio.PatioVisibility; import org.shedlang.compiler.patio.instructions.*; -import org.shedlang.compiler.patio.operands.PatioBool; -import org.shedlang.compiler.patio.operands.PatioDataPtr; +import org.shedlang.compiler.patio.operands.PatioBoolConst; +import org.shedlang.compiler.patio.operands.PatioDataPtrConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.*; @@ -66,7 +66,7 @@ public class ShidToPatioNamespaces { ); initContext = initContext.addInstruction(new PatioMemoryStore( - new PatioDataPtr(globalNameNamespaceValue(namespaceName)), + new PatioDataPtrConst(globalNameNamespaceValue(namespaceName)), PatioDataLayouts.DATA_POINTER, List.of(), namespaceValue, @@ -76,10 +76,10 @@ public class ShidToPatioNamespaces { initContext = generateInitBody.apply(initContext); initContext = initContext.addInstruction(new PatioMemoryStore( - new PatioDataPtr(globalNameNamespaceIsInited(namespaceName)), + new PatioDataPtrConst(globalNameNamespaceIsInited(namespaceName)), PatioDataLayouts.BOOL, List.of(), - new PatioBool(true), + new PatioBoolConst(true), source )); @@ -104,7 +104,7 @@ public class ShidToPatioNamespaces { importContext = importContext.addInstruction(new PatioMemoryLoad( isInited, - new PatioDataPtr(globalNameNamespaceIsInited(namespaceName)), + new PatioDataPtrConst(globalNameNamespaceIsInited(namespaceName)), PatioDataLayouts.BOOL, List.of(), source @@ -142,7 +142,7 @@ public class ShidToPatioNamespaces { importContext = importContext.addInstruction(new PatioMemoryLoad( namespaceValuePointer, - new PatioDataPtr(globalNameNamespaceValue(namespaceName)), + new PatioDataPtrConst(globalNameNamespaceValue(namespaceName)), PatioDataLayouts.DATA_POINTER, List.of(), source @@ -251,7 +251,7 @@ public class ShidToPatioNamespaces { context = context.addInstruction(new PatioMemoryLoad( namespaceValue, - new PatioDataPtr(globalNameNamespaceValue(namespaceName)), + new PatioDataPtrConst(globalNameNamespaceValue(namespaceName)), PatioDataLayouts.DATA_POINTER, List.of(), source diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java index af037ae6..a1c7d9bf 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStrings.java @@ -4,7 +4,7 @@ import org.shedlang.compiler.patio.PatioDataElementImmutable; import org.shedlang.compiler.patio.PatioFunctionDeclaration; import org.shedlang.compiler.patio.PatioLocal; import org.shedlang.compiler.patio.instructions.PatioCall; -import org.shedlang.compiler.patio.operands.PatioDataPtr; +import org.shedlang.compiler.patio.operands.PatioDataPtrConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioDataLayouts; @@ -31,7 +31,7 @@ public class ShidToPatioStrings { private ShidToPatioStrings() {} - public static ShidToPatioResult define( + public static ShidToPatioResult define( String value, Source source, ShidToPatioContext context @@ -60,7 +60,7 @@ public class ShidToPatioStrings { source )); - return context.toResult(new PatioDataPtr(elementName)); + return context.toResult(new PatioDataPtrConst(elementName)); } public static ShidToPatioContext add( diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java index 7146320d..0e36f05c 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioStructs.java @@ -2,7 +2,7 @@ package org.shedlang.compiler.shidtopatio; import org.shedlang.compiler.ast.typed.FreeVariables; import org.shedlang.compiler.patio.instructions.*; -import org.shedlang.compiler.patio.operands.PatioInt; +import org.shedlang.compiler.patio.operands.PatioIntConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioDataLayout; @@ -59,7 +59,7 @@ public class ShidToPatioStructs { valuePointer, structDataLayout, TAG_OFFSET, - new PatioInt(context.structTag(type)), + new PatioIntConst(context.structTag(type)), source )); diff --git a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java index acf24c08..e86bc366 100644 --- a/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java +++ b/src/main/java/org/shedlang/compiler/shidtopatio/ShidToPatioTuples.java @@ -1,7 +1,7 @@ package org.shedlang.compiler.shidtopatio; import org.shedlang.compiler.patio.instructions.*; -import org.shedlang.compiler.patio.operands.PatioInt; +import org.shedlang.compiler.patio.operands.PatioIntConst; import org.shedlang.compiler.patio.operands.PatioLocalRef; import org.shedlang.compiler.patio.operands.PatioOperand; import org.shedlang.compiler.patio.types.PatioDataLayout; @@ -31,7 +31,7 @@ public class ShidToPatioTuples { if (elements.size() == 0) { context = context.addInstruction(new PatioLocalStore( tuple, - new PatioInt(0), + new PatioIntConst(0), source )); diff --git a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java index 3b894f3a..6a5545ab 100644 --- a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java +++ b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java @@ -31,7 +31,7 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("x", PatioTypes.INT)) .addBodyInstruction(Patio.memoryLoad( Patio.localRef("x"), - Patio.dataPtr("answer"), + Patio.dataPtrConst("answer"), PatioDataLayouts.INT, List.of() )) @@ -66,7 +66,7 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("x", PatioTypes.INT)) .addBodyInstruction(Patio.memoryLoad( Patio.localRef("x"), - Patio.dataPtr("answer"), + Patio.dataPtrConst("answer"), PatioDataLayouts.struct(List.of( PatioDataLayouts.INT, PatioDataLayouts.INT, @@ -102,7 +102,7 @@ public abstract class PatioExampleTests { Patio.localRef("x"), PatioDataLayouts.INT, List.of(), - Patio.int_(42) + Patio.intConst(42) )) .addBodyInstruction(Patio.memoryLoad( Patio.localRef("y"), @@ -113,7 +113,7 @@ public abstract class PatioExampleTests { .addBodyInstruction(Patio.intAdd( Patio.localRef("z"), Patio.localRef("y"), - Patio.int_(5) + Patio.intConst(5) )) .addBodyInstruction(Patio.memoryStore( Patio.localRef("x"), @@ -148,7 +148,7 @@ public abstract class PatioExampleTests { List.of( Patio.localStore( Patio.localRef("x"), - Patio.int_(42) + Patio.intConst(42) ) ), List.of(Patio.localRef("x")) @@ -173,7 +173,7 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("r", PatioTypes.INT)) .addBodyInstruction(Patio.localStore( Patio.localRef("x"), - Patio.bool(false) + Patio.boolConst(false) )) .addBodyInstruction(Patio.boolToInt( Patio.localRef("y"), @@ -186,8 +186,8 @@ public abstract class PatioExampleTests { .addBodyInstruction(Patio.if_( List.of(Patio.localRef("r")), Patio.localRef("z"), - Patio.block(List.of(), List.of(Patio.int_(42))), - Patio.block(List.of(), List.of(Patio.int_(47))) + Patio.block(List.of(), List.of(Patio.intConst(42))), + Patio.block(List.of(), List.of(Patio.intConst(47))) )) .addBodyInstruction(Patio.return_(Patio.localRef("r"))) .build(); @@ -209,7 +209,7 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("r", PatioTypes.INT)) .addBodyInstruction(Patio.localStore( Patio.localRef("x"), - Patio.bool(true) + Patio.boolConst(true) )) .addBodyInstruction(Patio.boolToInt( Patio.localRef("y"), @@ -222,8 +222,8 @@ public abstract class PatioExampleTests { .addBodyInstruction(Patio.if_( List.of(Patio.localRef("r")), Patio.localRef("z"), - Patio.block(List.of(), List.of(Patio.int_(42))), - Patio.block(List.of(), List.of(Patio.int_(47))) + Patio.block(List.of(), List.of(Patio.intConst(42))), + Patio.block(List.of(), List.of(Patio.intConst(47))) )) .addBodyInstruction(Patio.return_(Patio.localRef("r"))) .build(); @@ -244,11 +244,11 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("z", PatioTypes.INT)) .addBodyInstruction(Patio.localStore( Patio.localRef("x"), - Patio.int_(42) + Patio.intConst(42) )) .addBodyInstruction(Patio.localStore( Patio.localRef("y"), - Patio.int_(5) + Patio.intConst(5) )) .addBodyInstruction(Patio.intAdd( Patio.localRef("z"), @@ -274,13 +274,13 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("x2", PatioTypes.INT)) .addBodyInstruction(Patio.switch_( List.of(Patio.localRef("x")), - Patio.int_(2), + Patio.intConst(2), List.of( Patio.switchCase( 1, Patio.block( List.of( - Patio.localStore(Patio.localRef("x1"), Patio.int_(42)) + Patio.localStore(Patio.localRef("x1"), Patio.intConst(42)) ), List.of(Patio.localRef("x1")) ) @@ -289,7 +289,7 @@ public abstract class PatioExampleTests { 2, Patio.block( List.of( - Patio.localStore(Patio.localRef("x2"), Patio.int_(47)) + Patio.localStore(Patio.localRef("x2"), Patio.intConst(47)) ), List.of(Patio.localRef("x2")) ) @@ -319,13 +319,13 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("x2", PatioTypes.INT)) .addBodyInstruction(Patio.switch_( List.of(Patio.localRef("x")), - Patio.int_(2), + Patio.intConst(2), List.of( Patio.switchCase( 1, Patio.block( List.of( - Patio.localStore(Patio.localRef("x1"), Patio.int_(42)) + Patio.localStore(Patio.localRef("x1"), Patio.intConst(42)) ), List.of(Patio.localRef("x1")) ) @@ -333,7 +333,7 @@ public abstract class PatioExampleTests { ), Patio.block( List.of( - Patio.localStore(Patio.localRef("x2"), Patio.int_(47)) + Patio.localStore(Patio.localRef("x2"), Patio.intConst(47)) ), List.of(Patio.localRef("x2")) ) @@ -364,13 +364,13 @@ public abstract class PatioExampleTests { Patio.localRef("e1"), Patio.block( List.of(), - List.of(Patio.int_(1)) + List.of(Patio.intConst(1)) ) ) ), Patio.block( List.of(), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) )) .addBodyInstruction(Patio.return_( @@ -404,7 +404,7 @@ public abstract class PatioExampleTests { Patio.localRef("e1"), Patio.block( List.of(), - List.of(Patio.int_(1)) + List.of(Patio.intConst(1)) ) ) ), @@ -418,15 +418,15 @@ public abstract class PatioExampleTests { Patio.localRef("e2"), Patio.block( List.of(), - List.of(Patio.int_(2)) + List.of(Patio.intConst(2)) ) ) ), Patio.block( List.of( - Patio.throw_("Error", Patio.int_(0)) + Patio.throw_("Error", Patio.intConst(0)) ), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) ) ), @@ -464,7 +464,7 @@ public abstract class PatioExampleTests { Patio.localRef("e2"), Patio.block( List.of(), - List.of(Patio.int_(1)) + List.of(Patio.intConst(1)) ) ), Patio.catchClause( @@ -472,15 +472,15 @@ public abstract class PatioExampleTests { Patio.localRef("e2"), Patio.block( List.of(), - List.of(Patio.int_(2)) + List.of(Patio.intConst(2)) ) ) ), Patio.block( List.of( - Patio.throw_("Error2", Patio.int_(0)) + Patio.throw_("Error2", Patio.intConst(0)) ), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) )) .addBodyInstruction(Patio.return_( @@ -515,7 +515,7 @@ public abstract class PatioExampleTests { Patio.localRef("e1"), Patio.block( List.of(), - List.of(Patio.int_(1)) + List.of(Patio.intConst(1)) ) ) ), @@ -529,15 +529,15 @@ public abstract class PatioExampleTests { Patio.localRef("e2"), Patio.block( List.of(), - List.of(Patio.int_(2)) + List.of(Patio.intConst(2)) ) ) ), Patio.block( List.of( - Patio.throw_("Error", Patio.int_(0)) + Patio.throw_("Error", Patio.intConst(0)) ), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) ) ), @@ -576,7 +576,7 @@ public abstract class PatioExampleTests { Patio.localRef("e1"), Patio.block( List.of(), - List.of(Patio.int_(1)) + List.of(Patio.intConst(1)) ) ) ), @@ -590,17 +590,17 @@ public abstract class PatioExampleTests { Patio.localRef("e2"), Patio.block( List.of( - Patio.throw_("Error", Patio.int_(0)) + Patio.throw_("Error", Patio.intConst(0)) ), - List.of(Patio.int_(2)) + List.of(Patio.intConst(2)) ) ) ), Patio.block( List.of( - Patio.throw_("Error", Patio.int_(0)) + Patio.throw_("Error", Patio.intConst(0)) ), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) ) ), @@ -638,7 +638,7 @@ public abstract class PatioExampleTests { Patio.localRef("e1"), Patio.block( List.of(), - List.of(Patio.int_(1)) + List.of(Patio.intConst(1)) ) ) ), @@ -652,16 +652,16 @@ public abstract class PatioExampleTests { Patio.localRef("e2"), Patio.block( List.of(), - List.of(Patio.int_(2)) + List.of(Patio.intConst(2)) ) ) ), Patio.block( List.of(), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) ), - Patio.throw_("Error", Patio.int_(0)) + Patio.throw_("Error", Patio.intConst(0)) ), List.of(Patio.localRef("r2")) ) @@ -701,9 +701,9 @@ public abstract class PatioExampleTests { ), Patio.block( List.of( - Patio.throw_("Error", Patio.int_(1)) + Patio.throw_("Error", Patio.intConst(1)) ), - List.of(Patio.int_(0)) + List.of(Patio.intConst(0)) ) )) .addBodyInstruction(Patio.return_( @@ -731,7 +731,7 @@ public abstract class PatioExampleTests { .addLocal(Patio.val("r", PatioTypes.INT)) .addBodyInstruction(Patio.varStore( Patio.localRef("x"), - Patio.int_(42) + Patio.intConst(42) )) .addBodyInstruction(Patio.varLoad( Patio.localRef("y"), @@ -740,7 +740,7 @@ public abstract class PatioExampleTests { .addBodyInstruction(Patio.intAdd( Patio.localRef("z"), Patio.localRef("y"), - Patio.int_(5) + Patio.intConst(5) )) .addBodyInstruction(Patio.varStore( Patio.localRef("x"), diff --git a/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java b/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java index 071007f9..a1be788c 100644 --- a/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java +++ b/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java @@ -112,7 +112,7 @@ public class PatioSerializerTests { .addLocal(Patio.val("local1", PatioTypes.FUNCTION_POINTER)) .addLocal(Patio.val("local2", PatioTypes.INT)) .withReturnType(PatioTypes.VOID) - .addBodyInstruction(Patio.localStore(Patio.localRef("local2"), Patio.int_(2))) + .addBodyInstruction(Patio.localStore(Patio.localRef("local2"), Patio.intConst(2))) .build(); var string = PatioTesting.serializeCompilationUnitElement(element); @@ -125,7 +125,7 @@ public class PatioSerializerTests { locals=((param "param1" int) (param "param2" data-ptr) (val "local1" function-ptr) (val "local2" int)) return-type=void body=( - (local-store (local "local2") (int 2)) + (local-store (local "local2") (int-const 2)) ) )""" )); @@ -149,8 +149,8 @@ public class PatioSerializerTests { public void canSerializeBlock() { var instruction = Patio.block( List.of( - Patio.localStore(Patio.localRef("x1"), Patio.int_(1)), - Patio.localStore(Patio.localRef("y1"), Patio.int_(2)) + Patio.localStore(Patio.localRef("x1"), Patio.intConst(1)), + Patio.localStore(Patio.localRef("y1"), Patio.intConst(2)) ), List.of( Patio.localRef("x1"), @@ -164,8 +164,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "x1") (int 1)) - (local-store (local "y1") (int 2)) + (local-store (local "x1") (int-const 1)) + (local-store (local "y1") (int-const 2)) ) results=((local "x1") (local "y1")) )""")); @@ -290,8 +290,8 @@ public class PatioSerializerTests { Patio.localRef("condition"), Patio.block( List.of( - Patio.localStore(Patio.localRef("x1"), Patio.int_(1)), - Patio.localStore(Patio.localRef("y1"), Patio.int_(2)) + Patio.localStore(Patio.localRef("x1"), Patio.intConst(1)), + Patio.localStore(Patio.localRef("y1"), Patio.intConst(2)) ), List.of( Patio.localRef("x1"), @@ -300,8 +300,8 @@ public class PatioSerializerTests { ), Patio.block( List.of( - Patio.localStore(Patio.localRef("x2"), Patio.int_(11)), - Patio.localStore(Patio.localRef("y2"), Patio.int_(12)) + Patio.localStore(Patio.localRef("x2"), Patio.intConst(11)), + Patio.localStore(Patio.localRef("y2"), Patio.intConst(12)) ), List.of( Patio.localRef("x2"), @@ -320,16 +320,16 @@ public class PatioSerializerTests { ( block ( - (local-store (local "x1") (int 1)) - (local-store (local "y1") (int 2)) + (local-store (local "x1") (int-const 1)) + (local-store (local "y1") (int-const 2)) ) results=((local "x1") (local "y1")) ) ( block ( - (local-store (local "x2") (int 11)) - (local-store (local "y2") (int 12)) + (local-store (local "x2") (int-const 11)) + (local-store (local "y2") (int-const 12)) ) results=((local "x2") (local "y2")) ) @@ -433,7 +433,7 @@ public class PatioSerializerTests { public void canSerializeLoop() { var instruction = Patio.loop( List.of( - Patio.localStore(Patio.localRef("x"), Patio.int_(1)) + Patio.localStore(Patio.localRef("x"), Patio.intConst(1)) ) ); @@ -443,7 +443,7 @@ public class PatioSerializerTests { ( loop ( - (local-store (local "x") (int 1)) + (local-store (local "x") (int-const 1)) ) )""")); } @@ -550,8 +550,8 @@ public class PatioSerializerTests { 1, Patio.block( List.of( - Patio.localStore(Patio.localRef("x1"), Patio.int_(11)), - Patio.localStore(Patio.localRef("y1"), Patio.int_(12)) + Patio.localStore(Patio.localRef("x1"), Patio.intConst(11)), + Patio.localStore(Patio.localRef("y1"), Patio.intConst(12)) ), List.of( Patio.localRef("x1"), @@ -563,8 +563,8 @@ public class PatioSerializerTests { 2, Patio.block( List.of( - Patio.localStore(Patio.localRef("x2"), Patio.int_(21)), - Patio.localStore(Patio.localRef("y2"), Patio.int_(22)) + Patio.localStore(Patio.localRef("x2"), Patio.intConst(21)), + Patio.localStore(Patio.localRef("y2"), Patio.intConst(22)) ), List.of( Patio.localRef("x2"), @@ -575,8 +575,8 @@ public class PatioSerializerTests { ), Patio.block( List.of( - Patio.localStore(Patio.localRef("x3"), Patio.int_(31)), - Patio.localStore(Patio.localRef("y3"), Patio.int_(32)) + Patio.localStore(Patio.localRef("x3"), Patio.intConst(31)), + Patio.localStore(Patio.localRef("y3"), Patio.intConst(32)) ), List.of( Patio.localRef("x3"), @@ -599,8 +599,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "x1") (int 11)) - (local-store (local "y1") (int 12)) + (local-store (local "x1") (int-const 11)) + (local-store (local "y1") (int-const 12)) ) results=((local "x1") (local "y1")) ) @@ -611,8 +611,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "x2") (int 21)) - (local-store (local "y2") (int 22)) + (local-store (local "x2") (int-const 21)) + (local-store (local "y2") (int-const 22)) ) results=((local "x2") (local "y2")) ) @@ -621,8 +621,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "x3") (int 31)) - (local-store (local "y3") (int 32)) + (local-store (local "x3") (int-const 31)) + (local-store (local "y3") (int-const 32)) ) results=((local "x3") (local "y3")) ) @@ -649,8 +649,8 @@ public class PatioSerializerTests { Patio.localRef("a1"), Patio.block( List.of( - Patio.localStore(Patio.localRef("xCatch1"), Patio.int_(11)), - Patio.localStore(Patio.localRef("yCatch1"), Patio.int_(12)) + Patio.localStore(Patio.localRef("xCatch1"), Patio.intConst(11)), + Patio.localStore(Patio.localRef("yCatch1"), Patio.intConst(12)) ), List.of(Patio.localRef("xCatch1"), Patio.localRef("yCatch1")) ) @@ -660,8 +660,8 @@ public class PatioSerializerTests { Patio.localRef("a2"), Patio.block( List.of( - Patio.localStore(Patio.localRef("xCatch2"), Patio.int_(21)), - Patio.localStore(Patio.localRef("yCatch2"), Patio.int_(22)) + Patio.localStore(Patio.localRef("xCatch2"), Patio.intConst(21)), + Patio.localStore(Patio.localRef("yCatch2"), Patio.intConst(22)) ), List.of(Patio.localRef("xCatch2"), Patio.localRef("yCatch2")) ) @@ -669,8 +669,8 @@ public class PatioSerializerTests { ), Patio.block( List.of( - Patio.localStore(Patio.localRef("xTry"), Patio.int_(31)), - Patio.localStore(Patio.localRef("yTry"), Patio.int_(32)) + Patio.localStore(Patio.localRef("xTry"), Patio.intConst(31)), + Patio.localStore(Patio.localRef("yTry"), Patio.intConst(32)) ), List.of(Patio.localRef("xTry"), Patio.localRef("yTry")) ) @@ -690,8 +690,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "xCatch1") (int 11)) - (local-store (local "yCatch1") (int 12)) + (local-store (local "xCatch1") (int-const 11)) + (local-store (local "yCatch1") (int-const 12)) ) results=((local "xCatch1") (local "yCatch1")) ) @@ -703,8 +703,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "xCatch2") (int 21)) - (local-store (local "yCatch2") (int 22)) + (local-store (local "xCatch2") (int-const 21)) + (local-store (local "yCatch2") (int-const 22)) ) results=((local "xCatch2") (local "yCatch2")) ) @@ -713,8 +713,8 @@ public class PatioSerializerTests { ( block ( - (local-store (local "xTry") (int 31)) - (local-store (local "yTry") (int 32)) + (local-store (local "xTry") (int-const 31)) + (local-store (local "yTry") (int-const 32)) ) results=((local "xTry") (local "yTry")) ) @@ -757,39 +757,39 @@ public class PatioSerializerTests { // == Operands == @Test - public void canSerializeBool() { - var operand = Patio.bool(true); + public void canSerializeBoolConst() { + var operand = Patio.boolConst(true); var string = PatioTesting.serializeOperand(operand); - assertThat(string, equalTo("(bool true)")); + assertThat(string, equalTo("(bool-const true)")); } @Test - public void canSerializeDataPtr() { - var operand = Patio.dataPtr("x"); + public void canSerializeDataPtrConst() { + var operand = Patio.dataPtrConst("x"); var string = PatioTesting.serializeOperand(operand); - assertThat(string, equalTo("(data-ptr \"x\")")); + assertThat(string, equalTo("(data-ptr-const \"x\")")); } @Test - public void canSerializeFunctionPtr() { - var operand = Patio.functionPtr("x"); + public void canSerializeFunctionPtrConst() { + var operand = Patio.functionPtrConst("x"); var string = PatioTesting.serializeOperand(operand); - assertThat(string, equalTo("(function-ptr \"x\")")); + assertThat(string, equalTo("(function-ptr-const \"x\")")); } @Test - public void canSerializeInt() { - var operand = Patio.int_(42); + public void canSerializeIntConst() { + var operand = Patio.intConst(42); var string = PatioTesting.serializeOperand(operand); - assertThat(string, equalTo("(int 42)")); + assertThat(string, equalTo("(int-const 42)")); } @Test diff --git a/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java b/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java index 49f35768..68bba360 100644 --- a/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java +++ b/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java @@ -24,8 +24,8 @@ public class Patio { return new PatioBlock(body, results, Sources.NULL); } - public static PatioOperand bool(boolean value) { - return new PatioBool(value); + public static PatioOperand boolConst(boolean value) { + return new PatioBoolConst(value); } public static PatioInstruction boolToInt(PatioLocalRef destination, PatioOperand value) { @@ -115,8 +115,8 @@ public class Patio { return new PatioDataElementMutable(name, initialValue, Sources.NULL); } - public static PatioOperand dataPtr(String name) { - return new PatioDataPtr(name); + public static PatioOperand dataPtrConst(String name) { + return new PatioDataPtrConst(name); } public static PatioInstruction dataPtrToInt(PatioLocalRef destination, PatioOperand value) { @@ -131,8 +131,8 @@ public class Patio { return new PatioExceptionTypeDefinition(name, valueType, Sources.NULL); } - public static PatioOperand functionPtr(String name) { - return new PatioFunctionPtr(name); + public static PatioOperand functionPtrConst(String name) { + return new PatioFunctionPtrConst(name); } public static PatioInstruction if_( @@ -150,8 +150,8 @@ public class Patio { ); } - public static PatioOperand int_(int value) { - return new PatioInt(value); + public static PatioOperand intConst(int value) { + return new PatioIntConst(value); } public static PatioInstruction intAdd( diff --git a/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioDefineFunctionTests.java b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioDefineFunctionTests.java index 797a8442..2bd24199 100644 --- a/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioDefineFunctionTests.java +++ b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioDefineFunctionTests.java @@ -86,9 +86,9 @@ public class ShidToPatioDefineFunctionTests { // free variables so we can distinguish the free variable being copied // into the closure upon closure creation (i.e. too soon) versus after // the free variable is set. - context = context.addInstruction(Patio.localStore(Patio.localRef("a"), Patio.int_(42))); + context = context.addInstruction(Patio.localStore(Patio.localRef("a"), Patio.intConst(42))); context = context.initShidLocal("a"); - context = context.addInstruction(Patio.localStore(Patio.localRef("b"), Patio.int_(47))); + context = context.addInstruction(Patio.localStore(Patio.localRef("b"), Patio.intConst(47))); context = context.initShidLocal("b"); snapshotter.assertSnapshot(serialize(context)); -- cgit v1.2.3