< prev index next >
src/hotspot/share/oops/constantPool.cpp
Print this page
@@ -198,23 +198,14 @@
{
const int class_index = klass_index_at(i);
unresolved_klass_at_put(i, class_index, num_klasses++);
}
break;
- case JVM_CONSTANT_ValueIndex:
- {
- const int class_index = value_type_index_at(i);
- unresolved_value_type_at_put(i, class_index, num_klasses++);
- }
- break;
#ifndef PRODUCT
case JVM_CONSTANT_Class:
case JVM_CONSTANT_UnresolvedClass:
case JVM_CONSTANT_UnresolvedClassInError:
- case JVM_CONSTANT_Value:
- case JVM_CONSTANT_UnresolvedValue:
- case JVM_CONSTANT_UnresolvedValueInError:
// All of these should have been reverted back to Unresolved before calling
// this function.
ShouldNotReachHere();
#endif
}
@@ -236,14 +227,13 @@
OrderAccess::release_store(adr, k);
// The interpreter assumes when the tag is stored, the klass is resolved
// and the Klass* non-NULL, so we need hardware store ordering here.
if (k != NULL) {
- release_tag_at_put(class_index, (k->is_value() ? (jbyte)JVM_CONSTANT_Value : JVM_CONSTANT_Class));
+ release_tag_at_put(class_index, JVM_CONSTANT_Class);
} else {
- release_tag_at_put(class_index, (tag_at(class_index).is_value_type_or_reference() ?
- JVM_CONSTANT_UnresolvedValue : JVM_CONSTANT_UnresolvedClass));
+ release_tag_at_put(class_index, JVM_CONSTANT_UnresolvedClass);
}
}
// Anonymous class support:
void ConstantPool::klass_at_put(int class_index, Klass* k) {
@@ -253,11 +243,11 @@
Klass** adr = resolved_klasses()->adr_at(resolved_klass_index);
OrderAccess::release_store(adr, k);
// The interpreter assumes when the tag is stored, the klass is resolved
// and the Klass* non-NULL, so we need hardware store ordering here.
- release_tag_at_put(class_index, (k->is_value() ? (jbyte)JVM_CONSTANT_Value : JVM_CONSTANT_Class));
+ release_tag_at_put(class_index, JVM_CONSTANT_Class);
}
#if INCLUDE_CDS_JAVA_HEAP
// Archive the resolved references
void ConstantPool::archive_resolved_references(Thread* THREAD) {
@@ -452,18 +442,16 @@
int resolved_klass_index = kslot.resolved_klass_index();
int name_index = kslot.name_index();
assert(this_cp->tag_at(name_index).is_symbol(), "sanity");
Klass* klass = this_cp->resolved_klasses()->at(resolved_klass_index);
-
if (klass != NULL) {
return klass;
}
// This tag doesn't change back to unresolved class unless at a safepoint.
- if (this_cp->tag_at(which).is_unresolved_klass_in_error() ||
- this_cp->tag_at(which).is_unresolved_value_type_in_error()) {
+ if (this_cp->tag_at(which).is_unresolved_klass_in_error()) {
// The original attempt to resolve this constant pool entry failed so find the
// class of the original error and throw another error of the same class
// (JVMS 5.4.3).
// If there is a detail message, pass that detail message to the error.
// The JVMS does not strictly require us to duplicate the same detail message,
@@ -488,14 +476,11 @@
// Failed to resolve class. We must record the errors so that subsequent attempts
// to resolve this constant pool entry fail with the same error (JVMS 5.4.3).
if (HAS_PENDING_EXCEPTION) {
if (save_resolution_error) {
- bool is_value_type_tag = this_cp->tag_at(which).is_value_type_or_reference();
- save_and_throw_exception(this_cp, which,
- constantTag((is_value_type_tag ? JVM_CONSTANT_UnresolvedValue : JVM_CONSTANT_UnresolvedClass)),
- CHECK_NULL);
+ save_and_throw_exception(this_cp, which, constantTag(JVM_CONSTANT_UnresolvedClass), CHECK_NULL);
// If CHECK_NULL above doesn't return the exception, that means that
// some other thread has beaten us and has resolved the class.
// To preserve old behavior, we return the resolved class.
klass = this_cp->resolved_klasses()->at(resolved_klass_index);
assert(klass != NULL, "must be resolved if exception was cleared");
@@ -516,11 +501,11 @@
Klass** adr = this_cp->resolved_klasses()->adr_at(resolved_klass_index);
OrderAccess::release_store(adr, k);
// The interpreter assumes when the tag is stored, the klass is resolved
// and the Klass* stored in _resolved_klasses is non-NULL, so we need
// hardware store ordering here.
- this_cp->release_tag_at_put(which, (k->is_value() ? (jbyte)JVM_CONSTANT_Value : JVM_CONSTANT_Class));
+ this_cp->release_tag_at_put(which, JVM_CONSTANT_Class);
return k;
}
// Does not update ConstantPool* - to avoid any exception throwing. Used
@@ -754,11 +739,10 @@
}
// Return specific message for the tag
switch (tag.value()) {
case JVM_CONSTANT_UnresolvedClass:
- case JVM_CONSTANT_UnresolvedValue:
// return the class name in the error message
message = this_cp->klass_name_at(which);
break;
case JVM_CONSTANT_MethodHandle:
// return the method handle name in the error message
@@ -809,11 +793,11 @@
// this error, so it needs to get the same error if the error is first.
jbyte old_tag = Atomic::cmpxchg((jbyte)error_tag,
(jbyte*)this_cp->tag_addr_at(which), (jbyte)tag.value());
if (old_tag != error_tag && old_tag != tag.value()) {
// MethodHandles and MethodType doesn't change to resolved version.
- assert(this_cp->tag_at(which).is_klass() || this_cp->tag_at(which).is_value_type(), "Wrong tag value");
+ assert(this_cp->tag_at(which).is_klass(), "Wrong tag value");
// Forget the exception and use the resolved class.
CLEAR_PENDING_EXCEPTION;
}
} else {
// some other thread put this in error state
@@ -903,13 +887,10 @@
switch (tag.value()) {
case JVM_CONSTANT_UnresolvedClass:
case JVM_CONSTANT_UnresolvedClassInError:
case JVM_CONSTANT_Class:
- case JVM_CONSTANT_UnresolvedValue:
- case JVM_CONSTANT_UnresolvedValueInError:
- case JVM_CONSTANT_Value:
{
assert(cache_index == _no_index_sentinel, "should not have been set");
Klass* resolved = klass_at_impl(this_cp, index, true, CHECK_NULL);
// ldc wants the java mirror.
result_oop = resolved->java_mirror();
@@ -1312,11 +1293,10 @@
return false;
}
switch (t1) {
case JVM_CONSTANT_Class:
- case JVM_CONSTANT_Value:
{
Klass* k1 = klass_at(index1, CHECK_false);
Klass* k2 = cp2->klass_at(index2, CHECK_false);
if (k1 == k2) {
return true;
@@ -1331,20 +1311,10 @@
if (match) {
return true;
}
} break;
- case JVM_CONSTANT_ValueIndex:
- {
- int recur1 = value_type_index_at(index1);
- int recur2 = cp2->value_type_index_at(index2);
- bool match = compare_entry_to(recur1, cp2, recur2, CHECK_false);
- if (match) {
- return true;
- }
- } break;
-
case JVM_CONSTANT_Double:
{
jdouble d1 = double_at(index1);
jdouble d2 = cp2->double_at(index2);
if (d1 == d2) {
@@ -1420,11 +1390,10 @@
return true;
}
} break;
case JVM_CONSTANT_UnresolvedClass:
- case JVM_CONSTANT_UnresolvedValue:
{
Symbol* k1 = klass_name_at(index1);
Symbol* k2 = cp2->klass_name_at(index2);
if (k1 == k2) {
return true;
@@ -1690,16 +1659,10 @@
{
jint ki = from_cp->klass_index_at(from_i);
to_cp->klass_index_at_put(to_i, ki);
} break;
- case JVM_CONSTANT_ValueIndex:
- {
- jint ki = from_cp->klass_index_at(from_i);
- to_cp->klass_index_at_put(to_i, ki);
- } break;
-
case JVM_CONSTANT_Double:
{
jdouble d = from_cp->double_at(from_i);
to_cp->double_at_put(to_i, d);
// double takes two constant pool entries so init second entry's tag
@@ -1768,20 +1731,10 @@
int name_index = from_cp->klass_slot_at(from_i).name_index();
assert(from_cp->tag_at(name_index).is_symbol(), "sanity");
to_cp->klass_index_at_put(to_i, name_index);
} break;
- case JVM_CONSTANT_Value:
- case JVM_CONSTANT_UnresolvedValue:
- case JVM_CONSTANT_UnresolvedValueInError:
- {
- // Revert to JVM_CONSTANT_ValueIndex
- int name_index = from_cp->klass_slot_at(from_i).name_index();
- assert(from_cp->tag_at(name_index).is_symbol(), "sanity");
- to_cp->value_type_index_at_put(to_i, name_index);
- } break;
-
case JVM_CONSTANT_String:
{
Symbol* s = from_cp->unresolved_string_at(from_i);
to_cp->unresolved_string_at_put(to_i, s);
} break;
@@ -1902,12 +1855,11 @@
constantTag tag = tag_at(which);
if (tag.is_string()) {
return string_at_noresolve(which);
- } else if (tag.is_klass() || tag.is_unresolved_klass() ||
- tag.is_value_type() || tag.is_unresolved_value_type()) {
+ } else if (tag.is_klass() || tag.is_unresolved_klass()) {
return klass_name_at(which)->as_C_string();
} else if (tag.is_symbol()) {
return symbol_at(which)->as_C_string();
}
return "";
@@ -1985,16 +1937,10 @@
idx1 = Bytes::get_Java_u2(bytes);
printf("class #%03d", idx1);
ent_size = 2;
break;
}
- case JVM_CONSTANT_Value: {
- idx1 = Bytes::get_Java_u2(bytes);
- printf("class #%03d", idx1);
- ent_size = 2;
- break;
- }
case JVM_CONSTANT_String: {
idx1 = Bytes::get_Java_u2(bytes);
printf("String #%03d", idx1);
ent_size = 2;
break;
@@ -2037,22 +1983,10 @@
}
case JVM_CONSTANT_UnresolvedClassInError: {
printf("UnresolvedClassInErr: %s", WARN_MSG);
break;
}
- case JVM_CONSTANT_ValueIndex: {
- printf("ValueIndex %s", WARN_MSG);
- break;
- }
- case JVM_CONSTANT_UnresolvedValue: {
- printf("UnresolvedValue: %s", WARN_MSG);
- break;
- }
- case JVM_CONSTANT_UnresolvedValueInError: {
- printf("UnresolvedValueInErr: %s", WARN_MSG);
- break;
- }
case JVM_CONSTANT_StringIndex: {
printf("StringIndex: %s", WARN_MSG);
break;
}
}
@@ -2079,14 +2013,10 @@
case JVM_CONSTANT_Class:
case JVM_CONSTANT_String:
case JVM_CONSTANT_ClassIndex:
case JVM_CONSTANT_UnresolvedClass:
case JVM_CONSTANT_UnresolvedClassInError:
- case JVM_CONSTANT_Value:
- case JVM_CONSTANT_ValueIndex:
- case JVM_CONSTANT_UnresolvedValue:
- case JVM_CONSTANT_UnresolvedValueInError:
case JVM_CONSTANT_StringIndex:
case JVM_CONSTANT_MethodType:
case JVM_CONSTANT_MethodTypeInError:
return 3;
@@ -2141,18 +2071,10 @@
Symbol* sym = klass_name_at(idx);
classmap->add_entry(sym, idx);
DBG(printf("adding class entry %s = %d\n", sym->as_utf8(), idx));
break;
}
- case JVM_CONSTANT_Value:
- case JVM_CONSTANT_UnresolvedValue:
- case JVM_CONSTANT_UnresolvedValueInError: {
- Symbol* sym = klass_name_at(idx);
- classmap->add_entry(sym, idx);
- DBG(printf("adding value type entry %s = %d\n", sym->as_utf8(), idx));
- break;
- }
case JVM_CONSTANT_Long:
case JVM_CONSTANT_Double: {
idx++; // Both Long and Double take two cpool slots
break;
}
@@ -2236,21 +2158,10 @@
assert(idx1 != 0, "Have not found a hashtable entry");
Bytes::put_Java_u2((address) (bytes+1), idx1);
DBG(printf("JVM_CONSTANT_Class: idx=#%03hd, %s", idx1, sym->as_utf8()));
break;
}
- case JVM_CONSTANT_Value:
- case JVM_CONSTANT_UnresolvedValue:
- case JVM_CONSTANT_UnresolvedValueInError: {
- *bytes = JVM_CONSTANT_Value;
- Symbol* sym = klass_name_at(idx);
- idx1 = tbl->symbol_to_value(sym);
- assert(idx1 != 0, "Have not found a hashtable entry");
- Bytes::put_Java_u2((address) (bytes+1), idx1);
- DBG(printf("JVM_CONSTANT_Value: idx=#%03hd, %s", idx1, sym->as_utf8()));
- break;
- }
case JVM_CONSTANT_String: {
*bytes = JVM_CONSTANT_String;
Symbol* sym = unresolved_string_at(idx);
idx1 = tbl->symbol_to_value(sym);
assert(idx1 != 0, "Have not found a hashtable entry");
@@ -2281,17 +2192,10 @@
idx1 = klass_index_at(idx);
Bytes::put_Java_u2((address) (bytes+1), idx1);
DBG(printf("JVM_CONSTANT_ClassIndex: %hd", idx1));
break;
}
- case JVM_CONSTANT_ValueIndex: {
- *bytes = JVM_CONSTANT_Value;
- idx1 = value_type_index_at(idx);
- Bytes::put_Java_u2((address) (bytes+1), idx1);
- DBG(printf("JVM_CONSTANT_ValueIndex: %hd", idx1));
- break;
- }
case JVM_CONSTANT_StringIndex: {
*bytes = JVM_CONSTANT_String;
idx1 = string_index_at(idx);
Bytes::put_Java_u2((address) (bytes+1), idx1);
DBG(printf("JVM_CONSTANT_StringIndex: %hd", idx1));
@@ -2406,12 +2310,11 @@
guarantee(obj->is_constantPool(), "object must be constant pool");
constantPoolHandle cp(THREAD, (ConstantPool*)obj);
guarantee(cp->pool_holder() != NULL, "must be fully loaded");
for (int i = 0; i< cp->length(); i++) {
- if (cp->tag_at(i).is_unresolved_klass() ||
- cp->tag_at(i).is_unresolved_value_type()) {
+ if (cp->tag_at(i).is_unresolved_klass()) {
// This will force loading of the class
Klass* klass = cp->klass_at(i, CHECK);
if (klass->is_instance_klass()) {
// Force initialization of class
InstanceKlass::cast(klass)->initialize(CHECK);
@@ -2466,17 +2369,10 @@
guarantee(k != NULL, "need klass");
k->print_value_on(st);
st->print(" {" PTR_FORMAT "}", p2i(k));
}
break;
- case JVM_CONSTANT_Value :
- { Klass* k = klass_at(index, CATCH);
- guarantee(k != NULL, "need klass");
- k->print_value_on(st);
- st->print(" {" PTR_FORMAT "}", p2i(k));
- }
- break;
case JVM_CONSTANT_Fieldref :
case JVM_CONSTANT_Methodref :
case JVM_CONSTANT_InterfaceMethodref :
st->print("klass_index=%d", uncached_klass_ref_index_at(index));
st->print(" name_and_type_index=%d", uncached_name_and_type_ref_index_at(index));
@@ -2507,21 +2403,18 @@
st->print(" signature_index=%d", signature_ref_index_at(index));
break;
case JVM_CONSTANT_Utf8 :
symbol_at(index)->print_value_on(st);
break;
- case JVM_CONSTANT_ClassIndex:
- case JVM_CONSTANT_ValueIndex: {
+ case JVM_CONSTANT_ClassIndex: {
int name_index = *int_at_addr(index);
st->print("klass_index=%d ", name_index);
symbol_at(name_index)->print_value_on(st);
}
break;
case JVM_CONSTANT_UnresolvedClass : // fall-through
- case JVM_CONSTANT_UnresolvedClassInError :
- case JVM_CONSTANT_UnresolvedValue :
- case JVM_CONSTANT_UnresolvedValueInError : {
+ case JVM_CONSTANT_UnresolvedClassInError: {
CPKlassSlot kslot = klass_slot_at(index);
int resolved_klass_index = kslot.resolved_klass_index();
int name_index = kslot.name_index();
assert(tag_at(name_index).is_symbol(), "sanity");
@@ -2614,12 +2507,11 @@
void ConstantPool::verify_on(outputStream* st) {
guarantee(is_constantPool(), "object must be constant pool");
for (int i = 0; i< length(); i++) {
constantTag tag = tag_at(i);
- if (tag.is_klass() || tag.is_unresolved_klass() ||
- tag.is_value_type() || tag.is_unresolved_value_type()) {
+ if (tag.is_klass() || tag.is_unresolved_klass()) {
guarantee(klass_name_at(i)->refcount() != 0, "should have nonzero reference count");
} else if (tag.is_symbol()) {
CPSlot entry = slot_at(i);
guarantee(entry.get_symbol()->refcount() != 0, "should have nonzero reference count");
} else if (tag.is_string()) {
< prev index next >