Skip to content

Commit 5c345ab

Browse files
committed
Expose an API for heap traversal.
Expose the `MMTK::enumerate_object` method for implementing heap traversal. That allows the Ruby VM to enable ObjectSpace.each_object and TracePoint. The test case whitelist is also updated to not exclude related test cases so that mmtk-core binding tests will use those test cases.
1 parent 2f453c7 commit 5c345ab

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

mmtk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ edition = "2021"
1212
# Metadata for the Ruby repository
1313
[package.metadata.ci-repos.ruby]
1414
repo = "mmtk/ruby" # This is used by actions/checkout, so the format is "owner/repo", not URL.
15-
rev = "8c5bd19b7a73c5156c4e2b9ee25cbf89c66816b8"
15+
rev = "482db1b960623260dcca01e82d36d38a6226c9bf"
1616

1717
[lib]
1818
name = "mmtk_ruby"

mmtk/src/api.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,15 @@ pub extern "C" fn mmtk_object_reference_write_post(
374374
ignored_target,
375375
)
376376
}
377+
378+
/// Enumerate objects. This function will call `callback(object, data)` for each object. It has
379+
/// undefined behavior if allocation or GC happens while this function is running.
380+
#[no_mangle]
381+
pub extern "C" fn mmtk_enumerate_objects(
382+
callback: extern "C" fn(ObjectReference, *mut libc::c_void),
383+
data: *mut libc::c_void,
384+
) {
385+
crate::mmtk().enumerate_objects(|object| {
386+
callback(object, data);
387+
})
388+
}

ruby-test-cases.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ test/ruby/test_integer.rb
5353
test/ruby/test_io_buffer.rb
5454
test/ruby/test_io_m17n.rb
5555
# test/ruby/test_io.rb XXXXX leaks?
56-
# test/ruby/test_iseq.rb XXXXX failures
56+
test/ruby/test_iseq.rb
5757
test/ruby/test_iterator.rb
5858
test/ruby/test_key_error.rb
5959
test/ruby/test_keyword.rb
@@ -75,8 +75,8 @@ test/ruby/test_nomethod_error.rb
7575
test/ruby/test_not.rb
7676
test/ruby/test_numeric.rb
7777
test/ruby/test_object.rb
78-
# test/ruby/test_objectspace.rb XXXX failures
79-
# test/ruby/test_optimization.rb XXXXX hard crash
78+
test/ruby/test_objectspace.rb
79+
test/ruby/test_optimization.rb
8080
test/ruby/test_pack.rb
8181
test/ruby/test_parse.rb
8282
test/ruby/test_path.rb
@@ -98,7 +98,7 @@ test/ruby/test_require.rb
9898
# test/ruby/test_rubyoptions.rb XXXX failures and crashes
9999
# test/ruby/test_rubyvm_mjit.rb XXXXX query
100100
test/ruby/test_rubyvm.rb
101-
# test/ruby/test_settracefunc.rb XXXX failures
101+
test/ruby/test_settracefunc.rb
102102
test/ruby/test_signal.rb
103103
test/ruby/test_sleep.rb
104104
test/ruby/test_sprintf_comb.rb

0 commit comments

Comments
 (0)