RPA Toolkit
renamed map related instructions.
authorMartin Stoilov <martin@rpasearch.com>
Thu, 9 Jun 2011 05:27:50 +0000 (22:27 -0700)
committerMartin Stoilov <martin@rpasearch.com>
Thu, 9 Jun 2011 05:27:50 +0000 (22:27 -0700)
rjs/rjs.c
rjs/rjscompiler.c
rvm/rvmcpu.c
rvm/rvmcpu.h
tests/testmisc/rpagen-test.c

index d1e6c0b..0d43d86 100644 (file)
--- a/rjs/rjs.c
+++ b/rjs/rjs.c
@@ -1,6 +1,6 @@
 #include <stdarg.h>
 #include "rmem.h"
-#include "rjsobject.h"
+#include "rmap.h"
 #include "rjs.h"
 #include "rvmcodegen.h"
 
@@ -39,7 +39,7 @@ rjs_engine_t *rjs_engine_create()
        if (!jse->pa || !jse->cpu || !jse->co || !jse->cgs)
                goto error;
        tp = rvm_cpu_alloc_global(jse->cpu);
-       rvm_reg_setjsobject(tp, (robject_t *)rjs_object_create(sizeof(rvmreg_t)));
+       rvm_reg_setjsobject(tp, (robject_t *)r_map_create(sizeof(rvmreg_t), 7));
        rvm_gc_add(jse->cpu->gc, (robject_t*)RVM_REG_GETP(tp));
        rvm_cpu_setreg(jse->cpu, TP, tp);
        return jse;
index 9252fb7..c8c6ed7 100644 (file)
@@ -675,7 +675,7 @@ rint rjs_compiler_rh_newarrayexpression(rjs_compiler_t *co, rarray_t *records, r
        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_ALLOCOBJ, R0, DA, XX, 0));
+       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPALLOC, R0, DA, XX, 0));
        rjs_compiler_debugtail(co, records, rec);
        return 0;
 }
@@ -698,12 +698,12 @@ rint 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_OBJLKUPADD, R0, R1, R2, 0));     // Get the offset of the element at offset R0
-               rvm_codegen_addins(co->cg, rvm_asm(RVM_ADDROBJH, R0, R1, R0, 0));       // Get the address of the element at offset R0
+               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
 
        } else {
-               rvm_codegen_addins(co->cg, rvm_asm(RVM_OBJLKUP, R0, R1, R2, 0));        // Get the offset of the element at offset R0
-               rvm_codegen_addins(co->cg, rvm_asm(RVM_LDOBJH, R0, R1, R0, 0)); // Get the value of the element at offset R0
+               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(RVM_MAPLDR, R0, R1, R0, 0)); // Get the value of the element at offset R0
        }
        rjs_compiler_debugtail(co, records, rec);
        return 0;
@@ -712,6 +712,7 @@ rint rjs_compiler_rh_memberexpressiondotop(rjs_compiler_t *co, rarray_t *records
 
 rint rjs_compiler_rh_memberexpressionindexop(rjs_compiler_t *co, rarray_t *records, rlong rec)
 {
+       rjs_coctx_t *ctx = rjs_compiler_gettopctx(co);
        rparecord_t *prec;
        prec = (rparecord_t *)r_array_slot(records, rec);
        rjs_compiler_debughead(co, records, rec);
@@ -720,16 +721,20 @@ rint rjs_compiler_rh_memberexpressionindexop(rjs_compiler_t *co, rarray_t *recor
 
        if (rjs_compiler_playchildrecords(co, records, rec) < 0)
                return -1;
+       if (ctx && ctx->type == RJS_COCTX_FUNCTIONCALL)
+               ((rjs_coctx_functioncall_t *)ctx)->setthis = 1;
        rec = rpa_recordtree_get(records, rec, RPA_RECORD_END);
        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_POP, R1, XX, XX, 0));    // Supposedly an Array
-               rvm_codegen_addins(co->cg, rvm_asm(RVM_ADDROBJN, R0, R1, R0, 0));       // Get the address of the element at offset R0
+               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
 
        } 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_LDOBJN, R0, R1, R0, 0)); // Get the value of the element at offset R0
+               rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLKUP, R0, R1, R0, 0));        // R1 Array
+               rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLDR, R0, R1, R0, 0)); // Get the value of the element at offset R0
        }
        rjs_compiler_debugtail(co, records, rec);
        return 0;
