RPA Toolkit
RJS: Added string comparison operators, added typeof operator implementation.
authorMartin Stoilov <martin@rpasearch.com>
Thu, 4 Aug 2011 04:09:13 +0000 (21:09 -0700)
committerMartin Stoilov <martin@rpasearch.com>
Thu, 4 Aug 2011 04:09:13 +0000 (21:09 -0700)
36 files changed:
rjs/ecma262.rpa
rjs/rjs.c
rjs/rjs.h
rjs/rjscompiler.c
rjs/rjsuids.h
rvm/rvmcpu.c
rvm/rvmcpu.h
rvm/rvmoperatoradd.c
rvm/rvmoperatorand.c
rvm/rvmoperatorbin.c
rvm/rvmoperatorcast.c
rvm/rvmoperatordiv.c
rvm/rvmoperatorgreater.c
rvm/rvmoperatorgreater.h
rvm/rvmoperatorgreatereq.c
rvm/rvmoperatorgreatereq.h
rvm/rvmoperatorless.c
rvm/rvmoperatorless.h
rvm/rvmoperatorlesseq.c
rvm/rvmoperatorlesseq.h
rvm/rvmoperatorlogicnot.c
rvm/rvmoperatorlsl.c
rvm/rvmoperatorlsr.c
rvm/rvmoperatormod.c
rvm/rvmoperatormul.c
rvm/rvmoperatornot.c
rvm/rvmoperatoror.c
rvm/rvmoperatorsub.c
rvm/rvmoperatorxor.c
rvm/rvmreg.c
rvm/rvmreg.h
tests/testmisc/asm-cast.c
tests/testmisc/funcarg-test.c
tests/testmisc/rharray-test.c
tests/testmisc/rpagen-test.c
tests/testmisc/string-test.c

index 18bdfee..420c96c 100644 (file)
@@ -92,6 +92,7 @@
 #!emitid UnaryExpressionDelete                 UID_UNARYEXPRESSIONDELETE                       62
 #!emitid IterationForIn                                        UID_ITERATIONFORIN                                      63
 #!emitid ForInInit                                             UID_FORININIT                                           64
+#!emitid UnaryExpressionTypeof                 UID_UNARYEXPRESSIONTYPEOF                       65
 
 #!abort SC
 
@@ -255,7 +256,7 @@ PrefixExpressionOp                          ::= <PrefixOperator> <LeftHandSideExpressionAddr>
 PrefixExpression                               ::= <PrefixExpressionOp> | <PostfixExpression>
 
 # 11.4 Unary Operators
-UnaryOperator                                  ::= '~' | '!' | ('+' - '++') | ('-' - '--') | 'void' | 'typeof'
+UnaryOperator                                  ::= '~' | '!' | ('+' - '++') | ('-' - '--')
 UnaryExpressionOp                      ::=     <S>? <UnaryOperator> <S>? <UnaryExpression>
 UnaryExpressionDelete                  ::=     <S>? 'delete' <S>? <UnaryExpression>
 UnaryExpressionVoid                            ::=     <S>? 'void' <S>? <UnaryExpression>
index 49a50b2..6fb45f7 100644 (file)
--- a/rjs/rjs.c
+++ b/rjs/rjs.c
@@ -24,7 +24,7 @@
 #include "rjs/rjs.h"
 #include "rvm/rvmcodegen.h"
 
-
+static void rjs_engine_initgp(rjs_engine_t *jse);
 static void rjs_engine_print(rvmcpu_t *cpu, rvm_asmins_t *ins);
 static void rjs_engine_dbgprint(rvmcpu_t *cpu, rvm_asmins_t *ins);
 static void rjs_engine_object(rvmcpu_t *cpu, rvm_asmins_t *ins);
@@ -58,6 +58,7 @@ rjs_engine_t *rjs_engine_create()
        rvm_cpu_addswitable(jse->cpu, "rjsswitable", rjsswitable);
        if (!jse->pa || !jse->cpu || !jse->co || !jse->cgs)
                goto error;
