Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .buildbot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ROOT_DIR=$(realpath $(pwd))

# What git commit hash of yklua & ykcbf will we test in buildbot?
YKLUA_REPO="https://github.com/ykjit/yklua.git"
YKLUA_COMMIT="484deee46c9a26ca32434f7fc0b992b97cbcd855"
YKLUA_COMMIT="c94e6feb51a362148951722fcc9ce231b58bb923"
YKCBF_REPO="https://github.com/ykjit/ykcbf.git"
YKCBF_COMMIT="431b92593180e1e376d08ecf383c4a1ab8473b3d"

Expand Down
6 changes: 3 additions & 3 deletions tests/c/swt_module_clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
// ...
// %{{dec_ptr}}: ptr = load %{{dec_addr}}
// %{{i}}: i32 = load %{{_}}
// %{{_}}: i32 = icall %{{dec_ptr}}(%{{i}})
// %{{_}}: i32 = icall %{{dec_ptr}}(%{{i}})...
// ...
// --- End aot ---
// --- Begin jit-pre-opt ---
// ...
// %{{_}}: i32 = icall %{{_}}(%{{_}})
// %{{_}}: i32 = icall %{{_}}(%{{_}})...
// ...
// --- End jit-pre-opt ---
// --- Begin jit-post-opt ---
// ...
// %{{_}}: i32 = icall %{{_}}(%{{_}})
// %{{_}}: i32 = icall %{{_}}(%{{_}})...
// ...
// --- End jit-post-opt ---
// 3
Expand Down
18 changes: 9 additions & 9 deletions tests/ir_lowering/unsupported_variants.ll
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
; %{{_}}: ?ty<<4 x i32>> = unimplemented << %{{15}} = add <4 x i32> %{{44}}, %{{44}}>>
; br bb3
; bb3:
; %{{_}}: i32 = unimplemented << %{{17}} = call i32 @f(i32 swiftself 5)>>
; %{{_}}: i32 = unimplemented << %{{18}} = call inreg i32 @f(i32 5)>>
; %{{_}}: i32 = unimplemented << %{{19}} = call i32 @f(i32 5) #{{0}}>>
; %{{_}}: float = unimplemented << %{{20}} = call nnan float @g()>>
; %{{_}}: i32 = unimplemented << %{{21}} = call ghccc i32 @f(i32 5)>>
; %{{_}}: i32 = unimplemented << %{{22}} = call i32 @f(i32 5) [ "kcfi"(i32 1234) ]>>
; %{{_}}: ptr = unimplemented << %{{23}} = call addrspace(6) ptr @p()>>
; %{{_}}: i32 = unimplemented << %{{17}} = call i32 @f(i32 swiftself 5) <note: swiftself param attr>>>
; %{{_}}: i32 = unimplemented << %{{18}} = call inreg i32 @f(i32 5) <note: inreg ret attr>>>
; %{{_}}: i32 = unimplemented << %{{19}} = call i32 @f(i32 5) #{{0}} <note: alignstack(8) fn attr>>>
; %{{_}}: float = unimplemented << %{{20}} = call nnan float @g() <note: fastmath>>>
; %{{_}}: i32 = unimplemented << %{{21}} = call ghccc i32 @f(i32 5) <note: cconv>>>
; %{{_}}: i32 = unimplemented << %{{22}} = call i32 @f(i32 5) [ "kcfi"(i32 1234) ] <note: bundles>>>
; %{{_}}: ptr = unimplemented << %{{23}} = call addrspace(6) ptr @p() <note: addrspace>>>
; br bb4
; bb4:
; %{{_}}: ?ty<<8 x i8>> = unimplemented << %{{26}} = ptrtoint <8 x ptr> %{{ptrs}} to <8 x i8>>>
Expand All @@ -36,7 +36,7 @@
; br bb6
; bb6:
; %{{_}}: i32 = unimplemented << %{{_}} = load atomic i32, ptr %{{_}} acquire, align 4>>
; %{{_}}: i32 = unimplemented << %{{_}} = load i32, ptr addrspace(10) %{{_}}, align 4>>
; %{{_}}: i32 = unimplemented << %{{_}} = load i32, ptr addrspace(10) %{{_}}, align 4 <note: addrspace>>>
; %{{_}}: i32 = unimplemented << %{{_}} = load i32, ptr %{{_}}, align 2>>
; br ...
; ...
Expand All @@ -45,7 +45,7 @@
; br bb11
; bb11:
; unimplemented << store atomic i32 0, ptr %0 release, align 4>>
; unimplemented << store i32 0, ptr addrspace(10) %5, align 4>>
; unimplemented << store i32 0, ptr addrspace(10) %5, align 4 <note: addrspace>>>
; unimplemented << store i32 0, ptr %0, align 2>>
; ret
; }
Expand Down
16 changes: 16 additions & 0 deletions tests/lua/inline_indirect_call.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- ignore-if: test "$YKB_TRACER" = "swt"
-- Run-time:
-- env-var: YK_HOT_THRESHOLD=3
-- env-var: YKD_LOG=4
-- env-var: YKD_LOG_IR=jit-pre-opt
-- env-var: YKD_SERIALISE_COMPILATION=1