@@ -1361,7 +1366,7 @@ rint rjs_compiler_rh_newexpressioncall(rjs_compiler_t *co, rarray_t *records, rl
        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_ALLOCOBJ, TP, DA, XX, 0));
+       rvm_codegen_addins(co->cg, rvm_asm(RVM_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));
index 9d3d649..c8c4c9f 100644 (file)
@@ -152,16 +152,13 @@ static const char *stropcalls[] = {
        "RVM_ADDRA",
        "RVM_LDA",
        "RVM_STA",
-       "RVM_ALLOCOBJ",
-       "RVM_ADDROBJN",
-       "RVM_ADDROBJH",
-       "RVM_LDOBJN",
-       "RVM_STOBJN",
-       "RVM_LDOBJH",
-       "RVM_STOBJH",
-       "RVM_OBJLKUP",
-       "RVM_OBJADD",
-       "RVM_OBJLKUPADD",
+       "RVM_MAPALLOC",
+       "RVM_MAPADDR",
+       "RVM_MAPLDR",
+       "RVM_MAPSTR",
+       "RVM_MAPLKUP",
+       "RVM_MAPADD",
+       "RVM_MAPLKUPADD",
        "UNKNOWN",
        "UNKNOWN",
        "UNKNOWN",
@@ -1516,7 +1513,7 @@ static void rvm_op_allocstr(rvmcpu_t *cpu, rvm_asmins_t *ins)
 }
 
 
-static void rvm_op_allocobj(rvmcpu_t *cpu, rvm_asmins_t *ins)
+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);
@@ -1543,76 +1540,33 @@ static void rvm_op_allocarr(rvmcpu_t *cpu, rvm_asmins_t *ins)
 }
 
 
-static void rvm_op_addrobjn(rvmcpu_t *cpu, rvm_asmins_t *ins)
+static void rvm_op_maplookup(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_long(0);
-       rmap_t *a;
-       rlong index;
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
-       index = RVM_REG_GETL(&tmp);
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_JSOBJECT)
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       if (index < 0)
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       a = (rmap_t*)RVM_REG_GETP(arg2);
-       RVM_REG_CLEAR(arg1);
-       RVM_REG_SETTYPE(arg1, RVM_DTYPE_POINTER);
-       RVM_REG_SETP(arg1, r_map_value(a, index));
-}
-
-
-static void rvm_op_ldobjn(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_long(0);
-       rmap_t *a = NULL;
-       rlong index;
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
-       index = RVM_REG_GETL(&tmp);
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_JSOBJECT)
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       if (index < 0)
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       a = (rmap_t*)RVM_REG_GETP(arg2);
-       *arg1 = *((rvmreg_t*)r_map_value(a, index));
-}
-
-
-static void rvm_op_stobjn(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_long(0);
-       rmap_t *a = NULL;
        rlong index;
-
-       rvm_opmap_invoke_binary_handler(cpu->opmap, RVM_OPID_CAST, cpu, &tmp, RVM_CPUREG_PTR(cpu, ins->op3), &tmp);
-       index = RVM_REG_GETL(&tmp);
-       if (rvm_reg_gettype(arg2) != RVM_DTYPE_JSOBJECT)
-               RVM_ABORT(cpu, RVM_E_NOTOBJECT);
-       if (index < 0)
-               RVM_ABORT(cpu, RVM_E_ILLEGAL);
-       a = (rmap_t*)RVM_REG_GETP(arg2);
-       r_map_setvalue(a, index, arg1);
-}
-
-
-static void rvm_op_objlookup(rvmcpu_t *cpu, rvm_asmins_t *ins)
-{
+       rlong keysize;
+       rchar key[256], *pkey = key;
        rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
        rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rlong index;
+       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_JSOBJECT) {
                RVM_ABORT(cpu, RVM_E_NOTOBJECT);
        }
-       index = r_map_lookup(a, -1, RVM_CPUREG_GETP(cpu, ins->op3), RVM_CPUREG_GETL(cpu, ins->op1));
+       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_LONG || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
+               keysize = r_snprintf(key, sizeof(key) - 1, "%ld", RVM_REG_GETL(arg3));
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_DOUBLE) {
+               keysize = r_snprintf(key, sizeof(key) - 1, "%f", RVM_REG_GETD(arg3));
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_STRING) {
+               pkey = ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str;
+               keysize = ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size;
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_POINTER) {
+               pkey = (rchar*)RVM_CPUREG_GETP(cpu, ins->op3);
+               keysize = RVM_CPUREG_GETL(cpu, ins->op1);
+       } else {
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       }
+       index = r_map_lookup(a, -1, pkey, keysize);
 
        RVM_REG_CLEAR(arg1);
        RVM_REG_SETTYPE(arg1, RVM_DTYPE_LONG);
