Thu, 29 Nov 2012 13:55:49 -0800
Merge
1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java Thu Nov 29 11:23:15 2012 -0800 1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java Thu Nov 29 13:55:49 2012 -0800 1.3 @@ -48,6 +48,7 @@ 1.4 private static int HAS_CHECKED_EXCEPTIONS; 1.5 private static int HAS_LOCALVARIABLE_TABLE; 1.6 private static int HAS_EXCEPTION_TABLE; 1.7 + private static int HAS_GENERIC_SIGNATURE; 1.8 1.9 private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { 1.10 Type type = db.lookupType("ConstMethod"); 1.11 @@ -60,13 +61,14 @@ 1.12 HAS_CHECKED_EXCEPTIONS = db.lookupIntConstant("ConstMethod::_has_checked_exceptions").intValue(); 1.13 HAS_LOCALVARIABLE_TABLE = db.lookupIntConstant("ConstMethod::_has_localvariable_table").intValue(); 1.14 HAS_EXCEPTION_TABLE = db.lookupIntConstant("ConstMethod::_has_exception_table").intValue(); 1.15 + HAS_GENERIC_SIGNATURE = db.lookupIntConstant("ConstMethod::_has_generic_signature").intValue(); 1.16 1.17 // Size of Java bytecodes allocated immediately after ConstMethod*. 1.18 codeSize = new CIntField(type.getCIntegerField("_code_size"), 0); 1.19 nameIndex = new CIntField(type.getCIntegerField("_name_index"), 0); 1.20 signatureIndex = new CIntField(type.getCIntegerField("_signature_index"), 0); 1.21 - genericSignatureIndex = new CIntField(type.getCIntegerField("_generic_signature_index"),0); 1.22 idnum = new CIntField(type.getCIntegerField("_method_idnum"), 0); 1.23 + maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0); 1.24 1.25 // start of byte code 1.26 bytecodeOffset = type.getSize(); 1.27 @@ -92,8 +94,8 @@ 1.28 private static CIntField codeSize; 1.29 private static CIntField nameIndex; 1.30 private static CIntField signatureIndex; 1.31 - private static CIntField genericSignatureIndex; 1.32 private static CIntField idnum; 1.33 + private static CIntField maxStack; 1.34 1.35 // start of bytecode 1.36 private static long bytecodeOffset; 1.37 @@ -134,13 +136,21 @@ 1.38 } 1.39 1.40 public long getGenericSignatureIndex() { 1.41 - return genericSignatureIndex.getValue(this); 1.42 + if (hasGenericSignature()) { 1.43 + return getAddress().getCIntegerAt(offsetOfGenericSignatureIndex(), 2, true); 1.44 + } else { 1.45 + return 0; 1.46 + } 1.47 } 1.48 1.49 public long getIdNum() { 1.50 return idnum.getValue(this); 1.51 } 1.52 1.53 + public long getMaxStack() { 1.54 + return maxStack.getValue(this); 1.55 + } 1.56 + 1.57 public Symbol getName() { 1.58 return getMethod().getName(); 1.59 } 1.60 @@ -235,8 +245,8 @@ 1.61 visitor.doCInt(codeSize, true); 1.62 visitor.doCInt(nameIndex, true); 1.63 visitor.doCInt(signatureIndex, true); 1.64 - visitor.doCInt(genericSignatureIndex, true); 1.65 visitor.doCInt(codeSize, true); 1.66 + visitor.doCInt(maxStack, true); 1.67 } 1.68 1.69 // Accessors 1.70 @@ -353,6 +363,10 @@ 1.71 return ret; 1.72 } 1.73 1.74 + private boolean hasGenericSignature() { 1.75 + return (getFlags() & HAS_GENERIC_SIGNATURE) != 0; 1.76 + } 1.77 + 1.78 1.79 //--------------------------------------------------------------------------- 1.80 // Internals only below this point 1.81 @@ -377,8 +391,14 @@ 1.82 return getSize() * VM.getVM().getObjectHeap().getOopSize() - 2; 1.83 } 1.84 1.85 + // Offset of the generic signature index 1.86 + private long offsetOfGenericSignatureIndex() { 1.87 + return offsetOfLastU2Element(); 1.88 + } 1.89 + 1.90 private long offsetOfCheckedExceptionsLength() { 1.91 - return offsetOfLastU2Element(); 1.92 + return hasGenericSignature() ? offsetOfLastU2Element() - 2 : 1.93 + offsetOfLastU2Element(); 1.94 } 1.95 1.96 private int getCheckedExceptionsLength() { 1.97 @@ -431,7 +451,8 @@ 1.98 } else if (hasCheckedExceptions()) { 1.99 return offsetOfCheckedExceptions() - 2; 1.100 } else { 1.101 - return offsetOfLastU2Element(); 1.102 + return hasGenericSignature() ? offsetOfLastU2Element() - 2 : 1.103 + offsetOfLastU2Element(); 1.104 } 1.105 } 1.106 1.107 @@ -460,7 +481,8 @@ 1.108 if (hasCheckedExceptions()) { 1.109 return offsetOfCheckedExceptions() - 2; 1.110 } else { 1.111 - return offsetOfLastU2Element(); 1.112 + return hasGenericSignature() ? offsetOfLastU2Element() - 2 : 1.113 + offsetOfLastU2Element(); 1.114 } 1.115 } 1.116
2.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java Thu Nov 29 11:23:15 2012 -0800 2.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java Thu Nov 29 13:55:49 2012 -0800 2.3 @@ -50,7 +50,6 @@ 2.4 constMethod = type.getAddressField("_constMethod"); 2.5 methodData = type.getAddressField("_method_data"); 2.6 methodSize = new CIntField(type.getCIntegerField("_method_size"), 0); 2.7 - maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0); 2.8 maxLocals = new CIntField(type.getCIntegerField("_max_locals"), 0); 2.9 sizeOfParameters = new CIntField(type.getCIntegerField("_size_of_parameters"), 0); 2.10 accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0); 2.11 @@ -84,7 +83,6 @@ 2.12 private static AddressField constMethod; 2.13 private static AddressField methodData; 2.14 private static CIntField methodSize; 2.15 - private static CIntField maxStack; 2.16 private static CIntField maxLocals; 2.17 private static CIntField sizeOfParameters; 2.18 private static CIntField accessFlags; 2.19 @@ -135,7 +133,7 @@ 2.20 } 2.21 /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */ 2.22 public long getMethodSize() { return methodSize.getValue(this); } 2.23 - public long getMaxStack() { return maxStack.getValue(this); } 2.24 + public long getMaxStack() { return getConstMethod().getMaxStack(); } 2.25 public long getMaxLocals() { return maxLocals.getValue(this); } 2.26 public long getSizeOfParameters() { return sizeOfParameters.getValue(this); } 2.27 public long getNameIndex() { return getConstMethod().getNameIndex(); } 2.28 @@ -284,7 +282,6 @@ 2.29 2.30 public void iterateFields(MetadataVisitor visitor) { 2.31 visitor.doCInt(methodSize, true); 2.32 - visitor.doCInt(maxStack, true); 2.33 visitor.doCInt(maxLocals, true); 2.34 visitor.doCInt(sizeOfParameters, true); 2.35 visitor.doCInt(accessFlags, true);
3.1 --- a/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Thu Nov 29 11:23:15 2012 -0800 3.2 +++ b/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Thu Nov 29 13:55:49 2012 -0800 3.3 @@ -1048,7 +1048,6 @@ 3.4 const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); 3.5 const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); 3.6 const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); 3.7 - const Address max_stack (G5_method, 0, in_bytes(Method::max_stack_offset())); 3.8 const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); 3.9 3.10 // slop factor is two extra slots on the expression stack so that 3.11 @@ -1070,7 +1069,9 @@ 3.12 __ lduh( size_of_parameters, Gtmp ); 3.13 __ calc_mem_param_words(Gtmp, Gtmp); // space for native call parameters passed on the stack in words 3.14 } else { 3.15 - __ lduh(max_stack, Gtmp); // Full size expression stack 3.16 + // Full size expression stack 3.17 + __ ld_ptr(constMethod, Gtmp); 3.18 + __ lduh(Gtmp, in_bytes(ConstMethod::max_stack_offset()), Gtmp); 3.19 } 3.20 __ add(Gtmp, fixed_size, Gtmp); // plus the fixed portion 3.21 3.22 @@ -1206,7 +1207,9 @@ 3.23 __ sub(O2, wordSize, O2); // prepush 3.24 __ st_ptr(O2, XXX_STATE(_stack)); // PREPUSH 3.25 3.26 - __ lduh(max_stack, O3); // Full size expression stack 3.27 + // Full size expression stack 3.28 + __ ld_ptr(constMethod, O3); 3.29 + __ lduh(O3, in_bytes(ConstMethod::max_stack_offset()), O3); 3.30 guarantee(!EnableInvokeDynamic, "no support yet for java.lang.invoke.MethodHandle"); //6815692 3.31 //6815692//if (EnableInvokeDynamic) 3.32 //6815692// __ inc(O3, Method::extra_stack_entries()); 3.33 @@ -1539,7 +1542,6 @@ 3.34 const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); 3.35 const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); 3.36 const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); 3.37 - const Address max_stack (G5_method, 0, in_bytes(Method::max_stack_offset())); 3.38 const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); 3.39 3.40 address entry_point = __ pc();
4.1 --- a/src/cpu/sparc/vm/interp_masm_sparc.cpp Thu Nov 29 11:23:15 2012 -0800 4.2 +++ b/src/cpu/sparc/vm/interp_masm_sparc.cpp Thu Nov 29 13:55:49 2012 -0800 4.3 @@ -518,7 +518,8 @@ 4.4 delayed()->nop(); 4.5 4.6 // Compute max expression stack+register save area 4.7 - lduh(Lmethod, in_bytes(Method::max_stack_offset()), Gframe_size); // Load max stack. 4.8 + ld_ptr(Lmethod, in_bytes(Method::const_offset()), Gframe_size); 4.9 + lduh(Gframe_size, in_bytes(ConstMethod::max_stack_offset()), Gframe_size); // Load max stack. 4.10 add( Gframe_size, frame::memory_parameter_word_sp_offset, Gframe_size ); 4.11 4.12 //
5.1 --- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Thu Nov 29 11:23:15 2012 -0800 5.2 +++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Thu Nov 29 13:55:49 2012 -0800 5.3 @@ -496,7 +496,7 @@ 5.4 5.5 const Address size_of_parameters(G5_method, Method::size_of_parameters_offset()); 5.6 const Address size_of_locals (G5_method, Method::size_of_locals_offset()); 5.7 - const Address max_stack (G5_method, Method::max_stack_offset()); 5.8 + const Address constMethod (G5_method, Method::const_offset()); 5.9 int rounded_vm_local_words = round_to( frame::interpreter_frame_vm_local_words, WordsPerLong ); 5.10 5.11 const int extra_space = 5.12 @@ -538,7 +538,8 @@ 5.13 // see if the frame is greater than one page in size. If so, 5.14 // then we need to verify there is enough stack space remaining 5.15 // Frame_size = (max_stack + extra_space) * BytesPerWord; 5.16 - __ lduh( max_stack, Gframe_size ); 5.17 + __ ld_ptr( constMethod, Gframe_size ); 5.18 + __ lduh( Gframe_size, in_bytes(ConstMethod::max_stack_offset()), Gframe_size ); 5.19 __ add( Gframe_size, extra_space, Gframe_size ); 5.20 __ round_to( Gframe_size, WordsPerLong ); 5.21 __ sll( Gframe_size, Interpreter::logStackElementSize, Gframe_size);
6.1 --- a/src/cpu/x86/vm/cppInterpreter_x86.cpp Thu Nov 29 11:23:15 2012 -0800 6.2 +++ b/src/cpu/x86/vm/cppInterpreter_x86.cpp Thu Nov 29 13:55:49 2012 -0800 6.3 @@ -538,9 +538,9 @@ 6.4 6.5 // compute full expression stack limit 6.6 6.7 - const Address size_of_stack (rbx, Method::max_stack_offset()); 6.8 const int extra_stack = 0; //6815692//Method::extra_stack_words(); 6.9 - __ load_unsigned_short(rdx, size_of_stack); // get size of expression stack in words 6.10 + __ movptr(rdx, Address(rbx, Method::const_offset())); 6.11 + __ load_unsigned_short(rdx, Address(rdx, ConstMethod::max_stack_offset())); // get size of expression stack in words 6.12 __ negptr(rdx); // so we can subtract in next step 6.13 // Allocate expression stack 6.14 __ lea(rsp, Address(rsp, rdx, Address::times_ptr, -extra_stack)); 6.15 @@ -682,12 +682,12 @@ 6.16 const Address stack_size(thread, Thread::stack_size_offset()); 6.17 6.18 // locals + overhead, in bytes 6.19 - const Address size_of_stack (rbx, Method::max_stack_offset()); 6.20 - // Always give one monitor to allow us to start interp if sync method. 6.21 - // Any additional monitors need a check when moving the expression stack 6.22 - const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize; 6.23 - const int extra_stack = 0; //6815692//Method::extra_stack_entries(); 6.24 - __ load_unsigned_short(rax, size_of_stack); // get size of expression stack in words 6.25 + // Always give one monitor to allow us to start interp if sync method. 6.26 + // Any additional monitors need a check when moving the expression stack 6.27 + const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize; 6.28 + const int extra_stack = 0; //6815692//Method::extra_stack_entries(); 6.29 + __ movptr(rax, Address(rbx, Method::const_offset())); 6.30 + __ load_unsigned_short(rax, Address(rax, ConstMethod::max_stack_offset())); // get size of expression stack in words 6.31 __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), extra_stack + one_monitor)); 6.32 __ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size)); 6.33
7.1 --- a/src/share/vm/classfile/classFileParser.cpp Thu Nov 29 11:23:15 2012 -0800 7.2 +++ b/src/share/vm/classfile/classFileParser.cpp Thu Nov 29 13:55:49 2012 -0800 7.3 @@ -2184,7 +2184,7 @@ 7.4 Method* m = Method::allocate( 7.5 loader_data, code_length, access_flags, linenumber_table_length, 7.6 total_lvt_length, exception_table_length, checked_exceptions_length, 7.7 - ConstMethod::NORMAL, CHECK_(nullHandle)); 7.8 + generic_signature_index, ConstMethod::NORMAL, CHECK_(nullHandle)); 7.9 7.10 ClassLoadingService::add_class_method_size(m->size()*HeapWordSize); 7.11 7.12 @@ -2192,7 +2192,6 @@ 7.13 m->set_constants(cp()); 7.14 m->set_name_index(name_index); 7.15 m->set_signature_index(signature_index); 7.16 - m->set_generic_signature_index(generic_signature_index); 7.17 #ifdef CC_INTERP 7.18 // hmm is there a gc issue here?? 7.19 ResultTypeFinder rtf(cp->symbol_at(signature_index));
8.1 --- a/src/share/vm/classfile/defaultMethods.cpp Thu Nov 29 11:23:15 2012 -0800 8.2 +++ b/src/share/vm/classfile/defaultMethods.cpp Thu Nov 29 13:55:49 2012 -0800 8.3 @@ -1148,12 +1148,11 @@ 8.4 int code_length = bytecodes->length(); 8.5 8.6 Method* m = Method::allocate(cp->pool_holder()->class_loader_data(), 8.7 - code_length, flags, 0, 0, 0, 0, mt, CHECK_NULL); 8.8 + code_length, flags, 0, 0, 0, 0, 0, mt, CHECK_NULL); 8.9 8.10 m->set_constants(NULL); // This will get filled in later 8.11 m->set_name_index(cp->utf8(name)); 8.12 m->set_signature_index(cp->utf8(sig)); 8.13 - m->set_generic_signature_index(0); 8.14 #ifdef CC_INTERP 8.15 ResultTypeFinder rtf(sig); 8.16 m->set_result_index(rtf.type());
9.1 --- a/src/share/vm/oops/constMethod.cpp Thu Nov 29 11:23:15 2012 -0800 9.2 +++ b/src/share/vm/oops/constMethod.cpp Thu Nov 29 13:55:49 2012 -0800 9.3 @@ -39,16 +39,19 @@ 9.4 int localvariable_table_length, 9.5 int exception_table_length, 9.6 int checked_exceptions_length, 9.7 + u2 generic_signature_index, 9.8 MethodType method_type, 9.9 TRAPS) { 9.10 int size = ConstMethod::size(byte_code_size, 9.11 compressed_line_number_size, 9.12 localvariable_table_length, 9.13 exception_table_length, 9.14 - checked_exceptions_length); 9.15 + checked_exceptions_length, 9.16 + generic_signature_index); 9.17 return new (loader_data, size, true, THREAD) ConstMethod( 9.18 byte_code_size, compressed_line_number_size, localvariable_table_length, 9.19 - exception_table_length, checked_exceptions_length, method_type, size); 9.20 + exception_table_length, checked_exceptions_length, generic_signature_index, 9.21 + method_type, size); 9.22 } 9.23 9.24 ConstMethod::ConstMethod(int byte_code_size, 9.25 @@ -56,6 +59,7 @@ 9.26 int localvariable_table_length, 9.27 int exception_table_length, 9.28 int checked_exceptions_length, 9.29 + u2 generic_signature_index, 9.30 MethodType method_type, 9.31 int size) { 9.32 9.33 @@ -66,7 +70,8 @@ 9.34 set_stackmap_data(NULL); 9.35 set_code_size(byte_code_size); 9.36 set_constMethod_size(size); 9.37 - set_inlined_tables_length(checked_exceptions_length, 9.38 + set_inlined_tables_length(generic_signature_index, 9.39 + checked_exceptions_length, 9.40 compressed_line_number_size, 9.41 localvariable_table_length, 9.42 exception_table_length); 9.43 @@ -90,7 +95,8 @@ 9.44 int compressed_line_number_size, 9.45 int local_variable_table_length, 9.46 int exception_table_length, 9.47 - int checked_exceptions_length) { 9.48 + int checked_exceptions_length, 9.49 + u2 generic_signature_index) { 9.50 int extra_bytes = code_size; 9.51 if (compressed_line_number_size > 0) { 9.52 extra_bytes += compressed_line_number_size; 9.53 @@ -108,6 +114,9 @@ 9.54 extra_bytes += sizeof(u2); 9.55 extra_bytes += exception_table_length * sizeof(ExceptionTableElement); 9.56 } 9.57 + if (generic_signature_index != 0) { 9.58 + extra_bytes += sizeof(u2); 9.59 + } 9.60 int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord; 9.61 return align_object_size(header_size() + extra_words); 9.62 } 9.63 @@ -125,10 +134,17 @@ 9.64 return code_end(); 9.65 } 9.66 9.67 +u2* ConstMethod::generic_signature_index_addr() const { 9.68 + // Located at the end of the constMethod. 9.69 + assert(has_generic_signature(), "called only if generic signature exists"); 9.70 + return last_u2_element(); 9.71 +} 9.72 + 9.73 u2* ConstMethod::checked_exceptions_length_addr() const { 9.74 - // Located at the end of the constMethod. 9.75 + // Located immediately before the generic signature index. 9.76 assert(has_checked_exceptions(), "called only if table is present"); 9.77 - return last_u2_element(); 9.78 + return has_generic_signature() ? (last_u2_element() - 1) : 9.79 + last_u2_element(); 9.80 } 9.81 9.82 u2* ConstMethod::exception_table_length_addr() const { 9.83 @@ -137,8 +153,10 @@ 9.84 // If checked_exception present, locate immediately before them. 9.85 return (u2*) checked_exceptions_start() - 1; 9.86 } else { 9.87 - // Else, the exception table is at the end of the constMethod. 9.88 - return last_u2_element(); 9.89 + // Else, the exception table is at the end of the constMethod or 9.90 + // immediately before the generic signature index. 9.91 + return has_generic_signature() ? (last_u2_element() - 1) : 9.92 + last_u2_element(); 9.93 } 9.94 } 9.95 9.96 @@ -152,25 +170,30 @@ 9.97 // If checked_exception present, locate immediately before them. 9.98 return (u2*) checked_exceptions_start() - 1; 9.99 } else { 9.100 - // Else, the linenumber table is at the end of the constMethod. 9.101 - return last_u2_element(); 9.102 + // Else, the linenumber table is at the end of the constMethod or 9.103 + // immediately before the generic signature index. 9.104 + return has_generic_signature() ? (last_u2_element() - 1) : 9.105 + last_u2_element(); 9.106 } 9.107 } 9.108 } 9.109 9.110 - 9.111 // Update the flags to indicate the presence of these optional fields. 9.112 -void ConstMethod::set_inlined_tables_length( 9.113 - int checked_exceptions_len, 9.114 - int compressed_line_number_size, 9.115 - int localvariable_table_len, 9.116 - int exception_table_len) { 9.117 +void ConstMethod::set_inlined_tables_length(u2 generic_signature_index, 9.118 + int checked_exceptions_len, 9.119 + int compressed_line_number_size, 9.120 + int localvariable_table_len, 9.121 + int exception_table_len) { 9.122 // Must be done in the order below, otherwise length_addr accessors 9.123 // will not work. Only set bit in header if length is positive. 9.124 assert(_flags == 0, "Error"); 9.125 if (compressed_line_number_size > 0) { 9.126 _flags |= _has_linenumber_table; 9.127 } 9.128 + if (generic_signature_index != 0) { 9.129 + _flags |= _has_generic_signature; 9.130 + *(generic_signature_index_addr()) = generic_signature_index; 9.131 + } 9.132 if (checked_exceptions_len > 0) { 9.133 _flags |= _has_checked_exceptions; 9.134 *(checked_exceptions_length_addr()) = checked_exceptions_len;
10.1 --- a/src/share/vm/oops/constMethod.hpp Thu Nov 29 11:23:15 2012 -0800 10.2 +++ b/src/share/vm/oops/constMethod.hpp Thu Nov 29 13:55:49 2012 -0800 10.3 @@ -45,7 +45,7 @@ 10.4 // | constMethod_size | 10.5 // | interp_kind | flags | code_size | 10.6 // | name index | signature index | 10.7 -// | method_idnum | generic_signature_index | 10.8 +// | method_idnum | max_stack | 10.9 // |------------------------------------------------------| 10.10 // | | 10.11 // | byte codes | 10.12 @@ -55,26 +55,29 @@ 10.13 // | (see class CompressedLineNumberReadStream) | 10.14 // | (note that length is unknown until decompressed) | 10.15 // | (access flags bit tells whether table is present) | 10.16 -// | (indexed from start of ConstMethod*) | 10.17 +// | (indexed from start of ConstMethod*) | 10.18 // | (elements not necessarily sorted!) | 10.19 // |------------------------------------------------------| 10.20 // | localvariable table elements + length (length last) | 10.21 // | (length is u2, elements are 6-tuples of u2) | 10.22 // | (see class LocalVariableTableElement) | 10.23 // | (access flags bit tells whether table is present) | 10.24 -// | (indexed from end of ConstMethod*) | 10.25 +// | (indexed from end of ConstMethod*) | 10.26 // |------------------------------------------------------| 10.27 // | exception table + length (length last) | 10.28 // | (length is u2, elements are 4-tuples of u2) | 10.29 // | (see class ExceptionTableElement) | 10.30 // | (access flags bit tells whether table is present) | 10.31 -// | (indexed from end of ConstMethod*) | 10.32 +// | (indexed from end of ConstMethod*) | 10.33 // |------------------------------------------------------| 10.34 // | checked exceptions elements + length (length last) | 10.35 // | (length is u2, elements are u2) | 10.36 // | (see class CheckedExceptionElement) | 10.37 // | (access flags bit tells whether table is present) | 10.38 -// | (indexed from end of ConstMethod*) | 10.39 +// | (indexed from end of ConstMethod*) | 10.40 +// |------------------------------------------------------| 10.41 +// | generic signature index (u2) | 10.42 +// | (indexed from start of constMethodOop) | 10.43 // |------------------------------------------------------| 10.44 10.45 10.46 @@ -118,7 +121,8 @@ 10.47 _has_checked_exceptions = 2, 10.48 _has_localvariable_table = 4, 10.49 _has_exception_table = 8, 10.50 - _is_overpass = 16 10.51 + _has_generic_signature = 16, 10.52 + _is_overpass = 32 10.53 }; 10.54 10.55 // Bit vector of signature 10.56 @@ -145,7 +149,7 @@ 10.57 u2 _method_idnum; // unique identification number for the method within the class 10.58 // initially corresponds to the index into the methods array. 10.59 // but this may change with redefinition 10.60 - u2 _generic_signature_index; // Generic signature (index in constant pool, 0 if absent) 10.61 + u2 _max_stack; // Maximum number of entries on the expression stack 10.62 10.63 10.64 // Constructor 10.65 @@ -154,6 +158,7 @@ 10.66 int localvariable_table_length, 10.67 int exception_table_length, 10.68 int checked_exceptions_length, 10.69 + u2 generic_signature_index, 10.70 MethodType is_overpass, 10.71 int size); 10.72 public: 10.73 @@ -164,17 +169,22 @@ 10.74 int localvariable_table_length, 10.75 int exception_table_length, 10.76 int checked_exceptions_length, 10.77 + u2 generic_signature_index, 10.78 MethodType mt, 10.79 TRAPS); 10.80 10.81 bool is_constMethod() const { return true; } 10.82 10.83 // Inlined tables 10.84 - void set_inlined_tables_length(int checked_exceptions_len, 10.85 + void set_inlined_tables_length(u2 generic_signature_index, 10.86 + int checked_exceptions_len, 10.87 int compressed_line_number_size, 10.88 int localvariable_table_len, 10.89 int exception_table_len); 10.90 10.91 + bool has_generic_signature() const 10.92 + { return (_flags & _has_generic_signature) != 0; } 10.93 + 10.94 bool has_linenumber_table() const 10.95 { return (_flags & _has_linenumber_table) != 0; } 10.96 10.97 @@ -252,8 +262,18 @@ 10.98 void set_signature_index(int index) { _signature_index = index; } 10.99 10.100 // generics support 10.101 - int generic_signature_index() const { return _generic_signature_index; } 10.102 - void set_generic_signature_index(int index) { _generic_signature_index = index; } 10.103 + int generic_signature_index() const { 10.104 + if (has_generic_signature()) { 10.105 + return *generic_signature_index_addr(); 10.106 + } else { 10.107 + return 0; 10.108 + } 10.109 + } 10.110 + void set_generic_signature_index(u2 index) { 10.111 + assert(has_generic_signature(), ""); 10.112 + u2* addr = generic_signature_index_addr(); 10.113 + *addr = index; 10.114 + } 10.115 10.116 // Sizing 10.117 static int header_size() { 10.118 @@ -264,7 +284,8 @@ 10.119 static int size(int code_size, int compressed_line_number_size, 10.120 int local_variable_table_length, 10.121 int exception_table_length, 10.122 - int checked_exceptions_length); 10.123 + int checked_exceptions_length, 10.124 + u2 generic_signature_index); 10.125 10.126 int size() const { return _constMethod_size;} 10.127 void set_constMethod_size(int size) { _constMethod_size = size; } 10.128 @@ -281,6 +302,7 @@ 10.129 // linenumber table - note that length is unknown until decompression, 10.130 // see class CompressedLineNumberReadStream. 10.131 u_char* compressed_linenumber_table() const; // not preserved by gc 10.132 + u2* generic_signature_index_addr() const; 10.133 u2* checked_exceptions_length_addr() const; 10.134 u2* localvariable_table_length_addr() const; 10.135 u2* exception_table_length_addr() const; 10.136 @@ -314,12 +336,19 @@ 10.137 static ByteSize constants_offset() 10.138 { return byte_offset_of(ConstMethod, _constants); } 10.139 10.140 + static ByteSize max_stack_offset() 10.141 + { return byte_offset_of(ConstMethod, _max_stack); } 10.142 + 10.143 // Unique id for the method 10.144 static const u2 MAX_IDNUM; 10.145 static const u2 UNSET_IDNUM; 10.146 u2 method_idnum() const { return _method_idnum; } 10.147 void set_method_idnum(u2 idnum) { _method_idnum = idnum; } 10.148 10.149 + // max stack 10.150 + int max_stack() const { return _max_stack; } 10.151 + void set_max_stack(int size) { _max_stack = size; } 10.152 + 10.153 // Deallocation for RedefineClasses 10.154 void deallocate_contents(ClassLoaderData* loader_data); 10.155 bool is_klass() const { return false; }
11.1 --- a/src/share/vm/oops/method.cpp Thu Nov 29 11:23:15 2012 -0800 11.2 +++ b/src/share/vm/oops/method.cpp Thu Nov 29 13:55:49 2012 -0800 11.3 @@ -64,6 +64,7 @@ 11.4 int localvariable_table_length, 11.5 int exception_table_length, 11.6 int checked_exceptions_length, 11.7 + u2 generic_signature_index, 11.8 ConstMethod::MethodType method_type, 11.9 TRAPS) { 11.10 assert(!access_flags.is_native() || byte_code_size == 0, 11.11 @@ -74,6 +75,7 @@ 11.12 localvariable_table_length, 11.13 exception_table_length, 11.14 checked_exceptions_length, 11.15 + generic_signature_index, 11.16 method_type, 11.17 CHECK_NULL); 11.18 11.19 @@ -1034,7 +1036,7 @@ 11.20 methodHandle m; 11.21 { 11.22 Method* m_oop = Method::allocate(loader_data, 0, accessFlags_from(flags_bits), 11.23 - 0, 0, 0, 0, ConstMethod::NORMAL, CHECK_(empty)); 11.24 + 0, 0, 0, 0, 0, ConstMethod::NORMAL, CHECK_(empty)); 11.25 m = methodHandle(THREAD, m_oop); 11.26 } 11.27 m->set_constants(cp()); 11.28 @@ -1082,6 +1084,7 @@ 11.29 assert(!m->is_native(), "cannot rewrite native methods"); 11.30 // Allocate new Method* 11.31 AccessFlags flags = m->access_flags(); 11.32 + u2 generic_signature_index = m->generic_signature_index(); 11.33 int checked_exceptions_len = m->checked_exceptions_length(); 11.34 int localvariable_len = m->localvariable_table_length(); 11.35 int exception_table_len = m->exception_table_length(); 11.36 @@ -1094,6 +1097,7 @@ 11.37 localvariable_len, 11.38 exception_table_len, 11.39 checked_exceptions_len, 11.40 + generic_signature_index, 11.41 m->method_type(), 11.42 CHECK_(methodHandle())); 11.43 methodHandle newm (THREAD, newm_oop);
12.1 --- a/src/share/vm/oops/method.hpp Thu Nov 29 11:23:15 2012 -0800 12.2 +++ b/src/share/vm/oops/method.hpp Thu Nov 29 13:55:49 2012 -0800 12.3 @@ -73,12 +73,10 @@ 12.4 // |------------------------------------------------------| 12.5 // | result_index (C++ interpreter only) | 12.6 // |------------------------------------------------------| 12.7 -// | method_size | max_stack | 12.8 -// | max_locals | size_of_parameters | 12.9 +// | method_size | max_locals | 12.10 +// | size_of_parameters | intrinsic_id| flags | 12.11 // |------------------------------------------------------| 12.12 -// |intrinsic_id| flags | throwout_count | 12.13 -// |------------------------------------------------------| 12.14 -// | num_breakpoints | (unused) | 12.15 +// | throwout_count | num_breakpoints | 12.16 // |------------------------------------------------------| 12.17 // | invocation_counter | 12.18 // | backedge_counter | 12.19 @@ -118,7 +116,6 @@ 12.20 int _result_index; // C++ interpreter needs for converting results to/from stack 12.21 #endif 12.22 u2 _method_size; // size of this object 12.23 - u2 _max_stack; // Maximum number of entries on the expression stack 12.24 u2 _max_locals; // Number of local variables used by this method 12.25 u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words 12.26 u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none) 12.27 @@ -166,6 +163,7 @@ 12.28 int localvariable_table_length, 12.29 int exception_table_length, 12.30 int checked_exceptions_length, 12.31 + u2 generic_signature_index, 12.32 ConstMethod::MethodType method_type, 12.33 TRAPS); 12.34 12.35 @@ -289,9 +287,9 @@ 12.36 12.37 // max stack 12.38 // return original max stack size for method verification 12.39 - int verifier_max_stack() const { return _max_stack; } 12.40 - int max_stack() const { return _max_stack + extra_stack_entries(); } 12.41 - void set_max_stack(int size) { _max_stack = size; } 12.42 + int verifier_max_stack() const { return constMethod()->max_stack(); } 12.43 + int max_stack() const { return constMethod()->max_stack() + extra_stack_entries(); } 12.44 + void set_max_stack(int size) { constMethod()->set_max_stack(size); } 12.45 12.46 // max locals 12.47 int max_locals() const { return _max_locals; } 12.48 @@ -607,7 +605,6 @@ 12.49 static ByteSize from_interpreted_offset() { return byte_offset_of(Method, _from_interpreted_entry ); } 12.50 static ByteSize interpreter_entry_offset() { return byte_offset_of(Method, _i2i_entry ); } 12.51 static ByteSize signature_handler_offset() { return in_ByteSize(sizeof(Method) + wordSize); } 12.52 - static ByteSize max_stack_offset() { return byte_offset_of(Method, _max_stack ); } 12.53 12.54 // for code generation 12.55 static int method_data_offset_in_bytes() { return offset_of(Method, _method_data); }
13.1 --- a/src/share/vm/runtime/vmStructs.cpp Thu Nov 29 11:23:15 2012 -0800 13.2 +++ b/src/share/vm/runtime/vmStructs.cpp Thu Nov 29 13:55:49 2012 -0800 13.3 @@ -355,7 +355,6 @@ 13.4 nonstatic_field(Method, _access_flags, AccessFlags) \ 13.5 nonstatic_field(Method, _vtable_index, int) \ 13.6 nonstatic_field(Method, _method_size, u2) \ 13.7 - nonstatic_field(Method, _max_stack, u2) \ 13.8 nonstatic_field(Method, _max_locals, u2) \ 13.9 nonstatic_field(Method, _size_of_parameters, u2) \ 13.10 nonstatic_field(Method, _interpreter_throwout_count, u2) \ 13.11 @@ -378,7 +377,7 @@ 13.12 nonstatic_field(ConstMethod, _name_index, u2) \ 13.13 nonstatic_field(ConstMethod, _signature_index, u2) \ 13.14 nonstatic_field(ConstMethod, _method_idnum, u2) \ 13.15 - nonstatic_field(ConstMethod, _generic_signature_index, u2) \ 13.16 + nonstatic_field(ConstMethod, _max_stack, u2) \ 13.17 nonstatic_field(ObjArrayKlass, _element_klass, Klass*) \ 13.18 nonstatic_field(ObjArrayKlass, _bottom_klass, Klass*) \ 13.19 volatile_nonstatic_field(Symbol, _refcount, int) \ 13.20 @@ -2280,6 +2279,7 @@ 13.21 declare_constant(ConstMethod::_has_checked_exceptions) \ 13.22 declare_constant(ConstMethod::_has_localvariable_table) \ 13.23 declare_constant(ConstMethod::_has_exception_table) \ 13.24 + declare_constant(ConstMethod::_has_generic_signature) \ 13.25 \ 13.26 /*************************************/ \ 13.27 /* InstanceKlass enum */ \