fix some return type & intrinsic typing

This commit is contained in:
Joshua Warner 2014-05-02 08:42:41 -06:00
parent cb7f570f20
commit 7b0d577430
2 changed files with 14 additions and 19 deletions

View File

@ -2667,16 +2667,17 @@ class MyCompiler: public Compiler {
ir::Value* src, ir::Value* src,
ir::Type dstType) ir::Type dstType)
{ {
assert(&c, dstType.size() >= TargetBytesPerWord);
assert(&c, srcType.flavor() == dstType.flavor()); assert(&c, srcType.flavor() == dstType.flavor());
assert(&c, src->type.flavor() == dstType.flavor());
Value* dst = value(&c, src->type); Value* dst = value(&c, dstType);
appendMove(&c, appendMove(&c,
signExtend == ir::SignExtend ? lir::Move : lir::MoveZ, signExtend == ir::SignExtend ? lir::Move : lir::MoveZ,
srcType.size(), srcType.size(),
srcType.size(), srcType.size(),
static_cast<Value*>(src), static_cast<Value*>(src),
dstType.size(), dstType.size() < TargetBytesPerWord ? TargetBytesPerWord
: dstType.size(),
dst); dst);
return dst; return dst;
} }

View File

@ -1367,10 +1367,10 @@ ir::Type operandTypeForFieldCode(Thread* t, unsigned code)
switch (code) { switch (code) {
case ByteField: case ByteField:
case BooleanField: case BooleanField:
return types.i1; return types.i4;
case CharField: case CharField:
case ShortField: case ShortField:
return types.i2; return types.i4;
case IntField: case IntField:
return types.i4; return types.i4;
case LongField: case LongField:
@ -3889,13 +3889,10 @@ intrinsic(MyThread* t, Frame* frame, object target)
{ {
ir::Value* address = popLongAddress(frame); ir::Value* address = popLongAddress(frame);
frame->popObject(); frame->popObject();
ir::Type type = MATCH(methodName(t, target), "getInt") ? types.i4
: types.f4;
frame->pushSmall( frame->pushSmall(
c->load(ir::SignExtend, c->load(ir::SignExtend, type, c->memory(address, type), type));
types.i4,
c->memory(address,
MATCH(methodName(t, target), "getInt") ? types.i4
: types.f4),
types.address));
return true; return true;
} else if ((MATCH(methodName(t, target), "putInt") } else if ((MATCH(methodName(t, target), "putInt")
and MATCH(methodSpec(t, target), "(JI)V")) and MATCH(methodSpec(t, target), "(JI)V"))
@ -3916,13 +3913,10 @@ intrinsic(MyThread* t, Frame* frame, object target)
{ {
ir::Value* address = popLongAddress(frame); ir::Value* address = popLongAddress(frame);
frame->popObject(); frame->popObject();
ir::Type type = MATCH(methodName(t, target), "getLong") ? types.i8
: types.f8;
frame->pushLarge( frame->pushLarge(
c->load(ir::SignExtend, c->load(ir::SignExtend, type, c->memory(address, type), type));
types.i8,
c->memory(address,
MATCH(methodName(t, target), "getLong") ? types.i8
: types.f8),
types.i8));
return true; return true;
} else if ((MATCH(methodName(t, target), "putLong") } else if ((MATCH(methodName(t, target), "putLong")
and MATCH(methodSpec(t, target), "(JJ)V")) and MATCH(methodSpec(t, target), "(JJ)V"))
@ -4414,7 +4408,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
c->load(ir::SignExtend, c->load(ir::SignExtend,
types.address, types.address,
c->memory(frame->popObject(), types.i4, TargetArrayLength), c->memory(frame->popObject(), types.i4, TargetArrayLength),
types.address)); types.i4));
} break; } break;
case astore: case astore:
@ -4753,7 +4747,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
ir::SignExtend, ir::SignExtend,
types.f4, types.f4,
c->memory(table, types.f4, targetFieldOffset(context, field)), c->memory(table, types.f4, targetFieldOffset(context, field)),
types.f8)); types.f4));
break; break;
case IntField: case IntField: