# HG changeset patch # User Gilles Duboscq # Date 1347045866 -7200 # Node ID 908e40db1d946f87752bdb56fb8b7c7a539c6bf7 # Parent a9b8d664dddd43dd2858623eea47f189b89396f3 Remove redundant code that discovers static final fields constant values diff -r a9b8d664dddd -r 908e40db1d94 src/share/vm/graal/graalCompilerToVM.cpp --- a/src/share/vm/graal/graalCompilerToVM.cpp Fri Sep 07 21:23:24 2012 +0200 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Fri Sep 07 21:24:26 2012 +0200 @@ -478,71 +478,6 @@ Handle type = GraalCompiler::get_JavaTypeFromSignature(cp, sig_index, cp->pool_holder(), CHECK_NULL); Handle field_handle = GraalCompiler::get_JavaField(offset, flags.as_int(), name, holder, type, code, THREAD); - oop constant_object = NULL; - // Check to see if the field is constant. - if (!holder_klass.is_null() && holder_klass->is_initialized() && flags.is_final() && flags.is_static()) { - // This field just may be constant. The only cases where it will - // not be constant are: - // - // 1. The field holds a non-perm-space oop. The field is, strictly - // speaking, constant but we cannot embed non-perm-space oops into - // generated code. For the time being we need to consider the - // field to be not constant. - // 2. The field is a *special* static&final field whose value - // may change. The three examples are java.lang.System.in, - // java.lang.System.out, and java.lang.System.err. - - bool ok = true; - assert( SystemDictionary::System_klass() != NULL, "Check once per vm"); - if( holder_klass->as_klassOop() == SystemDictionary::System_klass() ) { - // Check offsets for case 2: System.in, System.out, or System.err - if( offset == java_lang_System::in_offset_in_bytes() || - offset == java_lang_System::out_offset_in_bytes() || - offset == java_lang_System::err_offset_in_bytes() ) { - ok = false; - } - } - - if (ok) { - Handle mirror = holder_klass->java_mirror(); - switch(basic_type) { - case T_OBJECT: - case T_ARRAY: - constant_object = VMToCompiler::createConstantObject(mirror->obj_field(offset), CHECK_0); - break; - case T_DOUBLE: - constant_object = VMToCompiler::createConstantDouble(mirror->double_field(offset), CHECK_0); - break; - case T_FLOAT: - constant_object = VMToCompiler::createConstantFloat(mirror->float_field(offset), CHECK_0); - break; - case T_LONG: - constant_object = VMToCompiler::createConstant(Kind::Long(), mirror->long_field(offset), CHECK_0); - break; - case T_INT: - constant_object = VMToCompiler::createConstant(Kind::Int(), mirror->int_field(offset), CHECK_0); - break; - case T_SHORT: - constant_object = VMToCompiler::createConstant(Kind::Short(), mirror->short_field(offset), CHECK_0); - break; - case T_CHAR: - constant_object = VMToCompiler::createConstant(Kind::Char(), mirror->char_field(offset), CHECK_0); - break; - case T_BYTE: - constant_object = VMToCompiler::createConstant(Kind::Byte(), mirror->byte_field(offset), CHECK_0); - break; - case T_BOOLEAN: - constant_object = VMToCompiler::createConstant(Kind::Boolean(), mirror->bool_field(offset), CHECK_0); - break; - default: - fatal("Unhandled constant"); - break; - } - } - } - if (constant_object != NULL) { - HotSpotResolvedJavaField::set_constant(field_handle, constant_object); - } return JNIHandles::make_local(THREAD, field_handle()); }