Skip to content

Commit c134b32

Browse files
committed
Merge branch 'master' into support-moving
2 parents 11729f1 + 4933fb4 commit c134b32

10 files changed

+82
-72
lines changed

.github/scripts/Make.user

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
FORCE_ASSERTIONS=1
22
LLVM_ASSERTIONS=1
33
USE_BINARYBUILDER_MMTK_JULIA=0
4+
WITH_THIRD_PARTY_GC=mmtk

.github/scripts/ci-test-LinearAlgebra.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ set -e
55

66
. $(dirname "$0")/common.sh
77

8+
# plan to use
9+
plan=$1
10+
11+
export MMTK_PLAN=$plan
12+
813
export MMTK_MAX_HSIZE_G=8
914
total_mem=$(free -m | awk '/^Mem:/ {print $2}')
1015
mem_threshold=512 # use 0.5Gb as a threshold for the max rss based on the total free memory

.github/scripts/ci-test-other.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ set -xe
22

33
. $(dirname "$0")/common.sh
44

5+
# plan to use
6+
plan=$1
7+
8+
export MMTK_PLAN=$plan
9+
510
# Get all the tests
611
CHOOSE_TESTS_JL_PATH=$JULIA_PATH/test/choosetests.jl
712
CHOOSE_TESTS_JL_CONTENT=`cat $CHOOSE_TESTS_JL_PATH`
@@ -28,6 +33,12 @@ if [[ $CHOOSE_TESTS_JL_CONTENT =~ $REGEX_PATTERN ]]; then
2833
continue
2934
fi
3035
36+
if [[ $test =~ "compiler_extras" ]]; then
37+
# Skipping compiler_extras for now
38+
echo "-> Skip compiler_extras"
39+
continue
40+
fi
41+
3142
echo "-> Run"
3243
ci_run_jl_test $test
3344
fi

