RPA Toolkit
Moved all extended operations/operators from RVM to RJS. Still need to fix the tests...
authorMartin Stoilov <martin@rpasearch.com>
Sun, 21 Aug 2011 05:19:46 +0000 (22:19 -0700)
committerMartin Stoilov <martin@rpasearch.com>
Sun, 21 Aug 2011 05:19:46 +0000 (22:19 -0700)
70 files changed:
build/unix/build.mk
rjs/build/unix/rjs.mk
rjs/build/windows/rjs.mk
rjs/rjs.c
rjs/rjs.h
rjs/rjscompiler.c
rjs/rvmoperator.c [moved from rvm/rvmoperator.c with 68% similarity]
rjs/rvmoperator.h [new file with mode: 0644]
rjs/rvmoperatoradd.c [moved from rvm/rvmoperatoradd.c with 86% similarity]
rjs/rvmoperatoradd.h [moved from rvm/rvmoperatoradd.h with 71% similarity]
rjs/rvmoperatorand.c [moved from rvm/rvmoperatorand.c with 82% similarity]
rjs/rvmoperatorand.h [moved from rvm/rvmoperatorand.h with 82% similarity]
rjs/rvmoperatorbin.c [new file with mode: 0644]
rjs/rvmoperatorbin.h [moved from rvm/rvmoperatorbin.h with 91% similarity]
rjs/rvmoperatorcast.c [moved from rvm/rvmoperatorcast.c with 64% similarity]
rjs/rvmoperatorcast.h [moved from rvm/rvmoperatorcast.h with 79% similarity]
rjs/rvmoperatorcat.c [moved from rvm/rvmoperatorcat.c with 92% similarity]
rjs/rvmoperatorcat.h [moved from rvm/rvmoperatorcat.h with 82% similarity]
rjs/rvmoperatorcmn.c [moved from rvm/rvmoperatorcmn.c with 83% similarity]
rjs/rvmoperatorcmn.h [moved from rvm/rvmoperatorcmn.h with 82% similarity]
rjs/rvmoperatorcmp.c [moved from rvm/rvmoperatorcmp.c with 83% similarity]
rjs/rvmoperatorcmp.h [moved from rvm/rvmoperatorcmp.h with 82% similarity]
rjs/rvmoperatordiv.c [moved from rvm/rvmoperatordiv.c with 87% similarity]
rjs/rvmoperatordiv.h [moved from rvm/rvmoperatordiv.h with 82% similarity]
rjs/rvmoperatoreq.c [moved from rvm/rvmoperatoreq.c with 84% similarity]
rjs/rvmoperatoreq.h [moved from rvm/rvmoperatoreq.h with 79% similarity]
rjs/rvmoperatorgreater.c [moved from rvm/rvmoperatorgreater.c with 85% similarity]
rjs/rvmoperatorgreater.h [moved from rvm/rvmoperatorgreater.h with 79% similarity]
rjs/rvmoperatorgreatereq.c [moved from rvm/rvmoperatorgreatereq.c with 85% similarity]
rjs/rvmoperatorgreatereq.h [moved from rvm/rvmoperatorgreatereq.h with 79% similarity]
rjs/rvmoperatorless.c [moved from rvm/rvmoperatorless.c with 85% similarity]
rjs/rvmoperatorless.h [moved from rvm/rvmoperatorless.h with 79% similarity]
rjs/rvmoperatorlesseq.c [moved from rvm/rvmoperatorlesseq.c with 85% similarity]
rjs/rvmoperatorlesseq.h [moved from rvm/rvmoperatorlesseq.h with 79% similarity]
rjs/rvmoperatorlogicand.c [moved from rvm/rvmoperatorlogicand.c with 84% similarity]
rjs/rvmoperatorlogicand.h [moved from rvm/rvmoperatorlogicand.h with 82% similarity]
rjs/rvmoperatorlogicnot.c [moved from rvm/rvmoperatorlogicnot.c with 67% similarity]
rjs/rvmoperatorlogicnot.h [moved from rvm/rvmoperatorlogicnot.h with 92% similarity]
rjs/rvmoperatorlogicor.c [moved from rvm/rvmoperatorlogicor.c with 84% similarity]
rjs/rvmoperatorlogicor.h [moved from rvm/rvmoperatorlogicor.h with 82% similarity]
rjs/rvmoperatorlsl.c [moved from rvm/rvmoperatorlsl.c with 82% similarity]
rjs/rvmoperatorlsl.h [moved from rvm/rvmoperatorlsl.h with 82% similarity]
rjs/rvmoperatorlsr.c [moved from rvm/rvmoperatorlsr.c with 82% similarity]
rjs/rvmoperatorlsr.h [moved from rvm/rvmoperatorlsr.h with 82% similarity]
rjs/rvmoperatorlsru.c [moved from rvm/rvmoperatorlsru.c with 77% similarity]
rjs/rvmoperatorlsru.h [moved from rvm/rvmoperatorlsru.h with 82% similarity]
rjs/rvmoperatormod.c [moved from rvm/rvmoperatormod.c with 88% similarity]
rjs/rvmoperatormod.h [moved from rvm/rvmoperatormod.h with 82% similarity]
rjs/rvmoperatormul.c [moved from rvm/rvmoperatormul.c with 87% similarity]
rjs/rvmoperatormul.h [moved from rvm/rvmoperatormul.h with 82% similarity]
rjs/rvmoperatornot.c [moved from rvm/rvmoperatornot.c with 62% similarity]
rjs/rvmoperatornot.h [moved from rvm/rvmoperatornot.h with 93% similarity]
rjs/rvmoperatornoteq.c [moved from rvm/rvmoperatornoteq.c with 85% similarity]
rjs/rvmoperatornoteq.h [moved from rvm/rvmoperatornoteq.h with 79% similarity]
rjs/rvmoperatoror.c [moved from rvm/rvmoperatoror.c with 82% similarity]
rjs/rvmoperatoror.h [moved from rvm/rvmoperatoror.h with 82% similarity]
rjs/rvmoperatorsub.c [moved from rvm/rvmoperatorsub.c with 88% similarity]
rjs/rvmoperatorsub.h [moved from rvm/rvmoperatorsub.h with 82% similarity]
rjs/rvmoperatorxor.c [moved from rvm/rvmoperatorxor.c with 82% similarity]
rjs/rvmoperatorxor.h [moved from rvm/rvmoperatorxor.h with 82% similarity]
rpa/rpadbex.c
rvm/build/unix/rvm.mk
rvm/build/windows/rvm.mk
rvm/rvmcpu.c
rvm/rvmcpu.h
rvm/rvmoperator.h [deleted file]
rvm/rvmoperatorbin.c [deleted file]
tests/testmisc/loop-test.c
tests/testmisc/rpagen-test.c
tests/testmisc/speed-test.c

index 99c966d..8612690 100644 (file)
@@ -3,11 +3,11 @@ all:
        +make -C $(SRCDIR)/rpa/build/unix/$(ARCHDIR) all
        +make -C $(SRCDIR)/rvm/build/unix/$(ARCHDIR) all
        +make -C $(SRCDIR)/rgrep/build/unix/$(ARCHDIR) all
-       +make -C $(SRCDIR)/tests/testmisc/build/unix/$(ARCHDIR) all
+#      +make -C $(SRCDIR)/tests/testmisc/build/unix/$(ARCHDIR) all
        +make -C $(SRCDIR)/tests/testrpa/build/unix/$(ARCHDIR) all
        +make -C $(SRCDIR)/rjs/build/unix/$(ARCHDIR) all
 ifeq ($(OS), linux)
-       +make -C $(SRCDIR)/tests/testrjs/build/unix/$(ARCHDIR) all
+#      +make -C $(SRCDIR)/tests/testrjs/build/unix/$(ARCHDIR) all
 endif
 
 distclean: clean
index 69e8691..8caeacd 100644 (file)
@@ -27,6 +27,35 @@ RJS_OBJECTS += $(OUTDIR)/rjsparser.o
 RJS_OBJECTS += $(OUTDIR)/rjscompiler.o
 RJS_OBJECTS += $(OUTDIR)/rjsrules.o
 RJS_OBJECTS += $(OUTDIR)/rjsfile.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperator.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorbin.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatoradd.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorand.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatoreq.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatornoteq.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorlogicor.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorlogicand.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorlogicnot.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorless.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorlesseq.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorgreater.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorgreatereq.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorxor.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatoror.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorcmp.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorcmn.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorlsl.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorlsr.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorlsru.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorcast.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorcat.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatorsub.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatormul.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatordiv.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatormod.o
+RJS_OBJECTS += $(OUTDIR)/rvmoperatornot.o
+
+
 ifeq ($(OS), linux)
 RJS_OBJECTS += $(OUTDIR)/ecma262.o
 endif
index 6a742bb..919a543 100644 (file)
@@ -4,7 +4,34 @@ RJS_OBJECTS= \
        "$(OUTDIR)/rjsparser.obj" \\r
        "$(OUTDIR)/rjscompiler.obj" \\r
        "$(OUTDIR)/rjsfile.obj" \\r
-       "$(OUTDIR)/rjsrules.obj"\r
+       "$(OUTDIR)/rjsrules.obj" \\r
+       "$(OUTDIR)\rvmoperator.obj" \\r
+       "$(OUTDIR)\rvmoperatorbin.obj" \\r
+       "$(OUTDIR)\rvmoperatoradd.obj" \\r
+       "$(OUTDIR)\rvmoperatorand.obj" \\r
+       "$(OUTDIR)\rvmoperatoreq.obj" \\r
+       "$(OUTDIR)\rvmoperatornoteq.obj" \\r
+       "$(OUTDIR)\rvmoperatorlogicor.obj" \\r
+       "$(OUTDIR)\rvmoperatorlogicand.obj" \\r
+       "$(OUTDIR)\rvmoperatorlogicnot.obj" \\r
+       "$(OUTDIR)\rvmoperatorless.obj" \\r
+       "$(OUTDIR)\rvmoperatorlesseq.obj" \\r
+       "$(OUTDIR)\rvmoperatorgreater.obj" \\r
+       "$(OUTDIR)\rvmoperatorgreatereq.obj" \\r
+       "$(OUTDIR)\rvmoperatorxor.obj" \\r
+       "$(OUTDIR)\rvmoperatoror.obj" \\r
+       "$(OUTDIR)\rvmoperatorcmp.obj" \\r
+       "$(OUTDIR)\rvmoperatorcmn.obj" \\r
+       "$(OUTDIR)\rvmoperatorlsl.obj" \\r
+       "$(OUTDIR)\rvmoperatorlsr.obj" \\r
+       "$(OUTDIR)\rvmoperatorlsru.obj" \\r
+       "$(OUTDIR)\rvmoperatorcast.obj" \\r
+       "$(OUTDIR)\rvmoperatorcat.obj" \\r
+       "$(OUTDIR)\rvmoperatorsub.obj" \\r
+       "$(OUTDIR)\rvmoperatormul.obj" \\r
+       "$(OUTDIR)\rvmoperatordiv.obj" \\r
+       "$(OUTDIR)\rvmoperatormod.obj" \\r
+       "$(OUTDIR)\rvmoperatornot.obj" \\r
 \r
        \r
 RJSEXEC_OBJECTS =      \\r
@@ -52,6 +79,115 @@ SOURCE="$(DEPSRC_DIR)\rjsrules.c"
 "$(OUTDIR)\rjsrules.obj" : $(SOURCE) "$(OUTDIR)"\r
        $(CPP) $(CPP_FLAGS) $(SOURCE)\r
 \r
+SOURCE="$(SRC_DIR)\rvmoperator.c"\r
+"$(OUTDIR)\rvmoperator.obj" : $(SOURCE) $(OUTDIR)\r
+       $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorbin.c"\r
+"$(OUTDIR)\rvmoperatorbin.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatoradd.c"\r
+"$(OUTDIR)\rvmoperatoradd.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorand.c"\r
+"$(OUTDIR)\rvmoperatorand.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatoreq.c"\r
+"$(OUTDIR)\rvmoperatoreq.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatornoteq.c"\r
+"$(OUTDIR)\rvmoperatornoteq.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorlogicor.c"\r
+"$(OUTDIR)\rvmoperatorlogicor.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorlogicand.c"\r
+"$(OUTDIR)\rvmoperatorlogicand.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorlogicnot.c"\r
+"$(OUTDIR)\rvmoperatorlogicnot.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorless.c"\r
+"$(OUTDIR)\rvmoperatorless.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorlesseq.c"\r
+"$(OUTDIR)\rvmoperatorlesseq.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorgreater.c"\r
+"$(OUTDIR)\rvmoperatorgreater.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorgreatereq.c"\r
+"$(OUTDIR)\rvmoperatorgreatereq.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorxor.c"\r
+"$(OUTDIR)\rvmoperatorxor.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatoror.c"\r
+"$(OUTDIR)\rvmoperatoror.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorcmp.c"\r
+"$(OUTDIR)\rvmoperatorcmp.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorcmn.c"\r
+"$(OUTDIR)\rvmoperatorcmn.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorlsl.c"\r
+"$(OUTDIR)\rvmoperatorlsl.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorlsr.c"\r
+"$(OUTDIR)\rvmoperatorlsr.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorlsru.c"\r
+"$(OUTDIR)\rvmoperatorlsru.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorcast.c"\r
+"$(OUTDIR)\rvmoperatorcast.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorcat.c"\r
+"$(OUTDIR)\rvmoperatorcat.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatorsub.c"\r
+"$(OUTDIR)\rvmoperatorsub.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatormul.c"\r
+"$(OUTDIR)\rvmoperatormul.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatordiv.c"\r
+"$(OUTDIR)\rvmoperatordiv.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatormod.c"\r
+"$(OUTDIR)\rvmoperatormod.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+SOURCE="$(SRC_DIR)\rvmoperatornot.c"\r
+"$(OUTDIR)\rvmoperatornot.obj" : $(SOURCE) $(OUTDIR)\r
+    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
+\r
+\r
 SOURCE="$(DEPSRC_DIR)\rjs.rc"\r
 "$(OUTDIR)\rjs.res" : $(SOURCE) "$(OUTDIR)"\r
        $(RC) $(RC_FLAGS) /r /fo "$(OUTDIR)\rjs.res" $(SOURCE)\r
index df3b74e..583aacc 100644 (file)
--- a/rjs/rjs.c
+++ b/rjs/rjs.c
 #include "rlib/rmap.h"
 #include "rjs/rjs.h"
 #include "rvm/rvmcodegen.h"
+#include "rvmoperator.h"
+#include "rvmoperatorbin.h"
+#include "rvmoperatorcast.h"
+#include "rvmoperatornot.h"
+#include "rvmoperatorlogicnot.h"
+
 
 static void rjs_engine_initgp(rjs_engine_t *jse);
 static void rjs_engine_print(rvmcpu_t *cpu, rvm_asmins_t *ins);
@@ -38,6 +44,814 @@ static rvm_switable_t rjsswitable[] = {
 };
 
 
+static void rjs_op_cast(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_type_t type = (rvmreg_type_t)RVM_CPUREG_GETU(cpu, ins->op3);
+       rvmreg_t tmp;
+
+       RVM_REG_CLEAR(&tmp);
+       RVM_REG_SETTYPE(&tmp, type);
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, RVM_CPUREG_PTR(cpu, ins->op1), RVM_CPUREG_PTR(cpu, ins->op2), &tmp);
+}
+
+
+static void rjs_op_eadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_ADD, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_esub(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_SUB, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_eneg(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t zero;
+
+       rvm_reg_setunsigned(&zero, 0);
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_SUB, cpu, RVM_CPUREG_PTR(cpu, ins->op1), &zero, arg2);
+}
+
+
+
+static void rjs_op_emul(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_MUL, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_ediv(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_DIV, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_emod(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_MOD, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_elsl(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_LSL, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_elsr(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_LSR, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_elsru(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_LSRU, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_eand(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_AND, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_eorr(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_OR, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_exor(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_XOR, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_enot(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+
+       rjs_opmap_invoke_unary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_NOT, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2);
+}
+
+
+static void rjs_op_eland(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_LOGICAND, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_elor(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_LOGICOR, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_elnot(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+
+       rjs_opmap_invoke_unary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_LOGICNOT, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2);
+}
+
+
+static void rjs_op_eeq(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_EQ, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_enoteq(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_NOTEQ, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_egreat(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_GREATER, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_egreateq(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_GREATEREQ, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_elesseq(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_LESSEQ, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_eless(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_LESS, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+}
+
+
+static void rjs_op_ecmp(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CMP, cpu, NULL, arg1, arg2);
+}
+
+
+static void rjs_op_ecmn(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CMN, cpu, NULL, arg1, arg2);
+}
+
+
+static void rjs_op_stralloc(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rstring_t *s = r_string_create_strsize((const char*)RVM_CPUREG_GETP(cpu, ins->op2), (unsigned long)RVM_CPUREG_GETU(cpu, ins->op3));
+       if (!s) {
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       }
+       r_gc_add(cpu->gc, (robject_t*)s);
+       rvm_reg_setstring(arg1, s);
+}
+
+
+static void rjs_op_mapalloc(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rmap_t *a = r_map_create(sizeof(rvmreg_t), 7);
+       if (!a) {
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       }
+       r_gc_add(cpu->gc, (robject_t*)a);
+       rvm_reg_setjsobject(arg1, (robject_t*)a);
+}
+
+
+static void rjs_op_arralloc(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       ruword size = RVM_CPUREG_GETU(cpu, ins->op2);
+       rcarray_t *a = r_carray_create_rvmreg();
+       if (!a) {
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       }
+       r_carray_setlength(a, (unsigned long)size);
+       r_gc_add(cpu->gc, (robject_t*)a);
+       rvm_reg_setarray(arg1, (robject_t*)a);
+}
+
+
+static long rjs_op_mapproplookup(rmap_t *map, rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       long index = -1;
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_SIGNED || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
+               index = r_map_lookup_l(map, -1, (long)RVM_REG_GETL(arg3));
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_DOUBLE) {
+               index = r_map_lookup_d(map, -1, RVM_REG_GETD(arg3));
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_STRING) {
+               index = r_map_lookup(map, -1, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size);
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_POINTER) {
+               index = r_map_lookup(map, -1, (char*)RVM_CPUREG_GETP(cpu, ins->op3), (unsigned int)RVM_CPUREG_GETL(cpu, ins->op1));
+       }
+       return index;
+}
+
+
+static void rjs_op_proplookup(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       long index = -1;
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rmap_t *map = (rmap_t*)RVM_REG_GETP(arg2);
+
+       if (rvm_reg_gettype(arg2) == RVM_DTYPE_MAP) {
+               index = rjs_op_mapproplookup(map, cpu, ins);
+       } else {
+
+       }
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
+       RVM_REG_SETL(arg1, index);
+}
+
+
+
+static long rjs_op_mapproplookupadd(rmap_t *map, rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       long index;
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+
+       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_SIGNED || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
+               index = r_map_lookup_l(map, -1, (long)RVM_REG_GETL(arg3));
+               if (index < 0)
+                       index = r_map_gckey_add_l(map, cpu->gc, (long)RVM_REG_GETL(arg3), NULL);
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_DOUBLE) {
+               index = r_map_lookup_d(map, -1, RVM_REG_GETD(arg3));
+               if (index < 0)
+                       index = r_map_gckey_add_d(map, cpu->gc, RVM_REG_GETD(arg3), NULL);
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_STRING) {
+               index = r_map_lookup(map, -1, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size);
+               if (index < 0)
+                       index = r_map_gckey_add(map, cpu->gc, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size, NULL);
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_POINTER) {
+               index = r_map_lookup(map, -1, (char*)RVM_CPUREG_GETP(cpu, ins->op3), (unsigned int)RVM_CPUREG_GETL(cpu, ins->op1));
+               if (index < 0)
+                       index = r_map_gckey_add(map, cpu->gc, (char*)RVM_CPUREG_GETP(cpu, ins->op3), (unsigned int)RVM_CPUREG_GETL(cpu, ins->op1), NULL);
+       } else {
+               index = -1;
+       }
+
+       return index;
+}
+
+
+static void rjs_op_proplookupadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       long index = -1;
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rmap_t *map = (rmap_t*)RVM_REG_GETP(arg2);
+
+       if (rvm_reg_gettype(arg2) == RVM_DTYPE_MAP) {
+               index = rjs_op_mapproplookupadd(map, cpu, ins);
+       } else {
+
+       }
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
+       RVM_REG_SETL(arg1, index);
+}
+
+
+static void rjs_op_maplookup(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       long index;
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+       rmap_t *a = (rmap_t*)RVM_REG_GETP(arg2);
+
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP) {
+               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
+       }
+       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_SIGNED || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
+               index = r_map_lookup_l(a, -1, (long)RVM_REG_GETL(arg3));
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_DOUBLE) {
+               index = r_map_lookup_d(a, -1, RVM_REG_GETD(arg3));
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_STRING) {
+               index = r_map_lookup(a, -1, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size);
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_POINTER) {
+               index = r_map_lookup(a, -1, (char*)RVM_CPUREG_GETP(cpu, ins->op3), (unsigned int)RVM_CPUREG_GETL(cpu, ins->op1));
+       } else {
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       }
+
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
+       RVM_REG_SETL(arg1, index);
+}
+
+
+static void rjs_op_mapadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       long index;
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+       rmap_t *a = (rmap_t*)RVM_REG_GETP(arg2);
+
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP) {
+               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
+       }
+       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_SIGNED || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
+               index = r_map_gckey_add_l(a, cpu->gc, (long)RVM_REG_GETL(arg3), NULL);
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_DOUBLE) {
+               index = r_map_gckey_add_d(a, cpu->gc, RVM_REG_GETD(arg3), NULL);
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_STRING) {
+               index = r_map_gckey_add(a, cpu->gc, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size, NULL);
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_POINTER) {
+               index = r_map_gckey_add(a, cpu->gc, (char*)RVM_CPUREG_GETP(cpu, ins->op3), (unsigned int)RVM_CPUREG_GETL(cpu, ins->op1), NULL);
+       } else {
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       }
+
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
+       RVM_REG_SETL(arg1, index);
+}
+
+
+static void rjs_op_maplookupadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       long index;
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
+       rmap_t *a = (rmap_t*)RVM_REG_GETP(arg2);
+
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP) {
+               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
+       }
+       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_SIGNED || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
+               index = r_map_lookup_l(a, -1, (long)RVM_REG_GETL(arg3));
+               if (index < 0)
+                       index = r_map_gckey_add_l(a, cpu->gc, (long)RVM_REG_GETL(arg3), NULL);
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_DOUBLE) {
+               index = r_map_lookup_d(a, -1, RVM_REG_GETD(arg3));
+               if (index < 0)
+                       index = r_map_gckey_add_d(a, cpu->gc, RVM_REG_GETD(arg3), NULL);
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_STRING) {
+               index = r_map_lookup(a, -1, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size);
+               if (index < 0)
+                       index = r_map_gckey_add(a, cpu->gc, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size, NULL);
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_POINTER) {
+               index = r_map_lookup(a, -1, (char*)RVM_CPUREG_GETP(cpu, ins->op3), (unsigned int)RVM_CPUREG_GETL(cpu, ins->op1));
+               if (index < 0)
+                       index = r_map_gckey_add(a, cpu->gc, (char*)RVM_CPUREG_GETP(cpu, ins->op3), (unsigned int)RVM_CPUREG_GETL(cpu, ins->op1), NULL);
+       } else {
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       }
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
+       RVM_REG_SETL(arg1, index);
+}
+
+
+static void rjs_op_propstr(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *a = NULL;
+       rpointer value;
+       long index;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP) {
+
+               return;
+       }
+       a = (rmap_t*)RVM_REG_GETP(arg2);
+       value = r_map_value(a, index);
+       if (!value)
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       r_map_setvalue(a, index, arg1);
+}
+
+
+static void rjs_op_propldr(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *a = NULL;
+       rpointer value;
+       long index;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       rvm_reg_setundef(arg1);
+       if (rvm_reg_gettype(arg2) == RVM_DTYPE_MAP) {
+               a = (rmap_t*)RVM_REG_GETP(arg2);
+               value = r_map_value(a, index);
+               if (value) {
+                       *arg1 = *((rvmreg_t*)value);
+               }
+       }
+}
+
+
+static void rjs_op_propkeyldr(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *map = NULL;
+       rstring_t *key;
+       long index;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_UNDEF);
+       if (rvm_reg_gettype(arg2) == RVM_DTYPE_MAP) {
+               map = (rmap_t*)RVM_REG_GETP(arg2);
+               key = r_map_key(map, index);
+               if (key) {
+                       rvm_reg_setstring(arg1, key);
+               }
+       } else if (rvm_reg_gettype(arg2) == RVM_DTYPE_STRING) {
+
+       }
+}
+
+
+static void rjs_op_propdel(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       int ret;
+       long index;
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *a = NULL;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       rvm_reg_setboolean(arg1, 0);
+       if (rvm_reg_gettype(arg2) == RVM_DTYPE_MAP) {
+               a = (rmap_t*)RVM_REG_GETP(arg2);
+               ret = r_map_delete(a, index);
+               rvm_reg_setboolean(arg1, ret == 0 ? 1 : 0);
+       }
+}
+
+
+static void rjs_op_propaddr(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *a;
+       rpointer value;
+       long index;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
+               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
+       a = (rmap_t*)RVM_REG_GETP(arg2);
+       value = r_map_value(a, index);
+       if (!value)
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_POINTER);
+       RVM_REG_SETP(arg1, value);
+}
+
+
+static void rjs_op_propnext(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *map = NULL;
+       long index = -1;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       if (rvm_reg_gettype(arg2) == RVM_DTYPE_MAP) {
+               map = (rmap_t*)RVM_REG_GETP(arg2);
+               if (index < 0)
+                       index = r_map_first(map);
+               else
+                       index = r_map_next(map, index);
+       }
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
+       RVM_REG_SETL(arg1, index);
+}
+
+
+static void rjs_op_propprev(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *map = NULL;
+       long index = -1;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       if (rvm_reg_gettype(arg2) == RVM_DTYPE_MAP) {
+               map = (rmap_t*)RVM_REG_GETP(arg2);
+               if (index < 0)
+                       index = r_map_last(map);
+               else
+                       index = r_map_prev(map, index);
+       }
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
+       RVM_REG_SETL(arg1, index);
+}
+
+
+static void rjs_op_mapdel(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       int ret;
+       long index;
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *a = NULL;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
+               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
+       a = (rmap_t*)RVM_REG_GETP(arg2);
+       ret = r_map_delete(a, index);
+       rvm_reg_setboolean(arg1, ret == 0 ? 1 : 0);
+}
+
+
+static void rjs_op_mapaddr(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *a;
+       rpointer value;
+       long index;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
+               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
+       a = (rmap_t*)RVM_REG_GETP(arg2);
+       value = r_map_value(a, index);
+       if (!value)
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_POINTER);
+       RVM_REG_SETP(arg1, value);
+}
+
+
+static void rjs_op_mapldr(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *a = NULL;
+       rpointer value;
+       long index;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
+               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
+       a = (rmap_t*)RVM_REG_GETP(arg2);
+       value = r_map_value(a, index);
+       if (!value) {
+               RVM_REG_CLEAR(arg1);
+               RVM_REG_SETTYPE(arg1, RVM_DTYPE_UNDEF);
+       } else {
+               *arg1 = *((rvmreg_t*)value);
+       }
+}
+
+
+static void rjs_op_mapkeyldr(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *a = NULL;
+       rstring_t *key;
+       long index;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
+               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
+       a = (rmap_t*)RVM_REG_GETP(arg2);
+       key = r_map_key(a, index);
+       if (!key) {
+               RVM_REG_CLEAR(arg1);
+               RVM_REG_SETTYPE(arg1, RVM_DTYPE_UNDEF);
+       } else {
+               rvm_reg_setstring(arg1, key);
+       }
+}
+
+
+static void rjs_op_mapnext(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *a = NULL;
+       long index;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
+               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
+       a = (rmap_t*)RVM_REG_GETP(arg2);
+       if (index < 0)
+               index = r_map_first(a);
+       else
+               index = r_map_next(a, index);
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
+       RVM_REG_SETL(arg1, index);
+}
+
+
+static void rjs_op_mapprev(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *a = NULL;
+       long index;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
+               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
+       a = (rmap_t*)RVM_REG_GETP(arg2);
+       if (index < 0)
+               index = r_map_last(a);
+       else
+               index = r_map_prev(a, index);
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
+       RVM_REG_SETL(arg1, index);
+}
+
+
+static void rjs_op_mapstr(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rmap_t *a = NULL;
+       rpointer value;
+       long index;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
+               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
+       a = (rmap_t*)RVM_REG_GETP(arg2);
+       value = r_map_value(a, index);
+       if (!value)
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       r_map_setvalue(a, index, arg1);
+}
+
+
+static void rjs_op_addra(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       rvmreg_t tmp = rvm_reg_create_signed(0);
+       rcarray_t *a = RVM_REG_GETP(arg2);
+       long index;
+
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
+       index = (long)RVM_REG_GETL(&tmp);
+
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_ARRAY || index < 0) {
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       }
+       RVM_REG_CLEAR(arg1);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_POINTER);
+       RVM_REG_SETP(arg1, r_carray_slot_expand(a, index));
+}
+
+
+static void rjs_op_lda(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       ruword index = RVM_CPUREG_GETU(cpu, ins->op3);
+       rcarray_t *a = RVM_REG_GETP(arg2);
+
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_ARRAY) {
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       }
+       *arg1 = *((rvmreg_t*)r_carray_slot_expand(a, (unsigned long)index));
+}
+
+
+static void rjs_op_sta(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
+       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
+       ruword index = RVM_CPUREG_GETU(cpu, ins->op3);
+       rcarray_t *a = RVM_REG_GETP(arg2);
+
+       if (rvm_reg_gettype(arg2) != RVM_DTYPE_ARRAY) {
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       }
+       r_carray_replace(a, (unsigned long)index, arg1);
+}
+
+
+
 const char *rjs_version()
 {
        return RJS_VERSION_STRING;
@@ -46,11 +860,12 @@ const char *rjs_version()
 
 rjs_engine_t *rjs_engine_create()
 {
+       rvmcpu_t *cpu;
        rvmreg_t *tp;
        rjs_engine_t *jse = (rjs_engine_t *) r_zmalloc(sizeof(*jse));
 
        jse->pa = rjs_parser_create();
-       jse->cpu = rvm_cpu_create_default();
+       jse->cpu = cpu = rvm_cpu_create_default();
        jse->co = rjs_compiler_create(jse->cpu);
        jse->cgs = r_array_create(sizeof(rvm_codegen_t*));
        jse->errors = r_array_create(sizeof(rjs_error_t));
@@ -63,6 +878,51 @@ rjs_engine_t *rjs_engine_create()
        rvm_reg_setjsobject(tp, (robject_t *)r_map_create(sizeof(rvmreg_t), 7));
        r_gc_add(jse->cpu->gc, (robject_t*)RVM_REG_GETP(tp));
        rvm_cpu_setreg(jse->cpu, TP, tp);
+
+       rvm_cpu_setophandler(cpu, RJS_CAST, "RJS_CAST", rjs_op_cast);
+       rvm_cpu_setophandler(cpu, RJS_ENEG, "RJS_ENEG", rjs_op_eneg);
+       rvm_cpu_setophandler(cpu, RJS_EADD, "RJS_EADD", rjs_op_eadd);
+       rvm_cpu_setophandler(cpu, RJS_ESUB, "RJS_ESUB", rjs_op_esub);
+       rvm_cpu_setophandler(cpu, RJS_EMUL, "RJS_EMUL", rjs_op_emul);
+       rvm_cpu_setophandler(cpu, RJS_EDIV, "RJS_EDIV", rjs_op_ediv);
+       rvm_cpu_setophandler(cpu, RJS_EMOD, "RJS_EMOD", rjs_op_emod);
+       rvm_cpu_setophandler(cpu, RJS_ELSL, "RJS_ELSL", rjs_op_elsl);
+       rvm_cpu_setophandler(cpu, RJS_ELSR, "RJS_ELSR", rjs_op_elsr);
+       rvm_cpu_setophandler(cpu, RJS_ELSRU, "RJS_ELSRU", rjs_op_elsru);
+       rvm_cpu_setophandler(cpu, RJS_EAND, "RJS_EAND", rjs_op_eand);
+       rvm_cpu_setophandler(cpu, RJS_EORR, "RJS_EORR", rjs_op_eorr);
+       rvm_cpu_setophandler(cpu, RJS_EXOR, "RJS_EXOR", rjs_op_exor);
+       rvm_cpu_setophandler(cpu, RJS_ENOT, "RJS_ENOT", rjs_op_enot);
+       rvm_cpu_setophandler(cpu, RJS_ELAND, "RJS_ELAND", rjs_op_eland);
+       rvm_cpu_setophandler(cpu, RJS_ELOR, "RJS_ELOR", rjs_op_elor);
+       rvm_cpu_setophandler(cpu, RJS_ELNOT, "RJS_ELNOT", rjs_op_elnot);
+       rvm_cpu_setophandler(cpu, RJS_EEQ, "RJS_EEQ", rjs_op_eeq);
+       rvm_cpu_setophandler(cpu, RJS_ENOTEQ, "RJS_ENOTEQ", rjs_op_enoteq);
+       rvm_cpu_setophandler(cpu, RJS_EGREAT, "RJS_EGREAT", rjs_op_egreat);
+       rvm_cpu_setophandler(cpu, RJS_EGREATEQ, "RJS_EGREATEQ", rjs_op_egreateq);
+       rvm_cpu_setophandler(cpu, RJS_ELESS, "RJS_ELESS", rjs_op_eless);
+       rvm_cpu_setophandler(cpu, RJS_ELESSEQ, "RJS_ELESSEQ", rjs_op_elesseq);
+       rvm_cpu_setophandler(cpu, RJS_ECMP, "RJS_ECMP", rjs_op_ecmp);
+       rvm_cpu_setophandler(cpu, RJS_ECMN, "RJS_ECMN", rjs_op_ecmn);
+       rvm_cpu_setophandler(cpu, RJS_PROPLKUP, "RJS_PROPLKUP", rjs_op_proplookup);
+       rvm_cpu_setophandler(cpu, RJS_PROPLKUPADD, "RJS_PROPLKUPADD", rjs_op_proplookupadd);
+       rvm_cpu_setophandler(cpu, RJS_PROPLDR, "RJS_PROPLDR", rjs_op_propldr);
+       rvm_cpu_setophandler(cpu, RJS_PROPSTR, "RJS_PROPSTR", rjs_op_propstr);
+       rvm_cpu_setophandler(cpu, RJS_PROPADDR, "RJS_PROPADDR", rjs_op_propaddr);
+       rvm_cpu_setophandler(cpu, RJS_PROPKEYLDR, "RJS_PROPKEYLDR", rjs_op_propkeyldr);
+       rvm_cpu_setophandler(cpu, RJS_PROPDEL, "RJS_PROPDEL", rjs_op_propdel);
+       rvm_cpu_setophandler(cpu, RJS_PROPNEXT, "RJS_PROPNEXT", rjs_op_propnext);
+       rvm_cpu_setophandler(cpu, RJS_PROPPREV, "RJS_PROPPREV", rjs_op_propprev);
+       rvm_cpu_setophandler(cpu, RJS_STRALLOC, "RJS_STRALLOC", rjs_op_stralloc);
+       rvm_cpu_setophandler(cpu, RJS_ARRALLOC, "RJS_ARRALLOC", rjs_op_arralloc);
+       rvm_cpu_setophandler(cpu, RJS_MAPALLOC, "RJS_MAPALLOC", rjs_op_mapalloc);
+
+       cpu->userdata2 = rjs_opmap_create();
+       rjs_op_binary_init(RJS_USERDATA2MAP(cpu->userdata2));
+       rjs_op_cast_init(RJS_USERDATA2MAP(cpu->userdata2));
+       rjs_op_not_init(RJS_USERDATA2MAP(cpu->userdata2));
+       rjs_op_logicnot_init(RJS_USERDATA2MAP(cpu->userdata2));
+
        return jse;
 error:
        rjs_engine_destroy(jse);
@@ -83,6 +943,7 @@ void rjs_engine_destroy(rjs_engine_t *jse)
                r_array_destroy(jse->cgs);
                r_array_destroy(jse->errors);
                rjs_parser_destroy(jse->pa);
+               rjs_opmap_destroy(RJS_USERDATA2MAP(jse->cpu->userdata2));
                rvm_cpu_destroy(jse->cpu);
                rjs_compiler_destroy(jse->co);
                r_free(jse);
index 51f5162..f91454c 100644 (file)
--- a/rjs/rjs.h
+++ b/rjs/rjs.h
@@ -53,6 +53,45 @@ typedef struct rjs_engine_s {
 #define RJS_SWI_PARAMS(__cpu__) (RVM_CPUREG_GETU((__cpu__), SP) - RVM_CPUREG_GETU((__cpu__), FP))
 #define RJS_SWI_ABORT(__j__, __e__) do { rjs_engine_abort((__j__), (__e__)); return; } while (0)
 
+#define RJS_CAST                       RVM_USER130             /* Cast: op1 = (op3)op2 */
+#define RJS_EMOV                       RVM_USER131
+#define RJS_ENEG                       RVM_USER132             /* Negative: op1 = -op2, Update the status register */
+#define RJS_EADD                       RVM_USER133             /* Add: op1 = op2 + op3, update the status register */
+#define RJS_ESUB                       RVM_USER134             /* Subtract: op1 = op2 - op3, update the status register */
+#define RJS_EMUL                       RVM_USER135             /* Multiply: op1 = op2 * op3, update the status register */
+#define RJS_EDIV                       RVM_USER136             /* Divide: op1 = op2 / op3, update the status register */
+#define RJS_EMOD                       RVM_USER137             /* Modulo: op1 = op2 % op3, update the status register */
+#define RJS_ELSL                       RVM_USER138             /* Logical Shift Left: op1 = op2 << op3, update the status register */
+#define RJS_ELSR                       RVM_USER139             /* Logical Shift Right: op1 = op2 >> op3, update the status register */
+#define RJS_ELSRU                      RVM_USER140             /* Logical Unsigned Shift Right: op1 = op2 >>> op3, update the status register */
+#define RJS_EAND                       RVM_USER141             /* Bitwise AND: op1 = op2 & op3, update status register */
+#define RJS_EORR                       RVM_USER142             /* Bitwise OR: op1 = op2 | op3, update the status register */
+#define RJS_EXOR                       RVM_USER143             /* Bitwise XOR: op1 = op2 ^ op3, update the status register */
+#define RJS_ENOT                       RVM_USER144             /* Bitwise NOT: op1 = ~op2, Update the status register */
+#define RJS_ELAND                      RVM_USER145             /* Logical AND: op1 = op2 && op3, update status register */
+#define RJS_ELOR                       RVM_USER146             /* Logical OR: op1 = op2 || op3, update the status register */
+#define RJS_ELNOT                      RVM_USER147             /* Logical NOT: op1 = !op2, update the status register */
+#define RJS_EEQ                                RVM_USER148             /* op1 = op2 == op3 ? 1 : 0, update the status register */
+#define RJS_ENOTEQ                     RVM_USER149             /* op1 = op2 != op3 ? 1 : 0, update the status register */
+#define RJS_EGREAT                     RVM_USER150             /* op1 = op2 > op3 ? 1 : 0, update the status register */
+#define RJS_EGREATEQ           RVM_USER151             /* op1 = op2 >= op3 ? 1 : 0, update the status register */
+#define RJS_ELESS                      RVM_USER152             /* op1 = op2 < op3 ? 1 : 0, update the status register */
+#define RJS_ELESSEQ                    RVM_USER153             /* op1 = op2 <= op3 ? 1 : 0, update the status register */
+#define RJS_ECMP                       RVM_USER154             /* Compare: status register is updated based on the result: op1 - op2 */
+#define RJS_ECMN                       RVM_USER155             /* Compare Negative: status register is updated based on the result: op1 + op2 */
+#define RJS_PROPLKUP           RVM_USER156             /* Lookup property */
+#define RJS_PROPLKUPADD                RVM_USER157             /* Lookup or add property */
+#define RJS_PROPLDR                    RVM_USER158             /* Load property */
+#define RJS_PROPSTR                    RVM_USER159             /* Store property */
+#define RJS_PROPADDR           RVM_USER160             /* Property Address */
+#define RJS_PROPKEYLDR         RVM_USER161             /* Load Property Key */
+#define RJS_PROPDEL                    RVM_USER162             /* Delete Property */
+#define RJS_PROPNEXT           RVM_USER163
+#define RJS_PROPPREV           RVM_USER164
+#define RJS_STRALLOC           RVM_USER165             /* Allocate string in op1, op2 is pointer (char*) to string, op3 is the size */
+#define RJS_ARRALLOC           RVM_USER166             /* Allocate array in op1, op2 is the size */
+#define RJS_MAPALLOC           RVM_USER167             /* Allocate array in op1, op2 is the size */
+
 #define RJS_GPKEY_NONE 0
 #define RJS_GPKEY_TYPES 1
 
index 48e9e5f..5af7790 100644 (file)
@@ -48,7 +48,7 @@ void rjs_compiler_debugtail(rjs_compiler_t *co, rarray_t *records, long rec)
        rvm_codegen_setsource(co->cg, rec);
        if (co->debug) {
                rparecord_t *prec = (rparecord_t *) r_array_slot(records, rec);
-               rvm_asm_dump(rvm_codegen_getcode(co->cg, co->headoff), rvm_codegen_getcodesize(co->cg) - co->headoff);
+               rvm_asm_dump(co->cpu, rvm_codegen_getcode(co->cg, co->headoff), rvm_codegen_getcodesize(co->cg) - co->headoff);
                if (prec->type & RPA_RECORD_END) {
                        rpa_record_dump(records, rec);
                }
@@ -189,77 +189,77 @@ long rjs_compiler_record2opcode(rparecord_t *prec)
        unsigned long size = prec->inputsiz;
 
        if (r_stringncmp("++", input,  size))
-               return RVM_EADD;
+               return RJS_EADD;
        else if (r_stringncmp("+", input,  size))
-               return RVM_EADD;
+               return RJS_EADD;
        else if (r_stringncmp("+=", input,  size))
-               return RVM_EADD;
+               return RJS_EADD;
        else if (r_stringncmp("--", input,  size))
-               return RVM_ESUB;
+               return RJS_ESUB;
        else if (r_stringncmp("-", input,  size))
-               return RVM_ESUB;
+               return RJS_ESUB;
        else if (r_stringncmp("-=", input,  size))
-               return RVM_ESUB;
+               return RJS_ESUB;
        else if (r_stringncmp("*", input,  size))
-               return RVM_EMUL;
+               return RJS_EMUL;
        else if (r_stringncmp("*=", input,  size))
-               return RVM_EMUL;
+               return RJS_EMUL;
        else if (r_stringncmp("/", input,  size))
-               return RVM_EDIV;
+               return RJS_EDIV;
        else if (r_stringncmp("/=", input,  size))
-               return RVM_EDIV;
+               return RJS_EDIV;
        else if (r_stringncmp("%", input,  size))
-               return RVM_EMOD;
+               return RJS_EMOD;
        else if (r_stringncmp("%=", input,  size))
-               return RVM_EMOD;
+               return RJS_EMOD;
        else if (r_stringncmp("&&", input,  size))
-               return RVM_ELAND;
+               return RJS_ELAND;
        else if (r_stringncmp("||", input,  size))
-               return RVM_ELOR;
+               return RJS_ELOR;
        else if (r_stringncmp("&", input,  size))
-               return RVM_EAND;
+               return RJS_EAND;
        else if (r_stringncmp("&=", input,  size))
-               return RVM_EAND;
+               return RJS_EAND;
        else if (r_stringncmp("|", input,  size))
-               return RVM_EORR;
+               return RJS_EORR;
        else if (r_stringncmp("|=", input,  size))
-               return RVM_EORR;
+               return RJS_EORR;
        else if (r_stringncmp("^", input,  size))
-               return RVM_EXOR;
+               return RJS_EXOR;
        else if (r_stringncmp("^=", input,  size))
-               return RVM_EXOR;
+               return RJS_EXOR;
        else if (r_stringncmp(">>", input,  size))
-               return RVM_ELSR;
+               return RJS_ELSR;
        else if (r_stringncmp(">>=", input,  size))
-               return RVM_ELSR;
+               return RJS_ELSR;
        else if (r_stringncmp("<<", input,  size))
-               return RVM_ELSL;
+               return RJS_ELSL;
        else if (r_stringncmp("<<=", input,  size))
-               return RVM_ELSL;
+               return RJS_ELSL;
        else if (r_stringncmp(">>>", input,  size))
-               return RVM_ELSRU;
+               return RJS_ELSRU;
        else if (r_stringncmp(">>>=", input,  size))
-               return RVM_ELSRU;
+               return RJS_ELSRU;
        else if (r_stringncmp("<=", input,  size))
-               return RVM_ELESSEQ;
+               return RJS_ELESSEQ;
        else if (r_stringncmp(">=", input,  size))
-               return RVM_EGREATEQ;
+               return RJS_EGREATEQ;
        else if (r_stringncmp("<", input,  size))
-               return RVM_ELESS;
+               return RJS_ELESS;
        else if (r_stringncmp(">", input,  size))
-               return RVM_EGREAT;
+               return RJS_EGREAT;
        else if (r_stringncmp("===", input,  size))
-               return RVM_EEQ;
+               return RJS_EEQ;
        else if (r_stringncmp("==", input,  size))
-               return RVM_EEQ;
+               return RJS_EEQ;
        else if (r_stringncmp("!==", input,  size))
-               return RVM_ENOTEQ;
+               return RJS_ENOTEQ;
        else if (r_stringncmp("!=", input,  size))
-               return RVM_ENOTEQ;
+               return RJS_ENOTEQ;
        else if (r_stringncmp("!", input,  size))
-               return RVM_ELNOT;
+               return RJS_ELNOT;
        else if (r_stringncmp("~", input,  size))
-               return RVM_ENOT;
+               return RJS_ENOT;
        else if (r_stringncmp("=", input,  size))
                return RVM_NOP;
 
@@ -275,11 +275,11 @@ long rjs_compiler_record2unaryopcode(rparecord_t *prec)
        if (r_stringncmp("+", input,  size))
                return RVM_NOP;
        else if (r_stringncmp("-", input,  size))
-               return RVM_ENEG;
+               return RJS_ENEG;
        else if (r_stringncmp("~", input,  size))
-               return RVM_ENOT;
+               return RJS_ENOT;
        else if (r_stringncmp("!", input,  size))
-               return RVM_ELNOT;
+               return RJS_ELNOT;
        else
                return RVM_NOP;
 
@@ -705,10 +705,10 @@ int rjs_compiler_rh_unaryexpressiontypeof(rjs_compiler_t *co, rarray_t *records,
        prec = (rparecord_t *)r_array_slot(records, rec);
        rjs_compiler_debughead(co, records, rec);
        rvm_codegen_addins(co->cg, rvm_asm(RVM_TYPE, R0, R0, XX, 0));
-       rvm_codegen_addins(co->cg, rvm_asml(RVM_MAPLKUP, R1, GP, DA, RJS_GPKEY_TYPES));
-       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLDR, R1, GP, R1, 0));
-       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLKUP, R0, R1, R0, 0));
-       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLDR, R0, R1, R0, 0));
+       rvm_codegen_addins(co->cg, rvm_asml(RJS_PROPLKUP, R1, GP, DA, RJS_GPKEY_TYPES));
+       rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPLDR, R1, GP, R1, 0));
+       rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPLKUP, R0, R1, R0, 0));
+       rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPLDR, R0, R1, R0, 0));
 
        rjs_compiler_debugtail(co, records, rec);
        return 0;
@@ -758,7 +758,7 @@ int rjs_compiler_rh_newarrayexpression(rjs_compiler_t *co, rarray_t *records, lo
        rec = rpa_recordtree_get(records, rec, RPA_RECORD_END);
        prec = (rparecord_t *)r_array_slot(records, rec);
        rjs_compiler_debughead(co, records, rec);
-       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPALLOC, R0, DA, XX, 0));
+       rvm_codegen_addins(co->cg, rvm_asm(RJS_MAPALLOC, R0, DA, XX, 0));
        rjs_compiler_debugtail(co, records, rec);
        return 0;
 }
@@ -781,15 +781,15 @@ int rjs_compiler_rh_memberexpressiondotop(rjs_compiler_t *co, rarray_t *records,
        prec = (rparecord_t *)r_array_slot(records, rec);
        rjs_compiler_debughead(co, records, rec);
        if (rjs_compiler_record_parentuid(co, records, rec) == UID_LEFTHANDSIDEEXPRESSIONADDR && rjs_compiler_record_lastofkind(co, records, rec)) {
-               rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLKUPADD, R0, R1, R2, 0));     // Get the offset of the element at offset R0
-               rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPADDR, R0, R1, R0, 0));        // Get the address of the element at offset R0
+               rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPLKUPADD, R0, R1, R2, 0));    // Get the offset of the element at offset R0
+               rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPADDR, R0, R1, R0, 0));       // Get the address of the element at offset R0
 
        } else {
-               rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLKUP, R0, R1, R2, 0));        // Get the offset of the element at offset R0
+               rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPLKUP, R0, R1, R2, 0));       // Get the offset of the element at offset R0
                if (ctx && ctx->type == RJS_COCTX_DELETE)
-                       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPDEL, R0, R1, R0, 0));         // Get the result of deletion in R0
+                       rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPDEL, R0, R1, R0, 0));                // Get the result of deletion in R0
                else
-                       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLDR, R0, R1, R0, 0));         // Get the value of the element at offset R0
+                       rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPLDR, R0, R1, R0, 0));                // Get the value of the element at offset R0
        }
        rjs_compiler_debugtail(co, records, rec);
        return 0;
@@ -814,16 +814,16 @@ int rjs_compiler_rh_memberexpressionindexop(rjs_compiler_t *co, rarray_t *record
        rjs_compiler_debughead(co, records, rec);
        if (rjs_compiler_record_parentuid(co, records, rec) == UID_LEFTHANDSIDEEXPRESSIONADDR && rjs_compiler_record_lastofkind(co, records, rec)) {
                rvm_codegen_addins(co->cg, rvm_asm(RVM_POP, R1, XX, XX, 0));    // Supposedly an Array
-               rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLKUPADD, R0, R1, R0, 0));     // R1 Array
-               rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPADDR, R0, R1, R0, 0));        // Get the address of the element at offset R0
+               rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPLKUPADD, R0, R1, R0, 0));    // R1 Array
+               rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPADDR, R0, R1, R0, 0));       // Get the address of the element at offset R0
 
        } else {
                rvm_codegen_addins(co->cg, rvm_asm(RVM_POP, R1, XX, XX, 0));    // Supposedly an Array
-               rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLKUP, R0, R1, R0, 0));        // R1 Array
+               rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPLKUP, R0, R1, R0, 0));       // R1 Array
                if (ctx && ctx->type == RJS_COCTX_DELETE)
-                       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPDEL, R0, R1, R0, 0));         // Get the result of deletion in R0
+                       rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPDEL, R0, R1, R0, 0));                // Get the result of deletion in R0
                else
-                       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLDR, R0, R1, R0, 0));         // Get the value of the element at offset R0
+                       rvm_codegen_addins(co->cg, rvm_asm(RJS_PROPLDR, R0, R1, R0, 0));                // Get the value of the element at offset R0
        }
        rjs_compiler_debugtail(co, records, rec);
        return 0;
@@ -1285,11 +1285,11 @@ int rjs_compiler_rh_forininit(rjs_compiler_t *co, rarray_t *records, long rec)
        rvm_codegen_addins(co->cg, rvm_asml(RVM_LDS, R0, SP, DA, -2));
        rvm_codegen_addins(co->cg, rvm_asml(RVM_LDS, R1, SP, DA, 0));
        rvm_codegen_addins(co->cg, rvm_asml(RVM_LDS, R2, SP, DA, -1));
-       rvm_codegen_addins(co->cg, rvm_asml(RVM_MAPNEXT, R0, R1, R0, 0));
+       rvm_codegen_addins(co->cg, rvm_asml(RJS_PROPNEXT, R0, R1, R0, 0));
        rvm_codegen_addins(co->cg, rvm_asml(RVM_CMP, R0, DA, XX, 0));
        rvm_codegen_index_addrelocins(co->cg, RVM_RELOC_BRANCH, ctx->endidx, rvm_asm(RVM_BLES, DA, XX, XX, 0));
        rvm_codegen_addins(co->cg, rvm_asml(RVM_STS, R0, SP, DA, -2));
-       rvm_codegen_addins(co->cg, rvm_asml(RVM_MAPKEYLDR, R0, R1, R0, 0));
+       rvm_codegen_addins(co->cg, rvm_asml(RJS_PROPKEYLDR, R0, R1, R0, 0));
        rvm_codegen_addins(co->cg, rvm_asml(RVM_STRR, R0, R2, XX, 0));
        rjs_compiler_debugtail(co, records, rec);
        return 0;
@@ -1442,7 +1442,7 @@ int rjs_compiler_rh_caseclause(rjs_compiler_t *co, rarray_t *records, long rec)
                        return -1;
                rjs_compiler_debughead(co, records, rpa_recordtree_get(records, rec, RPA_RECORD_END));
                rvm_codegen_addins(co->cg, rvm_asml(RVM_LDS, R1, SP, DA, 0));
-               rvm_codegen_addins(co->cg, rvm_asml(RVM_EEQ, R0, R0, R1, 0));
+               rvm_codegen_addins(co->cg, rvm_asml(RJS_EEQ, R0, R0, R1, 0));
                rvm_codegen_index_addrelocins(co->cg, RVM_RELOC_BRANCH, caseidx, rvm_asm(RVM_BNEQ, DA, XX, XX, 0));
                rjs_compiler_debugtail(co, records, rpa_recordtree_get(records, rec, RPA_RECORD_END));
 
@@ -1658,7 +1658,7 @@ int rjs_compiler_rh_newexpressioncall(rjs_compiler_t *co, rarray_t *records, lon
        rec = rpa_recordtree_get(records, rec, RPA_RECORD_END);
        prec = (rparecord_t *)r_array_slot(records, rec);
        rjs_compiler_debughead(co, records, rec);
-       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPALLOC, TP, DA, XX, 0));
+       rvm_codegen_addins(co->cg, rvm_asm(RJS_MAPALLOC, TP, DA, XX, 0));
        rvm_codegen_addins(co->cg, rvm_asm(RVM_SUB, FP, SP, DA, ctx.arguments));
        rvm_codegen_addins(co->cg, rvm_asm(RVM_CALL, R0, XX, XX, 0));
        rvm_codegen_addins(co->cg, rvm_asm(RVM_MOV, SP, FP, XX, 0));
similarity index 68%
rename from rvm/rvmoperator.c
rename to rjs/rvmoperator.c
index 767cb81..5e93a2c 100644 (file)
  */
 
 #include "rlib/rmem.h"
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 
 
-rvm_opmap_t *rvm_opmap_create()
+rjs_opmap_t *rjs_opmap_create()
 {
-       rvm_opmap_t *opmap;
+       rjs_opmap_t *opmap;
 
-       opmap = (rvm_opmap_t*)r_malloc(sizeof(*opmap));
+       opmap = (rjs_opmap_t*)r_malloc(sizeof(*opmap));
        if (!opmap)
                return NULL;
        r_memset(opmap, 0, sizeof(*opmap));
-       opmap->operators = r_array_create(sizeof(rvm_opinfo_t));
+       opmap->operators = r_array_create(sizeof(rjs_opinfo_t));
        return opmap;
 }
 
 
-void rvm_opmap_destroy(rvm_opmap_t *opmap)
+void rjs_opmap_destroy(rjs_opmap_t *opmap)
 {
        unsigned long i;
-       rvm_opinfo_t *opinfo;
+       rjs_opinfo_t *opinfo;
 
        if (!opmap)
                return;
        for (i = 0; i < r_array_length(opmap->operators); i++) {
-               opinfo = ((rvm_opinfo_t*)r_array_slot(opmap->operators, i));
+               opinfo = ((rjs_opinfo_t*)r_array_slot(opmap->operators, i));
                if (opinfo->opid)
                        r_free(opinfo->handlers);
        }
@@ -52,34 +52,34 @@ void rvm_opmap_destroy(rvm_opmap_t *opmap)
 }
 
 
-void rvm_opmap_add_binary_operator(rvm_opmap_t *opmap, ruint16 opid)
+void rjs_opmap_add_binary_operator(rjs_opmap_t *opmap, ruint16 opid)
 {
-       rvm_opinfo_t opinfo;
+       rjs_opinfo_t opinfo;
 
        r_memset(&opinfo, 0, sizeof(opinfo));
        opinfo.opid = opid;
-       opinfo.handlers = r_zmalloc(RVM_DTYPE_MAX * RVM_DTYPE_MAX * sizeof(rvm_ophandler_t));
+       opinfo.handlers = r_zmalloc(RVM_DTYPE_MAX * RVM_DTYPE_MAX * sizeof(rjs_ophandler_t));
        r_array_replace(opmap->operators, opid, &opinfo);
 }
 
 
-void rvm_opmap_add_unary_operator(rvm_opmap_t *opmap, ruint16 opid)
+void rjs_opmap_add_unary_operator(rjs_opmap_t *opmap, ruint16 opid)
 {
-       rvm_opinfo_t opinfo;
+       rjs_opinfo_t opinfo;
 
        r_memset(&opinfo, 0, sizeof(opinfo));
        opinfo.opid = opid;
        opinfo.unary = TRUE;
-       opinfo.handlers = r_malloc(RVM_DTYPE_MAX * sizeof(rvm_ophandler_t));
+       opinfo.handlers = r_malloc(RVM_DTYPE_MAX * sizeof(rjs_ophandler_t));
        r_array_replace(opmap->operators, opid, &opinfo);
 }
 
 
-int rvm_opmap_set_binary_handler(rvm_opmap_t *opmap, ruint16 opid, rvm_binaryop_handler func, unsigned char firstType, unsigned char secondType)
+int rjs_opmap_set_binary_handler(rjs_opmap_t *opmap, ruint16 opid, rjs_binaryop_handler func, unsigned char firstType, unsigned char secondType)
 {
-       rvm_ophandler_t *h;
-       unsigned int index = RVM_OP_HANDLER(firstType, secondType);
-       rvm_opinfo_t *opinfo = ((rvm_opinfo_t*)r_array_slot(opmap->operators, opid));
+       rjs_ophandler_t *h;
+       unsigned int index = RJS_BINARY_HANDLER(firstType, secondType);
+       rjs_opinfo_t *opinfo = ((rjs_opinfo_t*)r_array_slot(opmap->operators, opid));
        if (!opinfo->handlers)
                return -1;
        h = &opinfo->handlers[index];
@@ -88,22 +88,22 @@ int rvm_opmap_set_binary_handler(rvm_opmap_t *opmap, ruint16 opid, rvm_binaryop_
 }
 
 
-int rvm_opmap_set_unary_handler(rvm_opmap_t *opmap, ruint16 opid, rvm_unaryop_handler func, unsigned char type)
+int rjs_opmap_set_unary_handler(rjs_opmap_t *opmap, ruint16 opid, rjs_unaryop_handler func, unsigned char type)
 {
-       rvm_ophandler_t *h;
-       rvm_opinfo_t *opinfo = ((rvm_opinfo_t*)r_array_slot(opmap->operators, opid));
+       rjs_ophandler_t *h;
+       rjs_opinfo_t *opinfo = ((rjs_opinfo_t*)r_array_slot(opmap->operators, opid));
        if (!opinfo->handlers)
                return -1;
-       h = &opinfo->handlers[RVM_UNARY_HANDLER(type)];
+       h = &opinfo->handlers[RJS_UNARY_HANDLER(type)];
        h->unary = func;
        return 0;
 }
 
 
-void rvm_opmap_invoke_binary_handler(rvm_opmap_t *opmap, ruint16 opid, rvmcpu_t *cpu, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_opmap_invoke_binary_handler(rjs_opmap_t *opmap, ruint16 opid, rvmcpu_t *cpu, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
-       rvm_ophandler_t *h;
-       rvm_opinfo_t *opinfo;
+       rjs_ophandler_t *h;
+       rjs_opinfo_t *opinfo;
        unsigned int index;
        rstring_t tempstr1, tempstr2;
        rvmreg_t temparg1, temparg2;
@@ -131,10 +131,10 @@ void rvm_opmap_invoke_binary_handler(rvm_opmap_t *opmap, ruint16 opid, rvmcpu_t
        }
 
 
-       index = RVM_OP_HANDLER(RVM_REG_GETTYPE(arg1), RVM_REG_GETTYPE(arg2));
+       index = RJS_BINARY_HANDLER(RVM_REG_GETTYPE(arg1), RVM_REG_GETTYPE(arg2));
        if (opid >= r_array_length(opmap->operators))
                goto error;
-       opinfo = ((rvm_opinfo_t*)r_array_slot(opmap->operators, opid));
+       opinfo = ((rjs_opinfo_t*)r_array_slot(opmap->operators, opid));
        h = &opinfo->handlers[index];
        if (h->op == NULL)
                goto error;
@@ -146,10 +146,10 @@ error:
 }
 
 
-void rvm_opmap_invoke_unary_handler(rvm_opmap_t *opmap, ruint16 opid, rvmcpu_t *cpu, rvmreg_t *res, const rvmreg_t *arg)
+void rjs_opmap_invoke_unary_handler(rjs_opmap_t *opmap, ruint16 opid, rvmcpu_t *cpu, rvmreg_t *res, const rvmreg_t *arg)
 {
-       rvm_ophandler_t *h;
-       rvm_opinfo_t *opinfo;
+       rjs_ophandler_t *h;
+       rjs_opinfo_t *opinfo;
        unsigned int index;
        rstring_t tempstr;
        rvmreg_t temparg;
@@ -163,10 +163,10 @@ void rvm_opmap_invoke_unary_handler(rvm_opmap_t *opmap, ruint16 opid, rvmcpu_t *
                arg = &temparg;
        }
 
-       index = RVM_UNARY_HANDLER(RVM_REG_GETTYPE(arg));
+       index = RJS_UNARY_HANDLER(RVM_REG_GETTYPE(arg));
        if (opid >= r_array_length(opmap->operators))
                goto error;
-       opinfo = ((rvm_opinfo_t*)r_array_slot(opmap->operators, opid));
+       opinfo = ((rjs_opinfo_t*)r_array_slot(opmap->operators, opid));
        h = &opinfo->handlers[index];
        if (h->unary == NULL)
                goto error;
diff --git a/rjs/rvmoperator.h b/rjs/rvmoperator.h
new file mode 100644 (file)
index 0000000..6f7a13c
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ *  Regular Pattern Analyzer (RPA)
+ *  Copyright (c) 2009-2010 Martin Stoilov
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *  Martin Stoilov <martin@rpasearch.com>
+ */
+
+#ifndef _RVMOPERATOR_H_
+#define _RVMOPERATOR_H_
+
+#include "rtypes.h"
+#include "rlib/rarray.h"
+#include "rvm/rvmcpu.h"
+
+#define RJS_UNARY_HANDLER(__t__) (__t__)
+#define RJS_BINARY_HANDLER(__ft__, __st__) ((__ft__) * RVM_DTYPE_MAX + (__st__))
+#define RJS_USERDATA2MAP(__ud__) ((rjs_opmap_t*)(__ud__))
+
+enum {
+       RJS_OPID_NONE = 0,
+       RJS_OPID_ADD,
+       RJS_OPID_SUB,
+       RJS_OPID_MUL,
+       RJS_OPID_DIV,
+       RJS_OPID_CAT,
+       RJS_OPID_CAST,
+       RJS_OPID_LSL,
+       RJS_OPID_LSR,
+       RJS_OPID_LSRU,
+       RJS_OPID_AND,
+       RJS_OPID_XOR,
+       RJS_OPID_OR,
+       RJS_OPID_NOT,
+       RJS_OPID_CMP,
+       RJS_OPID_CMN,
+       RJS_OPID_MOD,
+       RJS_OPID_LOGICAND,
+       RJS_OPID_LOGICOR,
+       RJS_OPID_LOGICNOT,
+       RJS_OPID_EQ,
+       RJS_OPID_NOTEQ,
+       RJS_OPID_LESS,
+       RJS_OPID_LESSEQ,
+       RJS_OPID_GREATER,
+       RJS_OPID_GREATEREQ,
+
+       RJS_OPID_USER0,
+       RJS_OPID_USER1,
+       RJS_OPID_USER2,
+       RJS_OPID_USER3,
+       RJS_OPID_USER4,
+       RJS_OPID_USER5,
+       RJS_OPID_USER6,
+       RJS_OPID_USER7,
+       RJS_OPID_USER8,
+       RJS_OPID_USER9,
+       RJS_OPID_USER10,
+       RJS_OPID_USER11,
+       RJS_OPID_USER12,
+       RJS_OPID_USER13,
+       RJS_OPID_USER14,
+       RJS_OPID_USER15,
+       RJS_OPID_LAST
+};
+
+
+/*
+ * Important: the res pointer might be the same as one of the arguments, the operator must
+ * be implemented to take care of such cases.
+ */
+typedef void (*rjs_unaryop_handler)(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg);
+typedef void (*rjs_binaryop_handler)(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+
+typedef union rjs_ophandler_s {
+       rjs_unaryop_handler unary;
+       rjs_binaryop_handler op;
+} rjs_ophandler_t;
+
+typedef struct rjs_opinfo_s {
+       ruint16 opid;
+       rboolean unary;
+       rjs_ophandler_t *handlers;
+} rjs_opinfo_t;
+
+typedef struct rjs_opmap_s {
+       rarray_t *operators;
+} rjs_opmap_t;
+
+
+rjs_opmap_t *rjs_opmap_create();
+void rjs_opmap_destroy(rjs_opmap_t *opmap);
+void rjs_opmap_add_binary_operator(rjs_opmap_t *opmap, ruint16 opid);
+void rjs_opmap_add_unary_operator(rjs_opmap_t *opmap, ruint16 opid);
+int rjs_opmap_set_binary_handler(rjs_opmap_t *opmap, ruint16 opid, rjs_binaryop_handler func, unsigned char firstType, unsigned char secondType);
+int rjs_opmap_set_unary_handler(rjs_opmap_t *opmap, ruint16 opid, rjs_unaryop_handler func, unsigned char type);
+void rjs_opmap_invoke_binary_handler(rjs_opmap_t *opmap, ruint16 opid, rvmcpu_t *cpu, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+void rjs_opmap_invoke_unary_handler(rjs_opmap_t *opmap, ruint16 opid, rvmcpu_t *cpu, rvmreg_t *res, const rvmreg_t *arg);
+
+#endif
similarity index 86%
rename from rvm/rvmoperatoradd.c
rename to rjs/rvmoperatoradd.c
index 79630a3..d4e7d04 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_add_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_add_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
        r = op1 + op2;
@@ -35,7 +35,7 @@ void rvm_op_add_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_add_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_add_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        rword r;
        r = op1 + op2;
@@ -45,7 +45,7 @@ void rvm_op_add_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_N, r & RVM_SIGN_BIT);
 }
 
-void rvm_op_add_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_add_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        double r;
        r = op1 + op2;
@@ -56,7 +56,7 @@ void rvm_op_add_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, d
 }
 
 
-void rvm_op_concat_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_concat_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        rstring_t *s1 = (rstring_t *)RVM_REG_GETP(arg1);
        rstring_t *s2 = (rstring_t *)RVM_REG_GETP(arg2);
@@ -68,7 +68,7 @@ void rvm_op_concat_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, con
 }
 
 
-void rvm_op_concat_signed_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_concat_signed_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        rstring_t *s1 = r_string_create_from_signed(RVM_REG_GETL(arg1));
        rstring_t *s2 = (rstring_t *)RVM_REG_GETP(arg2);
@@ -81,7 +81,7 @@ void rvm_op_concat_signed_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, con
 }
 
 
-void rvm_op_concat_string_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_concat_string_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        rstring_t *s1 = (rstring_t *)RVM_REG_GETP(arg1);
        rstring_t *s2 = r_string_create_from_signed(RVM_REG_GETL(arg2));
@@ -94,7 +94,7 @@ void rvm_op_concat_string_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, con
 }
 
 
-void rvm_op_concat_double_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_concat_double_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        rstring_t *s1 = r_string_create_from_double(RVM_REG_GETD(arg1));
        rstring_t *s2 = (rstring_t *)RVM_REG_GETP(arg2);
@@ -107,7 +107,7 @@ void rvm_op_concat_double_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, con
 }
 
 
-void rvm_op_concat_string_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_concat_string_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        rstring_t *s1 = (rstring_t *)RVM_REG_GETP(arg1);
        rstring_t *s2 = r_string_create_from_double(RVM_REG_GETD(arg2));
similarity index 71%
rename from rvm/rvmoperatoradd.h
rename to rjs/rvmoperatoradd.h
index 2df0997..04361cd 100644 (file)
 #ifndef __RVMOPERATORADD_H_
 #define __RVMOPERATORADD_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_add_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_add_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_add_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
-void rvm_op_concat_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
-void rvm_op_concat_signed_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
-void rvm_op_concat_string_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
-void rvm_op_concat_double_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
-void rvm_op_concat_string_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+void rjs_op_add_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_add_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_add_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_concat_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+void rjs_op_concat_signed_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+void rjs_op_concat_string_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+void rjs_op_concat_double_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+void rjs_op_concat_string_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
 
 
 #ifdef __cplusplus
similarity index 82%
rename from rvm/rvmoperatorand.c
rename to rjs/rvmoperatorand.c
index 40ba9b6..c3d4f5f 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_and_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_and_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -34,7 +34,7 @@ void rvm_op_and_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_and_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_and_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        rword r;
 
@@ -46,7 +46,7 @@ void rvm_op_and_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 }
 
 
-void rvm_op_and_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_and_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
-       rvm_op_and_signed(cpu, opid, res, (long)op1, (long)op2);
+       rjs_op_and_signed(cpu, opid, res, (long)op1, (long)op2);
 }
similarity index 82%
rename from rvm/rvmoperatorand.h
rename to rjs/rvmoperatorand.h
index 22b00c7..0c14ce1 100644 (file)
 #ifndef __RVMOPERATORAND_H_
 #define __RVMOPERATORAND_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_and_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_and_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_and_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_and_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_and_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_and_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
