use ir::Type in Compiler::return_

This commit is contained in:
Joshua Warner 2014-04-30 20:01:14 -06:00 committed by Joshua Warner
parent 587b1e3eda
commit d9fee1025c
3 changed files with 30 additions and 10 deletions

View File

@ -106,7 +106,8 @@ class Compiler {
OperandType resultType,
unsigned argumentFootprint) = 0;
virtual void return_(unsigned size, Operand* value) = 0;
virtual void return_(ir::Type type, Operand* value) = 0;
virtual void return_() = 0;
virtual void initLocal(unsigned size, unsigned index, OperandType type) = 0;
virtual void initLocalsFromLogicalIp(unsigned logicalIp) = 0;

View File

@ -2478,8 +2478,17 @@ class MyCompiler: public Compiler {
return result;
}
virtual void return_(unsigned size, Operand* value) {
appendReturn(&c, size, static_cast<Value*>(value));
virtual void return_(ir::Type type, Operand* value)
{
// TODO: once type information is flowed properly, enable this assert.
// Some time later, we can remove the parameter.
// assert(&c, static_cast<Value*>(value)->type == type);
appendReturn(&c, type.size(), static_cast<Value*>(value));
}
virtual void return_()
{
appendReturn(&c, 0, 0);
}
virtual void initLocal(unsigned footprint, unsigned index, OperandType type)
@ -2498,7 +2507,7 @@ class MyCompiler: public Compiler {
lowIndex = index;
} else {
lowIndex = index + 1;
highIndex = index;
highIndex = index;
}
if (TargetBytesPerWord == 4) {

View File

@ -4290,7 +4290,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
case areturn: {
handleExit(t, frame);
c->return_(TargetBytesPerWord, frame->popObject());
c->return_(types.address, frame->popObject());
} goto next;
case arraylength: {
@ -5179,10 +5179,15 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
frame->pushInt(c->binaryOp(lir::Remainder, 4, a, b));
} break;
case ireturn:
case ireturn: {
handleExit(t, frame);
c->return_(types.i4, frame->popInt());
}
goto next;
case freturn: {
handleExit(t, frame);
c->return_(4, frame->popInt());
c->return_(types.f4, frame->popInt());
} goto next;
case istore:
@ -5472,10 +5477,15 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
frame->pushLong(c->binaryOp(lir::Remainder, 8, a, b));
} break;
case lreturn:
case lreturn: {
handleExit(t, frame);
c->return_(types.i8, frame->popLong());
}
goto next;
case dreturn: {
handleExit(t, frame);
c->return_(8, frame->popLong());
c->return_(types.f8, frame->popLong());
} goto next;
case lshl:
@ -5887,7 +5897,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
}
handleExit(t, frame);
c->return_(0, 0);
c->return_();
goto next;
case sipush: