Skip to content

Commit dfa2d98

Browse files
bors[bot]vext01
andauthored
12: Simple trace stitching r=ltratt a=vext01 Co-authored-by: Edd Barrett <[email protected]>
2 parents 0ee4d69 + 4f691cf commit dfa2d98

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

llvm/lib/Transforms/Yk/BlockDisambiguate.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@ class YkBlockDisambiguate : public ModulePass {
191191
std::vector<BasicBlock *> NewBBs;
192192
for (BasicBlock &BB : F) {
193193
Instruction *TI = BB.getTerminator();
194-
assert(!isa<IndirectBrInst>(TI)); // YKFIXME: not implemented.
194+
195+
// YKFIXME: not implemented.
196+
// https://github.com/ykjit/yk/issues/440
197+
assert(!isa<IndirectBrInst>(TI));
198+
195199
if (isa<BranchInst>(TI)) {
196200
BranchInst *BI = cast<BranchInst>(TI);
197201
for (unsigned SuccIdx = 0; SuccIdx < BI->getNumSuccessors();

llvm/lib/Transforms/Yk/ControlPoint.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@
6363
// value that indicates if we should start/stop tracing, or jump to machine
6464
// code etc.
6565
//
66-
// - Because we haven't yet implemented guards or trace stitching, a machine
67-
// code trace will always return to the interpreter after one full run of
68-
// the traced interpreter loop. This means that the JIT doesn't yet
69-
// correctly implement the right program semantics. When we have trace
70-
// stitching, a machine code trace will only return upon a guard failure.
66+
// - Guards are currently assumed to abort the program.
67+
// https://github.com/ykjit/yk/issues/443
7168
//
69+
// - The block that performs the call to JITted code branches back to itself
70+
// to achieve rudimentary trace stitching. The looping should really be
71+
// implemented in the JITted code itself so that it isn't necessary to
72+
// repeatedly enter and exit the JITted code.
73+
// https://github.com/ykjit/yk/issues/442
7274
//===----------------------------------------------------------------------===//
7375

7476
#include "llvm/Transforms/Yk/ControlPoint.h"
@@ -214,7 +216,7 @@ void createControlPoint(Module &Mod, Function *F, std::vector<Value *> LiveVars,
214216
CallInst *CTResult = Builder.CreateCall(FType, CastTrace, F->getArg(1));
215217
createJITStatePrint(Builder, &Mod, "exit-jit-code");
216218
CTResult->setTailCall(true);
217-
Builder.CreateBr(BBReturn);
219+
Builder.CreateBr(BBExecuteTrace);
218220

219221
// Create block that decides when to stop tracing.
220222
Builder.SetInsertPoint(BBTracing);
@@ -243,7 +245,6 @@ void createControlPoint(Module &Mod, Function *F, std::vector<Value *> LiveVars,
243245
Value *YkCtrlPointVars = F->getArg(1);
244246
PHINode *Phi = Builder.CreatePHI(YkCtrlPointStruct, 3);
245247
Phi->addIncoming(YkCtrlPointVars, BBHasTrace);
246-
Phi->addIncoming(CTResult, BBExecuteTrace);
247248
Phi->addIncoming(YkCtrlPointVars, BBTracing);
248249
Phi->addIncoming(YkCtrlPointVars, BBHasNoTrace);
249250
Phi->addIncoming(YkCtrlPointVars, BBStopTracing);

0 commit comments

Comments
 (0)