@@ -84,6 +84,7 @@ def __init__(self):
84
84
def apply (self , config ):
85
85
vmArgs , mainClass , mainClassArgs = config
86
86
mx_truffle .enable_truffle_native_access (vmArgs )
87
+ mx_truffle .enable_sun_misc_unsafe (vmArgs )
87
88
return (vmArgs , mainClass , mainClassArgs )
88
89
89
90
mx_unittest .register_unittest_config (TruffleRubyUnittestConfig ())
@@ -153,6 +154,7 @@ def contents(self, result):
153
154
classpath_deps = [dep for dep in self .subject .buildDependencies if isinstance (dep , mx .ClasspathDependency )]
154
155
jvm_args = [shlex .quote (arg ) for arg in mx .get_runtime_jvm_args (classpath_deps )]
155
156
mx_truffle .enable_truffle_native_access (jvm_args )
157
+ mx_truffle .enable_sun_misc_unsafe (jvm_args )
156
158
157
159
debug_args = mx .java_debug_args ()
158
160
jvm_args .extend (debug_args )
@@ -219,6 +221,7 @@ def ruby_check_heap_dump(input_args, out=None):
219
221
vm_args , truffleruby_args = mx .extract_VM_args (args , useDoubleDash = True , defaultAllVMArgs = False )
220
222
vm_args += mx .get_runtime_jvm_args (dists )
221
223
mx_truffle .enable_truffle_native_access (vm_args )
224
+ mx_truffle .enable_sun_misc_unsafe (vm_args )
222
225
# vm_args.append("-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=y")
223
226
vm_args .append ("org.truffleruby.test.internal.LeakTest" )
224
227
out = mx .OutputCapture () if out is None else out
@@ -251,6 +254,19 @@ def ruby_run_ruby(args):
251
254
ruby = join (standalone_home , 'bin/ruby' )
252
255
os .execlp (ruby , ruby , * args )
253
256
257
+ def ruby_run_ruby_from_classpath (args ):
258
+ """run TruffleRuby from the classpath"""
259
+ dists = ['RUBY_COMMUNITY' , 'TRUFFLERUBY-LAUNCHER' ]
260
+ if '--skip-build' in args :
261
+ args .remove ('--skip-build' )
262
+ else :
263
+ mx .command_function ('build' )(['--dependencies' , ',' .join (dists )])
264
+ classpath = mx .classpath (dists )
265
+ jvm_args = ['-cp' , classpath ]
266
+ mx_truffle .enable_truffle_native_access (jvm_args )
267
+ mx_truffle .enable_sun_misc_unsafe (jvm_args )
268
+ mx .run_java ([* jvm_args , 'org.truffleruby.launcher.RubyLauncher' , * args ], jdk = jdk , nonZeroIsFatal = True )
269
+
254
270
def ruby_run_specs (ruby , args ):
255
271
with VerboseMx ():
256
272
jt ('--use' , ruby , 'test' , 'specs' , * args )
@@ -375,6 +391,7 @@ def ruby_maven_deploy_public_repo_dir(args):
375
391
376
392
mx .update_commands (_suite , {
377
393
'ruby' : [ruby_run_ruby , '' ],
394
+ 'ruby_from_classpath' : [ruby_run_ruby_from_classpath , '' ],
378
395
'build_truffleruby' : [build_truffleruby , '' ],
379
396
'ruby_check_heap_dump' : [ruby_check_heap_dump , '' ],
380
397
'ruby_testdownstream_aot' : [ruby_testdownstream_aot , 'aot_bin' ],
0 commit comments