From 1c2caf1eaa585c33e882a2f0924dd5150d93b9a4 Mon Sep 17 00:00:00 2001 From: Luis Eduardo de Souza Amorim Date: Thu, 9 May 2024 00:06:29 +0000 Subject: [PATCH 1/8] Processing gc preserve regions differently, transitively pinning roots from them --- julia/mmtk_julia_types.h | 2 + mmtk/api/mmtk.h | 1 + mmtk/src/julia_scanning.rs | 115 ++++++++++++++++++++++++++++++++----- mmtk/src/julia_types.rs | 38 +++++++----- 4 files changed, 127 insertions(+), 29 deletions(-) diff --git a/julia/mmtk_julia_types.h b/julia/mmtk_julia_types.h index bf1fdd29..4b9fa13a 100644 --- a/julia/mmtk_julia_types.h +++ b/julia/mmtk_julia_types.h @@ -470,6 +470,8 @@ typedef struct mmtk__jl_task_t { int8_t threadpoolid; // saved gc stack top for context switches mmtk_jl_gcframe_t *gcstack; + // stack of objects (not slots) that need to be transitively pinned + mmtk_jl_gcframe_t *tpin_gcstack; size_t world_age; // quick lookup for current ptls void* ptls; // == jl_all_tls_states[tid] diff --git a/mmtk/api/mmtk.h b/mmtk/api/mmtk.h index 7ef4dcec..6a942061 100644 --- a/mmtk/api/mmtk.h +++ b/mmtk/api/mmtk.h @@ -52,6 +52,7 @@ extern void mmtk_unreachable(void); extern unsigned char mmtk_pin_object(void* obj); extern bool mmtk_is_pinned(void* obj); + extern void mmtk_set_vm_space(void* addr, size_t size); extern void mmtk_immortal_region_post_alloc(void* addr, size_t size); diff --git a/mmtk/src/julia_scanning.rs b/mmtk/src/julia_scanning.rs index e4109521..ee9cc63d 100644 --- a/mmtk/src/julia_scanning.rs +++ b/mmtk/src/julia_scanning.rs @@ -358,9 +358,20 @@ pub unsafe fn scan_julia_object>(obj: Address, clos pub unsafe fn mmtk_scan_gcstack<'a, EV: EdgeVisitor>( ta: *const mmtk_jl_task_t, - mut closure: &'a mut EV, - mut pclosure: Option<&'a mut EV>, + closure: &'a mut EV, + pclosure: Option<&'a mut EV>, ) { + // process transitively pinning stack first + let pinning_closure = if let Some(c) = pclosure { + // only do this when scanning stack roots + // will not need the pinning closure, since everything on this stack will have to be transitively pinning + scan_stack((*ta).tpin_gcstack, 0, u64::MAX, 0, closure, None); + Some(c) + } else { + None + }; + + // process Julia's standard shadow (GC) stack let stkbuf = (*ta).stkbuf; let copy_stack = (*ta).copy_stack_custom(); @@ -370,7 +381,6 @@ pub unsafe fn mmtk_scan_gcstack<'a, EV: EdgeVisitor>( process_edge(closure, stkbuf_edge); } - let mut s = (*ta).gcstack; let (mut offset, mut lb, mut ub) = (0 as isize, 0 as u64, u64::MAX); #[cfg(feature = "julia_copy_stack")] @@ -384,8 +394,29 @@ pub unsafe fn mmtk_scan_gcstack<'a, EV: EdgeVisitor>( offset = (*ta).stkbuf as isize - lb as isize; } - if s != std::ptr::null_mut() { - let s_nroots_addr = ::std::ptr::addr_of!((*s).nroots); + // process Julia's gc shadow stack + scan_stack((*ta).gcstack, lb, ub, offset, closure, pinning_closure); + + // just call into C, since the code is cold + if (*ta).excstack != std::ptr::null_mut() { + ((*UPCALLS).scan_julia_exc_obj)( + Address::from_ptr(ta), + Address::from_mut_ptr(closure), + process_edge:: as _, + ); + } +} + +unsafe fn scan_stack<'a, EV: EdgeVisitor>( + mut stack: *mut mmtk__jl_gcframe_t, + lb: u64, + ub: u64, + offset: isize, + mut closure: &'a mut EV, + mut pclosure: Option<&'a mut EV>, +) { + if stack != std::ptr::null_mut() { + let s_nroots_addr = ::std::ptr::addr_of!((*stack).nroots); let mut nroots = read_stack(Address::from_ptr(s_nroots_addr), offset, lb, ub); debug_assert!(nroots.as_usize() as u32 <= UINT32_MAX); let mut nr = nroots >> 3; @@ -403,7 +434,7 @@ pub unsafe fn mmtk_scan_gcstack<'a, EV: EdgeVisitor>( } }; - let rts = Address::from_mut_ptr(s).shift::
(2); + let rts = Address::from_mut_ptr(stack).shift::
(2); let mut i = 0; while i < nr { if (nroots.as_usize() & 1) != 0 { @@ -436,6 +467,69 @@ pub unsafe fn mmtk_scan_gcstack<'a, EV: EdgeVisitor>( i += 1; } + let s_prev_address = ::std::ptr::addr_of!((*stack).prev); + let sprev = read_stack(Address::from_ptr(s_prev_address), offset, lb, ub); + if sprev.is_zero() { + break; + } + + stack = sprev.to_mut_ptr::(); + let s_nroots_addr = ::std::ptr::addr_of!((*stack).nroots); + let new_nroots = read_stack(Address::from_ptr(s_nroots_addr), offset, lb, ub); + nroots = new_nroots; + nr = nroots >> 3; + continue; + } + } +} + +pub unsafe fn mmtk_scan_tpinstack<'a, EV: EdgeVisitor>( + ta: *const mmtk_jl_task_t, + closure: &'a mut EV, +) { + let mut s = (*ta).tpin_gcstack; + let (offset, lb, ub) = (0 as isize, 0 as u64, u64::MAX); + + if s != std::ptr::null_mut() { + let s_nroots_addr = ::std::ptr::addr_of!((*s).nroots); + let mut nroots = read_stack(Address::from_ptr(s_nroots_addr), offset, lb, ub); + debug_assert!(nroots.as_usize() as u32 <= UINT32_MAX); + let mut nr = nroots >> 3; + + loop { + let rts = Address::from_mut_ptr(s).shift::
(2); + let mut i = 0; + + while i < nr { + let real_addr = get_stack_addr(rts.shift::
(i as isize), offset, lb, ub); + + let slot = read_stack(rts.shift::
(i as isize), offset, lb, ub); + use crate::julia_finalizer::gc_ptr_tag; + // malloced pointer tagged in jl_gc_add_quiescent + // skip both the next element (native function), and the object + if slot & 3usize == 3 { + i += 2; + continue; + } + + // pointer is not malloced but function is native, so skip it + if gc_ptr_tag(slot, 1) { + i += 2; + continue; + } + + if nr == 3 { + println!( + "s = {:?}, root = {}, obj = {}", + s, + real_addr, + real_addr.load::() + ); + } + process_edge(closure, real_addr); + i += 1; + } + let s_prev_address = ::std::ptr::addr_of!((*s).prev); let sprev = read_stack(Address::from_ptr(s_prev_address), offset, lb, ub); if sprev.is_zero() { @@ -450,15 +544,6 @@ pub unsafe fn mmtk_scan_gcstack<'a, EV: EdgeVisitor>( continue; } } - - // just call into C, since the code is cold - if (*ta).excstack != std::ptr::null_mut() { - ((*UPCALLS).scan_julia_exc_obj)( - Address::from_ptr(ta), - Address::from_mut_ptr(closure), - process_edge:: as _, - ); - } } #[inline(always)] diff --git a/mmtk/src/julia_types.rs b/mmtk/src/julia_types.rs index 9daa3676..9eb95ba8 100644 --- a/mmtk/src/julia_types.rs +++ b/mmtk/src/julia_types.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.69.1 */ +/* automatically generated by rust-bindgen 0.69.4 */ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] @@ -3663,7 +3663,6 @@ fn bindgen_test_layout_mmtk__jl_taggedvalue_t() { ); } #[repr(C)] -#[repr(align(2))] #[derive(Debug, Copy, Clone)] pub struct mmtk_jl_array_flags_t { pub _bitfield_align_1: [u16; 0], @@ -6478,6 +6477,7 @@ pub struct mmtk__jl_task_t { pub tid: u16, pub threadpoolid: i8, pub gcstack: *mut mmtk_jl_gcframe_t, + pub tpin_gcstack: *mut mmtk_jl_gcframe_t, pub world_age: usize, pub ptls: *mut ::std::os::raw::c_void, pub excstack: *mut mmtk_jl_excstack_t, @@ -6497,7 +6497,7 @@ fn bindgen_test_layout_mmtk__jl_task_t() { let ptr = UNINIT.as_ptr(); assert_eq!( ::std::mem::size_of::(), - 376usize, + 384usize, concat!("Size of: ", stringify!(mmtk__jl_task_t)) ); assert_eq!( @@ -6656,8 +6656,18 @@ fn bindgen_test_layout_mmtk__jl_task_t() { ) ); assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).world_age) as usize - ptr as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).tpin_gcstack) as usize - ptr as usize }, 112usize, + concat!( + "Offset of field: ", + stringify!(mmtk__jl_task_t), + "::", + stringify!(tpin_gcstack) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).world_age) as usize - ptr as usize }, + 120usize, concat!( "Offset of field: ", stringify!(mmtk__jl_task_t), @@ -6667,7 +6677,7 @@ fn bindgen_test_layout_mmtk__jl_task_t() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).ptls) as usize - ptr as usize }, - 120usize, + 128usize, concat!( "Offset of field: ", stringify!(mmtk__jl_task_t), @@ -6677,7 +6687,7 @@ fn bindgen_test_layout_mmtk__jl_task_t() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).excstack) as usize - ptr as usize }, - 128usize, + 136usize, concat!( "Offset of field: ", stringify!(mmtk__jl_task_t), @@ -6687,7 +6697,7 @@ fn bindgen_test_layout_mmtk__jl_task_t() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).eh) as usize - ptr as usize }, - 136usize, + 144usize, concat!( "Offset of field: ", stringify!(mmtk__jl_task_t), @@ -6697,7 +6707,7 @@ fn bindgen_test_layout_mmtk__jl_task_t() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).ctx) as usize - ptr as usize }, - 144usize, + 152usize, concat!( "Offset of field: ", stringify!(mmtk__jl_task_t), @@ -6707,7 +6717,7 @@ fn bindgen_test_layout_mmtk__jl_task_t() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).stkbuf) as usize - ptr as usize }, - 344usize, + 352usize, concat!( "Offset of field: ", stringify!(mmtk__jl_task_t), @@ -6717,7 +6727,7 @@ fn bindgen_test_layout_mmtk__jl_task_t() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).bufsz) as usize - ptr as usize }, - 352usize, + 360usize, concat!( "Offset of field: ", stringify!(mmtk__jl_task_t), @@ -6727,7 +6737,7 @@ fn bindgen_test_layout_mmtk__jl_task_t() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).inference_start_time) as usize - ptr as usize }, - 360usize, + 368usize, concat!( "Offset of field: ", stringify!(mmtk__jl_task_t), @@ -6737,7 +6747,7 @@ fn bindgen_test_layout_mmtk__jl_task_t() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).reentrant_inference) as usize - ptr as usize }, - 368usize, + 376usize, concat!( "Offset of field: ", stringify!(mmtk__jl_task_t), @@ -6747,7 +6757,7 @@ fn bindgen_test_layout_mmtk__jl_task_t() { ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).reentrant_timing) as usize - ptr as usize }, - 370usize, + 378usize, concat!( "Offset of field: ", stringify!(mmtk__jl_task_t), @@ -6833,7 +6843,7 @@ pub union mmtk___jl_purity_overrides_t { pub overrides: mmtk___jl_purity_overrides_t__bindgen_ty_1, pub bits: u8, } -#[repr(C, packed)] +#[repr(C)] #[derive(Debug, Copy, Clone)] pub struct mmtk___jl_purity_overrides_t__bindgen_ty_1 { pub _bitfield_align_1: [u8; 0], From 206d84132c6abe6d8ff639b75396acf4f97b52a6 Mon Sep 17 00:00:00 2001 From: Eduardo Souza Date: Tue, 11 Jun 2024 03:26:16 +0000 Subject: [PATCH 2/8] Updating julia_repo and julia_version --- mmtk/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index 7479a430..853ddd83 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -9,8 +9,8 @@ edition = "2018" # Metadata for the Julia repository [package.metadata.julia] # Our CI matches the following line and extract mmtk/julia. If this line is updated, please check ci yaml files and make sure it works. -julia_repo = "https://github.com/mmtk/julia.git" -julia_version = "88fea475d9639820488f6dd50fcb08c60a011899" +julia_repo = "https://github.com/udesou/julia.git" +julia_version = "480b89d8ce85ee1030aefa35804b6c9e68883913" [lib] crate-type = ["cdylib"] From da7b542346ede19608cc37b24e1bd652908c47a8 Mon Sep 17 00:00:00 2001 From: Eduardo Souza Date: Tue, 11 Jun 2024 05:40:23 +0000 Subject: [PATCH 3/8] Cleanup --- mmtk/Cargo.toml | 2 +- mmtk/src/julia_scanning.rs | 63 -------------------------------------- 2 files changed, 1 insertion(+), 64 deletions(-) diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index 853ddd83..6e7749d9 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" [package.metadata.julia] # Our CI matches the following line and extract mmtk/julia. If this line is updated, please check ci yaml files and make sure it works. julia_repo = "https://github.com/udesou/julia.git" -julia_version = "480b89d8ce85ee1030aefa35804b6c9e68883913" +julia_version = "ed66d4ba1af8c3e143f910bcac51486a0a8ab787" [lib] crate-type = ["cdylib"] diff --git a/mmtk/src/julia_scanning.rs b/mmtk/src/julia_scanning.rs index ee9cc63d..a82f955c 100644 --- a/mmtk/src/julia_scanning.rs +++ b/mmtk/src/julia_scanning.rs @@ -483,69 +483,6 @@ unsafe fn scan_stack<'a, EV: EdgeVisitor>( } } -pub unsafe fn mmtk_scan_tpinstack<'a, EV: EdgeVisitor>( - ta: *const mmtk_jl_task_t, - closure: &'a mut EV, -) { - let mut s = (*ta).tpin_gcstack; - let (offset, lb, ub) = (0 as isize, 0 as u64, u64::MAX); - - if s != std::ptr::null_mut() { - let s_nroots_addr = ::std::ptr::addr_of!((*s).nroots); - let mut nroots = read_stack(Address::from_ptr(s_nroots_addr), offset, lb, ub); - debug_assert!(nroots.as_usize() as u32 <= UINT32_MAX); - let mut nr = nroots >> 3; - - loop { - let rts = Address::from_mut_ptr(s).shift::
(2); - let mut i = 0; - - while i < nr { - let real_addr = get_stack_addr(rts.shift::
(i as isize), offset, lb, ub); - - let slot = read_stack(rts.shift::
(i as isize), offset, lb, ub); - use crate::julia_finalizer::gc_ptr_tag; - // malloced pointer tagged in jl_gc_add_quiescent - // skip both the next element (native function), and the object - if slot & 3usize == 3 { - i += 2; - continue; - } - - // pointer is not malloced but function is native, so skip it - if gc_ptr_tag(slot, 1) { - i += 2; - continue; - } - - if nr == 3 { - println!( - "s = {:?}, root = {}, obj = {}", - s, - real_addr, - real_addr.load::() - ); - } - process_edge(closure, real_addr); - i += 1; - } - - let s_prev_address = ::std::ptr::addr_of!((*s).prev); - let sprev = read_stack(Address::from_ptr(s_prev_address), offset, lb, ub); - if sprev.is_zero() { - break; - } - - s = sprev.to_mut_ptr::(); - let s_nroots_addr = ::std::ptr::addr_of!((*s).nroots); - let new_nroots = read_stack(Address::from_ptr(s_nroots_addr), offset, lb, ub); - nroots = new_nroots; - nr = nroots >> 3; - continue; - } - } -} - #[inline(always)] pub unsafe fn read_stack(addr: Address, offset: isize, lb: u64, ub: u64) -> Address { let real_addr = get_stack_addr(addr, offset, lb, ub); From 6bc01298be8ee4cb29488215ab75f537ca71854e Mon Sep 17 00:00:00 2001 From: Eduardo Souza Date: Tue, 11 Jun 2024 06:15:07 +0000 Subject: [PATCH 4/8] Updating julia_version --- mmtk/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index 6e7749d9..b7c23995 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" [package.metadata.julia] # Our CI matches the following line and extract mmtk/julia. If this line is updated, please check ci yaml files and make sure it works. julia_repo = "https://github.com/udesou/julia.git" -julia_version = "ed66d4ba1af8c3e143f910bcac51486a0a8ab787" +julia_version = "0558e64792ace533e7dccacb903ed03d2b5a51c3" [lib] crate-type = ["cdylib"] From 5ce39a48f4a391d72031f874f6995514058256e5 Mon Sep 17 00:00:00 2001 From: Eduardo Souza Date: Thu, 20 Jun 2024 05:51:04 +0000 Subject: [PATCH 5/8] Refactor code to add mmtk_scan_gcpreserve_stack function --- julia/mmtk_julia_types.h | 2 +- mmtk/Cargo.toml | 2 +- mmtk/src/julia_scanning.rs | 68 ++++++++++++++++++++++++++++++++------ mmtk/src/julia_types.rs | 11 +++--- mmtk/src/scanning.rs | 4 +++ 5 files changed, 69 insertions(+), 18 deletions(-) diff --git a/julia/mmtk_julia_types.h b/julia/mmtk_julia_types.h index 0e3ffa22..f23f86c4 100644 --- a/julia/mmtk_julia_types.h +++ b/julia/mmtk_julia_types.h @@ -471,7 +471,7 @@ typedef struct mmtk__jl_task_t { // saved gc stack top for context switches mmtk_jl_gcframe_t *gcstack; // stack of objects (not slots) that need to be transitively pinned - mmtk_jl_gcframe_t *tpin_gcstack; + mmtk_jl_gcframe_t *gcpreserve_stack; size_t world_age; // quick lookup for current ptls void* ptls; // == jl_all_tls_states[tid] diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index b7c23995..c3e25f5f 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" [package.metadata.julia] # Our CI matches the following line and extract mmtk/julia. If this line is updated, please check ci yaml files and make sure it works. julia_repo = "https://github.com/udesou/julia.git" -julia_version = "0558e64792ace533e7dccacb903ed03d2b5a51c3" +julia_version = "1b3d0defb72663433fae4f28f3a0812f5e1b880c" [lib] crate-type = ["cdylib"] diff --git a/mmtk/src/julia_scanning.rs b/mmtk/src/julia_scanning.rs index a82f955c..46cf90dc 100644 --- a/mmtk/src/julia_scanning.rs +++ b/mmtk/src/julia_scanning.rs @@ -356,21 +356,67 @@ pub unsafe fn scan_julia_object>(obj: Address, clos } } +pub unsafe fn mmtk_scan_gcpreserve_stack<'a, EV: EdgeVisitor>( + ta: *const mmtk_jl_task_t, + closure: &'a mut EV, +) { + // process transitively pinning stack + let mut s = (*ta).gcpreserve_stack; + let (offset, lb, ub) = (0 as isize, 0 as u64, u64::MAX); + + if s != std::ptr::null_mut() { + let s_nroots_addr = ::std::ptr::addr_of!((*s).nroots); + let mut nroots = read_stack(Address::from_ptr(s_nroots_addr), offset, lb, ub); + debug_assert!(nroots.as_usize() as u32 <= UINT32_MAX); + let mut nr = nroots >> 3; + + loop { + let rts = Address::from_mut_ptr(s).shift::
(2); + let mut i = 0; + + while i < nr { + let real_addr = get_stack_addr(rts.shift::
(i as isize), offset, lb, ub); + + let slot = read_stack(rts.shift::
(i as isize), offset, lb, ub); + use crate::julia_finalizer::gc_ptr_tag; + // malloced pointer tagged in jl_gc_add_quiescent + // skip both the next element (native function), and the object + if slot & 3usize == 3 { + i += 2; + continue; + } + + // pointer is not malloced but function is native, so skip it + if gc_ptr_tag(slot, 1) { + i += 2; + continue; + } + + process_edge(closure, real_addr); + i += 1; + } + + let s_prev_address = ::std::ptr::addr_of!((*s).prev); + let sprev = read_stack(Address::from_ptr(s_prev_address), offset, lb, ub); + if sprev.is_zero() { + break; + } + + s = sprev.to_mut_ptr::(); + let s_nroots_addr = ::std::ptr::addr_of!((*s).nroots); + let new_nroots = read_stack(Address::from_ptr(s_nroots_addr), offset, lb, ub); + nroots = new_nroots; + nr = nroots >> 3; + continue; + } + } +} + pub unsafe fn mmtk_scan_gcstack<'a, EV: EdgeVisitor>( ta: *const mmtk_jl_task_t, closure: &'a mut EV, pclosure: Option<&'a mut EV>, ) { - // process transitively pinning stack first - let pinning_closure = if let Some(c) = pclosure { - // only do this when scanning stack roots - // will not need the pinning closure, since everything on this stack will have to be transitively pinning - scan_stack((*ta).tpin_gcstack, 0, u64::MAX, 0, closure, None); - Some(c) - } else { - None - }; - // process Julia's standard shadow (GC) stack let stkbuf = (*ta).stkbuf; let copy_stack = (*ta).copy_stack_custom(); @@ -395,7 +441,7 @@ pub unsafe fn mmtk_scan_gcstack<'a, EV: EdgeVisitor>( } // process Julia's gc shadow stack - scan_stack((*ta).gcstack, lb, ub, offset, closure, pinning_closure); + scan_stack((*ta).gcstack, lb, ub, offset, closure, pclosure); // just call into C, since the code is cold if (*ta).excstack != std::ptr::null_mut() { diff --git a/mmtk/src/julia_types.rs b/mmtk/src/julia_types.rs index a3848f5a..4bc1a80a 100644 --- a/mmtk/src/julia_types.rs +++ b/mmtk/src/julia_types.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.69.4 */ +/* automatically generated by rust-bindgen 0.63.0 */ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] @@ -3663,6 +3663,7 @@ fn bindgen_test_layout_mmtk__jl_taggedvalue_t() { ); } #[repr(C)] +#[repr(align(2))] #[derive(Debug, Copy, Clone)] pub struct mmtk_jl_array_flags_t { pub _bitfield_align_1: [u16; 0], @@ -6477,7 +6478,7 @@ pub struct mmtk__jl_task_t { pub tid: u16, pub threadpoolid: i8, pub gcstack: *mut mmtk_jl_gcframe_t, - pub tpin_gcstack: *mut mmtk_jl_gcframe_t, + pub gcpreserve_stack: *mut mmtk_jl_gcframe_t, pub world_age: usize, pub ptls: *mut ::std::os::raw::c_void, pub excstack: *mut mmtk_jl_excstack_t, @@ -6656,13 +6657,13 @@ fn bindgen_test_layout_mmtk__jl_task_t() { ) ); assert_eq!( - unsafe { ::std::ptr::addr_of!((*ptr).tpin_gcstack) as usize - ptr as usize }, + unsafe { ::std::ptr::addr_of!((*ptr).gcpreserve_stack) as usize - ptr as usize }, 112usize, concat!( "Offset of field: ", stringify!(mmtk__jl_task_t), "::", - stringify!(tpin_gcstack) + stringify!(gcpreserve_stack) ) ); assert_eq!( @@ -6843,7 +6844,7 @@ pub union mmtk___jl_purity_overrides_t { pub overrides: mmtk___jl_purity_overrides_t__bindgen_ty_1, pub bits: u8, } -#[repr(C)] +#[repr(C, packed)] #[derive(Debug, Copy, Clone)] pub struct mmtk___jl_purity_overrides_t__bindgen_ty_1 { pub _bitfield_align_1: [u8; 0], diff --git a/mmtk/src/scanning.rs b/mmtk/src/scanning.rs index 10bf7f63..ab8349f6 100644 --- a/mmtk/src/scanning.rs +++ b/mmtk/src/scanning.rs @@ -60,6 +60,10 @@ impl Scanning for VMScanning { let mut root_scan_task = |task: *const mmtk__jl_task_t, task_is_root: bool| { if !task.is_null() { unsafe { + // process gc preserve stack + mmtk_scan_gcpreserve_stack(task, &mut tpinning_edge_buffer); + + // process gc stack mmtk_scan_gcstack( task, &mut tpinning_edge_buffer, From 559da543dcf355a5cb06887ecca24d3887c02e82 Mon Sep 17 00:00:00 2001 From: Eduardo Souza Date: Mon, 24 Jun 2024 01:46:22 +0000 Subject: [PATCH 6/8] Updating julia_version --- mmtk/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index e9168323..066beee9 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" [package.metadata.julia] # Our CI matches the following line and extract mmtk/julia. If this line is updated, please check ci yaml files and make sure it works. julia_repo = "https://github.com/udesou/julia.git" -julia_version = "1b3d0defb72663433fae4f28f3a0812f5e1b880c" +julia_version = "83d551b1fe214ef0d6c80797e5347778d68a93f4" [lib] crate-type = ["cdylib"] From 786011e990d816d0f247d8f74fb4ef184de6be53 Mon Sep 17 00:00:00 2001 From: Eduardo Souza Date: Mon, 24 Jun 2024 03:47:56 +0000 Subject: [PATCH 7/8] Updating julia_version --- mmtk/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index 066beee9..65842469 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" [package.metadata.julia] # Our CI matches the following line and extract mmtk/julia. If this line is updated, please check ci yaml files and make sure it works. julia_repo = "https://github.com/udesou/julia.git" -julia_version = "83d551b1fe214ef0d6c80797e5347778d68a93f4" +julia_version = "01f2f2406b48b9592ab5626bd50bad10989d0247" [lib] crate-type = ["cdylib"] From 6c05f3c54896becdc020dfb605aaa98e7b2f32e4 Mon Sep 17 00:00:00 2001 From: Eduardo Souza Date: Mon, 24 Jun 2024 06:15:35 +0000 Subject: [PATCH 8/8] Update julia_repo and julia_version --- mmtk/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmtk/Cargo.toml b/mmtk/Cargo.toml index 65842469..4843e16d 100644 --- a/mmtk/Cargo.toml +++ b/mmtk/Cargo.toml @@ -9,8 +9,8 @@ edition = "2018" # Metadata for the Julia repository [package.metadata.julia] # Our CI matches the following line and extract mmtk/julia. If this line is updated, please check ci yaml files and make sure it works. -julia_repo = "https://github.com/udesou/julia.git" -julia_version = "01f2f2406b48b9592ab5626bd50bad10989d0247" +julia_repo = "https://github.com/mmtk/julia.git" +julia_version = "5c9b37044fd6e446141d29111fb6c894ba0a42ff" [lib] crate-type = ["cdylib"]