# HG changeset patch # User coleenp # Date 1361540202 18000 # Node ID f16e75e0cf115609f2f6508858c8dc6e8aa052c7 # Parent 5ed317b25e2391438a405ae855c17dc6c7f84084 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 diff -r 5ed317b25e23 -r f16e75e0cf11 agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Fri Feb 22 10:03:02 2013 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Fri Feb 22 08:36:42 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ 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); } diff -r 5ed317b25e23 -r f16e75e0cf11 agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java Fri Feb 22 10:03:02 2013 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java Fri Feb 22 08:36:42 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 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; diff -r 5ed317b25e23 -r f16e75e0cf11 agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java Fri Feb 22 10:03:02 2013 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java Fri Feb 22 08:36:42 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ 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 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 @@ 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); diff -r 5ed317b25e23 -r f16e75e0cf11 src/cpu/sparc/vm/templateTable_sparc.cpp --- a/src/cpu/sparc/vm/templateTable_sparc.cpp Fri Feb 22 10:03:02 2013 +0100 +++ b/src/cpu/sparc/vm/templateTable_sparc.cpp Fri Feb 22 08:36:42 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ __ 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); diff -r 5ed317b25e23 -r f16e75e0cf11 src/share/vm/ci/ciEnv.cpp --- a/src/share/vm/ci/ciEnv.cpp Fri Feb 22 10:03:02 2013 +0100 +++ b/src/share/vm/ci/ciEnv.cpp Fri Feb 22 08:36:42 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ 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)); diff -r 5ed317b25e23 -r f16e75e0cf11 src/share/vm/interpreter/bytecodeTracer.cpp --- a/src/share/vm/interpreter/bytecodeTracer.cpp Fri Feb 22 10:03:02 2013 +0100 +++ b/src/share/vm/interpreter/bytecodeTracer.cpp Fri Feb 22 08:36:42 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ st->print_cr(" %s", constants->resolved_klass_at(i)->external_name()); } else if (tag.is_unresolved_klass()) { st->print_cr(" ", i); - } else if (tag.is_object()) { - st->print(" "); - print_oop(constants->object_at(i), st); } else if (tag.is_method_type()) { int i2 = constants->method_type_index_at(i); st->print(" %d", i2); diff -r 5ed317b25e23 -r f16e75e0cf11 src/share/vm/interpreter/linkResolver.cpp --- a/src/share/vm/interpreter/linkResolver.cpp Fri Feb 22 10:03:02 2013 +0100 +++ b/src/share/vm/interpreter/linkResolver.cpp Fri Feb 22 08:36:42 2013 -0500 @@ -1241,7 +1241,6 @@ 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(, method_name, method_signature, current_klass, pool, index, CHECK); Symbol* method_name = pool->name_ref_at(index); diff -r 5ed317b25e23 -r f16e75e0cf11 src/share/vm/interpreter/rewriter.cpp --- a/src/share/vm/interpreter/rewriter.cpp Fri Feb 22 10:03:02 2013 +0100 +++ b/src/share/vm/interpreter/rewriter.cpp Fri Feb 22 08:36:42 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ 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 @@ 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; diff -r 5ed317b25e23 -r f16e75e0cf11 src/share/vm/oops/constantPool.cpp --- a/src/share/vm/oops/constantPool.cpp Fri Feb 22 10:03:02 2013 +0100 +++ b/src/share/vm/oops/constantPool.cpp Fri Feb 22 08:36:42 2013 -0500 @@ -695,10 +695,6 @@ 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 @@ 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 @@ 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_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); diff -r 5ed317b25e23 -r f16e75e0cf11 src/share/vm/oops/constantPool.hpp --- a/src/share/vm/oops/constantPool.hpp Fri Feb 22 10:03:02 2013 +0100 +++ b/src/share/vm/oops/constantPool.hpp Fri Feb 22 08:36:42 2013 -0500 @@ -97,10 +97,8 @@ Array* _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 @@ Array* tags() const { return _tags; } Array* 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 @@ 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 @@ // 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 @@ 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 } diff -r 5ed317b25e23 -r f16e75e0cf11 src/share/vm/oops/generateOopMap.cpp --- a/src/share/vm/oops/generateOopMap.cpp Fri Feb 22 10:03:02 2013 +0100 +++ b/src/share/vm/oops/generateOopMap.cpp Fri Feb 22 08:36:42 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ 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"); diff -r 5ed317b25e23 -r f16e75e0cf11 src/share/vm/utilities/constantTag.cpp --- a/src/share/vm/utilities/constantTag.cpp Fri Feb 22 10:03:02 2013 +0100 +++ b/src/share/vm/utilities/constantTag.cpp Fri Feb 22 08:36:42 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ 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 @@ 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 : diff -r 5ed317b25e23 -r f16e75e0cf11 src/share/vm/utilities/constantTag.hpp --- a/src/share/vm/utilities/constantTag.hpp Fri Feb 22 10:03:02 2013 +0100 +++ b/src/share/vm/utilities/constantTag.hpp Fri Feb 22 08:36:42 2013 -0500 @@ -1,5 +1,5 @@ /* - * 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 @@ 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 @@ 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 @@ 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() {