RPA Toolkit
Going back to dynamic strings. No support for static strings for now.
authorMartin Stoilov <martin@rpasearch.com>
Sat, 28 May 2011 23:07:09 +0000 (16:07 -0700)
committerMartin Stoilov <martin@rpasearch.com>
Sat, 28 May 2011 23:07:09 +0000 (16:07 -0700)
rjs/rjscompiler.c
rvm/rvmrelocmap.h

index 2d92fe9..2e81e70 100644 (file)
@@ -536,9 +536,6 @@ rint rjs_compiler_rh_stringliteral(rjs_compiler_t *co, rarray_t *records, rlong
 {
        rparecord_t *prec;
        prec = (rparecord_t *)r_array_slot(records, rec);
-       rvmreg_t *strreg;
-       rstring_t *s;
-       rlong stringidx;
 
        rjs_compiler_debughead(co, records, rec);
        co->stringcharacters.str = NULL;
@@ -551,16 +548,9 @@ rint rjs_compiler_rh_stringliteral(rjs_compiler_t *co, rarray_t *records, rlong
        rec = rpa_recordtree_get(records, rec, RPA_RECORD_END);
        prec = (rparecord_t *)r_array_slot(records, rec);
        rjs_compiler_debughead(co, records, rec);
-
-/*
-       stringidx = rvm_codegen_adddata_s(co->cg, NULL, co->stringcharacters.str, co->stringcharacters.size);
-       rvm_codegen_index_addrelocins(co->cg, RVM_RELOC_STRING, stringidx, rvm_asma(RVM_MOV, R0, DA, XX, 0, co->stringcharacters.size));
-*/
-       strreg = rvm_cpu_alloc_global(co->cpu);
-       s = r_string_create_from_rstr(&co->stringcharacters);
-       rvm_gc_add(co->cpu->gc, (robject_t*)s);
-       rvm_reg_setstring(strreg, s);
-       rvm_codegen_addins(co->cg, rvm_asmp(RVM_LDRR, R0, DA, XX, strreg));
+       rvm_codegen_addins(co->cg, rvm_asmp(RVM_MOV, R1, DA, XX, co->stringcharacters.str));
+       rvm_codegen_addins(co->cg, rvm_asm(RVM_MOV, R2, DA, XX, co->stringcharacters.size));
+       rvm_codegen_addins(co->cg, rvm_asm(RVM_ALLOCSTR, R0, R1, R2, 0));
        rjs_compiler_debugtail(co, records, rec);
        return 0;
 }
index 1e75815..c774a43 100644 (file)
@@ -21,7 +21,14 @@ typedef enum {
 } rvm_reloctype_t;
 
 
+typedef enum {
+       RVM_RELOC_CODE = 0,
+       RVM_RELOC_DATA,
+} rvm_reloctarget_t;
+
+
 typedef struct rvm_relocrecord_s {
+       rvm_reloctarget_t target;
        rvm_reloctype_t type;
        rulong offset;
        rulong label;