< prev index next >

src/hotspot/share/oops/constantPool.hpp

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 63,75 **** Symbol* get_symbol() { return (Symbol*)(_ptr & ~_pseudo_bit); } }; ! // This represents a (JVM_CONSTANT_Class, JVM_CONSTANT_UnresolvedClass or JVM_CONSTANT_UnresolvedClassInError) or ! // (JVM_CONSTANT_Value, JVM_CONSTANT_UnresolvedValue or JVM_CONSTANT_UnresolvedValueInError) ! // slot in the constant pool. class CPKlassSlot VALUE_OBJ_CLASS_SPEC { // cp->symbol_at(_name_index) gives the name of the class. int _name_index; // cp->_resolved_klasses->at(_resolved_klass_index) gives the Klass* for the class. --- 63,74 ---- Symbol* get_symbol() { return (Symbol*)(_ptr & ~_pseudo_bit); } }; ! // This represents a JVM_CONSTANT_Class, JVM_CONSTANT_UnresolvedClass, or ! // JVM_CONSTANT_UnresolvedClassInError slot in the constant pool. class CPKlassSlot VALUE_OBJ_CLASS_SPEC { // cp->symbol_at(_name_index) gives the name of the class. int _name_index; // cp->_resolved_klasses->at(_resolved_klass_index) gives the Klass* for the class.
*** 144,155 **** private: intptr_t* base() const { return (intptr_t*) (((char*) this) + sizeof(ConstantPool)); } CPSlot slot_at(int which) const { assert(is_within_bounds(which), "index out of bounds"); ! assert(!tag_at(which).is_unresolved_klass() && !tag_at(which).is_unresolved_klass_in_error() && ! !tag_at(which).is_unresolved_value_type() && !tag_at(which).is_unresolved_value_type_in_error(), "Corrupted constant pool"); // Uses volatile because the klass slot changes without a lock. intptr_t adr = OrderAccess::load_acquire(obj_at_addr_raw(which)); assert(adr != 0 || which == 0, "cp entry for klass should not be zero"); return CPSlot(adr); } --- 143,153 ---- private: intptr_t* base() const { return (intptr_t*) (((char*) this) + sizeof(ConstantPool)); } CPSlot slot_at(int which) const { assert(is_within_bounds(which), "index out of bounds"); ! assert(!tag_at(which).is_unresolved_klass() && !tag_at(which).is_unresolved_klass_in_error(), "Corrupted constant pool"); // Uses volatile because the klass slot changes without a lock. intptr_t adr = OrderAccess::load_acquire(obj_at_addr_raw(which)); assert(adr != 0 || which == 0, "cp entry for klass should not be zero"); return CPSlot(adr); }
*** 278,293 **** void klass_index_at_put(int which, int name_index) { tag_at_put(which, JVM_CONSTANT_ClassIndex); *int_at_addr(which) = name_index; } - // For temporary use while constructing constant pool. Used during a retransform/class redefinition as well. - void value_type_index_at_put(int which, int name_index) { - tag_at_put(which, JVM_CONSTANT_ValueIndex); - *int_at_addr(which) = name_index; - } - // Anonymous class support: void klass_at_put(int class_index, int name_index, int resolved_klass_index, Klass* k, Symbol* name); void klass_at_put(int class_index, Klass* k); void unresolved_klass_at_put(int which, int name_index, int resolved_klass_index) { --- 276,285 ----
*** 297,315 **** assert((resolved_klass_index & 0xffff0000) == 0, "must be"); *int_at_addr(which) = build_int_from_shorts((jushort)resolved_klass_index, (jushort)name_index); } - void unresolved_value_type_at_put(int which, int name_index, int resolved_klass_index) { - release_tag_at_put(which, JVM_CONSTANT_UnresolvedValue); - - assert((name_index & 0xffff0000) == 0, "must be"); - assert((resolved_klass_index & 0xffff0000) == 0, "must be"); - *int_at_addr(which) = - build_int_from_shorts((jushort)resolved_klass_index, (jushort)name_index); - } - void method_handle_index_at_put(int which, int ref_kind, int ref_index) { tag_at_put(which, JVM_CONSTANT_MethodHandle); *int_at_addr(which) = ((jint) ref_index<<16) | ref_kind; } --- 289,298 ----
*** 411,422 **** constantPoolHandle h_this(THREAD, this); return klass_at_impl(h_this, which, false, THREAD); } CPKlassSlot klass_slot_at(int which) const { ! assert(tag_at(which).is_unresolved_klass() || tag_at(which).is_klass() || ! tag_at(which).is_unresolved_value_type() || tag_at(which).is_value_type(), "Corrupted constant pool"); int value = *int_at_addr(which); int name_index = extract_high_short_from_int(value); int resolved_klass_index = extract_low_short_from_int(value); return CPKlassSlot(name_index, resolved_klass_index); --- 394,404 ---- constantPoolHandle h_this(THREAD, this); return klass_at_impl(h_this, which, false, THREAD); } CPKlassSlot klass_slot_at(int which) const { ! assert(tag_at(which).is_unresolved_klass() || tag_at(which).is_klass(), "Corrupted constant pool"); int value = *int_at_addr(which); int name_index = extract_high_short_from_int(value); int resolved_klass_index = extract_low_short_from_int(value); return CPKlassSlot(name_index, resolved_klass_index);
*** 426,436 **** int klass_name_index_at(int which) const { return klass_slot_at(which).name_index(); } Klass* resolved_klass_at(int which) const { // Used by Compiler ! guarantee(tag_at(which).is_klass() || tag_at(which).is_value_type(), "Corrupted constant pool"); // Must do an acquire here in case another thread resolved the klass // behind our back, lest we later load stale values thru the oop. CPKlassSlot kslot = klass_slot_at(which); assert(tag_at(kslot.name_index()).is_symbol(), "sanity"); --- 408,418 ---- int klass_name_index_at(int which) const { return klass_slot_at(which).name_index(); } Klass* resolved_klass_at(int which) const { // Used by Compiler ! guarantee(tag_at(which).is_klass(), "Corrupted constant pool"); // Must do an acquire here in case another thread resolved the klass // behind our back, lest we later load stale values thru the oop. CPKlassSlot kslot = klass_slot_at(which); assert(tag_at(kslot.name_index()).is_symbol(), "sanity");
*** 443,457 **** void temp_unresolved_klass_at_put(int which, int name_index) { // Used only during constant pool merging for class redefinition. The resolved klass index // will be initialized later by a call to initialize_unresolved_klasses(). unresolved_klass_at_put(which, name_index, CPKlassSlot::_temp_resolved_klass_index); } - void temp_unresolved_value_type_at_put(int which, int name_index) { - // Used only during constant pool merging for class redefinition. The resolved klass index - // will be initialized later by a call to initialize_unresolved_klasses(). - unresolved_value_type_at_put(which, name_index, CPKlassSlot::_temp_resolved_klass_index); - } jint int_at(int which) { assert(tag_at(which).is_int(), "Corrupted constant pool"); return *int_at_addr(which); } --- 425,434 ----
*** 897,911 **** jint klass_index_at(int which) { assert(tag_at(which).is_klass_index(), "Corrupted constant pool"); return *int_at_addr(which); } - jint value_type_index_at(int which) { - assert(tag_at(which).is_value_type_index(), "Corrupted constant pool"); - return *int_at_addr(which); - } - jint string_index_at(int which) { assert(tag_at(which).is_string_index(), "Corrupted constant pool"); return *int_at_addr(which); } --- 874,883 ----
< prev index next >