Skip to content

Commit

Permalink
Fixed switch fallback when jumptable doens't work
Browse files Browse the repository at this point in the history
  • Loading branch information
Melchizedek6809 committed May 13, 2024
1 parent e5f34c6 commit a4c687e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ lVal lBytecodeEval(lClosure *callingClosure, lBytecodeArray *text){
ip = ops->data;

while(true){
dispatchLoop:
vmdispatch(*ip++){
vmcase(lopNOP)
vmbreak;
Expand Down Expand Up @@ -517,7 +518,7 @@ lVal lBytecodeEval(lClosure *callingClosure, lBytecodeArray *text){
while(t){
if(s == t->key){
ctx.valueStack[++ctx.sp] = t->value;
vmbreak;
goto dispatchLoop;
}
t = s > t->key ? t->right : t->left;
}
Expand All @@ -544,7 +545,7 @@ lVal lBytecodeEval(lClosure *callingClosure, lBytecodeArray *text){
while(t){
if(t->key == s){
t->value = ctx.valueStack[ctx.sp];
vmbreak;
goto dispatchLoop;
}
t = s > t->key ? t->right : t->left;
}
Expand Down

0 comments on commit a4c687e

Please sign in to comment.