.github/scripts/ci-test-patching.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ declare -a tests_to_skip=(
5252
'@test contains(sshot, "redact_this")' "$JULIA_PATH/stdlib/Profile/test/runtests.jl"
5353

5454
# This test checks GC logging
55-
'@test occursin("GC: pause", read(tmppath, String))' "$JULIA_PATH/test/misc.jl"
55+
'@test !isempty(test_complete("?("))' "$JULIA_PATH/stdlib/REPL/test/replcompletions.jl"
5656

57+
# This test seems to be failing in the new version of Julia
58+
'@test occursin("int.jl", code)' "$JULIA_PATH/test/cmdlineargs.jl"
5759
# These tests check for the number of stock GC threads (which we set to 0 with mmtk)
5860
'@test (cpu_threads == 1 ? "1" : string(div(cpu_threads, 2))) ==' "$JULIA_PATH/test/cmdlineargs.jl"
5961
'@test read(`$exename --gcthreads=2 -e $code`, String) == "2"' "$JULIA_PATH/test/cmdlineargs.jl"

.github/scripts/ci-test-stdlib.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ set -e
55

66
. $(dirname "$0")/common.sh
77

8+
# plan to use
9+
plan=$1
10+
11+
export MMTK_PLAN=$plan
12+
813
# These tests seem to fail. We skip them.
914
declare -a tests_to_skip=(
1015
# Test Failed at /home/runner/work/mmtk-julia/mmtk-julia/vm/julia/usr/share/julia/stdlib/v1.8/Dates/test/io.jl:45

.github/scripts/ci-test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ cur=$(realpath $(dirname "$0"))
1313
cd $cur
1414
./ci-build.sh release Immix
1515

16+
export MMTK_PLAN=Immix
17+
1618
# Use release build to run tests
1719
cd $cur
1820
./ci-test-gc-core.sh

.github/workflows/binding-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
$JULIA_PATH/julia --project=. -e "using InteractiveUtils; versioninfo()"
110110
- name: Test Julia
111111
run: |
112-
./.github/scripts/ci-test-other.sh
112+
./.github/scripts/ci-test-other.sh ${{ inputs.gc_plan }}
113113
114114
build-test-stdlib:
115115
runs-on: ubuntu-22.04
@@ -135,7 +135,7 @@ jobs:
135135
$JULIA_PATH/julia --project=. -e "using InteractiveUtils; versioninfo()"
136136
- name: Test Julia
137137
run: |
138-
./.github/scripts/ci-test-stdlib.sh
138+
./.github/scripts/ci-test-stdlib.sh ${{ inputs.gc_plan }}
139139
140140
build-test-LinearAlgebra:
141141
runs-on: ubuntu-22.04
@@ -158,4 +158,4 @@ jobs:
158158
$JULIA_PATH/julia --project=. -e "using InteractiveUtils; versioninfo()"
159159
- name: Test Julia
160160
run: |
161-
./.github/scripts/ci-test-LinearAlgebra.sh
161+
./.github/scripts/ci-test-LinearAlgebra.sh ${{ inputs.gc_plan }}

mmtk/build.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ fn main() {
8686
.clang_arg("c++")
8787
.clang_arg("-std=c++14")
8888
// using MMTK types
89-
.clang_arg("-DMMTK_GC")
89+
.clang_arg("-DWITH_THIRD_PARTY_HEAP=1")
90+
// using sticky, but it should not matter for the FFI bindings
91+
.clang_arg("-DMMTK_PLAN_STICKYIMMIX")
9092
// Finish the builder and generate the bindings.
9193
.generate()
9294
// Unwrap the Result and panic on failure.

mmtk/src/julia_scanning.rs

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ pub unsafe fn scan_julia_object<SV: SlotVisitor<JuliaVMSlot>>(obj: Address, clos
138138
}
139139
process_slot(closure, Address::from_ptr(usings_backeges_slot));
140140

141+
let scanned_methods_slot = ::std::ptr::addr_of!((*m).scanned_methods);
142+
if PRINT_OBJ_TYPE {
143+
println!(" - scan parent: {:?}\n", scanned_methods_slot);
144+
}
145+
process_slot(closure, Address::from_ptr(scanned_methods_slot));
146+
141147
// m.usings.items may be inlined in the module when the array list size <= AL_N_INLINE (cf. arraylist_new)
142148
// In that case it may be an mmtk object and not a malloced address.
143149
// If it is an mmtk object, (*m).usings.items will then be an internal pointer to the module
@@ -317,15 +323,6 @@ pub unsafe fn scan_julia_object<SV: SlotVisitor<JuliaVMSlot>>(obj: Address, clos
317323
let layout = (*vt).layout;
318324
let npointers = (*layout).npointers;
319325
if npointers != 0 {
320-
if vt == jl_binding_partition_type {
321-
let bpart_ptr = obj.to_mut_ptr::<jl_binding_partition_t>();
322-
let restriction = (*bpart_ptr).restriction._M_i;
323-
let offset = mmtk_decode_restriction_value(restriction);
324-
let slot = Address::from_ptr(::std::ptr::addr_of!((*bpart_ptr).restriction));
325-
if restriction - offset != 0 {
326-
process_offset_slot(closure, slot, offset);
327-
}
328-
}
329326
debug_assert!(
330327
(*layout).nfields > 0 && (*layout).fielddesc_type_custom() != 3,
331328
"opaque types should have been handled specially"
@@ -596,27 +593,6 @@ pub fn process_slot<EV: SlotVisitor<JuliaVMSlot>>(closure: &mut EV, slot: Addres
596593
closure.visit_slot(JuliaVMSlot::Simple(simple_slot));
597594
}
598595

599-
// This is based on the function decode_restriction_value from julia_internal.h.
600-
// However, since MMTk uses the slot to load the object, we get the offset from pku using
601-
// that offset to pass to process_offset_edge and get the right address.
602-
#[inline(always)]
603-
pub fn mmtk_decode_restriction_value(pku: usize) -> usize {
604-
#[cfg(target_pointer_width = "64")]
605-
{
606-
// need to apply (pku & ~0x7) to get the object to be traced
607-
// so we use (pku & 0x7) to get the offset from the object
608-
// and pass it to process_offset_slot
609-
pku & 0x7
610-
}
611-
612-
#[cfg(not(target_pointer_width = "64"))]
613-
{
614-
// when not #ifdef _P64 we simply return pku.val
615-
// i.e., the offset is 0, since val is the first field
616-
0
617-
}
618-
}
619-
620596
#[inline(always)]
621597
pub fn process_offset_slot<EV: SlotVisitor<JuliaVMSlot>>(
622598
closure: &mut EV,

mmtk/src/julia_types.rs

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,6 @@ const _: () = {
252252
pub type sigjmp_buf = [__jmp_buf_tag; 1usize];
253253
pub type jl_taggedvalue_t = _jl_taggedvalue_t;
254254
pub type jl_ptls_t = *mut _jl_tls_states_t;
255-
#[repr(C)]
256-
#[derive(Debug, Copy, Clone)]
257-
pub struct _jl_value_t {
258-
_unused: [u8; 0],
259-
}
260255
pub type sig_atomic_t = __sig_atomic_t;
261256
#[repr(C)]
262257
#[derive(Debug, Copy, Clone)]
@@ -385,6 +380,11 @@ const _: () = {
385380
[::std::mem::offset_of!(ucontext_t, __fpregs_mem) - 424usize];
386381
["Offset of field: ucontext_t::__ssp"][::std::mem::offset_of!(ucontext_t, __ssp) - 936usize];
387382
};
383+
#[repr(C)]
384+
#[derive(Debug, Copy, Clone)]
385+
pub struct _jl_value_t {
386+
_unused: [u8; 0],
387+
}
388388
pub type jl_value_t = _jl_value_t;
389389
#[repr(C)]
390390
#[repr(align(8))]
@@ -1067,19 +1067,20 @@ const _: () = {
10671067
};
10681068
#[repr(C)]
10691069
#[derive(Debug, Copy, Clone)]
1070-
pub struct jl_genericmemory_t {
1070+
pub struct _jl_genericmemory_t {
10711071
pub length: usize,
10721072
pub ptr: *mut ::std::os::raw::c_void,
10731073
}
10741074
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
10751075
const _: () = {
1076-
["Size of jl_genericmemory_t"][::std::mem::size_of::<jl_genericmemory_t>() - 16usize];
1077-
["Alignment of jl_genericmemory_t"][::std::mem::align_of::<jl_genericmemory_t>() - 8usize];
1078-
["Offset of field: jl_genericmemory_t::length"]
1079-
[::std::mem::offset_of!(jl_genericmemory_t, length) - 0usize];
1080-
["Offset of field: jl_genericmemory_t::ptr"]
1081-
[::std::mem::offset_of!(jl_genericmemory_t, ptr) - 8usize];
1076+
["Size of _jl_genericmemory_t"][::std::mem::size_of::<_jl_genericmemory_t>() - 16usize];
1077+
["Alignment of _jl_genericmemory_t"][::std::mem::align_of::<_jl_genericmemory_t>() - 8usize];
1078+
["Offset of field: _jl_genericmemory_t::length"]
1079+
[::std::mem::offset_of!(_jl_genericmemory_t, length) - 0usize];
1080+
["Offset of field: _jl_genericmemory_t::ptr"]
1081+
[::std::mem::offset_of!(_jl_genericmemory_t, ptr) - 8usize];
10821082
};
1083+
pub type jl_genericmemory_t = _jl_genericmemory_t;
10831084
#[repr(C)]
10841085
#[derive(Debug, Copy, Clone)]
10851086
pub struct jl_genericmemoryref_t {
@@ -2073,15 +2074,14 @@ const _: () = {
20732074
[::std::mem::offset_of!(_jl_weakref_t, value) - 0usize];
20742075
};
20752076
pub type jl_weakref_t = _jl_weakref_t;
2076-
pub type jl_ptr_kind_union_t = usize;
20772077
#[repr(C)]
20782078
#[derive(Debug)]
20792079
pub struct _jl_binding_partition_t {
2080-
pub restriction: std_atomic<jl_ptr_kind_union_t>,
2080+
pub restriction: *mut jl_value_t,
20812081
pub min_world: usize,
20822082
pub max_world: std_atomic<usize>,
20832083
pub next: u64,
2084-
pub reserved: usize,
2084+
pub kind: usize,
20852085
}
20862086
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
20872087
const _: () = {
@@ -2096,8 +2096,8 @@ const _: () = {
20962096
[::std::mem::offset_of!(_jl_binding_partition_t, max_world) - 16usize];
20972097
["Offset of field: _jl_binding_partition_t::next"]
20982098
[::std::mem::offset_of!(_jl_binding_partition_t, next) - 24usize];
2099-
["Offset of field: _jl_binding_partition_t::reserved"]
2100-
[::std::mem::offset_of!(_jl_binding_partition_t, reserved) - 32usize];
2099+
["Offset of field: _jl_binding_partition_t::kind"]
2100+
[::std::mem::offset_of!(_jl_binding_partition_t, kind) - 32usize];
21012101
};
21022102
pub type jl_binding_partition_t = _jl_binding_partition_t;
21032103
#[repr(C)]
@@ -2123,6 +2123,7 @@ pub struct _jl_module_t {
21232123
pub file: *mut jl_sym_t,
21242124
pub line: i32,
21252125
pub usings_backedges: *mut jl_value_t,
2126+
pub scanned_methods: *mut jl_value_t,
21262127
pub usings: arraylist_t,
21272128
pub build_id: jl_uuid_t,
21282129
pub uuid: jl_uuid_t,
@@ -2133,12 +2134,13 @@ pub struct _jl_module_t {
21332134
pub infer: i8,
21342135
pub istopmod: u8,
21352136
pub max_methods: i8,
2137+
pub export_set_changed_since_require_world: std_atomic<i8>,
21362138
pub lock: jl_mutex_t,
21372139
pub hash: isize,
21382140
}
21392141
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
21402142
const _: () = {
2141-
["Size of _jl_module_t"][::std::mem::size_of::<_jl_module_t>() - 384usize];
2143+
["Size of _jl_module_t"][::std::mem::size_of::<_jl_module_t>() - 392usize];
21422144
["Alignment of _jl_module_t"][::std::mem::align_of::<_jl_module_t>() - 8usize];
21432145
["Offset of field: _jl_module_t::name"][::std::mem::offset_of!(_jl_module_t, name) - 0usize];
21442146
["Offset of field: _jl_module_t::parent"]
@@ -2151,27 +2153,31 @@ const _: () = {
21512153
["Offset of field: _jl_module_t::line"][::std::mem::offset_of!(_jl_module_t, line) - 40usize];
21522154
["Offset of field: _jl_module_t::usings_backedges"]
21532155
[::std::mem::offset_of!(_jl_module_t, usings_backedges) - 48usize];
2156+
["Offset of field: _jl_module_t::scanned_methods"]
2157+
[::std::mem::offset_of!(_jl_module_t, scanned_methods) - 56usize];
21542158
["Offset of field: _jl_module_t::usings"]
2155-
[::std::mem::offset_of!(_jl_module_t, usings) - 56usize];
2159+
[::std::mem::offset_of!(_jl_module_t, usings) - 64usize];
21562160
["Offset of field: _jl_module_t::build_id"]
2157-
[::std::mem::offset_of!(_jl_module_t, build_id) - 312usize];
2158-
["Offset of field: _jl_module_t::uuid"][::std::mem::offset_of!(_jl_module_t, uuid) - 328usize];
2161+
[::std::mem::offset_of!(_jl_module_t, build_id) - 320usize];
2162+
["Offset of field: _jl_module_t::uuid"][::std::mem::offset_of!(_jl_module_t, uuid) - 336usize];
21592163
["Offset of field: _jl_module_t::counter"]
2160-
[::std::mem::offset_of!(_jl_module_t, counter) - 344usize];
2164+
[::std::mem::offset_of!(_jl_module_t, counter) - 352usize];
21612165
["Offset of field: _jl_module_t::nospecialize"]
2162-
[::std::mem::offset_of!(_jl_module_t, nospecialize) - 348usize];
2166+
[::std::mem::offset_of!(_jl_module_t, nospecialize) - 356usize];
21632167
["Offset of field: _jl_module_t::optlevel"]
2164-
[::std::mem::offset_of!(_jl_module_t, optlevel) - 352usize];
2168+
[::std::mem::offset_of!(_jl_module_t, optlevel) - 360usize];
21652169
["Offset of field: _jl_module_t::compile"]
2166-
[::std::mem::offset_of!(_jl_module_t, compile) - 353usize];
2170+
[::std::mem::offset_of!(_jl_module_t, compile) - 361usize];
21672171
["Offset of field: _jl_module_t::infer"]
2168-
[::std::mem::offset_of!(_jl_module_t, infer) - 354usize];
2172+
[::std::mem::offset_of!(_jl_module_t, infer) - 362usize];
21692173
["Offset of field: _jl_module_t::istopmod"]
2170-
[::std::mem::offset_of!(_jl_module_t, istopmod) - 355usize];
2174+
[::std::mem::offset_of!(_jl_module_t, istopmod) - 363usize];
21712175
["Offset of field: _jl_module_t::max_methods"]
2172-
[::std::mem::offset_of!(_jl_module_t, max_methods) - 356usize];
2173-
["Offset of field: _jl_module_t::lock"][::std::mem::offset_of!(_jl_module_t, lock) - 360usize];
2174-
["Offset of field: _jl_module_t::hash"][::std::mem::offset_of!(_jl_module_t, hash) - 376usize];
2176+
[::std::mem::offset_of!(_jl_module_t, max_methods) - 364usize];
2177+
["Offset of field: _jl_module_t::export_set_changed_since_require_world"]
2178+
[::std::mem::offset_of!(_jl_module_t, export_set_changed_since_require_world) - 365usize];
2179+
["Offset of field: _jl_module_t::lock"][::std::mem::offset_of!(_jl_module_t, lock) - 368usize];
2180+
["Offset of field: _jl_module_t::hash"][::std::mem::offset_of!(_jl_module_t, hash) - 384usize];
21752181
};
21762182
pub type jl_module_t = _jl_module_t;
21772183
#[repr(C)]
@@ -2570,13 +2576,6 @@ const _: () = {
25702576
[::std::mem::align_of::<std_atomic<i16>>() - 2usize];
25712577
};
25722578
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2573-
const _: () = {
2574-
["Size of template specialization: std_atomic_open0_jl_ptr_kind_union_t_close0"]
2575-
[::std::mem::size_of::<std_atomic<jl_ptr_kind_union_t>>() - 8usize];
2576-
["Align of template specialization: std_atomic_open0_jl_ptr_kind_union_t_close0"]
2577-
[::std::mem::align_of::<std_atomic<jl_ptr_kind_union_t>>() - 8usize];
2578-
};
2579-
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
25802579
const _: () = {
25812580
["Size of template specialization: std_atomic_open0_size_t_close0"]
25822581
[::std::mem::size_of::<std_atomic<usize>>() - 8usize];
@@ -2591,6 +2590,13 @@ const _: () = {
25912590
[::std::mem::align_of::<std_atomic<u32>>() - 4usize];
25922591
};
25932592
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
2593+
const _: () = {
2594+
["Size of template specialization: std_atomic_open0_int8_t_close0"]
2595+
[::std::mem::size_of::<std_atomic<i8>>() - 1usize];
2596+
["Align of template specialization: std_atomic_open0_int8_t_close0"]
2597+
[::std::mem::align_of::<std_atomic<i8>>() - 1usize];
2598+
};
2599+
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
25942600
const _: () = {
25952601
["Size of template specialization: std_atomic_open0_intptr_t_close0"]
25962602
[::std::mem::size_of::<std_atomic<isize>>() - 8usize];

0 commit comments

Comments
 (0)