# HG changeset patch # User Lukas Stadler # Date 1406034375 -7200 # Node ID a7d9b88ecd686b1fbf507ceca630fd9aba4c8487 # Parent 8a23eeeb7b064bcb2226905adc3894d07a2375ce use LIRKind in graalCodeInstaller, support compressed oops in frame states diff -r 8a23eeeb7b06 -r a7d9b88ecd68 src/share/vm/classfile/systemDictionary.hpp --- a/src/share/vm/classfile/systemDictionary.hpp Tue Jul 22 15:05:33 2014 +0200 +++ b/src/share/vm/classfile/systemDictionary.hpp Tue Jul 22 15:06:15 2014 +0200 @@ -238,6 +238,7 @@ GRAAL_ONLY(do_klass(NullConstant_klass, com_oracle_graal_api_meta_NullConstant, Graal)) \ GRAAL_ONLY(do_klass(ExceptionHandler_klass, com_oracle_graal_api_meta_ExceptionHandler, Graal)) \ GRAAL_ONLY(do_klass(Kind_klass, com_oracle_graal_api_meta_Kind, Graal)) \ + GRAAL_ONLY(do_klass(LIRKind_klass, com_oracle_graal_api_meta_LIRKind, Graal)) \ GRAAL_ONLY(do_klass(JavaMethod_klass, com_oracle_graal_api_meta_JavaMethod, Graal)) \ GRAAL_ONLY(do_klass(JavaType_klass, com_oracle_graal_api_meta_JavaType, Graal)) \ GRAAL_ONLY(do_klass(Value_klass, com_oracle_graal_api_meta_Value, Graal)) \ diff -r 8a23eeeb7b06 -r a7d9b88ecd68 src/share/vm/classfile/vmSymbols.hpp --- a/src/share/vm/classfile/vmSymbols.hpp Tue Jul 22 15:05:33 2014 +0200 +++ b/src/share/vm/classfile/vmSymbols.hpp Tue Jul 22 15:06:15 2014 +0200 @@ -322,6 +322,7 @@ GRAAL_ONLY(template(com_oracle_graal_api_meta_JavaMethod, "com/oracle/graal/api/meta/JavaMethod")) \ GRAAL_ONLY(template(com_oracle_graal_api_meta_JavaType, "com/oracle/graal/api/meta/JavaType")) \ GRAAL_ONLY(template(com_oracle_graal_api_meta_Kind, "com/oracle/graal/api/meta/Kind")) \ + GRAAL_ONLY(template(com_oracle_graal_api_meta_LIRKind, "com/oracle/graal/api/meta/LIRKind")) \ GRAAL_ONLY(template(com_oracle_graal_api_meta_Value, "com/oracle/graal/api/meta/Value")) \ GRAAL_ONLY(template(com_oracle_graal_api_code_Assumptions, "com/oracle/graal/api/code/Assumptions")) \ GRAAL_ONLY(template(com_oracle_graal_api_code_Assumptions_MethodContents, "com/oracle/graal/api/code/Assumptions$MethodContents")) \ diff -r 8a23eeeb7b06 -r a7d9b88ecd68 src/share/vm/graal/graalCodeInstaller.cpp --- a/src/share/vm/graal/graalCodeInstaller.cpp Tue Jul 22 15:05:33 2014 +0200 +++ b/src/share/vm/graal/graalCodeInstaller.cpp Tue Jul 22 15:06:15 2014 +0200 @@ -204,27 +204,36 @@ return new LocationValue(Location::new_stk_loc(Location::invalid, 0)); } - BasicType type = GraalRuntime::kindToBasicType(Kind::typeChar(Value::kind(value))); - Location::Type locationType = Location::normal; - if (type == T_OBJECT || type == T_ARRAY) locationType = Location::oop; + oop lirKind = Value::lirKind(value); + oop platformKind = LIRKind::platformKind(lirKind); + jint referenceMask = LIRKind::referenceMask(lirKind); + assert(referenceMask == 0 || referenceMask == 1, "unexpected referenceMask"); + bool reference = referenceMask == 1; + + BasicType type = GraalRuntime::kindToBasicType(Kind::typeChar(platformKind)); if (value->is_a(RegisterValue::klass())) { jint number = code_Register::number(RegisterValue::reg(value)); if (number < RegisterImpl::number_of_registers) { - if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE || type == T_ADDRESS) { + Location::Type locationType; + if (type == T_INT) { + locationType = reference ? Location::narrowoop : Location::int_in_long; + } else if (type == T_FLOAT) { locationType = Location::int_in_long; } else if (type == T_LONG) { - locationType = Location::lng; + locationType = reference ? Location::oop : Location::lng; } else { - assert(type == T_OBJECT || type == T_ARRAY, "unexpected type in cpu register"); + assert(type == T_OBJECT && reference, "unexpected type in cpu register"); + locationType = Location::oop; } ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_Register(number)->as_VMReg())); - if (type == T_LONG) { + if (type == T_LONG && !reference) { second = value; } return value; } else { assert(type == T_FLOAT || type == T_DOUBLE, "only float and double expected in xmm register"); + Location::Type locationType; if (type == T_FLOAT) { // this seems weird, but the same value is used in c1_LinearScan locationType = Location::normal; @@ -233,14 +242,14 @@ } #ifdef TARGET_ARCH_x86 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_XMMRegister(number - 16)->as_VMReg())); - if (type == T_DOUBLE) { + if (type == T_DOUBLE && !reference) { second = value; } return value; #else #ifdef TARGET_ARCH_sparc ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_FloatRegister(number)->as_VMReg())); - if (type == T_DOUBLE) { + if (type == T_DOUBLE && !reference) { second = value; } return value; @@ -250,41 +259,52 @@ #endif } } else if (value->is_a(StackSlot::klass())) { - if (type == T_DOUBLE) { + Location::Type locationType; + if (type == T_LONG) { + locationType = reference ? Location::oop : Location::lng; + } else if (type == T_INT) { + locationType = reference ? Location::narrowoop : Location::normal; + } else if (type == T_FLOAT) { + locationType = Location::normal; + } else if (type == T_DOUBLE) { locationType = Location::dbl; - } else if (type == T_LONG) { - locationType = Location::lng; + } else { + assert(type == T_OBJECT && reference, "unexpected type in stack slot"); + locationType = Location::oop; } jint offset = StackSlot::offset(value); if (StackSlot::addFrameSize(value)) { offset += total_frame_size; } ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset)); - if (type == T_DOUBLE || type == T_LONG) { + if (type == T_DOUBLE || (type == T_LONG && !reference)) { second = value; } return value; } else if (value->is_a(Constant::klass())){ record_metadata_in_constant(value, oop_recorder); - if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE) { - jint prim = (jint)PrimitiveConstant::primitive(value); - return new ConstantIntValue(prim); - } else if (type == T_LONG || type == T_DOUBLE) { - jlong prim = PrimitiveConstant::primitive(value); - second = new ConstantIntValue(0); - return new ConstantLongValue(prim); - } else if (type == T_OBJECT) { + if (value->is_a(PrimitiveConstant::klass())) { + assert(!reference, "unexpected primitive constant type"); + if (type == T_INT || type == T_FLOAT) { + jint prim = (jint)PrimitiveConstant::primitive(value); + return new ConstantIntValue(prim); + } else { + assert(type == T_LONG || type == T_DOUBLE, "unexpected primitive constant type"); + jlong prim = PrimitiveConstant::primitive(value); + second = new ConstantIntValue(0); + return new ConstantLongValue(prim); + } + } else { + assert(reference, "unexpected object constant type"); if (value->is_a(NullConstant::klass())) { return new ConstantOopWriteValue(NULL); } else { + assert(value->is_a(HotSpotObjectConstant::klass()), "unexpected constant type"); oop obj = HotSpotObjectConstant::object(value); assert(obj != NULL, "null value must be in NullConstant"); return new ConstantOopWriteValue(JNIHandles::make_local(obj)); } - } else if (type == T_ADDRESS) { - ShouldNotReachHere(); } - tty->print("%i", type); } else if (value->is_a(VirtualObject::klass())) { oop type = VirtualObject::type(value); int id = VirtualObject::id(value); diff -r 8a23eeeb7b06 -r a7d9b88ecd68 src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Tue Jul 22 15:05:33 2014 +0200 +++ b/src/share/vm/graal/graalJavaAccess.hpp Tue Jul 22 15:06:15 2014 +0200 @@ -223,8 +223,13 @@ static_oop_field(Kind, Int, "Lcom/oracle/graal/api/meta/Kind;"); \ static_oop_field(Kind, Long, "Lcom/oracle/graal/api/meta/Kind;"); \ end_class \ + start_class(LIRKind) \ + oop_field(LIRKind, platformKind, "Lcom/oracle/graal/api/meta/PlatformKind;") \ + int_field(LIRKind, referenceMask) \ + end_class \ start_class(Value) \ oop_field(Value, kind, "Lcom/oracle/graal/api/meta/Kind;") \ + oop_field(Value, lirKind, "Lcom/oracle/graal/api/meta/LIRKind;") \ static_oop_field(Value, ILLEGAL, "Lcom/oracle/graal/api/meta/AllocatableValue;"); \ end_class \ start_class(RegisterValue) \ diff -r 8a23eeeb7b06 -r a7d9b88ecd68 src/share/vm/graal/graalRuntime.cpp --- a/src/share/vm/graal/graalRuntime.cpp Tue Jul 22 15:05:33 2014 +0200 +++ b/src/share/vm/graal/graalRuntime.cpp Tue Jul 22 15:06:15 2014 +0200 @@ -117,7 +117,6 @@ case 'j': return T_LONG; case 'd': return T_DOUBLE; case 'a': return T_OBJECT; - case 'r': return T_ADDRESS; case '-': return T_ILLEGAL; default: fatal(err_msg("unexpected Kind: %c", ch));