Mercurial > hg > graal-jvmci-8
diff src/share/vm/graal/graalCompilerToVM.cpp @ 6346:908e40db1d94
Remove redundant code that discovers static final fields constant values
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 07 Sep 2012 21:24:26 +0200 |
parents | 2691e320d37c |
children | a73fcf1639fc ad97777056ec |
line wrap: on
line diff
--- 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()); }