[前][次][番号順一覧][スレッド一覧]

ruby-changes:55753

From: Aaron <ko1@a...>
Date: Sat, 18 May 2019 18:25:04 +0900 (JST)
Subject: [ruby-changes:55753] Aaron Patterson: 154a67f140 (trunk): Rename rb_gc_new_location to rb_gc_location

https://git.ruby-lang.org/ruby.git/commit/?id=154a67f140

From 154a67f140a8397df77d82cdc80e13b291b8aedd Mon Sep 17 00:00:00 2001
From: Aaron Patterson <tenderlove@r...>
Date: Sat, 18 May 2019 12:23:47 +0300
Subject: 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.

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) https://github.com/ruby/ruby/blob/trunk/gc.c#L7625
     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) https://github.com/ruby/ruby/blob/trunk/gc.c#L7789
 /* 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) https://github.com/ruby/ruby/blob/trunk/gc.c#L7825
     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) https://github.com/ruby/ruby/blob/trunk/gc.c#L7846
     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) https://github.com/ruby/ruby/blob/trunk/gc.c#L8096
     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 https://github.com/ruby/ruby/blob/trunk/gc.c#L8157
 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) https://github.com/ruby/ruby/blob/trunk/gc.c#L8166
 {
     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) https://github.com/ruby/ruby/blob/trunk/gc.c#L11126
 	    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); https://github.com/ruby/ruby/blob/trunk/include/ruby/intern.h#L515
 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) https://github.com/ruby/ruby/blob/trunk/iseq.c#L214
 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) https://github.com/ruby/ruby/blob/trunk/iseq.c#L223
     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) https://github.com/ruby/ruby/blob/trunk/iseq.c#L246
             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) https://github.com/ruby/ruby/blob/trunk/iseq.c#L258
                 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) https://github.com/ruby/ruby/blob/trunk/mjit.c#L119
 
     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) https://github.com/ruby/ruby/blob/trunk/mjit.c#L131
     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_ https://github.com/ruby/ruby/blob/trunk/transient_heap.c#L816
         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) https://github.com/ruby/ruby/blob/trunk/transient_heap.c#L848
 
     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);
   (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]