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

ruby-changes:63535

From: Alan <ko1@a...>
Date: Sat, 7 Nov 2020 02:55:54 +0900 (JST)
Subject: [ruby-changes:63535] f234f2740d (master): Add docs for some C extension GC APIs

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

From f234f2740dc060ab565899f726101ebf79f5c71e Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Wed, 4 Nov 2020 11:24:38 -0500
Subject: Add docs for some C extension GC APIs


diff --git a/include/ruby/internal/gc.h b/include/ruby/internal/gc.h
index 7f335ca..69ff619 100644
--- a/include/ruby/internal/gc.h
+++ b/include/ruby/internal/gc.h
@@ -25,10 +25,34 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/gc.h#L25
 
 RBIMPL_SYMBOL_EXPORT_BEGIN()
 
-void rb_global_variable(VALUE*);
-void rb_gc_register_mark_object(VALUE);
-void rb_gc_register_address(VALUE*);
-void rb_gc_unregister_address(VALUE*);
+/**
+ * Inform the garbage collector that `valptr` points to a live Ruby object that
+ * should not be moved. Note that extensions should use this API on global
+ * constants instead of assuming constants defined in Ruby are always alive.
+ * Ruby code can remove global constants.
+ */
+void rb_gc_register_address(VALUE *valptr);
+
+/**
+ * An alias for `rb_gc_register_address()`.
+ */
+void rb_global_variable(VALUE *);
+
+/**
+ * Inform the garbage collector that a pointer previously passed to
+ * `rb_gc_register_address()` no longer points to a live Ruby object.
+ */
+void rb_gc_unregister_address(VALUE *valptr);
+
+/**
+ * Inform the garbage collector that `object` is a live Ruby object. Note that
+ * the garbage collector is free to move `object` and so it is not correct to
+ * save `object` into a C global constant and assume that it will always refer
+ * to the same Ruby object.
+ *
+ * See also: rb_gc_register_address()
+ */
+void rb_gc_register_mark_object(VALUE object);
 
 RBIMPL_SYMBOL_EXPORT_END()
 
-- 
cgit v0.10.2


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

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