Commit 3cc1f4d8 authored by Kevin Modzelewski's avatar Kevin Modzelewski

doh these need to be incq not incl

parent 5f4d519b
......@@ -693,6 +693,70 @@ void Assembler::decl(Immediate imm) {
emitInt(imm.val, 4);
}
void Assembler::incq(Indirect mem) {
int src_idx = mem.base.regnum;
int rex = REX_W;
if (src_idx >= 8) {
rex |= REX_B;
src_idx -= 8;
}
assert(src_idx >= 0 && src_idx < 8);
if (rex)
emitRex(rex);
emitByte(0xff);
assert(-0x80 <= mem.offset && mem.offset < 0x80);
if (mem.offset == 0) {
emitModRM(0b00, 0, src_idx);
} else {
emitModRM(0b01, 0, src_idx);
emitByte(mem.offset);
}
}
void Assembler::decq(Indirect mem) {
int src_idx = mem.base.regnum;
int rex = REX_W;
if (src_idx >= 8) {
rex |= REX_B;
src_idx -= 8;
}
assert(src_idx >= 0 && src_idx < 8);
if (rex)
emitRex(rex);
emitByte(0xff);
assert(-0x80 <= mem.offset && mem.offset < 0x80);
if (mem.offset == 0) {
emitModRM(0b00, 1, src_idx);
} else {
emitModRM(0b01, 1, src_idx);
emitByte(mem.offset);
}
}
void Assembler::incq(Immediate imm) {
emitByte(0x48);
emitByte(0xff);
emitByte(0x04);
emitByte(0x25);
emitInt(imm.val, 4);
}
void Assembler::decq(Immediate imm) {
emitByte(0x48);
emitByte(0xff);
emitByte(0x0c);
emitByte(0x25);
emitInt(imm.val, 4);
}
void Assembler::call(Immediate imm) {
emitByte(0xe8);
emitInt(imm.val, 4);
......
......@@ -157,9 +157,12 @@ public:
void incl(Indirect mem);
void decl(Indirect mem);
void incl(Immediate mem);
void decl(Immediate mem);
void incq(Indirect mem);
void decq(Indirect mem);
void incq(Immediate mem);
void decq(Immediate mem);
void call(Immediate imm); // the value is the offset
void callq(Register reg);
......
......@@ -522,10 +522,10 @@ void Rewriter::_incref(RewriterVar* var) {
//llvm::ArrayRef<RewriterVar*>());
#ifdef Py_REF_DEBUG
//assembler->trap();
assembler->incl(assembler::Immediate(&_Py_RefTotal));
assembler->incq(assembler::Immediate(&_Py_RefTotal));
#endif
auto reg = var->getInReg();
assembler->incl(assembler::Indirect(reg, offsetof(Box, ob_refcnt)));
assembler->incq(assembler::Indirect(reg, offsetof(Box, ob_refcnt)));
// Doesn't call bumpUse, since this function is designed to be callable from other emitting functions.
// (ie the caller should call bumpUse)
......@@ -539,7 +539,7 @@ void Rewriter::_decref(RewriterVar* var) {
#ifdef Py_REF_DEBUG
//assembler->trap();
assembler->decl(assembler::Immediate(&_Py_RefTotal));
assembler->decq(assembler::Immediate(&_Py_RefTotal));
#endif
_setupCall(true, llvm::ArrayRef<RewriterVar*>(&var, 1), llvm::ArrayRef<RewriterVar*>(NULL, (int)0), assembler::RAX);
......@@ -548,7 +548,7 @@ void Rewriter::_decref(RewriterVar* var) {
auto reg = assembler::RDI;
//auto reg = var->getInReg();
assembler->decl(assembler::Indirect(reg, offsetof(Box, ob_refcnt)));
assembler->decq(assembler::Indirect(reg, offsetof(Box, ob_refcnt)));
{
assembler::ForwardJump jnz(*assembler, assembler::COND_NOT_ZERO);
//assembler->trap();
......
......@@ -954,7 +954,7 @@ void JitFragmentWriter::_emitRecordType(RewriterVar* type_recorder_var, Rewriter
assembler->mov(obj_cls_reg, last_seen_indirect);
assembler->movq(assembler::Immediate(0ul), last_seen_count);
}
assembler->incl(last_seen_count);
assembler->incq(last_seen_count);
type_recorder_var->bumpUse();
obj_cls_var->bumpUse();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment