From aef5acce844b021ecfbb69b1b1d31f7c90fcd3e8 Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Wed, 30 Apr 2014 22:41:47 -0600 Subject: [PATCH] add flavor type check to Compiler::store --- src/codegen/compiler.cpp | 2 ++ src/compile.cpp | 28 ++++++++-------------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/codegen/compiler.cpp b/src/codegen/compiler.cpp index 1e15fedfce..f8784106bb 100644 --- a/src/codegen/compiler.cpp +++ b/src/codegen/compiler.cpp @@ -2598,6 +2598,8 @@ class MyCompiler: public Compiler { ir::Type dstType, Operand* dst) { + assert(&c, srcType.flavor() == static_cast(src)->type.flavor()); + // assert(&c, dstType.flavor() == static_cast(dst)->type.flavor()); appendMove(&c, lir::Move, srcType.size(), diff --git a/src/compile.cpp b/src/compile.cpp index e65769b097..f47869e861 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -3818,15 +3818,9 @@ intrinsic(MyThread* t, Frame* frame, object target) Compiler::Operand* value = frame->popInt(); Compiler::Operand* address = popLongAddress(frame); frame->popObject(); - c->store(types.address, - value, - types.i4, - c->memory( - address, - MATCH(methodName(t, target), "putInt") ? types.i4 : types.f4, - 0, - 0, - 1)); + ir::Type type = MATCH(methodName(t, target), "putInt") ? types.i4 + : types.f4; + c->store(type, value, type, c->memory(address, type, 0, 0, 1)); return true; } else if ((MATCH(methodName(t, target), "getLong") and MATCH(methodSpec(t, target), "(J)J")) @@ -3854,15 +3848,9 @@ intrinsic(MyThread* t, Frame* frame, object target) Compiler::Operand* value = frame->popLong(); Compiler::Operand* address = popLongAddress(frame); frame->popObject(); - c->store(types.i8, - value, - types.i8, - c->memory(address, - MATCH(methodName(t, target), "putLong") ? types.i4 - : types.f4, - 0, - 0, - 1)); + ir::Type type = MATCH(methodName(t, target), "putLong") ? types.i8 + : types.f8; + c->store(type, value, type, c->memory(address, type, 0, 0, 1)); return true; } else if (MATCH(methodName(t, target), "getAddress") and MATCH(methodSpec(t, target), "(J)J")) @@ -4240,7 +4228,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, } break; case fastore: - c->store(types.address, + c->store(types.f4, value, types.f4, c->memory(array, types.f4, TargetArrayBody, index, 4)); @@ -5861,7 +5849,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, case FloatField: c->store( - types.address, + types.f4, value, types.f4, c->memory(