Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding GC: MMTk tag to Julia's banner when building with MMTk #193

Merged
merged 5 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mmtk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ 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 = "7a953be76af34dee24e17cf2b33ba5fb0a7eac02"
julia_repo = "https://github.com/udesou/julia.git"
julia_version = "abe8d0c741a62c09cef57b85333da607a7e595fe"

[lib]
crate-type = ["cdylib"]

[build-dependencies]
cc = "*"
built = "*"
built = { version = "*", features = ["git2"] }
bindgen = "*"

[profile.release]
Expand Down
1 change: 1 addition & 0 deletions mmtk/api/mmtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ extern void mmtk_runtime_panic(void);
extern void mmtk_unreachable(void);
extern unsigned char mmtk_pin_object(void* obj);
extern bool mmtk_is_pinned(void* obj);
extern const char* get_mmtk_version(void);

extern void mmtk_set_vm_space(void* addr, size_t size);
extern void mmtk_immortal_region_post_alloc(void* addr, size_t size);
Expand Down
2 changes: 2 additions & 0 deletions mmtk/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,6 @@ fn main() {
bindings
.write_to_file("src/julia_types.rs")
.expect("Couldn't write bindings!");

built::write_built_file().expect("Failed to acquire build-time information");
}
7 changes: 7 additions & 0 deletions mmtk/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,3 +504,10 @@ pub extern "C" fn mmtk_unpin_object(_object: ObjectReference) -> bool {
pub extern "C" fn mmtk_is_pinned(_object: ObjectReference) -> bool {
false
}

#[no_mangle]
pub extern "C" fn get_mmtk_version() -> *const c_char {
crate::build_info::MMTK_JULIA_FULL_VERSION_STRING
.as_c_str()
.as_ptr() as _
}
18 changes: 18 additions & 0 deletions mmtk/src/build_info.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use std::ffi::CString;

mod raw {
// The include imports a full list of the constants in built.rs from https://docs.rs/built/latest/built/index.html
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}

lazy_static! {
// Owned string for the binding version, such as MMTk Julia 0.14.0 (cfc755f-dirty)
static ref BINDING_VERSION_STRING: String = match (raw::GIT_COMMIT_HASH, raw::GIT_DIRTY) {
(Some(hash), Some(dirty)) => format!("Built with MMTk Julia {} ({}{})", raw::PKG_VERSION, hash.split_at(7).0, if dirty { "-dirty" } else { "" }),
(Some(hash), None) => format!("Built with MMTk Julia {} ({}{})", raw::PKG_VERSION, hash.split_at(7).0, "-?"),
_ => format!("Built with MMTk Julia {}", raw::PKG_VERSION),
};
// Owned string for both binding and core version.
#[derive(Debug)]
pub static ref MMTK_JULIA_FULL_VERSION_STRING: CString = CString::new(format!("{}, using {}", *BINDING_VERSION_STRING, *mmtk::build_info::MMTK_FULL_BUILD_INFO)).unwrap();
}
1 change: 1 addition & 0 deletions mmtk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::sync::{Arc, Condvar, Mutex, RwLock};

pub mod active_plan;
pub mod api;
mod build_info;
pub mod collection;
pub mod object_model;
pub mod reference_glue;
Expand Down
Loading