Skip to content

Commit

Permalink
Move to stable Rust. No longer get toolchain version in build.xml (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
qinsoon authored Mar 31, 2022
1 parent bcdf8e2 commit 078c0ec
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
9 changes: 3 additions & 6 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
<property name="rvm-binding.tools" location="${config.third-party-heap}/jikesrvm/tools"/>
<property name="mmtk-binding.dir" location="${config.third-party-heap}/mmtk"/>
<property environment="env"/>
<!-- use nightly if RUSTUP_TOOLCHAIN is not set -->
<condition property="rust-toolchain" value="+${env.RUSTUP_TOOLCHAIN}" else="+nightly">
<isset property="env.RUSTUP_TOOLCHAIN"/>
</condition>

<!-- Generate a few files that will be used by Rust mmtk -->
<target name="gen-jtoc">
Expand Down Expand Up @@ -44,12 +40,13 @@
<contains string="${rust.args}" substring="release"/>
</condition>
<echo message="Build Rust MMTk ${mmtk-binding.dir} to ${mmtk-binding.build}"/>
<echo message="toolchain: ${rust-toolchain}"/>
<exec executable="cargo" dir="${mmtk-binding.dir}" failonerror="true">
<arg value="version"/>
</exec>
<exec executable="/usr/bin/as" failonerror="true">
<arg line="--32 -o ${build.base}/${target.obj-prefix}glue${target.obj-ext} -I ${mmtk-binding.dir}/src ${mmtk-binding.dir}/src/glue.asm"/>
</exec>
<exec executable="cargo" dir="${mmtk-binding.dir}" failonerror="true">
<arg value="${rust-toolchain}"/>
<arg value="rustc"/>
<arg value="--manifest-path=${mmtk-binding.dir}/Cargo.toml"/>
<arg value="--target=i686-unknown-linux-gnu"/>
Expand Down
2 changes: 1 addition & 1 deletion mmtk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ log = {version = "0.4", features = ["max_level_trace", "release_max_level_off"]
# - change branch/rev
# - change repo name
# But other changes including adding/removing whitespaces in commented lines may break the CI.
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "cd6d8984c10c294c991dcd5f154ce41073c06ab9" }
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "cacded40b7622e97dea56a83179aaa6af42920d0" }
# Uncomment the following to build locally - if you change the path locally, do not commit the change in a PR
# mmtk = { path = "../repos/mmtk-core" }

Expand Down
2 changes: 1 addition & 1 deletion mmtk/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2022-02-11
1.59.0
1 change: 0 additions & 1 deletion mmtk/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(vec_into_raw_parts)]
extern crate libc;
extern crate mmtk;
#[macro_use]
Expand Down
8 changes: 7 additions & 1 deletion mmtk/src/scanning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ pub(crate) extern "C" fn create_process_edges_work<W: ProcessEdgesWork<VM = Jike
W::new(buf, false, &SINGLETON),
);
}
let (ptr, _length, capacity) = Vec::with_capacity(W::CAPACITY).into_raw_parts();
let (ptr, _length, capacity) = {
// TODO: Use Vec::into_raw_parts() when the method is available.
use std::mem::ManuallyDrop;
let new_vec = Vec::with_capacity(W::CAPACITY);
let mut me = ManuallyDrop::new(new_vec);
(me.as_mut_ptr(), me.len(), me.capacity())
};
debug_assert_eq!(capacity, W::CAPACITY);
ptr
}
Expand Down

0 comments on commit 078c0ec

Please sign in to comment.