Sun, 22 Feb 2009 17:11:56 -0800
Merge
1.1 --- a/src/cpu/sparc/vm/sparc.ad Sun Feb 15 20:09:02 2009 -0800 1.2 +++ b/src/cpu/sparc/vm/sparc.ad Sun Feb 22 17:11:56 2009 -0800 1.3 @@ -762,7 +762,7 @@ 1.4 case Assembler::stdf_op3: st_op = Op_StoreD; break; 1.5 1.6 case Assembler::ldsb_op3: ld_op = Op_LoadB; break; 1.7 - case Assembler::lduh_op3: ld_op = Op_LoadC; break; 1.8 + case Assembler::lduh_op3: ld_op = Op_LoadUS; break; 1.9 case Assembler::ldsh_op3: ld_op = Op_LoadS; break; 1.10 case Assembler::ldx_op3: // may become LoadP or stay LoadI 1.11 case Assembler::ldsw_op3: // may become LoadP or stay LoadI 1.12 @@ -3869,6 +3869,8 @@ 1.13 constraint(ALLOC_IN_RC(dflt_reg)); 1.14 match(RegD); 1.15 1.16 + match(regD_low); 1.17 + 1.18 format %{ %} 1.19 interface(REG_INTER); 1.20 %} 1.21 @@ -3883,7 +3885,7 @@ 1.22 1.23 operand regD_low() %{ 1.24 constraint(ALLOC_IN_RC(dflt_low_reg)); 1.25 - match(RegD); 1.26 + match(regD); 1.27 1.28 format %{ %} 1.29 interface(REG_INTER); 1.30 @@ -5314,9 +5316,9 @@ 1.31 ins_pipe(iload_mask_mem); 1.32 %} 1.33 1.34 -// Load Char (16bit UNsigned) into a Long Register 1.35 -instruct loadUCL(iRegL dst, memory mem, immL_FFFF bytemask) %{ 1.36 - match(Set dst (AndL (ConvI2L (LoadC mem)) bytemask)); 1.37 +// Load Unsigned Short/Char (16bit UNsigned) into a Long Register 1.38 +instruct loadUS2L(iRegL dst, memory mem, immL_FFFF bytemask) %{ 1.39 + match(Set dst (AndL (ConvI2L (LoadUS mem)) bytemask)); 1.40 ins_cost(MEMORY_REF_COST); 1.41 1.42 size(4); 1.43 @@ -5326,9 +5328,9 @@ 1.44 ins_pipe(iload_mask_mem); 1.45 %} 1.46 1.47 -// Load Char (16bit unsigned) 1.48 -instruct loadC(iRegI dst, memory mem) %{ 1.49 - match(Set dst (LoadC mem)); 1.50 +// Load Unsigned Short/Char (16bit unsigned) 1.51 +instruct loadUS(iRegI dst, memory mem) %{ 1.52 + match(Set dst (LoadUS mem)); 1.53 ins_cost(MEMORY_REF_COST); 1.54 1.55 size(4);
2.1 --- a/src/cpu/x86/vm/x86_32.ad Sun Feb 15 20:09:02 2009 -0800 2.2 +++ b/src/cpu/x86/vm/x86_32.ad Sun Feb 22 17:11:56 2009 -0800 2.3 @@ -6413,9 +6413,9 @@ 2.4 ins_pipe( ialu_reg_mem ); 2.5 %} 2.6 2.7 -// Load Char (16bit unsigned) 2.8 -instruct loadC(eRegI dst, memory mem) %{ 2.9 - match(Set dst (LoadC mem)); 2.10 +// Load Unsigned Short/Char (16bit unsigned) 2.11 +instruct loadUS(eRegI dst, memory mem) %{ 2.12 + match(Set dst (LoadUS mem)); 2.13 2.14 ins_cost(125); 2.15 format %{ "MOVZX $dst,$mem" %}
3.1 --- a/src/cpu/x86/vm/x86_64.ad Sun Feb 15 20:09:02 2009 -0800 3.2 +++ b/src/cpu/x86/vm/x86_64.ad Sun Feb 22 17:11:56 2009 -0800 3.3 @@ -6096,25 +6096,25 @@ 3.4 // ins_pipe(ialu_reg_mem); 3.5 // %} 3.6 3.7 -// Load Char (16 bit UNsigned) 3.8 -instruct loadC(rRegI dst, memory mem) 3.9 -%{ 3.10 - match(Set dst (LoadC mem)); 3.11 +// Load Unsigned Short/Char (16 bit UNsigned) 3.12 +instruct loadUS(rRegI dst, memory mem) 3.13 +%{ 3.14 + match(Set dst (LoadUS mem)); 3.15 3.16 ins_cost(125); 3.17 - format %{ "movzwl $dst, $mem\t# char" %} 3.18 + format %{ "movzwl $dst, $mem\t# ushort/char" %} 3.19 opcode(0x0F, 0xB7); 3.20 ins_encode(REX_reg_mem(dst, mem), OpcP, OpcS, reg_mem(dst, mem)); 3.21 ins_pipe(ialu_reg_mem); 3.22 %} 3.23 3.24 -// Load Char (16 bit UNsigned) into long 3.25 -// instruct loadC2L(rRegL dst, memory mem) 3.26 +// Load Unsigned Short/Char (16 bit UNsigned) into long 3.27 +// instruct loadUS2L(rRegL dst, memory mem) 3.28 // %{ 3.29 -// match(Set dst (ConvI2L (LoadC mem))); 3.30 +// match(Set dst (ConvI2L (LoadUS mem))); 3.31 3.32 // ins_cost(125); 3.33 -// format %{ "movzwl $dst, $mem\t# char -> long" %} 3.34 +// format %{ "movzwl $dst, $mem\t# ushort/char -> long" %} 3.35 // opcode(0x0F, 0xB7); 3.36 // ins_encode(REX_reg_mem(dst, mem), OpcP, OpcS, reg_mem(dst, mem)); 3.37 // ins_pipe(ialu_reg_mem); 3.38 @@ -9490,14 +9490,14 @@ 3.39 %{ 3.40 match(Set dst (AndL dst src)); 3.41 3.42 - format %{ "movzbq $dst, $src\t# long & 0xFF" %} 3.43 + format %{ "movzbq $dst, $dst\t# long & 0xFF" %} 3.44 opcode(0x0F, 0xB6); 3.45 ins_encode(REX_reg_reg_wide(dst, dst), OpcP, OpcS, reg_reg(dst, dst)); 3.46 ins_pipe(ialu_reg); 3.47 %} 3.48 3.49 // And Register with Immediate 65535 3.50 -instruct andL_rReg_imm65535(rRegI dst, immL_65535 src) 3.51 +instruct andL_rReg_imm65535(rRegL dst, immL_65535 src) 3.52 %{ 3.53 match(Set dst (AndL dst src)); 3.54
4.1 --- a/src/share/vm/adlc/dict2.cpp Sun Feb 15 20:09:02 2009 -0800 4.2 +++ b/src/share/vm/adlc/dict2.cpp Sun Feb 22 17:11:56 2009 -0800 4.3 @@ -316,9 +316,12 @@ 4.4 return strcmp((const char *)k1,(const char *)k2); 4.5 } 4.6 4.7 -// Slimey cheap key comparator. 4.8 +// Cheap key comparator. 4.9 int cmpkey(const void *key1, const void *key2) { 4.10 - return (int)((intptr_t)key1 - (intptr_t)key2); 4.11 + if (key1 == key2) return 0; 4.12 + intptr_t delta = (intptr_t)key1 - (intptr_t)key2; 4.13 + if (delta > 0) return 1; 4.14 + return -1; 4.15 } 4.16 4.17 //=============================================================================
5.1 --- a/src/share/vm/adlc/forms.cpp Sun Feb 15 20:09:02 2009 -0800 5.2 +++ b/src/share/vm/adlc/forms.cpp Sun Feb 22 17:11:56 2009 -0800 5.3 @@ -248,7 +248,7 @@ 5.4 // True if 'opType', an ideal name, loads or stores. 5.5 Form::DataType Form::is_load_from_memory(const char *opType) const { 5.6 if( strcmp(opType,"LoadB")==0 ) return Form::idealB; 5.7 - if( strcmp(opType,"LoadC")==0 ) return Form::idealC; 5.8 + if( strcmp(opType,"LoadUS")==0 ) return Form::idealC; 5.9 if( strcmp(opType,"LoadD")==0 ) return Form::idealD; 5.10 if( strcmp(opType,"LoadD_unaligned")==0 ) return Form::idealD; 5.11 if( strcmp(opType,"LoadF")==0 ) return Form::idealF;
6.1 --- a/src/share/vm/adlc/formssel.cpp Sun Feb 15 20:09:02 2009 -0800 6.2 +++ b/src/share/vm/adlc/formssel.cpp Sun Feb 22 17:11:56 2009 -0800 6.3 @@ -3314,7 +3314,7 @@ 6.4 "StoreI","StoreL","StoreP","StoreN","StoreD","StoreF" , 6.5 "StoreB","StoreC","Store" ,"StoreFP", 6.6 "LoadI" ,"LoadL", "LoadP" ,"LoadN", "LoadD" ,"LoadF" , 6.7 - "LoadB" ,"LoadC" ,"LoadS" ,"Load" , 6.8 + "LoadB" ,"LoadUS" ,"LoadS" ,"Load" , 6.9 "Store4I","Store2I","Store2L","Store2D","Store4F","Store2F","Store16B", 6.10 "Store8B","Store4B","Store8C","Store4C","Store2C", 6.11 "Load4I" ,"Load2I" ,"Load2L" ,"Load2D" ,"Load4F" ,"Load2F" ,"Load16B" ,
7.1 --- a/src/share/vm/asm/codeBuffer.cpp Sun Feb 15 20:09:02 2009 -0800 7.2 +++ b/src/share/vm/asm/codeBuffer.cpp Sun Feb 22 17:11:56 2009 -0800 7.3 @@ -123,6 +123,10 @@ 7.4 // addresses constructed before expansions will not be confused. 7.5 cb->free_blob(); 7.6 } 7.7 + 7.8 + // free any overflow storage 7.9 + delete _overflow_arena; 7.10 + 7.11 #ifdef ASSERT 7.12 Copy::fill_to_bytes(this, sizeof(*this), badResourceValue); 7.13 #endif
8.1 --- a/src/share/vm/classfile/systemDictionary.cpp Sun Feb 15 20:09:02 2009 -0800 8.2 +++ b/src/share/vm/classfile/systemDictionary.cpp Sun Feb 22 17:11:56 2009 -0800 8.3 @@ -846,6 +846,12 @@ 8.4 Handle protection_domain, 8.5 TRAPS) { 8.6 8.7 + // UseNewReflection 8.8 + // The result of this call should be consistent with the result 8.9 + // of the call to resolve_instance_class_or_null(). 8.10 + // See evaluation 6790209 and 4474172 for more details. 8.11 + class_loader = Handle(THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader())); 8.12 + 8.13 unsigned int d_hash = dictionary()->compute_hash(class_name, class_loader); 8.14 int d_index = dictionary()->hash_to_index(d_hash); 8.15
9.1 --- a/src/share/vm/libadt/dict.cpp Sun Feb 15 20:09:02 2009 -0800 9.2 +++ b/src/share/vm/libadt/dict.cpp Sun Feb 22 17:11:56 2009 -0800 9.3 @@ -346,9 +346,12 @@ 9.4 return strcmp((const char *)k1,(const char *)k2); 9.5 } 9.6 9.7 -// Slimey cheap key comparator. 9.8 +// Cheap key comparator. 9.9 int32 cmpkey(const void *key1, const void *key2) { 9.10 - return (int32)((intptr_t)key1 - (intptr_t)key2); 9.11 + if (key1 == key2) return 0; 9.12 + intptr_t delta = (intptr_t)key1 - (intptr_t)key2; 9.13 + if (delta > 0) return 1; 9.14 + return -1; 9.15 } 9.16 9.17 //=============================================================================
10.1 --- a/src/share/vm/memory/cardTableModRefBS.cpp Sun Feb 15 20:09:02 2009 -0800 10.2 +++ b/src/share/vm/memory/cardTableModRefBS.cpp Sun Feb 22 17:11:56 2009 -0800 10.3 @@ -217,15 +217,28 @@ 10.4 (HeapWord*) align_size_up((uintptr_t)new_end, _page_size); 10.5 assert(new_end_aligned >= (HeapWord*) new_end, 10.6 "align up, but less"); 10.7 + // Check the other regions (excludes "ind") to ensure that 10.8 + // the new_end_aligned does not intrude onto the committed 10.9 + // space of another region. 10.10 int ri = 0; 10.11 for (ri = 0; ri < _cur_covered_regions; ri++) { 10.12 if (ri != ind) { 10.13 if (_committed[ri].contains(new_end_aligned)) { 10.14 - assert((new_end_aligned >= _committed[ri].start()) && 10.15 - (_committed[ri].start() > _committed[ind].start()), 10.16 + // The prior check included in the assert 10.17 + // (new_end_aligned >= _committed[ri].start()) 10.18 + // is redundant with the "contains" test. 10.19 + // Any region containing the new end 10.20 + // should start at or beyond the region found (ind) 10.21 + // for the new end (committed regions are not expected to 10.22 + // be proper subsets of other committed regions). 10.23 + assert(_committed[ri].start() >= _committed[ind].start(), 10.24 "New end of committed region is inconsistent"); 10.25 new_end_aligned = _committed[ri].start(); 10.26 - assert(new_end_aligned > _committed[ind].start(), 10.27 + // new_end_aligned can be equal to the start of its 10.28 + // committed region (i.e., of "ind") if a second 10.29 + // region following "ind" also start at the same location 10.30 + // as "ind". 10.31 + assert(new_end_aligned >= _committed[ind].start(), 10.32 "New end of committed region is before start"); 10.33 debug_only(collided = true;) 10.34 // Should only collide with 1 region
11.1 --- a/src/share/vm/opto/block.cpp Sun Feb 15 20:09:02 2009 -0800 11.2 +++ b/src/share/vm/opto/block.cpp Sun Feb 22 17:11:56 2009 -0800 11.3 @@ -880,6 +880,7 @@ 11.4 } 11.5 11.6 void PhaseCFG::verify( ) const { 11.7 +#ifdef ASSERT 11.8 // Verify sane CFG 11.9 for( uint i = 0; i < _num_blocks; i++ ) { 11.10 Block *b = _blocks[i]; 11.11 @@ -894,10 +895,20 @@ 11.12 "CreateEx must be first instruction in block" ); 11.13 } 11.14 for( uint k = 0; k < n->req(); k++ ) { 11.15 - Node *use = n->in(k); 11.16 - if( use && use != n ) { 11.17 - assert( _bbs[use->_idx] || use->is_Con(), 11.18 + Node *def = n->in(k); 11.19 + if( def && def != n ) { 11.20 + assert( _bbs[def->_idx] || def->is_Con(), 11.21 "must have block; constants for debug info ok" ); 11.22 + // Verify that instructions in the block is in correct order. 11.23 + // Uses must follow their definition if they are at the same block. 11.24 + // Mostly done to check that MachSpillCopy nodes are placed correctly 11.25 + // when CreateEx node is moved in build_ifg_physical(). 11.26 + if( _bbs[def->_idx] == b && 11.27 + !(b->head()->is_Loop() && n->is_Phi()) && 11.28 + // See (+++) comment in reg_split.cpp 11.29 + !(n->jvms() != NULL && n->jvms()->is_monitor_use(k)) ) { 11.30 + assert( b->find_node(def) < j, "uses must follow definitions" ); 11.31 + } 11.32 } 11.33 } 11.34 } 11.35 @@ -914,6 +925,7 @@ 11.36 assert( b->_num_succs == 2, "Conditional branch must have two targets"); 11.37 } 11.38 } 11.39 +#endif 11.40 } 11.41 #endif 11.42
12.1 --- a/src/share/vm/opto/c2_globals.hpp Sun Feb 15 20:09:02 2009 -0800 12.2 +++ b/src/share/vm/opto/c2_globals.hpp Sun Feb 22 17:11:56 2009 -0800 12.3 @@ -191,6 +191,9 @@ 12.4 notproduct(bool, VerifyHashTableKeys, true, \ 12.5 "Verify the immutability of keys in the VN hash tables") \ 12.6 \ 12.7 + notproduct(bool, VerifyRegisterAllocator , false, \ 12.8 + "Verify Register Allocator") \ 12.9 + \ 12.10 develop_pd(intx, FLOATPRESSURE, \ 12.11 "Number of float LRG's that constitute high register pressure") \ 12.12 \
13.1 --- a/src/share/vm/opto/cfgnode.cpp Sun Feb 15 20:09:02 2009 -0800 13.2 +++ b/src/share/vm/opto/cfgnode.cpp Sun Feb 22 17:11:56 2009 -0800 13.3 @@ -858,12 +858,18 @@ 13.4 // convert the one to the other. 13.5 const TypePtr* ttp = _type->make_ptr(); 13.6 const TypeInstPtr* ttip = (ttp != NULL) ? ttp->isa_instptr() : NULL; 13.7 + const TypeKlassPtr* ttkp = (ttp != NULL) ? ttp->isa_klassptr() : NULL; 13.8 bool is_intf = false; 13.9 if (ttip != NULL) { 13.10 ciKlass* k = ttip->klass(); 13.11 if (k->is_loaded() && k->is_interface()) 13.12 is_intf = true; 13.13 } 13.14 + if (ttkp != NULL) { 13.15 + ciKlass* k = ttkp->klass(); 13.16 + if (k->is_loaded() && k->is_interface()) 13.17 + is_intf = true; 13.18 + } 13.19 13.20 // Default case: merge all inputs 13.21 const Type *t = Type::TOP; // Merged type starting value 13.22 @@ -921,6 +927,8 @@ 13.23 // uplift the type. 13.24 if( !t->empty() && ttip && ttip->is_loaded() && ttip->klass()->is_interface() ) 13.25 { assert(ft == _type, ""); } // Uplift to interface 13.26 + else if( !t->empty() && ttkp && ttkp->is_loaded() && ttkp->klass()->is_interface() ) 13.27 + { assert(ft == _type, ""); } // Uplift to interface 13.28 // Otherwise it's something stupid like non-overlapping int ranges 13.29 // found on dying counted loops. 13.30 else 13.31 @@ -936,6 +944,7 @@ 13.32 // because the type system doesn't interact well with interfaces. 13.33 const TypePtr *jtp = jt->make_ptr(); 13.34 const TypeInstPtr *jtip = (jtp != NULL) ? jtp->isa_instptr() : NULL; 13.35 + const TypeKlassPtr *jtkp = (jtp != NULL) ? jtp->isa_klassptr() : NULL; 13.36 if( jtip && ttip ) { 13.37 if( jtip->is_loaded() && jtip->klass()->is_interface() && 13.38 ttip->is_loaded() && !ttip->klass()->is_interface() ) { 13.39 @@ -945,6 +954,14 @@ 13.40 jt = ft; 13.41 } 13.42 } 13.43 + if( jtkp && ttkp ) { 13.44 + if( jtkp->is_loaded() && jtkp->klass()->is_interface() && 13.45 + ttkp->is_loaded() && !ttkp->klass()->is_interface() ) { 13.46 + assert(ft == ttkp->cast_to_ptr_type(jtkp->ptr()) || 13.47 + ft->isa_narrowoop() && ft->make_ptr() == ttkp->cast_to_ptr_type(jtkp->ptr()), ""); 13.48 + jt = ft; 13.49 + } 13.50 + } 13.51 if (jt != ft && jt->base() == ft->base()) { 13.52 if (jt->isa_int() && 13.53 jt->is_int()->_lo == ft->is_int()->_lo &&
14.1 --- a/src/share/vm/opto/chaitin.cpp Sun Feb 15 20:09:02 2009 -0800 14.2 +++ b/src/share/vm/opto/chaitin.cpp Sun Feb 22 17:11:56 2009 -0800 14.3 @@ -228,6 +228,11 @@ 14.4 // them for real. 14.5 de_ssa(); 14.6 14.7 +#ifdef ASSERT 14.8 + // Veify the graph before RA. 14.9 + verify(&live_arena); 14.10 +#endif 14.11 + 14.12 { 14.13 NOT_PRODUCT( Compile::TracePhase t3("computeLive", &_t_computeLive, TimeCompiler); ) 14.14 _live = NULL; // Mark live as being not available 14.15 @@ -306,12 +311,6 @@ 14.16 C->check_node_count(2*NodeLimitFudgeFactor, "out of nodes after physical split"); 14.17 if (C->failing()) return; 14.18 14.19 -#ifdef ASSERT 14.20 - if( VerifyOpto ) { 14.21 - _cfg.verify(); 14.22 - verify_base_ptrs(&live_arena); 14.23 - } 14.24 -#endif 14.25 NOT_PRODUCT( C->verify_graph_edges(); ) 14.26 14.27 compact(); // Compact LRGs; return new lower max lrg 14.28 @@ -340,7 +339,7 @@ 14.29 compress_uf_map_for_nodes(); 14.30 14.31 #ifdef ASSERT 14.32 - if( VerifyOpto ) _ifg->verify(this); 14.33 + verify(&live_arena, true); 14.34 #endif 14.35 } else { 14.36 ifg.SquareUp(); 14.37 @@ -376,12 +375,6 @@ 14.38 // Bail out if unique gets too large (ie - unique > MaxNodeLimit - 2*NodeLimitFudgeFactor) 14.39 C->check_node_count(2*NodeLimitFudgeFactor, "out of nodes after split"); 14.40 if (C->failing()) return; 14.41 -#ifdef ASSERT 14.42 - if( VerifyOpto ) { 14.43 - _cfg.verify(); 14.44 - verify_base_ptrs(&live_arena); 14.45 - } 14.46 -#endif 14.47 14.48 compact(); // Compact LRGs; return new lower max lrg 14.49 14.50 @@ -412,7 +405,7 @@ 14.51 } 14.52 compress_uf_map_for_nodes(); 14.53 #ifdef ASSERT 14.54 - if( VerifyOpto ) _ifg->verify(this); 14.55 + verify(&live_arena, true); 14.56 #endif 14.57 cache_lrg_info(); // Count degree of LRGs 14.58 14.59 @@ -432,6 +425,11 @@ 14.60 // Peephole remove copies 14.61 post_allocate_copy_removal(); 14.62 14.63 +#ifdef ASSERT 14.64 + // Veify the graph after RA. 14.65 + verify(&live_arena); 14.66 +#endif 14.67 + 14.68 // max_reg is past the largest *register* used. 14.69 // Convert that to a frame_slot number. 14.70 if( _max_reg <= _matcher._new_SP ) 14.71 @@ -956,7 +954,7 @@ 14.72 while ((neighbor = elements.next()) != 0) { 14.73 LRG *n = &lrgs(neighbor); 14.74 #ifdef ASSERT 14.75 - if( VerifyOpto ) { 14.76 + if( VerifyOpto || VerifyRegisterAllocator ) { 14.77 assert( _ifg->effective_degree(neighbor) == n->degree(), "" ); 14.78 } 14.79 #endif
15.1 --- a/src/share/vm/opto/chaitin.hpp Sun Feb 15 20:09:02 2009 -0800 15.2 +++ b/src/share/vm/opto/chaitin.hpp Sun Feb 22 17:11:56 2009 -0800 15.3 @@ -491,6 +491,8 @@ 15.4 // Verify that base pointers and derived pointers are still sane 15.5 void verify_base_ptrs( ResourceArea *a ) const; 15.6 15.7 + void verify( ResourceArea *a, bool verify_ifg = false ) const; 15.8 + 15.9 void dump_for_spill_split_recycle() const; 15.10 15.11 public:
16.1 --- a/src/share/vm/opto/classes.hpp Sun Feb 15 20:09:02 2009 -0800 16.2 +++ b/src/share/vm/opto/classes.hpp Sun Feb 22 17:11:56 2009 -0800 16.3 @@ -129,7 +129,7 @@ 16.4 macro(LShiftI) 16.5 macro(LShiftL) 16.6 macro(LoadB) 16.7 -macro(LoadC) 16.8 +macro(LoadUS) 16.9 macro(LoadD) 16.10 macro(LoadD_unaligned) 16.11 macro(LoadF)
17.1 --- a/src/share/vm/opto/compile.cpp Sun Feb 15 20:09:02 2009 -0800 17.2 +++ b/src/share/vm/opto/compile.cpp Sun Feb 22 17:11:56 2009 -0800 17.3 @@ -2005,7 +2005,7 @@ 17.4 case Op_StoreP: 17.5 case Op_StoreN: 17.6 case Op_LoadB: 17.7 - case Op_LoadC: 17.8 + case Op_LoadUS: 17.9 case Op_LoadI: 17.10 case Op_LoadKlass: 17.11 case Op_LoadNKlass:
18.1 --- a/src/share/vm/opto/divnode.cpp Sun Feb 15 20:09:02 2009 -0800 18.2 +++ b/src/share/vm/opto/divnode.cpp Sun Feb 22 17:11:56 2009 -0800 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 @@ -244,42 +244,73 @@ 18.11 18.12 //---------------------long_by_long_mulhi-------------------------------------- 18.13 // Generate ideal node graph for upper half of a 64 bit x 64 bit multiplication 18.14 -static Node *long_by_long_mulhi( PhaseGVN *phase, Node *dividend, jlong magic_const) { 18.15 +static Node* long_by_long_mulhi(PhaseGVN* phase, Node* dividend, jlong magic_const) { 18.16 // If the architecture supports a 64x64 mulhi, there is 18.17 // no need to synthesize it in ideal nodes. 18.18 if (Matcher::has_match_rule(Op_MulHiL)) { 18.19 - Node *v = phase->longcon(magic_const); 18.20 + Node* v = phase->longcon(magic_const); 18.21 return new (phase->C, 3) MulHiLNode(dividend, v); 18.22 } 18.23 18.24 + // Taken from Hacker's Delight, Fig. 8-2. Multiply high signed. 18.25 + // (http://www.hackersdelight.org/HDcode/mulhs.c) 18.26 + // 18.27 + // int mulhs(int u, int v) { 18.28 + // unsigned u0, v0, w0; 18.29 + // int u1, v1, w1, w2, t; 18.30 + // 18.31 + // u0 = u & 0xFFFF; u1 = u >> 16; 18.32 + // v0 = v & 0xFFFF; v1 = v >> 16; 18.33 + // w0 = u0*v0; 18.34 + // t = u1*v0 + (w0 >> 16); 18.35 + // w1 = t & 0xFFFF; 18.36 + // w2 = t >> 16; 18.37 + // w1 = u0*v1 + w1; 18.38 + // return u1*v1 + w2 + (w1 >> 16); 18.39 + // } 18.40 + // 18.41 + // Note: The version above is for 32x32 multiplications, while the 18.42 + // following inline comments are adapted to 64x64. 18.43 + 18.44 const int N = 64; 18.45 18.46 - Node *u_hi = phase->transform(new (phase->C, 3) RShiftLNode(dividend, phase->intcon(N / 2))); 18.47 - Node *u_lo = phase->transform(new (phase->C, 3) AndLNode(dividend, phase->longcon(0xFFFFFFFF))); 18.48 + // u0 = u & 0xFFFFFFFF; u1 = u >> 32; 18.49 + Node* u0 = phase->transform(new (phase->C, 3) AndLNode(dividend, phase->longcon(0xFFFFFFFF))); 18.50 + Node* u1 = phase->transform(new (phase->C, 3) RShiftLNode(dividend, phase->intcon(N / 2))); 18.51 18.52 - Node *v_hi = phase->longcon(magic_const >> N/2); 18.53 - Node *v_lo = phase->longcon(magic_const & 0XFFFFFFFF); 18.54 + // v0 = v & 0xFFFFFFFF; v1 = v >> 32; 18.55 + Node* v0 = phase->longcon(magic_const & 0xFFFFFFFF); 18.56 + Node* v1 = phase->longcon(magic_const >> (N / 2)); 18.57 18.58 - Node *hihi_product = phase->transform(new (phase->C, 3) MulLNode(u_hi, v_hi)); 18.59 - Node *hilo_product = phase->transform(new (phase->C, 3) MulLNode(u_hi, v_lo)); 18.60 - Node *lohi_product = phase->transform(new (phase->C, 3) MulLNode(u_lo, v_hi)); 18.61 - Node *lolo_product = phase->transform(new (phase->C, 3) MulLNode(u_lo, v_lo)); 18.62 + // w0 = u0*v0; 18.63 + Node* w0 = phase->transform(new (phase->C, 3) MulLNode(u0, v0)); 18.64 18.65 - Node *t1 = phase->transform(new (phase->C, 3) URShiftLNode(lolo_product, phase->intcon(N / 2))); 18.66 - Node *t2 = phase->transform(new (phase->C, 3) AddLNode(hilo_product, t1)); 18.67 + // t = u1*v0 + (w0 >> 32); 18.68 + Node* u1v0 = phase->transform(new (phase->C, 3) MulLNode(u1, v0)); 18.69 + Node* temp = phase->transform(new (phase->C, 3) URShiftLNode(w0, phase->intcon(N / 2))); 18.70 + Node* t = phase->transform(new (phase->C, 3) AddLNode(u1v0, temp)); 18.71 18.72 - // Construct both t3 and t4 before transforming so t2 doesn't go dead 18.73 - // prematurely. 18.74 - Node *t3 = new (phase->C, 3) RShiftLNode(t2, phase->intcon(N / 2)); 18.75 - Node *t4 = new (phase->C, 3) AndLNode(t2, phase->longcon(0xFFFFFFFF)); 18.76 - t3 = phase->transform(t3); 18.77 - t4 = phase->transform(t4); 18.78 + // w1 = t & 0xFFFFFFFF; 18.79 + Node* w1 = new (phase->C, 3) AndLNode(t, phase->longcon(0xFFFFFFFF)); 18.80 18.81 - Node *t5 = phase->transform(new (phase->C, 3) AddLNode(t4, lohi_product)); 18.82 - Node *t6 = phase->transform(new (phase->C, 3) RShiftLNode(t5, phase->intcon(N / 2))); 18.83 - Node *t7 = phase->transform(new (phase->C, 3) AddLNode(t3, hihi_product)); 18.84 + // w2 = t >> 32; 18.85 + Node* w2 = new (phase->C, 3) RShiftLNode(t, phase->intcon(N / 2)); 18.86 18.87 - return new (phase->C, 3) AddLNode(t7, t6); 18.88 + // 6732154: Construct both w1 and w2 before transforming, so t 18.89 + // doesn't go dead prematurely. 18.90 + w1 = phase->transform(w1); 18.91 + w2 = phase->transform(w2); 18.92 + 18.93 + // w1 = u0*v1 + w1; 18.94 + Node* u0v1 = phase->transform(new (phase->C, 3) MulLNode(u0, v1)); 18.95 + w1 = phase->transform(new (phase->C, 3) AddLNode(u0v1, w1)); 18.96 + 18.97 + // return u1*v1 + w2 + (w1 >> 32); 18.98 + Node* u1v1 = phase->transform(new (phase->C, 3) MulLNode(u1, v1)); 18.99 + Node* temp1 = phase->transform(new (phase->C, 3) AddLNode(u1v1, w2)); 18.100 + Node* temp2 = phase->transform(new (phase->C, 3) RShiftLNode(w1, phase->intcon(N / 2))); 18.101 + 18.102 + return new (phase->C, 3) AddLNode(temp1, temp2); 18.103 } 18.104 18.105 18.106 @@ -976,7 +1007,7 @@ 18.107 18.108 // Expand mod 18.109 if( con >= 0 && con < max_jlong && is_power_of_2_long(con+1) ) { 18.110 - uint k = log2_long(con); // Extract k 18.111 + uint k = exact_log2_long(con+1); // Extract k 18.112 18.113 // Basic algorithm by David Detlefs. See fastmod_long.java for gory details. 18.114 // Used to help a popular random number generator which does a long-mod
19.1 --- a/src/share/vm/opto/gcm.cpp Sun Feb 15 20:09:02 2009 -0800 19.2 +++ b/src/share/vm/opto/gcm.cpp Sun Feb 22 17:11:56 2009 -0800 19.3 @@ -29,6 +29,9 @@ 19.4 #include "incls/_precompiled.incl" 19.5 #include "incls/_gcm.cpp.incl" 19.6 19.7 +// To avoid float value underflow 19.8 +#define MIN_BLOCK_FREQUENCY 1.e-35f 19.9 + 19.10 //----------------------------schedule_node_into_block------------------------- 19.11 // Insert node n into block b. Look for projections of n and make sure they 19.12 // are in b also. 19.13 @@ -1380,6 +1383,13 @@ 19.14 } 19.15 } 19.16 19.17 +#ifdef ASSERT 19.18 + for (uint i = 0; i < _num_blocks; i++ ) { 19.19 + Block *b = _blocks[i]; 19.20 + assert(b->_freq >= MIN_BLOCK_FREQUENCY, "Register Allocator requiers meaningful block frequency"); 19.21 + } 19.22 +#endif 19.23 + 19.24 #ifndef PRODUCT 19.25 if (PrintCFGBlockFreq) { 19.26 tty->print_cr("CFG Block Frequencies"); 19.27 @@ -1877,7 +1887,9 @@ 19.28 float loop_freq = _freq * trip_count(); 19.29 for (int i = 0; i < _members.length(); i++) { 19.30 CFGElement* s = _members.at(i); 19.31 - s->_freq *= loop_freq; 19.32 + float block_freq = s->_freq * loop_freq; 19.33 + if (block_freq < MIN_BLOCK_FREQUENCY) block_freq = MIN_BLOCK_FREQUENCY; 19.34 + s->_freq = block_freq; 19.35 } 19.36 CFGLoop* ch = _child; 19.37 while (ch != NULL) {
20.1 --- a/src/share/vm/opto/graphKit.cpp Sun Feb 15 20:09:02 2009 -0800 20.2 +++ b/src/share/vm/opto/graphKit.cpp Sun Feb 22 17:11:56 2009 -0800 20.3 @@ -1836,10 +1836,7 @@ 20.4 (CardTableModRefBS*)(Universe::heap()->barrier_set()); 20.5 Node *b = _gvn.transform(new (C, 3) URShiftXNode( cast, _gvn.intcon(CardTableModRefBS::card_shift) )); 20.6 // We store into a byte array, so do not bother to left-shift by zero 20.7 - // Get base of card map 20.8 - assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), 20.9 - "adjust this code"); 20.10 - Node *c = makecon(TypeRawPtr::make((address)ct->byte_map_base)); 20.11 + Node *c = byte_map_base_node(); 20.12 // Combine 20.13 Node *sb_ctl = control(); 20.14 Node *sb_adr = _gvn.transform(new (C, 4) AddPNode( top()/*no base ptr*/, c, b )); 20.15 @@ -2945,16 +2942,10 @@ 20.16 20.17 // Now generate allocation code 20.18 20.19 - // With escape analysis, the entire memory state is needed to be able to 20.20 - // eliminate the allocation. If the allocations cannot be eliminated, this 20.21 - // will be optimized to the raw slice when the allocation is expanded. 20.22 - Node *mem; 20.23 - if (C->do_escape_analysis()) { 20.24 - mem = reset_memory(); 20.25 - set_all_memory(mem); 20.26 - } else { 20.27 - mem = memory(Compile::AliasIdxRaw); 20.28 - } 20.29 + // The entire memory state is needed for slow path of the allocation 20.30 + // since GC and deoptimization can happened. 20.31 + Node *mem = reset_memory(); 20.32 + set_all_memory(mem); // Create new memory state 20.33 20.34 AllocateNode* alloc 20.35 = new (C, AllocateNode::ParmLimit) 20.36 @@ -3091,16 +3082,10 @@ 20.37 20.38 // Now generate allocation code 20.39 20.40 - // With escape analysis, the entire memory state is needed to be able to 20.41 - // eliminate the allocation. If the allocations cannot be eliminated, this 20.42 - // will be optimized to the raw slice when the allocation is expanded. 20.43 - Node *mem; 20.44 - if (C->do_escape_analysis()) { 20.45 - mem = reset_memory(); 20.46 - set_all_memory(mem); 20.47 - } else { 20.48 - mem = memory(Compile::AliasIdxRaw); 20.49 - } 20.50 + // The entire memory state is needed for slow path of the allocation 20.51 + // since GC and deoptimization can happened. 20.52 + Node *mem = reset_memory(); 20.53 + set_all_memory(mem); // Create new memory state 20.54 20.55 // Create the AllocateArrayNode and its result projections 20.56 AllocateArrayNode* alloc 20.57 @@ -3365,14 +3350,6 @@ 20.58 20.59 const TypeFunc *tf = OptoRuntime::g1_wb_post_Type(); 20.60 20.61 - // Get the address of the card table 20.62 - CardTableModRefBS* ct = 20.63 - (CardTableModRefBS*)(Universe::heap()->barrier_set()); 20.64 - Node *card_table = __ makecon(TypeRawPtr::make((address)ct->byte_map_base)); 20.65 - // Get base of card map 20.66 - assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); 20.67 - 20.68 - 20.69 // Offsets into the thread 20.70 const int index_offset = in_bytes(JavaThread::dirty_card_queue_offset() + 20.71 PtrQueue::byte_offset_of_index()); 20.72 @@ -3402,7 +3379,7 @@ 20.73 Node* card_offset = __ URShiftX( cast, __ ConI(CardTableModRefBS::card_shift) ); 20.74 20.75 // Combine card table base and card offset 20.76 - Node *card_adr = __ AddP(no_base, card_table, card_offset ); 20.77 + Node *card_adr = __ AddP(no_base, byte_map_base_node(), card_offset ); 20.78 20.79 // If we know the value being stored does it cross regions? 20.80
21.1 --- a/src/share/vm/opto/graphKit.hpp Sun Feb 15 20:09:02 2009 -0800 21.2 +++ b/src/share/vm/opto/graphKit.hpp Sun Feb 22 17:11:56 2009 -0800 21.3 @@ -83,6 +83,18 @@ 21.4 Node* zerocon(BasicType bt) const { return _gvn.zerocon(bt); } 21.5 // (See also macro MakeConX in type.hpp, which uses intcon or longcon.) 21.6 21.7 + // Helper for byte_map_base 21.8 + Node* byte_map_base_node() { 21.9 + // Get base of card map 21.10 + CardTableModRefBS* ct = (CardTableModRefBS*)(Universe::heap()->barrier_set()); 21.11 + assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust users of this code"); 21.12 + if (ct->byte_map_base != NULL) { 21.13 + return makecon(TypeRawPtr::make((address)ct->byte_map_base)); 21.14 + } else { 21.15 + return null(); 21.16 + } 21.17 + } 21.18 + 21.19 jint find_int_con(Node* n, jint value_if_unknown) { 21.20 return _gvn.find_int_con(n, value_if_unknown); 21.21 }
22.1 --- a/src/share/vm/opto/ifg.cpp Sun Feb 15 20:09:02 2009 -0800 22.2 +++ b/src/share/vm/opto/ifg.cpp Sun Feb 22 17:11:56 2009 -0800 22.3 @@ -471,12 +471,28 @@ 22.4 // for the "collect_gc_info" phase later. 22.5 IndexSet liveout(_live->live(b)); 22.6 uint last_inst = b->end_idx(); 22.7 - // Compute last phi index 22.8 - uint last_phi; 22.9 - for( last_phi = 1; last_phi < last_inst; last_phi++ ) 22.10 - if( !b->_nodes[last_phi]->is_Phi() ) 22.11 + // Compute first nonphi node index 22.12 + uint first_inst; 22.13 + for( first_inst = 1; first_inst < last_inst; first_inst++ ) 22.14 + if( !b->_nodes[first_inst]->is_Phi() ) 22.15 break; 22.16 22.17 + // Spills could be inserted before CreateEx node which should be 22.18 + // first instruction in block after Phis. Move CreateEx up. 22.19 + for( uint insidx = first_inst; insidx < last_inst; insidx++ ) { 22.20 + Node *ex = b->_nodes[insidx]; 22.21 + if( ex->is_SpillCopy() ) continue; 22.22 + if( insidx > first_inst && ex->is_Mach() && 22.23 + ex->as_Mach()->ideal_Opcode() == Op_CreateEx ) { 22.24 + // If the CreateEx isn't above all the MachSpillCopies 22.25 + // then move it to the top. 22.26 + b->_nodes.remove(insidx); 22.27 + b->_nodes.insert(first_inst, ex); 22.28 + } 22.29 + // Stop once a CreateEx or any other node is found 22.30 + break; 22.31 + } 22.32 + 22.33 // Reset block's register pressure values for each ifg construction 22.34 uint pressure[2], hrp_index[2]; 22.35 pressure[0] = pressure[1] = 0; 22.36 @@ -485,7 +501,7 @@ 22.37 // Liveout things are presumed live for the whole block. We accumulate 22.38 // 'area' accordingly. If they get killed in the block, we'll subtract 22.39 // the unused part of the block from the area. 22.40 - int inst_count = last_inst - last_phi; 22.41 + int inst_count = last_inst - first_inst; 22.42 double cost = (inst_count <= 0) ? 0.0 : b->_freq * double(inst_count); 22.43 assert(!(cost < 0.0), "negative spill cost" ); 22.44 IndexSetIterator elements(&liveout);
23.1 --- a/src/share/vm/opto/lcm.cpp Sun Feb 15 20:09:02 2009 -0800 23.2 +++ b/src/share/vm/opto/lcm.cpp Sun Feb 22 17:11:56 2009 -0800 23.3 @@ -107,7 +107,7 @@ 23.4 was_store = false; 23.5 switch( mach->ideal_Opcode() ) { 23.6 case Op_LoadB: 23.7 - case Op_LoadC: 23.8 + case Op_LoadUS: 23.9 case Op_LoadD: 23.10 case Op_LoadF: 23.11 case Op_LoadI:
24.1 --- a/src/share/vm/opto/live.cpp Sun Feb 15 20:09:02 2009 -0800 24.2 +++ b/src/share/vm/opto/live.cpp Sun Feb 22 17:11:56 2009 -0800 24.3 @@ -271,9 +271,9 @@ 24.4 24.5 //------------------------------verify_base_ptrs------------------------------- 24.6 // Verify that base pointers and derived pointers are still sane. 24.7 -// Basically, if a derived pointer is live at a safepoint, then its 24.8 -// base pointer must be live also. 24.9 void PhaseChaitin::verify_base_ptrs( ResourceArea *a ) const { 24.10 +#ifdef ASSERT 24.11 + Unique_Node_List worklist(a); 24.12 for( uint i = 0; i < _cfg._num_blocks; i++ ) { 24.13 Block *b = _cfg._blocks[i]; 24.14 for( uint j = b->end_idx() + 1; j > 1; j-- ) { 24.15 @@ -287,28 +287,81 @@ 24.16 // Now scan for a live derived pointer 24.17 if (jvms->oopoff() < sfpt->req()) { 24.18 // Check each derived/base pair 24.19 - for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx += 2) { 24.20 + for (uint idx = jvms->oopoff(); idx < sfpt->req(); idx++) { 24.21 Node *check = sfpt->in(idx); 24.22 - uint j = 0; 24.23 + bool is_derived = ((idx - jvms->oopoff()) & 1) == 0; 24.24 // search upwards through spills and spill phis for AddP 24.25 - while(true) { 24.26 - if( !check ) break; 24.27 - int idx = check->is_Copy(); 24.28 - if( idx ) { 24.29 - check = check->in(idx); 24.30 - } else if( check->is_Phi() && check->_idx >= _oldphi ) { 24.31 - check = check->in(1); 24.32 - } else 24.33 - break; 24.34 - j++; 24.35 - assert(j < 100000,"Derived pointer checking in infinite loop"); 24.36 + worklist.clear(); 24.37 + worklist.push(check); 24.38 + uint k = 0; 24.39 + while( k < worklist.size() ) { 24.40 + check = worklist.at(k); 24.41 + assert(check,"Bad base or derived pointer"); 24.42 + // See PhaseChaitin::find_base_for_derived() for all cases. 24.43 + int isc = check->is_Copy(); 24.44 + if( isc ) { 24.45 + worklist.push(check->in(isc)); 24.46 + } else if( check->is_Phi() ) { 24.47 + for (uint m = 1; m < check->req(); m++) 24.48 + worklist.push(check->in(m)); 24.49 + } else if( check->is_Con() ) { 24.50 + if (is_derived) { 24.51 + // Derived is NULL+offset 24.52 + assert(!is_derived || check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad derived pointer"); 24.53 + } else { 24.54 + assert(check->bottom_type()->is_ptr()->_offset == 0,"Bad base pointer"); 24.55 + // Base either ConP(NULL) or loadConP 24.56 + if (check->is_Mach()) { 24.57 + assert(check->as_Mach()->ideal_Opcode() == Op_ConP,"Bad base pointer"); 24.58 + } else { 24.59 + assert(check->Opcode() == Op_ConP && 24.60 + check->bottom_type()->is_ptr()->ptr() == TypePtr::Null,"Bad base pointer"); 24.61 + } 24.62 + } 24.63 + } else if( check->bottom_type()->is_ptr()->_offset == 0 ) { 24.64 + if(check->is_Proj() || check->is_Mach() && 24.65 + (check->as_Mach()->ideal_Opcode() == Op_CreateEx || 24.66 + check->as_Mach()->ideal_Opcode() == Op_ThreadLocal || 24.67 + check->as_Mach()->ideal_Opcode() == Op_CMoveP || 24.68 + check->as_Mach()->ideal_Opcode() == Op_CheckCastPP || 24.69 +#ifdef _LP64 24.70 + UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_CastPP || 24.71 + UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_DecodeN || 24.72 +#endif 24.73 + check->as_Mach()->ideal_Opcode() == Op_LoadP || 24.74 + check->as_Mach()->ideal_Opcode() == Op_LoadKlass)) { 24.75 + // Valid nodes 24.76 + } else { 24.77 + check->dump(); 24.78 + assert(false,"Bad base or derived pointer"); 24.79 + } 24.80 + } else { 24.81 + assert(is_derived,"Bad base pointer"); 24.82 + assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer"); 24.83 + } 24.84 + k++; 24.85 + assert(k < 100000,"Derived pointer checking in infinite loop"); 24.86 } // End while 24.87 - assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer") 24.88 } 24.89 } // End of check for derived pointers 24.90 } // End of Kcheck for debug info 24.91 } // End of if found a safepoint 24.92 } // End of forall instructions in block 24.93 } // End of forall blocks 24.94 +#endif 24.95 } 24.96 + 24.97 +//------------------------------verify------------------------------------- 24.98 +// Verify that graphs and base pointers are still sane. 24.99 +void PhaseChaitin::verify( ResourceArea *a, bool verify_ifg ) const { 24.100 +#ifdef ASSERT 24.101 + if( VerifyOpto || VerifyRegisterAllocator ) { 24.102 + _cfg.verify(); 24.103 + verify_base_ptrs(a); 24.104 + if(verify_ifg) 24.105 + _ifg->verify(this); 24.106 + } 24.107 #endif 24.108 +} 24.109 + 24.110 +#endif
25.1 --- a/src/share/vm/opto/loopnode.cpp Sun Feb 15 20:09:02 2009 -0800 25.2 +++ b/src/share/vm/opto/loopnode.cpp Sun Feb 22 17:11:56 2009 -0800 25.3 @@ -2654,7 +2654,7 @@ 25.4 case Op_ModF: 25.5 case Op_ModD: 25.6 case Op_LoadB: // Same with Loads; they can sink 25.7 - case Op_LoadC: // during loop optimizations. 25.8 + case Op_LoadUS: // during loop optimizations. 25.9 case Op_LoadD: 25.10 case Op_LoadF: 25.11 case Op_LoadI:
26.1 --- a/src/share/vm/opto/macro.cpp Sun Feb 15 20:09:02 2009 -0800 26.2 +++ b/src/share/vm/opto/macro.cpp Sun Feb 22 17:11:56 2009 -0800 26.3 @@ -952,13 +952,6 @@ 26.4 Node* klass_node = alloc->in(AllocateNode::KlassNode); 26.5 Node* initial_slow_test = alloc->in(AllocateNode::InitialTest); 26.6 26.7 - // With escape analysis, the entire memory state was needed to be able to 26.8 - // eliminate the allocation. Since the allocations cannot be eliminated, 26.9 - // optimize it to the raw slice. 26.10 - if (mem->is_MergeMem()) { 26.11 - mem = mem->as_MergeMem()->memory_at(Compile::AliasIdxRaw); 26.12 - } 26.13 - 26.14 assert(ctrl != NULL, "must have control"); 26.15 // We need a Region and corresponding Phi's to merge the slow-path and fast-path results. 26.16 // they will not be used if "always_slow" is set 26.17 @@ -1016,6 +1009,11 @@ 26.18 Node *slow_mem = mem; // save the current memory state for slow path 26.19 // generate the fast allocation code unless we know that the initial test will always go slow 26.20 if (!always_slow) { 26.21 + // Fast path modifies only raw memory. 26.22 + if (mem->is_MergeMem()) { 26.23 + mem = mem->as_MergeMem()->memory_at(Compile::AliasIdxRaw); 26.24 + } 26.25 + 26.26 Node* eden_top_adr; 26.27 Node* eden_end_adr; 26.28 26.29 @@ -1239,8 +1237,6 @@ 26.30 } 26.31 } 26.32 26.33 - mem = result_phi_rawmem; 26.34 - 26.35 // An allocate node has separate i_o projections for the uses on the control and i_o paths 26.36 // Replace uses of the control i_o projection with result_phi_i_o (unless we are only generating a slow call) 26.37 if (_ioproj_fallthrough == NULL) {
27.1 --- a/src/share/vm/opto/matcher.cpp Sun Feb 15 20:09:02 2009 -0800 27.2 +++ b/src/share/vm/opto/matcher.cpp Sun Feb 22 17:11:56 2009 -0800 27.3 @@ -1824,7 +1824,7 @@ 27.4 mem_op = true; 27.5 break; 27.6 case Op_LoadB: 27.7 - case Op_LoadC: 27.8 + case Op_LoadUS: 27.9 case Op_LoadD: 27.10 case Op_LoadF: 27.11 case Op_LoadI:
28.1 --- a/src/share/vm/opto/memnode.cpp Sun Feb 15 20:09:02 2009 -0800 28.2 +++ b/src/share/vm/opto/memnode.cpp Sun Feb 22 17:11:56 2009 -0800 28.3 @@ -779,14 +779,14 @@ 28.4 "use LoadRangeNode instead"); 28.5 switch (bt) { 28.6 case T_BOOLEAN: 28.7 - case T_BYTE: return new (C, 3) LoadBNode(ctl, mem, adr, adr_type, rt->is_int() ); 28.8 - case T_INT: return new (C, 3) LoadINode(ctl, mem, adr, adr_type, rt->is_int() ); 28.9 - case T_CHAR: return new (C, 3) LoadCNode(ctl, mem, adr, adr_type, rt->is_int() ); 28.10 - case T_SHORT: return new (C, 3) LoadSNode(ctl, mem, adr, adr_type, rt->is_int() ); 28.11 - case T_LONG: return new (C, 3) LoadLNode(ctl, mem, adr, adr_type, rt->is_long() ); 28.12 - case T_FLOAT: return new (C, 3) LoadFNode(ctl, mem, adr, adr_type, rt ); 28.13 - case T_DOUBLE: return new (C, 3) LoadDNode(ctl, mem, adr, adr_type, rt ); 28.14 - case T_ADDRESS: return new (C, 3) LoadPNode(ctl, mem, adr, adr_type, rt->is_ptr() ); 28.15 + case T_BYTE: return new (C, 3) LoadBNode (ctl, mem, adr, adr_type, rt->is_int() ); 28.16 + case T_INT: return new (C, 3) LoadINode (ctl, mem, adr, adr_type, rt->is_int() ); 28.17 + case T_CHAR: return new (C, 3) LoadUSNode(ctl, mem, adr, adr_type, rt->is_int() ); 28.18 + case T_SHORT: return new (C, 3) LoadSNode (ctl, mem, adr, adr_type, rt->is_int() ); 28.19 + case T_LONG: return new (C, 3) LoadLNode (ctl, mem, adr, adr_type, rt->is_long() ); 28.20 + case T_FLOAT: return new (C, 3) LoadFNode (ctl, mem, adr, adr_type, rt ); 28.21 + case T_DOUBLE: return new (C, 3) LoadDNode (ctl, mem, adr, adr_type, rt ); 28.22 + case T_ADDRESS: return new (C, 3) LoadPNode (ctl, mem, adr, adr_type, rt->is_ptr() ); 28.23 case T_OBJECT: 28.24 #ifdef _LP64 28.25 if (adr->bottom_type()->is_ptr_to_narrowoop()) { 28.26 @@ -1076,13 +1076,14 @@ 28.27 // of the original value. 28.28 Node* mem_phi = in(Memory); 28.29 Node* offset = in(Address)->in(AddPNode::Offset); 28.30 + Node* region = base->in(0); 28.31 28.32 Node* in1 = clone(); 28.33 Node* in1_addr = in1->in(Address)->clone(); 28.34 in1_addr->set_req(AddPNode::Base, base->in(allocation_index)); 28.35 in1_addr->set_req(AddPNode::Address, base->in(allocation_index)); 28.36 in1_addr->set_req(AddPNode::Offset, offset); 28.37 - in1->set_req(0, base->in(allocation_index)); 28.38 + in1->set_req(0, region->in(allocation_index)); 28.39 in1->set_req(Address, in1_addr); 28.40 in1->set_req(Memory, mem_phi->in(allocation_index)); 28.41 28.42 @@ -1091,7 +1092,7 @@ 28.43 in2_addr->set_req(AddPNode::Base, base->in(load_index)); 28.44 in2_addr->set_req(AddPNode::Address, base->in(load_index)); 28.45 in2_addr->set_req(AddPNode::Offset, offset); 28.46 - in2->set_req(0, base->in(load_index)); 28.47 + in2->set_req(0, region->in(load_index)); 28.48 in2->set_req(Address, in2_addr); 28.49 in2->set_req(Memory, mem_phi->in(load_index)); 28.50 28.51 @@ -1100,7 +1101,7 @@ 28.52 in2_addr = phase->transform(in2_addr); 28.53 in2 = phase->transform(in2); 28.54 28.55 - PhiNode* result = PhiNode::make_blank(base->in(0), this); 28.56 + PhiNode* result = PhiNode::make_blank(region, this); 28.57 result->set_req(allocation_index, in1); 28.58 result->set_req(load_index, in2); 28.59 return result; 28.60 @@ -1357,7 +1358,7 @@ 28.61 // Steps (a), (b): Walk past independent stores to find an exact match. 28.62 if (prev_mem != NULL && prev_mem != in(MemNode::Memory)) { 28.63 // (c) See if we can fold up on the spot, but don't fold up here. 28.64 - // Fold-up might require truncation (for LoadB/LoadS/LoadC) or 28.65 + // Fold-up might require truncation (for LoadB/LoadS/LoadUS) or 28.66 // just return a prior value, which is done by Identity calls. 28.67 if (can_see_stored_value(prev_mem, phase)) { 28.68 // Make ready for step (d): 28.69 @@ -1606,14 +1607,14 @@ 28.70 return LoadNode::Ideal(phase, can_reshape); 28.71 } 28.72 28.73 -//--------------------------LoadCNode::Ideal-------------------------------------- 28.74 +//--------------------------LoadUSNode::Ideal------------------------------------- 28.75 // 28.76 // If the previous store is to the same address as this load, 28.77 // and the value stored was larger than a char, replace this load 28.78 // with the value stored truncated to a char. If no truncation is 28.79 // needed, the replacement is done in LoadNode::Identity(). 28.80 // 28.81 -Node *LoadCNode::Ideal(PhaseGVN *phase, bool can_reshape) { 28.82 +Node *LoadUSNode::Ideal(PhaseGVN *phase, bool can_reshape) { 28.83 Node* mem = in(MemNode::Memory); 28.84 Node* value = can_see_stored_value(mem,phase); 28.85 if( value && !phase->type(value)->higher_equal( _type ) )
29.1 --- a/src/share/vm/opto/memnode.hpp Sun Feb 15 20:09:02 2009 -0800 29.2 +++ b/src/share/vm/opto/memnode.hpp Sun Feb 22 17:11:56 2009 -0800 29.3 @@ -207,11 +207,11 @@ 29.4 virtual BasicType memory_type() const { return T_BYTE; } 29.5 }; 29.6 29.7 -//------------------------------LoadCNode-------------------------------------- 29.8 -// Load a char (16bits unsigned) from memory 29.9 -class LoadCNode : public LoadNode { 29.10 +//------------------------------LoadUSNode------------------------------------- 29.11 +// Load an unsigned short/char (16bits unsigned) from memory 29.12 +class LoadUSNode : public LoadNode { 29.13 public: 29.14 - LoadCNode( Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeInt *ti = TypeInt::CHAR ) 29.15 + LoadUSNode( Node *c, Node *mem, Node *adr, const TypePtr* at, const TypeInt *ti = TypeInt::CHAR ) 29.16 : LoadNode(c,mem,adr,at,ti) {} 29.17 virtual int Opcode() const; 29.18 virtual uint ideal_reg() const { return Op_RegI; }
30.1 --- a/src/share/vm/opto/mulnode.cpp Sun Feb 15 20:09:02 2009 -0800 30.2 +++ b/src/share/vm/opto/mulnode.cpp Sun Feb 22 17:11:56 2009 -0800 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 @@ -442,16 +442,17 @@ 30.11 return load; 30.12 } 30.13 uint lop = load->Opcode(); 30.14 - if( lop == Op_LoadC && 30.15 + if( lop == Op_LoadUS && 30.16 con == 0x0000FFFF ) // Already zero-extended 30.17 return load; 30.18 // Masking off the high bits of a unsigned-shift-right is not 30.19 // needed either. 30.20 if( lop == Op_URShiftI ) { 30.21 const TypeInt *t12 = phase->type( load->in(2) )->isa_int(); 30.22 - if( t12 && t12->is_con() ) { 30.23 - int shift_con = t12->get_con(); 30.24 - int mask = max_juint >> shift_con; 30.25 + if( t12 && t12->is_con() ) { // Shift is by a constant 30.26 + int shift = t12->get_con(); 30.27 + shift &= BitsPerJavaInteger - 1; // semantics of Java shifts 30.28 + int mask = max_juint >> shift; 30.29 if( (mask&con) == mask ) // If AND is useless, skip it 30.30 return load; 30.31 } 30.32 @@ -470,19 +471,19 @@ 30.33 uint lop = load->Opcode(); 30.34 30.35 // Masking bits off of a Character? Hi bits are already zero. 30.36 - if( lop == Op_LoadC && 30.37 + if( lop == Op_LoadUS && 30.38 (mask & 0xFFFF0000) ) // Can we make a smaller mask? 30.39 return new (phase->C, 3) AndINode(load,phase->intcon(mask&0xFFFF)); 30.40 30.41 // Masking bits off of a Short? Loading a Character does some masking 30.42 if( lop == Op_LoadS && 30.43 (mask & 0xFFFF0000) == 0 ) { 30.44 - Node *ldc = new (phase->C, 3) LoadCNode(load->in(MemNode::Control), 30.45 + Node *ldus = new (phase->C, 3) LoadUSNode(load->in(MemNode::Control), 30.46 load->in(MemNode::Memory), 30.47 load->in(MemNode::Address), 30.48 load->adr_type()); 30.49 - ldc = phase->transform(ldc); 30.50 - return new (phase->C, 3) AndINode(ldc,phase->intcon(mask&0xFFFF)); 30.51 + ldus = phase->transform(ldus); 30.52 + return new (phase->C, 3) AndINode(ldus, phase->intcon(mask&0xFFFF)); 30.53 } 30.54 30.55 // Masking sign bits off of a Byte? Let the matcher use an unsigned load 30.56 @@ -579,9 +580,10 @@ 30.57 // needed either. 30.58 if( lop == Op_URShiftL ) { 30.59 const TypeInt *t12 = phase->type( usr->in(2) )->isa_int(); 30.60 - if( t12 && t12->is_con() ) { 30.61 - int shift_con = t12->get_con(); 30.62 - jlong mask = max_julong >> shift_con; 30.63 + if( t12 && t12->is_con() ) { // Shift is by a constant 30.64 + int shift = t12->get_con(); 30.65 + shift &= BitsPerJavaLong - 1; // semantics of Java shifts 30.66 + jlong mask = max_julong >> shift; 30.67 if( (mask&con) == mask ) // If AND is useless, skip it 30.68 return usr; 30.69 } 30.70 @@ -605,8 +607,8 @@ 30.71 const TypeInt *t12 = phase->type(rsh->in(2))->isa_int(); 30.72 if( t12 && t12->is_con() ) { // Shift is by a constant 30.73 int shift = t12->get_con(); 30.74 - shift &= (BitsPerJavaInteger*2)-1; // semantics of Java shifts 30.75 - const jlong sign_bits_mask = ~(((jlong)CONST64(1) << (jlong)(BitsPerJavaInteger*2 - shift)) -1); 30.76 + shift &= BitsPerJavaLong - 1; // semantics of Java shifts 30.77 + const jlong sign_bits_mask = ~(((jlong)CONST64(1) << (jlong)(BitsPerJavaLong - shift)) -1); 30.78 // If the AND'ing of the 2 masks has no bits, then only original shifted 30.79 // bits survive. NO sign-extension bits survive the maskings. 30.80 if( (sign_bits_mask & mask) == 0 ) { 30.81 @@ -786,7 +788,7 @@ 30.82 30.83 // Check for ((x & ((CONST64(1)<<(64-c0))-1)) << c0) which ANDs off high bits 30.84 // before shifting them away. 30.85 - const jlong bits_mask = ((jlong)CONST64(1) << (jlong)(BitsPerJavaInteger*2 - con)) - CONST64(1); 30.86 + const jlong bits_mask = ((jlong)CONST64(1) << (jlong)(BitsPerJavaLong - con)) - CONST64(1); 30.87 if( add1_op == Op_AndL && 30.88 phase->type(add1->in(2)) == TypeLong::make( bits_mask ) ) 30.89 return new (phase->C, 3) LShiftLNode( add1->in(1), in(2) ); 30.90 @@ -820,7 +822,7 @@ 30.91 return TypeLong::LONG; 30.92 30.93 uint shift = r2->get_con(); 30.94 - shift &= (BitsPerJavaInteger*2)-1; // semantics of Java shifts 30.95 + shift &= BitsPerJavaLong - 1; // semantics of Java shifts 30.96 // Shift by a multiple of 64 does nothing: 30.97 if (shift == 0) return t1; 30.98 30.99 @@ -913,7 +915,7 @@ 30.100 set_req(2, phase->intcon(0)); 30.101 return this; 30.102 } 30.103 - else if( ld->Opcode() == Op_LoadC ) 30.104 + else if( ld->Opcode() == Op_LoadUS ) 30.105 // Replace zero-extension-load with sign-extension-load 30.106 return new (phase->C, 3) LoadSNode( ld->in(MemNode::Control), 30.107 ld->in(MemNode::Memory), 30.108 @@ -1235,7 +1237,7 @@ 30.109 if ( con == 0 ) return NULL; // let Identity() handle a 0 shift count 30.110 // note: mask computation below does not work for 0 shift count 30.111 // We'll be wanting the right-shift amount as a mask of that many bits 30.112 - const jlong mask = (((jlong)CONST64(1) << (jlong)(BitsPerJavaInteger*2 - con)) -1); 30.113 + const jlong mask = (((jlong)CONST64(1) << (jlong)(BitsPerJavaLong - con)) -1); 30.114 30.115 // Check for ((x << z) + Y) >>> z. Replace with x + con>>>z 30.116 // The idiom for rounding to a power of 2 is "(Q+(2^z-1)) >>> z". 30.117 @@ -1302,7 +1304,7 @@ 30.118 30.119 if (r2->is_con()) { 30.120 uint shift = r2->get_con(); 30.121 - shift &= (2*BitsPerJavaInteger)-1; // semantics of Java shifts 30.122 + shift &= BitsPerJavaLong - 1; // semantics of Java shifts 30.123 // Shift by a multiple of 64 does nothing: 30.124 if (shift == 0) return t1; 30.125 // Calculate reasonably aggressive bounds for the result. 30.126 @@ -1325,7 +1327,7 @@ 30.127 const TypeLong* tl = TypeLong::make(lo, hi, MAX2(r1->_widen,r2->_widen)); 30.128 #ifdef ASSERT 30.129 // Make sure we get the sign-capture idiom correct. 30.130 - if (shift == (2*BitsPerJavaInteger)-1) { 30.131 + if (shift == BitsPerJavaLong - 1) { 30.132 if (r1->_lo >= 0) assert(tl == TypeLong::ZERO, ">>>63 of + is 0"); 30.133 if (r1->_hi < 0) assert(tl == TypeLong::ONE, ">>>63 of - is +1"); 30.134 }
31.1 --- a/src/share/vm/opto/superword.cpp Sun Feb 15 20:09:02 2009 -0800 31.2 +++ b/src/share/vm/opto/superword.cpp Sun Feb 22 17:11:56 2009 -0800 31.3 @@ -1444,7 +1444,7 @@ 31.4 // (Start, end] half-open range defining which operands are vector 31.5 void SuperWord::vector_opd_range(Node* n, uint* start, uint* end) { 31.6 switch (n->Opcode()) { 31.7 - case Op_LoadB: case Op_LoadC: 31.8 + case Op_LoadB: case Op_LoadUS: 31.9 case Op_LoadI: case Op_LoadL: 31.10 case Op_LoadF: case Op_LoadD: 31.11 case Op_LoadP:
32.1 --- a/src/share/vm/opto/type.cpp Sun Feb 15 20:09:02 2009 -0800 32.2 +++ b/src/share/vm/opto/type.cpp Sun Feb 22 17:11:56 2009 -0800 32.3 @@ -2471,6 +2471,8 @@ 32.4 const Type* ft = join(kills); 32.5 const TypeInstPtr* ftip = ft->isa_instptr(); 32.6 const TypeInstPtr* ktip = kills->isa_instptr(); 32.7 + const TypeKlassPtr* ftkp = ft->isa_klassptr(); 32.8 + const TypeKlassPtr* ktkp = kills->isa_klassptr(); 32.9 32.10 if (ft->empty()) { 32.11 // Check for evil case of 'this' being a class and 'kills' expecting an 32.12 @@ -2484,6 +2486,8 @@ 32.13 // uplift the type. 32.14 if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface()) 32.15 return kills; // Uplift to interface 32.16 + if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface()) 32.17 + return kills; // Uplift to interface 32.18 32.19 return Type::TOP; // Canonical empty value 32.20 } 32.21 @@ -2499,6 +2503,12 @@ 32.22 // Happens in a CTW of rt.jar, 320-341, no extra flags 32.23 return ktip->cast_to_ptr_type(ftip->ptr()); 32.24 } 32.25 + if (ftkp != NULL && ktkp != NULL && 32.26 + ftkp->is_loaded() && ftkp->klass()->is_interface() && 32.27 + ktkp->is_loaded() && !ktkp->klass()->is_interface()) { 32.28 + // Happens in a CTW of rt.jar, 320-341, no extra flags 32.29 + return ktkp->cast_to_ptr_type(ftkp->ptr()); 32.30 + } 32.31 32.32 return ft; 32.33 } 32.34 @@ -3657,7 +3667,7 @@ 32.35 32.36 //------------------------------cast_to_ptr_type------------------------------- 32.37 const Type *TypeKlassPtr::cast_to_ptr_type(PTR ptr) const { 32.38 - assert(_base == OopPtr, "subclass must override cast_to_ptr_type"); 32.39 + assert(_base == KlassPtr, "subclass must override cast_to_ptr_type"); 32.40 if( ptr == _ptr ) return this; 32.41 return make(ptr, _klass, _offset); 32.42 }
33.1 --- a/src/share/vm/opto/type.hpp Sun Feb 15 20:09:02 2009 -0800 33.2 +++ b/src/share/vm/opto/type.hpp Sun Feb 22 17:11:56 2009 -0800 33.3 @@ -882,6 +882,8 @@ 33.4 public: 33.5 ciSymbol* name() const { return _klass->name(); } 33.6 33.7 + bool is_loaded() const { return _klass->is_loaded(); } 33.8 + 33.9 // ptr to klass 'k' 33.10 static const TypeKlassPtr *make( ciKlass* k ) { return make( TypePtr::Constant, k, 0); } 33.11 // ptr to klass 'k' with offset
34.1 --- a/src/share/vm/opto/vectornode.cpp Sun Feb 15 20:09:02 2009 -0800 34.2 +++ b/src/share/vm/opto/vectornode.cpp Sun Feb 22 17:11:56 2009 -0800 34.3 @@ -239,7 +239,7 @@ 34.4 return Op_XorV; 34.5 34.6 case Op_LoadB: 34.7 - case Op_LoadC: 34.8 + case Op_LoadUS: 34.9 case Op_LoadS: 34.10 case Op_LoadI: 34.11 case Op_LoadL: 34.12 @@ -269,7 +269,7 @@ 34.13 case 16: return Op_Load16B; 34.14 } 34.15 break; 34.16 - case Op_LoadC: 34.17 + case Op_LoadUS: 34.18 switch (vlen) { 34.19 case 2: return Op_Load2C; 34.20 case 4: return Op_Load4C;
35.1 --- a/src/share/vm/runtime/arguments.cpp Sun Feb 15 20:09:02 2009 -0800 35.2 +++ b/src/share/vm/runtime/arguments.cpp Sun Feb 22 17:11:56 2009 -0800 35.3 @@ -2489,7 +2489,7 @@ 35.4 vm_args.version = JNI_VERSION_1_2; 35.5 vm_args.options = options; 35.6 vm_args.nOptions = i; 35.7 - vm_args.ignoreUnrecognized = false; 35.8 + vm_args.ignoreUnrecognized = IgnoreUnrecognizedVMOptions; 35.9 35.10 if (PrintVMOptions) { 35.11 const char* tail; 35.12 @@ -2536,13 +2536,12 @@ 35.13 35.14 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed. 35.15 bool settings_file_specified = false; 35.16 + const char* flags_file; 35.17 int index; 35.18 for (index = 0; index < args->nOptions; index++) { 35.19 const JavaVMOption *option = args->options + index; 35.20 if (match_option(option, "-XX:Flags=", &tail)) { 35.21 - if (!process_settings_file(tail, true, args->ignoreUnrecognized)) { 35.22 - return JNI_EINVAL; 35.23 - } 35.24 + flags_file = tail; 35.25 settings_file_specified = true; 35.26 } 35.27 if (match_option(option, "-XX:+PrintVMOptions", &tail)) { 35.28 @@ -2551,6 +2550,24 @@ 35.29 if (match_option(option, "-XX:-PrintVMOptions", &tail)) { 35.30 PrintVMOptions = false; 35.31 } 35.32 + if (match_option(option, "-XX:+IgnoreUnrecognizedVMOptions", &tail)) { 35.33 + IgnoreUnrecognizedVMOptions = true; 35.34 + } 35.35 + if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions", &tail)) { 35.36 + IgnoreUnrecognizedVMOptions = false; 35.37 + } 35.38 + } 35.39 + 35.40 + if (IgnoreUnrecognizedVMOptions) { 35.41 + // uncast const to modify the flag args->ignoreUnrecognized 35.42 + *(jboolean*)(&args->ignoreUnrecognized) = true; 35.43 + } 35.44 + 35.45 + // Parse specified settings file 35.46 + if (settings_file_specified) { 35.47 + if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) { 35.48 + return JNI_EINVAL; 35.49 + } 35.50 } 35.51 35.52 // Parse default .hotspotrc settings file
36.1 --- a/src/share/vm/runtime/globals.hpp Sun Feb 15 20:09:02 2009 -0800 36.2 +++ b/src/share/vm/runtime/globals.hpp Sun Feb 22 17:11:56 2009 -0800 36.3 @@ -2194,6 +2194,9 @@ 36.4 product(bool, PrintVMOptions, trueInDebug, \ 36.5 "print VM flag settings") \ 36.6 \ 36.7 + product(bool, IgnoreUnrecognizedVMOptions, false, \ 36.8 + "Ignore unrecognized VM options") \ 36.9 + \ 36.10 diagnostic(bool, SerializeVMOutput, true, \ 36.11 "Use a mutex to serialize output to tty and hotspot.log") \ 36.12 \
37.1 --- a/src/share/vm/utilities/globalDefinitions.hpp Sun Feb 15 20:09:02 2009 -0800 37.2 +++ b/src/share/vm/utilities/globalDefinitions.hpp Sun Feb 22 17:11:56 2009 -0800 37.3 @@ -1,5 +1,5 @@ 37.4 /* 37.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 37.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 37.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 37.8 * 37.9 * This code is free software; you can redistribute it and/or modify it 37.10 @@ -74,6 +74,7 @@ 37.11 extern int BitsPerHeapOop; 37.12 37.13 const int BitsPerJavaInteger = 32; 37.14 +const int BitsPerJavaLong = 64; 37.15 const int BitsPerSize_t = size_tSize * BitsPerByte; 37.16 37.17 // Size of a char[] needed to represent a jint as a string in decimal. 37.18 @@ -906,6 +907,14 @@ 37.19 return log2_intptr(x); 37.20 } 37.21 37.22 +//* the argument must be exactly a power of 2 37.23 +inline int exact_log2_long(jlong x) { 37.24 + #ifdef ASSERT 37.25 + if (!is_power_of_2_long(x)) basic_fatal("x must be a power of 2"); 37.26 + #endif 37.27 + return log2_long(x); 37.28 +} 37.29 + 37.30 37.31 // returns integer round-up to the nearest multiple of s (s must be a power of two) 37.32 inline intptr_t round_to(intptr_t x, uintx s) {
38.1 --- a/test/Makefile Sun Feb 15 20:09:02 2009 -0800 38.2 +++ b/test/Makefile Sun Feb 22 17:11:56 2009 -0800 38.3 @@ -28,9 +28,9 @@ 38.4 38.5 # Get OS/ARCH specifics 38.6 OSNAME = $(shell uname -s) 38.7 -SLASH_JAVA = /java 38.8 ifeq ($(OSNAME), SunOS) 38.9 PLATFORM = solaris 38.10 + SLASH_JAVA = /java 38.11 ARCH = $(shell uname -p) 38.12 ifeq ($(ARCH), i386) 38.13 ARCH=i586 38.14 @@ -38,6 +38,7 @@ 38.15 endif 38.16 ifeq ($(OSNAME), Linux) 38.17 PLATFORM = linux 38.18 + SLASH_JAVA = /java 38.19 ARCH = $(shell uname -m) 38.20 ifeq ($(ARCH), i386) 38.21 ARCH = i586 38.22 @@ -62,6 +63,10 @@ 38.23 EXESUFFIX = .exe 38.24 endif 38.25 38.26 +ifdef ALT_SLASH_JAVA 38.27 + SLASH_JAVA = $(ALT_SLASH_JAVA) 38.28 +endif 38.29 + 38.30 # Utilities used 38.31 CD = cd 38.32 CP = cp
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 39.2 +++ b/test/compiler/6603011/Test.java Sun Feb 22 17:11:56 2009 -0800 39.3 @@ -0,0 +1,220 @@ 39.4 +/* 39.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 39.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 39.7 + * 39.8 + * This code is free software; you can redistribute it and/or modify it 39.9 + * under the terms of the GNU General Public License version 2 only, as 39.10 + * published by the Free Software Foundation. 39.11 + * 39.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 39.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 39.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 39.15 + * version 2 for more details (a copy is included in the LICENSE file that 39.16 + * accompanied this code). 39.17 + * 39.18 + * You should have received a copy of the GNU General Public License version 39.19 + * 2 along with this work; if not, write to the Free Software Foundation, 39.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 39.21 + * 39.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 39.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 39.24 + * have any questions. 39.25 + */ 39.26 + 39.27 +/** 39.28 + * @test 39.29 + * @bug 6603011 39.30 + * @summary long/int division by constant 39.31 + * 39.32 + * @run main/othervm -Xcomp -Xbatch -XX:-Inline Test 39.33 + */ 39.34 + 39.35 +// 39.36 +// -XX:-Inline is essential to this test so that verification functions 39.37 +// divi, modi, divl and modl generate "plain" divides. 39.38 +// -Xcomp -Xbatch are also useful to ensure the full range of 39.39 +// dividend and divisor combinations are tested 39.40 +// 39.41 + 39.42 +import java.net.*; 39.43 + 39.44 +class s { 39.45 + static int divi(int dividend, int divisor) { return dividend / divisor; } 39.46 + static int modi(int dividend, int divisor) { return dividend % divisor; } 39.47 + static long divl(long dividend, long divisor) { return dividend / divisor; } 39.48 + static long modl(long dividend, long divisor) { return dividend % divisor; } 39.49 +} 39.50 + 39.51 +public class Test implements Runnable { 39.52 + // Report verbose messages on failure; turn off to suppress 39.53 + // too much output with gross numbers of failures. 39.54 + static final boolean VERBOSE = true; 39.55 + 39.56 + // Initailize DIVISOR so that it is final in this class. 39.57 + static final int DIVISOR; 39.58 + static { 39.59 + int value = 0; 39.60 + try { 39.61 + value = Integer.decode(System.getProperty("divisor")); 39.62 + } catch (Throwable e) { 39.63 + } 39.64 + DIVISOR = value; 39.65 + } 39.66 + 39.67 + // The methods of interest. We want the JIT to compile these 39.68 + // and convert the divide into a multiply. 39.69 + public int divbyI (int dividend) { return dividend / DIVISOR; } 39.70 + public int modbyI (int dividend) { return dividend % DIVISOR; } 39.71 + public long divbyL (long dividend) { return dividend / DIVISOR; } 39.72 + public long modbyL (long dividend) { return dividend % DIVISOR; } 39.73 + 39.74 + public int divisor() { return DIVISOR; } 39.75 + 39.76 + public boolean checkI (int dividend) { 39.77 + int quo = divbyI(dividend); 39.78 + int rem = modbyI(dividend); 39.79 + int quo0 = s.divi(dividend, divisor()); 39.80 + int rem0 = s.modi(dividend, divisor()); 39.81 + 39.82 + if (quo != quo0 || rem != rem0) { 39.83 + if (VERBOSE) { 39.84 + System.out.println("Computed: " + dividend + " / " + divisor() + " = " + 39.85 + quo + ", " + dividend + " % " + divisor() + " = " + rem ); 39.86 + System.out.println("expected: " + dividend + " / " + divisor() + " = " + 39.87 + quo0 + ", " + dividend + " % " + divisor() + " = " + rem0); 39.88 + // Report sign of rem failure 39.89 + if (rem != 0 && (rem ^ dividend) < 0) { 39.90 + System.out.println(" rem & dividend have different signs"); 39.91 + } 39.92 + // Report range of rem failure 39.93 + if (java.lang.Math.abs(rem) >= java.lang.Math.abs(divisor())) { 39.94 + System.out.println(" remainder out of range"); 39.95 + } 39.96 + // Report quo/rem identity relationship failure 39.97 + if ((quo * divisor()) + rem != dividend) { 39.98 + System.out.println(" quotien/remainder invariant broken"); 39.99 + } 39.100 + } 39.101 + return false; 39.102 + } 39.103 + return true; 39.104 + } 39.105 + 39.106 + public boolean checkL (long dividend) { 39.107 + long quo = divbyL(dividend); 39.108 + long rem = modbyL(dividend); 39.109 + long quo0 = s.divl(dividend, divisor()); 39.110 + long rem0 = s.modl(dividend, divisor()); 39.111 + 39.112 + if (quo != quo0 || rem != rem0) { 39.113 + if (VERBOSE) { 39.114 + System.out.println(" " + dividend + " / " + divisor() + " = " + 39.115 + quo + ", " + dividend + " % " + divisor() + " = " + rem); 39.116 + // Report sign of rem failure 39.117 + if (rem != 0 && (rem ^ dividend) < 0) { 39.118 + System.out.println(" rem & dividend have different signs"); 39.119 + } 39.120 + // Report range of rem failure 39.121 + if (java.lang.Math.abs(rem) >= java.lang.Math.abs(divisor())) { 39.122 + System.out.println(" remainder out of range"); 39.123 + } 39.124 + // Report quo/rem identity relationship failure 39.125 + if ((quo * divisor()) + rem != dividend) { 39.126 + System.out.println(" (" + quo + " * " + divisor() + ") + " + rem + " != " 39.127 + + dividend); 39.128 + } 39.129 + } 39.130 + return false; 39.131 + } 39.132 + return true; 39.133 + } 39.134 + 39.135 + public void run() { 39.136 + // Don't try to divide by zero 39.137 + if (divisor() == 0) return; 39.138 + 39.139 + // Range of dividends to check. Try dividends from start to end 39.140 + // inclusive, as well as variations on those values as shifted 39.141 + // left. 39.142 + int start = -1024; 39.143 + int end = 1024; 39.144 + 39.145 + // Test int division using a variety of dividends. 39.146 + int wrong = 0; 39.147 + int total = 0; 39.148 + 39.149 + outerloop: 39.150 + for (int i = start; i <= end; i++) { 39.151 + for (int s = 0; s < 32; s += 4) { 39.152 + total++; 39.153 + int dividend = i << s; 39.154 + if (!checkI(dividend)) { 39.155 + wrong++; 39.156 + // Stop on the first failure 39.157 + // break outerloop; 39.158 + } 39.159 + } 39.160 + } 39.161 + if (wrong > 0) { 39.162 + System.out.println("divisor " + divisor() + ": " + 39.163 + wrong + "/" + total + " wrong int divisions"); 39.164 + } 39.165 + 39.166 + // Test long division using a variety of dividends. 39.167 + wrong = 0; 39.168 + total = 0; 39.169 + 39.170 + outerloop: 39.171 + for (int i = start; i <= end; i++) { 39.172 + for (int s = 0; s < 64; s += 4) { 39.173 + total++; 39.174 + long dividend = i << s; 39.175 + if (!checkL(dividend)) { 39.176 + wrong++; 39.177 + // Stop on the first failure 39.178 + // break outerloop; 39.179 + } 39.180 + } 39.181 + } 39.182 + if (wrong > 0) { 39.183 + System.out.println("divisor " + divisor() + ": " + 39.184 + wrong + "/" + total + " wrong long divisions"); 39.185 + } 39.186 + 39.187 + } 39.188 + 39.189 + // Reload this class with the "divisor" property set to the input parameter. 39.190 + // This allows the JIT to see q.DIVISOR as a final constant, and change 39.191 + // any divisions or mod operations into multiplies. 39.192 + public static void test_divisor(int divisor, 39.193 + URLClassLoader apploader) throws Exception { 39.194 + System.setProperty("divisor", "" + divisor); 39.195 + ClassLoader loader = new URLClassLoader(apploader.getURLs(), 39.196 + apploader.getParent()); 39.197 + Class c = loader.loadClass("Test"); 39.198 + Runnable r = (Runnable)c.newInstance(); 39.199 + r.run(); 39.200 + } 39.201 + 39.202 + public static void main(String[] args) throws Exception { 39.203 + Class cl = Class.forName("Test"); 39.204 + URLClassLoader apploader = (URLClassLoader)cl.getClassLoader(); 39.205 + 39.206 + 39.207 + // Test every divisor between -100 and 100. 39.208 + for (int i = -100; i <= 100; i++) { 39.209 + test_divisor(i, apploader); 39.210 + } 39.211 + 39.212 + // Try a few divisors outside the typical range. 39.213 + // The values below have been observed in rt.jar. 39.214 + test_divisor(101, apploader); 39.215 + test_divisor(400, apploader); 39.216 + test_divisor(1000, apploader); 39.217 + test_divisor(3600, apploader); 39.218 + test_divisor(9973, apploader); 39.219 + test_divisor(86400, apploader); 39.220 + test_divisor(1000000, apploader); 39.221 + } 39.222 + 39.223 +}
40.1 --- a/test/compiler/6775880/Test.java Sun Feb 15 20:09:02 2009 -0800 40.2 +++ b/test/compiler/6775880/Test.java Sun Feb 22 17:11:56 2009 -0800 40.3 @@ -27,7 +27,7 @@ 40.4 * @bug 6775880 40.5 * @summary EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now") 40.6 * @compile -source 1.4 -target 1.4 Test.java 40.7 - * @run main/othervm -server -Xbatch -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append Test 40.8 + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append Test 40.9 */ 40.10 40.11 public class Test {
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 41.2 +++ b/test/compiler/6795161/Test.java Sun Feb 22 17:11:56 2009 -0800 41.3 @@ -0,0 +1,60 @@ 41.4 +/* 41.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 41.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41.7 + * 41.8 + * This code is free software; you can redistribute it and/or modify it 41.9 + * under the terms of the GNU General Public License version 2 only, as 41.10 + * published by the Free Software Foundation. 41.11 + * 41.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 41.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 41.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 41.15 + * version 2 for more details (a copy is included in the LICENSE file that 41.16 + * accompanied this code). 41.17 + * 41.18 + * You should have received a copy of the GNU General Public License version 41.19 + * 2 along with this work; if not, write to the Free Software Foundation, 41.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 41.21 + * 41.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 41.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 41.24 + * have any questions. 41.25 + * 41.26 + */ 41.27 + 41.28 +/* 41.29 + * @test 41.30 + * @bug 6795161 41.31 + * @summary Escape analysis leads to data corruption 41.32 + * @run main/othervm -server -Xcomp -XX:CompileOnly=Test -XX:+DoEscapeAnalysis Test 41.33 + */ 41.34 + 41.35 +class Test_Class_1 { 41.36 + static String var_1; 41.37 + 41.38 + static void badFunc(int size) 41.39 + { 41.40 + try { 41.41 + for (int i = 0; i < 1; (new byte[size-i])[0] = 0, i++) {} 41.42 + } catch (Exception e) { 41.43 + // don't comment it out, it will lead to correct results ;) 41.44 + //System.out.println("Got exception: " + e); 41.45 + } 41.46 + } 41.47 +} 41.48 + 41.49 +public class Test { 41.50 + static String var_1_copy = Test_Class_1.var_1; 41.51 + 41.52 + static byte var_check; 41.53 + 41.54 + public static void main(String[] args) 41.55 + { 41.56 + var_check = 1; 41.57 + 41.58 + Test_Class_1.badFunc(-1); 41.59 + 41.60 + System.out.println("EATester.var_check = " + Test.var_check + " (expected 1)\n"); 41.61 + } 41.62 +} 41.63 +
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 42.2 +++ b/test/compiler/6795362/Test6795362.java Sun Feb 22 17:11:56 2009 -0800 42.3 @@ -0,0 +1,48 @@ 42.4 +/* 42.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 42.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 42.7 + * 42.8 + * This code is free software; you can redistribute it and/or modify it 42.9 + * under the terms of the GNU General Public License version 2 only, as 42.10 + * published by the Free Software Foundation. 42.11 + * 42.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 42.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 42.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 42.15 + * version 2 for more details (a copy is included in the LICENSE file that 42.16 + * accompanied this code). 42.17 + * 42.18 + * You should have received a copy of the GNU General Public License version 42.19 + * 2 along with this work; if not, write to the Free Software Foundation, 42.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 42.21 + * 42.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 42.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 42.24 + * have any questions. 42.25 + */ 42.26 + 42.27 +/** 42.28 + * @test 42.29 + * @bug 6795362 42.30 + * @summary 32bit server compiler leads to wrong results on solaris-x86 42.31 + * 42.32 + * @run main/othervm -Xcomp -XX:CompileOnly=Test6795362.sub Test6795362 42.33 + */ 42.34 + 42.35 +public class Test6795362 { 42.36 + public static void main(String[] args) 42.37 + { 42.38 + sub(); 42.39 + 42.40 + if (var_bad != 0) 42.41 + throw new InternalError(var_bad + " != 0"); 42.42 + } 42.43 + 42.44 + static long var_bad = -1L; 42.45 + 42.46 + static void sub() 42.47 + { 42.48 + var_bad >>= 65; 42.49 + var_bad /= 65; 42.50 + } 42.51 +}
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 43.2 +++ b/test/compiler/6799693/Test.java Sun Feb 22 17:11:56 2009 -0800 43.3 @@ -0,0 +1,47 @@ 43.4 +/* 43.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 43.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 43.7 + * 43.8 + * This code is free software; you can redistribute it and/or modify it 43.9 + * under the terms of the GNU General Public License version 2 only, as 43.10 + * published by the Free Software Foundation. 43.11 + * 43.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 43.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 43.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 43.15 + * version 2 for more details (a copy is included in the LICENSE file that 43.16 + * accompanied this code). 43.17 + * 43.18 + * You should have received a copy of the GNU General Public License version 43.19 + * 2 along with this work; if not, write to the Free Software Foundation, 43.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 43.21 + * 43.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 43.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 43.24 + * have any questions. 43.25 + * 43.26 + */ 43.27 + 43.28 +/* 43.29 + * @test 43.30 + * @bug 6799693 43.31 + * @summary Server compiler leads to data corruption when expression throws an Exception 43.32 + * @run main/othervm -Xcomp -XX:CompileOnly=Test Test 43.33 + */ 43.34 + 43.35 +public class Test { 43.36 + static int var_bad = 1; 43.37 + 43.38 + public static void main(String[] args) 43.39 + { 43.40 + var_bad++; 43.41 + 43.42 + try { 43.43 + for (int i = 0; i < 10; i++) (new byte[((byte)-1 << i)])[0] = 0; 43.44 + } 43.45 + catch (Exception e) { System.out.println("Got " + e); } 43.46 + 43.47 + System.out.println("Test.var_bad = " + var_bad + " (expected 2)\n"); 43.48 + } 43.49 +} 43.50 +
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 44.2 +++ b/test/compiler/6800154/Test6800154.java Sun Feb 22 17:11:56 2009 -0800 44.3 @@ -0,0 +1,109 @@ 44.4 +/* 44.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 44.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 44.7 + * 44.8 + * This code is free software; you can redistribute it and/or modify it 44.9 + * under the terms of the GNU General Public License version 2 only, as 44.10 + * published by the Free Software Foundation. 44.11 + * 44.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 44.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 44.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 44.15 + * version 2 for more details (a copy is included in the LICENSE file that 44.16 + * accompanied this code). 44.17 + * 44.18 + * You should have received a copy of the GNU General Public License version 44.19 + * 2 along with this work; if not, write to the Free Software Foundation, 44.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 44.21 + * 44.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 44.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 44.24 + * have any questions. 44.25 + */ 44.26 + 44.27 +/** 44.28 + * @test 44.29 + * @bug 6800154 44.30 + * @summary Add comments to long_by_long_mulhi() for better understandability 44.31 + * 44.32 + * @run main/othervm -Xcomp -XX:CompileOnly=Test6800154.divcomp Test6800154 44.33 + */ 44.34 + 44.35 +import java.net.URLClassLoader; 44.36 + 44.37 +public class Test6800154 implements Runnable { 44.38 + static final long[] DIVIDENDS = { 44.39 + 0, 44.40 + 1, 44.41 + 2, 44.42 + 1423487, 44.43 + 4444441, 44.44 + 4918923241323L, 44.45 + -1, 44.46 + -24351, 44.47 + 0x3333, 44.48 + 0x0000000080000000L, 44.49 + 0x7fffffffffffffffL, 44.50 + 0x8000000000000000L 44.51 + }; 44.52 + 44.53 + static final long[] DIVISORS = { 44.54 + 1, 44.55 + 2, 44.56 + 17, 44.57 + 12342, 44.58 + 24123, 44.59 + 143444, 44.60 + 123444442344L, 44.61 + -1, 44.62 + -2, 44.63 + -4423423234231423L, 44.64 + 0x0000000080000000L, 44.65 + 0x7fffffffffffffffL, 44.66 + 0x8000000000000000L 44.67 + }; 44.68 + 44.69 + // Initialize DIVISOR so that it is final in this class. 44.70 + static final long DIVISOR; 44.71 + 44.72 + static { 44.73 + long value = 0; 44.74 + try { 44.75 + value = Long.decode(System.getProperty("divisor")); 44.76 + } catch (Throwable e) { 44.77 + } 44.78 + DIVISOR = value; 44.79 + } 44.80 + 44.81 + public static void main(String[] args) throws Exception 44.82 + { 44.83 + Class cl = Class.forName("Test6800154"); 44.84 + URLClassLoader apploader = (URLClassLoader) cl.getClassLoader(); 44.85 + 44.86 + // Iterate over all divisors. 44.87 + for (int i = 0; i < DIVISORS.length; i++) { 44.88 + System.setProperty("divisor", "" + DIVISORS[i]); 44.89 + ClassLoader loader = new URLClassLoader(apploader.getURLs(), apploader.getParent()); 44.90 + Class c = loader.loadClass("Test6800154"); 44.91 + Runnable r = (Runnable) c.newInstance(); 44.92 + r.run(); 44.93 + } 44.94 + } 44.95 + 44.96 + public void run() 44.97 + { 44.98 + // Iterate over all dividends. 44.99 + for (int i = 0; i < DIVIDENDS.length; i++) { 44.100 + long dividend = DIVIDENDS[i]; 44.101 + 44.102 + long expected = divint(dividend); 44.103 + long result = divcomp(dividend); 44.104 + 44.105 + if (result != expected) 44.106 + throw new InternalError(dividend + " / " + DIVISOR + " failed: " + result + " != " + expected); 44.107 + } 44.108 + } 44.109 + 44.110 + static long divint(long a) { return a / DIVISOR; } 44.111 + static long divcomp(long a) { return a / DIVISOR; } 44.112 +}
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 45.2 +++ b/test/compiler/6805724/Test6805724.java Sun Feb 22 17:11:56 2009 -0800 45.3 @@ -0,0 +1,80 @@ 45.4 +/* 45.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 45.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 45.7 + * 45.8 + * This code is free software; you can redistribute it and/or modify it 45.9 + * under the terms of the GNU General Public License version 2 only, as 45.10 + * published by the Free Software Foundation. 45.11 + * 45.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 45.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 45.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 45.15 + * version 2 for more details (a copy is included in the LICENSE file that 45.16 + * accompanied this code). 45.17 + * 45.18 + * You should have received a copy of the GNU General Public License version 45.19 + * 2 along with this work; if not, write to the Free Software Foundation, 45.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 45.21 + * 45.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 45.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 45.24 + * have any questions. 45.25 + */ 45.26 + 45.27 +/** 45.28 + * @test 45.29 + * @bug 6805724 45.30 + * @summary ModLNode::Ideal() generates functionally incorrect graph when divisor is any (2^k-1) constant. 45.31 + * 45.32 + * @run main/othervm -Xcomp -XX:CompileOnly=Test6805724.fcomp Test6805724 45.33 + */ 45.34 + 45.35 +import java.net.URLClassLoader; 45.36 + 45.37 +public class Test6805724 implements Runnable { 45.38 + // Initialize DIVISOR so that it is final in this class. 45.39 + static final long DIVISOR; // 2^k-1 constant 45.40 + 45.41 + static { 45.42 + long value = 0; 45.43 + try { 45.44 + value = Long.decode(System.getProperty("divisor")); 45.45 + } catch (Throwable t) { 45.46 + // This one is required for the Class.forName() in main. 45.47 + } 45.48 + DIVISOR = value; 45.49 + } 45.50 + 45.51 + static long fint(long x) { 45.52 + return x % DIVISOR; 45.53 + } 45.54 + 45.55 + static long fcomp(long x) { 45.56 + return x % DIVISOR; 45.57 + } 45.58 + 45.59 + public void run() { 45.60 + long a = 0x617981E1L; 45.61 + 45.62 + long expected = fint(a); 45.63 + long result = fcomp(a); 45.64 + 45.65 + if (result != expected) 45.66 + throw new InternalError(result + " != " + expected); 45.67 + } 45.68 + 45.69 + public static void main(String args[]) throws Exception { 45.70 + Class cl = Class.forName("Test6805724"); 45.71 + URLClassLoader apploader = (URLClassLoader) cl.getClassLoader(); 45.72 + 45.73 + // Iterate over all 2^k-1 divisors. 45.74 + for (int k = 1; k < Long.SIZE; k++) { 45.75 + long divisor = (1L << k) - 1; 45.76 + System.setProperty("divisor", "" + divisor); 45.77 + ClassLoader loader = new URLClassLoader(apploader.getURLs(), apploader.getParent()); 45.78 + Class c = loader.loadClass("Test6805724"); 45.79 + Runnable r = (Runnable) c.newInstance(); 45.80 + r.run(); 45.81 + } 45.82 + } 45.83 +}