diff --git a/rjs/rvmoperatorbin.c b/rjs/rvmoperatorbin.c
new file mode 100644 (file)
index 0000000..c775218
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ *  Regular Pattern Analyzer (RPA)
+ *  Copyright (c) 2009-2010 Martin Stoilov
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *  Martin Stoilov <martin@rpasearch.com>
+ */
+
+#include "rvmoperator.h"
+#include "rvm/rvmreg.h"
+#include "rvmoperatornot.h"
+#include "rvmoperatorbin.h"
+#include "rvmoperatorlsr.h"
+#include "rvmoperatorlsru.h"
+#include "rvmoperatoreq.h"
+#include "rvmoperatornoteq.h"
+#include "rvmoperatorlogicor.h"
+#include "rvmoperatorlogicand.h"
+#include "rvmoperatorless.h"
+#include "rvmoperatorlesseq.h"
+#include "rvmoperatorgreater.h"
+#include "rvmoperatorgreatereq.h"
+#include "rvmoperatoror.h"
+#include "rvmoperatorxor.h"
+#include "rvmoperatorcast.h"
+#include "rvmoperatorsub.h"
+#include "rvmoperatoradd.h"
+#include "rvmoperatormod.h"
+#include "rvmoperatormul.h"
+#include "rvmoperatorlsl.h"
+#include "rvmoperatorcmn.h"
+#include "rvmoperatorcmp.h"
+#include "rvmoperatorand.h"
+#include "rvmoperatorcat.h"
+#include "rvmoperatordiv.h"
+
+static rvm_binopmap_t binary_operations[RJS_OPID_LAST+1];
+
+static void rjs_op_abort_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+{
+       RVM_ABORT(cpu, RVM_E_ILLEGAL);
+}
+
+
+static void rjs_op_abort_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+{
+       RVM_ABORT(cpu, RVM_E_ILLEGAL);
+}
+
+
+static void rjs_op_abort_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+{
+       RVM_ABORT(cpu, RVM_E_ILLEGAL);
+}
+
+
+static void rjs_op_binary_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+{
+       binary_operations[opid].unsigned_binop_fun(cpu, opid, res, op1, op2);
+}
+
+
+static void rjs_op_binary_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+{
+       binary_operations[opid].long_binop_fun(cpu, opid, res, op1, op2);
+}
+
+
+static void rjs_op_binary_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+{
+       binary_operations[opid].double_binop_fun(cpu, opid, res, op1, op2);
+}
+
+
+static void rjs_op_binary_unsigned_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+{
+       rjs_op_binary_unsigned(cpu, opid, res, RVM_REG_GETU(arg1), RVM_REG_GETU(arg2));
+}
+
+
+static void rjs_op_binary_signed_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+{
+       rjs_op_binary_signed(cpu, opid, res, RVM_REG_GETL(arg1), RVM_REG_GETL(arg2));
+}
+
+
+static void rjs_op_binary_double_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+{
+       rjs_op_binary_double(cpu, opid, res, RVM_REG_GETD(arg1), (double)RVM_REG_GETL(arg2));
+}
+
+
+void rjs_op_binary_signed_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+{
+       rjs_op_binary_double(cpu, opid, res, (double)RVM_REG_GETL(arg1), RVM_REG_GETD(arg2));
+}
+
+
+static void rjs_op_binary_double_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+{
+       rjs_op_binary_double(cpu, opid, res, RVM_REG_GETD(arg1), RVM_REG_GETD(arg2));
+}
+
+
+static void rjs_op_binary_string_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+{
+       rvmreg_t s;
+
+       if (rvm_reg_str2double(&s, arg1) < 0)
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       rjs_op_binary_double(cpu, opid, res, RVM_REG_GETD(&s), RVM_REG_GETD(arg2));
+}
+
+
+static void rjs_op_binary_string_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+{
+       rvmreg_t s;
+
+       if (rvm_reg_str2num(&s, arg1) < 0)
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+
+       if (rvm_reg_gettype(&s) == RVM_DTYPE_DOUBLE) {
+               rjs_op_binary_double(cpu, opid, res, RVM_REG_GETD(&s), (double)RVM_REG_GETL(arg2));
+       } else {
+               rjs_op_binary_signed(cpu, opid, res, RVM_REG_GETL(&s), RVM_REG_GETL(arg2));
+       }
+}
+
+
+static void rjs_op_binary_double_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+{
+       rvmreg_t s;
+
+       if (rvm_reg_str2double(&s, arg2) < 0)
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       rjs_op_binary_double(cpu, opid, res, RVM_REG_GETD(arg1), RVM_REG_GETD(&s));
+}
+
+
+static void rjs_op_binary_signed_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+{
+       rvmreg_t s;
+
+       if (rvm_reg_str2num(&s, arg2) < 0)
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       if (rvm_reg_gettype(&s) == RVM_DTYPE_DOUBLE) {
+               rjs_op_binary_double(cpu, opid, res, (double)RVM_REG_GETL(arg1), RVM_REG_GETD(&s));
+       } else {
+               rjs_op_binary_signed(cpu, opid, res, RVM_REG_GETL(arg1), RVM_REG_GETL(&s));
+       }
+}
+
+
+static void rjs_op_binary_nan(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+{
+       rvm_reg_cleanup(res);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_NAN);
+}
+
+
+void rjs_op_binary_insert(rjs_opmap_t *opmap, ruint16 opid, rvm_binop_unsigned u, rvm_binop_signed l, rvm_binop_double d)
+{
+       int i;
+
+       binary_operations[opid].opid = opid;
+       binary_operations[opid].unsigned_binop_fun = u;
+       binary_operations[opid].long_binop_fun = l;
+       binary_operations[opid].double_binop_fun = d;
+       rjs_opmap_add_binary_operator(opmap, opid);
+
+       for (i = 0; i < RVM_DTYPE_USER; i++) {
+               rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_nan, RVM_DTYPE_NAN, i);
+               rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_nan, RVM_DTYPE_UNDEF, i);
+               rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_nan, i, RVM_DTYPE_NAN);
+               rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_nan, i, RVM_DTYPE_UNDEF);
+       }
+
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_unsigned_unsigned, RVM_DTYPE_BOOLEAN, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_unsigned_unsigned, RVM_DTYPE_BOOLEAN, RVM_DTYPE_UNSIGNED);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_signed_signed, RVM_DTYPE_BOOLEAN, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_signed_double, RVM_DTYPE_BOOLEAN, RVM_DTYPE_DOUBLE);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_signed_string, RVM_DTYPE_BOOLEAN, RVM_DTYPE_STRING);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_unsigned_unsigned, RVM_DTYPE_UNSIGNED, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_unsigned_unsigned, RVM_DTYPE_SIGNED, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_double_signed, RVM_DTYPE_DOUBLE, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_string_signed, RVM_DTYPE_STRING, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_unsigned_unsigned, RVM_DTYPE_UNSIGNED, RVM_DTYPE_UNSIGNED);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_double_double, RVM_DTYPE_DOUBLE, RVM_DTYPE_DOUBLE);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_signed_signed, RVM_DTYPE_SIGNED, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_signed_signed, RVM_DTYPE_UNSIGNED, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_signed_signed, RVM_DTYPE_SIGNED, RVM_DTYPE_UNSIGNED);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_signed_double, RVM_DTYPE_SIGNED, RVM_DTYPE_DOUBLE);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_signed_double, RVM_DTYPE_UNSIGNED, RVM_DTYPE_DOUBLE);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_double_signed, RVM_DTYPE_DOUBLE, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_double_signed, RVM_DTYPE_DOUBLE, RVM_DTYPE_UNSIGNED);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_string_signed, RVM_DTYPE_STRING, RVM_DTYPE_UNSIGNED);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_string_signed, RVM_DTYPE_STRING, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_string_double, RVM_DTYPE_STRING, RVM_DTYPE_DOUBLE);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_signed_string, RVM_DTYPE_UNSIGNED, RVM_DTYPE_STRING);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_signed_string, RVM_DTYPE_SIGNED, RVM_DTYPE_STRING);
+       rjs_opmap_set_binary_handler(opmap, opid, rjs_op_binary_double_string, RVM_DTYPE_DOUBLE, RVM_DTYPE_STRING);
+}
+
+
+void rjs_op_binary_init(rjs_opmap_t *opmap)
+{
+       int i;
+
+       for (i = 0; i < sizeof(binary_operations)/sizeof(binary_operations[0]); i++) {
+               binary_operations[i].opid = RJS_OPID_NONE;
+               binary_operations[i].unsigned_binop_fun = rjs_op_abort_unsigned;
+               binary_operations[i].long_binop_fun = rjs_op_abort_signed;
+               binary_operations[i].double_binop_fun = rjs_op_abort_double;
+       }
+
+       rjs_op_binary_insert(opmap, RJS_OPID_SUB, rjs_op_sub_unsigned, rjs_op_sub_signed, rjs_op_sub_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_MUL, rjs_op_mul_unsigned, rjs_op_mul_signed, rjs_op_mul_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_DIV, rjs_op_div_unsigned, rjs_op_div_signed, rjs_op_div_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_LSL, rjs_op_lsl_unsigned, rjs_op_lsl_signed, rjs_op_lsl_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_LSR, rjs_op_lsr_unsigned, rjs_op_lsr_signed, rjs_op_lsr_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_LSRU, rjs_op_lsru_unsigned, rjs_op_lsru_signed, rjs_op_lsru_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_AND, rjs_op_and_unsigned, rjs_op_and_signed, rjs_op_and_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_XOR, rjs_op_xor_unsigned, rjs_op_xor_signed, rjs_op_xor_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_OR, rjs_op_or_unsigned, rjs_op_or_signed, rjs_op_or_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_CMP, rjs_op_cmp_unsigned, rjs_op_cmp_signed, rjs_op_cmp_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_CMN, rjs_op_cmn_unsigned, rjs_op_cmn_signed, rjs_op_cmn_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_MOD, rjs_op_mod_unsigned, rjs_op_mod_signed, rjs_op_mod_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_LOGICOR, rjs_op_logicor_unsigned, rjs_op_logicor_signed, rjs_op_logicor_double);
+       rjs_op_binary_insert(opmap, RJS_OPID_LOGICAND, rjs_op_logicand_unsigned, rjs_op_logicand_signed, rjs_op_logicand_double);
+
+       rjs_op_binary_insert(opmap, RJS_OPID_ADD, rjs_op_add_unsigned, rjs_op_add_signed, rjs_op_add_double);
+       /*
+        * Overwrite RJS_OPID_ADD for string concatenation
+        */
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_ADD, rjs_op_concat_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_ADD, rjs_op_concat_string_signed, RVM_DTYPE_STRING, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_ADD, rjs_op_concat_string_signed, RVM_DTYPE_STRING, RVM_DTYPE_UNSIGNED);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_ADD, rjs_op_concat_signed_string, RVM_DTYPE_SIGNED, RVM_DTYPE_STRING);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_ADD, rjs_op_concat_signed_string, RVM_DTYPE_UNSIGNED, RVM_DTYPE_STRING);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_ADD, rjs_op_concat_string_double, RVM_DTYPE_STRING, RVM_DTYPE_DOUBLE);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_ADD, rjs_op_concat_double_string, RVM_DTYPE_DOUBLE, RVM_DTYPE_STRING);
+
+       rjs_op_binary_insert(opmap, RJS_OPID_EQ, rjs_op_eq_unsigned, rjs_op_eq_signed, rjs_op_eq_double);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_EQ, rjs_op_eq_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
+
+       rjs_op_binary_insert(opmap, RJS_OPID_NOTEQ, rjs_op_noteq_unsigned, rjs_op_noteq_signed, rjs_op_noteq_double);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_NOTEQ, rjs_op_noteq_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
+
+       rjs_op_binary_insert(opmap, RJS_OPID_LESS, rjs_op_less_unsigned, rjs_op_less_signed, rjs_op_less_double);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_LESS, rjs_op_less_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
+
+       rjs_op_binary_insert(opmap, RJS_OPID_LESSEQ, rjs_op_lesseq_unsigned, rjs_op_lesseq_signed, rjs_op_lesseq_double);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_LESSEQ, rjs_op_lesseq_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
+
+       rjs_op_binary_insert(opmap, RJS_OPID_GREATER, rjs_op_greater_unsigned, rjs_op_greater_signed, rjs_op_greater_double);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_GREATER, rjs_op_greater_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
+
+       rjs_op_binary_insert(opmap, RJS_OPID_GREATEREQ, rjs_op_greatereq_unsigned, rjs_op_greatereq_signed, rjs_op_greatereq_double);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_GREATEREQ, rjs_op_greatereq_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
+
+}
similarity index 91%
rename from rvm/rvmoperatorbin.h
rename to rjs/rvmoperatorbin.h
index febb429..fb6c34e 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef __RVMOPERATORBIN_H_
 #define __RVMOPERATORBIN_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
@@ -40,8 +40,8 @@ typedef struct rvm_binopmap_s {
        rvm_binop_double double_binop_fun;
 } rvm_binopmap_t;
 
-void rvm_op_binary_insert(rvm_opmap_t *opmap, ruint16 opid, rvm_binop_unsigned u, rvm_binop_signed l, rvm_binop_double d);
-void rvm_op_binary_init(rvm_opmap_t *opmap);
+void rjs_op_binary_insert(rjs_opmap_t *opmap, ruint16 opid, rvm_binop_unsigned u, rvm_binop_signed l, rvm_binop_double d);
+void rjs_op_binary_init(rjs_opmap_t *opmap);
 
 #ifdef __cplusplus
 }
similarity index 64%
rename from rvm/rvmoperatorcast.c
rename to rjs/rvmoperatorcast.c
index 8c00933..3261541 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_cast_static_static(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_static_static(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        *res = *arg1;
 }
 
 
-void rvm_op_cast_double_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_double_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        ruword r = (ruword)RVM_REG_GETD(arg1);
 
@@ -37,7 +37,7 @@ void rvm_op_cast_double_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, con
        RVM_REG_SETL(res, r);
 }
 
-void rvm_op_cast_double_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_double_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        long r = (long)RVM_REG_GETD(arg1);
 
@@ -47,7 +47,7 @@ void rvm_op_cast_double_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const
 }
 
 
-void rvm_op_cast_signed_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_signed_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        ruword r = (ruword)RVM_REG_GETL(arg1);
 
@@ -57,7 +57,7 @@ void rvm_op_cast_signed_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, con
 }
 
 
-void rvm_op_cast_signed_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_signed_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        double r = (double)RVM_REG_GETL(arg1);
 
@@ -67,7 +67,7 @@ void rvm_op_cast_signed_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const
 }
 
 
-void rvm_op_cast_signed_boolean(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_signed_boolean(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        ruword r = (ruword)RVM_REG_GETL(arg1);
 
@@ -77,7 +77,7 @@ void rvm_op_cast_signed_boolean(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, cons
 }
 
 
-void rvm_op_cast_double_boolean(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_double_boolean(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        ruword r = (ruword)RVM_REG_GETD(arg1);
 
@@ -87,7 +87,7 @@ void rvm_op_cast_double_boolean(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, cons
 }
 
 
-void rvm_op_cast_pointer_boolean(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_pointer_boolean(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        rpointer r = (rpointer)RVM_REG_GETP(arg1);
 
@@ -97,7 +97,7 @@ void rvm_op_cast_pointer_boolean(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, con
 }
 
 
-void rvm_op_cast_unsigned_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_unsigned_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        long r = (long)RVM_REG_GETU(arg1);
 
@@ -107,7 +107,7 @@ void rvm_op_cast_unsigned_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, con
 }
 
 
-void rvm_op_cast_unsigned_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_unsigned_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        double r = (double)RVM_REG_GETU(arg1);
 
@@ -117,7 +117,7 @@ void rvm_op_cast_unsigned_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, con
 }
 
 
-void rvm_op_cast_string_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_string_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        rvmreg_t s;
 
@@ -127,7 +127,7 @@ void rvm_op_cast_string_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, con
 }
 
 
-void rvm_op_cast_string_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_string_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        rvmreg_t s;
 
@@ -137,7 +137,7 @@ void rvm_op_cast_string_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const
 }
 
 
-void rvm_op_cast_string_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cast_string_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        rvmreg_t s;
 
@@ -147,32 +147,32 @@ void rvm_op_cast_string_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const
 }
 
 
-void rvm_op_cast_init(rvm_opmap_t *opmap)
+void rjs_op_cast_init(rjs_opmap_t *opmap)
 {
-       rvm_opmap_add_binary_operator(opmap, RVM_OPID_CAST);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_static_static, RVM_DTYPE_UNSIGNED, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_static_static, RVM_DTYPE_DOUBLE, RVM_DTYPE_DOUBLE);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_static_static, RVM_DTYPE_SIGNED, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_static_static, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_static_static, RVM_DTYPE_BOOLEAN, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_signed_boolean, RVM_DTYPE_SIGNED, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_signed_boolean, RVM_DTYPE_UNSIGNED, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_double_boolean, RVM_DTYPE_DOUBLE, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_pointer_boolean, RVM_DTYPE_STRING, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_pointer_boolean, RVM_DTYPE_ARRAY, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_pointer_boolean, RVM_DTYPE_HARRAY, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_unsigned_signed, RVM_DTYPE_BOOLEAN, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_unsigned_double, RVM_DTYPE_BOOLEAN, RVM_DTYPE_DOUBLE);
-
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_signed_double, RVM_DTYPE_SIGNED, RVM_DTYPE_DOUBLE);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_signed_unsigned, RVM_DTYPE_SIGNED, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_double_signed, RVM_DTYPE_DOUBLE, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_double_unsigned, RVM_DTYPE_DOUBLE, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_unsigned_signed, RVM_DTYPE_UNSIGNED, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_unsigned_double, RVM_DTYPE_UNSIGNED, RVM_DTYPE_DOUBLE);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_string_unsigned, RVM_DTYPE_STRING, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_string_signed, RVM_DTYPE_STRING, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_string_double, RVM_DTYPE_STRING, RVM_DTYPE_DOUBLE);
+       rjs_opmap_add_binary_operator(opmap, RJS_OPID_CAST);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_static_static, RVM_DTYPE_UNSIGNED, RVM_DTYPE_UNSIGNED);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_static_static, RVM_DTYPE_DOUBLE, RVM_DTYPE_DOUBLE);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_static_static, RVM_DTYPE_SIGNED, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_static_static, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_static_static, RVM_DTYPE_BOOLEAN, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_signed_boolean, RVM_DTYPE_SIGNED, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_signed_boolean, RVM_DTYPE_UNSIGNED, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_double_boolean, RVM_DTYPE_DOUBLE, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_pointer_boolean, RVM_DTYPE_STRING, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_pointer_boolean, RVM_DTYPE_ARRAY, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_pointer_boolean, RVM_DTYPE_HARRAY, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_unsigned_signed, RVM_DTYPE_BOOLEAN, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_unsigned_double, RVM_DTYPE_BOOLEAN, RVM_DTYPE_DOUBLE);
+
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_signed_double, RVM_DTYPE_SIGNED, RVM_DTYPE_DOUBLE);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_signed_unsigned, RVM_DTYPE_SIGNED, RVM_DTYPE_UNSIGNED);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_double_signed, RVM_DTYPE_DOUBLE, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_double_unsigned, RVM_DTYPE_DOUBLE, RVM_DTYPE_UNSIGNED);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_unsigned_signed, RVM_DTYPE_UNSIGNED, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_unsigned_double, RVM_DTYPE_UNSIGNED, RVM_DTYPE_DOUBLE);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_string_unsigned, RVM_DTYPE_STRING, RVM_DTYPE_UNSIGNED);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_string_signed, RVM_DTYPE_STRING, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_binary_handler(opmap, RJS_OPID_CAST, rjs_op_cast_string_double, RVM_DTYPE_STRING, RVM_DTYPE_DOUBLE);
 
 }
 
similarity index 79%
rename from rvm/rvmoperatorcast.h
rename to rjs/rvmoperatorcast.h
index 1e8bcc2..0de33f8 100644 (file)
 #ifndef __RVMOPERATORCAST_H_
 #define __RVMOPERATORCAST_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_cast_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_cast_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_cast_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_cast_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_cast_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_cast_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
-void rvm_op_cast_init(rvm_opmap_t *opmap);
+void rjs_op_cast_init(rjs_opmap_t *opmap);
 
 #ifdef __cplusplus
 }
similarity index 92%
rename from rvm/rvmoperatorcat.c
rename to rjs/rvmoperatorcat.c
index ff36e3c..d8ea764 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rlib/rstring.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_cat_string_string(rvmcpu_t *cpu, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_cat_string_string(rvmcpu_t *cpu, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        rstring_t *s1 = (rstring_t*)RVM_REG_GETP(arg1);
        rstring_t *s2 = (rstring_t*)RVM_REG_GETP(arg2);
similarity index 82%
rename from rvm/rvmoperatorcat.h
rename to rjs/rvmoperatorcat.h
index be4aa1b..8864212 100644 (file)
 #ifndef __RVMOPERATORCAT_H_
 #define __RVMOPERATORCAT_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_cat_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_cat_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_cat_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_cat_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_cat_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_cat_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 83%
rename from rvm/rvmoperatorcmn.c
rename to rjs/rvmoperatorcmn.c
index 5ddc272..5531b73 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_cmn_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_cmn_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -35,13 +35,13 @@ void rvm_op_cmn_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_cmn_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_cmn_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
-       rvm_op_cmn_unsigned(cpu, opid, res, op1, op2);
+       rjs_op_cmn_unsigned(cpu, opid, res, op1, op2);
 }
 
 
-void rvm_op_cmn_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_cmn_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        double r;
 
similarity index 82%
rename from rvm/rvmoperatorcmn.h
rename to rjs/rvmoperatorcmn.h
index 75ee73a..a2b652a 100644 (file)
 #ifndef __RVMOPERATORCMN_H_
 #define __RVMOPERATORCMN_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_cmn_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_cmn_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_cmn_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_cmn_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_cmn_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_cmn_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 83%
rename from rvm/rvmoperatorcmp.c
rename to rjs/rvmoperatorcmp.c
index 858e61b..bd6d854 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_cmp_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_cmp_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -36,13 +36,13 @@ void rvm_op_cmp_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_cmp_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_cmp_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
-       rvm_op_cmp_unsigned(cpu, opid, res, op1, op2);
+       rjs_op_cmp_unsigned(cpu, opid, res, op1, op2);
 }
 
 
-void rvm_op_cmp_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_cmp_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        double r;
 
similarity index 82%
rename from rvm/rvmoperatorcmp.h
rename to rjs/rvmoperatorcmp.h
index 1145133..11e1a35 100644 (file)
 #ifndef __RVMOPERATORCMP_H_
 #define __RVMOPERATORCMP_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_cmp_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_cmp_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_cmp_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_cmp_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_cmp_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_cmp_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 87%
rename from rvm/rvmoperatordiv.c
rename to rjs/rvmoperatordiv.c
index 8531ec8..eb8736a 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_div_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_div_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -36,7 +36,7 @@ void rvm_op_div_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_div_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_div_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        rword r;
 
@@ -50,7 +50,7 @@ void rvm_op_div_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 }
 
 
-void rvm_op_div_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_div_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        double r;
 
similarity index 82%
rename from rvm/rvmoperatordiv.h
rename to rjs/rvmoperatordiv.h
index 7e70d1d..5a90d89 100644 (file)
 #ifndef __RVMOPERATORDIV_H_
 #define __RVMOPERATORDIV_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_div_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_div_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_div_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_div_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_div_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_div_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 84%
rename from rvm/rvmoperatoreq.c
rename to rjs/rvmoperatoreq.c
index 4d12741..4312cf1 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_eq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_eq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -33,7 +33,7 @@ void rvm_op_eq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_eq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_eq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        ruword r;
 
@@ -44,7 +44,7 @@ void rvm_op_eq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rwo
 }
 
 
-void rvm_op_eq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_eq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        ruword r;
 
@@ -55,7 +55,7 @@ void rvm_op_eq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, do
 }
 
 
-void rvm_op_eq_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_eq_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        ruword r;
 
@@ -66,7 +66,7 @@ void rvm_op_eq_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, do
 }
 
 
-void rvm_op_eq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_eq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        ruword r;
        rstring_t *s1 = (rstring_t *)RVM_REG_GETP(arg1);
similarity index 79%
rename from rvm/rvmoperatoreq.h
rename to rjs/rvmoperatoreq.h
index 45f6c96..c46ce36 100644 (file)
 #ifndef __RVMOPERATOREQ_H_
 #define __RVMOPERATOREQ_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_eq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_eq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_eq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
-void rvm_op_eq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+void rjs_op_eq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_eq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_eq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_eq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
 
 #ifdef __cplusplus
 }
similarity index 85%
rename from rvm/rvmoperatorgreater.c
rename to rjs/rvmoperatorgreater.c
index 173fab8..04a6991 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_greater_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_greater_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -33,7 +33,7 @@ void rvm_op_greater_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword
 }
 
 
-void rvm_op_greater_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_greater_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        ruword r;
 
@@ -44,7 +44,7 @@ void rvm_op_greater_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1
 }
 
 
-void rvm_op_greater_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_greater_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        ruword r;
 
@@ -55,7 +55,7 @@ void rvm_op_greater_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op
 }
 
 
-void rvm_op_greater_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_greater_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        ruword r;
        rstring_t *s1 = (rstring_t *)RVM_REG_GETP(arg1);
similarity index 79%
rename from rvm/rvmoperatorgreater.h
rename to rjs/rvmoperatorgreater.h
index 241e164..0cffe5d 100644 (file)
 #ifndef __RVMOPERATORGREATER_H_
 #define __RVMOPERATORGREATER_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_greater_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_greater_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_greater_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
-void rvm_op_greater_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+void rjs_op_greater_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_greater_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_greater_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_greater_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
 
 #ifdef __cplusplus
 }
similarity index 85%
rename from rvm/rvmoperatorgreatereq.c
rename to rjs/rvmoperatorgreatereq.c
index e4ec1ec..81f6e0b 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_greatereq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_greatereq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -33,7 +33,7 @@ void rvm_op_greatereq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruwor
 }
 
 
-void rvm_op_greatereq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_greatereq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        ruword r;
 
@@ -44,7 +44,7 @@ void rvm_op_greatereq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword o
 }
 
 
-void rvm_op_greatereq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_greatereq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        ruword r;
 
@@ -55,7 +55,7 @@ void rvm_op_greatereq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double
 }
 
 
-void rvm_op_greatereq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_greatereq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        ruword r;
        rstring_t *s1 = (rstring_t *)RVM_REG_GETP(arg1);
similarity index 79%
rename from rvm/rvmoperatorgreatereq.h
rename to rjs/rvmoperatorgreatereq.h
index e5f3c60..2f5aef2 100644 (file)
 #ifndef __RVMOPERATORGREATEREQ_H_
 #define __RVMOPERATORMULGREATEREQ_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_greatereq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_greatereq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_greatereq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
-void rvm_op_greatereq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+void rjs_op_greatereq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_greatereq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_greatereq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_greatereq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
 
 #ifdef __cplusplus
 }
similarity index 85%
rename from rvm/rvmoperatorless.c
rename to rjs/rvmoperatorless.c
index a83d9fd..bc80e13 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_less_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_less_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -33,7 +33,7 @@ void rvm_op_less_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1
 }
 
 
-void rvm_op_less_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_less_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        ruword r;
 
@@ -44,7 +44,7 @@ void rvm_op_less_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, r
 }
 
 
-void rvm_op_less_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_less_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        ruword r;
 
@@ -55,7 +55,7 @@ void rvm_op_less_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1,
 }
 
 
-void rvm_op_less_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_less_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        ruword r;
        rstring_t *s1 = (rstring_t *)RVM_REG_GETP(arg1);
similarity index 79%
rename from rvm/rvmoperatorless.h
rename to rjs/rvmoperatorless.h
index 9ec4980..ae6eadb 100644 (file)
 #ifndef __RVMOPERATORLESS_H_
 #define __RVMOPERATORLESS_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_less_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_less_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_less_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
-void rvm_op_less_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+void rjs_op_less_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_less_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_less_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_less_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
 
 #ifdef __cplusplus
 }
similarity index 85%
rename from rvm/rvmoperatorlesseq.c
rename to rjs/rvmoperatorlesseq.c
index 0bc0a1c..04004ab 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_lesseq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_lesseq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -33,7 +33,7 @@ void rvm_op_lesseq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword o
 }
 
 
-void rvm_op_lesseq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_lesseq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        ruword r;
 
@@ -44,7 +44,7 @@ void rvm_op_lesseq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1,
 }
 
 
-void rvm_op_lesseq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_lesseq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        ruword r;
 
@@ -55,7 +55,7 @@ void rvm_op_lesseq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1
 }
 
 
-void rvm_op_lesseq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_lesseq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        ruword r;
        rstring_t *s1 = (rstring_t *)RVM_REG_GETP(arg1);
similarity index 79%
rename from rvm/rvmoperatorlesseq.h
rename to rjs/rvmoperatorlesseq.h
index 5e4f70f..9974c9d 100644 (file)
 #ifndef __RVMOPERATORLESSEQ_H_
 #define __RVMOPERATORLESSEQ_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_lesseq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_lesseq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_lesseq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
-void rvm_op_lesseq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+void rjs_op_lesseq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_lesseq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_lesseq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_lesseq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
 
 #ifdef __cplusplus
 }
similarity index 84%
rename from rvm/rvmoperatorlogicand.c
rename to rjs/rvmoperatorlogicand.c
index 09bc2de..226dcda 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
-#include "rvm/rvmoperatorlogicand.h"
+#include "rvmoperator.h"
+#include "rvmoperatorlogicand.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_logicand_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_logicand_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -34,7 +34,7 @@ void rvm_op_logicand_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword
 }
 
 
-void rvm_op_logicand_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_logicand_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        ruword r;
 
@@ -45,7 +45,7 @@ void rvm_op_logicand_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op
 }
 
 
-void rvm_op_logicand_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_logicand_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        ruword r;
 
similarity index 82%
rename from rvm/rvmoperatorlogicand.h
rename to rjs/rvmoperatorlogicand.h
index 6cd925c..eba8b5b 100644 (file)
 #ifndef __RVMOPERATORLOGICAND_H_
 #define __RVMOPERATORLOGICAND_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_logicand_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_logicand_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_logicand_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_logicand_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_logicand_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_logicand_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 67%
rename from rvm/rvmoperatorlogicnot.c
rename to rjs/rvmoperatorlogicnot.c
index 8170e90..db12044 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-static void rvm_op_logicnot_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
+static void rjs_op_logicnot_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
 {
        ruword r;
 
@@ -33,7 +33,7 @@ static void rvm_op_logicnot_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res,
 }
 
 
-static void rvm_op_logicnot_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
+static void rjs_op_logicnot_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
 {
        ruword r;
 
@@ -44,7 +44,7 @@ static void rvm_op_logicnot_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, c
 }
 
 
-static void rvm_op_logicnot_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
+static void rjs_op_logicnot_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
 {
        ruword r;
 
@@ -55,7 +55,7 @@ static void rvm_op_logicnot_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, c
 }
 
 
-static void rvm_op_logicnot_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
+static void rjs_op_logicnot_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
 {
        ruword r;
 
@@ -66,26 +66,26 @@ static void rvm_op_logicnot_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, c
 }
 
 
-static void rvm_op_logicnot_nan(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
+static void rjs_op_logicnot_nan(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
 {
        rvm_reg_cleanup(res);
        RVM_REG_SETTYPE(res, RVM_DTYPE_NAN);
 }
 
 
-void rvm_op_logicnot_init(rvm_opmap_t *opmap)
+void rjs_op_logicnot_init(rjs_opmap_t *opmap)
 {
        int i;
-       rvm_opmap_add_unary_operator(opmap, RVM_OPID_LOGICNOT);
+       rjs_opmap_add_unary_operator(opmap, RJS_OPID_LOGICNOT);
        for (i = 0; i < RVM_DTYPE_USER; i++) {
-               rvm_opmap_set_unary_handler(opmap, RVM_OPID_LOGICNOT, rvm_op_logicnot_nan, RVM_DTYPE_NAN);
-               rvm_opmap_set_unary_handler(opmap, RVM_OPID_LOGICNOT, rvm_op_logicnot_nan, RVM_DTYPE_UNDEF);
+               rjs_opmap_set_unary_handler(opmap, RJS_OPID_LOGICNOT, rjs_op_logicnot_nan, RVM_DTYPE_NAN);
+               rjs_opmap_set_unary_handler(opmap, RJS_OPID_LOGICNOT, rjs_op_logicnot_nan, RVM_DTYPE_UNDEF);
        }
-       rvm_opmap_set_unary_handler(opmap, RVM_OPID_LOGICNOT, rvm_op_logicnot_unsigned, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_unary_handler(opmap, RVM_OPID_LOGICNOT, rvm_op_logicnot_unsigned, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_unary_handler(opmap, RVM_OPID_LOGICNOT, rvm_op_logicnot_unsigned, RVM_DTYPE_ARRAY);
-       rvm_opmap_set_unary_handler(opmap, RVM_OPID_LOGICNOT, rvm_op_logicnot_unsigned, RVM_DTYPE_HARRAY);
-       rvm_opmap_set_unary_handler(opmap, RVM_OPID_LOGICNOT, rvm_op_logicnot_signed, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_unary_handler(opmap, RVM_OPID_LOGICNOT, rvm_op_logicnot_double, RVM_DTYPE_DOUBLE);
-       rvm_opmap_set_unary_handler(opmap, RVM_OPID_LOGICNOT, rvm_op_logicnot_string, RVM_DTYPE_STRING);
+       rjs_opmap_set_unary_handler(opmap, RJS_OPID_LOGICNOT, rjs_op_logicnot_unsigned, RVM_DTYPE_UNSIGNED);
+       rjs_opmap_set_unary_handler(opmap, RJS_OPID_LOGICNOT, rjs_op_logicnot_unsigned, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_unary_handler(opmap, RJS_OPID_LOGICNOT, rjs_op_logicnot_unsigned, RVM_DTYPE_ARRAY);
+       rjs_opmap_set_unary_handler(opmap, RJS_OPID_LOGICNOT, rjs_op_logicnot_unsigned, RVM_DTYPE_HARRAY);
+       rjs_opmap_set_unary_handler(opmap, RJS_OPID_LOGICNOT, rjs_op_logicnot_signed, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_unary_handler(opmap, RJS_OPID_LOGICNOT, rjs_op_logicnot_double, RVM_DTYPE_DOUBLE);
+       rjs_opmap_set_unary_handler(opmap, RJS_OPID_LOGICNOT, rjs_op_logicnot_string, RVM_DTYPE_STRING);
 }
similarity index 92%
rename from rvm/rvmoperatorlogicnot.h
rename to rjs/rvmoperatorlogicnot.h
index eb7a923..305e79e 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef __RVMOPERATORLOGICNOT_H_
 #define __RVMOPERATORLOGICNOT_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
@@ -29,7 +29,7 @@ extern "C" {
 #endif
 
 
-void rvm_op_logicnot_init(rvm_opmap_t *opmap);
+void rjs_op_logicnot_init(rjs_opmap_t *opmap);
 
 #ifdef __cplusplus
 }
similarity index 84%
rename from rvm/rvmoperatorlogicor.c
rename to rjs/rvmoperatorlogicor.c
index 35ad4bc..9f54d84 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
-#include "rvm/rvmoperatorlogicor.h"
+#include "rvmoperator.h"
+#include "rvmoperatorlogicor.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_logicor_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_logicor_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -34,7 +34,7 @@ void rvm_op_logicor_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword
 }
 
 
-void rvm_op_logicor_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_logicor_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        ruword r;
 
@@ -45,7 +45,7 @@ void rvm_op_logicor_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1
 }
 
 
-void rvm_op_logicor_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_logicor_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        ruword r;
 
similarity index 82%
rename from rvm/rvmoperatorlogicor.h
rename to rjs/rvmoperatorlogicor.h
index 309e517..5be7d81 100644 (file)
 #ifndef __RVMOPERATORLOGICOR_H_
 #define __RVMOPERATORLOGICOR_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_logicor_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_logicor_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_logicor_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_logicor_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_logicor_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_logicor_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 82%
rename from rvm/rvmoperatorlsl.c
rename to rjs/rvmoperatorlsl.c
index 1fcdbb4..2935ac0 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_lsl_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_lsl_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -34,7 +34,7 @@ void rvm_op_lsl_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_lsl_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_lsl_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        rword r;
 
@@ -46,8 +46,8 @@ void rvm_op_lsl_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 }
 
 
-void rvm_op_lsl_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_lsl_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
-       rvm_op_lsl_signed(cpu, opid, res, (long)op1, (long)op2);
+       rjs_op_lsl_signed(cpu, opid, res, (long)op1, (long)op2);
 }
 
similarity index 82%
rename from rvm/rvmoperatorlsl.h
rename to rjs/rvmoperatorlsl.h
index c995a5b..48cd207 100644 (file)
 #ifndef __RVMOPERATORLSL_H_
 #define __RVMOPERATORLSL_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_lsl_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_lsl_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_lsl_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_lsl_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_lsl_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_lsl_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 82%
rename from rvm/rvmoperatorlsr.c
rename to rjs/rvmoperatorlsr.c
index 62e1ce1..7d473e8 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_lsr_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_lsr_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -34,7 +34,7 @@ void rvm_op_lsr_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_lsr_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_lsr_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        rword r;
 
@@ -46,8 +46,8 @@ void rvm_op_lsr_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 }
 
 
-void rvm_op_lsr_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_lsr_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
-       rvm_op_lsr_signed(cpu, opid, res, (long)op1, (long)op2);
+       rjs_op_lsr_signed(cpu, opid, res, (long)op1, (long)op2);
 }
 
similarity index 82%
rename from rvm/rvmoperatorlsr.h
rename to rjs/rvmoperatorlsr.h
index badc05c..b759df8 100644 (file)
 #ifndef __RVMOPERATORLSR_H_
 #define __RVMOPERATORLSR_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_lsr_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_lsr_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_lsr_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_lsr_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_lsr_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_lsr_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 77%
rename from rvm/rvmoperatorlsru.c
rename to rjs/rvmoperatorlsru.c
index b33a7aa..e67d34e 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_lsru_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_lsru_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -34,14 +34,14 @@ void rvm_op_lsru_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1
 }
 
 
-void rvm_op_lsru_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_lsru_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
-       rvm_op_lsru_unsigned(cpu, opid, res, op1, op2);
+       rjs_op_lsru_unsigned(cpu, opid, res, op1, op2);
 }
 
 
-void rvm_op_lsru_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_lsru_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
-       rvm_op_lsru_unsigned(cpu, opid, res, (ruword)((long)op1), (ruword)((long)op2));
+       rjs_op_lsru_unsigned(cpu, opid, res, (ruword)((long)op1), (ruword)((long)op2));
 }
 
similarity index 82%
rename from rvm/rvmoperatorlsru.h
rename to rjs/rvmoperatorlsru.h
index f2219e2..a58a24d 100644 (file)
 #ifndef __RVMOPERATORLSRU_H_
 #define __RVMOPERATORLSRU_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_lsru_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_lsru_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_lsru_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_lsru_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_lsru_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_lsru_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 88%
rename from rvm/rvmoperatormod.c
rename to rjs/rvmoperatormod.c
index 26f8d5c..95851c5 100644 (file)
  */
 
 #include "rlib/rmath.h"
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_mod_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_mod_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -37,7 +37,7 @@ void rvm_op_mod_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_mod_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_mod_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        rword r;
 
@@ -51,7 +51,7 @@ void rvm_op_mod_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 }
 
 
-void rvm_op_mod_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_mod_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        double r;
 
similarity index 82%
rename from rvm/rvmoperatormod.h
rename to rjs/rvmoperatormod.h
index 98d88fa..8ed1126 100644 (file)
 #ifndef __RVMOPERATORMOD_H_
 #define __RVMOPERATORMOD_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_mod_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_mod_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_mod_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_mod_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_mod_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_mod_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 87%
rename from rvm/rvmoperatormul.c
rename to rjs/rvmoperatormul.c
index f04b625..5705e22 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_mul_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_mul_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -35,7 +35,7 @@ void rvm_op_mul_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_mul_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_mul_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        rword r;
 
@@ -47,7 +47,7 @@ void rvm_op_mul_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 }
 
 
-void rvm_op_mul_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_mul_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        double r;
 
similarity index 82%
rename from rvm/rvmoperatormul.h
rename to rjs/rvmoperatormul.h
index 06a293e..d31f9ed 100644 (file)
 #ifndef __RVMOPERATORMUL_H_
 #define __RVMOPERATORMUL_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_mul_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_mul_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_mul_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_mul_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_mul_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_mul_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 62%
rename from rvm/rvmoperatornot.c
rename to rjs/rvmoperatornot.c
index 0e7fc8a..f7a5769 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-static void rvm_op_not_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
+static void rjs_op_not_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
 {
        ruword r;
 
@@ -34,38 +34,38 @@ static void rvm_op_not_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, cons
 }
 
 
-static void rvm_op_not_castunsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
+static void rjs_op_not_castunsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
 {
        rvmreg_t uarg;
 
        RVM_REG_SETTYPE(&uarg, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &uarg, arg1, &uarg);
+       rjs_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RJS_OPID_CAST, cpu, &uarg, arg1, &uarg);
        if (cpu->error)
                return;
-       rvm_op_not_unsigned(cpu, opid, res, &uarg);
+       rjs_op_not_unsigned(cpu, opid, res, &uarg);
 }
 
 
-static void rvm_op_not_nan(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
+static void rjs_op_not_nan(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1)
 {
        rvm_reg_cleanup(res);
        RVM_REG_SETTYPE(res, RVM_DTYPE_NAN);
 }
 
 
-void rvm_op_not_init(rvm_opmap_t *opmap)
+void rjs_op_not_init(rjs_opmap_t *opmap)
 {
        int i;
 
-       rvm_opmap_add_unary_operator(opmap, RVM_OPID_NOT);
+       rjs_opmap_add_unary_operator(opmap, RJS_OPID_NOT);
        for (i = 0; i < RVM_DTYPE_USER; i++) {
-               rvm_opmap_set_unary_handler(opmap, RVM_OPID_NOT, rvm_op_not_nan, RVM_DTYPE_NAN);
-               rvm_opmap_set_unary_handler(opmap, RVM_OPID_NOT, rvm_op_not_nan, RVM_DTYPE_UNDEF);
+               rjs_opmap_set_unary_handler(opmap, RJS_OPID_NOT, rjs_op_not_nan, RVM_DTYPE_NAN);
+               rjs_opmap_set_unary_handler(opmap, RJS_OPID_NOT, rjs_op_not_nan, RVM_DTYPE_UNDEF);
        }
 
-       rvm_opmap_set_unary_handler(opmap, RVM_OPID_NOT, rvm_op_not_unsigned, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_unary_handler(opmap, RVM_OPID_NOT, rvm_op_not_unsigned, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_unary_handler(opmap, RVM_OPID_NOT, rvm_op_not_castunsigned, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_unary_handler(opmap, RVM_OPID_NOT, rvm_op_not_castunsigned, RVM_DTYPE_DOUBLE);
-       rvm_opmap_set_unary_handler(opmap, RVM_OPID_NOT, rvm_op_not_castunsigned, RVM_DTYPE_STRING);
+       rjs_opmap_set_unary_handler(opmap, RJS_OPID_NOT, rjs_op_not_unsigned, RVM_DTYPE_UNSIGNED);
+       rjs_opmap_set_unary_handler(opmap, RJS_OPID_NOT, rjs_op_not_unsigned, RVM_DTYPE_BOOLEAN);
+       rjs_opmap_set_unary_handler(opmap, RJS_OPID_NOT, rjs_op_not_castunsigned, RVM_DTYPE_SIGNED);
+       rjs_opmap_set_unary_handler(opmap, RJS_OPID_NOT, rjs_op_not_castunsigned, RVM_DTYPE_DOUBLE);
+       rjs_opmap_set_unary_handler(opmap, RJS_OPID_NOT, rjs_op_not_castunsigned, RVM_DTYPE_STRING);
 }
similarity index 93%
rename from rvm/rvmoperatornot.h
rename to rjs/rvmoperatornot.h
index d60fb8a..1fcf867 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef __RVMOPERATORNOT_H_
 #define __RVMOPERATORNOT_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
@@ -29,7 +29,7 @@ extern "C" {
 #endif
 
 
-void rvm_op_not_init(rvm_opmap_t *opmap);
+void rjs_op_not_init(rjs_opmap_t *opmap);
 
 #ifdef __cplusplus
 }
similarity index 85%
rename from rvm/rvmoperatornoteq.c
rename to rjs/rvmoperatornoteq.c
index a9ffc2a..5233a56 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_noteq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_noteq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -33,7 +33,7 @@ void rvm_op_noteq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op
 }
 
 
-void rvm_op_noteq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_noteq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        ruword r;
 
@@ -44,7 +44,7 @@ void rvm_op_noteq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1,
 }
 
 
-void rvm_op_noteq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_noteq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        ruword r;
 
@@ -55,7 +55,7 @@ void rvm_op_noteq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1,
 }
 
 
-void rvm_op_noteq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
+void rjs_op_noteq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
 {
        ruword r;
        rstring_t *s1 = (rstring_t *)RVM_REG_GETP(arg1);
similarity index 79%
rename from rvm/rvmoperatornoteq.h
rename to rjs/rvmoperatornoteq.h
index 90c73ad..a20d167 100644 (file)
 #ifndef __RVMOPERATORNOTEQ_H_
 #define __RVMOPERATORNOTEQ_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_noteq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_noteq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_noteq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
-void rvm_op_noteq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
+void rjs_op_noteq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_noteq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_noteq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_noteq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
 
 #ifdef __cplusplus
 }
similarity index 82%
rename from rvm/rvmoperatoror.c
rename to rjs/rvmoperatoror.c
index 71a23ea..cf9012a 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_or_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_or_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -34,7 +34,7 @@ void rvm_op_or_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_or_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_or_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        rword r;
 
@@ -46,7 +46,7 @@ void rvm_op_or_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rwo
 }
 
 
-void rvm_op_or_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_or_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
-       rvm_op_or_signed(cpu, opid, res, (long)op1, (long)op2);
+       rjs_op_or_signed(cpu, opid, res, (long)op1, (long)op2);
 }
similarity index 82%
rename from rvm/rvmoperatoror.h
rename to rjs/rvmoperatoror.h
index 76c0ef9..71aa6da 100644 (file)
 #ifndef __RVMOPERATOROR_H_
 #define __RVMOPERATOROR_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_or_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_or_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_or_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_or_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_or_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_or_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 88%
rename from rvm/rvmoperatorsub.c
rename to rjs/rvmoperatorsub.c
index 00efeea..ce9ddc2 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_sub_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_sub_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -37,7 +37,7 @@ void rvm_op_sub_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_sub_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_sub_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        rword r;
 
@@ -49,7 +49,7 @@ void rvm_op_sub_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 }
 
 
-void rvm_op_sub_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_sub_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
        double r;
 
similarity index 82%
rename from rvm/rvmoperatorsub.h
rename to rjs/rvmoperatorsub.h
index 74c3885..219ace2 100644 (file)
 #ifndef __RVMOPERATORSUB_H_
 #define __RVMOPERATORSUB_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_sub_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_sub_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_sub_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_sub_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_sub_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_sub_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
similarity index 82%
rename from rvm/rvmoperatorxor.c
rename to rjs/rvmoperatorxor.c
index bea2602..2c2bce1 100644 (file)
  *  Martin Stoilov <martin@rpasearch.com>
  */
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 
-void rvm_op_xor_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
+void rjs_op_xor_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
 {
        ruword r;
 
@@ -34,7 +34,7 @@ void rvm_op_xor_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1,
 }
 
 
-void rvm_op_xor_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
+void rjs_op_xor_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
 {
        rword r;
 
@@ -46,7 +46,7 @@ void rvm_op_xor_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 }
 
 
-void rvm_op_xor_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
+void rjs_op_xor_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
 {
-       rvm_op_xor_signed(cpu, opid, res, (long)op1, (long)op2);
+       rjs_op_xor_signed(cpu, opid, res, (long)op1, (long)op2);
 }
similarity index 82%
rename from rvm/rvmoperatorxor.h
rename to rjs/rvmoperatorxor.h
index 2c67771..d7656e9 100644 (file)
 #ifndef __RVMOPERATORXOR_H_
 #define __RVMOPERATORXOR_H_
 
-#include "rvm/rvmoperator.h"
+#include "rvmoperator.h"
 #include "rvm/rvmreg.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void rvm_op_xor_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
-void rvm_op_xor_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
-void rvm_op_xor_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
+void rjs_op_xor_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2);
+void rjs_op_xor_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2);
+void rjs_op_xor_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2);
 
 #ifdef __cplusplus
 }
index 6c1cca4..48a4f39 100644 (file)
@@ -72,7 +72,7 @@ void rpa_dbex_debug_recordtail(rpadbex_t *dbex, long rec)
        if (dbex->debug) {
                rarray_t *records = dbex->records;
                rparecord_t *prec = (rparecord_t *) r_array_slot(records, rec);
-               rvm_asm_dump(rvm_codegen_getcode(dbex->co->cg, dbex->headoff), rvm_codegen_getcodesize(dbex->co->cg) - dbex->headoff);
+               rvm_asm_dump(NULL, rvm_codegen_getcode(dbex->co->cg, dbex->headoff), rvm_codegen_getcodesize(dbex->co->cg) - dbex->headoff);
                if (prec->type & RPA_RECORD_END) {
                        rpa_record_dump(records, rec);
                }
@@ -1629,7 +1629,7 @@ int rpa_dbex_dumpcode(rpadbex_t* dbex, rparule_t rid)
        info = (rpa_ruleinfo_t *)r_harray_get(dbex->rules, rid);
        if (!info)
                return -1;
-       rvm_asm_dump(rvm_codegen_getcode(dbex->co->cg, info->codeoff), info->codesiz);
+       rvm_asm_dump(dbex->pa->stat->cpu, rvm_codegen_getcode(dbex->co->cg, info->codeoff), info->codesiz);
        return 0;
 }
 
index 4e3153a..5bc2ed1 100644 (file)
@@ -9,38 +9,12 @@ TARGET_RVM_SO = $(OUTDIR)/$(RVM_SO)
 CFLAGS += -I$(SRCDIR)
 
 RVM_OBJECTS += $(OUTDIR)/rvmcpu.o 
-RVM_OBJECTS += $(OUTDIR)/rvmoperator.o
 RVM_OBJECTS += $(OUTDIR)/rvmcodemap.o
 RVM_OBJECTS += $(OUTDIR)/rvmrelocmap.o
 RVM_OBJECTS += $(OUTDIR)/rvmcodegen.o
 RVM_OBJECTS += $(OUTDIR)/rvmreg.o
 RVM_OBJECTS += $(OUTDIR)/rvmscope.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorbin.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatoradd.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorand.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatoreq.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatornoteq.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorlogicor.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorlogicand.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorlogicnot.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorless.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorlesseq.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorgreater.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorgreatereq.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorxor.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatoror.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorcmp.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorcmn.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorlsl.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorlsr.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorlsru.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorcast.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorcat.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatorsub.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatormul.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatordiv.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatormod.o
-RVM_OBJECTS += $(OUTDIR)/rvmoperatornot.o
+
 
 ifeq ($(OS), linux)
 all: $(OUTDIR) $(TARGET_RVM_LIB) $(TARGET_RVM_SO)
index 3ecaaff..b915333 100644 (file)
@@ -1,37 +1,10 @@
 TARGET=rvm.lib\r
 LINK32_OBJS= \\r
-       "$(OUTDIR)\rvmoperator.obj" \\r
        "$(OUTDIR)\rvmcodemap.obj" \\r
        "$(OUTDIR)\rvmrelocmap.obj" \\r
        "$(OUTDIR)\rvmcodegen.obj" \\r
        "$(OUTDIR)\rvmreg.obj" \\r
        "$(OUTDIR)\rvmscope.obj" \\r
-       "$(OUTDIR)\rvmoperatorbin.obj" \\r
-       "$(OUTDIR)\rvmoperatoradd.obj" \\r
-       "$(OUTDIR)\rvmoperatorand.obj" \\r
-       "$(OUTDIR)\rvmoperatoreq.obj" \\r
-       "$(OUTDIR)\rvmoperatornoteq.obj" \\r
-       "$(OUTDIR)\rvmoperatorlogicor.obj" \\r
-       "$(OUTDIR)\rvmoperatorlogicand.obj" \\r
-       "$(OUTDIR)\rvmoperatorlogicnot.obj" \\r
-       "$(OUTDIR)\rvmoperatorless.obj" \\r
-       "$(OUTDIR)\rvmoperatorlesseq.obj" \\r
-       "$(OUTDIR)\rvmoperatorgreater.obj" \\r
-       "$(OUTDIR)\rvmoperatorgreatereq.obj" \\r
-       "$(OUTDIR)\rvmoperatorxor.obj" \\r
-       "$(OUTDIR)\rvmoperatoror.obj" \\r
-       "$(OUTDIR)\rvmoperatorcmp.obj" \\r
-       "$(OUTDIR)\rvmoperatorcmn.obj" \\r
-       "$(OUTDIR)\rvmoperatorlsl.obj" \\r
-       "$(OUTDIR)\rvmoperatorlsr.obj" \\r
-       "$(OUTDIR)\rvmoperatorlsru.obj" \\r
-       "$(OUTDIR)\rvmoperatorcast.obj" \\r
-       "$(OUTDIR)\rvmoperatorcat.obj" \\r
-       "$(OUTDIR)\rvmoperatorsub.obj" \\r
-       "$(OUTDIR)\rvmoperatormul.obj" \\r
-       "$(OUTDIR)\rvmoperatordiv.obj" \\r
-       "$(OUTDIR)\rvmoperatormod.obj" \\r
-       "$(OUTDIR)\rvmoperatornot.obj" \\r
        "$(OUTDIR)\rvmcpu.obj" \\r
 \r
 \r
@@ -56,10 +29,6 @@ SOURCE="$(SRC_DIR)\rvmcpu.c"
 "$(OUTDIR)\rvmcpu.obj" : $(SOURCE) $(OUTDIR)\r
        $(CPP) $(CPP_FLAGS) $(SOURCE)\r
 \r
-SOURCE="$(SRC_DIR)\rvmoperator.c"\r
-"$(OUTDIR)\rvmoperator.obj" : $(SOURCE) $(OUTDIR)\r
-       $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
 SOURCE="$(SRC_DIR)\rvmcodemap.c"\r
 "$(OUTDIR)\rvmcodemap.obj" : $(SOURCE) $(OUTDIR)\r
        $(CPP) $(CPP_FLAGS) $(SOURCE)\r
@@ -79,108 +48,3 @@ SOURCE="$(SRC_DIR)\rvmreg.c"
 SOURCE="$(SRC_DIR)\rvmscope.c"\r
 "$(OUTDIR)\rvmscope.obj" : $(SOURCE) $(OUTDIR)\r
     $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorbin.c"\r
-"$(OUTDIR)\rvmoperatorbin.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatoradd.c"\r
-"$(OUTDIR)\rvmoperatoradd.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorand.c"\r
-"$(OUTDIR)\rvmoperatorand.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatoreq.c"\r
-"$(OUTDIR)\rvmoperatoreq.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatornoteq.c"\r
-"$(OUTDIR)\rvmoperatornoteq.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorlogicor.c"\r
-"$(OUTDIR)\rvmoperatorlogicor.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorlogicand.c"\r
-"$(OUTDIR)\rvmoperatorlogicand.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorlogicnot.c"\r
-"$(OUTDIR)\rvmoperatorlogicnot.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorless.c"\r
-"$(OUTDIR)\rvmoperatorless.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorlesseq.c"\r
-"$(OUTDIR)\rvmoperatorlesseq.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorgreater.c"\r
-"$(OUTDIR)\rvmoperatorgreater.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorgreatereq.c"\r
-"$(OUTDIR)\rvmoperatorgreatereq.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorxor.c"\r
-"$(OUTDIR)\rvmoperatorxor.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatoror.c"\r
-"$(OUTDIR)\rvmoperatoror.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorcmp.c"\r
-"$(OUTDIR)\rvmoperatorcmp.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorcmn.c"\r
-"$(OUTDIR)\rvmoperatorcmn.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorlsl.c"\r
-"$(OUTDIR)\rvmoperatorlsl.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorlsr.c"\r
-"$(OUTDIR)\rvmoperatorlsr.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorlsru.c"\r
-"$(OUTDIR)\rvmoperatorlsru.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorcast.c"\r
-"$(OUTDIR)\rvmoperatorcast.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorcat.c"\r
-"$(OUTDIR)\rvmoperatorcat.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatorsub.c"\r
-"$(OUTDIR)\rvmoperatorsub.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatormul.c"\r
-"$(OUTDIR)\rvmoperatormul.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatordiv.c"\r
-"$(OUTDIR)\rvmoperatordiv.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatormod.c"\r
-"$(OUTDIR)\rvmoperatormod.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
-SOURCE="$(SRC_DIR)\rvmoperatornot.c"\r
-"$(OUTDIR)\rvmoperatornot.obj" : $(SOURCE) $(OUTDIR)\r
-    $(CPP) $(CPP_FLAGS) $(SOURCE)\r
-\r
index d8de3db..6274ab0 100644 (file)
 #include <stdio.h>
 #include <stdarg.h>
 #include "rvm/rvmcpu.h"
-#include "rvm/rvmoperator.h"
-#include "rvm/rvmoperatorbin.h"
-#include "rvm/rvmoperatorcast.h"
-#include "rvm/rvmoperatornot.h"
-#include "rvm/rvmoperatorlogicnot.h"
 #include "rvm/rvmcodemap.h"
 #include "rlib/rmem.h"
 #include "rlib/rstring.h"
 
 #define RVM_DEFAULT_STACKSIZE (4 * 1024)
 
-static const char *stropcalls[] = {
-       "EXT",
-       "ABORT",
-       "PRN",
-       "ASR",
-       "SWI",
-       "SWIID",
-       "CALL",
-       "MOV",
-       "MOVS",
-       "SWP",
-       "INC",
-       "DEC",
-       "ADD",
-       "ADDS",
-       "ADC",
-       "AND",
-       "BIC",
-       "CLZ",
-       "CMN",
-       "XOR",
-       "SUB",
-       "SUBS",
-       "SBC",
-       "MUL",
-       "MLS",
-       "MULS",
-       "NOT",
-       "DIV",
-       "DVS",
-       "DIVS",
-       "MOD",
-       "MODS",
-       "BX",
-       "BXEQ",
-       "BXNEQ",
-       "BXLEQ",
-       "BXGEQ",
-       "BXLES",
-       "BXGRE",
-       "BXL",
-       "BL",
-       "B",
-       "STR",
-       "STRP",
-       "STRB",
-       "STRH",
-       "STRW",
-       "STRR",
-       "LDR",
-       "LDRP",
-       "LDRB",
-       "LDRH",
-       "LDRW",
-       "LDRR",
-       "CFLAG",
-       "CLR",
-       "CLRR",
-       "LSL",
-       "LSR",
-       "LSRS",
-       "STM",
-       "LDM",
-       "STS",
-       "LDS",
-       "ORR",
-       "PUSH",
-       "POP",
-       "CMP",
-       "NOP",
-       "BEQ",
-       "BNEQ",
-       "BLEQ",
-       "BGEQ",
-       "BLES",
-       "BGRE",
-       "RET",
-       "ROR",
-       "PUSHM",
-       "POPM",
-       "TST",
-       "TEQ",
-       "ADDRS",
-
-       "CAST",         /* Cast: op1 = (op3)op2 */
-       "TYPE",         /* Type: op1 = typeof(op2) */
-       "SETTYPE",      /* Type: op1.type = op2 */
-       "EMOV",
-       "ENEG",
-       "EADD",
-       "ESUB",
-       "EMUL",
-       "EDIV",
-       "EMOD",
-       "ELSL",
-       "ELSR",
-       "ELSRU",
-       "EAND",
-       "EORR",
-       "EXOR",
-       "ENOT",
-       "ELAND",
-       "ELOR",
-       "ELNOT",
-       "EEQ",
-       "ENOTEQ",
-       "EGREAT",
-       "EGREATEQ",
-       "ELESS",
-       "ELESSEQ",
-       "ECMP",
-       "ECMN",
-       "PROPLKUP",
-       "PROPLDR",
-       "STRALLOC",
-       "ARRALLOC",
-       "ADDRA",
-       "LDA",
-       "STA",
-       "MAPALLOC",
-       "MAPADDR",
-       "MAPKEYLDR",
-       "MAPLDR",
-       "MAPSTR",
-       "MAPDEL",
-       "MAPLKUP",
-       "MAPADD",
-       "MAPLKUPADD",
-       "MAPNEXT",
-       "MAPPREV",
-       "UNKNOWN",
-       "UNKNOWN",
-       "UNKNOWN",
-       "UNKNOWN",
-       "UNKNOWN",
-       "UNKNOWN",
-       "UNKNOWN",
-       "UNKNOWN",
-       "UNKNOWN",
-       "UNKNOWN",
-};
-
 
 static void rvm_op_b(rvmcpu_t *cpu, rvm_asmins_t *ins)
 {
@@ -1148,7 +1001,7 @@ int rvm_asm_dump_pi_to_str(rvmcpu_t *vm, rvm_asmins_t *pi, char *str, unsigned i
                char szSwi[64];
                r_memset(szSwi, 0, sizeof(szSwi));
                if (!vm) {
-                       rvm_snprintf(szSwi, sizeof(szSwi) - 1, "%s(%x)", stropcalls[pi->opcode], (ruint32)pi->swi);
+                       rvm_snprintf(szSwi, sizeof(szSwi) - 1, "OPCODE(%d)", pi->opcode);
                } else {
                        rvm_switable_t *switable;
                        unsigned int ntable = (unsigned int) RVM_SWI_TABLE(pi->swi);
@@ -1162,7 +1015,7 @@ int rvm_asm_dump_pi_to_str(rvmcpu_t *vm, rvm_asmins_t *pi, char *str, unsigned i
                if ((ret = rvm_snprintf(str, sz, "%16s   ", szSwi)) < 0)
                        return ret;
        } else {
-               if ((ret = rvm_snprintf(str, sz, "%16s   ", stropcalls[pi->opcode])) < 0)
+               if ((ret = rvm_snprintf(str, sz, "%16s   ", vm->ops[pi->opcode].name)) < 0)
                        return ret;
        }
        str += ret;
@@ -1217,11 +1070,11 @@ int rvm_asm_dump_pi_to_str(rvmcpu_t *vm, rvm_asmins_t *pi, char *str, unsigned i
 }
 
 
-void rvm_asm_dump(rvm_asmins_t *pi, unsigned int count)
+void rvm_asm_dump(rvmcpu_t *cpu, rvm_asmins_t *pi, unsigned int count)
 {
        char buffer[256];
        while (count) {
-               rvm_asm_dump_pi_to_str(NULL, pi, buffer, sizeof(buffer));
+               rvm_asm_dump_pi_to_str(cpu, pi, buffer, sizeof(buffer));
                rvm_printf("%s\n", buffer);
                ++pi;
                --count;
@@ -1255,17 +1108,6 @@ void rvm_cpu_dumpregs(rvmcpu_t *vm, rvm_asmins_t *pi)
 }
 
 
-static void rvm_op_cast(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_type_t type = (rvmreg_type_t)RVM_CPUREG_GETU(cpu, ins->op3);
-       rvmreg_t tmp;
-
-       RVM_REG_CLEAR(&tmp);
-       RVM_REG_SETTYPE(&tmp, type);
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, RVM_CPUREG_PTR(cpu, ins->op1), RVM_CPUREG_PTR(cpu, ins->op2), &tmp);
-}
-
-
 static void rvm_op_type(rvmcpu_t *cpu, rvm_asmins_t *ins)
 {
        rvmreg_type_t type = (rvmreg_type_t)RVM_CPUREG_GETTYPE(cpu, ins->op2);
@@ -1283,607 +1125,13 @@ static void rvm_op_settype(rvmcpu_t *cpu, rvm_asmins_t *ins)
 }
 
 
-static void rvm_op_emov(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvm_op_mov(cpu, ins);
-}
-
-
-static void rvm_op_eadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_ADD, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_esub(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_SUB, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_eneg(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t zero;
-
-       rvm_reg_setunsigned(&zero, 0);
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_SUB, cpu, RVM_CPUREG_PTR(cpu, ins->op1), &zero, arg2);
-}
-
-
-
-static void rvm_op_emul(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_MUL, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_ediv(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_DIV, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_emod(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_MOD, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_elsl(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_LSL, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_elsr(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_LSR, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_elsru(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_LSRU, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_eand(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_AND, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_eorr(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_OR, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_exor(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_XOR, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_enot(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-
-       rvm_opmap_invoke_unary_handler(cpu->opmap, RVM_OPID_NOT, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2);
-}
-
-
-static void rvm_op_eland(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_LOGICAND, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_elor(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_LOGICOR, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_elnot(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-
-       rvm_opmap_invoke_unary_handler(cpu->opmap, RVM_OPID_LOGICNOT, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2);
-}
-
-
-static void rvm_op_eeq(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_EQ, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_enoteq(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_NOTEQ, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_egreat(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_GREATER, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_egreateq(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_GREATEREQ, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_elesseq(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_LESSEQ, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_eless(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_LESS, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
-}
-
-
-static void rvm_op_ecmp(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CMP, cpu, NULL, arg1, arg2);
-}
-
-
-static void rvm_op_ecmn(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CMN, cpu, NULL, arg1, arg2);
-}
-
-
-static void rvm_op_stralloc(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rstring_t *s = r_string_create_strsize((const char*)RVM_CPUREG_GETP(cpu, ins->op2), (unsigned long)RVM_CPUREG_GETU(cpu, ins->op3));
-       if (!s) {
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       }
-       r_gc_add(cpu->gc, (robject_t*)s);
-       rvm_reg_setstring(arg1, s);
-}
-
-
-static void rvm_op_mapalloc(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rmap_t *a = r_map_create(sizeof(rvmreg_t), 7);
-       if (!a) {
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       }
-       r_gc_add(cpu->gc, (robject_t*)a);
-       rvm_reg_setjsobject(arg1, (robject_t*)a);
-}
-
-
-static void rvm_op_arralloc(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       ruword size = RVM_CPUREG_GETU(cpu, ins->op2);
-       rcarray_t *a = r_carray_create_rvmreg();
-       if (!a) {
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       }
-       r_carray_setlength(a, (unsigned long)size);
-       r_gc_add(cpu->gc, (robject_t*)a);
-       rvm_reg_setarray(arg1, (robject_t*)a);
-}
-
-
-static void rvm_op_proplookup(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       long index;
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-       rmap_t *a = (rmap_t*)RVM_REG_GETP(arg2);
-
-       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_STRING) {
-               index = r_map_lookup(a, -1, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size);
-       } else {
-               index = -1;
-       }
-
-       RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
-       RVM_REG_SETL(arg1, index);
-}
-
-
-static void rvm_op_propldr(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       long index;
-       rvmreg_t tmp = rvm_reg_create_signed(0);
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-//     rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-//     rmap_t *a = NULL;
-//     rpointer value;
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
-       index = (long)RVM_REG_GETL(&tmp);
-       rvm_reg_setundef(arg1);
-}
-
-
-static void rvm_op_maplookup(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       long index;
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-       rmap_t *a = (rmap_t*)RVM_REG_GETP(arg2);
-
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP) {
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       }
-       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_SIGNED || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
-               index = r_map_lookup_l(a, -1, (long)RVM_REG_GETL(arg3));
-       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_DOUBLE) {
-               index = r_map_lookup_d(a, -1, RVM_REG_GETD(arg3));
-       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_STRING) {
-               index = r_map_lookup(a, -1, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size);
-       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_POINTER) {
-               index = r_map_lookup(a, -1, (char*)RVM_CPUREG_GETP(cpu, ins->op3), (unsigned int)RVM_CPUREG_GETL(cpu, ins->op1));
-       } else {
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       }
-
-       RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
-       RVM_REG_SETL(arg1, index);
-}
-
-
-static void rvm_op_mapadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       long index;
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-       rmap_t *a = (rmap_t*)RVM_REG_GETP(arg2);
-
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP) {
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       }
-       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_SIGNED || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
-               index = r_map_gckey_add_l(a, cpu->gc, (long)RVM_REG_GETL(arg3), NULL);
-       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_DOUBLE) {
-               index = r_map_gckey_add_d(a, cpu->gc, RVM_REG_GETD(arg3), NULL);
-       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_STRING) {
-               index = r_map_gckey_add(a, cpu->gc, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size, NULL);
-       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_POINTER) {
-               index = r_map_gckey_add(a, cpu->gc, (char*)RVM_CPUREG_GETP(cpu, ins->op3), (unsigned int)RVM_CPUREG_GETL(cpu, ins->op1), NULL);
-       } else {
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       }
-
-       RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
-       RVM_REG_SETL(arg1, index);
-}
-
-
-static void rvm_op_maplookupadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       long index;
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
-       rmap_t *a = (rmap_t*)RVM_REG_GETP(arg2);
-
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP) {
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       }
-       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_SIGNED || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
-               index = r_map_lookup_l(a, -1, (long)RVM_REG_GETL(arg3));
-               if (index < 0)
-                       index = r_map_gckey_add_l(a, cpu->gc, (long)RVM_REG_GETL(arg3), NULL);
-       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_DOUBLE) {
-               index = r_map_lookup_d(a, -1, RVM_REG_GETD(arg3));
-               if (index < 0)
-                       index = r_map_gckey_add_d(a, cpu->gc, RVM_REG_GETD(arg3), NULL);
-       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_STRING) {
-               index = r_map_lookup(a, -1, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size);
-               if (index < 0)
-                       index = r_map_gckey_add(a, cpu->gc, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str, ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size, NULL);
-       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_POINTER) {
-               index = r_map_lookup(a, -1, (char*)RVM_CPUREG_GETP(cpu, ins->op3), (unsigned int)RVM_CPUREG_GETL(cpu, ins->op1));
-               if (index < 0)
-                       index = r_map_gckey_add(a, cpu->gc, (char*)RVM_CPUREG_GETP(cpu, ins->op3), (unsigned int)RVM_CPUREG_GETL(cpu, ins->op1), NULL);
-       } else {
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       }
-       RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
-       RVM_REG_SETL(arg1, index);
-}
-
-
-static void rvm_op_mapdel(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       int ret;
-       long index;
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t tmp = rvm_reg_create_signed(0);
-       rmap_t *a = NULL;
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
-       index = (long)RVM_REG_GETL(&tmp);
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       a = (rmap_t*)RVM_REG_GETP(arg2);
-       ret = r_map_delete(a, index);
-       rvm_reg_setboolean(arg1, ret == 0 ? 1 : 0);
-}
-
-
-static void rvm_op_mapaddr(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t tmp = rvm_reg_create_signed(0);
-       rmap_t *a;
-       rpointer value;
-       long index;
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
-       index = (long)RVM_REG_GETL(&tmp);
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       a = (rmap_t*)RVM_REG_GETP(arg2);
-       value = r_map_value(a, index);
-       if (!value)
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_POINTER);
-       RVM_REG_SETP(arg1, value);
-}
-
-
-static void rvm_op_mapldr(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t tmp = rvm_reg_create_signed(0);
-       rmap_t *a = NULL;
-       rpointer value;
-       long index;
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
-       index = (long)RVM_REG_GETL(&tmp);
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       a = (rmap_t*)RVM_REG_GETP(arg2);
-       value = r_map_value(a, index);
-       if (!value) {
-               RVM_REG_CLEAR(arg1);
-               RVM_REG_SETTYPE(arg1, RVM_DTYPE_UNDEF);
-       } else {
-               *arg1 = *((rvmreg_t*)value);
-       }
-}
-
-
-static void rvm_op_mapkeyldr(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t tmp = rvm_reg_create_signed(0);
-       rmap_t *a = NULL;
-       rstring_t *key;
-       long index;
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
-       index = (long)RVM_REG_GETL(&tmp);
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       a = (rmap_t*)RVM_REG_GETP(arg2);
-       key = r_map_key(a, index);
-       if (!key) {
-               RVM_REG_CLEAR(arg1);
-               RVM_REG_SETTYPE(arg1, RVM_DTYPE_UNDEF);
-       } else {
-               rvm_reg_setstring(arg1, key);
-       }
-}
-
-
-static void rvm_op_mapnext(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t tmp = rvm_reg_create_signed(0);
-       rmap_t *a = NULL;
-       long index;
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
-       index = (long)RVM_REG_GETL(&tmp);
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       a = (rmap_t*)RVM_REG_GETP(arg2);
-       if (index < 0)
-               index = r_map_first(a);
-       else
-               index = r_map_next(a, index);
-       RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
-       RVM_REG_SETL(arg1, index);
-}
-
-
-static void rvm_op_mapprev(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t tmp = rvm_reg_create_signed(0);
-       rmap_t *a = NULL;
-       long index;
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
-       index = (long)RVM_REG_GETL(&tmp);
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       a = (rmap_t*)RVM_REG_GETP(arg2);
-       if (index < 0)
-               index = r_map_last(a);
-       else
-               index = r_map_prev(a, index);
-       RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
-       RVM_REG_SETL(arg1, index);
-}
-
-
-static void rvm_op_mapstr(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t tmp = rvm_reg_create_signed(0);
-       rmap_t *a = NULL;
-       rpointer value;
-       long index;
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
-       index = (long)RVM_REG_GETL(&tmp);
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_MAP)
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       a = (rmap_t*)RVM_REG_GETP(arg2);
-       value = r_map_value(a, index);
-       if (!value)
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       r_map_setvalue(a, index, arg1);
-}
-
-
-static void rvm_op_addra(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rvmreg_t tmp = rvm_reg_create_signed(0);
-       rcarray_t *a = RVM_REG_GETP(arg2);
-       long index;
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
-       index = (long)RVM_REG_GETL(&tmp);
-
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_ARRAY || index < 0) {
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       }
-       RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_POINTER);
-       RVM_REG_SETP(arg1, r_carray_slot_expand(a, index));
-}
-
-
-static void rvm_op_lda(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       ruword index = RVM_CPUREG_GETU(cpu, ins->op3);
-       rcarray_t *a = RVM_REG_GETP(arg2);
-
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_ARRAY) {
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       }
-       *arg1 = *((rvmreg_t*)r_carray_slot_expand(a, (unsigned long)index));
-}
-
-
-static void rvm_op_sta(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
-       rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
-       rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       ruword index = RVM_CPUREG_GETU(cpu, ins->op3);
-       rcarray_t *a = RVM_REG_GETP(arg2);
-
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_ARRAY) {
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       }
-       r_carray_replace(a, (unsigned long)index, arg1);
-}
-
-
 static void rvm_op_abort(rvmcpu_t *cpu, rvm_asmins_t *ins)
 {
        RVM_ABORT(cpu, RVM_CPUREG_GETU(cpu, ins->op1));
 }
 
-
-static rvm_cpu_op ops[] = {
+#if 0
+static rvmcpu_op ops[] = {
        rvm_op_exit,            // RVM_EXT
        rvm_op_abort,           // RVM_ABORT
        rvm_op_prn,                     // RVM_PRN
@@ -1997,8 +1245,18 @@ static rvm_cpu_op ops[] = {
        rvm_op_elesseq,         // RVM_ELESSEQ
        rvm_op_ecmp,            // RVM_ECMP
        rvm_op_ecmn,            // RVM_ECMN
-       rvm_op_proplookup,      // RVM_PROPLKUP
+
+       rvm_op_proplookup,  // RVM_PROPLKUP
+       rvm_op_proplookupadd, //RVM_PROPLKUPADD
        rvm_op_propldr,         // RVM_PROPLDR
+       rvm_op_propstr,         // RVM_PROPSTR,
+       rvm_op_propaddr,        // RVM_PROPADDR
+       rvm_op_propkeyldr,      // RVM_PROPKEYLDR
+       rvm_op_propdel,         // RVM_PROPDEL
+       rvm_op_propnext,        // RVM_PROPNEXT
+       rvm_op_propprev,        // RVM_PROPPREV
+
+
        rvm_op_stralloc,        // RVM_STRALLOC
        rvm_op_arralloc,        // RVM_ARRALLOC
        rvm_op_addra,           // RVM_ADDRA
@@ -2025,6 +1283,17 @@ static rvm_cpu_op ops[] = {
        (void*) 0,
        
 };
+#endif
+
+
+int rvm_cpu_setophandler(rvmcpu_t *cpu, unsigned int opcode, const char *opname, rvmcpu_op op)
+{
+       if (opcode >= RVM_COUNT)
+               return -1;
+       cpu->ops[opcode].name = opname;
+       cpu->ops[opcode].op = op;
+       return 0;
+}
 
 
 rvmcpu_t *rvm_cpu_create(unsigned long stacksize)
@@ -2039,12 +1308,92 @@ rvmcpu_t *rvm_cpu_create(unsigned long stacksize)
        cpu->switables = r_harray_create(sizeof(rvm_switable_t*));
        cpu->stack = r_malloc(stacksize * sizeof(rvmreg_t));
        cpu->data = r_carray_create(sizeof(rvmreg_t));
-       cpu->opmap = rvm_opmap_create();
        cpu->gc = r_gc_create();
-       rvm_op_binary_init(cpu->opmap);
-       rvm_op_cast_init(cpu->opmap);
-       rvm_op_not_init(cpu->opmap);
-       rvm_op_logicnot_init(cpu->opmap);
+
+       rvm_cpu_setophandler(cpu, RVM_EXT, "EXT", rvm_op_exit);
+       rvm_cpu_setophandler(cpu, RVM_ABORT, "ABORT", rvm_op_abort);
+       rvm_cpu_setophandler(cpu, RVM_PRN, "PRN", rvm_op_prn);
+       rvm_cpu_setophandler(cpu, RVM_ASR, "ASR", rvm_op_asr);
+       rvm_cpu_setophandler(cpu, RVM_SWI, "SWI", rvm_op_swi);
+       rvm_cpu_setophandler(cpu, RVM_SWIID, "SWIID", rvm_op_swiid);
+       rvm_cpu_setophandler(cpu, RVM_CALL, "CALL", rvm_op_call);
+       rvm_cpu_setophandler(cpu, RVM_MOV, "MOV", rvm_op_mov);
+       rvm_cpu_setophandler(cpu, RVM_MOVS, "MOVS", rvm_op_movs);
+       rvm_cpu_setophandler(cpu, RVM_SWP, "SWP", rvm_op_swp);
+       rvm_cpu_setophandler(cpu, RVM_INC, "INC", rvm_op_inc);
+       rvm_cpu_setophandler(cpu, RVM_DEC, "DEC", rvm_op_dec);
+       rvm_cpu_setophandler(cpu, RVM_ADD, "ADD", rvm_op_add);
+       rvm_cpu_setophandler(cpu, RVM_ADDS, "ADDS", rvm_op_adds);
+       rvm_cpu_setophandler(cpu, RVM_ADC, "ADC", rvm_op_adc);
+       rvm_cpu_setophandler(cpu, RVM_AND, "AND", rvm_op_and);
+       rvm_cpu_setophandler(cpu, RVM_BIC, "BIC", rvm_op_bic);
+       rvm_cpu_setophandler(cpu, RVM_CLZ, "CLZ", rvm_op_clz);
+       rvm_cpu_setophandler(cpu, RVM_CMN, "CMN", rvm_op_cmn);
+       rvm_cpu_setophandler(cpu, RVM_XOR, "XOR", rvm_op_xor);
+       rvm_cpu_setophandler(cpu, RVM_SUB, "SUB", rvm_op_sub);
+       rvm_cpu_setophandler(cpu, RVM_SUBS, "SUBS", rvm_op_subs);
+       rvm_cpu_setophandler(cpu, RVM_SBC, "SBC", rvm_op_sbc);
+       rvm_cpu_setophandler(cpu, RVM_MUL, "MUL", rvm_op_mul);
+       rvm_cpu_setophandler(cpu, RVM_MLS, "MLS", rvm_op_mls);
+       rvm_cpu_setophandler(cpu, RVM_MULS, "MULS", rvm_op_muls);
+       rvm_cpu_setophandler(cpu, RVM_NOT, "NOT", rvm_op_not);
+       rvm_cpu_setophandler(cpu, RVM_DIV, "DIV", rvm_op_div);
+       rvm_cpu_setophandler(cpu, RVM_DVS, "DVS", rvm_op_dvs);
+       rvm_cpu_setophandler(cpu, RVM_DIVS, "DIVS", rvm_op_divs);
+       rvm_cpu_setophandler(cpu, RVM_MOD, "MOD", rvm_op_mod);
+       rvm_cpu_setophandler(cpu, RVM_MODS, "MODS", rvm_op_mods);
+       rvm_cpu_setophandler(cpu, RVM_BX, "BX", rvm_op_bx);
+       rvm_cpu_setophandler(cpu, RVM_BXEQ, "BXEQ", rvm_op_bxeq);
+       rvm_cpu_setophandler(cpu, RVM_BXNEQ, "BXNEQ", rvm_op_bxneq);
+       rvm_cpu_setophandler(cpu, RVM_BXLEQ, "BXLEQ", rvm_op_bxleq);
+       rvm_cpu_setophandler(cpu, RVM_BXGEQ, "BXGEQ", rvm_op_bxgeq);
+       rvm_cpu_setophandler(cpu, RVM_BXLES, "BXLES", rvm_op_bxles);
+       rvm_cpu_setophandler(cpu, RVM_BXGRE, "BXGRE", rvm_op_bxgre);
+       rvm_cpu_setophandler(cpu, RVM_BXL, "BXL", rvm_op_bxl);
+       rvm_cpu_setophandler(cpu, RVM_BL, "BL", rvm_op_bl);
+       rvm_cpu_setophandler(cpu, RVM_B, "B", rvm_op_b);
+       rvm_cpu_setophandler(cpu, RVM_STR, "STR", rvm_op_str);
+       rvm_cpu_setophandler(cpu, RVM_STRP, "STRP", rvm_op_strp);
+       rvm_cpu_setophandler(cpu, RVM_STRB, "STRB", rvm_op_strb);
+       rvm_cpu_setophandler(cpu, RVM_STRH, "STRH", rvm_op_strh);
+       rvm_cpu_setophandler(cpu, RVM_STRW, "STRW", rvm_op_strw);
+       rvm_cpu_setophandler(cpu, RVM_STRR, "STRR", rvm_op_strr);
+       rvm_cpu_setophandler(cpu, RVM_LDR, "LDR", rvm_op_ldr);
+       rvm_cpu_setophandler(cpu, RVM_LDRP, "LDRP", rvm_op_ldrp);
+       rvm_cpu_setophandler(cpu, RVM_LDRB, "LDRB", rvm_op_ldrb);
+       rvm_cpu_setophandler(cpu, RVM_LDRH, "LDRH", rvm_op_ldrh);
+       rvm_cpu_setophandler(cpu, RVM_LDRW, "LDRW", rvm_op_ldrw);
+       rvm_cpu_setophandler(cpu, RVM_LDRR, "LDRR", rvm_op_ldrr);
+       rvm_cpu_setophandler(cpu, RVM_CFLAG, "CFLAG", rvm_op_cflag);
+       rvm_cpu_setophandler(cpu, RVM_CLR, "CLR", rvm_op_clr);
+       rvm_cpu_setophandler(cpu, RVM_CLRR, "CLRR", rvm_op_clrr);
+       rvm_cpu_setophandler(cpu, RVM_LSL, "LSL", rvm_op_lsl);
+       rvm_cpu_setophandler(cpu, RVM_LSR, "LSR", rvm_op_lsr);
+       rvm_cpu_setophandler(cpu, RVM_LSRS, "LSRS", rvm_op_lsrs);
+       rvm_cpu_setophandler(cpu, RVM_STM, "STM", rvm_op_stm);
+       rvm_cpu_setophandler(cpu, RVM_LDM, "LDM", rvm_op_ldm);
+       rvm_cpu_setophandler(cpu, RVM_STS, "STS", rvm_op_sts);
+       rvm_cpu_setophandler(cpu, RVM_LDS, "LDS", rvm_op_lds);
+       rvm_cpu_setophandler(cpu, RVM_ORR, "ORR", rvm_op_orr);
+       rvm_cpu_setophandler(cpu, RVM_PUSH, "PUSH", rvm_op_push);
+       rvm_cpu_setophandler(cpu, RVM_POP, "POP", rvm_op_pop);
+       rvm_cpu_setophandler(cpu, RVM_CMP, "CMP", rvm_op_cmp);
+       rvm_cpu_setophandler(cpu, RVM_NOP, "NOP", rvm_op_nop);
+       rvm_cpu_setophandler(cpu, RVM_BEQ, "BEQ", rvm_op_beq);
+       rvm_cpu_setophandler(cpu, RVM_BNEQ, "BNEQ", rvm_op_bneq);
+       rvm_cpu_setophandler(cpu, RVM_BLEQ, "BLEQ", rvm_op_bleq);
+       rvm_cpu_setophandler(cpu, RVM_BGEQ, "BGEQ", rvm_op_bgeq);
+       rvm_cpu_setophandler(cpu, RVM_BLES, "BLES", rvm_op_bles);
+       rvm_cpu_setophandler(cpu, RVM_BGRE, "BGRE", rvm_op_bgre);
+       rvm_cpu_setophandler(cpu, RVM_RET, "RET", rvm_op_ret);
+       rvm_cpu_setophandler(cpu, RVM_ROR, "ROR", rvm_op_ror);
+       rvm_cpu_setophandler(cpu, RVM_PUSHM, "PUSHM", rvm_op_pushm);
+       rvm_cpu_setophandler(cpu, RVM_POPM, "POPM", rvm_op_popm);
+       rvm_cpu_setophandler(cpu, RVM_TST, "TST", rvm_op_tst);
+       rvm_cpu_setophandler(cpu, RVM_TEQ, "TEQ", rvm_op_teq);
+       rvm_cpu_setophandler(cpu, RVM_ADDRS, "ADDRS", rvm_op_addrs);
+       rvm_cpu_setophandler(cpu, RVM_SETTYPE, "SETTYPE", rvm_op_settype);
+       rvm_cpu_setophandler(cpu, RVM_TYPE, "TYPE", rvm_op_type);
 
        return cpu;
 }
@@ -2063,7 +1412,6 @@ void rvm_cpu_destroy(rvmcpu_t *cpu)
        r_object_destroy((robject_t*)cpu->switables);
        r_free(cpu->stack);
        r_object_destroy((robject_t*)cpu->data);
-       rvm_opmap_destroy(cpu->opmap);
        r_free(cpu);
 }
 
@@ -2114,7 +1462,7 @@ int rvm_cpu_exec(rvmcpu_t *cpu, rvm_asmins_t *prog, ruword off)
                        };
                }
 #endif
-               ops[pi->opcode](cpu, pi);
+               cpu->ops[pi->opcode].op(cpu, pi);
 #if RVM_CONDITIONAL_INSTRUCTIONS
 skipexec:
 #endif
@@ -2128,7 +1476,6 @@ skipexec:
 
 int rvm_cpu_exec_debug(rvmcpu_t *cpu, rvm_asmins_t *prog, ruword off)
 {
-       long line = 0;
        rvm_asmins_t *pi;
        rvmreg_t *regda = RVM_CPUREG_PTR(cpu, DA);
        rvmreg_t *regpc = RVM_CPUREG_PTR(cpu, PC);
@@ -2173,8 +1520,7 @@ int rvm_cpu_exec_debug(rvmcpu_t *cpu, rvm_asmins_t *prog, ruword off)
                        };
                }
 #endif
-               ops[pi->opcode](cpu, pi);
-               r_printf("%7ld :", ++line);
+               cpu->ops[pi->opcode].op(cpu, pi);
                rvm_cpu_dumpregs(cpu, pi);
 #if RVM_CONDITIONAL_INSTRUCTIONS
 skipexec:
index 77c791b..4fe5b14 100644 (file)
 #include "rvm/rvmreg.h"
 #include "rlib/rgc.h"
 
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#define RVM_REGISTER_BITS (8 * sizeof(ruword))
+#define RVM_SIGN_BIT (((ruword)1) << (RVM_REGISTER_BITS - 1))
+#define RVM_STATUS_Z (1 << 0)
+#define RVM_STATUS_N (1 << 1)
+#define RVM_STATUS_C (1 << 2)
+#define RVM_STATUS_V (1 << 3)
+#define RVM_STATUS_E (1 << 4)
+#define RVM_STATUS_ALL (RVM_STATUS_Z | RVM_STATUS_N | RVM_STATUS_C | RVM_STATUS_V | RVM_STATUS_E)
+#define RVM_STATUS_GETBIT(cpu, bit) ((cpu)->status & (bit))
+#define RVM_STATUS_SETBIT(cpu, bit) do { (cpu)->status |= (bit); } while (0)
+#define RVM_STATUS_CLRBIT(cpu, bit) do { (cpu)->status &= ~(bit); } while (0)
+#define RVM_STATUS_CLRALL(cpu) RVM_STATUS_CLRBIT(cpu, RVM_STATUS_ALL)
+#define RVM_STATUS_UPDATE(cpu, b, c) \
+do { \
+    if (c) \
+        RVM_STATUS_SETBIT(cpu, b); \
+    else \
+        RVM_STATUS_CLRBIT(cpu, b); \
+} while (0)
+
+#define RVM_OPERAND_BITS 4
+#define RVM_REGS_NUM (1 << RVM_OPERAND_BITS)
+#define R0 0
+#define R1 1
+#define R2 2
+#define R3 3
+#define R4 4
+#define R5 5
+#define R6 6
+#define R7 7
+#define R8 8
+#define R9 9
+#define R10 10
+#define R11 11
+#define R12 12
+#define R13 13
+#define R14 14
+#define R15 15
+#define R16 16
+#define R17 17
+#define R18 18
+#define R19 19
+#define R20 20
+#define R21 21
+#define R22 22
+#define R23 23
+#define R24 24
+#define R25 25
+#define R26 26
+#define R27 27
+#define R28 28
+#define R29 29
+#define R30 30
+#define R31 31
+#define RLST (RVM_REGS_NUM - 1)
+#define IP (RLST - 7)
+#define TP (RLST - 6)
+#define FP (RLST - 5)
+#define SP (RLST - 4)
+#define LR (RLST - 3)
+#define PC (RLST - 2)
+#define DA (RLST - 1)                          /* The DA register should never be modified manually, otherwise the result is undefined */
+#define XX (RLST)
+#define GP IP
 
 enum {
-       RVM_EXT = 0,
+       RVM_EXT = 0,    /* Exit */
        RVM_ABORT,              /* Abort: set the error code, op1: error code */
-       RVM_PRN,
+       RVM_PRN,                /* Debug print */
        RVM_ASR,                /* Arithmetic shift right: op1 = op2 >> op3, preserve the signed bit */
        RVM_SWI,
        RVM_SWIID,
@@ -69,13 +132,10 @@ enum {
        RVM_BX,                 /* Jump to op1 */
        RVM_BXEQ,               /* Jump to op1, if equal */
        RVM_BXNEQ,              /* Jump to op1, if not equal */
-
        RVM_BXLEQ,              /* Branch if less or equal */
        RVM_BXGEQ,              /* Branch if greater or equal */
        RVM_BXLES,              /* Branch if less */
        RVM_BXGRE,              /* Branch if greater */
-
-
        RVM_BXL,                /* Jump to op1, link */
        RVM_BL,                 /* Branch Link */
        RVM_B,                  /* Branch */
@@ -119,7 +179,183 @@ enum {
        RVM_TST,
        RVM_TEQ,
        RVM_ADDRS,              /* Memory location of the stack at offset op2 + op3 */
-
+       RVM_SETTYPE,    /* Type: op1.type = op2 */
+       RVM_TYPE,               /* Type: op1 = typeof(op2) */
+       RVM_RESERVED84,
+       RVM_RESERVED85,
+       RVM_RESERVED86,
+       RVM_RESERVED87,
+       RVM_RESERVED88,
+       RVM_RESERVED89,
+       RVM_RESERVED90,
+       RVM_RESERVED91,
+       RVM_RESERVED92,
+       RVM_RESERVED93,
+       RVM_RESERVED94,
+       RVM_RESERVED95,
+       RVM_RESERVED96,
+       RVM_RESERVED97,
+       RVM_RESERVED98,
+       RVM_RESERVED99,
+       RVM_RESERVED100,
+       RVM_RESERVED101,
+       RVM_RESERVED102,
+       RVM_RESERVED103,
+       RVM_RESERVED104,
+       RVM_RESERVED105,
+       RVM_RESERVED106,
+       RVM_RESERVED107,
+       RVM_RESERVED108,
+       RVM_RESERVED109,
+       RVM_RESERVED110,
+       RVM_RESERVED111,
+       RVM_RESERVED112,
+       RVM_RESERVED113,
+       RVM_RESERVED114,
+       RVM_RESERVED115,
+       RVM_RESERVED116,
+       RVM_RESERVED117,
+       RVM_RESERVED118,
+       RVM_RESERVED119,
+       RVM_RESERVED120,
+       RVM_RESERVED121,
+       RVM_RESERVED122,
+       RVM_RESERVED123,
+       RVM_RESERVED124,
+       RVM_RESERVED125,
+       RVM_RESERVED126,
+       RVM_RESERVED127,
+       RVM_USER128,
+       RVM_USER129,
+       RVM_USER130,
+       RVM_USER131,
+       RVM_USER132,
+       RVM_USER133,
+       RVM_USER134,
+       RVM_USER135,
+       RVM_USER136,
+       RVM_USER137,
+       RVM_USER138,
+       RVM_USER139,
+       RVM_USER140,
+       RVM_USER141,
+       RVM_USER142,
+       RVM_USER143,
+       RVM_USER144,
+       RVM_USER145,
+       RVM_USER146,
+       RVM_USER147,
+       RVM_USER148,
+       RVM_USER149,
+       RVM_USER150,
+       RVM_USER151,
+       RVM_USER152,
+       RVM_USER153,
+       RVM_USER154,
+       RVM_USER155,
+       RVM_USER156,
+       RVM_USER157,
+       RVM_USER158,
+       RVM_USER159,
+       RVM_USER160,
+       RVM_USER161,
+       RVM_USER162,
+       RVM_USER163,
+       RVM_USER164,
+       RVM_USER165,
+       RVM_USER166,
+       RVM_USER167,
+       RVM_USER168,
+       RVM_USER169,
+       RVM_USER170,
+       RVM_USER171,
+       RVM_USER172,
+       RVM_USER173,
+       RVM_USER174,
+       RVM_USER175,
+       RVM_USER176,
+       RVM_USER177,
+       RVM_USER178,
+       RVM_USER179,
+       RVM_USER180,
+       RVM_USER181,
+       RVM_USER182,
+       RVM_USER183,
+       RVM_USER184,
+       RVM_USER185,
+       RVM_USER186,
+       RVM_USER187,
+       RVM_USER188,
+       RVM_USER189,
+       RVM_USER190,
+       RVM_USER191,
+       RVM_USER192,
+       RVM_USER193,
+       RVM_USER194,
+       RVM_USER195,
+       RVM_USER196,
+       RVM_USER197,
+       RVM_USER198,
+       RVM_USER199,
+       RVM_USER200,
+       RVM_USER201,
+       RVM_USER202,
+       RVM_USER203,
+       RVM_USER204,
+       RVM_USER205,
+       RVM_USER206,
+       RVM_USER207,
+       RVM_USER208,
+       RVM_USER209,
+       RVM_USER210,
+       RVM_USER211,
+       RVM_USER212,
+       RVM_USER213,
+       RVM_USER214,
+       RVM_USER215,
+       RVM_USER216,
+       RVM_USER217,
+       RVM_USER218,
+       RVM_USER219,
+       RVM_USER220,
+       RVM_USER221,
+       RVM_USER222,
+       RVM_USER223,
+       RVM_USER224,
+       RVM_USER225,
+       RVM_USER226,
+       RVM_USER227,
+       RVM_USER228,
+       RVM_USER229,
+       RVM_USER230,
+       RVM_USER231,
+       RVM_USER232,
+       RVM_USER233,
+       RVM_USER234,
+       RVM_USER235,
+       RVM_USER236,
+       RVM_USER237,
+       RVM_USER238,
+       RVM_USER239,
+       RVM_USER240,
+       RVM_USER241,
+       RVM_USER242,
+       RVM_USER243,
+       RVM_USER244,
+       RVM_USER245,
+       RVM_USER246,
+       RVM_USER247,
+       RVM_USER248,
+       RVM_USER249,
+       RVM_USER250,
+       RVM_USER251,
+       RVM_USER252,
+       RVM_USER253,
+       RVM_USER254,
+       RVM_USER255,
+       RVM_COUNT,
+
+#if 0
 /* Extended VM opcodes, */
        RVM_CAST,               /* Cast: op1 = (op3)op2 */
        RVM_TYPE,               /* Type: op1 = typeof(op2) */
@@ -150,8 +386,16 @@ enum {
 
        RVM_ECMP,               /* Compare: status register is updated based on the result: op1 - op2 */
        RVM_ECMN,               /* Compare Negative: status register is updated based on the result: op1 + op2 */
-       RVM_PROPLKUP,   /* Lookup r_object property */
-       RVM_PROPLDR,    /* Load r_object property */
+       RVM_PROPLKUP,   /* Lookup property */
+       RVM_PROPLKUPADD,/* Lookup or add property */
+       RVM_PROPLDR,    /* Load property */
+       RVM_PROPSTR,    /* Store property */
+       RVM_PROPADDR,   /* Property Address */
+       RVM_PROPKEYLDR, /* Load Property Key */
+       RVM_PROPDEL,    /* Delete Property */
+       RVM_PROPNEXT,
+       RVM_PROPPREV,
+
        RVM_STRALLOC,   /* Allocate string in op1, op2 is pointer (char*) to string, op3 is the size */
        RVM_ARRALLOC,   /* Allocate array in op1, op2 is the size */
        RVM_ADDRA,              /* op1 is the destination memory, op2 is the array, op3 is the offset */
@@ -168,76 +412,9 @@ enum {
        RVM_MAPLKUPADD,
        RVM_MAPNEXT,
        RVM_MAPPREV,
-};
-
-
-#define RVM_REGISTER_BITS (8 * sizeof(ruword))
-#define RVM_SIGN_BIT (((ruword)1) << (RVM_REGISTER_BITS - 1))
-#define RVM_STATUS_Z (1 << 0)
-#define RVM_STATUS_N (1 << 1)
-#define RVM_STATUS_C (1 << 2)
-#define RVM_STATUS_V (1 << 3)
-#define RVM_STATUS_E (1 << 4)
-#define RVM_STATUS_ALL (RVM_STATUS_Z | RVM_STATUS_N | RVM_STATUS_C | RVM_STATUS_V | RVM_STATUS_E)
-#define RVM_STATUS_GETBIT(cpu, bit) ((cpu)->status & (bit))
-#define RVM_STATUS_SETBIT(cpu, bit) do { (cpu)->status |= (bit); } while (0)
-#define RVM_STATUS_CLRBIT(cpu, bit) do { (cpu)->status &= ~(bit); } while (0)
-#define RVM_STATUS_CLRALL(cpu) RVM_STATUS_CLRBIT(cpu, RVM_STATUS_ALL)
-
-#define RVM_STATUS_UPDATE(cpu, b, c) \
-do { \
-    if (c) \
-        RVM_STATUS_SETBIT(cpu, b); \
-    else \
-        RVM_STATUS_CLRBIT(cpu, b); \
-} while (0)
-
-#define RVM_OPERAND_BITS 4
-#define RVM_REGS_NUM (1 << RVM_OPERAND_BITS)
-#define R0 0
-#define R1 1
-#define R2 2
-#define R3 3
-#define R4 4
-#define R5 5
-#define R6 6
-#define R7 7
-#define R8 8
-#define R9 9
-#define R10 10
-#define R11 11
-#define R12 12
-#define R13 13
-#define R14 14
-#define R15 15
-#define R16 16
-#define R17 17
-#define R18 18
-#define R19 19
-#define R20 20
-#define R21 21
-#define R22 22
-#define R23 23
-#define R24 24
-#define R25 25
-#define R26 26
-#define R27 27
-#define R28 28
-#define R29 29
-#define R30 30
-#define R31 31
-
-#define RLST (RVM_REGS_NUM - 1)
-#define IP (RLST - 7)
-#define TP (RLST - 6)
-#define FP (RLST - 5)
-#define SP (RLST - 4)
-#define LR (RLST - 3)
-#define PC (RLST - 2)
-#define DA (RLST - 1)                          /* The DA register should never be modified manually, otherwise the result is undefined */
-#define XX (RLST)
-#define GP IP
 
+#endif
+};
 
 #define RVM_STACK_CHUNK 256
 #define RVM_ABORT(__cpu__, __e__) do { __cpu__->error = (__e__); (__cpu__)->abort = 1; R_ASSERT(0); return; } while (0)
@@ -286,16 +463,23 @@ do { \
 #define RVM_E_NOTSTRING                (10)
 #define RVM_E_USERABORT                (11)
 
+
 typedef struct rvm_asmins_s rvm_asmins_t;
 typedef struct rvmcpu_s rvmcpu_t;
 typedef void (*rvmcpu_swi)(rvmcpu_t *cpu, rvm_asmins_t *ins);
-typedef void (*rvm_cpu_op)(rvmcpu_t *cpu, rvm_asmins_t *ins);
+typedef void (*rvmcpu_op)(rvmcpu_t *cpu, rvm_asmins_t *ins);
 
 typedef struct rvm_switable_s {
        const char *name;
        rvmcpu_swi op;
 } rvm_switable_t;
 
+typedef struct rvm_optable_s {
+       const char *name;
+       rvmcpu_op op;
+} rvm_optable_t;
+
+
 #define RVM_CEXEC_NAN 0
 #define RVM_CEXEC_GRE 1
 #define RVM_CEXEC_GEQ 2
@@ -316,8 +500,6 @@ struct rvm_asmins_s {
 };
 
 
-struct rvm_opmap_s;
-
 struct rvmcpu_s {
        rvmreg_t r[RVM_REGS_NUM];
        ruword status;
@@ -327,7 +509,7 @@ struct rvmcpu_s {
        unsigned long stacksize;
        void *stack;
        rcarray_t *data;
-       struct rvm_opmap_s *opmap;
+       rvm_optable_t ops[RVM_COUNT];
        rvmreg_t *thisptr;
        rgc_t *gc;
        void *userdata1;
@@ -343,6 +525,7 @@ struct rvmcpu_s {
 rvmcpu_t *rvm_cpu_create_default();
 rvmcpu_t *rvm_cpu_create(unsigned long stacksize);
 void rvm_cpu_destroy(rvmcpu_t * vm);
+int rvm_cpu_setophandler(rvmcpu_t *cpu, unsigned int opcode, const char *opname, rvmcpu_op op);
 int rvm_cpu_abort(rvmcpu_t *cpu);
 int rvm_cpu_exec(rvmcpu_t *cpu, rvm_asmins_t *prog, ruword off);
 int rvm_cpu_exec_debug(rvmcpu_t *cpu, rvm_asmins_t *prog, ruword off);
@@ -374,7 +557,7 @@ rvm_asmins_t rvm_cond_asmf(ruword cond, ruword opcode, ruword op1, ruword op2, r
 rvm_asmins_t rvm_cond_asm2(ruword cond, ruword opcode, ruword op1, ruword op2, ruword op3, ruint32 p1, ruint32 p2);
 
 
-void rvm_asm_dump(rvm_asmins_t *pi, unsigned int count);
+void rvm_asm_dump(rvmcpu_t *cpu, rvm_asmins_t *pi, unsigned int count);
 
 
 #ifdef __cplusplus
diff --git a/rvm/rvmoperator.h b/rvm/rvmoperator.h
deleted file mode 100644 (file)
index b73bdf5..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *  Regular Pattern Analyzer (RPA)
- *  Copyright (c) 2009-2010 Martin Stoilov
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *  Martin Stoilov <martin@rpasearch.com>
- */
-
-#ifndef _RVMOPERATOR_H_
-#define _RVMOPERATOR_H_
-
-#include "rtypes.h"
-#include "rlib/rarray.h"
-#include "rvm/rvmcpu.h"
-
-#define RVM_UNARY_HANDLER(__t__) (__t__)
-#define RVM_OP_HANDLER(__ft__, __st__) ((__ft__) * RVM_DTYPE_MAX + (__st__))
-
-
-enum {
-       RVM_OPID_NONE = 0,
-       RVM_OPID_ADD,
-       RVM_OPID_SUB,
-       RVM_OPID_MUL,
-       RVM_OPID_DIV,
-       RVM_OPID_CAT,
-       RVM_OPID_CAST,
-       RVM_OPID_LSL,
-       RVM_OPID_LSR,
-       RVM_OPID_LSRU,
-       RVM_OPID_AND,
-       RVM_OPID_XOR,
-       RVM_OPID_OR,
-       RVM_OPID_NOT,
-       RVM_OPID_CMP,
-       RVM_OPID_CMN,
-       RVM_OPID_MOD,
-       RVM_OPID_LOGICAND,
-       RVM_OPID_LOGICOR,
-       RVM_OPID_LOGICNOT,
-       RVM_OPID_EQ,
-       RVM_OPID_NOTEQ,
-       RVM_OPID_LESS,
-       RVM_OPID_LESSEQ,
-       RVM_OPID_GREATER,
-       RVM_OPID_GREATEREQ,
-
-       RVM_OPID_USER0,
-       RVM_OPID_USER1,
-       RVM_OPID_USER2,
-       RVM_OPID_USER3,
-       RVM_OPID_USER4,
-       RVM_OPID_USER5,
-       RVM_OPID_USER6,
-       RVM_OPID_USER7,
-       RVM_OPID_USER8,
-       RVM_OPID_USER9,
-       RVM_OPID_USER10,
-       RVM_OPID_USER11,
-       RVM_OPID_USER12,
-       RVM_OPID_USER13,
-       RVM_OPID_USER14,
-       RVM_OPID_USER15,
-       RVM_OPID_LAST
-};
-
-/*
-#define RVM_OPID_NONE 0
-#define RVM_OPID_ADD 1
-#define RVM_OPID_SUB 2
-#define RVM_OPID_MUL 3
-#define RVM_OPID_DIV 4
-#define RVM_OPID_CAT 5
-#define RVM_OPID_CAST 6
-#define RVM_OPID_LSL 7
-#define RVM_OPID_LSR 8
-#define RVM_OPID_LSRU 8
-
-#define RVM_OPID_AND 9
-#define RVM_OPID_XOR 10
-#define RVM_OPID_OR 11
-#define RVM_OPID_NOT 12
-#define RVM_OPID_CMP 13
-#define RVM_OPID_CMN 14
-#define RVM_OPID_MOD 15
-#define RVM_OPID_LESS 16
-
-#define RVM_OPID_LAST 32
-*/
-/*
- * Important: the res pointer might be the same as one of the arguments, the operator must
- * be implemented to take care of such cases.
- */
-typedef void (*rvm_unaryop_handler)(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg);
-typedef void (*rvm_binaryop_handler)(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
-
-typedef union rvm_ophandler_s {
-       rvm_unaryop_handler unary;
-       rvm_binaryop_handler op;
-} rvm_ophandler_t;
-
-typedef struct rvm_opinfo_s {
-       ruint16 opid;
-       rboolean unary;
-       rvm_ophandler_t *handlers;
-} rvm_opinfo_t;
-
-typedef struct rvm_opmap_s {
-       rarray_t *operators;
-} rvm_opmap_t;
-
-
-rvm_opmap_t *rvm_opmap_create();
-void rvm_opmap_destroy(rvm_opmap_t *opmap);
-void rvm_opmap_add_binary_operator(rvm_opmap_t *opmap, ruint16 opid);
-void rvm_opmap_add_unary_operator(rvm_opmap_t *opmap, ruint16 opid);
-int rvm_opmap_set_binary_handler(rvm_opmap_t *opmap, ruint16 opid, rvm_binaryop_handler func, unsigned char firstType, unsigned char secondType);
-int rvm_opmap_set_unary_handler(rvm_opmap_t *opmap, ruint16 opid, rvm_unaryop_handler func, unsigned char type);
-void rvm_opmap_invoke_binary_handler(rvm_opmap_t *opmap, ruint16 opid, rvmcpu_t *cpu, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2);
-void rvm_opmap_invoke_unary_handler(rvm_opmap_t *opmap, ruint16 opid, rvmcpu_t *cpu, rvmreg_t *res, const rvmreg_t *arg);
-
-#endif
diff --git a/rvm/rvmoperatorbin.c b/rvm/rvmoperatorbin.c
deleted file mode 100644 (file)
index 12e4ee7..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- *  Regular Pattern Analyzer (RPA)
- *  Copyright (c) 2009-2010 Martin Stoilov
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- *  Martin Stoilov <martin@rpasearch.com>
- */
-
-#include "rvm/rvmoperator.h"
-#include "rvm/rvmreg.h"
-#include "rvm/rvmoperatornot.h"
-#include "rvm/rvmoperatorbin.h"
-#include "rvm/rvmoperatorlsr.h"
-#include "rvm/rvmoperatorlsru.h"
-#include "rvm/rvmoperatoreq.h"
-#include "rvm/rvmoperatornoteq.h"
-#include "rvm/rvmoperatorlogicor.h"
-#include "rvm/rvmoperatorlogicand.h"
-#include "rvm/rvmoperatorless.h"
-#include "rvm/rvmoperatorlesseq.h"
-#include "rvm/rvmoperatorgreater.h"
-#include "rvm/rvmoperatorgreatereq.h"
-#include "rvm/rvmoperatoror.h"
-#include "rvm/rvmoperatorxor.h"
-#include "rvm/rvmoperatorcast.h"
-#include "rvm/rvmoperatorsub.h"
-#include "rvm/rvmoperatoradd.h"
-#include "rvm/rvmoperatormod.h"
-#include "rvm/rvmoperatormul.h"
-#include "rvm/rvmoperatorlsl.h"
-#include "rvm/rvmoperatorcmn.h"
-#include "rvm/rvmoperatorcmp.h"
-#include "rvm/rvmoperatorand.h"
-#include "rvm/rvmoperatorcat.h"
-#include "rvm/rvmoperatordiv.h"
-
-static rvm_binopmap_t binary_operations[RVM_OPID_LAST+1];
-
-static void rvm_op_abort_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
-{
-       RVM_ABORT(cpu, RVM_E_ILLEGAL);
-}
-
-
-static void rvm_op_abort_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
-{
-       RVM_ABORT(cpu, RVM_E_ILLEGAL);
-}
-
-
-static void rvm_op_abort_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
-{
-       RVM_ABORT(cpu, RVM_E_ILLEGAL);
-}
-
-
-static void rvm_op_binary_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
-{
-       binary_operations[opid].unsigned_binop_fun(cpu, opid, res, op1, op2);
-}
-
-
-static void rvm_op_binary_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
-{
-       binary_operations[opid].long_binop_fun(cpu, opid, res, op1, op2);
-}
-
-
-static void rvm_op_binary_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
-{
-       binary_operations[opid].double_binop_fun(cpu, opid, res, op1, op2);
-}
-
-
-static void rvm_op_binary_unsigned_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
-{
-       rvm_op_binary_unsigned(cpu, opid, res, RVM_REG_GETU(arg1), RVM_REG_GETU(arg2));
-}
-
-
-static void rvm_op_binary_signed_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
-{
-       rvm_op_binary_signed(cpu, opid, res, RVM_REG_GETL(arg1), RVM_REG_GETL(arg2));
-}
-
-
-static void rvm_op_binary_double_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
-{
-       rvm_op_binary_double(cpu, opid, res, RVM_REG_GETD(arg1), (double)RVM_REG_GETL(arg2));
-}
-
-
-void rvm_op_binary_signed_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
-{
-       rvm_op_binary_double(cpu, opid, res, (double)RVM_REG_GETL(arg1), RVM_REG_GETD(arg2));
-}
-
-
-static void rvm_op_binary_double_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
-{
-       rvm_op_binary_double(cpu, opid, res, RVM_REG_GETD(arg1), RVM_REG_GETD(arg2));
-}
-
-
-static void rvm_op_binary_string_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
-{
-       rvmreg_t s;
-
-       if (rvm_reg_str2double(&s, arg1) < 0)
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       rvm_op_binary_double(cpu, opid, res, RVM_REG_GETD(&s), RVM_REG_GETD(arg2));
-}
-
-
-static void rvm_op_binary_string_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
-{
-       rvmreg_t s;
-
-       if (rvm_reg_str2num(&s, arg1) < 0)
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-
-       if (rvm_reg_gettype(&s) == RVM_DTYPE_DOUBLE) {
-               rvm_op_binary_double(cpu, opid, res, RVM_REG_GETD(&s), (double)RVM_REG_GETL(arg2));
-       } else {
-               rvm_op_binary_signed(cpu, opid, res, RVM_REG_GETL(&s), RVM_REG_GETL(arg2));
-       }
-}
-
-
-static void rvm_op_binary_double_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
-{
-       rvmreg_t s;
-
-       if (rvm_reg_str2double(&s, arg2) < 0)
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       rvm_op_binary_double(cpu, opid, res, RVM_REG_GETD(arg1), RVM_REG_GETD(&s));
-}
-
-
-static void rvm_op_binary_signed_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
-{
-       rvmreg_t s;
-
-       if (rvm_reg_str2num(&s, arg2) < 0)
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       if (rvm_reg_gettype(&s) == RVM_DTYPE_DOUBLE) {
-               rvm_op_binary_double(cpu, opid, res, (double)RVM_REG_GETL(arg1), RVM_REG_GETD(&s));
-       } else {
-               rvm_op_binary_signed(cpu, opid, res, RVM_REG_GETL(arg1), RVM_REG_GETL(&s));
-       }
-}
-
-
-static void rvm_op_binary_nan(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
-{
-       rvm_reg_cleanup(res);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_NAN);
-}
-
-
-void rvm_op_binary_insert(rvm_opmap_t *opmap, ruint16 opid, rvm_binop_unsigned u, rvm_binop_signed l, rvm_binop_double d)
-{
-       int i;
-
-       binary_operations[opid].opid = opid;
-       binary_operations[opid].unsigned_binop_fun = u;
-       binary_operations[opid].long_binop_fun = l;
-       binary_operations[opid].double_binop_fun = d;
-       rvm_opmap_add_binary_operator(opmap, opid);
-
-       for (i = 0; i < RVM_DTYPE_USER; i++) {
-               rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_nan, RVM_DTYPE_NAN, i);
-               rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_nan, RVM_DTYPE_UNDEF, i);
-               rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_nan, i, RVM_DTYPE_NAN);
-               rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_nan, i, RVM_DTYPE_UNDEF);
-       }
-
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_unsigned_unsigned, RVM_DTYPE_BOOLEAN, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_unsigned_unsigned, RVM_DTYPE_BOOLEAN, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_signed, RVM_DTYPE_BOOLEAN, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_double, RVM_DTYPE_BOOLEAN, RVM_DTYPE_DOUBLE);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_string, RVM_DTYPE_BOOLEAN, RVM_DTYPE_STRING);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_unsigned_unsigned, RVM_DTYPE_UNSIGNED, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_unsigned_unsigned, RVM_DTYPE_SIGNED, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_double_signed, RVM_DTYPE_DOUBLE, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_string_signed, RVM_DTYPE_STRING, RVM_DTYPE_BOOLEAN);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_unsigned_unsigned, RVM_DTYPE_UNSIGNED, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_double_double, RVM_DTYPE_DOUBLE, RVM_DTYPE_DOUBLE);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_signed, RVM_DTYPE_SIGNED, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_signed, RVM_DTYPE_UNSIGNED, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_signed, RVM_DTYPE_SIGNED, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_double, RVM_DTYPE_SIGNED, RVM_DTYPE_DOUBLE);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_double, RVM_DTYPE_UNSIGNED, RVM_DTYPE_DOUBLE);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_double_signed, RVM_DTYPE_DOUBLE, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_double_signed, RVM_DTYPE_DOUBLE, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_string_signed, RVM_DTYPE_STRING, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_string_signed, RVM_DTYPE_STRING, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_string_double, RVM_DTYPE_STRING, RVM_DTYPE_DOUBLE);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_string, RVM_DTYPE_UNSIGNED, RVM_DTYPE_STRING);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_string, RVM_DTYPE_SIGNED, RVM_DTYPE_STRING);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_double_string, RVM_DTYPE_DOUBLE, RVM_DTYPE_STRING);
-}
-
-
-void rvm_op_binary_init(rvm_opmap_t *opmap)
-{
-       int i;
-
-       for (i = 0; i < sizeof(binary_operations)/sizeof(binary_operations[0]); i++) {
-               binary_operations[i].opid = RVM_OPID_NONE;
-               binary_operations[i].unsigned_binop_fun = rvm_op_abort_unsigned;
-               binary_operations[i].long_binop_fun = rvm_op_abort_signed;
-               binary_operations[i].double_binop_fun = rvm_op_abort_double;
-       }
-
-       rvm_op_binary_insert(opmap, RVM_OPID_SUB, rvm_op_sub_unsigned, rvm_op_sub_signed, rvm_op_sub_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_MUL, rvm_op_mul_unsigned, rvm_op_mul_signed, rvm_op_mul_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_DIV, rvm_op_div_unsigned, rvm_op_div_signed, rvm_op_div_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_LSL, rvm_op_lsl_unsigned, rvm_op_lsl_signed, rvm_op_lsl_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_LSR, rvm_op_lsr_unsigned, rvm_op_lsr_signed, rvm_op_lsr_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_LSRU, rvm_op_lsru_unsigned, rvm_op_lsru_signed, rvm_op_lsru_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_AND, rvm_op_and_unsigned, rvm_op_and_signed, rvm_op_and_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_XOR, rvm_op_xor_unsigned, rvm_op_xor_signed, rvm_op_xor_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_OR, rvm_op_or_unsigned, rvm_op_or_signed, rvm_op_or_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_CMP, rvm_op_cmp_unsigned, rvm_op_cmp_signed, rvm_op_cmp_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_CMN, rvm_op_cmn_unsigned, rvm_op_cmn_signed, rvm_op_cmn_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_MOD, rvm_op_mod_unsigned, rvm_op_mod_signed, rvm_op_mod_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_LOGICOR, rvm_op_logicor_unsigned, rvm_op_logicor_signed, rvm_op_logicor_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_LOGICAND, rvm_op_logicand_unsigned, rvm_op_logicand_signed, rvm_op_logicand_double);
-
-       rvm_op_binary_insert(opmap, RVM_OPID_ADD, rvm_op_add_unsigned, rvm_op_add_signed, rvm_op_add_double);
-       /*
-        * Overwrite RVM_OPID_ADD for string concatenation
-        */
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_ADD, rvm_op_concat_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_ADD, rvm_op_concat_string_signed, RVM_DTYPE_STRING, RVM_DTYPE_SIGNED);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_ADD, rvm_op_concat_string_signed, RVM_DTYPE_STRING, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_ADD, rvm_op_concat_signed_string, RVM_DTYPE_SIGNED, RVM_DTYPE_STRING);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_ADD, rvm_op_concat_signed_string, RVM_DTYPE_UNSIGNED, RVM_DTYPE_STRING);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_ADD, rvm_op_concat_string_double, RVM_DTYPE_STRING, RVM_DTYPE_DOUBLE);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_ADD, rvm_op_concat_double_string, RVM_DTYPE_DOUBLE, RVM_DTYPE_STRING);
-
-       rvm_op_binary_insert(opmap, RVM_OPID_EQ, rvm_op_eq_unsigned, rvm_op_eq_signed, rvm_op_eq_double);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_EQ, rvm_op_eq_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
-
-       rvm_op_binary_insert(opmap, RVM_OPID_NOTEQ, rvm_op_noteq_unsigned, rvm_op_noteq_signed, rvm_op_noteq_double);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_NOTEQ, rvm_op_noteq_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
-
-       rvm_op_binary_insert(opmap, RVM_OPID_LESS, rvm_op_less_unsigned, rvm_op_less_signed, rvm_op_less_double);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_LESS, rvm_op_less_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
-
-       rvm_op_binary_insert(opmap, RVM_OPID_LESSEQ, rvm_op_lesseq_unsigned, rvm_op_lesseq_signed, rvm_op_lesseq_double);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_LESSEQ, rvm_op_lesseq_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
-
-       rvm_op_binary_insert(opmap, RVM_OPID_GREATER, rvm_op_greater_unsigned, rvm_op_greater_signed, rvm_op_greater_double);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_GREATER, rvm_op_greater_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
-
-       rvm_op_binary_insert(opmap, RVM_OPID_GREATEREQ, rvm_op_greatereq_unsigned, rvm_op_greatereq_signed, rvm_op_greatereq_double);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_GREATEREQ, rvm_op_greatereq_string_string, RVM_DTYPE_STRING, RVM_DTYPE_STRING);
-
-}
index 0a6ca68..e90bc5b 100644 (file)
@@ -29,7 +29,7 @@ static void rvm_eadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
        rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
        rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
 
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_ADD, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+       rvm_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RVM_OPID_ADD, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
 //     fprintf(stdout, "%s %ld\n", __FUNCTION__, RVM_CPUREG_GETU(cpu, ins->op1));
 }
 
