Mercurial > hg > truffle
comparison src/share/vm/oops/constantPoolOop.hpp @ 1339:09ac706c2623
Merge
author | asaha |
---|---|
date | Wed, 24 Mar 2010 17:16:33 -0700 |
parents | dd57230ba8fe |
children | c18cbe5936b8 ab102d5d923e |
comparison
equal
deleted
inserted
replaced
1338:f5dd08ad65df | 1339:09ac706c2623 |
---|---|
189 // marking thread before the tag was updated, redirty the card. | 189 // marking thread before the tag was updated, redirty the card. |
190 oop_store_without_check((volatile oop *)obj_at_addr(which), str); | 190 oop_store_without_check((volatile oop *)obj_at_addr(which), str); |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 void object_at_put(int which, oop str) { | |
195 oop_store((volatile oop*) obj_at_addr(which), str); | |
196 release_tag_at_put(which, JVM_CONSTANT_Object); | |
197 if (UseConcMarkSweepGC) { | |
198 // In case the earlier card-mark was consumed by a concurrent | |
199 // marking thread before the tag was updated, redirty the card. | |
200 oop_store_without_check((volatile oop*) obj_at_addr(which), str); | |
201 } | |
202 } | |
203 | |
194 // For temporary use while constructing constant pool | 204 // For temporary use while constructing constant pool |
195 void string_index_at_put(int which, int string_index) { | 205 void string_index_at_put(int which, int string_index) { |
196 tag_at_put(which, JVM_CONSTANT_StringIndex); | 206 tag_at_put(which, JVM_CONSTANT_StringIndex); |
197 *int_at_addr(which) = string_index; | 207 *int_at_addr(which) = string_index; |
198 } | 208 } |
226 constantTag tag = tag_at(which); | 236 constantTag tag = tag_at(which); |
227 return tag.is_klass() || | 237 return tag.is_klass() || |
228 tag.is_unresolved_klass() || | 238 tag.is_unresolved_klass() || |
229 tag.is_symbol() || | 239 tag.is_symbol() || |
230 tag.is_unresolved_string() || | 240 tag.is_unresolved_string() || |
231 tag.is_string(); | 241 tag.is_string() || |
242 tag.is_object(); | |
232 } | 243 } |
233 | 244 |
234 // Fetching constants | 245 // Fetching constants |
235 | 246 |
236 klassOop klass_at(int which, TRAPS) { | 247 klassOop klass_at(int which, TRAPS) { |
287 } | 298 } |
288 | 299 |
289 oop string_at(int which, TRAPS) { | 300 oop string_at(int which, TRAPS) { |
290 constantPoolHandle h_this(THREAD, this); | 301 constantPoolHandle h_this(THREAD, this); |
291 return string_at_impl(h_this, which, CHECK_NULL); | 302 return string_at_impl(h_this, which, CHECK_NULL); |
303 } | |
304 | |
305 oop object_at(int which) { | |
306 assert(tag_at(which).is_object(), "Corrupted constant pool"); | |
307 return *obj_at_addr(which); | |
292 } | 308 } |
293 | 309 |
294 // A "pseudo-string" is an non-string oop that has found is way into | 310 // A "pseudo-string" is an non-string oop that has found is way into |
295 // a String entry. | 311 // a String entry. |
296 // Under AnonymousClasses this can happen if the user patches a live | 312 // Under AnonymousClasses this can happen if the user patches a live |
340 assert(tag_at(which).is_name_and_type(), "Corrupted constant pool"); | 356 assert(tag_at(which).is_name_and_type(), "Corrupted constant pool"); |
341 return *int_at_addr(which); | 357 return *int_at_addr(which); |
342 } | 358 } |
343 | 359 |
344 // The following methods (name/signature/klass_ref_at, klass_ref_at_noresolve, | 360 // The following methods (name/signature/klass_ref_at, klass_ref_at_noresolve, |
345 // name_and_type_ref_index_at) all expect constant pool indices | 361 // name_and_type_ref_index_at) all expect to be passed indices obtained |
346 // from the bytecodes to be passed in, which are actually potentially byte-swapped | 362 // directly from the bytecode, and extracted according to java byte order. |
347 // or rewritten constant pool cache indices. They all call map_instruction_operand_to_index. | 363 // If the indices are meant to refer to fields or methods, they are |
348 int map_instruction_operand_to_index(int operand); | 364 // actually potentially byte-swapped, rewritten constant pool cache indices. |
349 | 365 // The routine remap_instruction_operand_from_cache manages the adjustment |
350 // There are also "uncached" versions which do not map the operand index; see below. | 366 // of these values back to constant pool indices. |
367 | |
368 // There are also "uncached" versions which do not adjust the operand index; see below. | |
351 | 369 |
352 // Lookup for entries consisting of (klass_index, name_and_type index) | 370 // Lookup for entries consisting of (klass_index, name_and_type index) |
353 klassOop klass_ref_at(int which, TRAPS); | 371 klassOop klass_ref_at(int which, TRAPS); |
354 symbolOop klass_ref_at_noresolve(int which); | 372 symbolOop klass_ref_at_noresolve(int which); |
355 symbolOop name_ref_at(int which) { return impl_name_ref_at(which, false); } | 373 symbolOop name_ref_at(int which) { return impl_name_ref_at(which, false); } |
359 int name_and_type_ref_index_at(int which) { return impl_name_and_type_ref_index_at(which, false); } | 377 int name_and_type_ref_index_at(int which) { return impl_name_and_type_ref_index_at(which, false); } |
360 | 378 |
361 // Lookup for entries consisting of (name_index, signature_index) | 379 // Lookup for entries consisting of (name_index, signature_index) |
362 int name_ref_index_at(int which_nt); // == low-order jshort of name_and_type_at(which_nt) | 380 int name_ref_index_at(int which_nt); // == low-order jshort of name_and_type_at(which_nt) |
363 int signature_ref_index_at(int which_nt); // == high-order jshort of name_and_type_at(which_nt) | 381 int signature_ref_index_at(int which_nt); // == high-order jshort of name_and_type_at(which_nt) |
364 symbolOop nt_name_ref_at(int which_nt) { return symbol_at(name_ref_index_at(which_nt)); } | |
365 symbolOop nt_signature_ref_at(int which_nt) { return symbol_at(signature_ref_index_at(which_nt)); } | |
366 | 382 |
367 BasicType basic_type_for_signature_at(int which); | 383 BasicType basic_type_for_signature_at(int which); |
368 | 384 |
369 // Resolve string constants (to prevent allocation during compilation) | 385 // Resolve string constants (to prevent allocation during compilation) |
370 void resolve_string_constants(TRAPS) { | 386 void resolve_string_constants(TRAPS) { |
423 symbolOop impl_name_ref_at(int which, bool uncached); | 439 symbolOop impl_name_ref_at(int which, bool uncached); |
424 symbolOop impl_signature_ref_at(int which, bool uncached); | 440 symbolOop impl_signature_ref_at(int which, bool uncached); |
425 int impl_klass_ref_index_at(int which, bool uncached); | 441 int impl_klass_ref_index_at(int which, bool uncached); |
426 int impl_name_and_type_ref_index_at(int which, bool uncached); | 442 int impl_name_and_type_ref_index_at(int which, bool uncached); |
427 | 443 |
428 // Takes either a constant pool cache index in possibly byte-swapped | 444 int remap_instruction_operand_from_cache(int operand); |
429 // byte order (which comes from the bytecodes after rewriting) or, | |
430 // if "uncached" is true, a vanilla constant pool index | |
431 jint field_or_method_at(int which, bool uncached) { | |
432 int i = which; | |
433 if (!uncached && cache() != NULL) { | |
434 // change byte-ordering and go via cache | |
435 i = map_instruction_operand_to_index(which); | |
436 } | |
437 assert(tag_at(i).is_field_or_method(), "Corrupted constant pool"); | |
438 return *int_at_addr(i); | |
439 } | |
440 | 445 |
441 // Used while constructing constant pool (only by ClassFileParser) | 446 // Used while constructing constant pool (only by ClassFileParser) |
442 jint klass_index_at(int which) { | 447 jint klass_index_at(int which) { |
443 assert(tag_at(which).is_klass_index(), "Corrupted constant pool"); | 448 assert(tag_at(which).is_klass_index(), "Corrupted constant pool"); |
444 return *int_at_addr(which); | 449 return *int_at_addr(which); |