Skip to content

Commit

Permalink
Remove X64::CodeGenerator::ifBlock and JccBlock
Browse files Browse the repository at this point in the history
ifBlock() is the same as a different utility function called
ifThen, and only had one callsite.

JccBlock only had one callsite, and can be done cleanly with
lambda-style

Reviewed By: @swtaarrs

Differential Revision: D1276611
  • Loading branch information
edwinsmith authored and sgolemon committed Apr 16, 2014
1 parent 56c6f68 commit 03ef863
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 39 deletions.
4 changes: 2 additions & 2 deletions hphp/runtime/vm/jit/code-gen-x64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5877,8 +5877,8 @@ void CodeGenerator::cgDbgAssertRetAddr(IRInstruction* inst) {
m_as.emitImmReg(imm, m_rScratch);
m_as.cmpq(m_rScratch, *rsp);
}
ifBlock(CC_NE, [&](Asm& a) {
a.ud2();
ifThen(m_as, CC_NE, [&] {
m_as.ud2();
});
}

Expand Down
8 changes: 0 additions & 8 deletions hphp/runtime/vm/jit/code-gen-x64.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,6 @@ struct CodeGenerator {
}
}

template <class Then>
void ifBlock(ConditionCode cc, Then thenBlock) {
Label done;
m_as.jcc8(ccNegate(cc), done);
thenBlock(m_as);
asm_label(m_as, done);
}

// Generate an if-then-else block
template <class Then, class Else>
void ifThenElse(Asm& a, ConditionCode cc, Then thenBlock, Else elseBlock) {
Expand Down
9 changes: 5 additions & 4 deletions hphp/runtime/vm/jit/func-prologues-x64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,11 @@ SrcKey emitPrologueWork(Func* func, int nPassed) {

if (!(func->attrs() & AttrStatic)) {
a.shrq(1, rAsm);
JccBlock<CC_BE> ifRealThis(a);
a.shlq(1, rAsm);
// XXX can objects be static?
emitIncRefCheckNonStatic(a, rAsm, KindOfObject);
ifThen(a, CC_NBE, [&] {
a.shlq(1, rAsm);
// XXX can objects be static?
emitIncRefCheckNonStatic(a, rAsm, KindOfObject);
});
}

// Put in the correct context
Expand Down
25 changes: 0 additions & 25 deletions hphp/runtime/vm/jit/mc-generator-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,6 @@ struct Jcc32 {
}
};

// JccBlock --
// A raw condition-code block; assumes whatever comparison or ALU op
// that sets the Jcc has already executed.
template <ConditionCode Jcc, typename J=Jcc8>
struct JccBlock {
mutable X64Assembler* m_a;
TCA m_jcc;

explicit JccBlock(X64Assembler& a)
: m_a(&a) {
m_jcc = a.frontier();
J::branch(a, Jcc, m_a->frontier());
}

~JccBlock() {
if (m_a) {
J::patch(*m_a, m_jcc, m_a->frontier());
}
}

private:
JccBlock(const JccBlock&);
JccBlock& operator=(const JccBlock&);
};

// A CondBlock is an RAII structure for emitting conditional code. It
// compares the source register at fieldOffset with fieldValue, and
// conditionally branches over the enclosing block of assembly on the
Expand Down

0 comments on commit 03ef863

Please sign in to comment.