index 1fe24f6..6929844 100644 (file)
@@ -251,7 +251,7 @@ static void rvm_swi_negative(rvmcpu_t *cpu, rvm_asmins_t *ins)
        rvmreg_t zero;
 
        RVM_REG_CLEAR(&zero);
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_SUB, cpu, res, &zero, arg);
+       rvm_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RVM_OPID_SUB, cpu, res, &zero, arg);
 }
 
 
@@ -261,7 +261,7 @@ static void rvm_swi_eadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
        rvmreg_t *arg1 = (rvmreg_t *)RVM_STACK_ADDR(cpu->stack, RVM_CPUREG_GETU(cpu, FP) + 1);
        rvmreg_t *arg2 = (rvmreg_t *)RVM_STACK_ADDR(cpu->stack, RVM_CPUREG_GETU(cpu, FP) + 2);
 
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_ADD, cpu, res, arg1, arg2);
+       rvm_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RVM_OPID_ADD, cpu, res, arg1, arg2);
 }
 
 
index 17e64d3..ed188a6 100644 (file)
@@ -29,7 +29,7 @@ static void rvm_eadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
        rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
        rvmreg_t *arg3 = RVM_CPUREG_PTR(cpu, ins->op3);
 
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_ADD, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
+       rvm_opmap_invoke_binary_handler(RJS_USERDATA2MAP(cpu->userdata2), RVM_OPID_ADD, cpu, RVM_CPUREG_PTR(cpu, ins->op1), arg2, arg3);
 //     fprintf(stdout, "%s %ld\n", __FUNCTION__, RVM_CPUREG_GETU(cpu, ins->op1));
 }