diff --git a/.github/scripts/ci-test-other.sh b/.github/scripts/ci-test-other.sh index 1d7c316..d83d1ee 100755 --- a/.github/scripts/ci-test-other.sh +++ b/.github/scripts/ci-test-other.sh @@ -23,9 +23,7 @@ declare -a max_moving_tests_to_skip=( "cmdlineargs" "Downloads" "read" - "threads" "LibCURL" - "rounding" "loading" "misc" ) @@ -63,8 +61,24 @@ if [[ $CHOOSE_TESTS_JL_CONTENT =~ $REGEX_PATTERN ]]; then continue fi + if [[ $test =~ "rounding" ]]; then + # Run rounding test with single thread and Julia's + # heap resizing (it OOMs with a fixed heap) + echo "-> Run" + ci_run_jl_test $test 1 $moving_feature + continue + fi + + if [[ $test =~ "ranges" ]]; then + # Run ranges test with single thread and Julia's + # heap resizing (it OOMs with a fixed heap) + echo "-> Run" + ci_run_jl_test $test 1 $moving_feature + continue + fi + echo "-> Run" - ci_run_jl_test $test 1 $moving_feature + ci_run_jl_test $test 2 $moving_feature fi done else diff --git a/mmtk/src/julia_types.rs b/mmtk/src/julia_types.rs index 0f1caf8..0feef01 100644 --- a/mmtk/src/julia_types.rs +++ b/mmtk/src/julia_types.rs @@ -418,23 +418,26 @@ const _: () = { pub struct jl_thread_heap_common_t { pub weak_refs: small_arraylist_t, pub live_tasks: small_arraylist_t, + pub all_tasks: small_arraylist_t, pub mallocarrays: small_arraylist_t, pub free_stacks: [small_arraylist_t; 16usize], } #[allow(clippy::unnecessary_operation, clippy::identity_op)] const _: () = { ["Size of jl_thread_heap_common_t"] - [::std::mem::size_of::() - 1216usize]; + [::std::mem::size_of::() - 1280usize]; ["Alignment of jl_thread_heap_common_t"] [::std::mem::align_of::() - 8usize]; ["Offset of field: jl_thread_heap_common_t::weak_refs"] [::std::mem::offset_of!(jl_thread_heap_common_t, weak_refs) - 0usize]; ["Offset of field: jl_thread_heap_common_t::live_tasks"] [::std::mem::offset_of!(jl_thread_heap_common_t, live_tasks) - 64usize]; + ["Offset of field: jl_thread_heap_common_t::all_tasks"] + [::std::mem::offset_of!(jl_thread_heap_common_t, all_tasks) - 128usize]; ["Offset of field: jl_thread_heap_common_t::mallocarrays"] - [::std::mem::offset_of!(jl_thread_heap_common_t, mallocarrays) - 128usize]; + [::std::mem::offset_of!(jl_thread_heap_common_t, mallocarrays) - 192usize]; ["Offset of field: jl_thread_heap_common_t::free_stacks"] - [::std::mem::offset_of!(jl_thread_heap_common_t, free_stacks) - 192usize]; + [::std::mem::offset_of!(jl_thread_heap_common_t, free_stacks) - 256usize]; }; #[repr(C)] #[derive(Debug)] @@ -480,13 +483,13 @@ pub struct jl_gc_tls_states_common_t { #[allow(clippy::unnecessary_operation, clippy::identity_op)] const _: () = { ["Size of jl_gc_tls_states_common_t"] - [::std::mem::size_of::() - 1280usize]; + [::std::mem::size_of::() - 1344usize]; ["Alignment of jl_gc_tls_states_common_t"] [::std::mem::align_of::() - 8usize]; ["Offset of field: jl_gc_tls_states_common_t::heap"] [::std::mem::offset_of!(jl_gc_tls_states_common_t, heap) - 0usize]; ["Offset of field: jl_gc_tls_states_common_t::gc_num"] - [::std::mem::offset_of!(jl_gc_tls_states_common_t, gc_num) - 1216usize]; + [::std::mem::offset_of!(jl_gc_tls_states_common_t, gc_num) - 1280usize]; }; #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -675,7 +678,7 @@ pub struct _jl_tls_states_t { } #[allow(clippy::unnecessary_operation, clippy::identity_op)] const _: () = { - ["Size of _jl_tls_states_t"][::std::mem::size_of::<_jl_tls_states_t>() - 3616usize]; + ["Size of _jl_tls_states_t"][::std::mem::size_of::<_jl_tls_states_t>() - 3680usize]; ["Alignment of _jl_tls_states_t"][::std::mem::align_of::<_jl_tls_states_t>() - 8usize]; ["Offset of field: _jl_tls_states_t::tid"] [::std::mem::offset_of!(_jl_tls_states_t, tid) - 0usize]; @@ -702,51 +705,51 @@ const _: () = { ["Offset of field: _jl_tls_states_t::gc_tls_common"] [::std::mem::offset_of!(_jl_tls_states_t, gc_tls_common) - 1800usize]; ["Offset of field: _jl_tls_states_t::lazily_freed_mtarraylist_buffers"] - [::std::mem::offset_of!(_jl_tls_states_t, lazily_freed_mtarraylist_buffers) - 3080usize]; + [::std::mem::offset_of!(_jl_tls_states_t, lazily_freed_mtarraylist_buffers) - 3144usize]; ["Offset of field: _jl_tls_states_t::defer_signal"] - [::std::mem::offset_of!(_jl_tls_states_t, defer_signal) - 3144usize]; + [::std::mem::offset_of!(_jl_tls_states_t, defer_signal) - 3208usize]; ["Offset of field: _jl_tls_states_t::current_task"] - [::std::mem::offset_of!(_jl_tls_states_t, current_task) - 3152usize]; + [::std::mem::offset_of!(_jl_tls_states_t, current_task) - 3216usize]; ["Offset of field: _jl_tls_states_t::next_task"] - [::std::mem::offset_of!(_jl_tls_states_t, next_task) - 3160usize]; + [::std::mem::offset_of!(_jl_tls_states_t, next_task) - 3224usize]; ["Offset of field: _jl_tls_states_t::previous_task"] - [::std::mem::offset_of!(_jl_tls_states_t, previous_task) - 3168usize]; + [::std::mem::offset_of!(_jl_tls_states_t, previous_task) - 3232usize]; ["Offset of field: _jl_tls_states_t::root_task"] - [::std::mem::offset_of!(_jl_tls_states_t, root_task) - 3176usize]; + [::std::mem::offset_of!(_jl_tls_states_t, root_task) - 3240usize]; ["Offset of field: _jl_tls_states_t::timing_stack"] - [::std::mem::offset_of!(_jl_tls_states_t, timing_stack) - 3184usize]; + [::std::mem::offset_of!(_jl_tls_states_t, timing_stack) - 3248usize]; ["Offset of field: _jl_tls_states_t::stackbase"] - [::std::mem::offset_of!(_jl_tls_states_t, stackbase) - 3192usize]; + [::std::mem::offset_of!(_jl_tls_states_t, stackbase) - 3256usize]; ["Offset of field: _jl_tls_states_t::stacksize"] - [::std::mem::offset_of!(_jl_tls_states_t, stacksize) - 3200usize]; + [::std::mem::offset_of!(_jl_tls_states_t, stacksize) - 3264usize]; ["Offset of field: _jl_tls_states_t::sig_exception"] - [::std::mem::offset_of!(_jl_tls_states_t, sig_exception) - 3208usize]; + [::std::mem::offset_of!(_jl_tls_states_t, sig_exception) - 3272usize]; ["Offset of field: _jl_tls_states_t::bt_data"] - [::std::mem::offset_of!(_jl_tls_states_t, bt_data) - 3216usize]; + [::std::mem::offset_of!(_jl_tls_states_t, bt_data) - 3280usize]; ["Offset of field: _jl_tls_states_t::bt_size"] - [::std::mem::offset_of!(_jl_tls_states_t, bt_size) - 3224usize]; + [::std::mem::offset_of!(_jl_tls_states_t, bt_size) - 3288usize]; ["Offset of field: _jl_tls_states_t::profiling_bt_buffer"] - [::std::mem::offset_of!(_jl_tls_states_t, profiling_bt_buffer) - 3232usize]; + [::std::mem::offset_of!(_jl_tls_states_t, profiling_bt_buffer) - 3296usize]; ["Offset of field: _jl_tls_states_t::signal_request"] - [::std::mem::offset_of!(_jl_tls_states_t, signal_request) - 3240usize]; + [::std::mem::offset_of!(_jl_tls_states_t, signal_request) - 3304usize]; ["Offset of field: _jl_tls_states_t::io_wait"] - [::std::mem::offset_of!(_jl_tls_states_t, io_wait) - 3244usize]; + [::std::mem::offset_of!(_jl_tls_states_t, io_wait) - 3308usize]; ["Offset of field: _jl_tls_states_t::signal_stack"] - [::std::mem::offset_of!(_jl_tls_states_t, signal_stack) - 3248usize]; + [::std::mem::offset_of!(_jl_tls_states_t, signal_stack) - 3312usize]; ["Offset of field: _jl_tls_states_t::signal_stack_size"] - [::std::mem::offset_of!(_jl_tls_states_t, signal_stack_size) - 3256usize]; + [::std::mem::offset_of!(_jl_tls_states_t, signal_stack_size) - 3320usize]; ["Offset of field: _jl_tls_states_t::system_id"] - [::std::mem::offset_of!(_jl_tls_states_t, system_id) - 3264usize]; + [::std::mem::offset_of!(_jl_tls_states_t, system_id) - 3328usize]; ["Offset of field: _jl_tls_states_t::suspend_count"] - [::std::mem::offset_of!(_jl_tls_states_t, suspend_count) - 3272usize]; + [::std::mem::offset_of!(_jl_tls_states_t, suspend_count) - 3336usize]; ["Offset of field: _jl_tls_states_t::finalizers"] - [::std::mem::offset_of!(_jl_tls_states_t, finalizers) - 3280usize]; + [::std::mem::offset_of!(_jl_tls_states_t, finalizers) - 3344usize]; ["Offset of field: _jl_tls_states_t::previous_exception"] - [::std::mem::offset_of!(_jl_tls_states_t, previous_exception) - 3536usize]; + [::std::mem::offset_of!(_jl_tls_states_t, previous_exception) - 3600usize]; ["Offset of field: _jl_tls_states_t::locks"] - [::std::mem::offset_of!(_jl_tls_states_t, locks) - 3544usize]; + [::std::mem::offset_of!(_jl_tls_states_t, locks) - 3608usize]; ["Offset of field: _jl_tls_states_t::engine_nqueued"] - [::std::mem::offset_of!(_jl_tls_states_t, engine_nqueued) - 3608usize]; + [::std::mem::offset_of!(_jl_tls_states_t, engine_nqueued) - 3672usize]; }; pub type jl_function_t = jl_value_t; pub type jl_timing_block_t = _jl_timing_block_t; @@ -3520,10 +3523,3 @@ const _: () = { ["Align of template specialization: pinned_ref_open0_jl_value_t_close0"] [::std::mem::align_of::>() - 8usize]; }; -#[allow(clippy::unnecessary_operation, clippy::identity_op)] -const _: () = { - ["Size of template specialization: pinned_ref_open0_jl_value_t_close0"] - [::std::mem::size_of::>() - 8usize]; - ["Align of template specialization: pinned_ref_open0_jl_value_t_close0"] - [::std::mem::align_of::>() - 8usize]; -}; diff --git a/mmtk/src/scanning.rs b/mmtk/src/scanning.rs index a7e3deb..6491153 100644 --- a/mmtk/src/scanning.rs +++ b/mmtk/src/scanning.rs @@ -62,7 +62,10 @@ impl Scanning for VMScanning { crate::conservative::mmtk_conservative_scan_ptls_registers(ptls); // Scan thread local from ptls: See gc_queue_thread_local in gc.c - let mut root_scan_task = |task: *const _jl_task_t, task_is_root: bool| { + + // scan task object to conservatively pin references from shadow, + // gc_preserve and regular stack and registers + let mut scan_root_task = |task: *const _jl_task_t| { if !task.is_null() { // Scan gc preserve and shadow stacks unsafe { @@ -92,40 +95,41 @@ impl Scanning for VMScanning { crate::conservative::mmtk_conservative_scan_task_registers(task); } // } + }; + }; - if task_is_root { - // captures wrong root nodes before creating the work - debug_assert!( - Address::from_ptr(task).as_usize() % 16 == 0 - || Address::from_ptr(task).as_usize() % 8 == 0, - "root node {:?} is not aligned to 8 or 16", - Address::from_ptr(task) - ); + // adding task object as root + let mut add_task_as_root = |task: *const _jl_task_t| { + if !task.is_null() { + // captures wrong root nodes before creating the work + debug_assert!( + Address::from_ptr(task).as_usize() % 16 == 0 + || Address::from_ptr(task).as_usize() % 8 == 0, + "root node {:?} is not aligned to 8 or 16", + Address::from_ptr(task) + ); - // unsafe: We checked `!task.is_null()` before. - let objref = unsafe { - ObjectReference::from_raw_address_unchecked(Address::from_ptr(task)) - }; - node_buffer.push(objref); - } + let objref = + unsafe { ObjectReference::from_raw_address_unchecked(Address::from_ptr(task)) }; + node_buffer.push(objref); } }; - root_scan_task(ptls.root_task, true); - // need to iterate over live tasks as well to process their shadow stacks - // we should not set the task themselves as roots as we will know which ones are still alive after GC + add_task_as_root(ptls.root_task); + add_task_as_root(ptls.current_task as *mut _jl_task_t); + add_task_as_root(ptls.next_task); + add_task_as_root(ptls.previous_task); + + // need to iterate over all tasks as well to process their shadow stacks and scan their stacks let mut i = 0; - while i < ptls.gc_tls_common.heap.live_tasks.len { - let mut task_address = Address::from_ptr(ptls.gc_tls_common.heap.live_tasks.items); + while i < ptls.gc_tls_common.heap.all_tasks.len { + let mut task_address = Address::from_ptr(ptls.gc_tls_common.heap.all_tasks.items); task_address = task_address.shift::
(i as isize); let task = unsafe { task_address.load::<*const jl_task_t>() }; - root_scan_task(task, false); + scan_root_task(task); i += 1; } - root_scan_task(ptls.current_task as *mut _jl_task_t, true); - root_scan_task(ptls.next_task, true); - root_scan_task(ptls.previous_task, true); if !ptls.previous_exception.is_null() { node_buffer.push(unsafe { // unsafe: We have just checked `ptls.previous_exception` is not null.