1.1 --- a/src/share/vm/ci/ciField.cpp Tue Jan 05 13:05:58 2010 +0100 1.2 +++ b/src/share/vm/ci/ciField.cpp Tue Jan 05 15:21:25 2010 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -86,7 +86,7 @@ 1.11 bool ignore; 1.12 // This is not really a class reference; the index always refers to the 1.13 // field's type signature, as a symbol. Linkage checks do not apply. 1.14 - _type = ciEnv::current(thread)->get_klass_by_index(klass, sig_index, ignore); 1.15 + _type = ciEnv::current(thread)->get_klass_by_index(cpool, sig_index, ignore, klass); 1.16 } else { 1.17 _type = ciType::make(field_type); 1.18 } 1.19 @@ -100,9 +100,9 @@ 1.20 int holder_index = cpool->klass_ref_index_at(index); 1.21 bool holder_is_accessible; 1.22 ciInstanceKlass* declared_holder = 1.23 - ciEnv::current(thread)->get_klass_by_index(klass, holder_index, 1.24 - holder_is_accessible) 1.25 - ->as_instance_klass(); 1.26 + ciEnv::current(thread)->get_klass_by_index(cpool, holder_index, 1.27 + holder_is_accessible, 1.28 + klass)->as_instance_klass(); 1.29 1.30 // The declared holder of this field may not have been loaded. 1.31 // Bail out with partial field information. 1.32 @@ -168,8 +168,18 @@ 1.33 _holder = CURRENT_ENV->get_object(fd->field_holder())->as_instance_klass(); 1.34 1.35 // Check to see if the field is constant. 1.36 - if (_holder->is_initialized() && 1.37 - this->is_final() && this->is_static()) { 1.38 + if (_holder->is_initialized() && this->is_final()) { 1.39 + if (!this->is_static()) { 1.40 + // A field can be constant if it's a final static field or if it's 1.41 + // a final non-static field of a trusted class ({java,sun}.dyn). 1.42 + if (_holder->is_in_package("java/dyn") || _holder->is_in_package("sun/dyn")) { 1.43 + _is_constant = true; 1.44 + return; 1.45 + } 1.46 + _is_constant = false; 1.47 + return; 1.48 + } 1.49 + 1.50 // This field just may be constant. The only cases where it will 1.51 // not be constant are: 1.52 //