Wed, 04 Apr 2012 20:44:38 -0700
7152811: Issues in client compiler
Reviewed-by: kvn, jrose
src/share/vm/ci/ciField.cpp | file | annotate | diff | comparison | revisions | |
src/share/vm/ci/ciField.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/ci/ciField.cpp Thu Mar 29 18:55:32 2012 -0400 1.2 +++ b/src/share/vm/ci/ciField.cpp Wed Apr 04 20:44:38 2012 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. 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 @@ -67,7 +67,7 @@ 1.11 1.12 // ------------------------------------------------------------------ 1.13 // ciField::ciField 1.14 -ciField::ciField(ciInstanceKlass* klass, int index): _known_to_link_with(NULL) { 1.15 +ciField::ciField(ciInstanceKlass* klass, int index): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) { 1.16 ASSERT_IN_VM; 1.17 CompilerThread *thread = CompilerThread::current(); 1.18 1.19 @@ -143,7 +143,7 @@ 1.20 initialize_from(&field_desc); 1.21 } 1.22 1.23 -ciField::ciField(fieldDescriptor *fd): _known_to_link_with(NULL) { 1.24 +ciField::ciField(fieldDescriptor *fd): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) { 1.25 ASSERT_IN_VM; 1.26 1.27 _cp_index = -1; 1.28 @@ -315,6 +315,10 @@ 1.29 bool ciField::will_link(ciInstanceKlass* accessing_klass, 1.30 Bytecodes::Code bc) { 1.31 VM_ENTRY_MARK; 1.32 + assert(bc == Bytecodes::_getstatic || bc == Bytecodes::_putstatic || 1.33 + bc == Bytecodes::_getfield || bc == Bytecodes::_putfield, 1.34 + "unexpected bytecode"); 1.35 + 1.36 if (_offset == -1) { 1.37 // at creation we couldn't link to our holder so we need to 1.38 // maintain that stance, otherwise there's no safe way to use this 1.39 @@ -322,8 +326,21 @@ 1.40 return false; 1.41 } 1.42 1.43 - if (_known_to_link_with == accessing_klass) { 1.44 - return true; 1.45 + // Check for static/nonstatic mismatch 1.46 + bool is_static = (bc == Bytecodes::_getstatic || bc == Bytecodes::_putstatic); 1.47 + if (is_static != this->is_static()) { 1.48 + return false; 1.49 + } 1.50 + 1.51 + // Get and put can have different accessibility rules 1.52 + bool is_put = (bc == Bytecodes::_putfield || bc == Bytecodes::_putstatic); 1.53 + if (is_put) { 1.54 + if (_known_to_link_with_put == accessing_klass) { 1.55 + return true; 1.56 + } 1.57 + if (_known_to_link_with_get == accessing_klass) { 1.58 + return true; 1.59 + } 1.60 } 1.61 1.62 FieldAccessInfo result; 1.63 @@ -334,8 +351,13 @@ 1.64 true, false, KILL_COMPILE_ON_FATAL_(false)); 1.65 1.66 // update the hit-cache, unless there is a problem with memory scoping: 1.67 - if (accessing_klass->is_shared() || !is_shared()) 1.68 - _known_to_link_with = accessing_klass; 1.69 + if (accessing_klass->is_shared() || !is_shared()) { 1.70 + if (is_put) { 1.71 + _known_to_link_with_put = accessing_klass; 1.72 + } else { 1.73 + _known_to_link_with_get = accessing_klass; 1.74 + } 1.75 + } 1.76 1.77 return true; 1.78 }
2.1 --- a/src/share/vm/ci/ciField.hpp Thu Mar 29 18:55:32 2012 -0400 2.2 +++ b/src/share/vm/ci/ciField.hpp Wed Apr 04 20:44:38 2012 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -49,7 +49,8 @@ 2.11 ciType* _type; 2.12 int _offset; 2.13 bool _is_constant; 2.14 - ciInstanceKlass* _known_to_link_with; 2.15 + ciInstanceKlass* _known_to_link_with_put; 2.16 + ciInstanceKlass* _known_to_link_with_get; 2.17 ciConstant _constant_value; 2.18 2.19 // Used for will_link