337 lines
13 KiB
Diff
337 lines
13 KiB
Diff
--- ruby-3.0.7/gc.rbinc 2024-04-23 12:23:28.000000000 +0200
|
|
+++ ruby/gc.rbinc 2025-02-27 13:20:54.803133890 +0100
|
|
@@ -26,31 +26,6 @@
|
|
}
|
|
|
|
static void
|
|
-mjit_compile_invokebuiltin_for_gc_get_auto_compact(FILE *f, long index, unsigned stack_size, bool inlinable_p)
|
|
-{
|
|
- fprintf(f, " VALUE self = GET_SELF();\n");
|
|
- fprintf(f, " typedef VALUE (*func)(rb_execution_context_t *, VALUE);\n");
|
|
- fprintf(f, " func f = (func)%"PRIdPTR"; /* == gc_get_auto_compact */\n", (intptr_t)gc_get_auto_compact);
|
|
- fprintf(f, " val = f(ec, self);\n");
|
|
-}
|
|
-
|
|
-static void
|
|
-mjit_compile_invokebuiltin_for_gc_set_auto_compact(FILE *f, long index, unsigned stack_size, bool inlinable_p)
|
|
-{
|
|
- fprintf(f, " VALUE self = GET_SELF();\n");
|
|
- fprintf(f, " typedef VALUE (*func)(rb_execution_context_t *, VALUE, VALUE);\n");
|
|
- if (index == -1) {
|
|
- fprintf(f, " const VALUE *argv = &stack[%d];\n", stack_size - 1);
|
|
- }
|
|
- else {
|
|
- fprintf(f, " const unsigned int lnum = GET_ISEQ()->body->local_table_size;\n");
|
|
- fprintf(f, " const VALUE *argv = GET_EP() - lnum - VM_ENV_DATA_SIZE + 1 + %ld;\n", index);
|
|
- }
|
|
- fprintf(f, " func f = (func)%"PRIdPTR"; /* == gc_set_auto_compact */\n", (intptr_t)gc_set_auto_compact);
|
|
- fprintf(f, " val = f(ec, self, argv[0]);\n");
|
|
-}
|
|
-
|
|
-static void
|
|
mjit_compile_invokebuiltin_for_gc_enable(FILE *f, long index, unsigned stack_size, bool inlinable_p)
|
|
{
|
|
fprintf(f, " VALUE self = GET_SELF();\n");
|
|
@@ -134,57 +109,18 @@
|
|
fprintf(f, " val = f(ec, self, argv[0]);\n");
|
|
}
|
|
|
|
-static void
|
|
-mjit_compile_invokebuiltin_for_gc_compact_stats(FILE *f, long index, unsigned stack_size, bool inlinable_p)
|
|
-{
|
|
- fprintf(f, " VALUE self = GET_SELF();\n");
|
|
- fprintf(f, " typedef VALUE (*func)(rb_execution_context_t *, VALUE);\n");
|
|
- fprintf(f, " func f = (func)%"PRIdPTR"; /* == gc_compact_stats */\n", (intptr_t)gc_compact_stats);
|
|
- fprintf(f, " val = f(ec, self);\n");
|
|
-}
|
|
-
|
|
-static void
|
|
-mjit_compile_invokebuiltin_for_gc_compact(FILE *f, long index, unsigned stack_size, bool inlinable_p)
|
|
-{
|
|
- fprintf(f, " VALUE self = GET_SELF();\n");
|
|
- fprintf(f, " typedef VALUE (*func)(rb_execution_context_t *, VALUE);\n");
|
|
- fprintf(f, " func f = (func)%"PRIdPTR"; /* == gc_compact */\n", (intptr_t)gc_compact);
|
|
- fprintf(f, " val = f(ec, self);\n");
|
|
-}
|
|
-
|
|
-static void
|
|
-mjit_compile_invokebuiltin_for_gc_verify_compaction_references(FILE *f, long index, unsigned stack_size, bool inlinable_p)
|
|
-{
|
|
- fprintf(f, " VALUE self = GET_SELF();\n");
|
|
- fprintf(f, " typedef VALUE (*func)(rb_execution_context_t *, VALUE, VALUE, VALUE);\n");
|
|
- if (index == -1) {
|
|
- fprintf(f, " const VALUE *argv = &stack[%d];\n", stack_size - 2);
|
|
- }
|
|
- else {
|
|
- fprintf(f, " const unsigned int lnum = GET_ISEQ()->body->local_table_size;\n");
|
|
- fprintf(f, " const VALUE *argv = GET_EP() - lnum - VM_ENV_DATA_SIZE + 1 + %ld;\n", index);
|
|
- }
|
|
- fprintf(f, " func f = (func)%"PRIdPTR"; /* == gc_verify_compaction_references */\n", (intptr_t)gc_verify_compaction_references);
|
|
- fprintf(f, " val = f(ec, self, argv[0], argv[1]);\n");
|
|
-}
|
|
-
|
|
void Init_builtin_gc(void)
|
|
{
|
|
// table definition
|
|
static const struct rb_builtin_function gc_table[] = {
|
|
RB_BUILTIN_FUNCTION(0, gc_start_internal, gc_start_internal, 4, mjit_compile_invokebuiltin_for_gc_start_internal),
|
|
- RB_BUILTIN_FUNCTION(1, gc_get_auto_compact, gc_get_auto_compact, 0, mjit_compile_invokebuiltin_for_gc_get_auto_compact),
|
|
- RB_BUILTIN_FUNCTION(2, gc_set_auto_compact, gc_set_auto_compact, 1, mjit_compile_invokebuiltin_for_gc_set_auto_compact),
|
|
- RB_BUILTIN_FUNCTION(3, gc_enable, gc_enable, 0, mjit_compile_invokebuiltin_for_gc_enable),
|
|
- RB_BUILTIN_FUNCTION(4, gc_disable, gc_disable, 0, mjit_compile_invokebuiltin_for_gc_disable),
|
|
- RB_BUILTIN_FUNCTION(5, gc_stress_get, gc_stress_get, 0, mjit_compile_invokebuiltin_for_gc_stress_get),
|
|
- RB_BUILTIN_FUNCTION(6, gc_stress_set_m, gc_stress_set_m, 1, mjit_compile_invokebuiltin_for_gc_stress_set_m),
|
|
- RB_BUILTIN_FUNCTION(7, gc_count, gc_count, 0, mjit_compile_invokebuiltin_for_gc_count),
|
|
- RB_BUILTIN_FUNCTION(8, gc_stat, gc_stat, 1, mjit_compile_invokebuiltin_for_gc_stat),
|
|
- RB_BUILTIN_FUNCTION(9, gc_latest_gc_info, gc_latest_gc_info, 1, mjit_compile_invokebuiltin_for_gc_latest_gc_info),
|
|
- RB_BUILTIN_FUNCTION(10, gc_compact_stats, gc_compact_stats, 0, mjit_compile_invokebuiltin_for_gc_compact_stats),
|
|
- RB_BUILTIN_FUNCTION(11, gc_compact, gc_compact, 0, mjit_compile_invokebuiltin_for_gc_compact),
|
|
- RB_BUILTIN_FUNCTION(12, gc_verify_compaction_references, gc_verify_compaction_references, 2, mjit_compile_invokebuiltin_for_gc_verify_compaction_references),
|
|
+ RB_BUILTIN_FUNCTION(1, gc_enable, gc_enable, 0, mjit_compile_invokebuiltin_for_gc_enable),
|
|
+ RB_BUILTIN_FUNCTION(2, gc_disable, gc_disable, 0, mjit_compile_invokebuiltin_for_gc_disable),
|
|
+ RB_BUILTIN_FUNCTION(3, gc_stress_get, gc_stress_get, 0, mjit_compile_invokebuiltin_for_gc_stress_get),
|
|
+ RB_BUILTIN_FUNCTION(4, gc_stress_set_m, gc_stress_set_m, 1, mjit_compile_invokebuiltin_for_gc_stress_set_m),
|
|
+ RB_BUILTIN_FUNCTION(5, gc_count, gc_count, 0, mjit_compile_invokebuiltin_for_gc_count),
|
|
+ RB_BUILTIN_FUNCTION(6, gc_stat, gc_stat, 1, mjit_compile_invokebuiltin_for_gc_stat),
|
|
+ RB_BUILTIN_FUNCTION(7, gc_latest_gc_info, gc_latest_gc_info, 1, mjit_compile_invokebuiltin_for_gc_latest_gc_info),
|
|
RB_BUILTIN_FUNCTION(-1, NULL, NULL, 0, 0),
|
|
};
|
|
|
|
@@ -194,8 +130,6 @@
|
|
COMPILER_WARNING_ERROR(-Wincompatible-pointer-types)
|
|
#endif
|
|
if (0) rb_builtin_function_check_arity4(gc_start_internal);
|
|
- if (0) rb_builtin_function_check_arity0(gc_get_auto_compact);
|
|
- if (0) rb_builtin_function_check_arity1(gc_set_auto_compact);
|
|
if (0) rb_builtin_function_check_arity0(gc_enable);
|
|
if (0) rb_builtin_function_check_arity0(gc_disable);
|
|
if (0) rb_builtin_function_check_arity0(gc_stress_get);
|
|
@@ -203,9 +137,6 @@
|
|
if (0) rb_builtin_function_check_arity0(gc_count);
|
|
if (0) rb_builtin_function_check_arity1(gc_stat);
|
|
if (0) rb_builtin_function_check_arity1(gc_latest_gc_info);
|
|
- if (0) rb_builtin_function_check_arity0(gc_compact_stats);
|
|
- if (0) rb_builtin_function_check_arity0(gc_compact);
|
|
- if (0) rb_builtin_function_check_arity2(gc_verify_compaction_references);
|
|
COMPILER_WARNING_POP
|
|
|
|
// load
|
|
--- ruby-3.0.7/miniprelude.c 2024-04-23 12:23:28.000000000 +0200
|
|
+++ ruby/miniprelude.c 2025-02-27 13:20:54.853135007 +0100
|
|
@@ -320,10 +320,9 @@
|
|
|
|
static const char prelude_name2[] = "<internal:gc>";
|
|
static const struct {
|
|
- char L0[489]; /* 1..58 */
|
|
- char L58[486]; /* 59..182 */
|
|
- char L182[430]; /* 183..235 */
|
|
- char L235[211]; /* 236..242 */
|
|
+ char L0[502]; /* 1..70 */
|
|
+ char L70[435]; /* 71..167 */
|
|
+ char L167[211]; /* 168..174 */
|
|
} prelude_code2 = {
|
|
#line 1 "gc.rb"
|
|
"\n"/* for gc.c */
|
|
@@ -367,29 +366,6 @@
|
|
" end\n"
|
|
"\n"
|
|
"\n"/* call-seq: */
|
|
-"\n"/* GC.auto_compact -> true or false */
|
|
-"\n"/* */
|
|
-"\n"/* Returns whether or not automatic compaction has been enabled. */
|
|
-"\n"/* */
|
|
-" def self.auto_compact\n"
|
|
-" Primitive.gc_get_auto_compact\n"
|
|
-" end\n"
|
|
-"\n"
|
|
-"\n"/* call-seq: */
|
|
-"\n"/* GC.auto_compact = flag */
|
|
-"\n"/* */
|
|
-"\n"/* Updates automatic compaction mode. */
|
|
-"\n"/* */
|
|
-"\n"/* When enabled, the compactor will execute on every major collection. */
|
|
-"\n"/* */
|
|
-"\n"/* Enabling compaction will degrade performance on major collections. */
|
|
-" def self.auto_compact=(flag)\n"
|
|
-,
|
|
-#line 59 "gc.rb"
|
|
-" Primitive.gc_set_auto_compact(flag)\n"
|
|
-" end\n"
|
|
-"\n"
|
|
-"\n"/* call-seq: */
|
|
"\n"/* GC.enable -> true or false */
|
|
"\n"/* */
|
|
"\n"/* Enables garbage collection, returning +true+ if garbage */
|
|
@@ -419,6 +395,8 @@
|
|
"\n"/* GC.stress -> integer, true or false */
|
|
"\n"/* */
|
|
"\n"/* Returns current status of GC stress mode. */
|
|
+,
|
|
+#line 71 "gc.rb"
|
|
" def self.stress\n"
|
|
" Primitive.gc_stress_get\n"
|
|
" end\n"
|
|
@@ -510,70 +488,21 @@
|
|
"\n"/* If the optional argument, hash, is given, */
|
|
"\n"/* it is overwritten and returned. */
|
|
"\n"/* This is intended to avoid probe effect. */
|
|
-,
|
|
-#line 183 "gc.rb"
|
|
" def self.latest_gc_info hash_or_key = nil\n"
|
|
" Primitive.gc_latest_gc_info hash_or_key\n"
|
|
" end\n"
|
|
-"\n"
|
|
-"\n"/* call-seq: */
|
|
-"\n"/* GC.latest_compact_info -> {:considered=>{:T_CLASS=>11}, :moved=>{:T_CLASS=>11}} */
|
|
-"\n"/* */
|
|
-"\n"/* Returns information about object moved in the most recent GC compaction. */
|
|
-"\n"/* */
|
|
-"\n"/* The returned hash has two keys :considered and :moved. The hash for */
|
|
-"\n"/* :considered lists the number of objects that were considered for movement */
|
|
-"\n"/* by the compactor, and the :moved hash lists the number of objects that */
|
|
-"\n"/* were actually moved. Some objects can't be moved (maybe they were pinned) */
|
|
-"\n"/* so these numbers can be used to calculate compaction efficiency. */
|
|
-" def self.latest_compact_info\n"
|
|
-" Primitive.gc_compact_stats\n"
|
|
-" end\n"
|
|
-"\n"
|
|
-"\n"/* call-seq: */
|
|
-"\n"/* GC.compact */
|
|
-"\n"/* */
|
|
-"\n"/* This function compacts objects together in Ruby's heap. It eliminates */
|
|
-"\n"/* unused space (or fragmentation) in the heap by moving objects in to that */
|
|
-"\n"/* unused space. This function returns a hash which contains statistics about */
|
|
-"\n"/* which objects were moved. See `GC.latest_gc_info` for details about */
|
|
-"\n"/* compaction statistics. */
|
|
-"\n"/* */
|
|
-"\n"/* This method is implementation specific and not expected to be implemented */
|
|
-"\n"/* in any implementation besides MRI. */
|
|
-" def self.compact\n"
|
|
-" Primitive.gc_compact\n"
|
|
-" end\n"
|
|
-"\n"
|
|
-"\n"/* call-seq: */
|
|
-"\n"/* GC.verify_compaction_references(toward: nil, double_heap: false) -> hash */
|
|
-"\n"/* */
|
|
-"\n"/* Verify compaction reference consistency. */
|
|
-"\n"/* */
|
|
-"\n"/* This method is implementation specific. During compaction, objects that */
|
|
-"\n"/* were moved are replaced with T_MOVED objects. No object should have a */
|
|
-"\n"/* reference to a T_MOVED object after compaction. */
|
|
-"\n"/* */
|
|
-"\n"/* This function doubles the heap to ensure room to move all objects, */
|
|
-"\n"/* compacts the heap to make sure everything moves, updates all references, */
|
|
-"\n"/* then performs a full GC. If any object contains a reference to a T_MOVED */
|
|
-"\n"/* object, that object should be pushed on the mark stack, and will */
|
|
-"\n"/* make a SEGV. */
|
|
-" def self.verify_compaction_references(toward: nil, double_heap: false)\n"
|
|
-" Primitive.gc_verify_compaction_references(double_heap, toward == :empty)\n"
|
|
-" end\n"
|
|
"end\n"
|
|
"\n"
|
|
"module ObjectSpace\n"
|
|
,
|
|
-#line 236 "gc.rb"
|
|
+#line 168 "gc.rb"
|
|
" def garbage_collect full_mark: true, immediate_mark: true, immediate_sweep: true\n"
|
|
" Primitive.gc_start_internal full_mark, immediate_mark, immediate_sweep, false\n"
|
|
" end\n"
|
|
"\n"
|
|
" module_function :garbage_collect\n"
|
|
"end\n"
|
|
-#line 577 "miniprelude.c"
|
|
+#line 506 "miniprelude.c"
|
|
};
|
|
|
|
static const char prelude_name3[] = "<internal:integer>";
|
|
@@ -734,7 +663,7 @@
|
|
" Primitive.cexpr! 'rb_int_zero_p(self)'\n"
|
|
" end\n"
|
|
"end\n"
|
|
-#line 738 "miniprelude.c"
|
|
+#line 667 "miniprelude.c"
|
|
};
|
|
|
|
static const char prelude_name4[] = "<internal:io>";
|
|
@@ -865,7 +794,7 @@
|
|
" Primitive.io_write_nonblock(buf, exception)\n"
|
|
" end\n"
|
|
"end\n"
|
|
-#line 869 "miniprelude.c"
|
|
+#line 798 "miniprelude.c"
|
|
};
|
|
|
|
static const char prelude_name5[] = "<internal:pack>";
|
|
@@ -1156,7 +1085,7 @@
|
|
" Primitive.pack_unpack1(fmt)\n"
|
|
" end\n"
|
|
"end\n"
|
|
-#line 1160 "miniprelude.c"
|
|
+#line 1089 "miniprelude.c"
|
|
};
|
|
|
|
static const char prelude_name6[] = "<internal:trace_point>";
|
|
@@ -1521,7 +1450,7 @@
|
|
" Primitive.tracepoint_attr_instruction_sequence\n"
|
|
" end\n"
|
|
"end\n"
|
|
-#line 1525 "miniprelude.c"
|
|
+#line 1454 "miniprelude.c"
|
|
};
|
|
|
|
static const char prelude_name7[] = "<internal:warning>";
|
|
@@ -1582,7 +1511,7 @@
|
|
" Primitive.rb_warn_m(msgs, uplevel, category)\n"
|
|
" end\n"
|
|
"end\n"
|
|
-#line 1586 "miniprelude.c"
|
|
+#line 1515 "miniprelude.c"
|
|
};
|
|
|
|
static const char prelude_name8[] = "<internal:array>";
|
|
@@ -1651,7 +1580,7 @@
|
|
" Primitive.rb_ary_sample(random, n, ary)\n"
|
|
" end\n"
|
|
"end\n"
|
|
-#line 1655 "miniprelude.c"
|
|
+#line 1584 "miniprelude.c"
|
|
};
|
|
|
|
static const char prelude_name9[] = "<internal:kernel>";
|
|
@@ -1836,7 +1765,7 @@
|
|
" Primitive.rb_f_float(arg, exception)\n"
|
|
" end\n"
|
|
"end\n"
|
|
-#line 1840 "miniprelude.c"
|
|
+#line 1769 "miniprelude.c"
|
|
};
|
|
|
|
static const char prelude_name10[] = "<internal:ractor>";
|
|
@@ -2703,7 +2632,7 @@
|
|
" }\n"
|
|
" end\n"
|
|
"end\n"
|
|
-#line 2707 "miniprelude.c"
|
|
+#line 2636 "miniprelude.c"
|
|
};
|
|
|
|
static const char prelude_name11[] = "<internal:prelude>";
|
|
@@ -2733,7 +2662,7 @@
|
|
"\n"
|
|
" private :pp\n"
|
|
"end\n"
|
|
-#line 2737 "miniprelude.c"
|
|
+#line 2666 "miniprelude.c"
|
|
};
|
|
|
|
static const char prelude_name12[] = "<internal:gem_prelude>";
|
|
@@ -2752,7 +2681,7 @@
|
|
"rescue LoadError\n"
|
|
" warn \"`did_you_mean' was not loaded.\"\n"
|
|
"end if defined?(DidYouMean)\n"
|
|
-#line 2756 "miniprelude.c"
|
|
+#line 2685 "miniprelude.c"
|
|
};
|
|
|
|
COMPILER_WARNING_POP
|