add call(Label)

This commit is contained in:
MITSUNARI Shigeo 2014-03-16 20:58:37 +09:00
parent 879f7b8d4a
commit 16416c4c78
2 changed files with 11 additions and 9 deletions

View File

@ -750,6 +750,7 @@ void testNewLabel()
jmp(label2);
L(exit);
}
Label callLabel;
{ // eax == 8
Label label1;
Label label2;
@ -773,6 +774,10 @@ void testNewLabel()
cmp(eax, 13);
je(label1);
}
call(callLabel);
ret();
L(callLabel);
inc(eax); // 16
ret();
}
};
@ -783,7 +788,7 @@ void testNewLabel()
if (grow) code.ready();
int (*f)() = code.getCode<int (*)()>();
int r = f();
if (r != 15) {
if (r != 16) {
printf("err %d %d\n", i, r);
}
}

View File

@ -1779,15 +1779,12 @@ public:
}
opModRM(*p1, *p2, (p1->isREG() && p2->isREG() && (p1->getBit() == p2->getBit())), p2->isMEM(), B10000110 | (p1->isBit(8) ? 0 : 1));
}
void call(const std::string& label)
{
opJmp(label, T_NEAR, 0, B11101000, 0);
}
void call(const std::string& label) { opJmp(label, T_NEAR, 0, B11101000, 0); }
// call(string label)
void call(const char *label) { call(std::string(label)); }
void call(const void *addr)
{
opJmpAbs(addr, T_NEAR, 0, B11101000);
}
void call(const Label& label) { opJmp(label, T_NEAR, 0, B11101000, 0); }
// call(function pointer)
void call(const void *addr) { opJmpAbs(addr, T_NEAR, 0, B11101000); }
// special case
void movd(const Address& addr, const Mmx& mmx)
{