-- FIXME: I don't think there's any output we could easily check to ensure
-- luaB_assert has been inlined?

for i = 0, 100 do
A = {}
assert(A) -- causes an icall in the trace.
end

io.stderr:write("exit\n")
2 changes: 1 addition & 1 deletion tests/yklua
Submodule yklua updated 3 files
+9 −1 src/ldo.c
+1 −0 src/lfunc.c
+1 −0 src/lvm.c
2 changes: 1 addition & 1 deletion ykllvm
17 changes: 9 additions & 8 deletions ykrt/src/compile/jitc_yk/aot_ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,7 @@ pub(crate) enum Inst {
num_args: u32,
#[deku(count = "num_args")]
args: Vec<Operand>,
safepoint: DeoptSafepoint,
},
#[deku(id = "16")]
Select {
Expand Down Expand Up @@ -1087,13 +1088,6 @@ impl Inst {
}
}

pub(crate) fn is_mappable_call(&self, m: &Module) -> bool {
match self {
Self::Call { callee, .. } => !m.func(*callee).is_declaration(),
_ => false,
}
}

/// Returns whether `self` is a call to the control point.
pub(crate) fn is_control_point(&self, m: &Module) -> bool {
// FIXME: We don't really expect any other patchpoints here, but it would be nice to check
Expand Down Expand Up @@ -1332,13 +1326,20 @@ impl fmt::Display for DisplayableInst<'_> {
ftyidx: _,
callop,
args,
safepoint,
} => {
let args_s = args
.iter()
.map(|a| a.display(self.m).to_string())
.collect::<Vec<_>>()
.join(", ");
write!(f, "icall {}({})", callop.display(self.m), args_s)
write!(
f,
"icall {}({}) {}",
callop.display(self.m),
args_s,
safepoint.display(self.m)
)
}
Inst::Select {
cond,
Expand Down
28 changes: 27 additions & 1 deletion ykrt/src/compile/jitc_yk/jit_ir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ impl Module {
/// If `iidx` points to a `Const`, `Copy`, or `Tombstone` instruction.
pub(crate) fn inst(&self, iidx: InstIdx) -> Inst {
match self.insts[usize::from(iidx)] {
Inst::Const(_) | Inst::Copy(_) | Inst::Tombstone => todo!(),
Inst::Const(_) | Inst::Copy(_) | Inst::Tombstone => {
todo!("{:?}", self.insts[usize::from(iidx)])
}
x => x,
}
}
Expand Down Expand Up @@ -1296,6 +1298,24 @@ impl Operand {
f(*iidx)
}
}

/// If self is [Operand::Var] and references a [Inst::Copy], recursively search until a
/// non-`Copy` instruction is found.
pub(crate) fn decopy(&self, m: &Module) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a docstring. I think "If self is Operand::Var and references a Copy, recursively search until a non-Copy instruction is found." or similar will do.

let mut ret = self.clone();
loop {
match ret {
Self::Var(iidx) => {
if let Inst::Copy(next_iidx) = m.inst_raw(iidx) {
ret = Operand::Var(next_iidx);
} else {
return ret;
}
}
Self::Const(_) => return ret,
}
}
}
}

pub(crate) struct DisplayableOperand<'a> {
Expand Down Expand Up @@ -2030,7 +2050,13 @@ impl Inst {
///
/// `%1`, `%2`, and `%3` are all "decopy equal" to each other, but `%4` is not "decopy equal"
/// to any other instruction.
///
/// # Panics
///
/// If either `self` or `other` are `Inst::Copy`.
pub(crate) fn decopy_eq(&self, m: &Module, other: Inst) -> bool {
assert!(!matches!(self, Inst::Copy(..)));
assert!(!matches!(other, Inst::Copy(..)));
if std::mem::discriminant(self) != std::mem::discriminant(&other) {
return false;
}
Expand Down
Loading