提交 b0e2c05b 编写于 作者: C coleenp

8000797: NPG: is_pseudo_string_at() doesn't work

Summary: Zero Symbol* for constant pool strings to indicate pseudo_strings (objects that aren't strings).  Clean up JVM_CONSTANT_Object and unused flags.
Reviewed-by: sspitsyn, jrose
上级 b281f85c
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2013, 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
......@@ -469,7 +469,6 @@ public class ConstantPool extends Metadata implements ClassConstants {
case JVM_CONSTANT_UnresolvedClassInError: return "JVM_CONSTANT_UnresolvedClassInError";
case JVM_CONSTANT_MethodHandleInError:return "JVM_CONSTANT_MethodHandleInError";
case JVM_CONSTANT_MethodTypeInError: return "JVM_CONSTANT_MethodTypeInError";
case JVM_CONSTANT_Object: return "JVM_CONSTANT_Object";
}
throw new InternalError("Unknown tag: " + tag);
}
......
/*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2013, 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
......@@ -67,7 +67,6 @@ public interface ClassConstants
public static final int JVM_CONSTANT_UnresolvedClassInError = 103; // Error tag due to resolution error
public static final int JVM_CONSTANT_MethodHandleInError = 104; // Error tag due to resolution error
public static final int JVM_CONSTANT_MethodTypeInError = 105; // Error tag due to resolution error
public static final int JVM_CONSTANT_Object = 106; // Required for BoundMethodHandle arguments.
// 1.5 major/minor version numbers from JVM spec. 3rd edition
public static final short MAJOR_VERSION = 49;
......
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2013, 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
......@@ -51,7 +51,6 @@ public class ConstantTag {
private static final int JVM_CONSTANT_UnresolvedClassInError = 103; // Resolution failed
private static final int JVM_CONSTANT_MethodHandleInError = 104; // Error tag due to resolution error
private static final int JVM_CONSTANT_MethodTypeInError = 105; // Error tag due to resolution error
private static final int JVM_CONSTANT_Object = 106; // Required for BoundMethodHandle arguments.
// JVM_CONSTANT_MethodHandle subtypes //FIXME: connect these to data structure
private static int JVM_REF_getField = 1;
......@@ -96,8 +95,6 @@ public class ConstantTag {
public boolean isKlassIndex() { return tag == JVM_CONSTANT_ClassIndex; }
public boolean isStringIndex() { return tag == JVM_CONSTANT_StringIndex; }
public boolean isObject() { return tag == JVM_CONSTANT_Object; }
public boolean isKlassReference() { return isKlassIndex() || isUnresolvedKlass(); }
public boolean isFieldOrMethod() { return isField() || isMethod() || isInterfaceMethod(); }
public boolean isSymbol() { return isUtf8(); }
......@@ -123,7 +120,6 @@ public class ConstantTag {
case JVM_CONSTANT_StringIndex :
case JVM_CONSTANT_MethodHandle :
case JVM_CONSTANT_MethodType :
case JVM_CONSTANT_Object :
return BasicType.T_OBJECT;
default:
throw new InternalError("unexpected tag: " + tag);
......
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2013, 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
......@@ -340,8 +340,6 @@ void TemplateTable::ldc(bool wide) {
__ bind(notInt);
// __ cmp(O2, JVM_CONSTANT_String);
__ brx(Assembler::equal, true, Assembler::pt, isString);
__ delayed()->cmp(O2, JVM_CONSTANT_Object);
__ brx(Assembler::notEqual, true, Assembler::pt, notString);
__ delayed()->ldf(FloatRegisterImpl::S, O0, O1, Ftos_f);
__ bind(isString);
......
/*
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2013, 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
......@@ -597,10 +597,6 @@ ciConstant ciEnv::get_constant_by_index_impl(constantPoolHandle cpool,
assert (klass->is_instance_klass() || klass->is_array_klass(),
"must be an instance or array klass ");
return ciConstant(T_OBJECT, klass->java_mirror());
} else if (tag.is_object()) {
oop obj = cpool->object_at(index);
ciObject* ciobj = get_object(obj);
return ciConstant(T_OBJECT, ciobj);
} else if (tag.is_method_type()) {
// must execute Java code to link this CP entry into cache[i].f1
ciSymbol* signature = get_symbol(cpool->method_type_signature_at(index));
......
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2013, 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
......@@ -335,9 +335,6 @@ void BytecodePrinter::print_constant(int i, outputStream* st) {
st->print_cr(" %s", constants->resolved_klass_at(i)->external_name());
} else if (tag.is_unresolved_klass()) {
st->print_cr(" <unresolved klass at %d>", i);
} else if (tag.is_object()) {
st->print(" <Object>");
print_oop(constants->object_at(i), st);
} else if (tag.is_method_type()) {
int i2 = constants->method_type_index_at(i);
st->print(" <MethodType> %d", i2);
......
......@@ -1241,7 +1241,6 @@ void LinkResolver::resolve_handle_call(CallInfo& result, KlassHandle resolved_kl
void LinkResolver::resolve_invokedynamic(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
assert(EnableInvokeDynamic, "");
pool->set_has_invokedynamic(); // mark header to flag active call sites
//resolve_pool(<resolved_klass>, method_name, method_signature, current_klass, pool, index, CHECK);
Symbol* method_name = pool->name_ref_at(index);
......
/*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2013, 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
......@@ -48,7 +48,6 @@ void Rewriter::compute_index_maps() {
add_cp_cache_entry(i);
break;
case JVM_CONSTANT_String:
case JVM_CONSTANT_Object:
case JVM_CONSTANT_MethodHandle : // fall through
case JVM_CONSTANT_MethodType : // fall through
add_resolved_references_entry(i);
......@@ -238,7 +237,7 @@ void Rewriter::maybe_rewrite_ldc(address bcp, int offset, bool is_wide,
address p = bcp + offset;
int cp_index = is_wide ? Bytes::get_Java_u2(p) : (u1)(*p);
constantTag tag = _pool->tag_at(cp_index).value();
if (tag.is_method_handle() || tag.is_method_type() || tag.is_string() || tag.is_object()) {
if (tag.is_method_handle() || tag.is_method_type() || tag.is_string()) {
int ref_index = cp_entry_to_resolved_references(cp_index);
if (is_wide) {
(*bcp) = Bytecodes::_fast_aldc_w;
......
......@@ -695,10 +695,6 @@ oop ConstantPool::resolve_constant_at_impl(constantPoolHandle this_oop, int inde
result_oop = string_at_impl(this_oop, index, cache_index, CHECK_NULL);
break;
case JVM_CONSTANT_Object:
result_oop = this_oop->object_at(index);
break;
case JVM_CONSTANT_MethodHandleInError:
case JVM_CONSTANT_MethodTypeInError:
{
......@@ -1824,8 +1820,6 @@ void ConstantPool::print_on(outputStream* st) const {
st->print_cr(internal_name());
if (flags() != 0) {
st->print(" - flags: 0x%x", flags());
if (has_pseudo_string()) st->print(" has_pseudo_string");
if (has_invokedynamic()) st->print(" has_invokedynamic");
if (has_preresolution()) st->print(" has_preresolution");
if (on_stack()) st->print(" on_stack");
st->cr();
......@@ -1869,13 +1863,14 @@ void ConstantPool::print_entry_on(const int index, outputStream* st) {
st->print(" name_and_type_index=%d", uncached_name_and_type_ref_index_at(index));
break;
case JVM_CONSTANT_String :
unresolved_string_at(index)->print_value_on(st);
if (is_pseudo_string_at(index)) {
oop anObj = pseudo_string_at(index);
anObj->print_value_on(st);
st->print(" {0x%lx}", (address)anObj);
} else {
unresolved_string_at(index)->print_value_on(st);
}
break;
case JVM_CONSTANT_Object : {
oop anObj = object_at(index);
anObj->print_value_on(st);
st->print(" {0x%lx}", (address)anObj);
} break;
case JVM_CONSTANT_Integer :
st->print("%d", int_at(index));
break;
......@@ -1939,8 +1934,6 @@ void ConstantPool::print_entry_on(const int index, outputStream* st) {
void ConstantPool::print_value_on(outputStream* st) const {
assert(is_constantPool(), "must be constantPool");
st->print("constant pool [%d]", length());
if (has_pseudo_string()) st->print("/pseudo_string");
if (has_invokedynamic()) st->print("/invokedynamic");
if (has_preresolution()) st->print("/preresolution");
if (operands() != NULL) st->print("/operands[%d]", operands()->length());
print_address_on(st);
......
......@@ -97,10 +97,8 @@ class ConstantPool : public Metadata {
Array<u2>* _reference_map;
enum {
_has_invokedynamic = 1, // Flags
_has_pseudo_string = 2,
_has_preresolution = 4,
_on_stack = 8
_has_preresolution = 1, // Flags
_on_stack = 2
};
int _flags; // old fashioned bit twiddling
......@@ -175,12 +173,6 @@ class ConstantPool : public Metadata {
Array<u1>* tags() const { return _tags; }
Array<u2>* operands() const { return _operands; }
bool has_invokedynamic() const { return (_flags & _has_invokedynamic) != 0; }
void set_has_invokedynamic() { _flags |= _has_invokedynamic; }
bool has_pseudo_string() const { return (_flags & _has_pseudo_string) != 0; }
void set_has_pseudo_string() { _flags |= _has_pseudo_string; }
bool has_preresolution() const { return (_flags & _has_preresolution) != 0; }
void set_has_preresolution() { _flags |= _has_preresolution; }
......@@ -324,14 +316,6 @@ class ConstantPool : public Metadata {
resolved_references()->obj_at_put(obj_index, str);
}
void set_object_tag_at(int which) {
release_tag_at_put(which, JVM_CONSTANT_Object);
}
void object_at_put(int which, oop obj) {
resolved_references()->obj_at_put(cp_to_object_index(which), obj);
}
// For temporary use while constructing constant pool
void string_index_at_put(int which, int string_index) {
tag_at_put(which, JVM_CONSTANT_StringIndex);
......@@ -429,12 +413,6 @@ class ConstantPool : public Metadata {
// Version that can be used before string oop array is created.
oop uncached_string_at(int which, TRAPS);
oop object_at(int which) {
assert(tag_at(which).is_object(), "Corrupted constant pool");
int obj_index = cp_to_object_index(which);
return resolved_references()->obj_at(obj_index);
}
// A "pseudo-string" is an non-string oop that has found is way into
// a String entry.
// Under EnableInvokeDynamic this can happen if the user patches a live
......@@ -454,10 +432,18 @@ class ConstantPool : public Metadata {
return s;
}
oop pseudo_string_at(int which) {
assert(tag_at(which).is_string(), "Corrupted constant pool");
assert(unresolved_string_at(which) == NULL, "shouldn't have symbol");
int obj_index = cp_to_object_index(which);
oop s = resolved_references()->obj_at(obj_index);
return s;
}
void pseudo_string_at_put(int which, int obj_index, oop x) {
assert(EnableInvokeDynamic, "");
set_has_pseudo_string(); // mark header
assert(tag_at(which).is_string(), "Corrupted constant pool");
unresolved_string_at_put(which, NULL); // indicates patched string
string_at_put(which, obj_index, x); // this works just fine
}
......
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2013, 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
......@@ -1853,7 +1853,6 @@ void GenerateOopMap::do_ldc(int bci) {
if (tag.is_klass() ||
tag.is_unresolved_klass() ||
tag.is_string() ||
tag.is_object() ||
tag.is_method_handle() ||
tag.is_method_type()) {
assert(bt == T_OBJECT, "Guard is incorrect");
......
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2013, 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
......@@ -52,7 +52,6 @@ BasicType constantTag::basic_type() const {
case JVM_CONSTANT_StringIndex :
case JVM_CONSTANT_MethodHandle :
case JVM_CONSTANT_MethodType :
case JVM_CONSTANT_Object :
return T_OBJECT;
default:
ShouldNotReachHere();
......@@ -96,8 +95,6 @@ const char* constantTag::internal_name() const {
return "MethodType Error";
case JVM_CONSTANT_InvokeDynamic :
return "InvokeDynamic";
case JVM_CONSTANT_Object :
return "Object";
case JVM_CONSTANT_Utf8 :
return "Utf8";
case JVM_CONSTANT_UnresolvedClass :
......
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2013, 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
......@@ -43,8 +43,7 @@ enum {
JVM_CONSTANT_UnresolvedClassInError = 103, // Error tag due to resolution error
JVM_CONSTANT_MethodHandleInError = 104, // Error tag due to resolution error
JVM_CONSTANT_MethodTypeInError = 105, // Error tag due to resolution error
JVM_CONSTANT_Object = 106, // Required for BoundMethodHandle arguments.
JVM_CONSTANT_InternalMax = 106 // Last implementation tag
JVM_CONSTANT_InternalMax = 105 // Last implementation tag
};
......@@ -84,8 +83,6 @@ class constantTag VALUE_OBJ_CLASS_SPEC {
bool is_klass_index() const { return _tag == JVM_CONSTANT_ClassIndex; }
bool is_string_index() const { return _tag == JVM_CONSTANT_StringIndex; }
bool is_object() const { return _tag == JVM_CONSTANT_Object; }
bool is_klass_reference() const { return is_klass_index() || is_unresolved_klass(); }
bool is_klass_or_reference() const{ return is_klass() || is_klass_reference(); }
bool is_field_or_method() const { return is_field() || is_method() || is_interface_method(); }
......@@ -98,7 +95,7 @@ class constantTag VALUE_OBJ_CLASS_SPEC {
bool is_loadable_constant() const {
return ((_tag >= JVM_CONSTANT_Integer && _tag <= JVM_CONSTANT_String) ||
is_method_type() || is_method_handle() ||
is_unresolved_klass() || is_object());
is_unresolved_klass());
}
constantTag() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册