diff --git a/src/assembler.h b/src/assembler.h index 549e7cad2b..fa2e9be88c 100644 --- a/src/assembler.h +++ b/src/assembler.h @@ -259,7 +259,7 @@ class Assembler { virtual int stack() = 0; virtual int thread() = 0; - virtual int returnLow() = 0; + virtual int returnLow(unsigned size) = 0; virtual int returnHigh() = 0; virtual bool condensedAddressing() = 0; diff --git a/src/compile.cpp b/src/compile.cpp index 0d019378b5..8a7d61518b 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -5713,7 +5713,7 @@ compileThunks(MyThread* t, Allocator* allocator, MyProcessor* p, a->popFrame(); - Assembler::Register result(t->arch->returnLow()); + Assembler::Register result(t->arch->returnLow(BytesPerWord)); a->apply(Jump, BytesPerWord, RegisterOperand, &result); a->endBlock(false)->resolve(0, 0); diff --git a/src/compiler.cpp b/src/compiler.cpp index a9c2443569..3804f01823 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -2322,7 +2322,7 @@ class CallEvent: public Event { clean(c, this, stackBefore, localsBefore, reads, popIndex); if (resultSize and live(result)) { - addSite(c, result, registerSite(c, c->arch->returnLow())); + addSite(c, result, registerSite(c, c->arch->returnLow(resultSize))); if (resultSize > BytesPerWord and live(result->high)) { addSite(c, result->high, registerSite(c, c->arch->returnHigh())); } @@ -2357,7 +2357,7 @@ class ReturnEvent: public Event { Event(c), value(value) { if (value) { - addRead(c, this, value, fixedRegisterRead(c, c->arch->returnLow())); + addRead(c, this, value, fixedRegisterRead(c, c->arch->returnLow(size))); if (size > BytesPerWord) { addRead(c, this, value->high, fixedRegisterRead(c, c->arch->returnHigh())); diff --git a/src/x86.cpp b/src/x86.cpp index bcf058d78e..5665c4b6c2 100644 --- a/src/x86.cpp +++ b/src/x86.cpp @@ -1997,10 +1997,14 @@ class MyArchitecture: public Assembler::Architecture { return rbx; } - virtual int returnLow() { + virtual int returnLow(unsigned) { return rax; } + virtual int returnHigh() { + return (BytesPerWord == 4 ? rdx : NoRegister); + } + virtual bool condensedAddressing() { return true; } @@ -2017,10 +2021,6 @@ class MyArchitecture: public Assembler::Architecture { } } - virtual int returnHigh() { - return (BytesPerWord == 4 ? rdx : NoRegister); - } - virtual unsigned argumentRegisterCount() { return (BytesPerWord == 4 ? 0 : 6); }