diff options
author | Léonard Oest O'Leary <lool4516@gmail.com> | 2023-05-19 13:53:12 -0400 |
---|---|---|
committer | Léonard Oest O'Leary <lool4516@gmail.com> | 2023-05-19 13:53:12 -0400 |
commit | bc5613669f59d5e709413d036df4ec7ea588e32e (patch) | |
tree | f0c5b6e4d5c17c768dd858e3d6e8e6536df44d11 | |
parent | 4486beccf3144e812a6ebcb305341e142b227243 (diff) |
Add the modifications to the js target
-rw-r--r-- | src/host/js/makefile | 2 | ||||
-rw-r--r-- | src/host/js/rvm.js | 32 |
2 files changed, 33 insertions, 1 deletions
diff --git a/src/host/js/makefile b/src/host/js/makefile index f725a27..40ca8d2 100644 --- a/src/host/js/makefile +++ b/src/host/js/makefile @@ -1,4 +1,4 @@ HOST = js HOST_INTERPRETER = $${JS_HOST_INTERPRETER:-node} -RSC_MUST_TEST_FEATURES = -f+ js/node +RSC_MUST_TEST_FEATURES = -f+ js/node; -f+ js/node -e skip include ../../makefile-common.mk diff --git a/src/host/js/rvm.js b/src/host/js/rvm.js index 7eb5e23..ba187a2 100644 --- a/src/host/js/rvm.js +++ b/src/host/js/rvm.js @@ -134,6 +134,9 @@ inst_tail = (x,i) => i ? inst_tail(x[2],i-1) : x; // decode the instruction graph +if(false){ // @@(feature pipeline-compiler)@@ + +// @@(feature encoding/skip stack = 0; while (1) { @@ -164,6 +167,35 @@ while (1) { } stack[0] = [op?op-1:0,n,stack[0]]; } +// )@@ + +} // @@(feature pipeline-compiler)@@ + + + +// @@(feature encoding/original +stack = 0; + +while (1) { + x = get_code(); + n = x; + d = 0; + op = -1; + while ((d=[20,30,0,10,11,4][++op])+2<n) n -= d+3; + if (x>90) + n = pop(); + else { + if (!op) stack = [0,stack,0]; + n = n>=d ? (n==d ? get_int(0) : symbol_ref(get_int(n-d-1))) : op<3 ? symbol_ref(n) : n; + if (4<op) { + n = [[n,0,pop()],0,1]; + if (!stack) break; + op=4; + } + } + stack[0] = [op?op-1:0,n,stack[0]]; +} +// )@@ set_global = (x) => { symtbl[0][0] = x; symtbl = symtbl[1]; }; |