Fri, 20 Mar 2009 23:19:36 -0700
6814659: separable cleanups and subroutines for 6655638
Summary: preparatory but separable changes for method handles
Reviewed-by: kvn, never
1.1 --- a/src/cpu/sparc/vm/assembler_sparc.cpp Thu Mar 19 09:13:24 2009 -0700 1.2 +++ b/src/cpu/sparc/vm/assembler_sparc.cpp Fri Mar 20 23:19:36 2009 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -2615,12 +2615,12 @@ 1.11 } 1.12 } 1.13 1.14 -RegisterConstant MacroAssembler::delayed_value(intptr_t* delayed_value_addr, 1.15 - Register tmp, 1.16 - int offset) { 1.17 +RegisterOrConstant MacroAssembler::delayed_value_impl(intptr_t* delayed_value_addr, 1.18 + Register tmp, 1.19 + int offset) { 1.20 intptr_t value = *delayed_value_addr; 1.21 if (value != 0) 1.22 - return RegisterConstant(value + offset); 1.23 + return RegisterOrConstant(value + offset); 1.24 1.25 // load indirectly to solve generation ordering problem 1.26 Address a(tmp, (address) delayed_value_addr); 1.27 @@ -2634,11 +2634,11 @@ 1.28 if (offset != 0) 1.29 add(tmp, offset, tmp); 1.30 1.31 - return RegisterConstant(tmp); 1.32 + return RegisterOrConstant(tmp); 1.33 } 1.34 1.35 1.36 -void MacroAssembler::regcon_inc_ptr( RegisterConstant& dest, RegisterConstant src, Register temp ) { 1.37 +void MacroAssembler::regcon_inc_ptr( RegisterOrConstant& dest, RegisterOrConstant src, Register temp ) { 1.38 assert(dest.register_or_noreg() != G0, "lost side effect"); 1.39 if ((src.is_constant() && src.as_constant() == 0) || 1.40 (src.is_register() && src.as_register() == G0)) { 1.41 @@ -2647,15 +2647,15 @@ 1.42 add(dest.as_register(), ensure_rs2(src, temp), dest.as_register()); 1.43 } else if (src.is_constant()) { 1.44 intptr_t res = dest.as_constant() + src.as_constant(); 1.45 - dest = RegisterConstant(res); // side effect seen by caller 1.46 + dest = RegisterOrConstant(res); // side effect seen by caller 1.47 } else { 1.48 assert(temp != noreg, "cannot handle constant += register"); 1.49 add(src.as_register(), ensure_rs2(dest, temp), temp); 1.50 - dest = RegisterConstant(temp); // side effect seen by caller 1.51 + dest = RegisterOrConstant(temp); // side effect seen by caller 1.52 } 1.53 } 1.54 1.55 -void MacroAssembler::regcon_sll_ptr( RegisterConstant& dest, RegisterConstant src, Register temp ) { 1.56 +void MacroAssembler::regcon_sll_ptr( RegisterOrConstant& dest, RegisterOrConstant src, Register temp ) { 1.57 assert(dest.register_or_noreg() != G0, "lost side effect"); 1.58 if (!is_simm13(src.constant_or_zero())) 1.59 src = (src.as_constant() & 0xFF); 1.60 @@ -2666,12 +2666,12 @@ 1.61 sll_ptr(dest.as_register(), src, dest.as_register()); 1.62 } else if (src.is_constant()) { 1.63 intptr_t res = dest.as_constant() << src.as_constant(); 1.64 - dest = RegisterConstant(res); // side effect seen by caller 1.65 + dest = RegisterOrConstant(res); // side effect seen by caller 1.66 } else { 1.67 assert(temp != noreg, "cannot handle constant <<= register"); 1.68 set(dest.as_constant(), temp); 1.69 sll_ptr(temp, src, temp); 1.70 - dest = RegisterConstant(temp); // side effect seen by caller 1.71 + dest = RegisterOrConstant(temp); // side effect seen by caller 1.72 } 1.73 } 1.74 1.75 @@ -2683,7 +2683,7 @@ 1.76 // On failure, execution transfers to the given label. 1.77 void MacroAssembler::lookup_interface_method(Register recv_klass, 1.78 Register intf_klass, 1.79 - RegisterConstant itable_index, 1.80 + RegisterOrConstant itable_index, 1.81 Register method_result, 1.82 Register scan_temp, 1.83 Register sethi_temp, 1.84 @@ -2720,7 +2720,7 @@ 1.85 add(recv_klass, scan_temp, scan_temp); 1.86 1.87 // Adjust recv_klass by scaled itable_index, so we can free itable_index. 1.88 - RegisterConstant itable_offset = itable_index; 1.89 + RegisterOrConstant itable_offset = itable_index; 1.90 regcon_sll_ptr(itable_offset, exact_log2(itableMethodEntry::size() * wordSize)); 1.91 regcon_inc_ptr(itable_offset, itableMethodEntry::method_offset_in_bytes()); 1.92 add(recv_klass, ensure_rs2(itable_offset, sethi_temp), recv_klass); 1.93 @@ -2805,7 +2805,7 @@ 1.94 Label* L_success, 1.95 Label* L_failure, 1.96 Label* L_slow_path, 1.97 - RegisterConstant super_check_offset, 1.98 + RegisterOrConstant super_check_offset, 1.99 Register instanceof_hack) { 1.100 int sc_offset = (klassOopDesc::header_size() * HeapWordSize + 1.101 Klass::secondary_super_cache_offset_in_bytes()); 1.102 @@ -2867,7 +2867,7 @@ 1.103 if (must_load_sco) { 1.104 // The super check offset is always positive... 1.105 lduw(super_klass, sco_offset, temp2_reg); 1.106 - super_check_offset = RegisterConstant(temp2_reg); 1.107 + super_check_offset = RegisterOrConstant(temp2_reg); 1.108 } 1.109 ld_ptr(sub_klass, super_check_offset, temp_reg); 1.110 cmp(super_klass, temp_reg); 1.111 @@ -4472,7 +4472,7 @@ 1.112 } 1.113 1.114 // Loading values by size and signed-ness 1.115 -void MacroAssembler::load_sized_value(Register s1, RegisterConstant s2, Register d, 1.116 +void MacroAssembler::load_sized_value(Register s1, RegisterOrConstant s2, Register d, 1.117 int size_in_bytes, bool is_signed) { 1.118 switch (size_in_bytes ^ (is_signed ? -1 : 0)) { 1.119 case ~8: // fall through:
2.1 --- a/src/cpu/sparc/vm/assembler_sparc.hpp Thu Mar 19 09:13:24 2009 -0700 2.2 +++ b/src/cpu/sparc/vm/assembler_sparc.hpp Fri Mar 20 23:19:36 2009 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 2.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -1088,8 +1088,8 @@ 2.11 inline void add( Register s1, Register s2, Register d ); 2.12 inline void add( Register s1, int simm13a, Register d, relocInfo::relocType rtype = relocInfo::none); 2.13 inline void add( Register s1, int simm13a, Register d, RelocationHolder const& rspec); 2.14 - inline void add( Register s1, RegisterConstant s2, Register d, int offset = 0); 2.15 - inline void add( const Address& a, Register d, int offset = 0); 2.16 + inline void add( Register s1, RegisterOrConstant s2, Register d, int offset = 0); 2.17 + inline void add( const Address& a, Register d, int offset = 0); 2.18 2.19 void addcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); } 2.20 void addcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); } 2.21 @@ -1305,15 +1305,15 @@ 2.22 inline void ld( const Address& a, Register d, int offset = 0 ); 2.23 inline void ldd( const Address& a, Register d, int offset = 0 ); 2.24 2.25 - inline void ldub( Register s1, RegisterConstant s2, Register d ); 2.26 - inline void ldsb( Register s1, RegisterConstant s2, Register d ); 2.27 - inline void lduh( Register s1, RegisterConstant s2, Register d ); 2.28 - inline void ldsh( Register s1, RegisterConstant s2, Register d ); 2.29 - inline void lduw( Register s1, RegisterConstant s2, Register d ); 2.30 - inline void ldsw( Register s1, RegisterConstant s2, Register d ); 2.31 - inline void ldx( Register s1, RegisterConstant s2, Register d ); 2.32 - inline void ld( Register s1, RegisterConstant s2, Register d ); 2.33 - inline void ldd( Register s1, RegisterConstant s2, Register d ); 2.34 + inline void ldub( Register s1, RegisterOrConstant s2, Register d ); 2.35 + inline void ldsb( Register s1, RegisterOrConstant s2, Register d ); 2.36 + inline void lduh( Register s1, RegisterOrConstant s2, Register d ); 2.37 + inline void ldsh( Register s1, RegisterOrConstant s2, Register d ); 2.38 + inline void lduw( Register s1, RegisterOrConstant s2, Register d ); 2.39 + inline void ldsw( Register s1, RegisterOrConstant s2, Register d ); 2.40 + inline void ldx( Register s1, RegisterOrConstant s2, Register d ); 2.41 + inline void ld( Register s1, RegisterOrConstant s2, Register d ); 2.42 + inline void ldd( Register s1, RegisterOrConstant s2, Register d ); 2.43 2.44 // pp 177 2.45 2.46 @@ -1535,12 +1535,12 @@ 2.47 inline void st( Register d, const Address& a, int offset = 0 ); 2.48 inline void std( Register d, const Address& a, int offset = 0 ); 2.49 2.50 - inline void stb( Register d, Register s1, RegisterConstant s2 ); 2.51 - inline void sth( Register d, Register s1, RegisterConstant s2 ); 2.52 - inline void stw( Register d, Register s1, RegisterConstant s2 ); 2.53 - inline void stx( Register d, Register s1, RegisterConstant s2 ); 2.54 - inline void std( Register d, Register s1, RegisterConstant s2 ); 2.55 - inline void st( Register d, Register s1, RegisterConstant s2 ); 2.56 + inline void stb( Register d, Register s1, RegisterOrConstant s2 ); 2.57 + inline void sth( Register d, Register s1, RegisterOrConstant s2 ); 2.58 + inline void stw( Register d, Register s1, RegisterOrConstant s2 ); 2.59 + inline void stx( Register d, Register s1, RegisterOrConstant s2 ); 2.60 + inline void std( Register d, Register s1, RegisterOrConstant s2 ); 2.61 + inline void st( Register d, Register s1, RegisterOrConstant s2 ); 2.62 2.63 // pp 177 2.64 2.65 @@ -1859,7 +1859,7 @@ 2.66 // Functions for isolating 64 bit shifts for LP64 2.67 inline void sll_ptr( Register s1, Register s2, Register d ); 2.68 inline void sll_ptr( Register s1, int imm6a, Register d ); 2.69 - inline void sll_ptr( Register s1, RegisterConstant s2, Register d ); 2.70 + inline void sll_ptr( Register s1, RegisterOrConstant s2, Register d ); 2.71 inline void srl_ptr( Register s1, Register s2, Register d ); 2.72 inline void srl_ptr( Register s1, int imm6a, Register d ); 2.73 2.74 @@ -1965,26 +1965,26 @@ 2.75 // st_ptr will perform st for 32 bit VM's and stx for 64 bit VM's 2.76 inline void ld_ptr( Register s1, Register s2, Register d ); 2.77 inline void ld_ptr( Register s1, int simm13a, Register d); 2.78 - inline void ld_ptr( Register s1, RegisterConstant s2, Register d ); 2.79 + inline void ld_ptr( Register s1, RegisterOrConstant s2, Register d ); 2.80 inline void ld_ptr( const Address& a, Register d, int offset = 0 ); 2.81 inline void st_ptr( Register d, Register s1, Register s2 ); 2.82 inline void st_ptr( Register d, Register s1, int simm13a); 2.83 - inline void st_ptr( Register d, Register s1, RegisterConstant s2 ); 2.84 + inline void st_ptr( Register d, Register s1, RegisterOrConstant s2 ); 2.85 inline void st_ptr( Register d, const Address& a, int offset = 0 ); 2.86 2.87 // ld_long will perform ld for 32 bit VM's and ldx for 64 bit VM's 2.88 // st_long will perform st for 32 bit VM's and stx for 64 bit VM's 2.89 inline void ld_long( Register s1, Register s2, Register d ); 2.90 inline void ld_long( Register s1, int simm13a, Register d ); 2.91 - inline void ld_long( Register s1, RegisterConstant s2, Register d ); 2.92 + inline void ld_long( Register s1, RegisterOrConstant s2, Register d ); 2.93 inline void ld_long( const Address& a, Register d, int offset = 0 ); 2.94 inline void st_long( Register d, Register s1, Register s2 ); 2.95 inline void st_long( Register d, Register s1, int simm13a ); 2.96 - inline void st_long( Register d, Register s1, RegisterConstant s2 ); 2.97 + inline void st_long( Register d, Register s1, RegisterOrConstant s2 ); 2.98 inline void st_long( Register d, const Address& a, int offset = 0 ); 2.99 2.100 // Loading values by size and signed-ness 2.101 - void load_sized_value(Register s1, RegisterConstant s2, Register d, 2.102 + void load_sized_value(Register s1, RegisterOrConstant s2, Register d, 2.103 int size_in_bytes, bool is_signed); 2.104 2.105 // Helpers for address formation. 2.106 @@ -1994,11 +1994,11 @@ 2.107 // is required, and becomes the result. 2.108 // If dest is a register and src is a non-simm13 constant, 2.109 // the temp argument is required, and is used to materialize the constant. 2.110 - void regcon_inc_ptr( RegisterConstant& dest, RegisterConstant src, 2.111 + void regcon_inc_ptr( RegisterOrConstant& dest, RegisterOrConstant src, 2.112 Register temp = noreg ); 2.113 - void regcon_sll_ptr( RegisterConstant& dest, RegisterConstant src, 2.114 + void regcon_sll_ptr( RegisterOrConstant& dest, RegisterOrConstant src, 2.115 Register temp = noreg ); 2.116 - RegisterConstant ensure_rs2(RegisterConstant rs2, Register sethi_temp) { 2.117 + RegisterOrConstant ensure_rs2(RegisterOrConstant rs2, Register sethi_temp) { 2.118 guarantee(sethi_temp != noreg, "constant offset overflow"); 2.119 if (is_simm13(rs2.constant_or_zero())) 2.120 return rs2; // register or short constant 2.121 @@ -2322,7 +2322,7 @@ 2.122 // interface method calling 2.123 void lookup_interface_method(Register recv_klass, 2.124 Register intf_klass, 2.125 - RegisterConstant itable_index, 2.126 + RegisterOrConstant itable_index, 2.127 Register method_result, 2.128 Register temp_reg, Register temp2_reg, 2.129 Label& no_such_interface); 2.130 @@ -2341,7 +2341,7 @@ 2.131 Label* L_success, 2.132 Label* L_failure, 2.133 Label* L_slow_path, 2.134 - RegisterConstant super_check_offset = RegisterConstant(-1), 2.135 + RegisterOrConstant super_check_offset = RegisterOrConstant(-1), 2.136 Register instanceof_hack = noreg); 2.137 2.138 // The rest of the type check; must be wired to a corresponding fast path. 2.139 @@ -2381,7 +2381,7 @@ 2.140 // stack overflow + shadow pages. Clobbers tsp and scratch registers. 2.141 void bang_stack_size(Register Rsize, Register Rtsp, Register Rscratch); 2.142 2.143 - virtual RegisterConstant delayed_value(intptr_t* delayed_value_addr, Register tmp, int offset); 2.144 + virtual RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr, Register tmp, int offset); 2.145 2.146 void verify_tlab(); 2.147
3.1 --- a/src/cpu/sparc/vm/assembler_sparc.inline.hpp Thu Mar 19 09:13:24 2009 -0700 3.2 +++ b/src/cpu/sparc/vm/assembler_sparc.inline.hpp Fri Mar 20 23:19:36 2009 -0700 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 3.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -143,45 +143,45 @@ 3.11 inline void Assembler::ld( Register s1, int simm13a, Register d) { lduw( s1, simm13a, d); } 3.12 #endif 3.13 3.14 -inline void Assembler::ldub( Register s1, RegisterConstant s2, Register d) { 3.15 +inline void Assembler::ldub( Register s1, RegisterOrConstant s2, Register d) { 3.16 if (s2.is_register()) ldsb(s1, s2.as_register(), d); 3.17 else ldsb(s1, s2.as_constant(), d); 3.18 } 3.19 -inline void Assembler::ldsb( Register s1, RegisterConstant s2, Register d) { 3.20 +inline void Assembler::ldsb( Register s1, RegisterOrConstant s2, Register d) { 3.21 if (s2.is_register()) ldsb(s1, s2.as_register(), d); 3.22 else ldsb(s1, s2.as_constant(), d); 3.23 } 3.24 -inline void Assembler::lduh( Register s1, RegisterConstant s2, Register d) { 3.25 +inline void Assembler::lduh( Register s1, RegisterOrConstant s2, Register d) { 3.26 if (s2.is_register()) ldsh(s1, s2.as_register(), d); 3.27 else ldsh(s1, s2.as_constant(), d); 3.28 } 3.29 -inline void Assembler::ldsh( Register s1, RegisterConstant s2, Register d) { 3.30 +inline void Assembler::ldsh( Register s1, RegisterOrConstant s2, Register d) { 3.31 if (s2.is_register()) ldsh(s1, s2.as_register(), d); 3.32 else ldsh(s1, s2.as_constant(), d); 3.33 } 3.34 -inline void Assembler::lduw( Register s1, RegisterConstant s2, Register d) { 3.35 +inline void Assembler::lduw( Register s1, RegisterOrConstant s2, Register d) { 3.36 if (s2.is_register()) ldsw(s1, s2.as_register(), d); 3.37 else ldsw(s1, s2.as_constant(), d); 3.38 } 3.39 -inline void Assembler::ldsw( Register s1, RegisterConstant s2, Register d) { 3.40 +inline void Assembler::ldsw( Register s1, RegisterOrConstant s2, Register d) { 3.41 if (s2.is_register()) ldsw(s1, s2.as_register(), d); 3.42 else ldsw(s1, s2.as_constant(), d); 3.43 } 3.44 -inline void Assembler::ldx( Register s1, RegisterConstant s2, Register d) { 3.45 +inline void Assembler::ldx( Register s1, RegisterOrConstant s2, Register d) { 3.46 if (s2.is_register()) ldx(s1, s2.as_register(), d); 3.47 else ldx(s1, s2.as_constant(), d); 3.48 } 3.49 -inline void Assembler::ld( Register s1, RegisterConstant s2, Register d) { 3.50 +inline void Assembler::ld( Register s1, RegisterOrConstant s2, Register d) { 3.51 if (s2.is_register()) ld(s1, s2.as_register(), d); 3.52 else ld(s1, s2.as_constant(), d); 3.53 } 3.54 -inline void Assembler::ldd( Register s1, RegisterConstant s2, Register d) { 3.55 +inline void Assembler::ldd( Register s1, RegisterOrConstant s2, Register d) { 3.56 if (s2.is_register()) ldd(s1, s2.as_register(), d); 3.57 else ldd(s1, s2.as_constant(), d); 3.58 } 3.59 3.60 // form effective addresses this way: 3.61 -inline void Assembler::add( Register s1, RegisterConstant s2, Register d, int offset) { 3.62 +inline void Assembler::add( Register s1, RegisterOrConstant s2, Register d, int offset) { 3.63 if (s2.is_register()) add(s1, s2.as_register(), d); 3.64 else { add(s1, s2.as_constant() + offset, d); offset = 0; } 3.65 if (offset != 0) add(d, offset, d); 3.66 @@ -243,23 +243,23 @@ 3.67 inline void Assembler::st( Register d, Register s1, Register s2) { stw(d, s1, s2); } 3.68 inline void Assembler::st( Register d, Register s1, int simm13a) { stw(d, s1, simm13a); } 3.69 3.70 -inline void Assembler::stb( Register d, Register s1, RegisterConstant s2) { 3.71 +inline void Assembler::stb( Register d, Register s1, RegisterOrConstant s2) { 3.72 if (s2.is_register()) stb(d, s1, s2.as_register()); 3.73 else stb(d, s1, s2.as_constant()); 3.74 } 3.75 -inline void Assembler::sth( Register d, Register s1, RegisterConstant s2) { 3.76 +inline void Assembler::sth( Register d, Register s1, RegisterOrConstant s2) { 3.77 if (s2.is_register()) sth(d, s1, s2.as_register()); 3.78 else sth(d, s1, s2.as_constant()); 3.79 } 3.80 -inline void Assembler::stx( Register d, Register s1, RegisterConstant s2) { 3.81 +inline void Assembler::stx( Register d, Register s1, RegisterOrConstant s2) { 3.82 if (s2.is_register()) stx(d, s1, s2.as_register()); 3.83 else stx(d, s1, s2.as_constant()); 3.84 } 3.85 -inline void Assembler::std( Register d, Register s1, RegisterConstant s2) { 3.86 +inline void Assembler::std( Register d, Register s1, RegisterOrConstant s2) { 3.87 if (s2.is_register()) std(d, s1, s2.as_register()); 3.88 else std(d, s1, s2.as_constant()); 3.89 } 3.90 -inline void Assembler::st( Register d, Register s1, RegisterConstant s2) { 3.91 +inline void Assembler::st( Register d, Register s1, RegisterOrConstant s2) { 3.92 if (s2.is_register()) st(d, s1, s2.as_register()); 3.93 else st(d, s1, s2.as_constant()); 3.94 } 3.95 @@ -308,7 +308,7 @@ 3.96 #endif 3.97 } 3.98 3.99 -inline void MacroAssembler::ld_ptr( Register s1, RegisterConstant s2, Register d ) { 3.100 +inline void MacroAssembler::ld_ptr( Register s1, RegisterOrConstant s2, Register d ) { 3.101 #ifdef _LP64 3.102 Assembler::ldx( s1, s2, d); 3.103 #else 3.104 @@ -340,7 +340,7 @@ 3.105 #endif 3.106 } 3.107 3.108 -inline void MacroAssembler::st_ptr( Register d, Register s1, RegisterConstant s2 ) { 3.109 +inline void MacroAssembler::st_ptr( Register d, Register s1, RegisterOrConstant s2 ) { 3.110 #ifdef _LP64 3.111 Assembler::stx( d, s1, s2); 3.112 #else 3.113 @@ -373,7 +373,7 @@ 3.114 #endif 3.115 } 3.116 3.117 -inline void MacroAssembler::ld_long( Register s1, RegisterConstant s2, Register d ) { 3.118 +inline void MacroAssembler::ld_long( Register s1, RegisterOrConstant s2, Register d ) { 3.119 #ifdef _LP64 3.120 Assembler::ldx(s1, s2, d); 3.121 #else 3.122 @@ -405,7 +405,7 @@ 3.123 #endif 3.124 } 3.125 3.126 -inline void MacroAssembler::st_long( Register d, Register s1, RegisterConstant s2 ) { 3.127 +inline void MacroAssembler::st_long( Register d, Register s1, RegisterOrConstant s2 ) { 3.128 #ifdef _LP64 3.129 Assembler::stx(d, s1, s2); 3.130 #else 3.131 @@ -455,7 +455,7 @@ 3.132 #endif 3.133 } 3.134 3.135 -inline void MacroAssembler::sll_ptr( Register s1, RegisterConstant s2, Register d ) { 3.136 +inline void MacroAssembler::sll_ptr( Register s1, RegisterOrConstant s2, Register d ) { 3.137 if (s2.is_register()) sll_ptr(s1, s2.as_register(), d); 3.138 else sll_ptr(s1, s2.as_constant(), d); 3.139 }
4.1 --- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Thu Mar 19 09:13:24 2009 -0700 4.2 +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Fri Mar 20 23:19:36 2009 -0700 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. 4.6 + * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -2489,7 +2489,7 @@ 4.11 __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, noreg, 4.12 (need_slow_path ? &done : NULL), 4.13 stub->entry(), NULL, 4.14 - RegisterConstant(k->super_check_offset())); 4.15 + RegisterOrConstant(k->super_check_offset())); 4.16 } else { 4.17 // perform the fast part of the checking logic 4.18 __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, O7, 4.19 @@ -2550,14 +2550,14 @@ 4.20 __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, O7, noreg, 4.21 (need_slow_path ? &done : NULL), 4.22 (need_slow_path ? &done : NULL), NULL, 4.23 - RegisterConstant(k->super_check_offset()), 4.24 + RegisterOrConstant(k->super_check_offset()), 4.25 dst); 4.26 } else { 4.27 assert(dst != klass_RInfo && dst != k_RInfo, "need 3 registers"); 4.28 // perform the fast part of the checking logic 4.29 __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, O7, dst, 4.30 &done, &done, NULL, 4.31 - RegisterConstant(-1), 4.32 + RegisterOrConstant(-1), 4.33 dst); 4.34 } 4.35 if (need_slow_path) {
5.1 --- a/src/cpu/x86/vm/assembler_x86.cpp Thu Mar 19 09:13:24 2009 -0700 5.2 +++ b/src/cpu/x86/vm/assembler_x86.cpp Fri Mar 20 23:19:36 2009 -0700 5.3 @@ -7218,7 +7218,7 @@ 5.4 // On failure, execution transfers to the given label. 5.5 void MacroAssembler::lookup_interface_method(Register recv_klass, 5.6 Register intf_klass, 5.7 - RegisterConstant itable_index, 5.8 + RegisterOrConstant itable_index, 5.9 Register method_result, 5.10 Register scan_temp, 5.11 Label& L_no_such_interface) { 5.12 @@ -7303,7 +7303,7 @@ 5.13 Label* L_success, 5.14 Label* L_failure, 5.15 Label* L_slow_path, 5.16 - RegisterConstant super_check_offset) { 5.17 + RegisterOrConstant super_check_offset) { 5.18 assert_different_registers(sub_klass, super_klass, temp_reg); 5.19 bool must_load_sco = (super_check_offset.constant_or_zero() == -1); 5.20 if (super_check_offset.is_register()) { 5.21 @@ -7352,7 +7352,7 @@ 5.22 if (must_load_sco) { 5.23 // Positive movl does right thing on LP64. 5.24 movl(temp_reg, super_check_offset_addr); 5.25 - super_check_offset = RegisterConstant(temp_reg); 5.26 + super_check_offset = RegisterOrConstant(temp_reg); 5.27 } 5.28 Address super_check_addr(sub_klass, super_check_offset, Address::times_1, 0); 5.29 cmpptr(super_klass, super_check_addr); // load displayed supertype 5.30 @@ -7550,12 +7550,12 @@ 5.31 } 5.32 5.33 5.34 -RegisterConstant MacroAssembler::delayed_value(intptr_t* delayed_value_addr, 5.35 - Register tmp, 5.36 - int offset) { 5.37 +RegisterOrConstant MacroAssembler::delayed_value_impl(intptr_t* delayed_value_addr, 5.38 + Register tmp, 5.39 + int offset) { 5.40 intptr_t value = *delayed_value_addr; 5.41 if (value != 0) 5.42 - return RegisterConstant(value + offset); 5.43 + return RegisterOrConstant(value + offset); 5.44 5.45 // load indirectly to solve generation ordering problem 5.46 movptr(tmp, ExternalAddress((address) delayed_value_addr)); 5.47 @@ -7571,7 +7571,7 @@ 5.48 if (offset != 0) 5.49 addptr(tmp, offset); 5.50 5.51 - return RegisterConstant(tmp); 5.52 + return RegisterOrConstant(tmp); 5.53 } 5.54 5.55
6.1 --- a/src/cpu/x86/vm/assembler_x86.hpp Thu Mar 19 09:13:24 2009 -0700 6.2 +++ b/src/cpu/x86/vm/assembler_x86.hpp Fri Mar 20 23:19:36 2009 -0700 6.3 @@ -212,7 +212,7 @@ 6.4 "inconsistent address"); 6.5 } 6.6 6.7 - Address(Register base, RegisterConstant index, ScaleFactor scale = times_1, int disp = 0) 6.8 + Address(Register base, RegisterOrConstant index, ScaleFactor scale = times_1, int disp = 0) 6.9 : _base (base), 6.10 _index(index.register_or_noreg()), 6.11 _scale(scale), 6.12 @@ -256,7 +256,7 @@ 6.13 "inconsistent address"); 6.14 } 6.15 6.16 - Address(Register base, RegisterConstant index, ScaleFactor scale, ByteSize disp) 6.17 + Address(Register base, RegisterOrConstant index, ScaleFactor scale, ByteSize disp) 6.18 : _base (base), 6.19 _index(index.register_or_noreg()), 6.20 _scale(scale), 6.21 @@ -1802,7 +1802,7 @@ 6.22 // interface method calling 6.23 void lookup_interface_method(Register recv_klass, 6.24 Register intf_klass, 6.25 - RegisterConstant itable_index, 6.26 + RegisterOrConstant itable_index, 6.27 Register method_result, 6.28 Register scan_temp, 6.29 Label& no_such_interface); 6.30 @@ -1819,7 +1819,7 @@ 6.31 Label* L_success, 6.32 Label* L_failure, 6.33 Label* L_slow_path, 6.34 - RegisterConstant super_check_offset = RegisterConstant(-1)); 6.35 + RegisterOrConstant super_check_offset = RegisterOrConstant(-1)); 6.36 6.37 // The rest of the type check; must be wired to a corresponding fast path. 6.38 // It does not repeat the fast path logic, so don't use it standalone. 6.39 @@ -1883,9 +1883,9 @@ 6.40 // stack overflow + shadow pages. Also, clobbers tmp 6.41 void bang_stack_size(Register size, Register tmp); 6.42 6.43 - virtual RegisterConstant delayed_value(intptr_t* delayed_value_addr, 6.44 - Register tmp, 6.45 - int offset); 6.46 + virtual RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr, 6.47 + Register tmp, 6.48 + int offset); 6.49 6.50 // Support for serializing memory accesses between threads 6.51 void serialize_memory(Register thread, Register tmp);
7.1 --- a/src/share/vm/asm/assembler.hpp Thu Mar 19 09:13:24 2009 -0700 7.2 +++ b/src/share/vm/asm/assembler.hpp Fri Mar 20 23:19:36 2009 -0700 7.3 @@ -1,5 +1,5 @@ 7.4 /* 7.5 - * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 7.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 7.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.8 * 7.9 * This code is free software; you can redistribute it and/or modify it 7.10 @@ -143,15 +143,15 @@ 7.11 // A union type for code which has to assemble both constant and 7.12 // non-constant operands, when the distinction cannot be made 7.13 // statically. 7.14 -class RegisterConstant VALUE_OBJ_CLASS_SPEC { 7.15 +class RegisterOrConstant VALUE_OBJ_CLASS_SPEC { 7.16 private: 7.17 Register _r; 7.18 intptr_t _c; 7.19 7.20 public: 7.21 - RegisterConstant(): _r(noreg), _c(0) {} 7.22 - RegisterConstant(Register r): _r(r), _c(0) {} 7.23 - RegisterConstant(intptr_t c): _r(noreg), _c(c) {} 7.24 + RegisterOrConstant(): _r(noreg), _c(0) {} 7.25 + RegisterOrConstant(Register r): _r(r), _c(0) {} 7.26 + RegisterOrConstant(intptr_t c): _r(noreg), _c(c) {} 7.27 7.28 Register as_register() const { assert(is_register(),""); return _r; } 7.29 intptr_t as_constant() const { assert(is_constant(),""); return _c; } 7.30 @@ -310,13 +310,13 @@ 7.31 // offsets in code which must be generated before the object class is loaded. 7.32 // Field offsets are never zero, since an object's header (mark word) 7.33 // is located at offset zero. 7.34 - RegisterConstant delayed_value(int(*value_fn)(), Register tmp, int offset = 0) { 7.35 - return delayed_value(delayed_value_addr(value_fn), tmp, offset); 7.36 + RegisterOrConstant delayed_value(int(*value_fn)(), Register tmp, int offset = 0) { 7.37 + return delayed_value_impl(delayed_value_addr(value_fn), tmp, offset); 7.38 } 7.39 - RegisterConstant delayed_value(address(*value_fn)(), Register tmp, int offset = 0) { 7.40 - return delayed_value(delayed_value_addr(value_fn), tmp, offset); 7.41 + RegisterOrConstant delayed_value(address(*value_fn)(), Register tmp, int offset = 0) { 7.42 + return delayed_value_impl(delayed_value_addr(value_fn), tmp, offset); 7.43 } 7.44 - virtual RegisterConstant delayed_value(intptr_t* delayed_value_addr, Register tmp, int offset) = 0; 7.45 + virtual RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr, Register tmp, int offset) = 0; 7.46 // Last overloading is platform-dependent; look in assembler_<arch>.cpp. 7.47 static intptr_t* delayed_value_addr(int(*constant_fn)()); 7.48 static intptr_t* delayed_value_addr(address(*constant_fn)());
8.1 --- a/src/share/vm/classfile/javaClasses.cpp Thu Mar 19 09:13:24 2009 -0700 8.2 +++ b/src/share/vm/classfile/javaClasses.cpp Fri Mar 20 23:19:36 2009 -0700 8.3 @@ -239,22 +239,20 @@ 8.4 typeArrayOop value = java_lang_String::value(obj); 8.5 int offset = java_lang_String::offset(obj); 8.6 int length = java_lang_String::length(obj); 8.7 - 8.8 - ResourceMark rm(THREAD); 8.9 - symbolHandle result; 8.10 - 8.11 - if (length > 0) { 8.12 - int utf8_length = UNICODE::utf8_length(value->char_at_addr(offset), length); 8.13 - char* chars = NEW_RESOURCE_ARRAY(char, utf8_length + 1); 8.14 - UNICODE::convert_to_utf8(value->char_at_addr(offset), length, chars); 8.15 - // Allocate the symbol 8.16 - result = oopFactory::new_symbol_handle(chars, utf8_length, CHECK_(symbolHandle())); 8.17 - } else { 8.18 - result = oopFactory::new_symbol_handle("", 0, CHECK_(symbolHandle())); 8.19 - } 8.20 - return result; 8.21 + jchar* base = value->char_at_addr(offset); 8.22 + symbolOop sym = SymbolTable::lookup_unicode(base, length, THREAD); 8.23 + return symbolHandle(THREAD, sym); 8.24 } 8.25 8.26 +symbolOop java_lang_String::as_symbol_or_null(oop java_string) { 8.27 + typeArrayOop value = java_lang_String::value(java_string); 8.28 + int offset = java_lang_String::offset(java_string); 8.29 + int length = java_lang_String::length(java_string); 8.30 + jchar* base = value->char_at_addr(offset); 8.31 + return SymbolTable::probe_unicode(base, length); 8.32 +} 8.33 + 8.34 + 8.35 int java_lang_String::utf8_length(oop java_string) { 8.36 typeArrayOop value = java_lang_String::value(java_string); 8.37 int offset = java_lang_String::offset(java_string); 8.38 @@ -385,6 +383,48 @@ 8.39 } 8.40 8.41 8.42 +void java_lang_Class::print_signature(oop java_class, outputStream* st) { 8.43 + assert(java_lang_Class::is_instance(java_class), "must be a Class object"); 8.44 + symbolOop name = NULL; 8.45 + bool is_instance = false; 8.46 + if (is_primitive(java_class)) { 8.47 + name = vmSymbols::type_signature(primitive_type(java_class)); 8.48 + } else { 8.49 + klassOop k = as_klassOop(java_class); 8.50 + is_instance = Klass::cast(k)->oop_is_instance(); 8.51 + name = Klass::cast(k)->name(); 8.52 + } 8.53 + if (name == NULL) { 8.54 + st->print("<null>"); 8.55 + return; 8.56 + } 8.57 + if (is_instance) st->print("L"); 8.58 + st->write((char*) name->base(), (int) name->utf8_length()); 8.59 + if (is_instance) st->print(";"); 8.60 +} 8.61 + 8.62 +symbolOop java_lang_Class::as_signature(oop java_class, bool intern_if_not_found, TRAPS) { 8.63 + assert(java_lang_Class::is_instance(java_class), "must be a Class object"); 8.64 + symbolOop name = NULL; 8.65 + if (is_primitive(java_class)) { 8.66 + return vmSymbols::type_signature(primitive_type(java_class)); 8.67 + } else { 8.68 + klassOop k = as_klassOop(java_class); 8.69 + if (!Klass::cast(k)->oop_is_instance()) { 8.70 + return Klass::cast(k)->name(); 8.71 + } else { 8.72 + ResourceMark rm; 8.73 + const char* sigstr = Klass::cast(k)->signature_name(); 8.74 + int siglen = (int) strlen(sigstr); 8.75 + if (!intern_if_not_found) 8.76 + return SymbolTable::probe(sigstr, siglen); 8.77 + else 8.78 + return oopFactory::new_symbol(sigstr, siglen, THREAD); 8.79 + } 8.80 + } 8.81 +} 8.82 + 8.83 + 8.84 klassOop java_lang_Class::array_klass(oop java_class) { 8.85 klassOop k = klassOop(java_class->obj_field(array_klass_offset)); 8.86 assert(k == NULL || k->is_klass() && Klass::cast(k)->oop_is_javaArray(), "should be array klass"); 8.87 @@ -412,6 +452,8 @@ 8.88 8.89 8.90 bool java_lang_Class::is_primitive(oop java_class) { 8.91 + // should assert: 8.92 + //assert(java_lang_Class::is_instance(java_class), "must be a Class object"); 8.93 klassOop k = klassOop(java_class->obj_field(klass_offset)); 8.94 return k == NULL; 8.95 } 8.96 @@ -431,6 +473,19 @@ 8.97 return type; 8.98 } 8.99 8.100 +BasicType java_lang_Class::as_BasicType(oop java_class, klassOop* reference_klass) { 8.101 + assert(java_lang_Class::is_instance(java_class), "must be a Class object"); 8.102 + if (is_primitive(java_class)) { 8.103 + if (reference_klass != NULL) 8.104 + (*reference_klass) = NULL; 8.105 + return primitive_type(java_class); 8.106 + } else { 8.107 + if (reference_klass != NULL) 8.108 + (*reference_klass) = as_klassOop(java_class); 8.109 + return T_OBJECT; 8.110 + } 8.111 +} 8.112 + 8.113 8.114 oop java_lang_Class::primitive_mirror(BasicType t) { 8.115 oop mirror = Universe::java_mirror(t); 8.116 @@ -1988,6 +2043,21 @@ 8.117 } 8.118 8.119 8.120 +void java_lang_boxing_object::print(BasicType type, jvalue* value, outputStream* st) { 8.121 + switch (type) { 8.122 + case T_BOOLEAN: st->print("%s", value->z ? "true" : "false"); break; 8.123 + case T_CHAR: st->print("%d", value->c); break; 8.124 + case T_BYTE: st->print("%d", value->b); break; 8.125 + case T_SHORT: st->print("%d", value->s); break; 8.126 + case T_INT: st->print("%d", value->i); break; 8.127 + case T_LONG: st->print(INT64_FORMAT, value->j); break; 8.128 + case T_FLOAT: st->print("%f", value->f); break; 8.129 + case T_DOUBLE: st->print("%lf", value->d); break; 8.130 + default: st->print("type %d?", type); break; 8.131 + } 8.132 +} 8.133 + 8.134 + 8.135 // Support for java_lang_ref_Reference 8.136 oop java_lang_ref_Reference::pending_list_lock() { 8.137 instanceKlass* ik = instanceKlass::cast(SystemDictionary::reference_klass());
9.1 --- a/src/share/vm/classfile/javaClasses.hpp Thu Mar 19 09:13:24 2009 -0700 9.2 +++ b/src/share/vm/classfile/javaClasses.hpp Fri Mar 20 23:19:36 2009 -0700 9.3 @@ -107,6 +107,7 @@ 9.4 9.5 // Conversion 9.6 static symbolHandle as_symbol(Handle java_string, TRAPS); 9.7 + static symbolOop as_symbol_or_null(oop java_string); 9.8 9.9 // Testers 9.10 static bool is_instance(oop obj) { 9.11 @@ -149,6 +150,9 @@ 9.12 static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS); 9.13 // Conversion 9.14 static klassOop as_klassOop(oop java_class); 9.15 + static BasicType as_BasicType(oop java_class, klassOop* reference_klass = NULL); 9.16 + static symbolOop as_signature(oop java_class, bool intern_if_not_found, TRAPS); 9.17 + static void print_signature(oop java_class, outputStream *st); 9.18 // Testing 9.19 static bool is_instance(oop obj) { 9.20 return obj != NULL && obj->klass() == SystemDictionary::class_klass(); 9.21 @@ -668,6 +672,8 @@ 9.22 static BasicType basic_type(oop box); 9.23 static bool is_instance(oop box) { return basic_type(box) != T_ILLEGAL; } 9.24 static bool is_instance(oop box, BasicType type) { return basic_type(box) == type; } 9.25 + static void print(oop box, outputStream* st) { jvalue value; print(get_value(box, &value), &value, st); } 9.26 + static void print(BasicType type, jvalue* value, outputStream* st); 9.27 9.28 static int value_offset_in_bytes(BasicType type) { 9.29 return ( type == T_LONG || type == T_DOUBLE ) ? long_value_offset :
10.1 --- a/src/share/vm/classfile/loaderConstraints.hpp Thu Mar 19 09:13:24 2009 -0700 10.2 +++ b/src/share/vm/classfile/loaderConstraints.hpp Fri Mar 20 23:19:36 2009 -0700 10.3 @@ -1,5 +1,5 @@ 10.4 /* 10.5 - * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. 10.6 + * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. 10.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.8 * 10.9 * This code is free software; you can redistribute it and/or modify it 10.10 @@ -60,8 +60,10 @@ 10.11 bool add_entry(symbolHandle name, klassOop klass1, Handle loader1, 10.12 klassOop klass2, Handle loader2); 10.13 10.14 - void check_signature_loaders(symbolHandle signature, Handle loader1, 10.15 - Handle loader2, bool is_method, TRAPS); 10.16 + // Note: The main entry point for this module is via SystemDictionary. 10.17 + // SystemDictionary::check_signature_loaders(symbolHandle signature, 10.18 + // Handle loader1, Handle loader2, 10.19 + // bool is_method, TRAPS) 10.20 10.21 klassOop find_constrained_klass(symbolHandle name, Handle loader); 10.22 klassOop find_constrained_elem_klass(symbolHandle name, symbolHandle elem_name,
11.1 --- a/src/share/vm/classfile/symbolTable.cpp Thu Mar 19 09:13:24 2009 -0700 11.2 +++ b/src/share/vm/classfile/symbolTable.cpp Fri Mar 20 23:19:36 2009 -0700 11.3 @@ -1,5 +1,5 @@ 11.4 /* 11.5 - * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 11.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 11.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.8 * 11.9 * This code is free software; you can redistribute it and/or modify it 11.10 @@ -109,6 +109,40 @@ 11.11 return the_table()->lookup(index, name, len, hash); 11.12 } 11.13 11.14 +// Suggestion: Push unicode-based lookup all the way into the hashing 11.15 +// and probing logic, so there is no need for convert_to_utf8 until 11.16 +// an actual new symbolOop is created. 11.17 +symbolOop SymbolTable::lookup_unicode(const jchar* name, int utf16_length, TRAPS) { 11.18 + int utf8_length = UNICODE::utf8_length((jchar*) name, utf16_length); 11.19 + char stack_buf[128]; 11.20 + if (utf8_length < (int) sizeof(stack_buf)) { 11.21 + char* chars = stack_buf; 11.22 + UNICODE::convert_to_utf8(name, utf16_length, chars); 11.23 + return lookup(chars, utf8_length, THREAD); 11.24 + } else { 11.25 + ResourceMark rm(THREAD); 11.26 + char* chars = NEW_RESOURCE_ARRAY(char, utf8_length + 1);; 11.27 + UNICODE::convert_to_utf8(name, utf16_length, chars); 11.28 + return lookup(chars, utf8_length, THREAD); 11.29 + } 11.30 +} 11.31 + 11.32 +symbolOop SymbolTable::lookup_only_unicode(const jchar* name, int utf16_length, 11.33 + unsigned int& hash) { 11.34 + int utf8_length = UNICODE::utf8_length((jchar*) name, utf16_length); 11.35 + char stack_buf[128]; 11.36 + if (utf8_length < (int) sizeof(stack_buf)) { 11.37 + char* chars = stack_buf; 11.38 + UNICODE::convert_to_utf8(name, utf16_length, chars); 11.39 + return lookup_only(chars, utf8_length, hash); 11.40 + } else { 11.41 + ResourceMark rm; 11.42 + char* chars = NEW_RESOURCE_ARRAY(char, utf8_length + 1);; 11.43 + UNICODE::convert_to_utf8(name, utf16_length, chars); 11.44 + return lookup_only(chars, utf8_length, hash); 11.45 + } 11.46 +} 11.47 + 11.48 void SymbolTable::add(constantPoolHandle cp, int names_count, 11.49 const char** names, int* lengths, int* cp_indices, 11.50 unsigned int* hashValues, TRAPS) { 11.51 @@ -126,15 +160,6 @@ 11.52 } 11.53 } 11.54 11.55 -// Needed for preloading classes in signatures when compiling. 11.56 - 11.57 -symbolOop SymbolTable::probe(const char* name, int len) { 11.58 - unsigned int hashValue = hash_symbol(name, len); 11.59 - int index = the_table()->hash_to_index(hashValue); 11.60 - return the_table()->lookup(index, name, len, hashValue); 11.61 -} 11.62 - 11.63 - 11.64 symbolOop SymbolTable::basic_add(int index, u1 *name, int len, 11.65 unsigned int hashValue, TRAPS) { 11.66 assert(!Universe::heap()->is_in_reserved(name) || GC_locker::is_active(),
12.1 --- a/src/share/vm/classfile/symbolTable.hpp Thu Mar 19 09:13:24 2009 -0700 12.2 +++ b/src/share/vm/classfile/symbolTable.hpp Fri Mar 20 23:19:36 2009 -0700 12.3 @@ -1,5 +1,5 @@ 12.4 /* 12.5 - * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 12.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 12.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.8 * 12.9 * This code is free software; you can redistribute it and/or modify it 12.10 @@ -91,6 +91,10 @@ 12.11 // Only copy to C string to be added if lookup failed. 12.12 static symbolOop lookup(symbolHandle sym, int begin, int end, TRAPS); 12.13 12.14 + // jchar (utf16) version of lookups 12.15 + static symbolOop lookup_unicode(const jchar* name, int len, TRAPS); 12.16 + static symbolOop lookup_only_unicode(const jchar* name, int len, unsigned int& hash); 12.17 + 12.18 static void add(constantPoolHandle cp, int names_count, 12.19 const char** names, int* lengths, int* cp_indices, 12.20 unsigned int* hashValues, TRAPS); 12.21 @@ -112,7 +116,14 @@ 12.22 // Needed for preloading classes in signatures when compiling. 12.23 // Returns the symbol is already present in symbol table, otherwise 12.24 // NULL. NO ALLOCATION IS GUARANTEED! 12.25 - static symbolOop probe(const char* name, int len); 12.26 + static symbolOop probe(const char* name, int len) { 12.27 + unsigned int ignore_hash; 12.28 + return lookup_only(name, len, ignore_hash); 12.29 + } 12.30 + static symbolOop probe_unicode(const jchar* name, int len) { 12.31 + unsigned int ignore_hash; 12.32 + return lookup_only_unicode(name, len, ignore_hash); 12.33 + } 12.34 12.35 // Histogram 12.36 static void print_histogram() PRODUCT_RETURN;
13.1 --- a/src/share/vm/classfile/systemDictionary.cpp Thu Mar 19 09:13:24 2009 -0700 13.2 +++ b/src/share/vm/classfile/systemDictionary.cpp Fri Mar 20 23:19:36 2009 -0700 13.3 @@ -1964,6 +1964,13 @@ 13.4 return T_OBJECT; 13.5 } 13.6 13.7 +KlassHandle SystemDictionaryHandles::box_klass(BasicType t) { 13.8 + if (t >= T_BOOLEAN && t <= T_VOID) 13.9 + return KlassHandle(&SystemDictionary::_box_klasses[t], true); 13.10 + else 13.11 + return KlassHandle(); 13.12 +} 13.13 + 13.14 // Constraints on class loaders. The details of the algorithm can be 13.15 // found in the OOPSLA'98 paper "Dynamic Class Loading in the Java 13.16 // Virtual Machine" by Sheng Liang and Gilad Bracha. The basic idea is 13.17 @@ -2174,11 +2181,56 @@ 13.18 } 13.19 13.20 13.21 +// Signature constraints ensure that callers and callees agree about 13.22 +// the meaning of type names in their signatures. This routine is the 13.23 +// intake for constraints. It collects them from several places: 13.24 +// 13.25 +// * LinkResolver::resolve_method (if check_access is true) requires 13.26 +// that the resolving class (the caller) and the defining class of 13.27 +// the resolved method (the callee) agree on each type in the 13.28 +// method's signature. 13.29 +// 13.30 +// * LinkResolver::resolve_interface_method performs exactly the same 13.31 +// checks. 13.32 +// 13.33 +// * LinkResolver::resolve_field requires that the constant pool 13.34 +// attempting to link to a field agree with the field's defining 13.35 +// class about the type of the field signature. 13.36 +// 13.37 +// * klassVtable::initialize_vtable requires that, when a class 13.38 +// overrides a vtable entry allocated by a superclass, that the 13.39 +// overriding method (i.e., the callee) agree with the superclass 13.40 +// on each type in the method's signature. 13.41 +// 13.42 +// * klassItable::initialize_itable requires that, when a class fills 13.43 +// in its itables, for each non-abstract method installed in an 13.44 +// itable, the method (i.e., the callee) agree with the interface 13.45 +// on each type in the method's signature. 13.46 +// 13.47 +// All those methods have a boolean (check_access, checkconstraints) 13.48 +// which turns off the checks. This is used from specialized contexts 13.49 +// such as bootstrapping, dumping, and debugging. 13.50 +// 13.51 +// No direct constraint is placed between the class and its 13.52 +// supertypes. Constraints are only placed along linked relations 13.53 +// between callers and callees. When a method overrides or implements 13.54 +// an abstract method in a supertype (superclass or interface), the 13.55 +// constraints are placed as if the supertype were the caller to the 13.56 +// overriding method. (This works well, since callers to the 13.57 +// supertype have already established agreement between themselves and 13.58 +// the supertype.) As a result of all this, a class can disagree with 13.59 +// its supertype about the meaning of a type name, as long as that 13.60 +// class neither calls a relevant method of the supertype, nor is 13.61 +// called (perhaps via an override) from the supertype. 13.62 +// 13.63 +// 13.64 +// SystemDictionary::check_signature_loaders(sig, l1, l2) 13.65 +// 13.66 // Make sure all class components (including arrays) in the given 13.67 // signature will be resolved to the same class in both loaders. 13.68 // Returns the name of the type that failed a loader constraint check, or 13.69 // NULL if no constraint failed. The returned C string needs cleaning up 13.70 -// with a ResourceMark in the caller 13.71 +// with a ResourceMark in the caller. No exception except OOME is thrown. 13.72 char* SystemDictionary::check_signature_loaders(symbolHandle signature, 13.73 Handle loader1, Handle loader2, 13.74 bool is_method, TRAPS) {
14.1 --- a/src/share/vm/classfile/systemDictionary.hpp Thu Mar 19 09:13:24 2009 -0700 14.2 +++ b/src/share/vm/classfile/systemDictionary.hpp Fri Mar 20 23:19:36 2009 -0700 14.3 @@ -161,6 +161,7 @@ 14.4 class SystemDictionary : AllStatic { 14.5 friend class VMStructs; 14.6 friend class CompactingPermGenGen; 14.7 + friend class SystemDictionaryHandles; 14.8 NOT_PRODUCT(friend class instanceKlassKlass;) 14.9 14.10 public: 14.11 @@ -595,3 +596,18 @@ 14.12 static bool _has_loadClassInternal; 14.13 static bool _has_checkPackageAccess; 14.14 }; 14.15 + 14.16 +// Cf. vmSymbols vs. vmSymbolHandles 14.17 +class SystemDictionaryHandles : AllStatic { 14.18 +public: 14.19 + #define WK_KLASS_HANDLE_DECLARE(name, ignore_symbol, option) \ 14.20 + static KlassHandle name() { \ 14.21 + SystemDictionary::name(); \ 14.22 + klassOop* loc = &SystemDictionary::_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]; \ 14.23 + return KlassHandle(loc, true); \ 14.24 + } 14.25 + WK_KLASSES_DO(WK_KLASS_HANDLE_DECLARE); 14.26 + #undef WK_KLASS_HANDLE_DECLARE 14.27 + 14.28 + static KlassHandle box_klass(BasicType t); 14.29 +};
15.1 --- a/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp Thu Mar 19 09:13:24 2009 -0700 15.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp Fri Mar 20 23:19:36 2009 -0700 15.3 @@ -1,5 +1,5 @@ 15.4 /* 15.5 - * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. 15.6 + * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. 15.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.8 * 15.9 * This code is free software; you can redistribute it and/or modify it 15.10 @@ -825,6 +825,7 @@ 15.11 if (young_gen()->is_in_reserved(addr)) { 15.12 assert(young_gen()->is_in(addr), 15.13 "addr should be in allocated part of young gen"); 15.14 + if (Debugging) return NULL; // called from find() in debug.cpp 15.15 Unimplemented(); 15.16 } else if (old_gen()->is_in_reserved(addr)) { 15.17 assert(old_gen()->is_in(addr),
16.1 --- a/src/share/vm/oops/instanceKlass.cpp Thu Mar 19 09:13:24 2009 -0700 16.2 +++ b/src/share/vm/oops/instanceKlass.cpp Fri Mar 20 23:19:36 2009 -0700 16.3 @@ -1,5 +1,5 @@ 16.4 /* 16.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 16.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 16.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.8 * 16.9 * This code is free software; you can redistribute it and/or modify it 16.10 @@ -1813,6 +1813,8 @@ 16.11 oop class_loader2, symbolOop class_name2) { 16.12 if (class_loader1 != class_loader2) { 16.13 return false; 16.14 + } else if (class_name1 == class_name2) { 16.15 + return true; // skip painful bytewise comparison 16.16 } else { 16.17 ResourceMark rm; 16.18 16.19 @@ -1859,6 +1861,55 @@ 16.20 } 16.21 } 16.22 16.23 +/* defined for now in jvm.cpp, for historical reasons *-- 16.24 +klassOop instanceKlass::compute_enclosing_class_impl(instanceKlassHandle self, 16.25 + symbolOop& simple_name_result, TRAPS) { 16.26 + ... 16.27 +} 16.28 +*/ 16.29 + 16.30 +// tell if two classes have the same enclosing class (at package level) 16.31 +bool instanceKlass::is_same_package_member_impl(instanceKlassHandle class1, 16.32 + klassOop class2_oop, TRAPS) { 16.33 + if (class2_oop == class1->as_klassOop()) return true; 16.34 + if (!Klass::cast(class2_oop)->oop_is_instance()) return false; 16.35 + instanceKlassHandle class2(THREAD, class2_oop); 16.36 + 16.37 + // must be in same package before we try anything else 16.38 + if (!class1->is_same_class_package(class2->class_loader(), class2->name())) 16.39 + return false; 16.40 + 16.41 + // As long as there is an outer1.getEnclosingClass, 16.42 + // shift the search outward. 16.43 + instanceKlassHandle outer1 = class1; 16.44 + for (;;) { 16.45 + // As we walk along, look for equalities between outer1 and class2. 16.46 + // Eventually, the walks will terminate as outer1 stops 16.47 + // at the top-level class around the original class. 16.48 + symbolOop ignore_name; 16.49 + klassOop next = outer1->compute_enclosing_class(ignore_name, CHECK_false); 16.50 + if (next == NULL) break; 16.51 + if (next == class2()) return true; 16.52 + outer1 = instanceKlassHandle(THREAD, next); 16.53 + } 16.54 + 16.55 + // Now do the same for class2. 16.56 + instanceKlassHandle outer2 = class2; 16.57 + for (;;) { 16.58 + symbolOop ignore_name; 16.59 + klassOop next = outer2->compute_enclosing_class(ignore_name, CHECK_false); 16.60 + if (next == NULL) break; 16.61 + // Might as well check the new outer against all available values. 16.62 + if (next == class1()) return true; 16.63 + if (next == outer1()) return true; 16.64 + outer2 = instanceKlassHandle(THREAD, next); 16.65 + } 16.66 + 16.67 + // If by this point we have not found an equality between the 16.68 + // two classes, we know they are in separate package members. 16.69 + return false; 16.70 +} 16.71 + 16.72 16.73 jint instanceKlass::compute_modifier_flags(TRAPS) const { 16.74 klassOop k = as_klassOop(); 16.75 @@ -1996,9 +2047,11 @@ 16.76 16.77 // Printing 16.78 16.79 +#define BULLET " - " 16.80 + 16.81 void FieldPrinter::do_field(fieldDescriptor* fd) { 16.82 - if (fd->is_static() == (_obj == NULL)) { 16.83 - _st->print(" - "); 16.84 + _st->print(BULLET); 16.85 + if (fd->is_static() || (_obj == NULL)) { 16.86 fd->print_on(_st); 16.87 _st->cr(); 16.88 } else { 16.89 @@ -2019,7 +2072,7 @@ 16.90 value->is_typeArray() && 16.91 offset <= (juint) value->length() && 16.92 offset + length <= (juint) value->length()) { 16.93 - st->print("string: "); 16.94 + st->print(BULLET"string: "); 16.95 Handle h_obj(obj); 16.96 java_lang_String::print(h_obj, st); 16.97 st->cr(); 16.98 @@ -2027,23 +2080,26 @@ 16.99 } 16.100 } 16.101 16.102 - st->print_cr("fields:"); 16.103 + st->print_cr(BULLET"---- fields (total size %d words):", oop_size(obj)); 16.104 FieldPrinter print_nonstatic_field(st, obj); 16.105 do_nonstatic_fields(&print_nonstatic_field); 16.106 16.107 if (as_klassOop() == SystemDictionary::class_klass()) { 16.108 + st->print(BULLET"signature: "); 16.109 + java_lang_Class::print_signature(obj, st); 16.110 + st->cr(); 16.111 klassOop mirrored_klass = java_lang_Class::as_klassOop(obj); 16.112 - st->print(" - fake entry for mirror: "); 16.113 + st->print(BULLET"fake entry for mirror: "); 16.114 mirrored_klass->print_value_on(st); 16.115 st->cr(); 16.116 - st->print(" - fake entry resolved_constructor: "); 16.117 + st->print(BULLET"fake entry resolved_constructor: "); 16.118 methodOop ctor = java_lang_Class::resolved_constructor(obj); 16.119 ctor->print_value_on(st); 16.120 klassOop array_klass = java_lang_Class::array_klass(obj); 16.121 - st->print(" - fake entry for array: "); 16.122 + st->cr(); 16.123 + st->print(BULLET"fake entry for array: "); 16.124 array_klass->print_value_on(st); 16.125 st->cr(); 16.126 - st->cr(); 16.127 } 16.128 } 16.129 16.130 @@ -2051,6 +2107,28 @@ 16.131 st->print("a "); 16.132 name()->print_value_on(st); 16.133 obj->print_address_on(st); 16.134 + if (as_klassOop() == SystemDictionary::string_klass() 16.135 + && java_lang_String::value(obj) != NULL) { 16.136 + ResourceMark rm; 16.137 + int len = java_lang_String::length(obj); 16.138 + int plen = (len < 24 ? len : 12); 16.139 + char* str = java_lang_String::as_utf8_string(obj, 0, plen); 16.140 + st->print(" = \"%s\"", str); 16.141 + if (len > plen) 16.142 + st->print("...[%d]", len); 16.143 + } else if (as_klassOop() == SystemDictionary::class_klass()) { 16.144 + klassOop k = java_lang_Class::as_klassOop(obj); 16.145 + st->print(" = "); 16.146 + if (k != NULL) { 16.147 + k->print_value_on(st); 16.148 + } else { 16.149 + const char* tname = type2name(java_lang_Class::primitive_type(obj)); 16.150 + st->print("%s", tname ? tname : "type?"); 16.151 + } 16.152 + } else if (java_lang_boxing_object::is_instance(obj)) { 16.153 + st->print(" = "); 16.154 + java_lang_boxing_object::print(obj, st); 16.155 + } 16.156 } 16.157 16.158 #endif // ndef PRODUCT
17.1 --- a/src/share/vm/oops/instanceKlass.hpp Thu Mar 19 09:13:24 2009 -0700 17.2 +++ b/src/share/vm/oops/instanceKlass.hpp Fri Mar 20 23:19:36 2009 -0700 17.3 @@ -1,5 +1,5 @@ 17.4 /* 17.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 17.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 17.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.8 * 17.9 * This code is free software; you can redistribute it and/or modify it 17.10 @@ -308,6 +308,22 @@ 17.11 bool is_same_class_package(oop classloader2, symbolOop classname2); 17.12 static bool is_same_class_package(oop class_loader1, symbolOop class_name1, oop class_loader2, symbolOop class_name2); 17.13 17.14 + // find an enclosing class (defined where original code was, in jvm.cpp!) 17.15 + klassOop compute_enclosing_class(symbolOop& simple_name_result, TRAPS) { 17.16 + instanceKlassHandle self(THREAD, this->as_klassOop()); 17.17 + return compute_enclosing_class_impl(self, simple_name_result, THREAD); 17.18 + } 17.19 + static klassOop compute_enclosing_class_impl(instanceKlassHandle self, 17.20 + symbolOop& simple_name_result, TRAPS); 17.21 + 17.22 + // tell if two classes have the same enclosing class (at package level) 17.23 + bool is_same_package_member(klassOop class2, TRAPS) { 17.24 + instanceKlassHandle self(THREAD, this->as_klassOop()); 17.25 + return is_same_package_member_impl(self, class2, THREAD); 17.26 + } 17.27 + static bool is_same_package_member_impl(instanceKlassHandle self, 17.28 + klassOop class2, TRAPS); 17.29 + 17.30 // initialization state 17.31 bool is_loaded() const { return _init_state >= loaded; } 17.32 bool is_linked() const { return _init_state >= linked; }
18.1 --- a/src/share/vm/oops/instanceKlassKlass.cpp Thu Mar 19 09:13:24 2009 -0700 18.2 +++ b/src/share/vm/oops/instanceKlassKlass.cpp Fri Mar 20 23:19:36 2009 -0700 18.3 @@ -1,5 +1,5 @@ 18.4 /* 18.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 18.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 * 18.9 * This code is free software; you can redistribute it and/or modify it 18.10 @@ -487,6 +487,8 @@ 18.11 18.12 // Printing 18.13 18.14 +#define BULLET " - " 18.15 + 18.16 static const char* state_names[] = { 18.17 "unparseable_by_gc", "allocated", "loaded", "linked", "being_initialized", "fully_initialized", "initialization_error" 18.18 }; 18.19 @@ -497,13 +499,13 @@ 18.20 instanceKlass* ik = instanceKlass::cast(klassOop(obj)); 18.21 klassKlass::oop_print_on(obj, st); 18.22 18.23 - st->print(" - instance size: %d", ik->size_helper()); st->cr(); 18.24 - st->print(" - klass size: %d", ik->object_size()); st->cr(); 18.25 - st->print(" - access: "); ik->access_flags().print_on(st); st->cr(); 18.26 - st->print(" - state: "); st->print_cr(state_names[ik->_init_state]); 18.27 - st->print(" - name: "); ik->name()->print_value_on(st); st->cr(); 18.28 - st->print(" - super: "); ik->super()->print_value_on(st); st->cr(); 18.29 - st->print(" - sub: "); 18.30 + st->print(BULLET"instance size: %d", ik->size_helper()); st->cr(); 18.31 + st->print(BULLET"klass size: %d", ik->object_size()); st->cr(); 18.32 + st->print(BULLET"access: "); ik->access_flags().print_on(st); st->cr(); 18.33 + st->print(BULLET"state: "); st->print_cr(state_names[ik->_init_state]); 18.34 + st->print(BULLET"name: "); ik->name()->print_value_on(st); st->cr(); 18.35 + st->print(BULLET"super: "); ik->super()->print_value_on(st); st->cr(); 18.36 + st->print(BULLET"sub: "); 18.37 Klass* sub = ik->subklass(); 18.38 int n; 18.39 for (n = 0; sub != NULL; n++, sub = sub->next_sibling()) { 18.40 @@ -516,12 +518,12 @@ 18.41 st->cr(); 18.42 18.43 if (ik->is_interface()) { 18.44 - st->print_cr(" - nof implementors: %d", ik->nof_implementors()); 18.45 + st->print_cr(BULLET"nof implementors: %d", ik->nof_implementors()); 18.46 int print_impl = 0; 18.47 for (int i = 0; i < instanceKlass::implementors_limit; i++) { 18.48 if (ik->implementor(i) != NULL) { 18.49 if (++print_impl == 1) 18.50 - st->print_cr(" - implementor: "); 18.51 + st->print_cr(BULLET"implementor: "); 18.52 st->print(" "); 18.53 ik->implementor(i)->print_value_on(st); 18.54 } 18.55 @@ -529,34 +531,33 @@ 18.56 if (print_impl > 0) st->cr(); 18.57 } 18.58 18.59 - st->print(" - arrays: "); ik->array_klasses()->print_value_on(st); st->cr(); 18.60 - st->print(" - methods: "); ik->methods()->print_value_on(st); st->cr(); 18.61 + st->print(BULLET"arrays: "); ik->array_klasses()->print_value_on(st); st->cr(); 18.62 + st->print(BULLET"methods: "); ik->methods()->print_value_on(st); st->cr(); 18.63 if (Verbose) { 18.64 objArrayOop methods = ik->methods(); 18.65 for(int i = 0; i < methods->length(); i++) { 18.66 tty->print("%d : ", i); methods->obj_at(i)->print_value(); tty->cr(); 18.67 } 18.68 } 18.69 - st->print(" - method ordering: "); ik->method_ordering()->print_value_on(st); st->cr(); 18.70 - st->print(" - local interfaces: "); ik->local_interfaces()->print_value_on(st); st->cr(); 18.71 - st->print(" - trans. interfaces: "); ik->transitive_interfaces()->print_value_on(st); st->cr(); 18.72 - st->print(" - constants: "); ik->constants()->print_value_on(st); st->cr(); 18.73 - st->print(" - class loader: "); ik->class_loader()->print_value_on(st); st->cr(); 18.74 - st->print(" - protection domain: "); ik->protection_domain()->print_value_on(st); st->cr(); 18.75 - st->print(" - host class: "); ik->host_klass()->print_value_on(st); st->cr(); 18.76 - st->print(" - signers: "); ik->signers()->print_value_on(st); st->cr(); 18.77 + st->print(BULLET"method ordering: "); ik->method_ordering()->print_value_on(st); st->cr(); 18.78 + st->print(BULLET"local interfaces: "); ik->local_interfaces()->print_value_on(st); st->cr(); 18.79 + st->print(BULLET"trans. interfaces: "); ik->transitive_interfaces()->print_value_on(st); st->cr(); 18.80 + st->print(BULLET"constants: "); ik->constants()->print_value_on(st); st->cr(); 18.81 + st->print(BULLET"class loader: "); ik->class_loader()->print_value_on(st); st->cr(); 18.82 + st->print(BULLET"protection domain: "); ik->protection_domain()->print_value_on(st); st->cr(); 18.83 + st->print(BULLET"host class: "); ik->host_klass()->print_value_on(st); st->cr(); 18.84 + st->print(BULLET"signers: "); ik->signers()->print_value_on(st); st->cr(); 18.85 if (ik->source_file_name() != NULL) { 18.86 - st->print(" - source file: "); 18.87 + st->print(BULLET"source file: "); 18.88 ik->source_file_name()->print_value_on(st); 18.89 st->cr(); 18.90 } 18.91 if (ik->source_debug_extension() != NULL) { 18.92 - st->print(" - source debug extension: "); 18.93 + st->print(BULLET"source debug extension: "); 18.94 ik->source_debug_extension()->print_value_on(st); 18.95 st->cr(); 18.96 } 18.97 18.98 - st->print_cr(" - previous version: "); 18.99 { 18.100 ResourceMark rm; 18.101 // PreviousVersionInfo objects returned via PreviousVersionWalker 18.102 @@ -564,38 +565,43 @@ 18.103 // GrowableArray _after_ the PreviousVersionWalker destructor 18.104 // has destroyed the handles. 18.105 { 18.106 + bool have_pv = false; 18.107 PreviousVersionWalker pvw(ik); 18.108 for (PreviousVersionInfo * pv_info = pvw.next_previous_version(); 18.109 pv_info != NULL; pv_info = pvw.next_previous_version()) { 18.110 + if (!have_pv) 18.111 + st->print(BULLET"previous version: "); 18.112 + have_pv = true; 18.113 pv_info->prev_constant_pool_handle()()->print_value_on(st); 18.114 } 18.115 - st->cr(); 18.116 + if (have_pv) st->cr(); 18.117 } // pvw is cleaned up 18.118 } // rm is cleaned up 18.119 18.120 if (ik->generic_signature() != NULL) { 18.121 - st->print(" - generic signature: "); 18.122 + st->print(BULLET"generic signature: "); 18.123 ik->generic_signature()->print_value_on(st); 18.124 + st->cr(); 18.125 } 18.126 - st->print(" - inner classes: "); ik->inner_classes()->print_value_on(st); st->cr(); 18.127 - st->print(" - java mirror: "); ik->java_mirror()->print_value_on(st); st->cr(); 18.128 - st->print(" - vtable length %d (start addr: " INTPTR_FORMAT ")", ik->vtable_length(), ik->start_of_vtable()); st->cr(); 18.129 - st->print(" - itable length %d (start addr: " INTPTR_FORMAT ")", ik->itable_length(), ik->start_of_itable()); st->cr(); 18.130 - st->print_cr(" - static fields:"); 18.131 + st->print(BULLET"inner classes: "); ik->inner_classes()->print_value_on(st); st->cr(); 18.132 + st->print(BULLET"java mirror: "); ik->java_mirror()->print_value_on(st); st->cr(); 18.133 + st->print(BULLET"vtable length %d (start addr: " INTPTR_FORMAT ")", ik->vtable_length(), ik->start_of_vtable()); st->cr(); 18.134 + st->print(BULLET"itable length %d (start addr: " INTPTR_FORMAT ")", ik->itable_length(), ik->start_of_itable()); st->cr(); 18.135 + st->print_cr(BULLET"---- static fields (%d words):", ik->static_field_size()); 18.136 FieldPrinter print_static_field(st); 18.137 ik->do_local_static_fields(&print_static_field); 18.138 - st->print_cr(" - non-static fields:"); 18.139 - FieldPrinter print_nonstatic_field(st, obj); 18.140 + st->print_cr(BULLET"---- non-static fields (%d words):", ik->nonstatic_field_size()); 18.141 + FieldPrinter print_nonstatic_field(st); 18.142 ik->do_nonstatic_fields(&print_nonstatic_field); 18.143 18.144 - st->print(" - static oop maps: "); 18.145 + st->print(BULLET"static oop maps: "); 18.146 if (ik->static_oop_field_size() > 0) { 18.147 int first_offset = ik->offset_of_static_fields(); 18.148 st->print("%d-%d", first_offset, first_offset + ik->static_oop_field_size() - 1); 18.149 } 18.150 st->cr(); 18.151 18.152 - st->print(" - non-static oop maps: "); 18.153 + st->print(BULLET"non-static oop maps: "); 18.154 OopMapBlock* map = ik->start_of_nonstatic_oop_maps(); 18.155 OopMapBlock* end_map = map + ik->nonstatic_oop_map_size(); 18.156 while (map < end_map) {
19.1 --- a/src/share/vm/oops/klassVtable.cpp Thu Mar 19 09:13:24 2009 -0700 19.2 +++ b/src/share/vm/oops/klassVtable.cpp Fri Mar 20 23:19:36 2009 -0700 19.3 @@ -1,5 +1,5 @@ 19.4 /* 19.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 19.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 19.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.8 * 19.9 * This code is free software; you can redistribute it and/or modify it 19.10 @@ -1153,6 +1153,27 @@ 19.11 return index; 19.12 } 19.13 19.14 + 19.15 +// inverse to compute_itable_index 19.16 +methodOop klassItable::method_for_itable_index(klassOop intf, int itable_index) { 19.17 + assert(instanceKlass::cast(intf)->is_interface(), "sanity check"); 19.18 + objArrayOop methods = instanceKlass::cast(intf)->methods(); 19.19 + 19.20 + int index = itable_index; 19.21 + // Adjust for <clinit>, which is left out of table if first method 19.22 + if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->name() == vmSymbols::class_initializer_name()) { 19.23 + index++; 19.24 + } 19.25 + 19.26 + if (itable_index < 0 || index >= methods->length()) 19.27 + return NULL; // help caller defend against bad indexes 19.28 + 19.29 + methodOop m = (methodOop)methods->obj_at(index); 19.30 + assert(compute_itable_index(m) == itable_index, "correct inverse"); 19.31 + 19.32 + return m; 19.33 +} 19.34 + 19.35 void klassVtable::verify(outputStream* st, bool forced) { 19.36 // make sure table is initialized 19.37 if (!Universe::is_fully_initialized()) return;
20.1 --- a/src/share/vm/oops/klassVtable.hpp Thu Mar 19 09:13:24 2009 -0700 20.2 +++ b/src/share/vm/oops/klassVtable.hpp Fri Mar 20 23:19:36 2009 -0700 20.3 @@ -1,5 +1,5 @@ 20.4 /* 20.5 - * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 20.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 20.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.8 * 20.9 * This code is free software; you can redistribute it and/or modify it 20.10 @@ -298,6 +298,8 @@ 20.11 20.12 // Resolving of method to index 20.13 static int compute_itable_index(methodOop m); 20.14 + // ...and back again: 20.15 + static methodOop method_for_itable_index(klassOop klass, int itable_index); 20.16 20.17 // Debugging/Statistics 20.18 static void print_statistics() PRODUCT_RETURN;
21.1 --- a/src/share/vm/oops/methodKlass.cpp Thu Mar 19 09:13:24 2009 -0700 21.2 +++ b/src/share/vm/oops/methodKlass.cpp Fri Mar 20 23:19:36 2009 -0700 21.3 @@ -1,5 +1,5 @@ 21.4 /* 21.5 - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 21.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 21.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.8 * 21.9 * This code is free software; you can redistribute it and/or modify it 21.10 @@ -247,9 +247,14 @@ 21.11 st->print_cr(" - size of params: %d", m->size_of_parameters()); 21.12 st->print_cr(" - method size: %d", m->method_size()); 21.13 st->print_cr(" - vtable index: %d", m->_vtable_index); 21.14 + st->print_cr(" - i2i entry: " INTPTR_FORMAT, m->interpreter_entry()); 21.15 + st->print_cr(" - adapter: " INTPTR_FORMAT, m->adapter()); 21.16 + st->print_cr(" - compiled entry " INTPTR_FORMAT, m->from_compiled_entry()); 21.17 st->print_cr(" - code size: %d", m->code_size()); 21.18 - st->print_cr(" - code start: " INTPTR_FORMAT, m->code_base()); 21.19 - st->print_cr(" - code end (excl): " INTPTR_FORMAT, m->code_base() + m->code_size()); 21.20 + if (m->code_size() != 0) { 21.21 + st->print_cr(" - code start: " INTPTR_FORMAT, m->code_base()); 21.22 + st->print_cr(" - code end (excl): " INTPTR_FORMAT, m->code_base() + m->code_size()); 21.23 + } 21.24 if (m->method_data() != NULL) { 21.25 st->print_cr(" - method data: " INTPTR_FORMAT, (address)m->method_data()); 21.26 } 21.27 @@ -293,6 +298,10 @@ 21.28 m->code()->print_value_on(st); 21.29 st->cr(); 21.30 } 21.31 + if (m->is_native()) { 21.32 + st->print_cr(" - native function: " INTPTR_FORMAT, m->native_function()); 21.33 + st->print_cr(" - signature handler: " INTPTR_FORMAT, m->signature_handler()); 21.34 + } 21.35 } 21.36 21.37
22.1 --- a/src/share/vm/oops/objArrayKlass.cpp Thu Mar 19 09:13:24 2009 -0700 22.2 +++ b/src/share/vm/oops/objArrayKlass.cpp Fri Mar 20 23:19:36 2009 -0700 22.3 @@ -1,5 +1,5 @@ 22.4 /* 22.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 22.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.8 * 22.9 * This code is free software; you can redistribute it and/or modify it 22.10 @@ -502,12 +502,25 @@ 22.11 } 22.12 } 22.13 22.14 +static int max_objArray_print_length = 4; 22.15 22.16 void objArrayKlass::oop_print_value_on(oop obj, outputStream* st) { 22.17 assert(obj->is_objArray(), "must be objArray"); 22.18 + st->print("a "); 22.19 element_klass()->print_value_on(st); 22.20 - st->print("a [%d] ", objArrayOop(obj)->length()); 22.21 - as_klassOop()->klass()->print_value_on(st); 22.22 + int len = objArrayOop(obj)->length(); 22.23 + st->print("[%d] ", len); 22.24 + obj->print_address_on(st); 22.25 + if (PrintOopAddress || PrintMiscellaneous && (WizardMode || Verbose)) { 22.26 + st->print("{"); 22.27 + for (int i = 0; i < len; i++) { 22.28 + if (i > max_objArray_print_length) { 22.29 + st->print("..."); break; 22.30 + } 22.31 + st->print(" "INTPTR_FORMAT, (intptr_t)(void*)objArrayOop(obj)->obj_at(i)); 22.32 + } 22.33 + st->print(" }"); 22.34 + } 22.35 } 22.36 22.37 #endif // PRODUCT
23.1 --- a/src/share/vm/oops/oop.cpp Thu Mar 19 09:13:24 2009 -0700 23.2 +++ b/src/share/vm/oops/oop.cpp Fri Mar 20 23:19:36 2009 -0700 23.3 @@ -1,5 +1,5 @@ 23.4 /* 23.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 23.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 23.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.8 * 23.9 * This code is free software; you can redistribute it and/or modify it 23.10 @@ -65,11 +65,7 @@ 23.11 23.12 void oopDesc::print_address_on(outputStream* st) const { 23.13 if (PrintOopAddress) { 23.14 - st->print("{"); 23.15 - if (PrintOopAddress) { 23.16 - st->print(INTPTR_FORMAT, this); 23.17 - } 23.18 - st->print("}"); 23.19 + st->print("{"INTPTR_FORMAT"}", this); 23.20 } 23.21 } 23.22
24.1 --- a/src/share/vm/prims/jvm.cpp Thu Mar 19 09:13:24 2009 -0700 24.2 +++ b/src/share/vm/prims/jvm.cpp Fri Mar 20 23:19:36 2009 -0700 24.3 @@ -1242,7 +1242,7 @@ 24.4 24.5 // Throws an exception if outer klass has not declared k as 24.6 // an inner klass 24.7 - Reflection::check_for_inner_class(k, inner_klass, CHECK_NULL); 24.8 + Reflection::check_for_inner_class(k, inner_klass, true, CHECK_NULL); 24.9 24.10 result->obj_at_put(members, inner_klass->java_mirror()); 24.11 members++; 24.12 @@ -1265,16 +1265,29 @@ 24.13 24.14 24.15 JVM_ENTRY(jclass, JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass)) 24.16 - const int inner_class_info_index = 0; 24.17 - const int outer_class_info_index = 1; 24.18 - 24.19 +{ 24.20 // ofClass is a reference to a java_lang_Class object. 24.21 if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) || 24.22 ! Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_instance()) { 24.23 return NULL; 24.24 } 24.25 24.26 - instanceKlassHandle k(thread, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass))); 24.27 + symbolOop simple_name = NULL; 24.28 + klassOop outer_klass 24.29 + = instanceKlass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)) 24.30 + )->compute_enclosing_class(simple_name, CHECK_NULL); 24.31 + if (outer_klass == NULL) return NULL; // already a top-level class 24.32 + if (simple_name == NULL) return NULL; // an anonymous class (inside a method) 24.33 + return (jclass) JNIHandles::make_local(env, Klass::cast(outer_klass)->java_mirror()); 24.34 +} 24.35 +JVM_END 24.36 + 24.37 +// should be in instanceKlass.cpp, but is here for historical reasons 24.38 +klassOop instanceKlass::compute_enclosing_class_impl(instanceKlassHandle k, 24.39 + symbolOop& simple_name_result, TRAPS) { 24.40 + Thread* thread = THREAD; 24.41 + const int inner_class_info_index = inner_class_inner_class_info_offset; 24.42 + const int outer_class_info_index = inner_class_outer_class_info_offset; 24.43 24.44 if (k->inner_classes()->length() == 0) { 24.45 // No inner class info => no declaring class 24.46 @@ -1288,35 +1301,51 @@ 24.47 bool found = false; 24.48 klassOop ok; 24.49 instanceKlassHandle outer_klass; 24.50 + bool inner_is_member = false; 24.51 + int simple_name_index = 0; 24.52 24.53 // Find inner_klass attribute 24.54 - for(int i = 0; i < i_length && !found; i+= 4) { 24.55 + for (int i = 0; i < i_length && !found; i += inner_class_next_offset) { 24.56 int ioff = i_icls->ushort_at(i + inner_class_info_index); 24.57 int ooff = i_icls->ushort_at(i + outer_class_info_index); 24.58 - 24.59 - if (ioff != 0 && ooff != 0) { 24.60 + int noff = i_icls->ushort_at(i + inner_class_inner_name_offset); 24.61 + if (ioff != 0) { 24.62 // Check to see if the name matches the class we're looking for 24.63 // before attempting to find the class. 24.64 if (i_cp->klass_name_at_matches(k, ioff)) { 24.65 klassOop inner_klass = i_cp->klass_at(ioff, CHECK_NULL); 24.66 - if (k() == inner_klass) { 24.67 - found = true; 24.68 + found = (k() == inner_klass); 24.69 + if (found && ooff != 0) { 24.70 ok = i_cp->klass_at(ooff, CHECK_NULL); 24.71 outer_klass = instanceKlassHandle(thread, ok); 24.72 + simple_name_index = noff; 24.73 + inner_is_member = true; 24.74 } 24.75 } 24.76 } 24.77 } 24.78 24.79 + if (found && outer_klass.is_null()) { 24.80 + // It may be anonymous; try for that. 24.81 + int encl_method_class_idx = k->enclosing_method_class_index(); 24.82 + if (encl_method_class_idx != 0) { 24.83 + ok = i_cp->klass_at(encl_method_class_idx, CHECK_NULL); 24.84 + outer_klass = instanceKlassHandle(thread, ok); 24.85 + inner_is_member = false; 24.86 + } 24.87 + } 24.88 + 24.89 // If no inner class attribute found for this class. 24.90 - if (!found) return NULL; 24.91 + if (outer_klass.is_null()) return NULL; 24.92 24.93 // Throws an exception if outer klass has not declared k as an inner klass 24.94 - Reflection::check_for_inner_class(outer_klass, k, CHECK_NULL); 24.95 - 24.96 - return (jclass)JNIHandles::make_local(env, outer_klass->java_mirror()); 24.97 -JVM_END 24.98 - 24.99 + // We need evidence that each klass knows about the other, or else 24.100 + // the system could allow a spoof of an inner class to gain access rights. 24.101 + Reflection::check_for_inner_class(outer_klass, k, inner_is_member, CHECK_NULL); 24.102 + 24.103 + simple_name_result = (inner_is_member ? i_cp->symbol_at(simple_name_index) : symbolOop(NULL)); 24.104 + return outer_klass(); 24.105 +} 24.106 24.107 JVM_ENTRY(jstring, JVM_GetClassSignature(JNIEnv *env, jclass cls)) 24.108 assert (cls != NULL, "illegal class");
25.1 --- a/src/share/vm/runtime/fieldDescriptor.cpp Thu Mar 19 09:13:24 2009 -0700 25.2 +++ b/src/share/vm/runtime/fieldDescriptor.cpp Fri Mar 20 23:19:36 2009 -0700 25.3 @@ -1,5 +1,5 @@ 25.4 /* 25.5 - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. 25.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 25.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.8 * 25.9 * This code is free software; you can redistribute it and/or modify it 25.10 @@ -107,13 +107,14 @@ 25.11 void fieldDescriptor::print_on_for(outputStream* st, oop obj) { 25.12 print_on(st); 25.13 BasicType ft = field_type(); 25.14 - jint as_int; 25.15 + jint as_int = 0; 25.16 switch (ft) { 25.17 case T_BYTE: 25.18 as_int = (jint)obj->byte_field(offset()); 25.19 st->print(" %d", obj->byte_field(offset())); 25.20 break; 25.21 case T_CHAR: 25.22 + as_int = (jint)obj->char_field(offset()); 25.23 { 25.24 jchar c = obj->char_field(offset()); 25.25 as_int = c; 25.26 @@ -128,6 +129,7 @@ 25.27 st->print(" %f", obj->float_field(offset())); 25.28 break; 25.29 case T_INT: 25.30 + as_int = obj->int_field(offset()); 25.31 st->print(" %d", obj->int_field(offset())); 25.32 break; 25.33 case T_LONG: 25.34 @@ -144,12 +146,12 @@ 25.35 break; 25.36 case T_ARRAY: 25.37 st->print(" "); 25.38 - as_int = obj->int_field(offset()); 25.39 + NOT_LP64(as_int = obj->int_field(offset())); 25.40 obj->obj_field(offset())->print_value_on(st); 25.41 break; 25.42 case T_OBJECT: 25.43 st->print(" "); 25.44 - as_int = obj->int_field(offset()); 25.45 + NOT_LP64(as_int = obj->int_field(offset())); 25.46 obj->obj_field(offset())->print_value_on(st); 25.47 break; 25.48 default: 25.49 @@ -158,9 +160,9 @@ 25.50 } 25.51 // Print a hint as to the underlying integer representation. This can be wrong for 25.52 // pointers on an LP64 machine 25.53 - if (ft == T_LONG || ft == T_DOUBLE) { 25.54 + if (ft == T_LONG || ft == T_DOUBLE LP64_ONLY(|| !is_java_primitive(ft)) ) { 25.55 st->print(" (%x %x)", obj->int_field(offset()), obj->int_field(offset()+sizeof(jint))); 25.56 - } else { 25.57 + } else if (as_int < 0 || as_int > 9) { 25.58 st->print(" (%x)", as_int); 25.59 } 25.60 }
26.1 --- a/src/share/vm/runtime/handles.hpp Thu Mar 19 09:13:24 2009 -0700 26.2 +++ b/src/share/vm/runtime/handles.hpp Fri Mar 20 23:19:36 2009 -0700 26.3 @@ -1,5 +1,5 @@ 26.4 /* 26.5 - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 26.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 26.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.8 * 26.9 * This code is free software; you can redistribute it and/or modify it 26.10 @@ -137,6 +137,14 @@ 26.11 assert(is_null() || obj()->is_klass(), "not a klassOop"); 26.12 } 26.13 26.14 + // Direct interface, use very sparingly. 26.15 + // Used by SystemDictionaryHandles to create handles on existing WKKs. 26.16 + // The obj of such a klass handle may be null, because the handle is formed 26.17 + // during system bootstrapping. 26.18 + KlassHandle(klassOop *handle, bool dummy) : Handle((oop*)handle, dummy) { 26.19 + assert(SharedSkipVerify || is_null() || obj() == NULL || obj()->is_klass(), "not a klassOop"); 26.20 + } 26.21 + 26.22 // General access 26.23 klassOop operator () () const { return obj(); } 26.24 Klass* operator -> () const { return as_klass(); }
27.1 --- a/src/share/vm/runtime/reflection.cpp Thu Mar 19 09:13:24 2009 -0700 27.2 +++ b/src/share/vm/runtime/reflection.cpp Fri Mar 20 23:19:36 2009 -0700 27.3 @@ -1,5 +1,5 @@ 27.4 /* 27.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 27.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 27.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 27.8 * 27.9 * This code is free software; you can redistribute it and/or modify it 27.10 @@ -554,10 +554,18 @@ 27.11 return instanceKlass::cast(class1)->is_same_class_package(class2); 27.12 } 27.13 27.14 +bool Reflection::is_same_package_member(klassOop class1, klassOop class2, TRAPS) { 27.15 + return instanceKlass::cast(class1)->is_same_package_member(class2, THREAD); 27.16 +} 27.17 + 27.18 27.19 // Checks that the 'outer' klass has declared 'inner' as being an inner klass. If not, 27.20 // throw an incompatible class change exception 27.21 -void Reflection::check_for_inner_class(instanceKlassHandle outer, instanceKlassHandle inner, TRAPS) { 27.22 +// If inner_is_member, require the inner to be a member of the outer. 27.23 +// If !inner_is_member, require the inner to be anonymous (a non-member). 27.24 +// Caller is responsible for figuring out in advance which case must be true. 27.25 +void Reflection::check_for_inner_class(instanceKlassHandle outer, instanceKlassHandle inner, 27.26 + bool inner_is_member, TRAPS) { 27.27 const int inner_class_info_index = 0; 27.28 const int outer_class_info_index = 1; 27.29 27.30 @@ -567,7 +575,7 @@ 27.31 int ioff = icls->ushort_at(i + inner_class_info_index); 27.32 int ooff = icls->ushort_at(i + outer_class_info_index); 27.33 27.34 - if (ioff != 0 && ooff != 0) { 27.35 + if (inner_is_member && ioff != 0 && ooff != 0) { 27.36 klassOop o = cp->klass_at(ooff, CHECK); 27.37 if (o == outer()) { 27.38 klassOop i = cp->klass_at(ioff, CHECK); 27.39 @@ -576,6 +584,13 @@ 27.40 } 27.41 } 27.42 } 27.43 + if (!inner_is_member && ioff != 0 && ooff == 0 && 27.44 + cp->klass_name_at_matches(inner, ioff)) { 27.45 + klassOop i = cp->klass_at(ioff, CHECK); 27.46 + if (i == inner()) { 27.47 + return; 27.48 + } 27.49 + } 27.50 } 27.51 27.52 // 'inner' not declared as an inner klass in outer
28.1 --- a/src/share/vm/runtime/reflection.hpp Thu Mar 19 09:13:24 2009 -0700 28.2 +++ b/src/share/vm/runtime/reflection.hpp Fri Mar 20 23:19:36 2009 -0700 28.3 @@ -1,5 +1,5 @@ 28.4 /* 28.5 - * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 28.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 28.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.8 * 28.9 * This code is free software; you can redistribute it and/or modify it 28.10 @@ -87,12 +87,18 @@ 28.11 bool classloader_only, 28.12 bool protected_restriction = false); 28.13 static bool is_same_class_package(klassOop class1, klassOop class2); 28.14 + static bool is_same_package_member(klassOop class1, klassOop class2, TRAPS); 28.15 28.16 static bool can_relax_access_check_for( 28.17 klassOop accessor, klassOop accesee, bool classloader_only); 28.18 28.19 // inner class reflection 28.20 - static void check_for_inner_class(instanceKlassHandle outer, instanceKlassHandle inner, TRAPS); 28.21 + // raise an ICCE unless the required relationship can be proven to hold 28.22 + // If inner_is_member, require the inner to be a member of the outer. 28.23 + // If !inner_is_member, require the inner to be anonymous (a non-member). 28.24 + // Caller is responsible for figuring out in advance which case must be true. 28.25 + static void check_for_inner_class(instanceKlassHandle outer, instanceKlassHandle inner, 28.26 + bool inner_is_member, TRAPS); 28.27 28.28 // 28.29 // Support for reflection based on dynamic bytecode generation (JDK 1.4)
29.1 --- a/src/share/vm/runtime/sharedRuntime.cpp Thu Mar 19 09:13:24 2009 -0700 29.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp Fri Mar 20 23:19:36 2009 -0700 29.3 @@ -675,48 +675,6 @@ 29.4 JRT_END 29.5 29.6 29.7 -// --------------------------------------------------------------------------------------------------------- 29.8 -// Non-product code 29.9 -#ifndef PRODUCT 29.10 - 29.11 -void SharedRuntime::verify_caller_frame(frame caller_frame, methodHandle callee_method) { 29.12 - ResourceMark rm; 29.13 - assert (caller_frame.is_interpreted_frame(), "sanity check"); 29.14 - assert (callee_method->has_compiled_code(), "callee must be compiled"); 29.15 - methodHandle caller_method (Thread::current(), caller_frame.interpreter_frame_method()); 29.16 - jint bci = caller_frame.interpreter_frame_bci(); 29.17 - methodHandle method = find_callee_method_inside_interpreter(caller_frame, caller_method, bci); 29.18 - assert (callee_method == method, "incorrect method"); 29.19 -} 29.20 - 29.21 -methodHandle SharedRuntime::find_callee_method_inside_interpreter(frame caller_frame, methodHandle caller_method, int bci) { 29.22 - EXCEPTION_MARK; 29.23 - Bytecode_invoke* bytecode = Bytecode_invoke_at(caller_method, bci); 29.24 - methodHandle staticCallee = bytecode->static_target(CATCH); // Non-product code 29.25 - 29.26 - bytecode = Bytecode_invoke_at(caller_method, bci); 29.27 - int bytecode_index = bytecode->index(); 29.28 - Bytecodes::Code bc = bytecode->adjusted_invoke_code(); 29.29 - 29.30 - Handle receiver; 29.31 - if (bc == Bytecodes::_invokeinterface || 29.32 - bc == Bytecodes::_invokevirtual || 29.33 - bc == Bytecodes::_invokespecial) { 29.34 - symbolHandle signature (THREAD, staticCallee->signature()); 29.35 - receiver = Handle(THREAD, retrieve_receiver(signature, caller_frame)); 29.36 - } else { 29.37 - receiver = Handle(); 29.38 - } 29.39 - CallInfo result; 29.40 - constantPoolHandle constants (THREAD, caller_method->constants()); 29.41 - LinkResolver::resolve_invoke(result, receiver, constants, bytecode_index, bc, CATCH); // Non-product code 29.42 - methodHandle calleeMethod = result.selected_method(); 29.43 - return calleeMethod; 29.44 -} 29.45 - 29.46 -#endif // PRODUCT 29.47 - 29.48 - 29.49 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::register_finalizer(JavaThread* thread, oopDesc* obj)) 29.50 assert(obj->is_oop(), "must be a valid oop"); 29.51 assert(obj->klass()->klass_part()->has_finalizer(), "shouldn't be here otherwise");
30.1 --- a/src/share/vm/runtime/sharedRuntime.hpp Thu Mar 19 09:13:24 2009 -0700 30.2 +++ b/src/share/vm/runtime/sharedRuntime.hpp Fri Mar 20 23:19:36 2009 -0700 30.3 @@ -1,5 +1,5 @@ 30.4 /* 30.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 30.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 30.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 30.8 * 30.9 * This code is free software; you can redistribute it and/or modify it 30.10 @@ -180,9 +180,6 @@ 30.11 30.12 static oop retrieve_receiver( symbolHandle sig, frame caller ); 30.13 30.14 - static void verify_caller_frame(frame caller_frame, methodHandle callee_method) PRODUCT_RETURN; 30.15 - static methodHandle find_callee_method_inside_interpreter(frame caller_frame, methodHandle caller_method, int bci) PRODUCT_RETURN_(return methodHandle();); 30.16 - 30.17 static void register_finalizer(JavaThread* thread, oopDesc* obj); 30.18 30.19 // dtrace notifications