File tree Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -637,6 +637,7 @@ rb_gc_impl_config_get(void *objspace_ptr)
637
637
rb_hash_aset (hash , ID2SYM (rb_intern_const ("mmtk_heap_mode" )), rb_str_new_cstr ((const char * )mmtk_heap_mode ()));
638
638
size_t heap_min = mmtk_heap_min ();
639
639
if (heap_min > 0 ) rb_hash_aset (hash , ID2SYM (rb_intern_const ("mmtk_heap_min" )), RB_ULONG2NUM (heap_min ));
640
+ rb_hash_aset (hash , ID2SYM (rb_intern_const ("mmtk_heap_max" )), RB_ULONG2NUM (mmtk_heap_max ()));
640
641
641
642
return hash ;
642
643
}
Original file line number Diff line number Diff line change @@ -153,6 +153,8 @@ const uint8_t *mmtk_heap_mode(void);
153
153
154
154
size_t mmtk_heap_min (void );
155
155
156
+ size_t mmtk_heap_max (void );
157
+
156
158
bool mmtk_is_mmtk_object (MMTk_Address addr );
157
159
158
160
#endif /* MMTK_H */
Original file line number Diff line number Diff line change @@ -368,6 +368,15 @@ pub extern "C" fn mmtk_heap_min() -> usize {
368
368
}
369
369
}
370
370
371
+ #[ no_mangle]
372
+ pub extern "C" fn mmtk_heap_max ( ) -> usize {
373
+ match * crate :: BINDING . get ( ) . unwrap ( ) . mmtk . get_options ( ) . gc_trigger {
374
+ GCTriggerSelector :: FixedHeapSize ( max_size) => max_size,
375
+ GCTriggerSelector :: DynamicHeapSize ( _, max_size) => max_size,
376
+ _ => panic ! ( "Unknown heap mode" )
377
+ }
378
+ }
379
+
371
380
// =============== Miscellaneous ===============
372
381
373
382
#[ no_mangle]
Original file line number Diff line number Diff line change @@ -39,6 +39,12 @@ def test_MMTK_HEAP_MIN
39
39
RUBY
40
40
end
41
41
42
+ def test_MMTK_HEAP_MAX
43
+ assert_separately ( [ { "MMTK_HEAP_MODE" => "fixed" , "MMTK_HEAP_MAX" => "100MiB" } ] , <<~RUBY )
44
+ assert_equal(100 * 1024 * 1024, GC.config[:mmtk_heap_max])
45
+ RUBY
46
+ end
47
+
42
48
%w( MMTK_THREADS MMTK_HEAP_MIN MMTK_HEAP_MAX MMTK_HEAP_MODE MMTK_PLAN ) . each do |var |
43
49
define_method ( :"test_invalid_#{ var } " ) do
44
50
exit_code = assert_in_out_err (
You can’t perform that action at this time.
0 commit comments