2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/jruby/startup/appcds.rb', line 2
def self.regenerate_archive(argv)
java_version = ENV_JAVA['java.specification.version']
if java_version < '11'
puts "*** Warning: this feature is only supported on Java 11 or higher"
end
if JRUBY_VERSION < '9.2.1.0'
puts "*** JRuby 9.2.1 or higher recommended"
end
command_line = argv[0] || "-e 1"
jruby_home = ENV_JAVA['jruby.home']
jruby_bin = File.join(jruby_home, 'bin')
jruby_lib = File.join(jruby_home, 'lib')
jruby_exe = File.join(jruby_bin, 'jruby')
jruby_list = File.join(jruby_lib, 'jruby.list')
jruby_jsa = File.join(jruby_lib, 'jruby.jsa')
ENV['VERIFY_JRUBY'] = '1'
puts "*** Outputting list of classes at #{jruby_list}\n\n"
fail unless system "VERIFY_JRUBY=1 JAVA_OPTS='-XX:DumpLoadedClassList=#{jruby_list}' #{jruby_exe} #{command_line}"
puts "\n*** Generating shared AppCDS archive at #{jruby_jsa}\n\n"
fail unless system "VERIFY_JRUBY=1 JAVA_OPTS='-Xshare:dump -XX:G1HeapRegionSize=2m -XX:+UnlockDiagnosticVMOptions -XX:SharedClassListFile=#{jruby_list} -XX:SharedArchiveFile=#{jruby_jsa}' #{jruby_exe} #{command_line}"
puts "\n *** Success!\n \n JRuby versions 9.2.1 or higher should detect \#{jruby_jsa} and use it automatically.\n For versions of JRuby 9.2 or earlier, set the following environment variables:\n\n VERIFY_JRUBY=1\n JAVA_OPTS=\"-XX:G1HeapRegionSize=2m -XX:SharedArchiveFile=\#{jruby_jsa}\"\n END\nend\n"
|