From f6bc51647e488ae3267c2f901fec022a7a027fcf Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Sat, 3 May 2014 20:10:55 -0600 Subject: [PATCH] add type assert in Compiler::store, fix ensuing problems --- src/codegen/compiler.cpp | 1 + src/compile.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/codegen/compiler.cpp b/src/codegen/compiler.cpp index e833a1d591..aa1eecdfe9 100644 --- a/src/codegen/compiler.cpp +++ b/src/codegen/compiler.cpp @@ -2595,6 +2595,7 @@ class MyCompiler: public Compiler { virtual void store(ir::Type srcType, ir::Value* src, ir::Value* dst) { + assert(&c, srcType == src->type); assert(&c, srcType.flavor() == src->type.flavor()); assert(&c, srcType.flavor() == dst->type.flavor()); assert(&c, diff --git a/src/compile.cpp b/src/compile.cpp index cc83db899d..ec8afa02e0 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -3790,7 +3790,7 @@ intrinsic(MyThread* t, Frame* frame, object target) ir::Value* value = frame->popInt(); ir::Value* address = popLongAddress(frame); frame->popObject(); - c->store(types.address, value, c->memory(address, types.i1)); + c->store(types.i4, value, c->memory(address, types.i1)); return true; } else if ((MATCH(methodName(t, target), "getShort") and MATCH(methodSpec(t, target), "(J)S")) @@ -3810,7 +3810,7 @@ intrinsic(MyThread* t, Frame* frame, object target) ir::Value* value = frame->popInt(); ir::Value* address = popLongAddress(frame); frame->popObject(); - c->store(types.address, value, c->memory(address, types.i2)); + c->store(types.i4, value, c->memory(address, types.i2)); return true; } else if ((MATCH(methodName(t, target), "getInt") and MATCH(methodSpec(t, target), "(J)I")) @@ -4257,20 +4257,20 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, break; case iastore: - c->store(types.address, + c->store(types.i4, value, c->memory(array, types.i4, TargetArrayBody, index)); break; case bastore: - c->store(types.address, + c->store(types.i4, value, c->memory(array, types.i1, TargetArrayBody, index)); break; case castore: case sastore: - c->store(types.address, + c->store(types.i4, value, c->memory(array, types.i2, TargetArrayBody, index)); break;