mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
YJIT: Allow dev_nodebug to disasm release-mode code (#11198)
* YJIT: Allow dev_nodebug to disasm release-mode code * Revert "YJIT: Squash canary before falling back" This reverts commitf05ad373d8
. The stray canary issue should have been solved bydef7023ee4
, alleviating this codegen accommodation. * s/runtime_assertions/runtime_checks/ --------- Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
This commit is contained in:
parent
059535bd65
commit
2de8b5b805
Notes:
git
2024-07-18 20:02:05 +00:00
Merged-By: k0kubun <takashikkbn@gmail.com>
4 changed files with 12 additions and 13 deletions
|
@ -3916,17 +3916,17 @@ AS_CASE(["${YJIT_SUPPORT}"],
|
||||||
],
|
],
|
||||||
[dev], [
|
[dev], [
|
||||||
rb_rust_target_subdir=debug
|
rb_rust_target_subdir=debug
|
||||||
CARGO_BUILD_ARGS='--features stats,disasm'
|
CARGO_BUILD_ARGS='--features disasm,runtime_checks'
|
||||||
AC_DEFINE(RUBY_DEBUG, 1)
|
AC_DEFINE(RUBY_DEBUG, 1)
|
||||||
],
|
],
|
||||||
[dev_nodebug], [
|
[dev_nodebug], [
|
||||||
rb_rust_target_subdir=dev_nodebug
|
rb_rust_target_subdir=dev_nodebug
|
||||||
CARGO_BUILD_ARGS='--profile dev_nodebug --features stats,disasm'
|
CARGO_BUILD_ARGS='--profile dev_nodebug --features disasm'
|
||||||
AC_DEFINE(YJIT_STATS, 1)
|
AC_DEFINE(YJIT_STATS, 1)
|
||||||
],
|
],
|
||||||
[stats], [
|
[stats], [
|
||||||
rb_rust_target_subdir=stats
|
rb_rust_target_subdir=stats
|
||||||
CARGO_BUILD_ARGS='--profile stats --features stats'
|
CARGO_BUILD_ARGS='--profile stats'
|
||||||
AC_DEFINE(YJIT_STATS, 1)
|
AC_DEFINE(YJIT_STATS, 1)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,16 @@ crate-type = ["staticlib"]
|
||||||
# written rationale. Optional For development and testing purposes
|
# written rationale. Optional For development and testing purposes
|
||||||
capstone = { version = "0.12.0", optional = true }
|
capstone = { version = "0.12.0", optional = true }
|
||||||
|
|
||||||
[features]
|
|
||||||
# NOTE: Development builds select a set of these via configure.ac
|
# NOTE: Development builds select a set of these via configure.ac
|
||||||
# For debugging, `make V=1` shows exact cargo invocation.
|
# For debugging, `make V=1` shows exact cargo invocation.
|
||||||
|
[features]
|
||||||
|
# Support --yjit-dump-disasm and RubyVM::YJIT.disasm using libcapstone.
|
||||||
disasm = ["capstone"]
|
disasm = ["capstone"]
|
||||||
stats = []
|
# Modify generated code for assertions, e.g. and poison value in PC
|
||||||
|
# for C method calls and stack canary. This is managed separately
|
||||||
|
# from cfg!(debug_assertions) so that we can see disasm of the code
|
||||||
|
# that would run in the release mode.
|
||||||
|
runtime_checks = []
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
opt-level = 0
|
opt-level = 0
|
||||||
|
|
|
@ -1759,7 +1759,7 @@ impl Assembler {
|
||||||
|
|
||||||
// If the slot is already used, which is a valid optimization to avoid spills,
|
// If the slot is already used, which is a valid optimization to avoid spills,
|
||||||
// give up the verification.
|
// give up the verification.
|
||||||
let canary_opnd = if cfg!(debug_assertions) && self.leaf_ccall && opnds.iter().all(|opnd|
|
let canary_opnd = if cfg!(feature = "runtime_checks") && self.leaf_ccall && opnds.iter().all(|opnd|
|
||||||
opnd.get_reg_opnd() != canary_opnd.get_reg_opnd()
|
opnd.get_reg_opnd() != canary_opnd.get_reg_opnd()
|
||||||
) {
|
) {
|
||||||
asm_comment!(self, "set stack canary");
|
asm_comment!(self, "set stack canary");
|
||||||
|
|
|
@ -6587,7 +6587,7 @@ fn gen_send_cfunc(
|
||||||
cme,
|
cme,
|
||||||
recv,
|
recv,
|
||||||
sp,
|
sp,
|
||||||
pc: if cfg!(debug_assertions) {
|
pc: if cfg!(feature = "runtime_checks") {
|
||||||
Some(!0) // Poison value. Helps to fail fast.
|
Some(!0) // Poison value. Helps to fail fast.
|
||||||
} else {
|
} else {
|
||||||
None // Leave PC uninitialized as cfuncs shouldn't read it
|
None // Leave PC uninitialized as cfuncs shouldn't read it
|
||||||
|
@ -8385,12 +8385,6 @@ fn gen_send_dynamic<F: Fn(&mut Assembler) -> Opnd>(
|
||||||
// Save PC and SP to prepare for dynamic dispatch
|
// Save PC and SP to prepare for dynamic dispatch
|
||||||
jit_prepare_non_leaf_call(jit, asm);
|
jit_prepare_non_leaf_call(jit, asm);
|
||||||
|
|
||||||
// Squash stack canary that might be left over from elsewhere
|
|
||||||
assert_eq!(false, asm.get_leaf_ccall());
|
|
||||||
if cfg!(debug_assertions) {
|
|
||||||
asm.store(asm.ctx.sp_opnd(0), 0.into());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dispatch a method
|
// Dispatch a method
|
||||||
let ret = vm_sendish(asm);
|
let ret = vm_sendish(asm);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue