File tree Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -633,6 +633,7 @@ rb_gc_impl_config_get(void *objspace_ptr)
633
633
VALUE hash = rb_hash_new ();
634
634
635
635
rb_hash_aset (hash , ID2SYM (rb_intern_const ("mmtk_worker_count" )), RB_ULONG2NUM (mmtk_worker_count ()));
636
+ rb_hash_aset (hash , ID2SYM (rb_intern_const ("mmtk_plan" )), rb_str_new_cstr ((const char * )mmtk_plan ()));
636
637
637
638
return hash ;
638
639
}
Original file line number Diff line number Diff line change @@ -147,6 +147,8 @@ MMTk_Address mmtk_last_heap_address(void);
147
147
148
148
size_t mmtk_worker_count (void );
149
149
150
+ const uint8_t * mmtk_plan (void );
151
+
150
152
bool mmtk_is_mmtk_object (MMTk_Address addr );
151
153
152
154
#endif /* MMTK_H */
Original file line number Diff line number Diff line change @@ -333,6 +333,20 @@ pub extern "C" fn mmtk_worker_count() -> usize {
333
333
memory_manager:: num_of_workers ( mmtk ( ) )
334
334
}
335
335
336
+ #[ no_mangle]
337
+ pub extern "C" fn mmtk_plan ( ) -> * const u8 {
338
+ static NO_GC : & [ u8 ] = b"NoGC\0 " ;
339
+ static MARK_SWEEP : & [ u8 ] = b"MarkSweep\0 " ;
340
+ static IMMIX : & [ u8 ] = b"Immix\0 " ;
341
+
342
+ match * crate :: BINDING . get ( ) . unwrap ( ) . mmtk . get_options ( ) . plan {
343
+ PlanSelector :: NoGC => NO_GC . as_ptr ( ) ,
344
+ PlanSelector :: MarkSweep => MARK_SWEEP . as_ptr ( ) ,
345
+ PlanSelector :: Immix => IMMIX . as_ptr ( ) ,
346
+ _ => panic ! ( "Unknown plan" )
347
+ }
348
+ }
349
+
336
350
// =============== Miscellaneous ===============
337
351
338
352
#[ no_mangle]
Original file line number Diff line number Diff line change @@ -12,6 +12,15 @@ def test_MMTK_THREADS
12
12
RUBY
13
13
end
14
14
15
+ # TODO: Add NoGC once this is fixed: https://github.com/mmtk/mmtk-core/pull/1263
16
+ %w( MarkSweep Immix ) . each do |plan |
17
+ define_method ( :"test_MMTK_PLAN_#{ plan } " ) do
18
+ assert_separately ( [ { "MMTK_PLAN" => plan } ] , <<~RUBY )
19
+ assert_equal("#{ plan } ", GC.config[:mmtk_plan])
20
+ RUBY
21
+ end
22
+ end
23
+
15
24
%w( MMTK_THREADS MMTK_HEAP_MIN MMTK_HEAP_MAX MMTK_HEAP_MODE MMTK_PLAN ) . each do |var |
16
25
define_method ( :"test_invalid_#{ var } " ) do
17
26
exit_code = assert_in_out_err (
You can’t perform that action at this time.
0 commit comments