Mercurial > hg > truffle
comparison src/share/vm/ci/ciField.cpp @ 12264:b2e698d2276c
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
Summary: Enhance method resolution and resulting data structures, plus some refactoring.
Reviewed-by: twisti, acorn, jrose
author | drchase |
---|---|
date | Fri, 13 Sep 2013 22:38:02 -0400 |
parents | edb5ab0f3fe5 |
children | cefad50507d8 63a4eb8bcd23 00cf2b6f51b9 |
comparison
equal
deleted
inserted
replaced
12261:2c98370f2611 | 12264:b2e698d2276c |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
73 | 73 |
74 assert(ciObjectFactory::is_initialized(), "not a shared field"); | 74 assert(ciObjectFactory::is_initialized(), "not a shared field"); |
75 | 75 |
76 assert(klass->get_instanceKlass()->is_linked(), "must be linked before using its constan-pool"); | 76 assert(klass->get_instanceKlass()->is_linked(), "must be linked before using its constan-pool"); |
77 | 77 |
78 _cp_index = index; | |
79 constantPoolHandle cpool(thread, klass->get_instanceKlass()->constants()); | 78 constantPoolHandle cpool(thread, klass->get_instanceKlass()->constants()); |
80 | 79 |
81 // Get the field's name, signature, and type. | 80 // Get the field's name, signature, and type. |
82 Symbol* name = cpool->name_ref_at(index); | 81 Symbol* name = cpool->name_ref_at(index); |
83 _name = ciEnv::current(thread)->get_symbol(name); | 82 _name = ciEnv::current(thread)->get_symbol(name); |
114 klass)->as_instance_klass(); | 113 klass)->as_instance_klass(); |
115 | 114 |
116 // The declared holder of this field may not have been loaded. | 115 // The declared holder of this field may not have been loaded. |
117 // Bail out with partial field information. | 116 // Bail out with partial field information. |
118 if (!holder_is_accessible) { | 117 if (!holder_is_accessible) { |
119 // _cp_index and _type have already been set. | 118 // _type has already been set. |
120 // The default values for _flags and _constant_value will suffice. | 119 // The default values for _flags and _constant_value will suffice. |
121 // We need values for _holder, _offset, and _is_constant, | 120 // We need values for _holder, _offset, and _is_constant, |
122 _holder = declared_holder; | 121 _holder = declared_holder; |
123 _offset = -1; | 122 _offset = -1; |
124 _is_constant = false; | 123 _is_constant = false; |
143 initialize_from(&field_desc); | 142 initialize_from(&field_desc); |
144 } | 143 } |
145 | 144 |
146 ciField::ciField(fieldDescriptor *fd): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) { | 145 ciField::ciField(fieldDescriptor *fd): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) { |
147 ASSERT_IN_VM; | 146 ASSERT_IN_VM; |
148 | |
149 _cp_index = -1; | |
150 | 147 |
151 // Get the field's name, signature, and type. | 148 // Get the field's name, signature, and type. |
152 ciEnv* env = CURRENT_ENV; | 149 ciEnv* env = CURRENT_ENV; |
153 _name = env->get_symbol(fd->name()); | 150 _name = env->get_symbol(fd->name()); |
154 _signature = env->get_symbol(fd->signature()); | 151 _signature = env->get_symbol(fd->signature()); |
349 if (_known_to_link_with_get == accessing_klass) { | 346 if (_known_to_link_with_get == accessing_klass) { |
350 return true; | 347 return true; |
351 } | 348 } |
352 } | 349 } |
353 | 350 |
354 FieldAccessInfo result; | 351 fieldDescriptor result; |
355 constantPoolHandle c_pool(THREAD, | 352 LinkResolver::resolve_field(result, _holder->get_instanceKlass(), |
356 accessing_klass->get_instanceKlass()->constants()); | 353 _name->get_symbol(), _signature->get_symbol(), |
357 LinkResolver::resolve_field(result, c_pool, _cp_index, | 354 accessing_klass->get_Klass(), bc, true, false, |
358 Bytecodes::java_code(bc), | 355 KILL_COMPILE_ON_FATAL_(false)); |
359 true, false, KILL_COMPILE_ON_FATAL_(false)); | |
360 | 356 |
361 // update the hit-cache, unless there is a problem with memory scoping: | 357 // update the hit-cache, unless there is a problem with memory scoping: |
362 if (accessing_klass->is_shared() || !is_shared()) { | 358 if (accessing_klass->is_shared() || !is_shared()) { |
363 if (is_put) { | 359 if (is_put) { |
364 _known_to_link_with_put = accessing_klass; | 360 _known_to_link_with_put = accessing_klass; |