From 69966f1d36c6ad0bef6defb3911adf6f235594bd Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Sat, 3 May 2014 19:49:56 -0600 Subject: [PATCH] add type assert in load, fix ensuing problems --- src/codegen/compiler.cpp | 1 + src/compile.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/codegen/compiler.cpp b/src/codegen/compiler.cpp index be62ca5904..156b79625b 100644 --- a/src/codegen/compiler.cpp +++ b/src/codegen/compiler.cpp @@ -2613,6 +2613,7 @@ class MyCompiler: public Compiler { { assert(&c, srcType.flavor() == dstType.flavor()); assert(&c, src->type.flavor() == dstType.flavor()); + assert(&c, src->type == srcType); Value* dst = value(&c, dstType); appendMove(&c, diff --git a/src/compile.cpp b/src/compile.cpp index 4ff08d7168..6cd2fe1878 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -4361,11 +4361,11 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, } goto next; case arraylength: { - frame->pushInt( - c->load(ir::SignExtend, - types.address, - c->memory(frame->popObject(), types.i4, TargetArrayLength), - types.i4)); + frame->pushInt(c->load( + ir::SignExtend, + types.address, + c->memory(frame->popObject(), types.address, TargetArrayLength), + types.i4)); } break; case astore: @@ -4679,7 +4679,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, frame->pushInt(c->load( ir::SignExtend, types.i1, - c->memory(table, types.i4, targetFieldOffset(context, field)), + c->memory(table, types.i1, targetFieldOffset(context, field)), types.i4)); break; @@ -4687,7 +4687,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, frame->pushInt(c->load( ir::ZeroExtend, types.i2, - c->memory(table, types.i4, targetFieldOffset(context, field)), + c->memory(table, types.i2, targetFieldOffset(context, field)), types.i4)); break; @@ -4695,7 +4695,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, frame->pushInt(c->load( ir::SignExtend, types.i2, - c->memory(table, types.i4, targetFieldOffset(context, field)), + c->memory(table, types.i2, targetFieldOffset(context, field)), types.i4)); break;