+       rjs_engine_initgp(jse);
        tp = rvm_cpu_alloc_global(jse->cpu);
        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));
@@ -87,6 +88,54 @@ void rjs_engine_destroy(rjs_engine_t *jse)
        }
 }
 
+static void rjs_engine_inittypes(rjs_engine_t *jse)
+{
+       rmap_t *gmap = (rmap_t *)RVM_CPUREG_GETP(jse->cpu, GP);
+       rmap_t *types;
+       rvmreg_t rt, rs;
+       rstring_t *s;
+
+       types = r_map_create(sizeof(rvmreg_t), 3);
+       r_gc_add(jse->cpu->gc, (robject_t*)types);
+       rvm_reg_setjsobject(&rt, (robject_t *)types);
+       r_map_add_l(gmap, RJS_GPKEY_TYPES, &rt);
+
+       s = r_string_create_from_ansistr("undefined");
+       r_gc_add(jse->cpu->gc, (robject_t*)s);
+       rvm_reg_setstring(&rs, s);
+       r_map_add_l(types, RVM_DTYPE_UNDEF, &rs);
+
+       s = r_string_create_from_ansistr("boolean");
+       r_gc_add(jse->cpu->gc, (robject_t*)s);
+       rvm_reg_setstring(&rs, s);
+       r_map_add_l(types, RVM_DTYPE_BOOLEAN, &rs);
+
+       s = r_string_create_from_ansistr("number");
+       r_gc_add(jse->cpu->gc, (robject_t*)s);
+       rvm_reg_setstring(&rs, s);
+       r_map_add_l(types, RVM_DTYPE_DOUBLE, &rs);
+       r_map_add_l(types, RVM_DTYPE_UNSIGNED, &rs);
+       r_map_add_l(types, RVM_DTYPE_SIGNED, &rs);
+
+       s = r_string_create_from_ansistr("string");
+       rvm_reg_setstring(&rs, s);
+       r_gc_add(jse->cpu->gc, (robject_t*)s);
+       r_map_add_l(types, RVM_DTYPE_STRING, &rs);
+}
+
+static void rjs_engine_initgp(rjs_engine_t *jse)
+{
+       rvmreg_t gp;
+       rmap_t *gmap;
+
+       rvm_reg_init(&gp);
+       gmap = r_map_create(sizeof(rvmreg_t), 7);
+       r_gc_add(jse->cpu->gc, (robject_t*)gmap);
+
+       rvm_reg_setjsobject(RVM_CPUREG_PTR(jse->cpu, GP), (robject_t *)gmap);
+       rjs_engine_inittypes(jse);
+}
+
 
 int rjs_engine_open(rjs_engine_t *jse)
 {
@@ -321,7 +370,7 @@ static void rjs_engine_print(rvmcpu_t *cpu, rvm_asmins_t *ins)
                r_printf("%s\n", RVM_REG_GETU(r) ? "true" : "false");
        else if (rvm_reg_gettype(r) == RVM_DTYPE_POINTER)
                r_printf("%p\n", RVM_REG_GETP(r));
-       else if (rvm_reg_gettype(r) == RVM_DTYPE_SINGED)
+       else if (rvm_reg_gettype(r) == RVM_DTYPE_SIGNED)
                r_printf("%ld\n", RVM_REG_GETL(r));
        else if (rvm_reg_gettype(r) == RVM_DTYPE_DOUBLE)
                r_printf("%f\n", RVM_REG_GETD(r));
@@ -354,7 +403,7 @@ static void rjs_engine_dbgprint(rvmcpu_t *cpu, rvm_asmins_t *ins)
                r_printf("(BOOLEAN) %s\n", RVM_REG_GETU(r) ? "true" : "false");
        else if (rvm_reg_gettype(r) == RVM_DTYPE_POINTER)
                r_printf("(POINTER) %p\n", RVM_REG_GETP(r));
-       else if (rvm_reg_gettype(r) == RVM_DTYPE_SINGED)
+       else if (rvm_reg_gettype(r) == RVM_DTYPE_SIGNED)
                r_printf("(LONG) %ld\n", RVM_REG_GETL(r));
        else if (rvm_reg_gettype(r) == RVM_DTYPE_DOUBLE)
                r_printf("(DOUBLE) %f\n", RVM_REG_GETD(r));
index a65854d..51f5162 100644 (file)
--- a/rjs/rjs.h
+++ b/rjs/rjs.h
@@ -53,6 +53,8 @@ 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_GPKEY_NONE 0
+#define RJS_GPKEY_TYPES 1
 
 const char *rjs_version();
 
index 2d2506f..5793080 100644 (file)
@@ -21,6 +21,7 @@
 #include "rlib/rmem.h"
 #include "rjs/rjscompiler.h"
 #include "rjs/rjsparser.h"
+#include "rjs/rjs.h"
 
 
 int rjs_compiler_playreversechildrecords(rjs_compiler_t *co, rarray_t *records, long rec);
@@ -681,6 +682,29 @@ error:
 }
 
 
