File tree Expand file tree Collapse file tree 4 files changed +23
-3
lines changed Expand file tree Collapse file tree 4 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -630,8 +630,11 @@ rb_gc_impl_stress_get(void *objspace_ptr)
630
630
VALUE
631
631
rb_gc_impl_config_get (void * objspace_ptr )
632
632
{
633
- // TODO
634
- return rb_hash_new ();
633
+ VALUE hash = rb_hash_new ();
634
+
635
+ rb_hash_aset (hash , ID2SYM (rb_intern_const ("mmtk_worker_count" )), RB_ULONG2NUM (mmtk_worker_count ()));
636
+
637
+ return hash ;
635
638
}
636
639
637
640
void
Original file line number Diff line number Diff line change @@ -145,6 +145,8 @@ MMTk_Address mmtk_starting_heap_address(void);
145
145
146
146
MMTk_Address mmtk_last_heap_address (void );
147
147
148
+ size_t mmtk_worker_count (void );
149
+
148
150
bool mmtk_is_mmtk_object (MMTk_Address addr );
149
151
150
- #endif /* MMTK_H */
152
+ #endif /* MMTK_H */
Original file line number Diff line number Diff line change @@ -328,6 +328,11 @@ pub extern "C" fn mmtk_last_heap_address() -> Address {
328
328
memory_manager:: last_heap_address ( )
329
329
}
330
330
331
+ #[ no_mangle]
332
+ pub extern "C" fn mmtk_worker_count ( ) -> usize {
333
+ memory_manager:: num_of_workers ( mmtk ( ) )
334
+ }
335
+
331
336
// =============== Miscellaneous ===============
332
337
333
338
#[ no_mangle]
Original file line number Diff line number Diff line change 2
2
require_relative "helper"
3
3
module MMTk
4
4
class TestConfiguration < TestCase
5
+ def test_MMTK_THREADS
6
+ assert_separately ( [ { "MMTK_THREADS" => "5" } ] , <<~RUBY )
7
+ assert_equal(5, GC.config[:mmtk_worker_count])
8
+ RUBY
9
+
10
+ assert_separately ( [ { "MMTK_THREADS" => "1" } ] , <<~RUBY )
11
+ assert_equal(1, GC.config[:mmtk_worker_count])
12
+ RUBY
13
+ end
14
+
5
15
%w( MMTK_THREADS MMTK_HEAP_MIN MMTK_HEAP_MAX MMTK_HEAP_MODE MMTK_PLAN ) . each do |var |
6
16
define_method ( :"test_invalid_#{ var } " ) do
7
17
exit_code = assert_in_out_err (
You can’t perform that action at this time.
0 commit comments