@@ -7,6 +7,7 @@ vm_oop_t Start() {
7
7
8
8
void * loopTargets [] = {& & LABEL_BC_HALT ,
9
9
& & LABEL_BC_DUP ,
10
+ & & LABEL_BC_DUP_SECOND ,
10
11
& & LABEL_BC_PUSH_LOCAL ,
11
12
& & LABEL_BC_PUSH_LOCAL_0 ,
12
13
& & LABEL_BC_PUSH_LOCAL_1 ,
@@ -40,17 +41,20 @@ vm_oop_t Start() {
40
41
& & LABEL_BC_SUPER_SEND ,
41
42
& & LABEL_BC_RETURN_LOCAL ,
42
43
& & LABEL_BC_RETURN_NON_LOCAL ,
44
+ & & LABEL_BC_INC ,
43
45
& & LABEL_BC_JUMP ,
44
46
& & LABEL_BC_JUMP_ON_FALSE_POP ,
45
47
& & LABEL_BC_JUMP_ON_TRUE_POP ,
46
48
& & LABEL_BC_JUMP_ON_FALSE_TOP_NIL ,
47
49
& & LABEL_BC_JUMP_ON_TRUE_TOP_NIL ,
50
+ & & LABEL_BC_JUMP_IF_GREATER ,
48
51
& & LABEL_BC_JUMP_BACKWARD ,
49
52
& & LABEL_BC_JUMP2 ,
50
53
& & LABEL_BC_JUMP2_ON_FALSE_POP ,
51
54
& & LABEL_BC_JUMP2_ON_TRUE_POP ,
52
55
& & LABEL_BC_JUMP2_ON_FALSE_TOP_NIL ,
53
56
& & LABEL_BC_JUMP2_ON_TRUE_TOP_NIL ,
57
+ & & LABEL_BC_JUMP2_IF_GREATER ,
54
58
& & LABEL_BC_JUMP2_BACKWARD };
55
59
56
60
goto* loopTargets [currentBytecodes [bytecodeIndexGlobal ]];
@@ -66,6 +70,14 @@ vm_oop_t Start() {
66
70
doDup ();
67
71
DISPATCH_NOGC ();
68
72
73
+ LABEL_BC_DUP_SECOND :
74
+ PROLOGUE (1 );
75
+ {
76
+ vm_oop_t elem = GetFrame ()-> GetStackElement (1 );
77
+ GetFrame ()-> Push (elem );
78
+ }
79
+ DISPATCH_NOGC ();
80
+
69
81
LABEL_BC_PUSH_LOCAL :
70
82
PROLOGUE (3 );
71
83
doPushLocal (bytecodeIndexGlobal - 3 );
@@ -249,6 +261,11 @@ vm_oop_t Start() {
249
261
doReturnNonLocal ();
250
262
DISPATCH_NOGC ();
251
263
264
+ LABEL_BC_INC :
265
+ PROLOGUE (1 );
266
+ doInc ();
267
+ DISPATCH_NOGC ();
268
+
252
269
LABEL_BC_JUMP : {
253
270
uint8_t offset = currentBytecodes [bytecodeIndexGlobal + 1 ];
254
271
bytecodeIndexGlobal += offset ;
@@ -305,6 +322,17 @@ LABEL_BC_JUMP_ON_TRUE_TOP_NIL: {
305
322
}
306
323
DISPATCH_NOGC ();
307
324
325
+ LABEL_BC_JUMP_IF_GREATER : {
326
+ if (checkIsGreater ()) {
327
+ bytecodeIndexGlobal += currentBytecodes [bytecodeIndexGlobal + 1 ];
328
+ GetFrame ()-> Pop ();
329
+ GetFrame ()-> Pop ();
330
+ } else {
331
+ bytecodeIndexGlobal += 3 ;
332
+ }
333
+ }
334
+ DISPATCH_NOGC ();
335
+
308
336
LABEL_BC_JUMP_BACKWARD : {
309
337
uint8_t offset = currentBytecodes [bytecodeIndexGlobal + 1 ];
310
338
bytecodeIndexGlobal -= offset ;
@@ -376,6 +404,19 @@ LABEL_BC_JUMP2_ON_TRUE_TOP_NIL: {
376
404
}
377
405
DISPATCH_NOGC ();
378
406
407
+ LABEL_BC_JUMP2_IF_GREATER : {
408
+ if (checkIsGreater ()) {
409
+ bytecodeIndexGlobal +=
410
+ ComputeOffset (currentBytecodes [bytecodeIndexGlobal + 1 ],
411
+ currentBytecodes [bytecodeIndexGlobal + 2 ]);
412
+ GetFrame ()-> Pop ();
413
+ GetFrame ()-> Pop ();
414
+ } else {
415
+ bytecodeIndexGlobal += 3 ;
416
+ }
417
+ }
418
+ DISPATCH_NOGC ();
419
+
379
420
LABEL_BC_JUMP2_BACKWARD : {
380
421
uint16_t offset = ComputeOffset (currentBytecodes [bytecodeIndexGlobal + 1 ],
381
422
currentBytecodes [bytecodeIndexGlobal + 2 ]);
0 commit comments