+int rjs_compiler_rh_unaryexpressiontypeof(rjs_compiler_t *co, rarray_t *records, long rec)
+{
+       rparecord_t *prec;
+
+       prec = (rparecord_t *)r_array_slot(records, rec);
+       rjs_compiler_debughead(co, records, rec);
+       rjs_compiler_debugtail(co, records, rec);
+       if (rjs_compiler_playchildrecords(co, records, rec) < 0)
+               return -1;
+       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_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));
+
+       rjs_compiler_debugtail(co, records, rec);
+       return 0;
+}
+
+
 int rjs_compiler_rh_assignmentexpressionop(rjs_compiler_t *co, rarray_t *records, long rec)
 {
        rparecord_t *prec;
@@ -1777,6 +1801,7 @@ rjs_compiler_t *rjs_compiler_create(rvmcpu_t *cpu)
        co->handlers[UID_NEWEXPRESSIONCALL] = rjs_compiler_rh_newexpressioncall;
        co->handlers[UID_UNARYEXPRESSIONOP] = rjs_compiler_rh_unaryexpressionop;
        co->handlers[UID_UNARYEXPRESSIONDELETE] = rjs_compiler_rh_unaryexpressiondelete;
+       co->handlers[UID_UNARYEXPRESSIONTYPEOF] = rjs_compiler_rh_unaryexpressiontypeof;
        co->handlers[UID_BINARYOPERATOR] = rjs_compiler_rh_binaryoperator;
        co->handlers[UID_UNARYOPERATOR] = rjs_compiler_rh_unaryoperator;
        co->handlers[UID_BREAKSTATEMENT] = rjs_compiler_rh_break;
index e0f9f76..656544e 100644 (file)
@@ -79,3 +79,4 @@
 #define UID_UNARYEXPRESSIONDELETE 62
 #define UID_ITERATIONFORIN 63
 #define UID_FORININIT 64
+#define UID_UNARYEXPRESSIONTYPEOF 65
index 1683649..a6db1dd 100644 (file)
@@ -1119,7 +1119,7 @@ static void rvm_op_prn(rvmcpu_t *cpu, rvm_asmins_t *ins)
                rvm_printf("(UNSIGNED) R%d = %lu(0x%lx)\n", ins->op1, RVM_REG_GETU(r), RVM_REG_GETU(r));
        else if (rvm_reg_gettype(r) == RVM_DTYPE_POINTER)
                rvm_printf("(POINTER) R%d = %p\n", ins->op1, RVM_REG_GETP(r));
-       else if (rvm_reg_gettype(r) == RVM_DTYPE_SINGED)
+       else if (rvm_reg_gettype(r) == RVM_DTYPE_SIGNED)
                rvm_printf("(LONG) R%d = %ld\n", ins->op1, RVM_REG_GETL(r));
        else if (rvm_reg_gettype(r) == RVM_DTYPE_DOUBLE)
                rvm_printf("(DOUBLE) R%d = %0.2f\n", ins->op1, RVM_REG_GETD(r));
@@ -1200,7 +1200,7 @@ int rvm_asm_dump_pi_to_str(rvmcpu_t *vm, rvm_asmins_t *pi, char *str, unsigned i
        if (RVM_REG_GETTYPE(&pi->data) == RVM_DTYPE_DOUBLE) {
                if ((ret = rvm_snprintf(str, sz, "%f  ", RVM_REG_GETD(&pi->data))) < 0)
                        return ret;
-       } else if (RVM_REG_GETTYPE(&pi->data) == RVM_DTYPE_SINGED) {
+       } else if (RVM_REG_GETTYPE(&pi->data) == RVM_DTYPE_SIGNED) {
                if ((ret = rvm_snprintf(str, sz, "%ld  ", RVM_REG_GETL(&pi->data))) < 0)
                        return ret;
        } else {
@@ -1269,6 +1269,7 @@ 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);
 
        RVM_CPUREG_SETU(cpu, ins->op1, type);
+       RVM_CPUREG_SETTYPE(cpu, ins->op1, RVM_DTYPE_UNSIGNED);
 }
 
 
@@ -1551,7 +1552,7 @@ static void rvm_op_maplookup(rvmcpu_t *cpu, rvm_asmins_t *ins)
        if (rvm_reg_gettype(arg2) != RVM_DTYPE_JSOBJECT) {
                RVM_ABORT(cpu, RVM_E_NOTOBJECT);
        }
-       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_SINGED || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
+       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));
@@ -1564,7 +1565,7 @@ static void rvm_op_maplookup(rvmcpu_t *cpu, rvm_asmins_t *ins)
        }
 
        RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
        RVM_REG_SETL(arg1, index);
 }
 
@@ -1580,7 +1581,7 @@ static void rvm_op_mapadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
        if (rvm_reg_gettype(arg2) != RVM_DTYPE_JSOBJECT) {
                RVM_ABORT(cpu, RVM_E_NOTOBJECT);
        }
-       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_SINGED || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
+       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);
@@ -1593,7 +1594,7 @@ static void rvm_op_mapadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
        }
 
        RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
        RVM_REG_SETL(arg1, index);
 }
 
@@ -1609,7 +1610,7 @@ static void rvm_op_maplookupadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
        if (rvm_reg_gettype(arg2) != RVM_DTYPE_JSOBJECT) {
                RVM_ABORT(cpu, RVM_E_NOTOBJECT);
        }
-       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_SINGED || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
+       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);
@@ -1629,7 +1630,7 @@ static void rvm_op_maplookupadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
                RVM_ABORT(cpu, RVM_E_ILLEGAL);
        }
        RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
        RVM_REG_SETL(arg1, index);
 }
 
@@ -1742,7 +1743,7 @@ static void rvm_op_mapnext(rvmcpu_t *cpu, rvm_asmins_t *ins)
        else
                index = r_map_next(a, index);
        RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
        RVM_REG_SETL(arg1, index);
 }
 
@@ -1765,7 +1766,7 @@ static void rvm_op_mapprev(rvmcpu_t *cpu, rvm_asmins_t *ins)
        else
                index = r_map_prev(a, index);
        RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(arg1, RVM_DTYPE_SIGNED);
        RVM_REG_SETL(arg1, index);
 }
 
index d4d0e3c..73f8c13 100644 (file)
@@ -234,6 +234,7 @@ do { \
 #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
 
 
 #define RVM_STACK_CHUNK 256
index 86a4109..79630a3 100644 (file)
@@ -40,7 +40,7 @@ void rvm_op_add_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
        rword r;
        r = op1 + op2;
        RVM_REG_SETL(res, r);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_SIGNED);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_N, r & RVM_SIGN_BIT);
 }
index fe3e018..40ba9b6 100644 (file)
@@ -40,7 +40,7 @@ void rvm_op_and_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 
        r = op1 & op2;
        RVM_REG_SETL(res, r);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_SIGNED);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_N, r & RVM_SIGN_BIT);
 }
