trying to fix some goto implementation issues

This commit is contained in:
hyunghwan.chung 2019-08-04 16:38:09 +00:00
parent 490804d0aa
commit 55bf7e269e
2 changed files with 10 additions and 2 deletions

View File

@ -108,7 +108,15 @@ start:
[goto B02. A01: 10. B02: 1000. ] value class dump.
self q.
[ | a | a := 21. if (a = 21) { goto X02 }. X02: ] value dump. ## this causes a stack depletion problem... TODO:
[ | a | a := 21. if (a = 21) { goto X02 }. X02: ] value dump. // this causes a stack depletion problem... TODO:
/*
this is horrible... the stack won't be cleared when goto is made...
System should never be popped out
(if (2 > 1) { 20. System log: (if (2 > 1) {goto X2}) }) dump.
X2:
a dump.
*/
EXCEPTION_TEST:
Exception signal: 'experiment with exception signalling'.

View File

@ -959,7 +959,7 @@ enum moo_bcode_t
BCODE_JUMP2_FORWARD_IF_TRUE = 0xC7, /* 199 ## */
BCODE_JUMP_FORWARD_IF_FALSE = 0xC8, /* 200 ## */
BCODE_JUMP2_FORWARD_IF_FALSE = 0xC9, /* 201 ## */
/* JMPOP = JUMP + POP */
/* JMPOP = JUMP + POP -> it pops the stack top always but it jumps only if the condition is met */
BCODE_JMPOP_FORWARD_IF_TRUE = 0xCA, /* 202 ## */
BCODE_JMPOP2_FORWARD_IF_TRUE = 0xCB, /* 203 ## */
BCODE_JMPOP_FORWARD_IF_FALSE = 0xCC, /* 204 ## */