summaryrefslogtreecommitdiff
path: root/ujit_iface.c
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2021-01-22 12:22:34 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:27 -0400
commitd528cf4fd5551c323484c2ffb79b56af0c6f50c4 (patch)
tree705f5729cd772cc4aff66fcd9e923a24ac9c388a /ujit_iface.c
parent11512a80fce8bfac3adf7038e9d9e3839e5cbbfb (diff)
Added comments. Fixed compiler warning.
Diffstat (limited to 'ujit_iface.c')
-rw-r--r--ujit_iface.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/ujit_iface.c b/ujit_iface.c
index 412c3ace90..ea7445e4ed 100644
--- a/ujit_iface.c
+++ b/ujit_iface.c
@@ -253,23 +253,6 @@ rb_ujit_method_lookup_change(VALUE cme_or_cc)
// Invalidate all regions that depend on the cme or cc
for (int32_t i = 0; i < array->size; i++) {
block_t* block = array->data[i];
-
- /*
- struct compiled_region *region = &array->data[i];
- const struct rb_iseq_constant_body *body = region->iseq->body;
- RUBY_ASSERT((unsigned int)region->start_idx < body->iseq_size);
-
- // Restore region address to interpreter address in bytecode sequence
- if (body->iseq_encoded[region->start_idx] == (VALUE)region->code) {
- const void *const *code_threading_table = rb_vm_get_insns_address_table();
- int opcode = rb_vm_insn_addr2insn(region->code);
- body->iseq_encoded[region->start_idx] = (VALUE)code_threading_table[opcode];
- if (UJIT_DUMP_MODE > 0) {
- fprintf(stderr, "cc_or_cme=%p now out of date. Restored idx=%u in iseq=%p\n", (void *)cme_or_cc, (unsigned)region->start_idx, (void *)region->iseq);
- }
- }
- */
-
invalidate(block);
}
@@ -333,7 +316,7 @@ ujit_blocks_for(VALUE mod, VALUE rb_iseq)
}
static VALUE
-ujit_insert(VALUE mod, VALUE iseq)
+ujit_install_entry(VALUE mod, VALUE iseq)
{
rb_ujit_compile_iseq(rb_iseqw_to_iseq(iseq));
return iseq;
@@ -355,7 +338,10 @@ block_code(VALUE self)
block_t * block;
TypedData_Get_Struct(self, block_t, &ujit_block_type, block);
- return rb_str_new(cb->mem_block + block->start_pos, block->end_pos - block->start_pos);
+ return (VALUE)rb_str_new(
+ (const char*)cb->mem_block + block->start_pos,
+ block->end_pos - block->start_pos
+ );
}
/* Get the start index in the Instruction Sequence that corresponds to this
@@ -394,7 +380,7 @@ rb_ujit_init(void)
ujit_init_codegen();
VALUE mUjit = rb_define_module("UJIT");
- rb_define_module_function(mUjit, "install_entry", ujit_insert, 1);
+ rb_define_module_function(mUjit, "install_entry", ujit_install_entry, 1);
rb_define_module_function(mUjit, "blocks_for", ujit_blocks_for, 1);
cUjitBlock = rb_define_class_under(mUjit, "Block", rb_cObject);