index 091a998..12e4ee7 100644 (file)
@@ -189,27 +189,27 @@ void rvm_op_binary_insert(rvm_opmap_t *opmap, ruint16 opid, rvm_binop_unsigned u
 
        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_SINGED);
+       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_SINGED, 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_SINGED, RVM_DTYPE_SINGED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_signed, RVM_DTYPE_UNSIGNED, RVM_DTYPE_SINGED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_signed, RVM_DTYPE_SINGED, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_binary_handler(opmap, opid, rvm_op_binary_signed_double, RVM_DTYPE_SINGED, 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_SINGED);
+       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_SINGED);
+       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_SINGED, 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);
 }
 
@@ -239,20 +239,15 @@ void rvm_op_binary_init(rvm_opmap_t *opmap)
        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_NOTEQ, rvm_op_noteq_unsigned, rvm_op_noteq_signed, rvm_op_noteq_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_LESS, rvm_op_less_unsigned, rvm_op_less_signed, rvm_op_less_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_LESSEQ, rvm_op_lesseq_unsigned, rvm_op_lesseq_signed, rvm_op_lesseq_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_GREATER, rvm_op_greater_unsigned, rvm_op_greater_signed, rvm_op_greater_double);
-       rvm_op_binary_insert(opmap, RVM_OPID_GREATEREQ, rvm_op_greatereq_unsigned, rvm_op_greatereq_signed, rvm_op_greatereq_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_SINGED);
+       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_SINGED, RVM_DTYPE_STRING);
+       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);
@@ -263,4 +258,16 @@ void rvm_op_binary_init(rvm_opmap_t *opmap)
        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 3c72a81..8c00933 100644 (file)
@@ -42,7 +42,7 @@ void rvm_op_cast_double_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const
        long r = (long)RVM_REG_GETD(arg1);
 
        RVM_REG_CLEAR(res);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_SIGNED);
        RVM_REG_SETL(res, r);
 }
 
@@ -102,7 +102,7 @@ void rvm_op_cast_unsigned_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, con
        long r = (long)RVM_REG_GETU(arg1);
 
        RVM_REG_CLEAR(res);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_SIGNED);
        RVM_REG_SETL(res, r);
 }
 
@@ -152,26 +152,26 @@ void rvm_op_cast_init(rvm_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_SINGED, RVM_DTYPE_SINGED);
+       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_SINGED, 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_SINGED);
+       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_SINGED, RVM_DTYPE_DOUBLE);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_signed_unsigned, RVM_DTYPE_SINGED, RVM_DTYPE_UNSIGNED);
-       rvm_opmap_set_binary_handler(opmap, RVM_OPID_CAST, rvm_op_cast_double_signed, RVM_DTYPE_DOUBLE, RVM_DTYPE_SINGED);
+       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_SINGED);
+       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_SINGED);
+       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);
 
 }
index ac5f16b..8531ec8 100644 (file)
@@ -44,7 +44,7 @@ void rvm_op_div_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
                RVM_ABORT(cpu, RVM_E_DIVZERO);
        r = op1 / op2;
        RVM_REG_SETL(res, r);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_SIGNED);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_N, r & RVM_SIGN_BIT);
 }
index 2591b50..173fab8 100644 (file)
@@ -54,3 +54,15 @@ void rvm_op_greater_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
 }
 
+
+void rvm_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);
+       rstring_t *s2 = (rstring_t *)RVM_REG_GETP(arg2);
+
+       r = (r_strncmp(s1->s.str, s2->s.str, R_MIN(s1->s.size, s2->s.size)) > 0) ? 1 : 0;
+       rvm_reg_setboolean(res, r);
+       RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
+}
+
index 3e0b4b0..241e164 100644 (file)
@@ -31,6 +31,7 @@ extern "C" {
 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);
 
 #ifdef __cplusplus
 }
index 7f9286b..e4ec1ec 100644 (file)
@@ -54,3 +54,16 @@ void rvm_op_greatereq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
 }
 
