comparison src/share/vm/oops/constantPool.hpp @ 10408:836a62f43af9

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 19 Jun 2013 10:45:56 +0200
parents 5fc51c1ecdeb 92ef81e2f571
children cefad50507d8
comparison
equal deleted inserted replaced
10086:e0fb8a213650 10408:836a62f43af9
109 int _resolved_reference_length; 109 int _resolved_reference_length;
110 // keeps version number for redefined classes (used in backtrace) 110 // keeps version number for redefined classes (used in backtrace)
111 int _version; 111 int _version;
112 } _saved; 112 } _saved;
113 113
114 Monitor* _lock;
115 114
116 void set_tags(Array<u1>* tags) { _tags = tags; } 115 void set_tags(Array<u1>* tags) { _tags = tags; }
117 void tag_at_put(int which, jbyte t) { tags()->at_put(which, t); } 116 void tag_at_put(int which, jbyte t) { tags()->at_put(which, t); }
118 void release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); } 117 void release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); }
119 118
353 return klass_at_impl(h_this, which, CHECK_NULL); 352 return klass_at_impl(h_this, which, CHECK_NULL);
354 } 353 }
355 354
356 Symbol* klass_name_at(int which); // Returns the name, w/o resolving. 355 Symbol* klass_name_at(int which); // Returns the name, w/o resolving.
357 356
358 Klass* resolved_klass_at(int which) { // Used by Compiler 357 Klass* resolved_klass_at(int which) const { // Used by Compiler
359 guarantee(tag_at(which).is_klass(), "Corrupted constant pool"); 358 guarantee(tag_at(which).is_klass(), "Corrupted constant pool");
360 // Must do an acquire here in case another thread resolved the klass 359 // Must do an acquire here in case another thread resolved the klass
361 // behind our back, lest we later load stale values thru the oop. 360 // behind our back, lest we later load stale values thru the oop.
362 return CPSlot((Klass*)OrderAccess::load_ptr_acquire(obj_at_addr_raw(which))).get_klass(); 361 return CPSlot((Klass*)OrderAccess::load_ptr_acquire(obj_at_addr_raw(which))).get_klass();
363 } 362 }
565 enum { 564 enum {
566 _indy_bsm_offset = 0, // CONSTANT_MethodHandle bsm 565 _indy_bsm_offset = 0, // CONSTANT_MethodHandle bsm
567 _indy_argc_offset = 1, // u2 argc 566 _indy_argc_offset = 1, // u2 argc
568 _indy_argv_offset = 2 // u2 argv[argc] 567 _indy_argv_offset = 2 // u2 argv[argc]
569 }; 568 };
569
570 // These functions are used in RedefineClasses for CP merge
571
572 int operand_offset_at(int bootstrap_specifier_index) {
573 assert(0 <= bootstrap_specifier_index &&
574 bootstrap_specifier_index < operand_array_length(operands()),
575 "Corrupted CP operands");
576 return operand_offset_at(operands(), bootstrap_specifier_index);
577 }
578 int operand_bootstrap_method_ref_index_at(int bootstrap_specifier_index) {
579 int offset = operand_offset_at(bootstrap_specifier_index);
580 return operands()->at(offset + _indy_bsm_offset);
581 }
582 int operand_argument_count_at(int bootstrap_specifier_index) {
583 int offset = operand_offset_at(bootstrap_specifier_index);
584 int argc = operands()->at(offset + _indy_argc_offset);
585 return argc;
586 }
587 int operand_argument_index_at(int bootstrap_specifier_index, int j) {
588 int offset = operand_offset_at(bootstrap_specifier_index);
589 return operands()->at(offset + _indy_argv_offset + j);
590 }
591 int operand_next_offset_at(int bootstrap_specifier_index) {
592 int offset = operand_offset_at(bootstrap_specifier_index) + _indy_argv_offset
593 + operand_argument_count_at(bootstrap_specifier_index);
594 return offset;
595 }
596 // Compare a bootsrap specifier in the operands arrays
597 bool compare_operand_to(int bootstrap_specifier_index1, constantPoolHandle cp2,
598 int bootstrap_specifier_index2, TRAPS);
599 // Find a bootsrap specifier in the operands array
600 int find_matching_operand(int bootstrap_specifier_index, constantPoolHandle search_cp,
601 int operands_cur_len, TRAPS);
602 // Resize the operands array with delta_len and delta_size
603 void resize_operands(int delta_len, int delta_size, TRAPS);
604 // Extend the operands array with the length and size of the ext_cp operands
605 void extend_operands(constantPoolHandle ext_cp, TRAPS);
606 // Shrink the operands array to a smaller array with new_len length
607 void shrink_operands(int new_len, TRAPS);
608
609
570 int invoke_dynamic_bootstrap_method_ref_index_at(int which) { 610 int invoke_dynamic_bootstrap_method_ref_index_at(int which) {
571 assert(tag_at(which).is_invoke_dynamic(), "Corrupted constant pool"); 611 assert(tag_at(which).is_invoke_dynamic(), "Corrupted constant pool");
572 int op_base = invoke_dynamic_operand_base(which); 612 int op_base = invoke_dynamic_operand_base(which);
573 return operands()->at(op_base + _indy_bsm_offset); 613 return operands()->at(op_base + _indy_bsm_offset);
574 } 614 }
782 _saved._version = version >= 0 ? (version + 1) : version; // keep overflow 822 _saved._version = version >= 0 ? (version + 1) : version; // keep overflow
783 } 823 }
784 824
785 void set_resolved_reference_length(int length) { _saved._resolved_reference_length = length; } 825 void set_resolved_reference_length(int length) { _saved._resolved_reference_length = length; }
786 int resolved_reference_length() const { return _saved._resolved_reference_length; } 826 int resolved_reference_length() const { return _saved._resolved_reference_length; }
787 void set_lock(Monitor* lock) { _lock = lock; } 827
788 Monitor* lock() { return _lock; } 828 // lock() may return null -- constant pool updates may happen before this lock is
829 // initialized, because the _pool_holder has not been fully initialized and
830 // has not been registered into the system dictionary. In this case, no other
831 // thread can be modifying this constantpool, so no synchronization is
832 // necessary.
833 //
834 // Use cplock() like this:
835 // oop cplock = cp->lock();
836 // ObjectLocker ol(cplock , THREAD, cplock != NULL);
837 oop lock();
789 838
790 // Decrease ref counts of symbols that are in the constant pool 839 // Decrease ref counts of symbols that are in the constant pool
791 // when the holder class is unloaded 840 // when the holder class is unloaded
792 void unreference_symbols(); 841 void unreference_symbols();
793 842