diff --git a/NEWS.md b/NEWS.md index 1b9f87c09b..afcfb374fc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -35,13 +35,6 @@ Note: We're only listing outstanding class updates. The class use equality semantic to lookup keys like a regular hash, but it doesn't hold strong references on the keys. [[Feature #18498]] -* Process.warnup - - * Notify the Ruby virtual machine that the boot sequence is finished, - and that now is a good time to optimize the application. This is useful - for long running applications. The actual optimizations performed are entirely - implementation specific and may change in the future without notice. [[Feature #18885] - ## Stdlib updates The following default gems are updated. diff --git a/common.mk b/common.mk index e186b06d73..b1cf9b05a2 100644 --- a/common.mk +++ b/common.mk @@ -11024,9 +11024,7 @@ process.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h process.$(OBJEXT): {$(VPATH)}thread_native.h process.$(OBJEXT): {$(VPATH)}util.h process.$(OBJEXT): {$(VPATH)}vm_core.h -process.$(OBJEXT): {$(VPATH)}vm_debug.h process.$(OBJEXT): {$(VPATH)}vm_opts.h -process.$(OBJEXT): {$(VPATH)}vm_sync.h ractor.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h ractor.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h ractor.$(OBJEXT): $(CCAN_DIR)/list/list.h diff --git a/gc.c b/gc.c index 4050c47edf..3dc63433a7 100644 --- a/gc.c +++ b/gc.c @@ -9833,26 +9833,6 @@ garbage_collect_with_gvl(rb_objspace_t *objspace, unsigned int reason) } } -static int -gc_promote_object_i(void *vstart, void *vend, size_t stride, void *data) -{ - rb_objspace_t *objspace = &rb_objspace; - VALUE v = (VALUE)vstart; - for (; v != (VALUE)vend; v += stride) { - switch (BUILTIN_TYPE(v)) { - case T_NONE: - case T_ZOMBIE: - break; - default: - if (!RVALUE_OLD_P(v) && !RVALUE_WB_UNPROTECTED(v)) { - RVALUE_AGE_SET_OLD(objspace, v); - } - } - } - - return 0; -} - static VALUE gc_start_internal(rb_execution_context_t *ec, VALUE self, VALUE full_mark, VALUE immediate_mark, VALUE immediate_sweep, VALUE compact) { @@ -9880,33 +9860,6 @@ gc_start_internal(rb_execution_context_t *ec, VALUE self, VALUE full_mark, VALUE return Qnil; } -void -rb_gc_prepare_heap(void) -{ - gc_start_internal(NULL, Qtrue, Qtrue, Qtrue, Qtrue, Qtrue); - - /* Flush any postponed jobs. - * Transient heap uses postponed jobs to mark things, so we need to - * give it a chance to finish what it was doing. */ - rb_postponed_job_flush(GET_VM()); - - /* The transient heap need to be evacuated before we promote objects. - * First put the transient heap in marking mode so that we can - * evacuate everything. Then evacuate everything. Then finish up - * marking mode so that the transient heap is in the right mode - * for the next GC. */ - rb_transient_heap_start_marking(true); - rb_transient_heap_evacuate(); - rb_transient_heap_finish_marking(); - - /* Finally, promote everyone to old gen, but don't let the GC run - * while we iterate over the heap. */ - VALUE gc_disabled = rb_gc_disable_no_rest(); - rb_objspace_each_objects(gc_promote_object_i, NULL); - if (gc_disabled != Qtrue) rb_gc_enable(); - rb_transient_heap_verify(); -} - static int gc_is_moveable_obj(rb_objspace_t *objspace, VALUE obj) { diff --git a/internal/gc.h b/internal/gc.h index e0cc3bfa8a..2b67ca40dc 100644 --- a/internal/gc.h +++ b/internal/gc.h @@ -214,7 +214,6 @@ extern VALUE *ruby_initial_gc_stress_ptr; extern int ruby_disable_gc; RUBY_ATTR_MALLOC void *ruby_mimmalloc(size_t size); void ruby_mimfree(void *ptr); -void rb_gc_prepare_heap(void); void rb_objspace_set_event_hook(const rb_event_flag_t event); VALUE rb_objspace_gc_enable(struct rb_objspace *); VALUE rb_objspace_gc_disable(struct rb_objspace *); diff --git a/process.c b/process.c index 9605036c64..daf3456bfd 100644 --- a/process.c +++ b/process.c @@ -115,7 +115,6 @@ int initgroups(const char *, rb_gid_t); #include "ruby/thread.h" #include "ruby/util.h" #include "vm_core.h" -#include "vm_sync.h" #include "ruby/ractor.h" /* define system APIs */ @@ -8511,37 +8510,6 @@ static VALUE rb_mProcUID; static VALUE rb_mProcGID; static VALUE rb_mProcID_Syscall; -/* - * call-seq: - * Process.warmup -> true - * - * Notify the Ruby virtual machine that the boot sequence is finished, - * and that now is a good time to optimize the application. This is useful - * for long running applications. - * - * This method is expected to be called at the end of the application boot. - * If the application is deployed using a pre-forking model, +Process.warmup+ - * should be called in the original process before the first fork. - * - * The actual optimizations performed are entirely implementation specific - * and may change in the future without notice. - * - * On CRuby, +Process.warmup+: - * - * * Perform a major GC. - * * Compacts the heap. - * * Promotes all surviving objects to the old generation. - */ - -static VALUE -proc_warmup(VALUE _) -{ - RB_VM_LOCK_ENTER(); - rb_gc_prepare_heap(); - RB_VM_LOCK_LEAVE(); - return Qtrue; -} - /* * Document-module: Process @@ -8659,8 +8627,6 @@ InitVM_process(void) rb_define_module_function(rb_mProcess, "getpriority", proc_getpriority, 2); rb_define_module_function(rb_mProcess, "setpriority", proc_setpriority, 3); - rb_define_module_function(rb_mProcess, "warmup", proc_warmup, 0); - #ifdef HAVE_GETPRIORITY /* see Process.setpriority */ rb_define_const(rb_mProcess, "PRIO_PROCESS", INT2FIX(PRIO_PROCESS)); diff --git a/spec/ruby/core/process/warmup_spec.rb b/spec/ruby/core/process/warmup_spec.rb deleted file mode 100644 index fbdfd34848..0000000000 --- a/spec/ruby/core/process/warmup_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require_relative '../../spec_helper' - -describe "Process.warmup" do - ruby_version_is "3.3" do - # The behavior is entirely implementation dependant. - # Other implementations are free to just make it a noop - it "is implemented" do - Process.warmup.should == true - end - end -end diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index fa25d10353..6e8050a54a 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -4,7 +4,6 @@ require 'test/unit' require 'tempfile' require 'timeout' require 'rbconfig' -require 'objspace' class TestProcess < Test::Unit::TestCase RUBY = EnvUtil.rubybin @@ -2680,11 +2679,4 @@ EOS end end; end if Process.respond_to?(:_fork) - - def test_warmup_promote_all_objects_to_oldgen - obj = Object.new - refute_includes(ObjectSpace.dump(obj), '"old":true') - Process.warmup - assert_includes(ObjectSpace.dump(obj), '"old":true') - end end