summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2019-05-18 09:23:47 (GMT)
committerAaron Patterson <tenderlove@ruby-lang.org>2019-05-18 09:24:28 (GMT)
commit154a67f140a8397df77d82cdc80e13b291b8aedd (patch)
treeb2f637ae3b7310aa1004b92d648a906f7f2c59a0
parentbbb84a16fab8e715a108c318e9e0e019339eb972 (diff)
Rename rb_gc_new_location to rb_gc_location
The function will return new or existing locations depending on whether or not the object actually moved, so give it a more appropriate name.
-rw-r--r--gc.c22
-rw-r--r--include/ruby/intern.h2
-rw-r--r--iseq.c20
-rw-r--r--mjit.c4
-rw-r--r--transient_heap.c4
-rw-r--r--variable.c2
6 files changed, 27 insertions, 27 deletions
diff --git a/gc.c b/gc.c
index f6309b1..7f3cc8b 100644
--- a/gc.c
+++ b/gc.c
@@ -7625,11 +7625,11 @@ hash_replace_ref(st_data_t *key, st_data_t *value, st_data_t argp, int existing)
rb_objspace_t *objspace = (rb_objspace_t *)argp;
if (gc_object_moved_p(objspace, (VALUE)*key)) {
- *key = rb_gc_new_location((VALUE)*key);
+ *key = rb_gc_location((VALUE)*key);
}
if (gc_object_moved_p(objspace, (VALUE)*value)) {
- *value = rb_gc_new_location((VALUE)*value);
+ *value = rb_gc_location((VALUE)*value);
}
return ST_CONTINUE;
@@ -7789,7 +7789,7 @@ check_id_table_move(ID id, VALUE value, void *data)
/* Returns the new location of an object, if it moved. Otherwise returns
* the existing location. */
VALUE
-rb_gc_new_location(VALUE value)
+rb_gc_location(VALUE value)
{
VALUE destination;
@@ -7825,7 +7825,7 @@ update_id_table(ID *key, VALUE * value, void *data, int existing)
rb_objspace_t *objspace = (rb_objspace_t *)data;
if (gc_object_moved_p(objspace, (VALUE)*value)) {
- *value = rb_gc_new_location((VALUE)*value);
+ *value = rb_gc_location((VALUE)*value);
}
return ID_TABLE_CONTINUE;
@@ -7846,11 +7846,11 @@ update_const_table(VALUE value, void *data)
rb_objspace_t * objspace = (rb_objspace_t *)data;
if (gc_object_moved_p(objspace, ce->value)) {
- ce->value = rb_gc_new_location(ce->value);
+ ce->value = rb_gc_location(ce->value);
}
if (gc_object_moved_p(objspace, ce->file)) {
- ce->file = rb_gc_new_location(ce->file);
+ ce->file = rb_gc_location(ce->file);
}
return ID_TABLE_CONTINUE;
@@ -8096,8 +8096,8 @@ gc_update_references(rb_objspace_t * objspace)
rb_objspace_each_objects_without_setup(gc_ref_update, objspace);
rb_vm_update_references(vm);
rb_transient_heap_update_references();
- global_symbols.ids = rb_gc_new_location(global_symbols.ids);
- global_symbols.dsymbol_fstr_hash = rb_gc_new_location(global_symbols.dsymbol_fstr_hash);
+ global_symbols.ids = rb_gc_location(global_symbols.ids);
+ global_symbols.dsymbol_fstr_hash = rb_gc_location(global_symbols.dsymbol_fstr_hash);
gc_update_table_refs(objspace, global_symbols.str_sym);
gc_update_table_refs(objspace, finalizer_table);
}
@@ -8157,7 +8157,7 @@ static void
root_obj_check_moved_i(const char *category, VALUE obj, void *data)
{
if (gc_object_moved_p(&rb_objspace, obj)) {
- rb_bug("ROOT %s points to MOVED: %p -> %s\n", category, (void *)obj, obj_info(rb_gc_new_location(obj)));
+ rb_bug("ROOT %s points to MOVED: %p -> %s\n", category, (void *)obj, obj_info(rb_gc_location(obj)));
}
}
@@ -8166,7 +8166,7 @@ reachable_object_check_moved_i(VALUE ref, void *data)
{
VALUE parent = (VALUE)data;
if (gc_object_moved_p(&rb_objspace, ref)) {
- rb_bug("Object %s points to MOVED: %p -> %s\n", obj_info(parent), (void *)ref, obj_info(rb_gc_new_location(ref)));
+ rb_bug("Object %s points to MOVED: %p -> %s\n", obj_info(parent), (void *)ref, obj_info(rb_gc_location(ref)));
}
}
@@ -11126,7 +11126,7 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj)
break;
}
case T_MOVED: {
- snprintf(buff, buff_size, "-> %p", (void*)rb_gc_new_location(obj));
+ snprintf(buff, buff_size, "-> %p", (void*)rb_gc_location(obj));
break;
}
case T_HASH: {
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index efe2f31..d629d08 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -515,7 +515,7 @@ void rb_update_st_references(struct st_table *ht);
void rb_gc_mark_maybe(VALUE);
void rb_gc_mark(VALUE);
void rb_gc_mark_no_pin(VALUE);
-VALUE rb_gc_new_location(VALUE);
+VALUE rb_gc_location(VALUE);
void rb_gc_force_recycle(VALUE);
void rb_gc(void);
void rb_gc_copy_finalizer(VALUE,VALUE);
diff --git a/iseq.c b/iseq.c
index ac5476d..f70a100 100644
--- a/iseq.c
+++ b/iseq.c
@@ -214,7 +214,7 @@ rb_iseq_each_value(const rb_iseq_t *iseq, iseq_value_itr_t * func, void *data)
static VALUE
update_each_insn_value(void *ctx, VALUE obj)
{
- return rb_gc_new_location(obj);
+ return rb_gc_location(obj);
}
void
@@ -223,16 +223,16 @@ rb_iseq_update_references(rb_iseq_t *iseq)
if (iseq->body) {
struct rb_iseq_constant_body *body = iseq->body;
- body->variable.coverage = rb_gc_new_location(body->variable.coverage);
- body->variable.pc2branchindex = rb_gc_new_location(body->variable.pc2branchindex);
- body->location.label = rb_gc_new_location(body->location.label);
- body->location.base_label = rb_gc_new_location(body->location.base_label);
- body->location.pathobj = rb_gc_new_location(body->location.pathobj);
+ body->variable.coverage = rb_gc_location(body->variable.coverage);
+ body->variable.pc2branchindex = rb_gc_location(body->variable.pc2branchindex);
+ body->location.label = rb_gc_location(body->location.label);
+ body->location.base_label = rb_gc_location(body->location.base_label);
+ body->location.pathobj = rb_gc_location(body->location.pathobj);
if (body->local_iseq) {
- body->local_iseq = (struct rb_iseq_struct *)rb_gc_new_location((VALUE)body->local_iseq);
+ body->local_iseq = (struct rb_iseq_struct *)rb_gc_location((VALUE)body->local_iseq);
}
if (body->parent_iseq) {
- body->parent_iseq = (struct rb_iseq_struct *)rb_gc_new_location((VALUE)body->parent_iseq);
+ body->parent_iseq = (struct rb_iseq_struct *)rb_gc_location((VALUE)body->parent_iseq);
}
if (FL_TEST(iseq, ISEQ_MARKABLE_ISEQ)) {
rb_iseq_each_value(iseq, update_each_insn_value, NULL);
@@ -246,7 +246,7 @@ rb_iseq_update_references(rb_iseq_t *iseq)
for (j = 0; i < body->param.keyword->num; i++, j++) {
VALUE obj = body->param.keyword->default_values[j];
if (obj != Qundef) {
- body->param.keyword->default_values[j] = rb_gc_new_location(obj);
+ body->param.keyword->default_values[j] = rb_gc_location(obj);
}
}
}
@@ -258,7 +258,7 @@ rb_iseq_update_references(rb_iseq_t *iseq)
struct iseq_catch_table_entry *entry;
entry = &table->entries[i];
if (entry->iseq) {
- entry->iseq = (rb_iseq_t *)rb_gc_new_location((VALUE)entry->iseq);
+ entry->iseq = (rb_iseq_t *)rb_gc_location((VALUE)entry->iseq);
}
}
}
diff --git a/mjit.c b/mjit.c
index 9142e92..2f5f233 100644
--- a/mjit.c
+++ b/mjit.c
@@ -119,7 +119,7 @@ mjit_update_references(const rb_iseq_t *iseq)
CRITICAL_SECTION_START(4, "mjit_update_references");
if (iseq->body->jit_unit) {
- iseq->body->jit_unit->iseq = (rb_iseq_t *)rb_gc_new_location((VALUE)iseq->body->jit_unit->iseq);
+ iseq->body->jit_unit->iseq = (rb_iseq_t *)rb_gc_location((VALUE)iseq->body->jit_unit->iseq);
// We need to invalidate JIT-ed code for the ISeq because it embeds pointer addresses.
// To efficiently do that, we use the same thing as TracePoint and thus everything is cancelled for now.
mjit_call_p = false; // TODO: instead of cancelling all, invalidate only this one and recompile it with some threshold.
@@ -131,7 +131,7 @@ mjit_update_references(const rb_iseq_t *iseq)
struct rb_mjit_unit *unit = NULL;
list_for_each(&stale_units.head, unit, unode) {
if (unit->iseq == iseq) {
- unit->iseq = (rb_iseq_t *)rb_gc_new_location((VALUE)unit->iseq);
+ unit->iseq = (rb_iseq_t *)rb_gc_location((VALUE)unit->iseq);
}
}
CRITICAL_SECTION_FINISH(4, "mjit_update_references");
diff --git a/transient_heap.c b/transient_heap.c
index 81cd495..b67469b 100644
--- a/transient_heap.c
+++ b/transient_heap.c
@@ -816,7 +816,7 @@ transient_heap_block_update_refs(struct transient_heap* theap, struct transient_
void *poisoned = __asan_region_is_poisoned((void *)header->obj, SIZEOF_VALUE);
unpoison_object(header->obj, false);
- header->obj = rb_gc_new_location(header->obj);
+ header->obj = rb_gc_location(header->obj);
if (poisoned) {
poison_object(header->obj);
@@ -848,7 +848,7 @@ rb_transient_heap_update_references(void)
for (i=0; i<theap->promoted_objects_index; i++) {
VALUE obj = theap->promoted_objects[i];
- theap->promoted_objects[i] = rb_gc_new_location(obj);
+ theap->promoted_objects[i] = rb_gc_location(obj);
}
}
diff --git a/variable.c b/variable.c
index 482b084..f09637f 100644
--- a/variable.c
+++ b/variable.c
@@ -2030,7 +2030,7 @@ static void
autoload_i_compact(void *ptr)
{
struct autoload_data_i *p = ptr;
- p->feature = rb_gc_new_location(p->feature);
+ p->feature = rb_gc_location(p->feature);
}
static void