File tree Expand file tree Collapse file tree 4 files changed +23
-0
lines changed Expand file tree Collapse file tree 4 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -634,6 +634,7 @@ rb_gc_impl_config_get(void *objspace_ptr)
634
634
635
635
rb_hash_aset (hash , ID2SYM (rb_intern_const ("mmtk_worker_count" )), RB_ULONG2NUM (mmtk_worker_count ()));
636
636
rb_hash_aset (hash , ID2SYM (rb_intern_const ("mmtk_plan" )), rb_str_new_cstr ((const char * )mmtk_plan ()));
637
+ rb_hash_aset (hash , ID2SYM (rb_intern_const ("mmtk_heap_mode" )), rb_str_new_cstr ((const char * )mmtk_heap_mode ()));
637
638
638
639
return hash ;
639
640
}
Original file line number Diff line number Diff line change @@ -149,6 +149,8 @@ size_t mmtk_worker_count(void);
149
149
150
150
const uint8_t * mmtk_plan (void );
151
151
152
+ const uint8_t * mmtk_heap_mode (void );
153
+
152
154
bool mmtk_is_mmtk_object (MMTk_Address addr );
153
155
154
156
#endif /* MMTK_H */
Original file line number Diff line number Diff line change @@ -347,6 +347,18 @@ pub extern "C" fn mmtk_plan() -> *const u8 {
347
347
}
348
348
}
349
349
350
+ #[ no_mangle]
351
+ pub extern "C" fn mmtk_heap_mode ( ) -> * const u8 {
352
+ static FIXED_HEAP : & [ u8 ] = b"fixed\0 " ;
353
+ static DYNAMIC_HEAP : & [ u8 ] = b"dynamic\0 " ;
354
+
355
+ match * crate :: BINDING . get ( ) . unwrap ( ) . mmtk . get_options ( ) . gc_trigger {
356
+ GCTriggerSelector :: FixedHeapSize ( _) => FIXED_HEAP . as_ptr ( ) ,
357
+ GCTriggerSelector :: DynamicHeapSize ( _, _) => DYNAMIC_HEAP . as_ptr ( ) ,
358
+ _ => panic ! ( "Unknown heap mode" )
359
+ }
360
+ }
361
+
350
362
// =============== Miscellaneous ===============
351
363
352
364
#[ no_mangle]
Original file line number Diff line number Diff line change @@ -21,6 +21,14 @@ def test_MMTK_THREADS
21
21
end
22
22
end
23
23
24
+ %w( fixed dynamic ) . each do |heap |
25
+ define_method ( :"test_MMTK_HEAP_MODE_#{ heap } " ) do
26
+ assert_separately ( [ { "MMTK_HEAP_MODE" => heap } ] , <<~RUBY )
27
+ assert_equal("#{ heap } ", GC.config[:mmtk_heap_mode])
28
+ RUBY
29
+ end
30
+ end
31
+
24
32
%w( MMTK_THREADS MMTK_HEAP_MIN MMTK_HEAP_MAX MMTK_HEAP_MODE MMTK_PLAN ) . each do |var |
25
33
define_method ( :"test_invalid_#{ var } " ) do
26
34
exit_code = assert_in_out_err (
You can’t perform that action at this time.
0 commit comments