+
+void rvm_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);
+       rstring_t *s2 = (rstring_t *)RVM_REG_GETP(arg2);
+
+       r = (r_strncmp(s1->s.str, s2->s.str, R_MIN(s1->s.size, s2->s.size)) >= 0) ? 1 : 0;
+       rvm_reg_setboolean(res, r);
+       RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
+}
+
+
index 71bdea5..e5f3c60 100644 (file)
@@ -31,6 +31,7 @@ extern "C" {
 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);
 
 #ifdef __cplusplus
 }
index 1cdec41..a83d9fd 100644 (file)
@@ -53,3 +53,15 @@ void rvm_op_less_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1,
        RVM_REG_SETTYPE(res, RVM_DTYPE_BOOLEAN);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
 }
+
+
+void rvm_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);
+       rstring_t *s2 = (rstring_t *)RVM_REG_GETP(arg2);
+
+       r = (r_strncmp(s1->s.str, s2->s.str, R_MIN(s1->s.size, s2->s.size)) < 0) ? 1 : 0;
+       rvm_reg_setboolean(res, r);
+       RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
+}
index 47ef51b..9ec4980 100644 (file)
@@ -31,6 +31,7 @@ extern "C" {
 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);
 
 #ifdef __cplusplus
 }
index 25a9380..0bc0a1c 100644 (file)
@@ -53,3 +53,16 @@ void rvm_op_lesseq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1
        RVM_REG_SETTYPE(res, RVM_DTYPE_BOOLEAN);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
 }
+
+
+void rvm_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);
+       rstring_t *s2 = (rstring_t *)RVM_REG_GETP(arg2);
+
+       r = (r_strncmp(s1->s.str, s2->s.str, R_MIN(s1->s.size, s2->s.size)) <= 0) ? 1 : 0;
+       rvm_reg_setboolean(res, r);
+       RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
+}
+
index c9c1e38..5e4f70f 100644 (file)
@@ -31,6 +31,7 @@ extern "C" {
 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);
 
 #ifdef __cplusplus
 }
index 08aba50..8170e90 100644 (file)
@@ -85,7 +85,7 @@ void rvm_op_logicnot_init(rvm_opmap_t *opmap)
        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_SINGED);
+       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);
 }
index f2eca39..1fcdbb4 100644 (file)
@@ -40,7 +40,7 @@ void rvm_op_lsl_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 
        r = op1 << op2;
        RVM_REG_SETL(res, r);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_SIGNED);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_N, r & RVM_SIGN_BIT);
 }
index 4d40de6..62e1ce1 100644 (file)
@@ -40,7 +40,7 @@ void rvm_op_lsr_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 
        r = op1 >> op2;
        RVM_REG_SETL(res, r);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_SIGNED);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_N, r & RVM_SIGN_BIT);
 }
index 640e8f3..26f8d5c 100644 (file)
@@ -45,7 +45,7 @@ void rvm_op_mod_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
                RVM_ABORT(cpu, RVM_E_DIVZERO);
        r = op1 % op2;
        RVM_REG_SETL(res, r);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_SIGNED);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_N, r & RVM_SIGN_BIT);
 }
index 02b50ba..f04b625 100644 (file)
@@ -41,7 +41,7 @@ void rvm_op_mul_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 
        r = op1 * op2;
        RVM_REG_SETL(res, r);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_SIGNED);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_N, r & RVM_SIGN_BIT);
 }
index 04d0fc6..0e7fc8a 100644 (file)
@@ -65,7 +65,7 @@ void rvm_op_not_init(rvm_opmap_t *opmap)
 
        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_SINGED);
+       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);
 }
index 8bc91a1..71a23ea 100644 (file)
@@ -40,7 +40,7 @@ void rvm_op_or_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rwo
 
        r = op1 | op2;
        RVM_REG_SETL(res, r);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_SIGNED);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_N, r & RVM_SIGN_BIT);
 }
