Skip to content

Commit 96e868b

Browse files
qinsoonmmtkgc-bot
andauthored
Add Java-specific constants from MMTk (#258)
Java-specific constants in MMTk are no longer public in mmtk/mmtk-core#1026. This PR duplicates the constants that are used in the binding. --------- Co-authored-by: mmtkgc-bot <[email protected]>
1 parent 53e60ad commit 96e868b

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

mmtk/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mmtk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ memoffset = "0.9.0"
3232
# - change branch
3333
# - change repo name
3434
# But other changes including adding/removing whitespaces in commented lines may break the CI.
35-
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "39d237189fdfa22873eeb529f3e97b7578d9b246" }
35+
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "b06619982f3cee271e453a555f48b613f3eba2f6" }
3636
# Uncomment the following to build locally
3737
# mmtk = { path = "../repos/mmtk-core" }
3838

mmtk/src/abi.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ use std::fmt;
1111
use std::sync::atomic::AtomicUsize;
1212
use std::{mem, slice};
1313

14+
// These are some Java specific constants that were in MMTk.
15+
// As we plan to remove them from MMTk, they are moved here.
16+
// We could further investigae if we really need them in the OpenJDK binding.
17+
18+
pub const LOG_BYTES_IN_INT: u8 = 2;
19+
pub const BYTES_IN_INT: usize = 1 << LOG_BYTES_IN_INT;
20+
pub const LOG_BYTES_IN_LONG: u8 = 3;
21+
pub const BYTES_IN_LONG: usize = 1 << LOG_BYTES_IN_LONG;
22+
pub const LOG_BITS_IN_LONG: u8 = LOG_BITS_IN_BYTE + LOG_BYTES_IN_LONG;
23+
pub const BITS_IN_LONG: usize = 1 << LOG_BITS_IN_LONG;
24+
1425
#[repr(i32)]
1526
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
1627
#[allow(dead_code)]

mmtk/src/edges.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ use std::{
33
sync::atomic::{AtomicBool, AtomicUsize, Ordering},
44
};
55

6+
use super::abi::LOG_BYTES_IN_INT;
67
use atomic::Atomic;
78
use mmtk::{
8-
util::{
9-
constants::{LOG_BYTES_IN_INT, LOG_BYTES_IN_WORD},
10-
Address, ObjectReference,
11-
},
9+
util::{constants::LOG_BYTES_IN_WORD, Address, ObjectReference},
1210
vm::edge_shape::{Edge, MemorySlice},
1311
};
1412

0 commit comments

Comments
 (0)