diff options
| -rw-r--r-- | ujit_codegen.c | 8 | ||||
| -rw-r--r-- | ujit_core.c | 13 |
2 files changed, 13 insertions, 8 deletions
diff --git a/ujit_codegen.c b/ujit_codegen.c index a9462622ae..980e3e6673 100644 --- a/ujit_codegen.c +++ b/ujit_codegen.c @@ -776,7 +776,10 @@ gen_opt_send_without_block(jitstate_t* jit, ctx_t* ctx) // Pointer to the klass field of the receiver &(recv->klass) x86opnd_t klass_opnd = mem_opnd(64, REG0, offsetof(struct RBasic, klass)); - // Bail if receiver class is different from compiled time call cache class + // FIXME + //assume_method_lookup_stable(cd->cc, cme, ctx); + + // Bail if receiver class is different from compile-time call cache class mov(cb, REG1, imm_opnd(cd->cc->klass)); cmp(cb, klass_opnd, REG1); jne_ptr(cb, side_exit); @@ -893,9 +896,6 @@ gen_opt_send_without_block(jitstate_t* jit, ctx_t* ctx) //print_str(cb, "before C call"); - // FIXME - //assume_method_lookup_stable(cd->cc, cme, ctx); - // Call the C function // VALUE ret = (cfunc->func)(recv, argv[0], argv[1]); // cfunc comes from compile-time cme->def, which we assume to be stable. diff --git a/ujit_core.c b/ujit_core.c index 9ebc3c1e56..e3086c4fba 100644 --- a/ujit_core.c +++ b/ujit_core.c @@ -86,18 +86,23 @@ uint8_t* find_block_version(blockid_t block, const ctx_t* ctx) } // Compile a new block version immediately -uint8_t* gen_block_version(blockid_t block, const ctx_t* ctx) +uint8_t* gen_block_version(blockid_t blockid, const ctx_t* ctx) { // Copy the context object to avoid modifying it ctx_t ctx_copy = *ctx; uint32_t num_instrs = 0; - uint8_t* block_ptr = ujit_compile_block(block.iseq, block.idx, &ctx_copy, &num_instrs); + uint8_t* p_block = ujit_compile_block(blockid.iseq, blockid.idx, &ctx_copy, &num_instrs); + + // Need to allocate the blockid on the heap + // to store it in the hash table + blockid_t* p_blockid = (blockid_t*)malloc(sizeof(blockid_t)); + memcpy(p_blockid, &blockid, sizeof(blockid_t)); // Keep track of the new block version - st_insert(version_tbl, (st_data_t)&block, (st_data_t)block_ptr); + st_insert(version_tbl, (st_data_t)p_blockid, (st_data_t)p_block); - return block_ptr; + return p_block; } // Called by the generated code when a branch stub is executed |
