aboutsummaryrefslogtreecommitdiff
path: root/vm.d
diff options
context:
space:
mode:
authormryouse2023-05-26 21:04:49 +0000
committermryouse2023-05-26 21:04:49 +0000
commita043f552ddca8d890b14bcddf555472ef69e9014 (patch)
treee4dbc495867791aff6c5d9129a717f6a0f55578d /vm.d
parentb57c1630da58d55dbb7855d9de76f776600038ea (diff)
bytecode compilation of map()
Diffstat (limited to 'vm.d')
-rw-r--r--vm.d11
1 files changed, 7 insertions, 4 deletions
diff --git a/vm.d b/vm.d
index 75f6328..ba7fc50 100644
--- a/vm.d
+++ b/vm.d
@@ -311,7 +311,7 @@ class VM {
// pop the next n-1 values
Value[] inner;
- for (int i = 0; i < n - 1; i++) {
+ for (int i = 0; i < (n - 1); i++) {
inner ~= this.popA();
}
@@ -319,7 +319,7 @@ class VM {
this.pushA(top);
// push the other values (preserve order)
- for (int i = n - 1; i >= 0; i--) {
+ for (int i = (n - 2); i >= 0; i--) {
this.pushA(inner[i]);
}
break;
@@ -568,13 +568,16 @@ class VM {
this.popA(); // throw this one away
this.pushA(val);
break;
-
+ case OpCode.OP_JUMP_TO:
+ uint addr = this.readShort();
+ //this.current.ip -= offset;
+ this.current.ip = to!ubyte(addr);
+ break;
case OpCode.OP_JUMP:
uint offset = this.readShort();
//ip += offset;
this.current.ip += offset;
break;
-
case OpCode.OP_JUMP_IF_FALSE:
uint offset = this.readShort();
if (!isBoolean(this.peekA(0))) {