Skip to content

Commit 98c0544

Browse files
committed
Force EXIT to not be optimized.
1 parent 2fe3e3d commit 98c0544

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/forth/primitive.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,8 +1146,12 @@ func PrimitiveSetup(vm *VirtualMachine) error {
11461146
"ld r2, r1, 0", // load the return address
11471147
"sub r1, r1, 1", // decrement rsp
11481148
"st r1, r0, 0", // store the rsp
1149-
// we will continue executing at the return address
1149+
// go to next instruction, but label it as
1150+
// nonstandard so this isn't optimized away
1151+
"add r2, r2, 1",
1152+
"jump r2",
11501153
},
1154+
NonStandardNext: true,
11511155
},
11521156
},
11531157
{

0 commit comments

Comments
 (0)