index 86178f9..00efeea 100644 (file)
@@ -43,7 +43,7 @@ void rvm_op_sub_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 
        r = op1 - op2;
        RVM_REG_SETL(res, r);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_SIGNED);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_N, r & RVM_SIGN_BIT);
 }
index 6ba72af..bea2602 100644 (file)
@@ -40,7 +40,7 @@ void rvm_op_xor_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rw
 
        r = op1 ^ op2;
        RVM_REG_SETL(res, r);
-       RVM_REG_SETTYPE(res, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(res, RVM_DTYPE_SIGNED);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
        RVM_STATUS_UPDATE(cpu, RVM_STATUS_N, r & RVM_SIGN_BIT);
 }
index 47100f6..719259a 100644 (file)
@@ -384,7 +384,7 @@ void rvm_reg_setunsigned(rvmreg_t *r, ruword u)
 void rvm_reg_setsigned(rvmreg_t *r, rword l)
 {
        RVM_REG_SETL(r, l);
-       RVM_REG_SETTYPE(r, RVM_DTYPE_SINGED);
+       RVM_REG_SETTYPE(r, RVM_DTYPE_SIGNED);
        RVM_REG_CLRFLAG(r, RVM_INFOBIT_ROBJECT);
 }
 
index d580f59..0e0652f 100644 (file)
@@ -37,7 +37,7 @@ extern "C" {
 #define RVM_DTYPE_NONE 0
 #define RVM_DTYPE_UWORD RVM_DTYPE_NONE
 #define RVM_DTYPE_UNSIGNED RVM_DTYPE_NONE
-#define RVM_DTYPE_SINGED 1
+#define RVM_DTYPE_SIGNED 1
 #define RVM_DTYPE_POINTER 2                    /* Generic pointer, it can point to any memory object */
 #define RVM_DTYPE_BOOLEAN 3
 #define RVM_DTYPE_DOUBLE 4
index 722f3e2..f52ebfe 100644 (file)
@@ -31,7 +31,7 @@ static void test_swi_print_r(rvmcpu_t *cpu, rvm_asmins_t *ins)
 
        if (rvm_reg_gettype(r) == RVM_DTYPE_UWORD)
                fprintf(stdout, "R%d = %ld\n", R, RVM_REG_GETL(r));
-       else if (rvm_reg_gettype(r) == RVM_DTYPE_SINGED)
+       else if (rvm_reg_gettype(r) == RVM_DTYPE_SIGNED)
                fprintf(stdout, "R%d = %ld\n", R, RVM_REG_GETL(r));
        else if (rvm_reg_gettype(r) == RVM_DTYPE_DOUBLE)
                fprintf(stdout, "R%d = %5.2f\n", R, RVM_REG_GETD(r));
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
        vmcode[off++] = rvm_asmp(RVM_LDRR, R0, DA, XX, &d2);
        vmcode[off++] = rvm_asm(RVM_TYPE, R1, R0, XX, 0);
        vmcode[off++] = rvm_asm(RVM_OPSWI(rvm_cpu_swilookup_s(vm, "switable", "print")), R1, XX, XX, 0);
-       vmcode[off++] = rvm_asm(RVM_CAST, R0, R0, DA, RVM_DTYPE_SINGED);
+       vmcode[off++] = rvm_asm(RVM_CAST, R0, R0, DA, RVM_DTYPE_SIGNED);
        vmcode[off++] = rvm_asm(RVM_OPSWI(rvm_cpu_swilookup_s(vm, "switable", "print")), R0, XX, XX, 0);
        vmcode[off++] = rvm_asm(RVM_MOV, R1, DA, XX, 2);
        vmcode[off++] = rvm_asm(RVM_ADD, R0, R1, R0, 0);
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
        vmcode[off++] = rvm_asmp(RVM_PRN, R1, XX, XX, 0);
        vmcode[off++] = rvm_asm(RVM_CAST, R0, R1, DA, RVM_DTYPE_UNSIGNED);
        vmcode[off++] = rvm_asmp(RVM_PRN, R0, XX, XX, 0);
-       vmcode[off++] = rvm_asm(RVM_CAST, R0, R1, DA, RVM_DTYPE_SINGED);
+       vmcode[off++] = rvm_asm(RVM_CAST, R0, R1, DA, RVM_DTYPE_SIGNED);
        vmcode[off++] = rvm_asmp(RVM_PRN, R0, XX, XX, 0);
        vmcode[off++] = rvm_asm(RVM_CAST, R0, R1, DA, RVM_DTYPE_DOUBLE);
        vmcode[off++] = rvm_asmp(RVM_PRN, R0, XX, XX, 0);
index b31c8b9..a4cf669 100644 (file)
@@ -32,7 +32,7 @@ static void test_swi_print_r(rvmcpu_t *cpu, rvm_asmins_t *ins)
 
        if (rvm_reg_gettype(r) == RVM_DTYPE_UWORD)
                fprintf(stdout, "R%d = %ld\n", ins->op1, RVM_REG_GETL(r));
-       else if (rvm_reg_gettype(r) == RVM_DTYPE_SINGED)
+       else if (rvm_reg_gettype(r) == RVM_DTYPE_SIGNED)
                fprintf(stdout, "R%d = %ld\n", ins->op1, RVM_REG_GETL(r));
        else if (rvm_reg_gettype(r) == RVM_DTYPE_DOUBLE)
                fprintf(stdout, "R%d = %5.2f\n", ins->op1, RVM_REG_GETD(r));
index 9480b6f..5222517 100644 (file)
@@ -33,7 +33,7 @@ static void test_swi_print_r(rvmcpu_t *cpu, rvm_asmins_t *ins)
 {
        rvmreg_t *r = RVM_CPUREG_PTR(cpu, ins->op1);
 
-       if (rvm_reg_gettype(r) == RVM_DTYPE_SINGED)
+       if (rvm_reg_gettype(r) == RVM_DTYPE_SIGNED)
                fprintf(stdout, "R%d = %ld\n", ins->op1, RVM_REG_GETL(r));
        else if (rvm_reg_gettype(r) == RVM_DTYPE_DOUBLE)
                fprintf(stdout, "R%d = %5.2f\n", ins->op1, RVM_REG_GETD(r));
index 89fca7a..305ca23 100644 (file)
@@ -296,7 +296,7 @@ static void rvm_js_print(rvmcpu_t *cpu, rvm_asmins_t *ins)
                r_printf("%s\n", RVM_REG_GETU(r) ? "true" : "false");
        else if (rvm_reg_gettype(r) == RVM_DTYPE_POINTER)
                r_printf("%p\n", RVM_REG_GETP(r));
-       else if (rvm_reg_gettype(r) == RVM_DTYPE_SINGED)
+       else if (rvm_reg_gettype(r) == RVM_DTYPE_SIGNED)
                r_printf("%ld\n", RVM_REG_GETL(r));
        else if (rvm_reg_gettype(r) == RVM_DTYPE_DOUBLE)
                r_printf("%f\n", RVM_REG_GETD(r));
index 3b5902e..a2d2716 100644 (file)
@@ -42,7 +42,7 @@ static void test_swi_cat(rvmcpu_t *cpu, rvm_asmins_t *ins)
 
 static void test_swi_print_r(rvmcpu_t *cpu, rvm_asmins_t *ins)
 {
-       if (rvm_reg_gettype(RVM_CPUREG_PTR(cpu, ins->op1)) == RVM_DTYPE_SINGED)
+       if (rvm_reg_gettype(RVM_CPUREG_PTR(cpu, ins->op1)) == RVM_DTYPE_SIGNED)
                fprintf(stdout, "R%d = %ld\n", ins->op1, RVM_CPUREG_GETL(cpu, ins->op1));
        else if (rvm_reg_gettype(RVM_CPUREG_PTR(cpu, ins->op1)) == RVM_DTYPE_DOUBLE)
                fprintf(stdout, "R%d = %5.2f\n", ins->op1, RVM_CPUREG_GETD(cpu, ins->op1));