@@ -1620,17 +1574,33 @@ static void rvm_op_objlookup(rvmcpu_t *cpu, rvm_asmins_t *ins)
 }
 
 
-static void rvm_op_objkeyadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
+static void rvm_op_mapadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
 {
+       rlong index;
+       rlong keysize;
+       rchar key[256], *pkey = key;
        rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
        rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rlong index;
+       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_JSOBJECT) {
                RVM_ABORT(cpu, RVM_E_NOTOBJECT);
        }
-       index = r_map_add(a, RVM_CPUREG_GETP(cpu, ins->op3), RVM_CPUREG_GETL(cpu, ins->op1), NULL);
+       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_LONG || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
+               keysize = r_snprintf(key, sizeof(key) - 1, "%ld", RVM_REG_GETL(arg3));
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_DOUBLE) {
+               keysize = r_snprintf(key, sizeof(key) - 1, "%f", RVM_REG_GETD(arg3));
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_STRING) {
+               pkey = ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str;
+               keysize = ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size;
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_POINTER) {
+               pkey = (rchar*)RVM_CPUREG_GETP(cpu, ins->op3);
+               keysize = RVM_CPUREG_GETL(cpu, ins->op1);
+       } else {
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       }
+       index = r_map_add(a, pkey, keysize, NULL);
 
        RVM_REG_CLEAR(arg1);
        RVM_REG_SETTYPE(arg1, RVM_DTYPE_LONG);
@@ -1638,27 +1608,43 @@ static void rvm_op_objkeyadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
 }
 
 
-static void rvm_op_objkeylookupadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
+static void rvm_op_maplookupadd(rvmcpu_t *cpu, rvm_asmins_t *ins)
 {
+       rlong index;
+       rlong keysize;
+       rchar key[256], *pkey = key;
        rvmreg_t *arg1 = RVM_CPUREG_PTR(cpu, ins->op1);
        rvmreg_t *arg2 = RVM_CPUREG_PTR(cpu, ins->op2);
-       rlong index;
+       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_JSOBJECT) {
                RVM_ABORT(cpu, RVM_E_NOTOBJECT);
        }
-       index = r_map_lookup(a, -1, RVM_CPUREG_GETP(cpu, ins->op3), RVM_CPUREG_GETL(cpu, ins->op1));
-       if (index < 0)
-               index = r_map_add(a, RVM_CPUREG_GETP(cpu, ins->op3), RVM_CPUREG_GETL(cpu, ins->op1), NULL);
 
+       if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_LONG || RVM_REG_GETTYPE(arg3) == RVM_DTYPE_UNSIGNED) {
+               keysize = r_snprintf(key, sizeof(key) - 1, "%ld", RVM_REG_GETL(arg3));
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_DOUBLE) {
+               keysize = r_snprintf(key, sizeof(key) - 1, "%f", RVM_REG_GETD(arg3));
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_STRING) {
+               pkey = ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.str;
+               keysize = ((rstring_t *)RVM_CPUREG_GETP(cpu, ins->op3))->s.size;
+       } else if (RVM_REG_GETTYPE(arg3) == RVM_DTYPE_POINTER) {
+               pkey = (rchar*)RVM_CPUREG_GETP(cpu, ins->op3);
+               keysize = RVM_CPUREG_GETL(cpu, ins->op1);
+       } else {
+               RVM_ABORT(cpu, RVM_E_ILLEGAL);
+       }
+       index = r_map_lookup(a, -1, pkey, keysize);
+       if (index < 0)
+               index = r_map_add(a, pkey, keysize, NULL);
        RVM_REG_CLEAR(arg1);
        RVM_REG_SETTYPE(arg1, RVM_DTYPE_LONG);
        RVM_REG_SETL(arg1, index);
 }
 
 
-static void rvm_op_addrobjh(rvmcpu_t *cpu, rvm_asmins_t *ins)
+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);
@@ -1681,7 +1667,7 @@ static void rvm_op_addrobjh(rvmcpu_t *cpu, rvm_asmins_t *ins)
 }
 
 
-static void rvm_op_ldobjh(rvmcpu_t *cpu, rvm_asmins_t *ins)
+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);
@@ -1705,7 +1691,7 @@ static void rvm_op_ldobjh(rvmcpu_t *cpu, rvm_asmins_t *ins)
 }
 
 
-static void rvm_op_stobjh(rvmcpu_t *cpu, rvm_asmins_t *ins)
+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);
@@ -1899,16 +1885,13 @@ static rvm_cpu_op ops[] = {
        rvm_op_addra,           // RVM_ADDRA
        rvm_op_lda,                     // RVM_LDA
        rvm_op_sta,                     // RVM_STA
-       rvm_op_allocobj,        // RVM_ALLOCOBJ
-       rvm_op_addrobjn,        // RVM_ADDROBJN,
-       rvm_op_addrobjh,        // RVM_ADDROBJH,
-       rvm_op_ldobjn,          // RVM_LDOBJN,
-       rvm_op_stobjn,          // RVM_STOBJN,
-       rvm_op_ldobjh,          // RVM_LDOBJH,
-       rvm_op_stobjh,          // RVM_STOBJH,
-       rvm_op_objlookup,       // RVM_OBJLKUP,
-       rvm_op_objkeyadd,       // RVM_OBJADD,
-       rvm_op_objkeylookupadd, // RVM_OBJLKUPADD,
+       rvm_op_mapalloc,        // RVM_MAPALLOC
+       rvm_op_mapaddr,         // RVM_MAPADDR,
+       rvm_op_mapldr,          // RVM_MAPLDR,
+       rvm_op_mapstr,          // RVM_MAPSTR,
+       rvm_op_maplookup,       // RVM_MAPLKUP,
+       rvm_op_mapadd,          // RVM_MAPADD,
+       rvm_op_maplookupadd,// RVM_MAPLKUPADD,
        (void*) 0,
        (void*) 0,
        (void*) 0,
index 24947c7..b34edff 100644 (file)
@@ -155,16 +155,13 @@ enum {
        RVM_ADDRA,              /* op1 is the destination memory, op2 is the array, op3 is the offset */
        RVM_LDA,                /* op1 is the destination, op2 is the array, op3 is the offset */
        RVM_STA,                /* op1 is the source, op2 is the array, op3 is the offset */
-       RVM_ALLOCOBJ,
-       RVM_ADDROBJN,
-       RVM_ADDROBJH,
-       RVM_LDOBJN,
-       RVM_STOBJN,
-       RVM_LDOBJH,
-       RVM_STOBJH,
-       RVM_OBJLKUP,
-       RVM_OBJADD,
-       RVM_OBJLKUPADD,
+       RVM_MAPALLOC,
+       RVM_MAPADDR,
+       RVM_MAPLDR,
+       RVM_MAPSTR,
+       RVM_MAPLKUP,
+       RVM_MAPADD,
+       RVM_MAPLKUPADD,
 };
 
 
index 9f88ab0..09880b1 100644 (file)
@@ -647,7 +647,7 @@ int codegen_program_callback(rpa_stat_handle stat, const char *name, void *userd
                rvm_costat_pushroot(co);
                rvm_codegen_addins(co->cg, rvm_asm(RVM_NOP, XX, XX, XX, 0));
                rvm_codegen_addins(co->cg, rvm_asm(RVM_NOP, XX, XX, XX, 0));
-//             rvm_codegen_addins(co->cg, rvm_asm(RVM_ALLOCOBJ, R8, DA, XX, 0));
+//             rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPALLOC, R8, DA, XX, 0));
 //             rvm_codegen_addins(co->cg, rvm_asm(RVM_MOV, TP, R8, XX, 0));
        } else {
                rvm_codegen_replaceins(co->cg, 0, rvm_asm(RVM_MOV, FP, SP, XX, 0));
@@ -757,9 +757,9 @@ int codegen_addressoflefthandside_callback(rpa_stat_handle stat, const char *nam
        } else if (last->opcode == RVM_LDOBJN) {
                last->opcode = RVM_ADDROBJN;
                off -= 1;
-       } else if (last->opcode == RVM_LDOBJH && lastlast->opcode == RVM_OBJLKUP) {
-               lastlast->opcode = RVM_OBJLKUPADD;
-               last->opcode = RVM_ADDROBJH;
+       } else if (last->opcode == RVM_MAPLDR && lastlast->opcode == RVM_MAPLKUP) {
+               lastlast->opcode = RVM_MAPLKUPADD;
+               last->opcode = RVM_MAPADDR;
                off -= 2;
        } else {
                fprintf(stdout, "ERROR: Invalid Left-Hand side expression: ");
@@ -800,7 +800,7 @@ int codegen_h_arraynamelookup_callback(rpa_stat_handle stat, const char *name, v
        rvm_codegen_addins(co->cg, rvm_asm(RVM_POP, R1, XX, XX, 0));    // Supposedly Array Address
        rvm_codegen_addins(co->cg, rvm_asm(RVM_MOV, R0, DA, XX, size));
        rvm_codegen_addins(co->cg, rvm_asmp(RVM_MOV, R2, DA, XX, (void*)input));
-       rvm_codegen_addins(co->cg, rvm_asm(RVM_OBJLKUP, R0, R1, R2, 0));        // Get the address of the element at offset R0
+       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLKUP, R0, R1, R2, 0));        // Get the address of the element at offset R0
 
        codegen_print_callback(stat, name, userdata, input, size, reason);
        codegen_dump_code(rvm_codegen_getcode(co->cg, off), rvm_codegen_getcodesize(co->cg) - off);
@@ -814,7 +814,7 @@ int codegen_h_arrayelementvalue_callback(rpa_stat_handle stat, const char *name,
        rvm_compiler_t *co = (rvm_compiler_t *)userdata;
        rulong off = rvm_codegen_getcodesize(co->cg);
 
-       rvm_codegen_addins(co->cg, rvm_asm(RVM_LDOBJH, R0, R1, R0, 0)); // Get the address of the element at offset R0
+       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPLDR, R0, R1, R0, 0)); // Get the address of the element at offset R0
 
        codegen_print_callback(stat, name, userdata, input, size, reason);
        codegen_dump_code(rvm_codegen_getcode(co->cg, off), rvm_codegen_getcodesize(co->cg) - off);
@@ -972,7 +972,7 @@ int codegen_opnewarray_callback(rpa_stat_handle stat, const char *name, void *us
        rvm_compiler_t *co = (rvm_compiler_t *)userdata;
        rulong off = rvm_codegen_getcodesize(co->cg);
 
-       rvm_codegen_addins(co->cg, rvm_asm(RVM_ALLOCOBJ, R0, DA, XX, 0));
+       rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPALLOC, R0, DA, XX, 0));
 
        codegen_print_callback(stat, name, userdata, input, size, reason);
        codegen_dump_code(rvm_codegen_getcode(co->cg, off), rvm_codegen_getcodesize(co->cg) - off);
@@ -1056,7 +1056,7 @@ int codegen_newexpressioncallop_callback(rpa_stat_handle stat, const char *name,
                rvm_codegen_addins(co->cg, rvm_asm(RVM_PUSHM, DA, XX, XX, BIT(TP)|BIT(FP)|BIT(SP)|BIT(LR)));
        } else if (reason & RPA_REASON_MATCHED){
                rvm_funcall_t *funcall = r_array_empty(co->funcall) ? NULL : (rvm_funcall_t *) r_array_slot(co->funcall, r_array_length(co->funcall) - 1);
-               rvm_codegen_addins(co->cg, rvm_asm(RVM_ALLOCOBJ, TP, DA, XX, 0));
+               rvm_codegen_addins(co->cg, rvm_asm(RVM_MAPALLOC, TP, DA, XX, 0));
                rvm_codegen_addins(co->cg, rvm_asm(RVM_SUB, FP, SP, DA, funcall->params));
                rvm_codegen_addins(co->cg, rvm_asm(RVM_CALL, R0, DA, XX, -rvm_codegen_getcodesize(co->cg)));
                rvm_codegen_addins(co->cg, rvm_asm(RVM_MOV, SP, FP, XX, 0));
@@ -1085,7 +1085,7 @@ int codegen_funcallname_callback(rpa_stat_handle stat, const char *name, void *u
        rulong off = rvm_codegen_getcodesize(co->cg);
        rvm_asmins_t *last = rvm_codegen_getcode(co->cg, off - 1);
 
-       if (last->op1 == R0 && last->op2 == R1 && (last->opcode == RVM_LDOBJN || last->opcode == RVM_LDOBJH)) {
+       if (last->op1 == R0 && last->op2 == R1 && (last->opcode == RVM_LDOBJN || last->opcode == RVM_MAPLDR)) {
                /*
                 * The function call id is comming from an object, so we set the this pointer (TP)
                 * to point to the object (R1)