diff options
author | Alan Wu <[email protected]> | 2022-07-28 11:08:30 -0400 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2022-08-29 08:47:05 -0700 |
commit | 869b0ba6e00168d739830af766c3abb0dec01f12 (patch) | |
tree | b3aa712b59913cec94aacde99cead910075979d6 /yjit/src/utils.rs | |
parent | 6ab71a8598c6eece25975ca262eb880462e47b06 (diff) |
Minor cleanups (https://github.com/Shopify/ruby/pull/345)
* Move allocation into Assembler::pos_marker
We wanted to do this to begin with but didn't because we were confused
about the lifetime parameter. It's actually talking about the lifetime
of the references that the closure captures. Since all of our usages
capture no references (they use `move`), it's fine to put a `+ 'static`
here.
* Use optional token syntax for calling convention macro
* Explicitly request C ABI on ARM
It looks like the Rust calling convention for functions are the same as
the C ABI for now and it's unlikely to change, but it's easy for us to
be explicit here. I also tried saying `extern "aapcs"` but that
unfortunately doesn't work.
Diffstat (limited to 'yjit/src/utils.rs')
-rw-r--r-- | yjit/src/utils.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/yjit/src/utils.rs b/yjit/src/utils.rs index 5f42ba1fdb..bea57e4fc2 100644 --- a/yjit/src/utils.rs +++ b/yjit/src/utils.rs @@ -122,14 +122,12 @@ yjit_print_iseq(const rb_iseq_t *iseq) #[cfg(target_arch = "aarch64")] macro_rules! c_callable { - (fn $f:ident $args:tt -> $ret:ty $body:block) => { fn $f $args -> $ret $body }; - (fn $f:ident $args:tt $body:block) => { fn $f $args $body }; + (fn $f:ident $args:tt $(-> $ret:ty)? $body:block) => { extern "C" fn $f $args $(-> $ret)? $body }; } #[cfg(target_arch = "x86_64")] macro_rules! c_callable { - (fn $f:ident $args:tt -> $ret:ty $body:block) => { extern "sysv64" fn $f $args -> $ret $body }; - (fn $f:ident $args:tt $body:block) => { extern "sysv64" fn $f $args $body }; + (fn $f:ident $args:tt $(-> $ret:ty)? $body:block) => { extern "sysv64" fn $f $args $(-> $ret)? $body }; } pub(crate) use c_callable; |