Created
September 27, 2019 12:29
-
-
Save kares/7a15f344485042c6e27a7ae4e5d33cc1 to your computer and use it in GitHub Desktop.
Revisions
-
kares revised this gist
Sep 27, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ def self.start_thread return unless JIT_MAX > 0 Thread.start do loop { sleep 90; new.check_and_force_jit_max } end end -
kares created this gist
Sep 27, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ # force -Xjit.max setting on JRuby <= 9.2.8 # # forcing is not perfect - # counter for existing methods will still keep incrementing but compilation is expected to halt # # @note -Xjit.max has no effect on JRuby 9K - its only enforced since 9.2.9 # (Class.new do JIT_MAX = ENV_JAVA['jruby.jit.max'].to_i if JRUBY_VERSION >= '9.2.9' fail "-Xjit.max enforcing no longer necessary on JRuby #{JRUBY_VERSION}, remove #{__FILE__}" end def self.start_thread return unless JIT_MAX > 0 Thread.start do loop { sleep 9.0; new.check_and_force_jit_max } end end def check_and_force_jit_max success_count = mbean_server.getAttribute jit_compiler_mbean_name, 'SuccessCount' if success_count > JIT_MAX org.jruby.util.cli.Options::JIT_THRESHOLD.force '1000000000' warn "halting JRuby JIT by forcing JIT_THRESHOLD to #{org.jruby.util.cli.Options::JIT_THRESHOLD.load}" raise StopIteration end end def jit_compiler_mbean_name name = javax.management.ObjectName.getInstance("org.jruby:*,service=JITCompiler") mbean_server.queryNames(name, nil).first end def mbean_server java.lang.management.ManagementFactory.getPlatformMBeanServer end end.start_thread) if defined?(JRUBY_VERSION)