Thu, 12 May 2011 15:05:22 -0700
Merge
src/share/vm/runtime/globals.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/.hgtags Wed May 11 15:47:12 2011 -0700 1.2 +++ b/.hgtags Thu May 12 15:05:22 2011 -0700 1.3 @@ -166,3 +166,7 @@ 1.4 0930dc920c185afbf40fed9a655290b8e5b16783 hs21-b08 1.5 611e19a16519d6fb5deea9ab565336e6e6ee475d jdk7-b139 1.6 611e19a16519d6fb5deea9ab565336e6e6ee475d hs21-b09 1.7 +d283b82966712b353fa307845a1316da42a355f4 jdk7-b140 1.8 +d283b82966712b353fa307845a1316da42a355f4 hs21-b10 1.9 +5d07913abd59261c77f24cc04a759cb75d804099 jdk7-b141 1.10 +3aea9e9feb073f5500e031be6186666bcae89aa2 hs21-b11
2.1 --- a/agent/make/Makefile Wed May 11 15:47:12 2011 -0700 2.2 +++ b/agent/make/Makefile Thu May 12 15:05:22 2011 -0700 2.3 @@ -257,7 +257,7 @@ 2.4 all: filelist 2.5 @mkdir -p $(OUTPUT_DIR) 2.6 @echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) 2.7 - $(JAVAC) -source 1.4 -classpath $(CLASSPATH) -deprecation -sourcepath $(SRC_DIR) -g -d $(OUTPUT_DIR) @filelist 2.8 + $(JAVAC) -classpath $(CLASSPATH) -deprecation -sourcepath $(SRC_DIR) -g -d $(OUTPUT_DIR) @filelist 2.9 $(RMIC) -classpath $(OUTPUT_DIR) -d $(OUTPUT_DIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer 2.10 rm -f $(OUTPUT_DIR)/sun/jvm/hotspot/utilities/soql/sa.js 2.11 cp $(SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(OUTPUT_DIR)/sun/jvm/hotspot/utilities/soql 2.12 @@ -269,7 +269,7 @@ 2.13 allprof: filelist 2.14 @mkdir -p $(OUTPUT_DIR) 2.15 @echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) 2.16 - $(JAVAC) -source 1.4 -J-Xprof -classpath $(CLASSPATH) -deprecation -sourcepath $(SRC_DIR) -g -d $(OUTPUT_DIR) @filelist 2.17 + $(JAVAC) -J-Xprof -classpath $(CLASSPATH) -deprecation -sourcepath $(SRC_DIR) -g -d $(OUTPUT_DIR) @filelist 2.18 $(RMIC) -classpath $(OUTPUT_DIR) -d $(OUTPUT_DIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer 2.19 rm -f $(OUTPUT_DIR)/sun/jvm/hotspot/utilities/soql/sa.js 2.20 cp $(SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(OUTPUT_DIR)/sun/jvm/hotspot/utilities/soql
3.1 --- a/make/altsrc.make Wed May 11 15:47:12 2011 -0700 3.2 +++ b/make/altsrc.make Thu May 12 15:05:22 2011 -0700 3.3 @@ -24,7 +24,8 @@ 3.4 3.5 # This file defines variables and macros which are used in the makefiles to 3.6 # allow distributions to augment or replace common hotspot code with 3.7 -# distribution-specific source files. 3.8 +# distribution-specific source files. This capability is disabled when 3.9 +# an OPENJDK build is requested, unless HS_ALT_SRC_REL has been set externally. 3.10 3.11 # Requires: GAMMADIR 3.12 # Provides: 3.13 @@ -33,14 +34,17 @@ 3.14 3.15 HS_COMMON_SRC_REL=src 3.16 3.17 -# This needs to be changed to a more generic location, but we keep it as this 3.18 -# for now for compatibility 3.19 -HS_ALT_SRC_REL=src/closed 3.20 +ifneq ($(OPENJDK),true) 3.21 + # This needs to be changed to a more generic location, but we keep it 3.22 + # as this for now for compatibility 3.23 + HS_ALT_SRC_REL=src/closed 3.24 +else 3.25 + HS_ALT_SRC_REL=NO_SUCH_PATH 3.26 +endif 3.27 3.28 HS_COMMON_SRC=$(GAMMADIR)/$(HS_COMMON_SRC_REL) 3.29 HS_ALT_SRC=$(GAMMADIR)/$(HS_ALT_SRC_REL) 3.30 3.31 - 3.32 ## altsrc-equiv 3.33 # 3.34 # Convert a common source path to an alternative source path
4.1 --- a/make/hotspot_version Wed May 11 15:47:12 2011 -0700 4.2 +++ b/make/hotspot_version Thu May 12 15:05:22 2011 -0700 4.3 @@ -35,7 +35,7 @@ 4.4 4.5 HS_MAJOR_VER=21 4.6 HS_MINOR_VER=0 4.7 -HS_BUILD_NUMBER=11 4.8 +HS_BUILD_NUMBER=12 4.9 4.10 JDK_MAJOR_VER=1 4.11 JDK_MINOR_VER=7
5.1 --- a/src/cpu/sparc/vm/frame_sparc.cpp Wed May 11 15:47:12 2011 -0700 5.2 +++ b/src/cpu/sparc/vm/frame_sparc.cpp Thu May 12 15:05:22 2011 -0700 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -806,3 +806,34 @@ 5.11 int index = (Interpreter::expr_offset_in_bytes(offset)/wordSize) - 1; 5.12 return &interpreter_frame_tos_address()[index]; 5.13 } 5.14 + 5.15 + 5.16 +#ifdef ASSERT 5.17 + 5.18 +#define DESCRIBE_FP_OFFSET(name) \ 5.19 + values.describe(-1, fp() + frame::name##_offset, #name) 5.20 + 5.21 +void frame::describe_pd(FrameValues& values, int frame_no) { 5.22 + for (int w = 0; w < frame::register_save_words; w++) { 5.23 + values.describe(frame_no, sp() + w, err_msg("register save area word %d", w), 1); 5.24 + } 5.25 + 5.26 + if (is_interpreted_frame()) { 5.27 + DESCRIBE_FP_OFFSET(interpreter_frame_d_scratch_fp); 5.28 + DESCRIBE_FP_OFFSET(interpreter_frame_l_scratch_fp); 5.29 + DESCRIBE_FP_OFFSET(interpreter_frame_padding); 5.30 + DESCRIBE_FP_OFFSET(interpreter_frame_oop_temp); 5.31 + } 5.32 + 5.33 + if (!is_compiled_frame()) { 5.34 + if (frame::callee_aggregate_return_pointer_words != 0) { 5.35 + values.describe(frame_no, sp() + frame::callee_aggregate_return_pointer_sp_offset, "callee_aggregate_return_pointer_word"); 5.36 + } 5.37 + for (int w = 0; w < frame::callee_register_argument_save_area_words; w++) { 5.38 + values.describe(frame_no, sp() + frame::callee_register_argument_save_area_sp_offset + w, 5.39 + err_msg("callee_register_argument_save_area_words %d", w)); 5.40 + } 5.41 + } 5.42 +} 5.43 + 5.44 +#endif
6.1 --- a/src/cpu/sparc/vm/methodHandles_sparc.cpp Wed May 11 15:47:12 2011 -0700 6.2 +++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp Thu May 12 15:05:22 2011 -0700 6.3 @@ -350,8 +350,9 @@ 6.4 #ifndef PRODUCT 6.5 extern "C" void print_method_handle(oop mh); 6.6 void trace_method_handle_stub(const char* adaptername, 6.7 - oopDesc* mh) { 6.8 - printf("MH %s mh="INTPTR_FORMAT"\n", adaptername, (intptr_t) mh); 6.9 + oopDesc* mh, 6.10 + intptr_t* saved_sp) { 6.11 + tty->print_cr("MH %s mh="INTPTR_FORMAT " saved_sp=" INTPTR_FORMAT, adaptername, (intptr_t) mh, saved_sp); 6.12 print_method_handle(mh); 6.13 } 6.14 void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) { 6.15 @@ -361,6 +362,7 @@ 6.16 __ save_frame(16); 6.17 __ set((intptr_t) adaptername, O0); 6.18 __ mov(G3_method_handle, O1); 6.19 + __ mov(I5_savedSP, O2); 6.20 __ mov(G3_method_handle, L3); 6.21 __ mov(Gargs, L4); 6.22 __ mov(G5_method_type, L5); 6.23 @@ -643,9 +645,10 @@ 6.24 6.25 // Live at this point: 6.26 // - G5_klass : klass required by the target method 6.27 + // - O0_argslot : argslot index in vmarg; may be required in the failing path 6.28 // - O1_scratch : argument klass to test 6.29 // - G3_method_handle: adapter method handle 6.30 - __ check_klass_subtype(O1_scratch, G5_klass, O0_argslot, O2_scratch, done); 6.31 + __ check_klass_subtype(O1_scratch, G5_klass, O2_scratch, O3_scratch, done); 6.32 6.33 // If we get here, the type check failed! 6.34 __ load_heap_oop(G3_amh_argument, O2_required); // required class
7.1 --- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Wed May 11 15:47:12 2011 -0700 7.2 +++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Thu May 12 15:05:22 2011 -0700 7.3 @@ -1698,35 +1698,21 @@ 7.4 popframe_extra_args; 7.5 7.6 int local_words = method->max_locals() * Interpreter::stackElementWords; 7.7 - int parm_words = method->size_of_parameters() * Interpreter::stackElementWords; 7.8 - NEEDS_CLEANUP; 7.9 intptr_t* locals; 7.10 - if (caller->is_interpreted_frame()) { 7.11 - // Can force the locals area to end up properly overlapping the top of the expression stack. 7.12 - intptr_t* Lesp_ptr = caller->interpreter_frame_tos_address() - 1; 7.13 - // Note that this computation means we replace size_of_parameters() values from the caller 7.14 - // interpreter frame's expression stack with our argument locals 7.15 - locals = Lesp_ptr + parm_words; 7.16 - int delta = local_words - parm_words; 7.17 - int computed_sp_adjustment = (delta > 0) ? round_to(delta, WordsPerLong) : 0; 7.18 - *interpreter_frame->register_addr(I5_savedSP) = (intptr_t) (fp + computed_sp_adjustment) - STACK_BIAS; 7.19 + if (caller->is_compiled_frame()) { 7.20 + // Compiled frames do not allocate a varargs area so place them 7.21 + // next to the register save area. 7.22 + locals = fp + frame::register_save_words + local_words - 1; 7.23 + // Caller wants his own SP back 7.24 + int caller_frame_size = caller->cb()->frame_size(); 7.25 + *interpreter_frame->register_addr(I5_savedSP) = (intptr_t)(caller->fp() - caller_frame_size) - STACK_BIAS; 7.26 } else { 7.27 - assert(caller->is_compiled_frame() || caller->is_entry_frame(), "only possible cases"); 7.28 - // Don't have Lesp available; lay out locals block in the caller 7.29 - // adjacent to the register window save area. 7.30 - // 7.31 - // Compiled frames do not allocate a varargs area which is why this if 7.32 - // statement is needed. 7.33 - // 7.34 - if (caller->is_compiled_frame()) { 7.35 - locals = fp + frame::register_save_words + local_words - 1; 7.36 - } else { 7.37 - locals = fp + frame::memory_parameter_word_sp_offset + local_words - 1; 7.38 - } 7.39 - if (!caller->is_entry_frame()) { 7.40 - // Caller wants his own SP back 7.41 - int caller_frame_size = caller->cb()->frame_size(); 7.42 - *interpreter_frame->register_addr(I5_savedSP) = (intptr_t)(caller->fp() - caller_frame_size) - STACK_BIAS; 7.43 + assert(caller->is_interpreted_frame() || caller->is_entry_frame(), "only possible cases"); 7.44 + // The entry and interpreter frames are laid out like normal C 7.45 + // frames so place the locals adjacent to the varargs area. 7.46 + locals = fp + frame::memory_parameter_word_sp_offset + local_words - 1; 7.47 + if (caller->is_interpreted_frame()) { 7.48 + *interpreter_frame->register_addr(I5_savedSP) = (intptr_t) (fp + rounded_cls) - STACK_BIAS; 7.49 } 7.50 } 7.51 if (TraceDeoptimization) {
8.1 --- a/src/cpu/x86/vm/assembler_x86.cpp Wed May 11 15:47:12 2011 -0700 8.2 +++ b/src/cpu/x86/vm/assembler_x86.cpp Thu May 12 15:05:22 2011 -0700 8.3 @@ -6039,6 +6039,43 @@ 8.4 call_VM_leaf(entry_point, 3); 8.5 } 8.6 8.7 +void MacroAssembler::super_call_VM_leaf(address entry_point, Register arg_0) { 8.8 + pass_arg0(this, arg_0); 8.9 + MacroAssembler::call_VM_leaf_base(entry_point, 1); 8.10 +} 8.11 + 8.12 +void MacroAssembler::super_call_VM_leaf(address entry_point, Register arg_0, Register arg_1) { 8.13 + 8.14 + LP64_ONLY(assert(arg_0 != c_rarg1, "smashed arg")); 8.15 + pass_arg1(this, arg_1); 8.16 + pass_arg0(this, arg_0); 8.17 + MacroAssembler::call_VM_leaf_base(entry_point, 2); 8.18 +} 8.19 + 8.20 +void MacroAssembler::super_call_VM_leaf(address entry_point, Register arg_0, Register arg_1, Register arg_2) { 8.21 + LP64_ONLY(assert(arg_0 != c_rarg2, "smashed arg")); 8.22 + LP64_ONLY(assert(arg_1 != c_rarg2, "smashed arg")); 8.23 + pass_arg2(this, arg_2); 8.24 + LP64_ONLY(assert(arg_0 != c_rarg1, "smashed arg")); 8.25 + pass_arg1(this, arg_1); 8.26 + pass_arg0(this, arg_0); 8.27 + MacroAssembler::call_VM_leaf_base(entry_point, 3); 8.28 +} 8.29 + 8.30 +void MacroAssembler::super_call_VM_leaf(address entry_point, Register arg_0, Register arg_1, Register arg_2, Register arg_3) { 8.31 + LP64_ONLY(assert(arg_0 != c_rarg3, "smashed arg")); 8.32 + LP64_ONLY(assert(arg_1 != c_rarg3, "smashed arg")); 8.33 + LP64_ONLY(assert(arg_2 != c_rarg3, "smashed arg")); 8.34 + pass_arg3(this, arg_3); 8.35 + LP64_ONLY(assert(arg_0 != c_rarg2, "smashed arg")); 8.36 + LP64_ONLY(assert(arg_1 != c_rarg2, "smashed arg")); 8.37 + pass_arg2(this, arg_2); 8.38 + LP64_ONLY(assert(arg_0 != c_rarg1, "smashed arg")); 8.39 + pass_arg1(this, arg_1); 8.40 + pass_arg0(this, arg_0); 8.41 + MacroAssembler::call_VM_leaf_base(entry_point, 4); 8.42 +} 8.43 + 8.44 void MacroAssembler::check_and_handle_earlyret(Register java_thread) { 8.45 } 8.46
9.1 --- a/src/cpu/x86/vm/assembler_x86.hpp Wed May 11 15:47:12 2011 -0700 9.2 +++ b/src/cpu/x86/vm/assembler_x86.hpp Thu May 12 15:05:22 2011 -0700 9.3 @@ -1655,6 +1655,14 @@ 9.4 void call_VM_leaf(address entry_point, 9.5 Register arg_1, Register arg_2, Register arg_3); 9.6 9.7 + // These always tightly bind to MacroAssembler::call_VM_leaf_base 9.8 + // bypassing the virtual implementation 9.9 + void super_call_VM_leaf(address entry_point); 9.10 + void super_call_VM_leaf(address entry_point, Register arg_1); 9.11 + void super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2); 9.12 + void super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3); 9.13 + void super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3, Register arg_4); 9.14 + 9.15 // last Java Frame (fills frame anchor) 9.16 void set_last_Java_frame(Register thread, 9.17 Register last_java_sp,
10.1 --- a/src/cpu/x86/vm/frame_x86.cpp Wed May 11 15:47:12 2011 -0700 10.2 +++ b/src/cpu/x86/vm/frame_x86.cpp Thu May 12 15:05:22 2011 -0700 10.3 @@ -1,5 +1,5 @@ 10.4 /* 10.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 10.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -669,3 +669,23 @@ 10.11 int index = (Interpreter::expr_offset_in_bytes(offset)/wordSize); 10.12 return &interpreter_frame_tos_address()[index]; 10.13 } 10.14 + 10.15 +#ifdef ASSERT 10.16 + 10.17 +#define DESCRIBE_FP_OFFSET(name) \ 10.18 + values.describe(-1, fp() + frame::name##_offset, #name) 10.19 + 10.20 +void frame::describe_pd(FrameValues& values, int frame_no) { 10.21 + if (is_interpreted_frame()) { 10.22 + DESCRIBE_FP_OFFSET(interpreter_frame_sender_sp); 10.23 + DESCRIBE_FP_OFFSET(interpreter_frame_last_sp); 10.24 + DESCRIBE_FP_OFFSET(interpreter_frame_method); 10.25 + DESCRIBE_FP_OFFSET(interpreter_frame_mdx); 10.26 + DESCRIBE_FP_OFFSET(interpreter_frame_cache); 10.27 + DESCRIBE_FP_OFFSET(interpreter_frame_locals); 10.28 + DESCRIBE_FP_OFFSET(interpreter_frame_bcx); 10.29 + DESCRIBE_FP_OFFSET(interpreter_frame_initial_sp); 10.30 + } 10.31 + 10.32 +} 10.33 +#endif
11.1 --- a/src/cpu/x86/vm/interp_masm_x86_32.cpp Wed May 11 15:47:12 2011 -0700 11.2 +++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp Thu May 12 15:05:22 2011 -0700 11.3 @@ -383,32 +383,6 @@ 11.4 movptr(Address(rsp, Interpreter::expr_offset_in_bytes(n)), val); 11.5 } 11.6 11.7 -void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point) { 11.8 - MacroAssembler::call_VM_leaf_base(entry_point, 0); 11.9 -} 11.10 - 11.11 - 11.12 -void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, Register arg_1) { 11.13 - push(arg_1); 11.14 - MacroAssembler::call_VM_leaf_base(entry_point, 1); 11.15 -} 11.16 - 11.17 - 11.18 -void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2) { 11.19 - push(arg_2); 11.20 - push(arg_1); 11.21 - MacroAssembler::call_VM_leaf_base(entry_point, 2); 11.22 -} 11.23 - 11.24 - 11.25 -void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3) { 11.26 - push(arg_3); 11.27 - push(arg_2); 11.28 - push(arg_1); 11.29 - MacroAssembler::call_VM_leaf_base(entry_point, 3); 11.30 -} 11.31 - 11.32 - 11.33 void InterpreterMacroAssembler::prepare_to_jump_from_interpreted() { 11.34 // set sender sp 11.35 lea(rsi, Address(rsp, wordSize));
12.1 --- a/src/cpu/x86/vm/interp_masm_x86_32.hpp Wed May 11 15:47:12 2011 -0700 12.2 +++ b/src/cpu/x86/vm/interp_masm_x86_32.hpp Thu May 12 15:05:22 2011 -0700 12.3 @@ -1,5 +1,5 @@ 12.4 /* 12.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 12.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -124,12 +124,6 @@ 12.11 void load_ptr(int n, Register val); 12.12 void store_ptr(int n, Register val); 12.13 12.14 - // Super call_VM calls - correspond to MacroAssembler::call_VM(_leaf) calls 12.15 - void super_call_VM_leaf(address entry_point); 12.16 - void super_call_VM_leaf(address entry_point, Register arg_1); 12.17 - void super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2); 12.18 - void super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3); 12.19 - 12.20 // Generate a subtype check: branch to ok_is_subtype if sub_klass is 12.21 // a subtype of super_klass. EAX holds the super_klass. Blows ECX 12.22 // and EDI. Register sub_klass cannot be any of the above.
13.1 --- a/src/cpu/x86/vm/interp_masm_x86_64.cpp Wed May 11 15:47:12 2011 -0700 13.2 +++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp Thu May 12 15:05:22 2011 -0700 13.3 @@ -381,56 +381,6 @@ 13.4 } 13.5 13.6 13.7 -void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point) { 13.8 - MacroAssembler::call_VM_leaf_base(entry_point, 0); 13.9 -} 13.10 - 13.11 - 13.12 -void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, 13.13 - Register arg_1) { 13.14 - if (c_rarg0 != arg_1) { 13.15 - mov(c_rarg0, arg_1); 13.16 - } 13.17 - MacroAssembler::call_VM_leaf_base(entry_point, 1); 13.18 -} 13.19 - 13.20 - 13.21 -void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, 13.22 - Register arg_1, 13.23 - Register arg_2) { 13.24 - assert(c_rarg0 != arg_2, "smashed argument"); 13.25 - assert(c_rarg1 != arg_1, "smashed argument"); 13.26 - if (c_rarg0 != arg_1) { 13.27 - mov(c_rarg0, arg_1); 13.28 - } 13.29 - if (c_rarg1 != arg_2) { 13.30 - mov(c_rarg1, arg_2); 13.31 - } 13.32 - MacroAssembler::call_VM_leaf_base(entry_point, 2); 13.33 -} 13.34 - 13.35 -void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, 13.36 - Register arg_1, 13.37 - Register arg_2, 13.38 - Register arg_3) { 13.39 - assert(c_rarg0 != arg_2, "smashed argument"); 13.40 - assert(c_rarg0 != arg_3, "smashed argument"); 13.41 - assert(c_rarg1 != arg_1, "smashed argument"); 13.42 - assert(c_rarg1 != arg_3, "smashed argument"); 13.43 - assert(c_rarg2 != arg_1, "smashed argument"); 13.44 - assert(c_rarg2 != arg_2, "smashed argument"); 13.45 - if (c_rarg0 != arg_1) { 13.46 - mov(c_rarg0, arg_1); 13.47 - } 13.48 - if (c_rarg1 != arg_2) { 13.49 - mov(c_rarg1, arg_2); 13.50 - } 13.51 - if (c_rarg2 != arg_3) { 13.52 - mov(c_rarg2, arg_3); 13.53 - } 13.54 - MacroAssembler::call_VM_leaf_base(entry_point, 3); 13.55 -} 13.56 - 13.57 void InterpreterMacroAssembler::prepare_to_jump_from_interpreted() { 13.58 // set sender sp 13.59 lea(r13, Address(rsp, wordSize));
14.1 --- a/src/cpu/x86/vm/interp_masm_x86_64.hpp Wed May 11 15:47:12 2011 -0700 14.2 +++ b/src/cpu/x86/vm/interp_masm_x86_64.hpp Thu May 12 15:05:22 2011 -0700 14.3 @@ -1,5 +1,5 @@ 14.4 /* 14.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 14.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 14.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.8 * 14.9 * This code is free software; you can redistribute it and/or modify it 14.10 @@ -136,13 +136,6 @@ 14.11 void load_ptr(int n, Register val); 14.12 void store_ptr(int n, Register val); 14.13 14.14 - // Super call_VM calls - correspond to MacroAssembler::call_VM(_leaf) calls 14.15 - void super_call_VM_leaf(address entry_point); 14.16 - void super_call_VM_leaf(address entry_point, Register arg_1); 14.17 - void super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2); 14.18 - void super_call_VM_leaf(address entry_point, 14.19 - Register arg_1, Register arg_2, Register arg_3); 14.20 - 14.21 // Generate a subtype check: branch to ok_is_subtype if sub_klass is 14.22 // a subtype of super_klass. 14.23 void gen_subtype_check( Register sub_klass, Label &ok_is_subtype );
15.1 --- a/src/cpu/x86/vm/methodHandles_x86.cpp Wed May 11 15:47:12 2011 -0700 15.2 +++ b/src/cpu/x86/vm/methodHandles_x86.cpp Thu May 12 15:05:22 2011 -0700 15.3 @@ -315,56 +315,38 @@ 15.4 #ifndef PRODUCT 15.5 extern "C" void print_method_handle(oop mh); 15.6 void trace_method_handle_stub(const char* adaptername, 15.7 + intptr_t* saved_sp, 15.8 oop mh, 15.9 - intptr_t* saved_regs, 15.10 - intptr_t* entry_sp, 15.11 - intptr_t* saved_sp, 15.12 - intptr_t* saved_bp) { 15.13 + intptr_t* sp) { 15.14 // called as a leaf from native code: do not block the JVM! 15.15 - intptr_t* last_sp = (intptr_t*) saved_bp[frame::interpreter_frame_last_sp_offset]; 15.16 - intptr_t* base_sp = (intptr_t*) saved_bp[frame::interpreter_frame_monitor_block_top_offset]; 15.17 - printf("MH %s mh="INTPTR_FORMAT" sp=("INTPTR_FORMAT"+"INTX_FORMAT") stack_size="INTX_FORMAT" bp="INTPTR_FORMAT"\n", 15.18 - adaptername, (intptr_t)mh, (intptr_t)entry_sp, (intptr_t)(saved_sp - entry_sp), (intptr_t)(base_sp - last_sp), (intptr_t)saved_bp); 15.19 - if (last_sp != saved_sp && last_sp != NULL) 15.20 - printf("*** last_sp="INTPTR_FORMAT"\n", (intptr_t)last_sp); 15.21 + intptr_t* entry_sp = sp + LP64_ONLY(16) NOT_LP64(8); 15.22 + tty->print_cr("MH %s mh="INTPTR_FORMAT" sp="INTPTR_FORMAT" saved_sp="INTPTR_FORMAT")", 15.23 + adaptername, (intptr_t)mh, (intptr_t)entry_sp, saved_sp); 15.24 if (Verbose) { 15.25 - printf(" reg dump: "); 15.26 - int saved_regs_count = (entry_sp-1) - saved_regs; 15.27 - // 32 bit: rdi rsi rbp rsp; rbx rdx rcx (*) rax 15.28 - int i; 15.29 - for (i = 0; i <= saved_regs_count; i++) { 15.30 - if (i > 0 && i % 4 == 0 && i != saved_regs_count) 15.31 - printf("\n + dump: "); 15.32 - printf(" %d: "INTPTR_FORMAT, i, saved_regs[i]); 15.33 - } 15.34 - printf("\n"); 15.35 - int stack_dump_count = 16; 15.36 - if (stack_dump_count < (int)(saved_bp + 2 - saved_sp)) 15.37 - stack_dump_count = (int)(saved_bp + 2 - saved_sp); 15.38 - if (stack_dump_count > 64) stack_dump_count = 48; 15.39 - for (i = 0; i < stack_dump_count; i += 4) { 15.40 - printf(" dump at SP[%d] "INTPTR_FORMAT": "INTPTR_FORMAT" "INTPTR_FORMAT" "INTPTR_FORMAT" "INTPTR_FORMAT"\n", 15.41 - i, (intptr_t) &entry_sp[i+0], entry_sp[i+0], entry_sp[i+1], entry_sp[i+2], entry_sp[i+3]); 15.42 - } 15.43 print_method_handle(mh); 15.44 } 15.45 } 15.46 void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) { 15.47 if (!TraceMethodHandles) return; 15.48 BLOCK_COMMENT("trace_method_handle {"); 15.49 - __ push(rax); 15.50 - __ lea(rax, Address(rsp, wordSize*6)); // entry_sp 15.51 __ pusha(); 15.52 +#ifdef _LP64 15.53 + // Pass arguments carefully since the registers overlap with the calling convention. 15.54 + // rcx: method handle 15.55 + // r13: saved sp 15.56 + __ mov(c_rarg2, rcx); // mh 15.57 + __ mov(c_rarg1, r13); // saved sp 15.58 + __ mov(c_rarg3, rsp); // sp 15.59 + __ movptr(c_rarg0, (intptr_t) adaptername); 15.60 + __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, trace_method_handle_stub), c_rarg0, c_rarg1, c_rarg2, c_rarg3); 15.61 +#else 15.62 // arguments: 15.63 - __ push(rbp); // interpreter frame pointer 15.64 - __ push(rsi); // saved_sp 15.65 - __ push(rax); // entry_sp 15.66 - __ push(rcx); // mh 15.67 - __ push(rcx); 15.68 - __ movptr(Address(rsp, 0), (intptr_t) adaptername); 15.69 - __ call_VM_leaf(CAST_FROM_FN_PTR(address, trace_method_handle_stub), 5); 15.70 + // rcx: method handle 15.71 + // rsi: saved sp 15.72 + __ movptr(rbx, (intptr_t) adaptername); 15.73 + __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, trace_method_handle_stub), rbx, rsi, rcx, rsp); 15.74 +#endif 15.75 __ popa(); 15.76 - __ pop(rax); 15.77 BLOCK_COMMENT("} trace_method_handle"); 15.78 } 15.79 #endif //PRODUCT
16.1 --- a/src/cpu/x86/vm/x86_32.ad Wed May 11 15:47:12 2011 -0700 16.2 +++ b/src/cpu/x86/vm/x86_32.ad Thu May 12 15:05:22 2011 -0700 16.3 @@ -12989,6 +12989,53 @@ 16.4 %} 16.5 16.6 // ============================================================================ 16.7 +// Counted Loop limit node which represents exact final iterator value. 16.8 +// Note: the resulting value should fit into integer range since 16.9 +// counted loops have limit check on overflow. 16.10 +instruct loopLimit_eReg(eAXRegI limit, nadxRegI init, immI stride, eDXRegI limit_hi, nadxRegI tmp, eFlagsReg flags) %{ 16.11 + match(Set limit (LoopLimit (Binary init limit) stride)); 16.12 + effect(TEMP limit_hi, TEMP tmp, KILL flags); 16.13 + ins_cost(300); 16.14 + 16.15 + format %{ "loopLimit $init,$limit,$stride # $limit = $init + $stride *( $limit - $init + $stride -1)/ $stride, kills $limit_hi" %} 16.16 + ins_encode %{ 16.17 + int strd = (int)$stride$$constant; 16.18 + assert(strd != 1 && strd != -1, "sanity"); 16.19 + int m1 = (strd > 0) ? 1 : -1; 16.20 + // Convert limit to long (EAX:EDX) 16.21 + __ cdql(); 16.22 + // Convert init to long (init:tmp) 16.23 + __ movl($tmp$$Register, $init$$Register); 16.24 + __ sarl($tmp$$Register, 31); 16.25 + // $limit - $init 16.26 + __ subl($limit$$Register, $init$$Register); 16.27 + __ sbbl($limit_hi$$Register, $tmp$$Register); 16.28 + // + ($stride - 1) 16.29 + if (strd > 0) { 16.30 + __ addl($limit$$Register, (strd - 1)); 16.31 + __ adcl($limit_hi$$Register, 0); 16.32 + __ movl($tmp$$Register, strd); 16.33 + } else { 16.34 + __ addl($limit$$Register, (strd + 1)); 16.35 + __ adcl($limit_hi$$Register, -1); 16.36 + __ lneg($limit_hi$$Register, $limit$$Register); 16.37 + __ movl($tmp$$Register, -strd); 16.38 + } 16.39 + // signed devision: (EAX:EDX) / pos_stride 16.40 + __ idivl($tmp$$Register); 16.41 + if (strd < 0) { 16.42 + // restore sign 16.43 + __ negl($tmp$$Register); 16.44 + } 16.45 + // (EAX) * stride 16.46 + __ mull($tmp$$Register); 16.47 + // + init (ignore upper bits) 16.48 + __ addl($limit$$Register, $init$$Register); 16.49 + %} 16.50 + ins_pipe( pipe_slow ); 16.51 +%} 16.52 + 16.53 +// ============================================================================ 16.54 // Branch Instructions 16.55 // Jump Table 16.56 instruct jumpXtnd(eRegI switch_val) %{
17.1 --- a/src/share/vm/memory/genOopClosures.hpp Wed May 11 15:47:12 2011 -0700 17.2 +++ b/src/share/vm/memory/genOopClosures.hpp Thu May 12 15:05:22 2011 -0700 17.3 @@ -175,7 +175,7 @@ 17.4 protected: 17.5 template <class T> inline void do_oop_work(T* p) { 17.6 oop obj = oopDesc::load_decode_heap_oop(p); 17.7 - guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, obj)); 17.8 + guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, (oopDesc*) obj)); 17.9 } 17.10 public: 17.11 virtual void do_oop(oop* p);
18.1 --- a/src/share/vm/oops/methodDataOop.hpp Wed May 11 15:47:12 2011 -0700 18.2 +++ b/src/share/vm/oops/methodDataOop.hpp Thu May 12 15:05:22 2011 -0700 18.3 @@ -1194,7 +1194,7 @@ 18.4 // Whole-method sticky bits and flags 18.5 public: 18.6 enum { 18.7 - _trap_hist_limit = 16, // decoupled from Deoptimization::Reason_LIMIT 18.8 + _trap_hist_limit = 17, // decoupled from Deoptimization::Reason_LIMIT 18.9 _trap_hist_mask = max_jubyte, 18.10 _extra_data_count = 4 // extra DataLayout headers, for trap history 18.11 }; // Public flag values
19.1 --- a/src/share/vm/opto/bytecodeInfo.cpp Wed May 11 15:47:12 2011 -0700 19.2 +++ b/src/share/vm/opto/bytecodeInfo.cpp Thu May 12 15:05:22 2011 -0700 19.3 @@ -310,13 +310,14 @@ 19.4 return "inlining too deep"; 19.5 } 19.6 19.7 - // We need to detect recursive inlining of method handle targets: if 19.8 - // the current method is a method handle adapter and one of the 19.9 - // callers is the same method as the callee, we bail out if 19.10 - // MaxRecursiveInlineLevel is hit. 19.11 - if (method()->is_method_handle_adapter()) { 19.12 + // detect direct and indirect recursive inlining 19.13 + { 19.14 + // count the current method and the callee 19.15 + int inline_level = (method() == callee_method) ? 1 : 0; 19.16 + if (inline_level > MaxRecursiveInlineLevel) 19.17 + return "recursively inlining too deep"; 19.18 + // count callers of current method and callee 19.19 JVMState* jvms = caller_jvms(); 19.20 - int inline_level = 0; 19.21 while (jvms != NULL && jvms->has_method()) { 19.22 if (jvms->method() == callee_method) { 19.23 inline_level++; 19.24 @@ -327,10 +328,6 @@ 19.25 } 19.26 } 19.27 19.28 - if (method() == callee_method && inline_depth() > MaxRecursiveInlineLevel) { 19.29 - return "recursively inlining too deep"; 19.30 - } 19.31 - 19.32 int size = callee_method->code_size(); 19.33 19.34 if (UseOldInlining && ClipInlining 19.35 @@ -376,7 +373,6 @@ 19.36 return true; 19.37 } 19.38 19.39 -#ifndef PRODUCT 19.40 //------------------------------print_inlining--------------------------------- 19.41 // Really, the failure_msg can be a success message also. 19.42 void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, const char* failure_msg) const { 19.43 @@ -388,7 +384,6 @@ 19.44 tty->print(" bcs: %d+%d invoked: %d", top->count_inline_bcs(), callee_method->code_size(), callee_method->interpreter_invocation_count()); 19.45 } 19.46 } 19.47 -#endif 19.48 19.49 //------------------------------ok_to_inline----------------------------------- 19.50 WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallProfile& profile, WarmCallInfo* initial_wci) {
20.1 --- a/src/share/vm/opto/c2_globals.hpp Wed May 11 15:47:12 2011 -0700 20.2 +++ b/src/share/vm/opto/c2_globals.hpp Thu May 12 15:05:22 2011 -0700 20.3 @@ -183,6 +183,21 @@ 20.4 develop(bool, TraceLoopOpts, false, \ 20.5 "Trace executed loop optimizations") \ 20.6 \ 20.7 + diagnostic(bool, LoopLimitCheck, true, \ 20.8 + "Generate a loop limits check for overflow") \ 20.9 + \ 20.10 + develop(bool, TraceLoopLimitCheck, false, \ 20.11 + "Trace generation of loop limits checks") \ 20.12 + \ 20.13 + diagnostic(bool, RangeLimitCheck, true, \ 20.14 + "Additional overflow checks during range check elimination") \ 20.15 + \ 20.16 + develop(bool, TraceRangeLimitCheck, false, \ 20.17 + "Trace additional overflow checks in RCE") \ 20.18 + \ 20.19 + diagnostic(bool, UnrollLimitCheck, true, \ 20.20 + "Additional overflow checks during loop unroll") \ 20.21 + \ 20.22 product(bool, OptimizeFill, false, \ 20.23 "convert fill/copy loops into intrinsic") \ 20.24 \
21.1 --- a/src/share/vm/opto/cfgnode.cpp Wed May 11 15:47:12 2011 -0700 21.2 +++ b/src/share/vm/opto/cfgnode.cpp Thu May 12 15:05:22 2011 -0700 21.3 @@ -1373,7 +1373,7 @@ 21.4 21.5 // Clone loop predicates 21.6 if (predicate_proj != NULL) { 21.7 - newn = igvn->clone_loop_predicates(predicate_proj, newn); 21.8 + newn = igvn->clone_loop_predicates(predicate_proj, newn, !n->is_CountedLoop()); 21.9 } 21.10 21.11 // Now I can point to the new node.
22.1 --- a/src/share/vm/opto/classes.hpp Wed May 11 15:47:12 2011 -0700 22.2 +++ b/src/share/vm/opto/classes.hpp Thu May 12 15:05:22 2011 -0700 22.3 @@ -156,6 +156,7 @@ 22.4 macro(LogD) 22.5 macro(Log10D) 22.6 macro(Loop) 22.7 +macro(LoopLimit) 22.8 macro(Mach) 22.9 macro(MachProj) 22.10 macro(MaxI)
23.1 --- a/src/share/vm/opto/graphKit.cpp Wed May 11 15:47:12 2011 -0700 23.2 +++ b/src/share/vm/opto/graphKit.cpp Thu May 12 15:05:22 2011 -0700 23.3 @@ -3378,6 +3378,10 @@ 23.4 if (UseLoopPredicate) { 23.5 add_predicate_impl(Deoptimization::Reason_predicate, nargs); 23.6 } 23.7 + // loop's limit check predicate should be near the loop. 23.8 + if (LoopLimitCheck) { 23.9 + add_predicate_impl(Deoptimization::Reason_loop_limit_check, nargs); 23.10 + } 23.11 } 23.12 23.13 //----------------------------- store barriers ----------------------------
24.1 --- a/src/share/vm/opto/ifnode.cpp Wed May 11 15:47:12 2011 -0700 24.2 +++ b/src/share/vm/opto/ifnode.cpp Thu May 12 15:05:22 2011 -0700 24.3 @@ -236,6 +236,7 @@ 24.4 } 24.5 Node* predicate_c = NULL; 24.6 Node* predicate_x = NULL; 24.7 + bool counted_loop = r->is_CountedLoop(); 24.8 24.9 Node *region_c = new (igvn->C, req_c + 1) RegionNode(req_c + 1); 24.10 Node *phi_c = con1; 24.11 @@ -294,16 +295,16 @@ 24.12 if (predicate_c != NULL) { 24.13 assert(predicate_x == NULL, "only one predicate entry expected"); 24.14 // Clone loop predicates to each path 24.15 - iff_c_t = igvn->clone_loop_predicates(predicate_c, iff_c_t); 24.16 - iff_c_f = igvn->clone_loop_predicates(predicate_c, iff_c_f); 24.17 + iff_c_t = igvn->clone_loop_predicates(predicate_c, iff_c_t, !counted_loop); 24.18 + iff_c_f = igvn->clone_loop_predicates(predicate_c, iff_c_f, !counted_loop); 24.19 } 24.20 Node *iff_x_t = phase->transform(new (igvn->C, 1) IfTrueNode (iff_x)); 24.21 Node *iff_x_f = phase->transform(new (igvn->C, 1) IfFalseNode(iff_x)); 24.22 if (predicate_x != NULL) { 24.23 assert(predicate_c == NULL, "only one predicate entry expected"); 24.24 // Clone loop predicates to each path 24.25 - iff_x_t = igvn->clone_loop_predicates(predicate_x, iff_x_t); 24.26 - iff_x_f = igvn->clone_loop_predicates(predicate_x, iff_x_f); 24.27 + iff_x_t = igvn->clone_loop_predicates(predicate_x, iff_x_t, !counted_loop); 24.28 + iff_x_f = igvn->clone_loop_predicates(predicate_x, iff_x_f, !counted_loop); 24.29 } 24.30 24.31 // Merge the TRUE paths 24.32 @@ -545,6 +546,7 @@ 24.33 Node *new_bol = gvn->transform( new (gvn->C, 2) BoolNode( new_cmp, bol->as_Bool()->_test._test ) ); 24.34 igvn->hash_delete( iff ); 24.35 iff->set_req_X( 1, new_bol, igvn ); 24.36 + igvn->_worklist.push( iff ); 24.37 } 24.38 24.39 //------------------------------up_one_dom-------------------------------------
25.1 --- a/src/share/vm/opto/library_call.cpp Wed May 11 15:47:12 2011 -0700 25.2 +++ b/src/share/vm/opto/library_call.cpp Thu May 12 15:05:22 2011 -0700 25.3 @@ -867,12 +867,10 @@ 25.4 Node* str1_offset = make_load(no_ctrl, str1_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); 25.5 Node* str1_start = array_element_address(str1_value, str1_offset, T_CHAR); 25.6 25.7 - // Pin loads from String::equals() argument since it could be NULL. 25.8 - Node* str2_ctrl = (opcode == Op_StrEquals) ? control() : no_ctrl; 25.9 Node* str2_valuea = basic_plus_adr(str2, str2, value_offset); 25.10 - Node* str2_value = make_load(str2_ctrl, str2_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); 25.11 + Node* str2_value = make_load(no_ctrl, str2_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); 25.12 Node* str2_offseta = basic_plus_adr(str2, str2, offset_offset); 25.13 - Node* str2_offset = make_load(str2_ctrl, str2_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); 25.14 + Node* str2_offset = make_load(no_ctrl, str2_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); 25.15 Node* str2_start = array_element_address(str2_value, str2_offset, T_CHAR); 25.16 25.17 Node* result = NULL; 25.18 @@ -1012,14 +1010,15 @@ 25.19 if (!stopped()) { 25.20 // Properly cast the argument to String 25.21 argument = _gvn.transform(new (C, 2) CheckCastPPNode(control(), argument, string_type)); 25.22 + // This path is taken only when argument's type is String:NotNull. 25.23 + argument = cast_not_null(argument, false); 25.24 25.25 // Get counts for string and argument 25.26 Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); 25.27 receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); 25.28 25.29 - // Pin load from argument string since it could be NULL. 25.30 Node* argument_cnta = basic_plus_adr(argument, argument, count_offset); 25.31 - argument_cnt = make_load(control(), argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); 25.32 + argument_cnt = make_load(no_ctrl, argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); 25.33 25.34 // Check for receiver count != argument count 25.35 Node* cmp = _gvn.transform( new(C, 3) CmpINode(receiver_cnt, argument_cnt) );
26.1 --- a/src/share/vm/opto/loopPredicate.cpp Wed May 11 15:47:12 2011 -0700 26.2 +++ b/src/share/vm/opto/loopPredicate.cpp Thu May 12 15:05:22 2011 -0700 26.3 @@ -341,7 +341,7 @@ 26.4 // Cut predicate from old place. 26.5 Node* old = predicate_proj; 26.6 igvn->_worklist.push(old); 26.7 - for (DUIterator_Last imin, i = old->last_outs(imin); i >= imin; ) { 26.8 + for (DUIterator_Last imin, i = old->last_outs(imin); i >= imin;) { 26.9 Node* use = old->last_out(i); // for each use... 26.10 igvn->hash_delete(use); 26.11 igvn->_worklist.push(use); 26.12 @@ -384,24 +384,25 @@ 26.13 26.14 //--------------------------clone_loop_predicates----------------------- 26.15 // Interface from IGVN 26.16 -Node* PhaseIterGVN::clone_loop_predicates(Node* old_entry, Node* new_entry) { 26.17 - return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, false, NULL, this); 26.18 +Node* PhaseIterGVN::clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) { 26.19 + return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, false, clone_limit_check, NULL, this); 26.20 } 26.21 -Node* PhaseIterGVN::move_loop_predicates(Node* old_entry, Node* new_entry) { 26.22 - return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, true, NULL, this); 26.23 +Node* PhaseIterGVN::move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) { 26.24 + return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, true, clone_limit_check, NULL, this); 26.25 } 26.26 26.27 // Interface from PhaseIdealLoop 26.28 -Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry) { 26.29 - return clone_loop_predicates(old_entry, new_entry, false, this, &this->_igvn); 26.30 +Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) { 26.31 + return clone_loop_predicates(old_entry, new_entry, false, clone_limit_check, this, &this->_igvn); 26.32 } 26.33 -Node* PhaseIdealLoop::move_loop_predicates(Node* old_entry, Node* new_entry) { 26.34 - return clone_loop_predicates(old_entry, new_entry, true, this, &this->_igvn); 26.35 +Node* PhaseIdealLoop::move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) { 26.36 + return clone_loop_predicates(old_entry, new_entry, true, clone_limit_check, this, &this->_igvn); 26.37 } 26.38 26.39 // Clone loop predicates to cloned loops (peeled, unswitched, split_if). 26.40 Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry, 26.41 bool move_predicates, 26.42 + bool clone_limit_check, 26.43 PhaseIdealLoop* loop_phase, 26.44 PhaseIterGVN* igvn) { 26.45 #ifdef ASSERT 26.46 @@ -413,10 +414,16 @@ 26.47 #endif 26.48 // Search original predicates 26.49 Node* entry = old_entry; 26.50 + ProjNode* limit_check_proj = NULL; 26.51 + if (LoopLimitCheck) { 26.52 + limit_check_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 26.53 + if (limit_check_proj != NULL) { 26.54 + entry = entry->in(0)->in(0); 26.55 + } 26.56 + } 26.57 if (UseLoopPredicate) { 26.58 ProjNode* predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 26.59 if (predicate_proj != NULL) { // right pattern that can be used by loop predication 26.60 - assert(entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be"); 26.61 if (move_predicates) { 26.62 new_entry = move_predicate(predicate_proj, new_entry, 26.63 Deoptimization::Reason_predicate, 26.64 @@ -435,11 +442,37 @@ 26.65 } 26.66 } 26.67 } 26.68 + if (limit_check_proj != NULL && clone_limit_check) { 26.69 + // Clone loop limit check last to insert it before loop. 26.70 + // Don't clone a limit check which was already finalized 26.71 + // for this counted loop (only one limit check is needed). 26.72 + if (move_predicates) { 26.73 + new_entry = move_predicate(limit_check_proj, new_entry, 26.74 + Deoptimization::Reason_loop_limit_check, 26.75 + loop_phase, igvn); 26.76 + assert(new_entry == limit_check_proj, "old limit check fall through projection"); 26.77 + } else { 26.78 + new_entry = clone_predicate(limit_check_proj, new_entry, 26.79 + Deoptimization::Reason_loop_limit_check, 26.80 + loop_phase, igvn); 26.81 + assert(new_entry != NULL && new_entry->is_Proj(), "IfTrue or IfFalse after clone limit check"); 26.82 + } 26.83 + if (TraceLoopLimitCheck) { 26.84 + tty->print_cr("Loop Limit Check %s: ", move_predicates ? "moved" : "cloned"); 26.85 + debug_only( new_entry->in(0)->dump(); ) 26.86 + } 26.87 + } 26.88 return new_entry; 26.89 } 26.90 26.91 //--------------------------eliminate_loop_predicates----------------------- 26.92 void PhaseIdealLoop::eliminate_loop_predicates(Node* entry) { 26.93 + if (LoopLimitCheck) { 26.94 + Node* predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 26.95 + if (predicate != NULL) { 26.96 + entry = entry->in(0)->in(0); 26.97 + } 26.98 + } 26.99 if (UseLoopPredicate) { 26.100 ProjNode* predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 26.101 if (predicate_proj != NULL) { // right pattern that can be used by loop predication 26.102 @@ -456,10 +489,15 @@ 26.103 // Skip related predicates. 26.104 Node* PhaseIdealLoop::skip_loop_predicates(Node* entry) { 26.105 Node* predicate = NULL; 26.106 + if (LoopLimitCheck) { 26.107 + predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 26.108 + if (predicate != NULL) { 26.109 + entry = entry->in(0)->in(0); 26.110 + } 26.111 + } 26.112 if (UseLoopPredicate) { 26.113 predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 26.114 if (predicate != NULL) { // right pattern that can be used by loop predication 26.115 - assert(entry->is_Proj() && entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be"); 26.116 IfNode* iff = entry->in(0)->as_If(); 26.117 ProjNode* uncommon_proj = iff->proj_out(1 - entry->as_Proj()->_con); 26.118 Node* rgn = uncommon_proj->unique_ctrl_out(); 26.119 @@ -491,10 +529,15 @@ 26.120 // Find a predicate 26.121 Node* PhaseIdealLoop::find_predicate(Node* entry) { 26.122 Node* predicate = NULL; 26.123 + if (LoopLimitCheck) { 26.124 + predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 26.125 + if (predicate != NULL) { // right pattern that can be used by loop predication 26.126 + return entry; 26.127 + } 26.128 + } 26.129 if (UseLoopPredicate) { 26.130 predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 26.131 if (predicate != NULL) { // right pattern that can be used by loop predication 26.132 - assert(entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be"); 26.133 return entry; 26.134 } 26.135 } 26.136 @@ -658,7 +701,7 @@ 26.137 Node* range = cmp->in(2); 26.138 if (range->Opcode() != Op_LoadRange) { 26.139 const TypeInt* tint = phase->_igvn.type(range)->isa_int(); 26.140 - if (!OptimizeFill || tint == NULL || tint->empty() || tint->_lo < 0) { 26.141 + if (tint == NULL || tint->empty() || tint->_lo < 0) { 26.142 // Allow predication on positive values that aren't LoadRanges. 26.143 // This allows optimization of loops where the length of the 26.144 // array is a known value and doesn't need to be loaded back 26.145 @@ -696,36 +739,49 @@ 26.146 // max(scale*i + offset) = scale*(limit-stride) + offset 26.147 // (2) stride*scale < 0 26.148 // max(scale*i + offset) = scale*init + offset 26.149 -BoolNode* PhaseIdealLoop::rc_predicate(Node* ctrl, 26.150 +BoolNode* PhaseIdealLoop::rc_predicate(IdealLoopTree *loop, Node* ctrl, 26.151 int scale, Node* offset, 26.152 Node* init, Node* limit, Node* stride, 26.153 Node* range, bool upper) { 26.154 - DEBUG_ONLY(ttyLocker ttyl); 26.155 - if (TraceLoopPredicate) tty->print("rc_predicate "); 26.156 + stringStream* predString = NULL; 26.157 + if (TraceLoopPredicate) { 26.158 + predString = new stringStream(); 26.159 + predString->print("rc_predicate "); 26.160 + } 26.161 26.162 Node* max_idx_expr = init; 26.163 int stride_con = stride->get_int(); 26.164 if ((stride_con > 0) == (scale > 0) == upper) { 26.165 - max_idx_expr = new (C, 3) SubINode(limit, stride); 26.166 - register_new_node(max_idx_expr, ctrl); 26.167 - if (TraceLoopPredicate) tty->print("(limit - stride) "); 26.168 + if (LoopLimitCheck) { 26.169 + // With LoopLimitCheck limit is not exact. 26.170 + // Calculate exact limit here. 26.171 + // Note, counted loop's test is '<' or '>'. 26.172 + limit = exact_limit(loop); 26.173 + max_idx_expr = new (C, 3) SubINode(limit, stride); 26.174 + register_new_node(max_idx_expr, ctrl); 26.175 + if (TraceLoopPredicate) predString->print("(limit - stride) "); 26.176 + } else { 26.177 + max_idx_expr = new (C, 3) SubINode(limit, stride); 26.178 + register_new_node(max_idx_expr, ctrl); 26.179 + if (TraceLoopPredicate) predString->print("(limit - stride) "); 26.180 + } 26.181 } else { 26.182 - if (TraceLoopPredicate) tty->print("init "); 26.183 + if (TraceLoopPredicate) predString->print("init "); 26.184 } 26.185 26.186 if (scale != 1) { 26.187 ConNode* con_scale = _igvn.intcon(scale); 26.188 max_idx_expr = new (C, 3) MulINode(max_idx_expr, con_scale); 26.189 register_new_node(max_idx_expr, ctrl); 26.190 - if (TraceLoopPredicate) tty->print("* %d ", scale); 26.191 + if (TraceLoopPredicate) predString->print("* %d ", scale); 26.192 } 26.193 26.194 if (offset && (!offset->is_Con() || offset->get_int() != 0)){ 26.195 max_idx_expr = new (C, 3) AddINode(max_idx_expr, offset); 26.196 register_new_node(max_idx_expr, ctrl); 26.197 if (TraceLoopPredicate) 26.198 - if (offset->is_Con()) tty->print("+ %d ", offset->get_int()); 26.199 - else tty->print("+ offset "); 26.200 + if (offset->is_Con()) predString->print("+ %d ", offset->get_int()); 26.201 + else predString->print("+ offset "); 26.202 } 26.203 26.204 CmpUNode* cmp = new (C, 3) CmpUNode(max_idx_expr, range); 26.205 @@ -733,7 +789,10 @@ 26.206 BoolNode* bol = new (C, 2) BoolNode(cmp, BoolTest::lt); 26.207 register_new_node(bol, ctrl); 26.208 26.209 - if (TraceLoopPredicate) tty->print_cr("<u range"); 26.210 + if (TraceLoopPredicate) { 26.211 + predString->print_cr("<u range"); 26.212 + tty->print(predString->as_string()); 26.213 + } 26.214 return bol; 26.215 } 26.216 26.217 @@ -746,29 +805,36 @@ 26.218 // Could be a simple region when irreducible loops are present. 26.219 return false; 26.220 } 26.221 + LoopNode* head = loop->_head->as_Loop(); 26.222 26.223 - if (loop->_head->unique_ctrl_out()->Opcode() == Op_NeverBranch) { 26.224 + if (head->unique_ctrl_out()->Opcode() == Op_NeverBranch) { 26.225 // do nothing for infinite loops 26.226 return false; 26.227 } 26.228 26.229 CountedLoopNode *cl = NULL; 26.230 - if (loop->_head->is_CountedLoop()) { 26.231 - cl = loop->_head->as_CountedLoop(); 26.232 + if (head->is_CountedLoop()) { 26.233 + cl = head->as_CountedLoop(); 26.234 // do nothing for iteration-splitted loops 26.235 if (!cl->is_normal_loop()) return false; 26.236 } 26.237 26.238 - LoopNode *lpn = loop->_head->as_Loop(); 26.239 - Node* entry = lpn->in(LoopNode::EntryControl); 26.240 + Node* entry = head->in(LoopNode::EntryControl); 26.241 + ProjNode *predicate_proj = NULL; 26.242 + // Loop limit check predicate should be near the loop. 26.243 + if (LoopLimitCheck) { 26.244 + predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 26.245 + if (predicate_proj != NULL) 26.246 + entry = predicate_proj->in(0)->in(0); 26.247 + } 26.248 26.249 - ProjNode *predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 26.250 + predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 26.251 if (!predicate_proj) { 26.252 #ifndef PRODUCT 26.253 if (TraceLoopPredicate) { 26.254 tty->print("missing predicate:"); 26.255 loop->dump_head(); 26.256 - lpn->dump(1); 26.257 + head->dump(1); 26.258 } 26.259 #endif 26.260 return false; 26.261 @@ -782,7 +848,6 @@ 26.262 // Create list of if-projs such that a newer proj dominates all older 26.263 // projs in the list, and they all dominate loop->tail() 26.264 Node_List if_proj_list(area); 26.265 - LoopNode *head = loop->_head->as_Loop(); 26.266 Node *current_proj = loop->tail(); //start from tail 26.267 while (current_proj != head) { 26.268 if (loop == get_loop(current_proj) && // still in the loop ? 26.269 @@ -856,8 +921,8 @@ 26.270 const Node* cmp = bol->in(1)->as_Cmp(); 26.271 Node* idx = cmp->in(1); 26.272 assert(!invar.is_invariant(idx), "index is variant"); 26.273 - assert(cmp->in(2)->Opcode() == Op_LoadRange || OptimizeFill, "must be"); 26.274 Node* rng = cmp->in(2); 26.275 + assert(rng->Opcode() == Op_LoadRange || _igvn.type(rng)->is_int() >= 0, "must be"); 26.276 assert(invar.is_invariant(rng), "range must be invariant"); 26.277 int scale = 1; 26.278 Node* offset = zero; 26.279 @@ -886,14 +951,14 @@ 26.280 } 26.281 26.282 // Test the lower bound 26.283 - Node* lower_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, rng, false); 26.284 + Node* lower_bound_bol = rc_predicate(loop, ctrl, scale, offset, init, limit, stride, rng, false); 26.285 IfNode* lower_bound_iff = lower_bound_proj->in(0)->as_If(); 26.286 _igvn.hash_delete(lower_bound_iff); 26.287 lower_bound_iff->set_req(1, lower_bound_bol); 26.288 if (TraceLoopPredicate) tty->print_cr("lower bound check if: %d", lower_bound_iff->_idx); 26.289 26.290 // Test the upper bound 26.291 - Node* upper_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, rng, true); 26.292 + Node* upper_bound_bol = rc_predicate(loop, ctrl, scale, offset, init, limit, stride, rng, true); 26.293 IfNode* upper_bound_iff = upper_bound_proj->in(0)->as_If(); 26.294 _igvn.hash_delete(upper_bound_iff); 26.295 upper_bound_iff->set_req(1, upper_bound_bol); 26.296 @@ -957,4 +1022,3 @@ 26.297 26.298 return hoisted; 26.299 } 26.300 -
27.1 --- a/src/share/vm/opto/loopTransform.cpp Wed May 11 15:47:12 2011 -0700 27.2 +++ b/src/share/vm/opto/loopTransform.cpp Thu May 12 15:05:22 2011 -0700 27.3 @@ -83,7 +83,7 @@ 27.4 #ifdef ASSERT 27.5 BoolTest::mask bt = cl->loopexit()->test_trip(); 27.6 assert(bt == BoolTest::lt || bt == BoolTest::gt || 27.7 - bt == BoolTest::ne, "canonical test is expected"); 27.8 + (bt == BoolTest::ne && !LoopLimitCheck), "canonical test is expected"); 27.9 #endif 27.10 27.11 Node* init_n = cl->init_trip(); 27.12 @@ -510,7 +510,7 @@ 27.13 // the pre-loop with only 1 user (the new peeled iteration), but the 27.14 // peeled-loop backedge has 2 users. 27.15 Node* new_exit_value = old_new[head->in(LoopNode::LoopBackControl)->_idx]; 27.16 - new_exit_value = move_loop_predicates(entry, new_exit_value); 27.17 + new_exit_value = move_loop_predicates(entry, new_exit_value, !counted_loop); 27.18 _igvn.hash_delete(head); 27.19 head->set_req(LoopNode::EntryControl, new_exit_value); 27.20 for (DUIterator_Fast jmax, j = head->fast_outs(jmax); j < jmax; j++) { 27.21 @@ -593,6 +593,12 @@ 27.22 return false; 27.23 } 27.24 27.25 + // Fully unroll a loop with few iterations regardless next 27.26 + // conditions since following loop optimizations will split 27.27 + // such loop anyway (pre-main-post). 27.28 + if (trip_count <= 3) 27.29 + return true; 27.30 + 27.31 // Take into account that after unroll conjoined heads and tails will fold, 27.32 // otherwise policy_unroll() may allow more unrolling than max unrolling. 27.33 uint new_body_size = EMPTY_LOOP_SIZE + (body_size - EMPTY_LOOP_SIZE) * trip_count; 27.34 @@ -605,15 +611,6 @@ 27.35 return false; 27.36 } 27.37 27.38 - // Currently we don't have policy to optimize one iteration loops. 27.39 - // Maximally unrolling transformation is used for that: 27.40 - // it is peeled and the original loop become non reachable (dead). 27.41 - // Also fully unroll a loop with few iterations regardless next 27.42 - // conditions since following loop optimizations will split 27.43 - // such loop anyway (pre-main-post). 27.44 - if (trip_count <= 3) 27.45 - return true; 27.46 - 27.47 // Do not unroll a loop with String intrinsics code. 27.48 // String intrinsics are large and have loops. 27.49 for (uint k = 0; k < _body.size(); k++) { 27.50 @@ -632,6 +629,8 @@ 27.51 } 27.52 27.53 27.54 +#define MAX_UNROLL 16 // maximum number of unrolls for main loop 27.55 + 27.56 //------------------------------policy_unroll---------------------------------- 27.57 // Return TRUE or FALSE if the loop should be unrolled or not. Unroll if 27.58 // the loop is a CountedLoop and the body is small enough. 27.59 @@ -643,13 +642,15 @@ 27.60 if (!cl->is_valid_counted_loop()) 27.61 return false; // Malformed counted loop 27.62 27.63 - // protect against over-unrolling 27.64 - if (cl->trip_count() <= 1) return false; 27.65 - 27.66 - // Check for stride being a small enough constant 27.67 - if (abs(cl->stride_con()) > (1<<3)) return false; 27.68 + // Protect against over-unrolling. 27.69 + // After split at least one iteration will be executed in pre-loop. 27.70 + if (cl->trip_count() <= (uint)(cl->is_normal_loop() ? 2 : 1)) return false; 27.71 27.72 int future_unroll_ct = cl->unrolled_count() * 2; 27.73 + if (future_unroll_ct > MAX_UNROLL) return false; 27.74 + 27.75 + // Check for initial stride being a small enough constant 27.76 + if (abs(cl->stride_con()) > (1<<2)*future_unroll_ct) return false; 27.77 27.78 // Don't unroll if the next round of unrolling would push us 27.79 // over the expected trip count of the loop. One is subtracted 27.80 @@ -675,6 +676,7 @@ 27.81 27.82 Node *init_n = cl->init_trip(); 27.83 Node *limit_n = cl->limit(); 27.84 + int stride_con = cl->stride_con(); 27.85 // Non-constant bounds. 27.86 // Protect against over-unrolling when init or/and limit are not constant 27.87 // (so that trip_count's init value is maxint) but iv range is known. 27.88 @@ -684,7 +686,7 @@ 27.89 if (phi != NULL) { 27.90 assert(phi->is_Phi() && phi->in(0) == _head, "Counted loop should have iv phi."); 27.91 const TypeInt* iv_type = phase->_igvn.type(phi)->is_int(); 27.92 - int next_stride = cl->stride_con() * 2; // stride after this unroll 27.93 + int next_stride = stride_con * 2; // stride after this unroll 27.94 if (next_stride > 0) { 27.95 if (iv_type->_lo + next_stride <= iv_type->_lo || // overflow 27.96 iv_type->_lo + next_stride > iv_type->_hi) { 27.97 @@ -699,15 +701,19 @@ 27.98 } 27.99 } 27.100 27.101 + // After unroll limit will be adjusted: new_limit = limit-stride. 27.102 + // Bailout if adjustment overflow. 27.103 + const TypeInt* limit_type = phase->_igvn.type(limit_n)->is_int(); 27.104 + if (stride_con > 0 && ((limit_type->_hi - stride_con) >= limit_type->_hi) || 27.105 + stride_con < 0 && ((limit_type->_lo - stride_con) <= limit_type->_lo)) 27.106 + return false; // overflow 27.107 + 27.108 // Adjust body_size to determine if we unroll or not 27.109 uint body_size = _body.size(); 27.110 - // Key test to unroll CaffeineMark's Logic test 27.111 - int xors_in_loop = 0; 27.112 // Also count ModL, DivL and MulL which expand mightly 27.113 for (uint k = 0; k < _body.size(); k++) { 27.114 Node* n = _body.at(k); 27.115 switch (n->Opcode()) { 27.116 - case Op_XorI: xors_in_loop++; break; // CaffeineMark's Logic test 27.117 case Op_ModL: body_size += 30; break; 27.118 case Op_DivL: body_size += 30; break; 27.119 case Op_MulL: body_size += 10; break; 27.120 @@ -724,8 +730,7 @@ 27.121 27.122 // Check for being too big 27.123 if (body_size > (uint)LoopUnrollLimit) { 27.124 - if (xors_in_loop >= 4 && body_size < (uint)LoopUnrollLimit*4) return true; 27.125 - // Normal case: loop too big 27.126 + // Normal case: loop too big 27.127 return false; 27.128 } 27.129 27.130 @@ -747,28 +752,31 @@ 27.131 // Return TRUE or FALSE if the loop should be range-check-eliminated. 27.132 // Actually we do iteration-splitting, a more powerful form of RCE. 27.133 bool IdealLoopTree::policy_range_check( PhaseIdealLoop *phase ) const { 27.134 - if( !RangeCheckElimination ) return false; 27.135 + if (!RangeCheckElimination) return false; 27.136 27.137 CountedLoopNode *cl = _head->as_CountedLoop(); 27.138 // If we unrolled with no intention of doing RCE and we later 27.139 // changed our minds, we got no pre-loop. Either we need to 27.140 // make a new pre-loop, or we gotta disallow RCE. 27.141 - if( cl->is_main_no_pre_loop() ) return false; // Disallowed for now. 27.142 + if (cl->is_main_no_pre_loop()) return false; // Disallowed for now. 27.143 Node *trip_counter = cl->phi(); 27.144 27.145 // Check loop body for tests of trip-counter plus loop-invariant vs 27.146 // loop-invariant. 27.147 - for( uint i = 0; i < _body.size(); i++ ) { 27.148 + for (uint i = 0; i < _body.size(); i++) { 27.149 Node *iff = _body[i]; 27.150 - if( iff->Opcode() == Op_If ) { // Test? 27.151 + if (iff->Opcode() == Op_If) { // Test? 27.152 27.153 // Comparing trip+off vs limit 27.154 Node *bol = iff->in(1); 27.155 - if( bol->req() != 2 ) continue; // dead constant test 27.156 + if (bol->req() != 2) continue; // dead constant test 27.157 if (!bol->is_Bool()) { 27.158 assert(UseLoopPredicate && bol->Opcode() == Op_Conv2B, "predicate check only"); 27.159 continue; 27.160 } 27.161 + if (bol->as_Bool()->_test._test == BoolTest::ne) 27.162 + continue; // not RC 27.163 + 27.164 Node *cmp = bol->in(1); 27.165 27.166 Node *rc_exp = cmp->in(1); 27.167 @@ -1064,6 +1072,7 @@ 27.168 // negative stride use > 27.169 27.170 if (pre_end->in(CountedLoopEndNode::TestValue)->as_Bool()->_test._test == BoolTest::ne) { 27.171 + assert(!LoopLimitCheck, "only canonical tests (lt or gt) are expected"); 27.172 27.173 BoolTest::mask new_test = (main_end->stride_con() > 0) ? BoolTest::lt : BoolTest::gt; 27.174 // Modify pre loop end condition 27.175 @@ -1090,6 +1099,9 @@ 27.176 main_head->set_main_loop(); 27.177 if( peel_only ) main_head->set_main_no_pre_loop(); 27.178 27.179 + // Subtract a trip count for the pre-loop. 27.180 + main_head->set_trip_count(main_head->trip_count() - 1); 27.181 + 27.182 // It's difficult to be precise about the trip-counts 27.183 // for the pre/post loops. They are usually very short, 27.184 // so guess that 4 trips is a reasonable value. 27.185 @@ -1123,9 +1135,9 @@ 27.186 loop->dump_head(); 27.187 } else if (TraceLoopOpts) { 27.188 if (loop_head->trip_count() < (uint)LoopUnrollLimit) { 27.189 - tty->print("Unroll %d(%2d) ", loop_head->unrolled_count()*2, loop_head->trip_count()); 27.190 + tty->print("Unroll %d(%2d) ", loop_head->unrolled_count()*2, loop_head->trip_count()); 27.191 } else { 27.192 - tty->print("Unroll %d ", loop_head->unrolled_count()*2); 27.193 + tty->print("Unroll %d ", loop_head->unrolled_count()*2); 27.194 } 27.195 loop->dump_head(); 27.196 } 27.197 @@ -1141,7 +1153,8 @@ 27.198 Node *stride = loop_head->stride(); 27.199 27.200 Node *opaq = NULL; 27.201 - if( adjust_min_trip ) { // If not maximally unrolling, need adjustment 27.202 + if (adjust_min_trip) { // If not maximally unrolling, need adjustment 27.203 + // Search for zero-trip guard. 27.204 assert( loop_head->is_main_loop(), "" ); 27.205 assert( ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, "" ); 27.206 Node *iff = ctrl->in(0); 27.207 @@ -1151,63 +1164,210 @@ 27.208 Node *cmp = bol->in(1); 27.209 assert( cmp->Opcode() == Op_CmpI, "" ); 27.210 opaq = cmp->in(2); 27.211 - // Occasionally it's possible for a pre-loop Opaque1 node to be 27.212 + // Occasionally it's possible for a zero-trip guard Opaque1 node to be 27.213 // optimized away and then another round of loop opts attempted. 27.214 // We can not optimize this particular loop in that case. 27.215 - if( opaq->Opcode() != Op_Opaque1 ) 27.216 - return; // Cannot find pre-loop! Bail out! 27.217 + if (opaq->Opcode() != Op_Opaque1) 27.218 + return; // Cannot find zero-trip guard! Bail out! 27.219 + // Zero-trip test uses an 'opaque' node which is not shared. 27.220 + assert(opaq->outcnt() == 1 && opaq->in(1) == limit, ""); 27.221 } 27.222 27.223 C->set_major_progress(); 27.224 27.225 - // Adjust max trip count. The trip count is intentionally rounded 27.226 - // down here (e.g. 15-> 7-> 3-> 1) because if we unwittingly over-unroll, 27.227 - // the main, unrolled, part of the loop will never execute as it is protected 27.228 - // by the min-trip test. See bug 4834191 for a case where we over-unrolled 27.229 - // and later determined that part of the unrolled loop was dead. 27.230 - loop_head->set_trip_count(loop_head->trip_count() / 2); 27.231 + Node* new_limit = NULL; 27.232 + if (UnrollLimitCheck) { 27.233 + int stride_con = stride->get_int(); 27.234 + int stride_p = (stride_con > 0) ? stride_con : -stride_con; 27.235 + uint old_trip_count = loop_head->trip_count(); 27.236 + // Verify that unroll policy result is still valid. 27.237 + assert(old_trip_count > 1 && 27.238 + (!adjust_min_trip || stride_p <= (1<<3)*loop_head->unrolled_count()), "sanity"); 27.239 27.240 - // Double the count of original iterations in the unrolled loop body. 27.241 - loop_head->double_unrolled_count(); 27.242 + // Adjust loop limit to keep valid iterations number after unroll. 27.243 + // Use (limit - stride) instead of (((limit - init)/stride) & (-2))*stride 27.244 + // which may overflow. 27.245 + if (!adjust_min_trip) { 27.246 + assert(old_trip_count > 1 && (old_trip_count & 1) == 0, 27.247 + "odd trip count for maximally unroll"); 27.248 + // Don't need to adjust limit for maximally unroll since trip count is even. 27.249 + } else if (loop_head->has_exact_trip_count() && init->is_Con()) { 27.250 + // Loop's limit is constant. Loop's init could be constant when pre-loop 27.251 + // become peeled iteration. 27.252 + long init_con = init->get_int(); 27.253 + // We can keep old loop limit if iterations count stays the same: 27.254 + // old_trip_count == new_trip_count * 2 27.255 + // Note: since old_trip_count >= 2 then new_trip_count >= 1 27.256 + // so we also don't need to adjust zero trip test. 27.257 + long limit_con = limit->get_int(); 27.258 + // (stride_con*2) not overflow since stride_con <= 8. 27.259 + int new_stride_con = stride_con * 2; 27.260 + int stride_m = new_stride_con - (stride_con > 0 ? 1 : -1); 27.261 + long trip_count = (limit_con - init_con + stride_m)/new_stride_con; 27.262 + // New trip count should satisfy next conditions. 27.263 + assert(trip_count > 0 && (julong)trip_count < (julong)max_juint/2, "sanity"); 27.264 + uint new_trip_count = (uint)trip_count; 27.265 + adjust_min_trip = (old_trip_count != new_trip_count*2); 27.266 + } 27.267 27.268 - // ----------- 27.269 - // Step 2: Cut back the trip counter for an unroll amount of 2. 27.270 - // Loop will normally trip (limit - init)/stride_con. Since it's a 27.271 - // CountedLoop this is exact (stride divides limit-init exactly). 27.272 - // We are going to double the loop body, so we want to knock off any 27.273 - // odd iteration: (trip_cnt & ~1). Then back compute a new limit. 27.274 - Node *span = new (C, 3) SubINode( limit, init ); 27.275 - register_new_node( span, ctrl ); 27.276 - Node *trip = new (C, 3) DivINode( 0, span, stride ); 27.277 - register_new_node( trip, ctrl ); 27.278 - Node *mtwo = _igvn.intcon(-2); 27.279 - set_ctrl(mtwo, C->root()); 27.280 - Node *rond = new (C, 3) AndINode( trip, mtwo ); 27.281 - register_new_node( rond, ctrl ); 27.282 - Node *spn2 = new (C, 3) MulINode( rond, stride ); 27.283 - register_new_node( spn2, ctrl ); 27.284 - Node *lim2 = new (C, 3) AddINode( spn2, init ); 27.285 - register_new_node( lim2, ctrl ); 27.286 + if (adjust_min_trip) { 27.287 + // Step 2: Adjust the trip limit if it is called for. 27.288 + // The adjustment amount is -stride. Need to make sure if the 27.289 + // adjustment underflows or overflows, then the main loop is skipped. 27.290 + Node* cmp = loop_end->cmp_node(); 27.291 + assert(cmp->in(2) == limit, "sanity"); 27.292 + assert(opaq != NULL && opaq->in(1) == limit, "sanity"); 27.293 27.294 - // Hammer in the new limit 27.295 - Node *ctrl2 = loop_end->in(0); 27.296 - Node *cmp2 = new (C, 3) CmpINode( loop_head->incr(), lim2 ); 27.297 - register_new_node( cmp2, ctrl2 ); 27.298 - Node *bol2 = new (C, 2) BoolNode( cmp2, loop_end->test_trip() ); 27.299 - register_new_node( bol2, ctrl2 ); 27.300 - _igvn.hash_delete(loop_end); 27.301 - loop_end->set_req(CountedLoopEndNode::TestValue, bol2); 27.302 + // Verify that policy_unroll result is still valid. 27.303 + const TypeInt* limit_type = _igvn.type(limit)->is_int(); 27.304 + assert(stride_con > 0 && ((limit_type->_hi - stride_con) < limit_type->_hi) || 27.305 + stride_con < 0 && ((limit_type->_lo - stride_con) > limit_type->_lo), "sanity"); 27.306 27.307 - // Step 3: Find the min-trip test guaranteed before a 'main' loop. 27.308 - // Make it a 1-trip test (means at least 2 trips). 27.309 - if( adjust_min_trip ) { 27.310 - // Guard test uses an 'opaque' node which is not shared. Hence I 27.311 - // can edit it's inputs directly. Hammer in the new limit for the 27.312 - // minimum-trip guard. 27.313 - assert( opaq->outcnt() == 1, "" ); 27.314 - _igvn.hash_delete(opaq); 27.315 - opaq->set_req(1, lim2); 27.316 - } 27.317 + if (limit->is_Con()) { 27.318 + // The check in policy_unroll and the assert above guarantee 27.319 + // no underflow if limit is constant. 27.320 + new_limit = _igvn.intcon(limit->get_int() - stride_con); 27.321 + set_ctrl(new_limit, C->root()); 27.322 + } else { 27.323 + // Limit is not constant. 27.324 + { 27.325 + // Separate limit by Opaque node in case it is an incremented 27.326 + // variable from previous loop to avoid using pre-incremented 27.327 + // value which could increase register pressure. 27.328 + // Otherwise reorg_offsets() optimization will create a separate 27.329 + // Opaque node for each use of trip-counter and as result 27.330 + // zero trip guard limit will be different from loop limit. 27.331 + assert(has_ctrl(opaq), "should have it"); 27.332 + Node* opaq_ctrl = get_ctrl(opaq); 27.333 + limit = new (C, 2) Opaque2Node( C, limit ); 27.334 + register_new_node( limit, opaq_ctrl ); 27.335 + } 27.336 + if (stride_con > 0 && ((limit_type->_lo - stride_con) < limit_type->_lo) || 27.337 + stride_con < 0 && ((limit_type->_hi - stride_con) > limit_type->_hi)) { 27.338 + // No underflow. 27.339 + new_limit = new (C, 3) SubINode(limit, stride); 27.340 + } else { 27.341 + // (limit - stride) may underflow. 27.342 + // Clamp the adjustment value with MININT or MAXINT: 27.343 + // 27.344 + // new_limit = limit-stride 27.345 + // if (stride > 0) 27.346 + // new_limit = (limit < new_limit) ? MININT : new_limit; 27.347 + // else 27.348 + // new_limit = (limit > new_limit) ? MAXINT : new_limit; 27.349 + // 27.350 + BoolTest::mask bt = loop_end->test_trip(); 27.351 + assert(bt == BoolTest::lt || bt == BoolTest::gt, "canonical test is expected"); 27.352 + Node* adj_max = _igvn.intcon((stride_con > 0) ? min_jint : max_jint); 27.353 + set_ctrl(adj_max, C->root()); 27.354 + Node* old_limit = NULL; 27.355 + Node* adj_limit = NULL; 27.356 + Node* bol = limit->is_CMove() ? limit->in(CMoveNode::Condition) : NULL; 27.357 + if (loop_head->unrolled_count() > 1 && 27.358 + limit->is_CMove() && limit->Opcode() == Op_CMoveI && 27.359 + limit->in(CMoveNode::IfTrue) == adj_max && 27.360 + bol->as_Bool()->_test._test == bt && 27.361 + bol->in(1)->Opcode() == Op_CmpI && 27.362 + bol->in(1)->in(2) == limit->in(CMoveNode::IfFalse)) { 27.363 + // Loop was unrolled before. 27.364 + // Optimize the limit to avoid nested CMove: 27.365 + // use original limit as old limit. 27.366 + old_limit = bol->in(1)->in(1); 27.367 + // Adjust previous adjusted limit. 27.368 + adj_limit = limit->in(CMoveNode::IfFalse); 27.369 + adj_limit = new (C, 3) SubINode(adj_limit, stride); 27.370 + } else { 27.371 + old_limit = limit; 27.372 + adj_limit = new (C, 3) SubINode(limit, stride); 27.373 + } 27.374 + assert(old_limit != NULL && adj_limit != NULL, ""); 27.375 + register_new_node( adj_limit, ctrl ); // adjust amount 27.376 + Node* adj_cmp = new (C, 3) CmpINode(old_limit, adj_limit); 27.377 + register_new_node( adj_cmp, ctrl ); 27.378 + Node* adj_bool = new (C, 2) BoolNode(adj_cmp, bt); 27.379 + register_new_node( adj_bool, ctrl ); 27.380 + new_limit = new (C, 4) CMoveINode(adj_bool, adj_limit, adj_max, TypeInt::INT); 27.381 + } 27.382 + register_new_node(new_limit, ctrl); 27.383 + } 27.384 + assert(new_limit != NULL, ""); 27.385 + // Replace in loop test. 27.386 + _igvn.hash_delete(cmp); 27.387 + cmp->set_req(2, new_limit); 27.388 + 27.389 + // Step 3: Find the min-trip test guaranteed before a 'main' loop. 27.390 + // Make it a 1-trip test (means at least 2 trips). 27.391 + 27.392 + // Guard test uses an 'opaque' node which is not shared. Hence I 27.393 + // can edit it's inputs directly. Hammer in the new limit for the 27.394 + // minimum-trip guard. 27.395 + assert(opaq->outcnt() == 1, ""); 27.396 + _igvn.hash_delete(opaq); 27.397 + opaq->set_req(1, new_limit); 27.398 + } 27.399 + 27.400 + // Adjust max trip count. The trip count is intentionally rounded 27.401 + // down here (e.g. 15-> 7-> 3-> 1) because if we unwittingly over-unroll, 27.402 + // the main, unrolled, part of the loop will never execute as it is protected 27.403 + // by the min-trip test. See bug 4834191 for a case where we over-unrolled 27.404 + // and later determined that part of the unrolled loop was dead. 27.405 + loop_head->set_trip_count(old_trip_count / 2); 27.406 + 27.407 + // Double the count of original iterations in the unrolled loop body. 27.408 + loop_head->double_unrolled_count(); 27.409 + 27.410 + } else { // LoopLimitCheck 27.411 + 27.412 + // Adjust max trip count. The trip count is intentionally rounded 27.413 + // down here (e.g. 15-> 7-> 3-> 1) because if we unwittingly over-unroll, 27.414 + // the main, unrolled, part of the loop will never execute as it is protected 27.415 + // by the min-trip test. See bug 4834191 for a case where we over-unrolled 27.416 + // and later determined that part of the unrolled loop was dead. 27.417 + loop_head->set_trip_count(loop_head->trip_count() / 2); 27.418 + 27.419 + // Double the count of original iterations in the unrolled loop body. 27.420 + loop_head->double_unrolled_count(); 27.421 + 27.422 + // ----------- 27.423 + // Step 2: Cut back the trip counter for an unroll amount of 2. 27.424 + // Loop will normally trip (limit - init)/stride_con. Since it's a 27.425 + // CountedLoop this is exact (stride divides limit-init exactly). 27.426 + // We are going to double the loop body, so we want to knock off any 27.427 + // odd iteration: (trip_cnt & ~1). Then back compute a new limit. 27.428 + Node *span = new (C, 3) SubINode( limit, init ); 27.429 + register_new_node( span, ctrl ); 27.430 + Node *trip = new (C, 3) DivINode( 0, span, stride ); 27.431 + register_new_node( trip, ctrl ); 27.432 + Node *mtwo = _igvn.intcon(-2); 27.433 + set_ctrl(mtwo, C->root()); 27.434 + Node *rond = new (C, 3) AndINode( trip, mtwo ); 27.435 + register_new_node( rond, ctrl ); 27.436 + Node *spn2 = new (C, 3) MulINode( rond, stride ); 27.437 + register_new_node( spn2, ctrl ); 27.438 + new_limit = new (C, 3) AddINode( spn2, init ); 27.439 + register_new_node( new_limit, ctrl ); 27.440 + 27.441 + // Hammer in the new limit 27.442 + Node *ctrl2 = loop_end->in(0); 27.443 + Node *cmp2 = new (C, 3) CmpINode( loop_head->incr(), new_limit ); 27.444 + register_new_node( cmp2, ctrl2 ); 27.445 + Node *bol2 = new (C, 2) BoolNode( cmp2, loop_end->test_trip() ); 27.446 + register_new_node( bol2, ctrl2 ); 27.447 + _igvn.hash_delete(loop_end); 27.448 + loop_end->set_req(CountedLoopEndNode::TestValue, bol2); 27.449 + 27.450 + // Step 3: Find the min-trip test guaranteed before a 'main' loop. 27.451 + // Make it a 1-trip test (means at least 2 trips). 27.452 + if( adjust_min_trip ) { 27.453 + assert( new_limit != NULL, "" ); 27.454 + // Guard test uses an 'opaque' node which is not shared. Hence I 27.455 + // can edit it's inputs directly. Hammer in the new limit for the 27.456 + // minimum-trip guard. 27.457 + assert( opaq->outcnt() == 1, "" ); 27.458 + _igvn.hash_delete(opaq); 27.459 + opaq->set_req(1, new_limit); 27.460 + } 27.461 + } // LoopLimitCheck 27.462 27.463 // --------- 27.464 // Step 4: Clone the loop body. Move it inside the loop. This loop body 27.465 @@ -1263,6 +1423,7 @@ 27.466 27.467 void PhaseIdealLoop::do_maximally_unroll( IdealLoopTree *loop, Node_List &old_new ) { 27.468 CountedLoopNode *cl = loop->_head->as_CountedLoop(); 27.469 + assert(cl->has_exact_trip_count(), "trip count is not exact"); 27.470 assert(cl->trip_count() > 0, ""); 27.471 #ifndef PRODUCT 27.472 if (TraceLoopOpts) { 27.473 @@ -1279,6 +1440,7 @@ 27.474 // Now its tripping an even number of times remaining. Double loop body. 27.475 // Do not adjust pre-guards; they are not needed and do not exist. 27.476 if (cl->trip_count() > 0) { 27.477 + assert((cl->trip_count() & 1) == 0, "missed peeling"); 27.478 do_unroll(loop, old_new, false); 27.479 } 27.480 } 27.481 @@ -1292,22 +1454,13 @@ 27.482 } 27.483 27.484 //------------------------------add_constraint--------------------------------- 27.485 -// Constrain the main loop iterations so the condition: 27.486 -// scale_con * I + offset < limit 27.487 +// Constrain the main loop iterations so the conditions: 27.488 +// low_limit <= scale_con * I + offset < upper_limit 27.489 // always holds true. That is, either increase the number of iterations in 27.490 // the pre-loop or the post-loop until the condition holds true in the main 27.491 // loop. Stride, scale, offset and limit are all loop invariant. Further, 27.492 // stride and scale are constants (offset and limit often are). 27.493 -void PhaseIdealLoop::add_constraint( int stride_con, int scale_con, Node *offset, Node *limit, Node *pre_ctrl, Node **pre_limit, Node **main_limit ) { 27.494 - 27.495 - // Compute "I :: (limit-offset)/scale_con" 27.496 - Node *con = new (C, 3) SubINode( limit, offset ); 27.497 - register_new_node( con, pre_ctrl ); 27.498 - Node *scale = _igvn.intcon(scale_con); 27.499 - set_ctrl(scale, C->root()); 27.500 - Node *X = new (C, 3) DivINode( 0, con, scale ); 27.501 - register_new_node( X, pre_ctrl ); 27.502 - 27.503 +void PhaseIdealLoop::add_constraint( int stride_con, int scale_con, Node *offset, Node *low_limit, Node *upper_limit, Node *pre_ctrl, Node **pre_limit, Node **main_limit ) { 27.504 // For positive stride, the pre-loop limit always uses a MAX function 27.505 // and the main loop a MIN function. For negative stride these are 27.506 // reversed. 27.507 @@ -1316,48 +1469,143 @@ 27.508 // pre-loop must check for underflow and the post-loop for overflow. 27.509 // Negative stride*scale reverses this; pre-loop checks for overflow and 27.510 // post-loop for underflow. 27.511 - if( stride_con*scale_con > 0 ) { 27.512 - // Compute I < (limit-offset)/scale_con 27.513 - // Adjust main-loop last iteration to be MIN/MAX(main_loop,X) 27.514 - *main_limit = (stride_con > 0) 27.515 - ? (Node*)(new (C, 3) MinINode( *main_limit, X )) 27.516 - : (Node*)(new (C, 3) MaxINode( *main_limit, X )); 27.517 - register_new_node( *main_limit, pre_ctrl ); 27.518 + if (stride_con*scale_con > 0) { 27.519 + // The overflow limit: scale*I+offset < upper_limit 27.520 + // For main-loop compute 27.521 + // ( if (scale > 0) /* and stride > 0 */ 27.522 + // I < (upper_limit-offset)/scale 27.523 + // else /* scale < 0 and stride < 0 */ 27.524 + // I > (upper_limit-offset)/scale 27.525 + // ) 27.526 + // 27.527 + // (upper_limit-offset) may overflow when offset < 0. 27.528 + // But it is fine since main loop will either have 27.529 + // less iterations or will be skipped in such case. 27.530 + Node *con = new (C, 3) SubINode(upper_limit, offset); 27.531 + register_new_node(con, pre_ctrl); 27.532 + Node *scale = _igvn.intcon(scale_con); 27.533 + set_ctrl(scale, C->root()); 27.534 + Node *X = new (C, 3) DivINode(0, con, scale); 27.535 + register_new_node(X, pre_ctrl); 27.536 27.537 - } else { 27.538 - // Compute (limit-offset)/scale_con + SGN(-scale_con) <= I 27.539 - // Add the negation of the main-loop constraint to the pre-loop. 27.540 - // See footnote [++] below for a derivation of the limit expression. 27.541 - Node *incr = _igvn.intcon(scale_con > 0 ? -1 : 1); 27.542 - set_ctrl(incr, C->root()); 27.543 - Node *adj = new (C, 3) AddINode( X, incr ); 27.544 - register_new_node( adj, pre_ctrl ); 27.545 - *pre_limit = (scale_con > 0) 27.546 - ? (Node*)new (C, 3) MinINode( *pre_limit, adj ) 27.547 - : (Node*)new (C, 3) MaxINode( *pre_limit, adj ); 27.548 - register_new_node( *pre_limit, pre_ctrl ); 27.549 + // Adjust main-loop last iteration 27.550 + Node *loop_limit = *main_limit; 27.551 + loop_limit = (stride_con > 0) // scale > 0 27.552 + ? (Node*)(new (C, 3) MinINode(loop_limit, X)) 27.553 + : (Node*)(new (C, 3) MaxINode(loop_limit, X)); 27.554 + register_new_node(loop_limit, pre_ctrl); 27.555 + *main_limit = loop_limit; 27.556 27.557 -// [++] Here's the algebra that justifies the pre-loop limit expression: 27.558 -// 27.559 -// NOT( scale_con * I + offset < limit ) 27.560 -// == 27.561 -// scale_con * I + offset >= limit 27.562 -// == 27.563 -// SGN(scale_con) * I >= (limit-offset)/|scale_con| 27.564 -// == 27.565 -// (limit-offset)/|scale_con| <= I * SGN(scale_con) 27.566 -// == 27.567 -// (limit-offset)/|scale_con|-1 < I * SGN(scale_con) 27.568 -// == 27.569 -// ( if (scale_con > 0) /*common case*/ 27.570 -// (limit-offset)/scale_con - 1 < I 27.571 -// else 27.572 -// (limit-offset)/scale_con + 1 > I 27.573 -// ) 27.574 -// ( if (scale_con > 0) /*common case*/ 27.575 -// (limit-offset)/scale_con + SGN(-scale_con) < I 27.576 -// else 27.577 -// (limit-offset)/scale_con + SGN(-scale_con) > I 27.578 + // The underflow limit: low_limit <= scale*I+offset. 27.579 + // For pre-loop compute 27.580 + // NOT(scale*I+offset >= low_limit) 27.581 + // scale*I+offset < low_limit 27.582 + // ( if (scale > 0) /* and stride > 0 */ 27.583 + // I < (low_limit-offset)/scale 27.584 + // else /* scale < 0 and stride < 0 */ 27.585 + // I > (low_limit-offset)/scale 27.586 + // ) 27.587 + 27.588 + if (low_limit->get_int() == -max_jint) { 27.589 + if (!RangeLimitCheck) return; 27.590 + // We need this guard when scale*pre_limit+offset >= limit 27.591 + // due to underflow so we need execute pre-loop until 27.592 + // scale*I+offset >= min_int. But (low_limit-offset) will 27.593 + // underflow when offset > 0 and X will be > original_limit. 27.594 + // To avoid it we replace offset = offset > 0 ? 0 : offset 27.595 + // and add min(pre_limit, original_limit). 27.596 + Node* shift = _igvn.intcon(31); 27.597 + set_ctrl(shift, C->root()); 27.598 + Node *neg_off = new (C, 3) RShiftINode(offset, shift); 27.599 + register_new_node(neg_off, pre_ctrl); 27.600 + offset = new (C, 3) AndINode(offset, neg_off); 27.601 + register_new_node(offset, pre_ctrl); 27.602 + } else { 27.603 + assert(low_limit->get_int() == 0, "wrong low limit for range check"); 27.604 + // The only problem we have here when offset == min_int 27.605 + // since (0-min_int) == min_int. It may be fine for scale > 0 27.606 + // but for scale < 0 X will be < original_limit. 27.607 + } 27.608 + con = new (C, 3) SubINode(low_limit, offset); 27.609 + register_new_node(con, pre_ctrl); 27.610 + scale = _igvn.intcon(scale_con); 27.611 + set_ctrl(scale, C->root()); 27.612 + X = new (C, 3) DivINode(0, con, scale); 27.613 + register_new_node(X, pre_ctrl); 27.614 + 27.615 + // Adjust pre-loop last iteration 27.616 + loop_limit = *pre_limit; 27.617 + loop_limit = (stride_con > 0) // scale > 0 27.618 + ? (Node*)(new (C, 3) MaxINode(loop_limit, X)) 27.619 + : (Node*)(new (C, 3) MinINode(loop_limit, X)); 27.620 + register_new_node( loop_limit, pre_ctrl ); 27.621 + *pre_limit = loop_limit; 27.622 + 27.623 + } else { // stride_con*scale_con < 0 27.624 + // For negative stride*scale pre-loop checks for overflow and 27.625 + // post-loop for underflow. 27.626 + // 27.627 + // The underflow limit: low_limit <= scale*I+offset. 27.628 + // For main-loop compute 27.629 + // scale*I+offset+1 > low_limit 27.630 + // ( if (scale < 0) /* and stride > 0 */ 27.631 + // I < (low_limit-(offset+1))/scale 27.632 + // else /* scale < 0 and stride < 0 */ 27.633 + // I > (low_limit-(offset+1))/scale 27.634 + // ) 27.635 + 27.636 + if (low_limit->get_int() == -max_jint) { 27.637 + if (!RangeLimitCheck) return; 27.638 + } else { 27.639 + assert(low_limit->get_int() == 0, "wrong low limit for range check"); 27.640 + } 27.641 + 27.642 + Node *one = _igvn.intcon(1); 27.643 + set_ctrl(one, C->root()); 27.644 + Node *plus_one = new (C, 3) AddINode(offset, one); 27.645 + register_new_node( plus_one, pre_ctrl ); 27.646 + Node *con = new (C, 3) SubINode(low_limit, plus_one); 27.647 + register_new_node(con, pre_ctrl); 27.648 + Node *scale = _igvn.intcon(scale_con); 27.649 + set_ctrl(scale, C->root()); 27.650 + Node *X = new (C, 3) DivINode(0, con, scale); 27.651 + register_new_node(X, pre_ctrl); 27.652 + 27.653 + // Adjust main-loop last iteration 27.654 + Node *loop_limit = *main_limit; 27.655 + loop_limit = (stride_con > 0) // scale < 0 27.656 + ? (Node*)(new (C, 3) MinINode(loop_limit, X)) 27.657 + : (Node*)(new (C, 3) MaxINode(loop_limit, X)); 27.658 + register_new_node(loop_limit, pre_ctrl); 27.659 + *main_limit = loop_limit; 27.660 + 27.661 + // The overflow limit: scale*I+offset < upper_limit 27.662 + // For pre-loop compute 27.663 + // NOT(scale*I+offset < upper_limit) 27.664 + // scale*I+offset >= upper_limit 27.665 + // scale*I+offset+1 > upper_limit 27.666 + // ( if (scale < 0) /* and stride > 0 */ 27.667 + // I < (upper_limit-(offset+1))/scale 27.668 + // else /* scale < 0 and stride < 0 */ 27.669 + // I > (upper_limit-(offset+1))/scale 27.670 + // ) 27.671 + plus_one = new (C, 3) AddINode(offset, one); 27.672 + register_new_node( plus_one, pre_ctrl ); 27.673 + con = new (C, 3) SubINode(upper_limit, plus_one); 27.674 + register_new_node(con, pre_ctrl); 27.675 + scale = _igvn.intcon(scale_con); 27.676 + set_ctrl(scale, C->root()); 27.677 + X = new (C, 3) DivINode(0, con, scale); 27.678 + register_new_node(X, pre_ctrl); 27.679 + 27.680 + // Adjust pre-loop last iteration 27.681 + loop_limit = *pre_limit; 27.682 + loop_limit = (stride_con > 0) // scale < 0 27.683 + ? (Node*)(new (C, 3) MaxINode(loop_limit, X)) 27.684 + : (Node*)(new (C, 3) MinINode(loop_limit, X)); 27.685 + register_new_node( loop_limit, pre_ctrl ); 27.686 + *pre_limit = loop_limit; 27.687 + 27.688 } 27.689 } 27.690 27.691 @@ -1488,7 +1736,7 @@ 27.692 Node *cmpzm = bolzm->in(1); 27.693 assert(cmpzm->is_Cmp(), ""); 27.694 Node *opqzm = cmpzm->in(2); 27.695 - // Can not optimize a loop if pre-loop Opaque1 node is optimized 27.696 + // Can not optimize a loop if zero-trip Opaque1 node is optimized 27.697 // away and then another round of loop opts attempted. 27.698 if (opqzm->Opcode() != Op_Opaque1) 27.699 return; 27.700 @@ -1523,8 +1771,11 @@ 27.701 int stride_con = cl->stride_con(); 27.702 Node *zero = _igvn.intcon(0); 27.703 Node *one = _igvn.intcon(1); 27.704 + // Use symmetrical int range [-max_jint,max_jint] 27.705 + Node *mini = _igvn.intcon(-max_jint); 27.706 set_ctrl(zero, C->root()); 27.707 set_ctrl(one, C->root()); 27.708 + set_ctrl(mini, C->root()); 27.709 27.710 // Range checks that do not dominate the loop backedge (ie. 27.711 // conditionally executed) can lengthen the pre loop limit beyond 27.712 @@ -1599,7 +1850,12 @@ 27.713 if( offset_c == ctrl ) { 27.714 continue; // Don't rce this check but continue looking for other candidates. 27.715 } 27.716 - 27.717 +#ifdef ASSERT 27.718 + if (TraceRangeLimitCheck) { 27.719 + tty->print_cr("RC bool node%s", flip ? " flipped:" : ":"); 27.720 + bol->dump(2); 27.721 + } 27.722 +#endif 27.723 // At this point we have the expression as: 27.724 // scale_con * trip_counter + offset :: limit 27.725 // where scale_con, offset and limit are loop invariant. Trip_counter 27.726 @@ -1610,17 +1866,16 @@ 27.727 // Adjust pre and main loop limits to guard the correct iteration set 27.728 if( cmp->Opcode() == Op_CmpU ) {// Unsigned compare is really 2 tests 27.729 if( b_test._test == BoolTest::lt ) { // Range checks always use lt 27.730 - // The overflow limit: scale*I+offset < limit 27.731 - add_constraint( stride_con, scale_con, offset, limit, pre_ctrl, &pre_limit, &main_limit ); 27.732 - // The underflow limit: 0 <= scale*I+offset. 27.733 - // Some math yields: -scale*I-(offset+1) < 0 27.734 - Node *plus_one = new (C, 3) AddINode( offset, one ); 27.735 - register_new_node( plus_one, pre_ctrl ); 27.736 - Node *neg_offset = new (C, 3) SubINode( zero, plus_one ); 27.737 - register_new_node( neg_offset, pre_ctrl ); 27.738 - add_constraint( stride_con, -scale_con, neg_offset, zero, pre_ctrl, &pre_limit, &main_limit ); 27.739 + // The underflow and overflow limits: 0 <= scale*I+offset < limit 27.740 + add_constraint( stride_con, scale_con, offset, zero, limit, pre_ctrl, &pre_limit, &main_limit ); 27.741 if (!conditional_rc) { 27.742 conditional_rc = !loop->dominates_backedge(iff); 27.743 + // It is also needed if offset->_lo == min_int since 27.744 + // (0-min_int) == min_int. It may be fine for stride > 0 27.745 + // but for stride < 0 pre_limit will be < original_limit. 27.746 + const TypeInt* offset_t = _igvn.type(offset)->is_int(); 27.747 + conditional_rc |= RangeLimitCheck && (offset_t->_lo == min_jint) && 27.748 + (scale_con<0) && (stride_con<0); 27.749 } 27.750 } else { 27.751 #ifndef PRODUCT 27.752 @@ -1631,21 +1886,35 @@ 27.753 } 27.754 } else { // Otherwise work on normal compares 27.755 switch( b_test._test ) { 27.756 - case BoolTest::ge: // Convert X >= Y to -X <= -Y 27.757 + case BoolTest::gt: 27.758 + // Fall into GE case 27.759 + case BoolTest::ge: 27.760 + // Convert (I*scale+offset) >= Limit to (I*(-scale)+(-offset)) <= -Limit 27.761 scale_con = -scale_con; 27.762 offset = new (C, 3) SubINode( zero, offset ); 27.763 register_new_node( offset, pre_ctrl ); 27.764 limit = new (C, 3) SubINode( zero, limit ); 27.765 register_new_node( limit, pre_ctrl ); 27.766 // Fall into LE case 27.767 - case BoolTest::le: // Convert X <= Y to X < Y+1 27.768 - limit = new (C, 3) AddINode( limit, one ); 27.769 - register_new_node( limit, pre_ctrl ); 27.770 + case BoolTest::le: 27.771 + if (b_test._test != BoolTest::gt) { 27.772 + // Convert X <= Y to X < Y+1 27.773 + limit = new (C, 3) AddINode( limit, one ); 27.774 + register_new_node( limit, pre_ctrl ); 27.775 + } 27.776 // Fall into LT case 27.777 case BoolTest::lt: 27.778 - add_constraint( stride_con, scale_con, offset, limit, pre_ctrl, &pre_limit, &main_limit ); 27.779 + // The underflow and overflow limits: MIN_INT <= scale*I+offset < limit 27.780 + add_constraint( stride_con, scale_con, offset, mini, limit, pre_ctrl, &pre_limit, &main_limit ); 27.781 if (!conditional_rc) { 27.782 conditional_rc = !loop->dominates_backedge(iff); 27.783 + // It is also needed if scale*pre_limit+offset >= limit 27.784 + // due to underflow so we need execute pre-loop until 27.785 + // scale*I+offset >= min_int. But (low_limit-offset) will 27.786 + // underflow when offset > 0 and X will be > original_limit. 27.787 + const TypeInt* offset_t = _igvn.type(offset)->is_int(); 27.788 + conditional_rc |= RangeLimitCheck && (offset_t->_hi > 0) && 27.789 + (scale_con>0) && (stride_con>0); 27.790 } 27.791 break; 27.792 default: 27.793 @@ -1696,7 +1965,8 @@ 27.794 27.795 // Note:: we are making the main loop limit no longer precise; 27.796 // need to round up based on stride. 27.797 - if( stride_con != 1 && stride_con != -1 ) { // Cutout for common case 27.798 + cl->set_nonexact_trip_count(); 27.799 + if (!LoopLimitCheck && stride_con != 1 && stride_con != -1) { // Cutout for common case 27.800 // "Standard" round-up logic: ([main_limit-init+(y-1)]/y)*y+init 27.801 // Hopefully, compiler will optimize for powers of 2. 27.802 Node *ctrl = get_ctrl(main_limit); 27.803 @@ -1876,7 +2146,19 @@ 27.804 // iteration. Then the CountedLoopEnd will collapse (backedge never 27.805 // taken) and all loop-invariant uses of the exit values will be correct. 27.806 Node *phi = cl->phi(); 27.807 - Node *final = new (phase->C, 3) SubINode( cl->limit(), cl->stride() ); 27.808 + Node *exact_limit = phase->exact_limit(this); 27.809 + if (exact_limit != cl->limit()) { 27.810 + // We also need to replace the original limit to collapse loop exit. 27.811 + Node* cmp = cl->loopexit()->cmp_node(); 27.812 + assert(cl->limit() == cmp->in(2), "sanity"); 27.813 + phase->_igvn._worklist.push(cmp->in(2)); // put limit on worklist 27.814 + phase->_igvn.hash_delete(cmp); 27.815 + cmp->set_req(2, exact_limit); 27.816 + phase->_igvn._worklist.push(cmp); // put cmp on worklist 27.817 + } 27.818 + // Note: the final value after increment should not overflow since 27.819 + // counted loop has limit check predicate. 27.820 + Node *final = new (phase->C, 3) SubINode( exact_limit, cl->stride() ); 27.821 phase->register_new_node(final,cl->in(LoopNode::EntryControl)); 27.822 phase->_igvn.replace_node(phi,final); 27.823 phase->C->set_major_progress();
28.1 --- a/src/share/vm/opto/loopUnswitch.cpp Wed May 11 15:47:12 2011 -0700 28.2 +++ b/src/share/vm/opto/loopUnswitch.cpp Thu May 12 15:05:22 2011 -0700 28.3 @@ -130,6 +130,11 @@ 28.4 Node* uniqc = proj_true->unique_ctrl_out(); 28.5 Node* entry = head->in(LoopNode::EntryControl); 28.6 Node* predicate = find_predicate(entry); 28.7 + if (predicate != NULL && LoopLimitCheck && UseLoopPredicate) { 28.8 + // We may have two predicates, find first. 28.9 + entry = find_predicate(entry->in(0)->in(0)); 28.10 + if (entry != NULL) predicate = entry; 28.11 + } 28.12 if (predicate != NULL) predicate = predicate->in(0); 28.13 assert(proj_true->is_IfTrue() && 28.14 (predicate == NULL && uniqc == head || 28.15 @@ -217,6 +222,7 @@ 28.16 ProjNode* PhaseIdealLoop::create_slow_version_of_loop(IdealLoopTree *loop, 28.17 Node_List &old_new) { 28.18 LoopNode* head = loop->_head->as_Loop(); 28.19 + bool counted_loop = head->is_CountedLoop(); 28.20 Node* entry = head->in(LoopNode::EntryControl); 28.21 _igvn.hash_delete(entry); 28.22 _igvn._worklist.push(entry); 28.23 @@ -242,14 +248,14 @@ 28.24 assert(old_new[head->_idx]->is_Loop(), "" ); 28.25 28.26 // Fast (true) control 28.27 - Node* iffast_pred = clone_loop_predicates(entry, iffast); 28.28 + Node* iffast_pred = clone_loop_predicates(entry, iffast, !counted_loop); 28.29 _igvn.hash_delete(head); 28.30 head->set_req(LoopNode::EntryControl, iffast_pred); 28.31 set_idom(head, iffast_pred, dom_depth(head)); 28.32 _igvn._worklist.push(head); 28.33 28.34 // Slow (false) control 28.35 - Node* ifslow_pred = move_loop_predicates(entry, ifslow); 28.36 + Node* ifslow_pred = move_loop_predicates(entry, ifslow, !counted_loop); 28.37 LoopNode* slow_head = old_new[head->_idx]->as_Loop(); 28.38 _igvn.hash_delete(slow_head); 28.39 slow_head->set_req(LoopNode::EntryControl, ifslow_pred);
29.1 --- a/src/share/vm/opto/loopnode.cpp Wed May 11 15:47:12 2011 -0700 29.2 +++ b/src/share/vm/opto/loopnode.cpp Thu May 12 15:05:22 2011 -0700 29.3 @@ -206,7 +206,7 @@ 29.4 // Get backedge compare 29.5 Node *cmp = test->in(1); 29.6 int cmp_op = cmp->Opcode(); 29.7 - if( cmp_op != Op_CmpI ) 29.8 + if (cmp_op != Op_CmpI) 29.9 return false; // Avoid pointer & float compares 29.10 29.11 // Find the trip-counter increment & limit. Limit must be loop invariant. 29.12 @@ -259,7 +259,8 @@ 29.13 } 29.14 // Stride must be constant 29.15 int stride_con = stride->get_int(); 29.16 - assert(stride_con != 0, "missed some peephole opt"); 29.17 + if (stride_con == 0) 29.18 + return false; // missed some peephole opt 29.19 29.20 if (!xphi->is_Phi()) 29.21 return false; // Too much math on the trip counter 29.22 @@ -319,7 +320,7 @@ 29.23 // Count down loop rolls through MAXINT 29.24 (bt == BoolTest::le || bt == BoolTest::lt) && stride_con < 0 || 29.25 // Count up loop rolls through MININT 29.26 - (bt == BoolTest::ge || bt == BoolTest::gt) && stride_con > 0 ) { 29.27 + (bt == BoolTest::ge || bt == BoolTest::gt) && stride_con > 0) { 29.28 return false; // Bail out 29.29 } 29.30 29.31 @@ -341,12 +342,137 @@ 29.32 // 29.33 assert(x->Opcode() == Op_Loop, "regular loops only"); 29.34 C->print_method("Before CountedLoop", 3); 29.35 + 29.36 + Node *hook = new (C, 6) Node(6); 29.37 + 29.38 + if (LoopLimitCheck) { 29.39 + 29.40 + // =================================================== 29.41 + // Generate loop limit check to avoid integer overflow 29.42 + // in cases like next (cyclic loops): 29.43 + // 29.44 + // for (i=0; i <= max_jint; i++) {} 29.45 + // for (i=0; i < max_jint; i+=2) {} 29.46 + // 29.47 + // 29.48 + // Limit check predicate depends on the loop test: 29.49 + // 29.50 + // for(;i != limit; i++) --> limit <= (max_jint) 29.51 + // for(;i < limit; i+=stride) --> limit <= (max_jint - stride + 1) 29.52 + // for(;i <= limit; i+=stride) --> limit <= (max_jint - stride ) 29.53 + // 29.54 + 29.55 + // Check if limit is excluded to do more precise int overflow check. 29.56 + bool incl_limit = (bt == BoolTest::le || bt == BoolTest::ge); 29.57 + int stride_m = stride_con - (incl_limit ? 0 : (stride_con > 0 ? 1 : -1)); 29.58 + 29.59 + // If compare points directly to the phi we need to adjust 29.60 + // the compare so that it points to the incr. Limit have 29.61 + // to be adjusted to keep trip count the same and the 29.62 + // adjusted limit should be checked for int overflow. 29.63 + if (phi_incr != NULL) { 29.64 + stride_m += stride_con; 29.65 + } 29.66 + 29.67 + if (limit->is_Con()) { 29.68 + int limit_con = limit->get_int(); 29.69 + if ((stride_con > 0 && limit_con > (max_jint - stride_m)) || 29.70 + (stride_con < 0 && limit_con < (min_jint - stride_m))) { 29.71 + // Bailout: it could be integer overflow. 29.72 + return false; 29.73 + } 29.74 + } else if ((stride_con > 0 && limit_t->_hi <= (max_jint - stride_m)) || 29.75 + (stride_con < 0 && limit_t->_lo >= (min_jint - stride_m))) { 29.76 + // Limit's type may satisfy the condition, for example, 29.77 + // when it is an array length. 29.78 + } else { 29.79 + // Generate loop's limit check. 29.80 + // Loop limit check predicate should be near the loop. 29.81 + ProjNode *limit_check_proj = find_predicate_insertion_point(init_control, Deoptimization::Reason_loop_limit_check); 29.82 + if (!limit_check_proj) { 29.83 + // The limit check predicate is not generated if this method trapped here before. 29.84 +#ifdef ASSERT 29.85 + if (TraceLoopLimitCheck) { 29.86 + tty->print("missing loop limit check:"); 29.87 + loop->dump_head(); 29.88 + x->dump(1); 29.89 + } 29.90 +#endif 29.91 + return false; 29.92 + } 29.93 + 29.94 + IfNode* check_iff = limit_check_proj->in(0)->as_If(); 29.95 + Node* cmp_limit; 29.96 + Node* bol; 29.97 + 29.98 + if (stride_con > 0) { 29.99 + cmp_limit = new (C, 3) CmpINode(limit, _igvn.intcon(max_jint - stride_m)); 29.100 + bol = new (C, 2) BoolNode(cmp_limit, BoolTest::le); 29.101 + } else { 29.102 + cmp_limit = new (C, 3) CmpINode(limit, _igvn.intcon(min_jint - stride_m)); 29.103 + bol = new (C, 2) BoolNode(cmp_limit, BoolTest::ge); 29.104 + } 29.105 + cmp_limit = _igvn.register_new_node_with_optimizer(cmp_limit); 29.106 + bol = _igvn.register_new_node_with_optimizer(bol); 29.107 + set_subtree_ctrl(bol); 29.108 + 29.109 + // Replace condition in original predicate but preserve Opaque node 29.110 + // so that previous predicates could be found. 29.111 + assert(check_iff->in(1)->Opcode() == Op_Conv2B && 29.112 + check_iff->in(1)->in(1)->Opcode() == Op_Opaque1, ""); 29.113 + Node* opq = check_iff->in(1)->in(1); 29.114 + _igvn.hash_delete(opq); 29.115 + opq->set_req(1, bol); 29.116 + // Update ctrl. 29.117 + set_ctrl(opq, check_iff->in(0)); 29.118 + set_ctrl(check_iff->in(1), check_iff->in(0)); 29.119 + 29.120 #ifndef PRODUCT 29.121 - if (TraceLoopOpts) { 29.122 - tty->print("Counted "); 29.123 - loop->dump_head(); 29.124 + // report that the loop predication has been actually performed 29.125 + // for this loop 29.126 + if (TraceLoopLimitCheck) { 29.127 + tty->print_cr("Counted Loop Limit Check generated:"); 29.128 + debug_only( bol->dump(2); ) 29.129 + } 29.130 +#endif 29.131 } 29.132 -#endif 29.133 + 29.134 + if (phi_incr != NULL) { 29.135 + // If compare points directly to the phi we need to adjust 29.136 + // the compare so that it points to the incr. Limit have 29.137 + // to be adjusted to keep trip count the same and we 29.138 + // should avoid int overflow. 29.139 + // 29.140 + // i = init; do {} while(i++ < limit); 29.141 + // is converted to 29.142 + // i = init; do {} while(++i < limit+1); 29.143 + // 29.144 + limit = gvn->transform(new (C, 3) AddINode(limit, stride)); 29.145 + } 29.146 + 29.147 + // Now we need to canonicalize loop condition. 29.148 + if (bt == BoolTest::ne) { 29.149 + assert(stride_con == 1 || stride_con == -1, "simple increment only"); 29.150 + bt = (stride_con > 0) ? BoolTest::lt : BoolTest::gt; 29.151 + } 29.152 + 29.153 + if (incl_limit) { 29.154 + // The limit check guaranties that 'limit <= (max_jint - stride)' so 29.155 + // we can convert 'i <= limit' to 'i < limit+1' since stride != 0. 29.156 + // 29.157 + Node* one = (stride_con > 0) ? gvn->intcon( 1) : gvn->intcon(-1); 29.158 + limit = gvn->transform(new (C, 3) AddINode(limit, one)); 29.159 + if (bt == BoolTest::le) 29.160 + bt = BoolTest::lt; 29.161 + else if (bt == BoolTest::ge) 29.162 + bt = BoolTest::gt; 29.163 + else 29.164 + ShouldNotReachHere(); 29.165 + } 29.166 + set_subtree_ctrl( limit ); 29.167 + 29.168 + } else { // LoopLimitCheck 29.169 + 29.170 // If compare points to incr, we are ok. Otherwise the compare 29.171 // can directly point to the phi; in this case adjust the compare so that 29.172 // it points to the incr by adjusting the limit. 29.173 @@ -359,7 +485,6 @@ 29.174 Node *one_m = gvn->intcon(-1); 29.175 29.176 Node *trip_count = NULL; 29.177 - Node *hook = new (C, 6) Node(6); 29.178 switch( bt ) { 29.179 case BoolTest::eq: 29.180 ShouldNotReachHere(); 29.181 @@ -441,6 +566,8 @@ 29.182 limit = gvn->transform(new (C, 3) AddINode(span,init_trip)); 29.183 set_subtree_ctrl( limit ); 29.184 29.185 + } // LoopLimitCheck 29.186 + 29.187 // Check for SafePoint on backedge and remove 29.188 Node *sfpt = x->in(LoopNode::LoopBackControl); 29.189 if (sfpt->Opcode() == Op_SafePoint && is_deleteable_safept(sfpt)) { 29.190 @@ -531,7 +658,7 @@ 29.191 29.192 // Check for immediately preceding SafePoint and remove 29.193 Node *sfpt2 = le->in(0); 29.194 - if( sfpt2->Opcode() == Op_SafePoint && is_deleteable_safept(sfpt2)) 29.195 + if (sfpt2->Opcode() == Op_SafePoint && is_deleteable_safept(sfpt2)) 29.196 lazy_replace( sfpt2, sfpt2->in(TypeFunc::Control)); 29.197 29.198 // Free up intermediate goo 29.199 @@ -541,12 +668,56 @@ 29.200 assert(l->is_valid_counted_loop(), "counted loop shape is messed up"); 29.201 assert(l == loop->_head && l->phi() == phi && l->loopexit() == lex, "" ); 29.202 #endif 29.203 +#ifndef PRODUCT 29.204 + if (TraceLoopOpts) { 29.205 + tty->print("Counted "); 29.206 + loop->dump_head(); 29.207 + } 29.208 +#endif 29.209 29.210 C->print_method("After CountedLoop", 3); 29.211 29.212 return true; 29.213 } 29.214 29.215 +//----------------------exact_limit------------------------------------------- 29.216 +Node* PhaseIdealLoop::exact_limit( IdealLoopTree *loop ) { 29.217 + assert(loop->_head->is_CountedLoop(), ""); 29.218 + CountedLoopNode *cl = loop->_head->as_CountedLoop(); 29.219 + 29.220 + if (!LoopLimitCheck || ABS(cl->stride_con()) == 1 || 29.221 + cl->limit()->Opcode() == Op_LoopLimit) { 29.222 + // Old code has exact limit (it could be incorrect in case of int overflow). 29.223 + // Loop limit is exact with stride == 1. And loop may already have exact limit. 29.224 + return cl->limit(); 29.225 + } 29.226 + Node *limit = NULL; 29.227 +#ifdef ASSERT 29.228 + BoolTest::mask bt = cl->loopexit()->test_trip(); 29.229 + assert(bt == BoolTest::lt || bt == BoolTest::gt, "canonical test is expected"); 29.230 +#endif 29.231 + if (cl->has_exact_trip_count()) { 29.232 + // Simple case: loop has constant boundaries. 29.233 + // Use longs to avoid integer overflow. 29.234 + int stride_con = cl->stride_con(); 29.235 + long init_con = cl->init_trip()->get_int(); 29.236 + long limit_con = cl->limit()->get_int(); 29.237 + julong trip_cnt = cl->trip_count(); 29.238 + long final_con = init_con + trip_cnt*stride_con; 29.239 + final_con -= stride_con; 29.240 + int final_int = (int)final_con; 29.241 + // The final value should be in integer range since the loop 29.242 + // is counted and the limit was checked for overflow. 29.243 + assert(final_con == (long)final_int, "final value should be integer"); 29.244 + limit = _igvn.intcon(final_int); 29.245 + } else { 29.246 + // Create new LoopLimit node to get exact limit (final iv value). 29.247 + limit = new (C, 4) LoopLimitNode(C, cl->init_trip(), cl->limit(), cl->stride()); 29.248 + register_new_node(limit, cl->in(LoopNode::EntryControl)); 29.249 + } 29.250 + assert(limit != NULL, "sanity"); 29.251 + return limit; 29.252 +} 29.253 29.254 //------------------------------Ideal------------------------------------------ 29.255 // Return a node which is more "ideal" than the current node. 29.256 @@ -572,14 +743,12 @@ 29.257 #ifndef PRODUCT 29.258 void CountedLoopNode::dump_spec(outputStream *st) const { 29.259 LoopNode::dump_spec(st); 29.260 - if( stride_is_con() ) { 29.261 + if (stride_is_con()) { 29.262 st->print("stride: %d ",stride_con()); 29.263 - } else { 29.264 - st->print("stride: not constant "); 29.265 } 29.266 - if( is_pre_loop () ) st->print("pre of N%d" , _main_idx ); 29.267 - if( is_main_loop() ) st->print("main of N%d", _idx ); 29.268 - if( is_post_loop() ) st->print("post of N%d", _main_idx ); 29.269 + if (is_pre_loop ()) st->print("pre of N%d" , _main_idx); 29.270 + if (is_main_loop()) st->print("main of N%d", _idx); 29.271 + if (is_post_loop()) st->print("post of N%d", _main_idx); 29.272 } 29.273 #endif 29.274 29.275 @@ -588,7 +757,130 @@ 29.276 return stride()->bottom_type()->is_int()->get_con(); 29.277 } 29.278 29.279 - 29.280 +//============================================================================= 29.281 +//------------------------------Value----------------------------------------- 29.282 +const Type *LoopLimitNode::Value( PhaseTransform *phase ) const { 29.283 + const Type* init_t = phase->type(in(Init)); 29.284 + const Type* limit_t = phase->type(in(Limit)); 29.285 + const Type* stride_t = phase->type(in(Stride)); 29.286 + // Either input is TOP ==> the result is TOP 29.287 + if (init_t == Type::TOP) return Type::TOP; 29.288 + if (limit_t == Type::TOP) return Type::TOP; 29.289 + if (stride_t == Type::TOP) return Type::TOP; 29.290 + 29.291 + int stride_con = stride_t->is_int()->get_con(); 29.292 + if (stride_con == 1) 29.293 + return NULL; // Identity 29.294 + 29.295 + if (init_t->is_int()->is_con() && limit_t->is_int()->is_con()) { 29.296 + // Use longs to avoid integer overflow. 29.297 + long init_con = init_t->is_int()->get_con(); 29.298 + long limit_con = limit_t->is_int()->get_con(); 29.299 + int stride_m = stride_con - (stride_con > 0 ? 1 : -1); 29.300 + long trip_count = (limit_con - init_con + stride_m)/stride_con; 29.301 + long final_con = init_con + stride_con*trip_count; 29.302 + int final_int = (int)final_con; 29.303 + // The final value should be in integer range since the loop 29.304 + // is counted and the limit was checked for overflow. 29.305 + assert(final_con == (long)final_int, "final value should be integer"); 29.306 + return TypeInt::make(final_int); 29.307 + } 29.308 + 29.309 + return bottom_type(); // TypeInt::INT 29.310 +} 29.311 + 29.312 +//------------------------------Ideal------------------------------------------ 29.313 +// Return a node which is more "ideal" than the current node. 29.314 +Node *LoopLimitNode::Ideal(PhaseGVN *phase, bool can_reshape) { 29.315 + if (phase->type(in(Init)) == Type::TOP || 29.316 + phase->type(in(Limit)) == Type::TOP || 29.317 + phase->type(in(Stride)) == Type::TOP) 29.318 + return NULL; // Dead 29.319 + 29.320 + int stride_con = phase->type(in(Stride))->is_int()->get_con(); 29.321 + if (stride_con == 1) 29.322 + return NULL; // Identity 29.323 + 29.324 + if (in(Init)->is_Con() && in(Limit)->is_Con()) 29.325 + return NULL; // Value 29.326 + 29.327 + // Delay following optimizations until all loop optimizations 29.328 + // done to keep Ideal graph simple. 29.329 + if (!can_reshape || phase->C->major_progress()) 29.330 + return NULL; 29.331 + 29.332 + const TypeInt* init_t = phase->type(in(Init) )->is_int(); 29.333 + const TypeInt* limit_t = phase->type(in(Limit))->is_int(); 29.334 + int stride_p; 29.335 + long lim, ini; 29.336 + julong max; 29.337 + if (stride_con > 0) { 29.338 + stride_p = stride_con; 29.339 + lim = limit_t->_hi; 29.340 + ini = init_t->_lo; 29.341 + max = (julong)max_jint; 29.342 + } else { 29.343 + stride_p = -stride_con; 29.344 + lim = init_t->_hi; 29.345 + ini = limit_t->_lo; 29.346 + max = (julong)min_jint; 29.347 + } 29.348 + julong range = lim - ini + stride_p; 29.349 + if (range <= max) { 29.350 + // Convert to integer expression if it is not overflow. 29.351 + Node* stride_m = phase->intcon(stride_con - (stride_con > 0 ? 1 : -1)); 29.352 + Node *range = phase->transform(new (phase->C, 3) SubINode(in(Limit), in(Init))); 29.353 + Node *bias = phase->transform(new (phase->C, 3) AddINode(range, stride_m)); 29.354 + Node *trip = phase->transform(new (phase->C, 3) DivINode(0, bias, in(Stride))); 29.355 + Node *span = phase->transform(new (phase->C, 3) MulINode(trip, in(Stride))); 29.356 + return new (phase->C, 3) AddINode(span, in(Init)); // exact limit 29.357 + } 29.358 + 29.359 + if (is_power_of_2(stride_p) || // divisor is 2^n 29.360 + !Matcher::has_match_rule(Op_LoopLimit)) { // or no specialized Mach node? 29.361 + // Convert to long expression to avoid integer overflow 29.362 + // and let igvn optimizer convert this division. 29.363 + // 29.364 + Node* init = phase->transform( new (phase->C, 2) ConvI2LNode(in(Init))); 29.365 + Node* limit = phase->transform( new (phase->C, 2) ConvI2LNode(in(Limit))); 29.366 + Node* stride = phase->longcon(stride_con); 29.367 + Node* stride_m = phase->longcon(stride_con - (stride_con > 0 ? 1 : -1)); 29.368 + 29.369 + Node *range = phase->transform(new (phase->C, 3) SubLNode(limit, init)); 29.370 + Node *bias = phase->transform(new (phase->C, 3) AddLNode(range, stride_m)); 29.371 + Node *span; 29.372 + if (stride_con > 0 && is_power_of_2(stride_p)) { 29.373 + // bias >= 0 if stride >0, so if stride is 2^n we can use &(-stride) 29.374 + // and avoid generating rounding for division. Zero trip guard should 29.375 + // guarantee that init < limit but sometimes the guard is missing and 29.376 + // we can get situation when init > limit. Note, for the empty loop 29.377 + // optimization zero trip guard is generated explicitly which leaves 29.378 + // only RCE predicate where exact limit is used and the predicate 29.379 + // will simply fail forcing recompilation. 29.380 + Node* neg_stride = phase->longcon(-stride_con); 29.381 + span = phase->transform(new (phase->C, 3) AndLNode(bias, neg_stride)); 29.382 + } else { 29.383 + Node *trip = phase->transform(new (phase->C, 3) DivLNode(0, bias, stride)); 29.384 + span = phase->transform(new (phase->C, 3) MulLNode(trip, stride)); 29.385 + } 29.386 + // Convert back to int 29.387 + Node *span_int = phase->transform(new (phase->C, 2) ConvL2INode(span)); 29.388 + return new (phase->C, 3) AddINode(span_int, in(Init)); // exact limit 29.389 + } 29.390 + 29.391 + return NULL; // No progress 29.392 +} 29.393 + 29.394 +//------------------------------Identity--------------------------------------- 29.395 +// If stride == 1 return limit node. 29.396 +Node *LoopLimitNode::Identity( PhaseTransform *phase ) { 29.397 + int stride_con = phase->type(in(Stride))->is_int()->get_con(); 29.398 + if (stride_con == 1 || stride_con == -1) 29.399 + return in(Limit); 29.400 + return this; 29.401 +} 29.402 + 29.403 +//============================================================================= 29.404 //----------------------match_incr_with_optional_truncation-------------------- 29.405 // Match increment with optional truncation: 29.406 // CHAR: (i+1)&0x7fff, BYTE: ((i+1)<<8)>>8, or SHORT: ((i+1)<<16)>>16 29.407 @@ -870,7 +1162,7 @@ 29.408 outer = igvn.register_new_node_with_optimizer(outer, _head); 29.409 phase->set_created_loop_node(); 29.410 29.411 - Node* pred = phase->clone_loop_predicates(ctl, outer); 29.412 + Node* pred = phase->clone_loop_predicates(ctl, outer, true); 29.413 // Outermost loop falls into '_head' loop 29.414 _head->set_req(LoopNode::EntryControl, pred); 29.415 _head->del_req(outer_idx); 29.416 @@ -1440,9 +1732,16 @@ 29.417 tty->print(" "); 29.418 tty->print("Loop: N%d/N%d ",_head->_idx,_tail->_idx); 29.419 if (_irreducible) tty->print(" IRREDUCIBLE"); 29.420 + Node* entry = _head->in(LoopNode::EntryControl); 29.421 + if (LoopLimitCheck) { 29.422 + Node* predicate = PhaseIdealLoop::find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 29.423 + if (predicate != NULL ) { 29.424 + tty->print(" limit_check"); 29.425 + entry = entry->in(0)->in(0); 29.426 + } 29.427 + } 29.428 if (UseLoopPredicate) { 29.429 - Node* entry = PhaseIdealLoop::find_predicate_insertion_point(_head->in(LoopNode::EntryControl), 29.430 - Deoptimization::Reason_predicate); 29.431 + entry = PhaseIdealLoop::find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 29.432 if (entry != NULL) { 29.433 tty->print(" predicated"); 29.434 } 29.435 @@ -1528,10 +1827,15 @@ 29.436 !loop->tail()->is_top()) { 29.437 LoopNode* lpn = loop->_head->as_Loop(); 29.438 Node* entry = lpn->in(LoopNode::EntryControl); 29.439 - Node* predicate_proj = find_predicate(entry); 29.440 + Node* predicate_proj = find_predicate(entry); // loop_limit_check first 29.441 if (predicate_proj != NULL ) { // right pattern that can be used by loop predication 29.442 assert(entry->in(0)->in(1)->in(1)->Opcode() == Op_Opaque1, "must be"); 29.443 useful_predicates.push(entry->in(0)->in(1)->in(1)); // good one 29.444 + entry = entry->in(0)->in(0); 29.445 + } 29.446 + predicate_proj = find_predicate(entry); // Predicate 29.447 + if (predicate_proj != NULL ) { 29.448 + useful_predicates.push(entry->in(0)->in(1)->in(1)); // good one 29.449 } 29.450 } 29.451 29.452 @@ -1542,6 +1846,8 @@ 29.453 29.454 //------------------------eliminate_useless_predicates----------------------------- 29.455 // Eliminate all inserted predicates if they could not be used by loop predication. 29.456 +// Note: it will also eliminates loop limits check predicate since it also uses 29.457 +// Opaque1 node (see Parse::add_predicate()). 29.458 void PhaseIdealLoop::eliminate_useless_predicates() { 29.459 if (C->predicate_count() == 0) 29.460 return; // no predicate left 29.461 @@ -1731,7 +2037,7 @@ 29.462 // Some parser-inserted loop predicates could never be used by loop 29.463 // predication or they were moved away from loop during some optimizations. 29.464 // For example, peeling. Eliminate them before next loop optimizations. 29.465 - if (UseLoopPredicate) { 29.466 + if (UseLoopPredicate || LoopLimitCheck) { 29.467 eliminate_useless_predicates(); 29.468 } 29.469
30.1 --- a/src/share/vm/opto/loopnode.hpp Wed May 11 15:47:12 2011 -0700 30.2 +++ b/src/share/vm/opto/loopnode.hpp Thu May 12 15:05:22 2011 -0700 30.3 @@ -289,6 +289,28 @@ 30.4 inline Node *CountedLoopNode::incr() const { return loopexit() ? loopexit()->incr() : NULL; } 30.5 inline Node *CountedLoopNode::phi() const { return loopexit() ? loopexit()->phi() : NULL; } 30.6 30.7 +//------------------------------LoopLimitNode----------------------------- 30.8 +// Counted Loop limit node which represents exact final iterator value: 30.9 +// trip_count = (limit - init_trip + stride - 1)/stride 30.10 +// final_value= trip_count * stride + init_trip. 30.11 +// Use HW instructions to calculate it when it can overflow in integer. 30.12 +// Note, final_value should fit into integer since counted loop has 30.13 +// limit check: limit <= max_int-stride. 30.14 +class LoopLimitNode : public Node { 30.15 + enum { Init=1, Limit=2, Stride=3 }; 30.16 + public: 30.17 + LoopLimitNode( Compile* C, Node *init, Node *limit, Node *stride ) : Node(0,init,limit,stride) { 30.18 + // Put it on the Macro nodes list to optimize during macro nodes expansion. 30.19 + init_flags(Flag_is_macro); 30.20 + C->add_macro_node(this); 30.21 + } 30.22 + virtual int Opcode() const; 30.23 + virtual const Type *bottom_type() const { return TypeInt::INT; } 30.24 + virtual uint ideal_reg() const { return Op_RegI; } 30.25 + virtual const Type *Value( PhaseTransform *phase ) const; 30.26 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 30.27 + virtual Node *Identity( PhaseTransform *phase ); 30.28 +}; 30.29 30.30 // -----------------------------IdealLoopTree---------------------------------- 30.31 class IdealLoopTree : public ResourceObj { 30.32 @@ -775,6 +797,8 @@ 30.33 30.34 bool is_counted_loop( Node *x, IdealLoopTree *loop ); 30.35 30.36 + Node* exact_limit( IdealLoopTree *loop ); 30.37 + 30.38 // Return a post-walked LoopNode 30.39 IdealLoopTree *get_loop( Node *n ) const { 30.40 // Dead nodes have no loop, so return the top level loop instead 30.41 @@ -837,7 +861,6 @@ 30.42 bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset, int depth = 0); 30.43 30.44 // Return true if proj is for "proj->[region->..]call_uct" 30.45 - // Return true if proj is for "proj->[region->..]call_uct" 30.46 static bool is_uncommon_trap_proj(ProjNode* proj, Deoptimization::DeoptReason reason); 30.47 // Return true for "if(test)-> proj -> ... 30.48 // | 30.49 @@ -860,10 +883,11 @@ 30.50 PhaseIterGVN* igvn); 30.51 static Node* clone_loop_predicates(Node* old_entry, Node* new_entry, 30.52 bool move_predicates, 30.53 + bool clone_limit_check, 30.54 PhaseIdealLoop* loop_phase, 30.55 PhaseIterGVN* igvn); 30.56 - Node* clone_loop_predicates(Node* old_entry, Node* new_entry); 30.57 - Node* move_loop_predicates(Node* old_entry, Node* new_entry); 30.58 + Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check); 30.59 + Node* move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check); 30.60 30.61 void eliminate_loop_predicates(Node* entry); 30.62 static Node* skip_loop_predicates(Node* entry); 30.63 @@ -873,7 +897,7 @@ 30.64 // Find a predicate 30.65 static Node* find_predicate(Node* entry); 30.66 // Construct a range check for a predicate if 30.67 - BoolNode* rc_predicate(Node* ctrl, 30.68 + BoolNode* rc_predicate(IdealLoopTree *loop, Node* ctrl, 30.69 int scale, Node* offset, 30.70 Node* init, Node* limit, Node* stride, 30.71 Node* range, bool upper); 30.72 @@ -903,11 +927,11 @@ 30.73 30.74 // Range Check Elimination uses this function! 30.75 // Constrain the main loop iterations so the affine function: 30.76 - // scale_con * I + offset < limit 30.77 + // low_limit <= scale_con * I + offset < upper_limit 30.78 // always holds true. That is, either increase the number of iterations in 30.79 // the pre-loop or the post-loop until the condition holds true in the main 30.80 // loop. Scale_con, offset and limit are all loop invariant. 30.81 - void add_constraint( int stride_con, int scale_con, Node *offset, Node *limit, Node *pre_ctrl, Node **pre_limit, Node **main_limit ); 30.82 + void add_constraint( int stride_con, int scale_con, Node *offset, Node *low_limit, Node *upper_limit, Node *pre_ctrl, Node **pre_limit, Node **main_limit ); 30.83 30.84 // Partially peel loop up through last_peel node. 30.85 bool partial_peel( IdealLoopTree *loop, Node_List &old_new );
31.1 --- a/src/share/vm/opto/macro.cpp Wed May 11 15:47:12 2011 -0700 31.2 +++ b/src/share/vm/opto/macro.cpp Thu May 12 15:05:22 2011 -0700 31.3 @@ -2154,6 +2154,11 @@ 31.4 debug_only(int old_macro_count = C->macro_count();); 31.5 if (n->is_AbstractLock()) { 31.6 success = eliminate_locking_node(n->as_AbstractLock()); 31.7 + } else if (n->Opcode() == Op_LoopLimit) { 31.8 + // Remove it from macro list and put on IGVN worklist to optimize. 31.9 + C->remove_macro_node(n); 31.10 + _igvn._worklist.push(n); 31.11 + success = true; 31.12 } else if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) { 31.13 _igvn.replace_node(n, n->in(1)); 31.14 success = true;
32.1 --- a/src/share/vm/opto/matcher.cpp Wed May 11 15:47:12 2011 -0700 32.2 +++ b/src/share/vm/opto/matcher.cpp Thu May 12 15:05:22 2011 -0700 32.3 @@ -2086,6 +2086,13 @@ 32.4 n->del_req(3); 32.5 break; 32.6 } 32.7 + case Op_LoopLimit: { 32.8 + Node *pair1 = new (C, 3) BinaryNode(n->in(1),n->in(2)); 32.9 + n->set_req(1,pair1); 32.10 + n->set_req(2,n->in(3)); 32.11 + n->del_req(3); 32.12 + break; 32.13 + } 32.14 case Op_StrEquals: { 32.15 Node *pair1 = new (C, 3) BinaryNode(n->in(2),n->in(3)); 32.16 n->set_req(2,pair1);
33.1 --- a/src/share/vm/opto/parse.hpp Wed May 11 15:47:12 2011 -0700 33.2 +++ b/src/share/vm/opto/parse.hpp Thu May 12 15:05:22 2011 -0700 33.3 @@ -70,7 +70,7 @@ 33.4 const char* try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result); 33.5 const char* shouldInline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) const; 33.6 const char* shouldNotInline(ciMethod* callee_method, ciMethod* caller_method, WarmCallInfo* wci_result) const; 33.7 - void print_inlining(ciMethod *callee_method, int caller_bci, const char *failure_msg) const PRODUCT_RETURN; 33.8 + void print_inlining(ciMethod *callee_method, int caller_bci, const char *failure_msg) const; 33.9 33.10 InlineTree *caller_tree() const { return _caller_tree; } 33.11 InlineTree* callee_at(int bci, ciMethod* m) const;
34.1 --- a/src/share/vm/opto/parse1.cpp Wed May 11 15:47:12 2011 -0700 34.2 +++ b/src/share/vm/opto/parse1.cpp Thu May 12 15:05:22 2011 -0700 34.3 @@ -638,7 +638,7 @@ 34.4 ensure_phis_everywhere(); 34.5 34.6 if (block->is_SEL_head() && 34.7 - UseLoopPredicate) { 34.8 + (UseLoopPredicate || LoopLimitCheck)) { 34.9 // Add predicate to single entry (not irreducible) loop head. 34.10 assert(!block->has_merged_backedge(), "only entry paths should be merged for now"); 34.11 // Need correct bci for predicate.
35.1 --- a/src/share/vm/opto/phaseX.hpp Wed May 11 15:47:12 2011 -0700 35.2 +++ b/src/share/vm/opto/phaseX.hpp Thu May 12 15:05:22 2011 -0700 35.3 @@ -472,8 +472,8 @@ 35.4 } 35.5 35.6 // Clone loop predicates. Defined in loopTransform.cpp. 35.7 - Node* clone_loop_predicates(Node* old_entry, Node* new_entry); 35.8 - Node* move_loop_predicates(Node* old_entry, Node* new_entry); 35.9 + Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check); 35.10 + Node* move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check); 35.11 // Create a new if below new_entry for the predicate to be cloned 35.12 ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry, 35.13 Deoptimization::DeoptReason reason);
36.1 --- a/src/share/vm/opto/subnode.cpp Wed May 11 15:47:12 2011 -0700 36.2 +++ b/src/share/vm/opto/subnode.cpp Thu May 12 15:05:22 2011 -0700 36.3 @@ -1223,21 +1223,6 @@ 36.4 } 36.5 36.6 //============================================================================= 36.7 -//------------------------------NegNode---------------------------------------- 36.8 -Node *NegFNode::Ideal(PhaseGVN *phase, bool can_reshape) { 36.9 - if( in(1)->Opcode() == Op_SubF ) 36.10 - return new (phase->C, 3) SubFNode( in(1)->in(2), in(1)->in(1) ); 36.11 - return NULL; 36.12 -} 36.13 - 36.14 -Node *NegDNode::Ideal(PhaseGVN *phase, bool can_reshape) { 36.15 - if( in(1)->Opcode() == Op_SubD ) 36.16 - return new (phase->C, 3) SubDNode( in(1)->in(2), in(1)->in(1) ); 36.17 - return NULL; 36.18 -} 36.19 - 36.20 - 36.21 -//============================================================================= 36.22 //------------------------------Value------------------------------------------ 36.23 // Compute sqrt 36.24 const Type *SqrtDNode::Value( PhaseTransform *phase ) const {
37.1 --- a/src/share/vm/opto/subnode.hpp Wed May 11 15:47:12 2011 -0700 37.2 +++ b/src/share/vm/opto/subnode.hpp Thu May 12 15:05:22 2011 -0700 37.3 @@ -377,7 +377,6 @@ 37.4 public: 37.5 NegFNode( Node *in1 ) : NegNode(in1) {} 37.6 virtual int Opcode() const; 37.7 - virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 37.8 const Type *bottom_type() const { return Type::FLOAT; } 37.9 virtual uint ideal_reg() const { return Op_RegF; } 37.10 }; 37.11 @@ -391,7 +390,6 @@ 37.12 public: 37.13 NegDNode( Node *in1 ) : NegNode(in1) {} 37.14 virtual int Opcode() const; 37.15 - virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 37.16 const Type *bottom_type() const { return Type::DOUBLE; } 37.17 virtual uint ideal_reg() const { return Op_RegD; } 37.18 };
38.1 --- a/src/share/vm/prims/jvmti.xml Wed May 11 15:47:12 2011 -0700 38.2 +++ b/src/share/vm/prims/jvmti.xml Thu May 12 15:05:22 2011 -0700 38.3 @@ -280,10 +280,8 @@ 38.4 <!ELEMENT externallink (#PCDATA|jvmti|code|i|b|tm)*> 38.5 <!ATTLIST externallink id CDATA #REQUIRED> 38.6 38.7 - <!ELEMENT vmspeclink EMPTY> 38.8 - <!ATTLIST vmspeclink id CDATA #IMPLIED> 38.9 - <!ATTLIST vmspeclink name CDATA #IMPLIED> 38.10 - <!ATTLIST vmspeclink preposition CDATA #IMPLIED> 38.11 + <!ELEMENT vmspec EMPTY> 38.12 + <!ATTLIST vmspec chapter CDATA #IMPLIED> 38.13 38.14 <!ELEMENT internallink (#PCDATA|jvmti|code|i|b)*> 38.15 <!ATTLIST internallink id CDATA #REQUIRED> 38.16 @@ -2285,9 +2283,8 @@ 38.17 Stack frames are referenced by depth. 38.18 The frame at depth zero is the current frame. 38.19 <p/> 38.20 - Stack frames are as described in the 38.21 - <vmspeclink id="Overview.doc.html#17257" 38.22 - name="Frames section"/>. 38.23 + Stack frames are as described in 38.24 + <vmspec chapter="3.6"/>, 38.25 That is, they correspond to method 38.26 invocations (including native methods) but do not correspond to platform native or 38.27 VM internal frames. 38.28 @@ -2627,7 +2624,7 @@ 38.29 <param id="use_java_stack"> 38.30 <jboolean/> 38.31 <description> 38.32 - Return the stack showing the <vmspeclink/> 38.33 + Return the stack showing <vmspec/> 38.34 model of the stack; 38.35 otherwise, show the internal representation of the stack with 38.36 inlined and optimized methods missing. If the virtual machine 38.37 @@ -2707,7 +2704,7 @@ 38.38 When the thread is resumed, the execution 38.39 state of the thread is reset to the state 38.40 immediately before the called method was invoked. 38.41 - That is (using the <vmspeclink/> terminology): 38.42 + That is (using <vmspec/> terminology): 38.43 <ul> 38.44 <li>the current frame is discarded as the previous frame becomes the current one</li> 38.45 <li>the operand stack is restored--the argument values are added back 38.46 @@ -2868,9 +2865,8 @@ 38.47 to return at any point during its execution. 38.48 The method which will return early is referred to as the <i>called method</i>. 38.49 The called method is the current method 38.50 - (as defined by the 38.51 - <vmspeclink id="Overview.doc.html#17257" 38.52 - name="Frames section"/>) 38.53 + (as defined by 38.54 + <vmspec chapter="3.6"/>) 38.55 for the specified thread at 38.56 the time the function is called. 38.57 <p/> 38.58 @@ -3576,10 +3572,8 @@ 38.59 <field id="index"> 38.60 <jint/> 38.61 <description> 38.62 - The index into the constant pool of the class. See the 38.63 - <vmspeclink id="ClassFile.doc.html#20080" 38.64 - name="Constant Pool section"/> 38.65 - description. 38.66 + The index into the constant pool of the class. See the description in 38.67 + <vmspec chapter="4.4"/>. 38.68 </description> 38.69 </field> 38.70 </typedef> 38.71 @@ -5006,9 +5000,8 @@ 38.72 For references of this kind the <code>referrer_index</code> 38.73 parameter to the <internallink id="jvmtiObjectReferenceCallback"> 38.74 jvmtiObjectReferenceCallback</internallink> is the index into 38.75 - constant pool table of the class, starting at 1. See the 38.76 - <vmspeclink id="ClassFile.doc.html#20080" 38.77 - name="Constant Pool section"/> 38.78 + constant pool table of the class, starting at 1. See 38.79 + <vmspec chapter="4.4"/>. 38.80 </constant> 38.81 </constants> 38.82 38.83 @@ -6441,9 +6434,7 @@ 38.84 been recorded as an initiating loader. Each 38.85 class in the returned array was created by this class loader, 38.86 either by defining it directly or by delegation to another class loader. 38.87 - See the 38.88 - <vmspeclink id="ConstantPool.doc.html#72007" 38.89 - name="Creation and Loading section"/>. 38.90 + See <vmspec chapter="5.3"/>. 38.91 <p/> 38.92 For JDK version 1.1 implementations that don't 38.93 recognize the distinction between initiating and defining class loaders, 38.94 @@ -6626,9 +6617,7 @@ 38.95 For the class indicated by <code>klass</code>, return the access 38.96 flags 38.97 via <code>modifiers_ptr</code>. 38.98 - Access flags are defined in the 38.99 - <vmspeclink id="ClassFile.doc.html" 38.100 - name="Class File Format chapter"/>. 38.101 + Access flags are defined in <vmspec chapter="4"/>. 38.102 <p/> 38.103 If the class is an array class, then its public, private, and protected 38.104 modifiers are the same as those of its component type. For arrays of 38.105 @@ -6794,9 +6783,8 @@ 38.106 <description> 38.107 For the class indicated by <code>klass</code>, 38.108 return the minor and major version numbers, 38.109 - as defined in the 38.110 - <vmspeclink id="ClassFile.doc.html" 38.111 - name="Class File Format chapter"/>. 38.112 + as defined in 38.113 + <vmspec chapter="4"/>. 38.114 </description> 38.115 <origin>new</origin> 38.116 <capabilities> 38.117 @@ -6839,10 +6827,8 @@ 38.118 <description> 38.119 For the class indicated by <code>klass</code>, 38.120 return the raw bytes of the constant pool in the format of the 38.121 - <code>constant_pool</code> item of the 38.122 - <vmspeclink id="ClassFile.doc.html" 38.123 - name="Class File Format" 38.124 - preposition="in"/>. 38.125 + <code>constant_pool</code> item of 38.126 + <vmspec chapter="4"/>. 38.127 The format of the constant pool may differ between versions 38.128 of the Class File Format, so, the 38.129 <functionlink id="GetClassVersionNumbers">minor and major 38.130 @@ -7286,9 +7272,7 @@ 38.131 <field id="class_bytes"> 38.132 <inbuf incount="class_byte_count"><uchar/></inbuf> 38.133 <description> 38.134 - Bytes defining class (in the 38.135 - <vmspeclink id="ClassFile.doc.html" 38.136 - name="Class File Format"/>) 38.137 + Bytes defining class (in <vmspec chapter="4"/>) 38.138 </description> 38.139 </field> 38.140 </typedef> 38.141 @@ -7611,10 +7595,8 @@ 38.142 <paramlink id="signature_ptr"/>. 38.143 <p/> 38.144 Field signatures are defined in the JNI Specification and 38.145 - are referred to as 38.146 - <vmspeclink id="ClassFile.doc.html#14152" 38.147 - name="field descriptors" 38.148 - preposition="in"/>. 38.149 + are referred to as <code>field descriptors</code> in 38.150 + <vmspec chapter="4.3.2"/>. 38.151 </description> 38.152 <origin>jvmdiClone</origin> 38.153 <capabilities> 38.154 @@ -7709,9 +7691,7 @@ 38.155 <description> 38.156 For the field indicated by <code>klass</code> and <code>field</code> 38.157 return the access flags via <code>modifiers_ptr</code>. 38.158 - Access flags are defined in the 38.159 - <vmspeclink id="ClassFile.doc.html" 38.160 - name="Class File Format chapter"/>. 38.161 + Access flags are defined in <vmspec chapter="4"/>. 38.162 </description> 38.163 <origin>jvmdi</origin> 38.164 <capabilities> 38.165 @@ -7810,10 +7790,9 @@ 38.166 return the method name via <code>name_ptr</code> and method signature via 38.167 <code>signature_ptr</code>. 38.168 <p/> 38.169 - Method signatures are defined in the JNI Specification and are referred to as 38.170 - <vmspeclink id="ClassFile.doc.html#7035" 38.171 - name="method descriptors" 38.172 - preposition="in"/>. 38.173 + Method signatures are defined in the JNI Specification and are 38.174 + referred to as <code>method descriptors</code> in 38.175 + <vmspec chapter="4.3.3"/>. 38.176 Note this is different 38.177 than method signatures as defined in the <i>Java Language Specification</i>. 38.178 </description> 38.179 @@ -7902,9 +7881,7 @@ 38.180 <description> 38.181 For the method indicated by <code>method</code>, 38.182 return the access flags via <code>modifiers_ptr</code>. 38.183 - Access flags are defined in the 38.184 - <vmspeclink id="ClassFile.doc.html" 38.185 - name="Class File Format chapter"/>. 38.186 + Access flags are defined in <vmspec chapter="4"/>. 38.187 </description> 38.188 <origin>jvmdi</origin> 38.189 <capabilities> 38.190 @@ -7941,9 +7918,7 @@ 38.191 including the local variables used to pass parameters to the 38.192 method on its invocation. 38.193 <p/> 38.194 - See <code>max_locals</code> in the 38.195 - <vmspeclink id="ClassFile.doc.html#1546" 38.196 - name="Code Attribute section"/>. 38.197 + See <code>max_locals</code> in <vmspec chapter="4.7.3"/>. 38.198 </description> 38.199 <origin>jvmdi</origin> 38.200 <capabilities> 38.201 @@ -8150,8 +8125,7 @@ 38.202 The local variable's type signature, encoded as a 38.203 <internallink id="mUTF">modified UTF-8</internallink> string. 38.204 The signature format is the same as that defined in 38.205 - <vmspeclink id="ClassFile.doc.html#14152" 38.206 - name="Field Descriptors section"/> 38.207 + <vmspec chapter="4.3.2"/>. 38.208 </description> 38.209 </field> 38.210 <field id="generic_signature"> 38.211 @@ -10460,10 +10434,7 @@ 38.212 <synopsis>Add To Bootstrap Class Loader Search</synopsis> 38.213 <description> 38.214 This function can be used to cause instrumentation classes to be defined by the 38.215 - bootstrap class loader. See 38.216 - <vmspeclink id="ConstantPool.doc.html#79383" 38.217 - name="Loading Using the Bootstrap Class Loader" 38.218 - preposition="in"/>. 38.219 + bootstrap class loader. See <vmspec chapter="5.3.1"/>. 38.220 After the bootstrap 38.221 class loader unsuccessfully searches for a class, the specified platform-dependent 38.222 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in 38.223 @@ -10480,7 +10451,7 @@ 38.224 contain any classes or resources other than those to be defined by the bootstrap 38.225 class loader for the purposes of instrumentation. 38.226 <p/> 38.227 - The <vmspeclink/> specifies that a subsequent attempt to resolve a symbolic 38.228 + <vmspec/> specifies that a subsequent attempt to resolve a symbolic 38.229 reference that the Java virtual machine has previously unsuccessfully attempted 38.230 to resolve always fails with the same error that was thrown as a result of the 38.231 initial resolution attempt. Consequently, if the JAR file contains an entry 38.232 @@ -10512,10 +10483,7 @@ 38.233 <synopsis>Add To System Class Loader Search</synopsis> 38.234 <description> 38.235 This function can be used to cause instrumentation classes to be 38.236 - defined by the system class loader. See 38.237 - <vmspeclink id="ConstantPool.doc.html#79441" 38.238 - name="Loading Using a User-defined Class Loader" 38.239 - preposition="in"/>. 38.240 + defined by the system class loader. See <vmspec chapter="5.3.2"/>. 38.241 After the class loader unsuccessfully searches for a class, the specified platform-dependent search 38.242 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the 38.243 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the 38.244 @@ -10536,7 +10504,7 @@ 38.245 which takes a single parameter of type <code>java.lang.String</code>. The method is not required 38.246 to have <code>public</code> access. 38.247 <p/> 38.248 - The <vmspeclink/> specifies that a subsequent attempt to resolve a symbolic 38.249 + <vmspec/> specifies that a subsequent attempt to resolve a symbolic 38.250 reference that the Java virtual machine has previously unsuccessfully attempted 38.251 to resolve always fails with the same error that was thrown as a result of the 38.252 initial resolution attempt. Consequently, if the JAR file contains an entry 38.253 @@ -11438,7 +11406,7 @@ 38.254 at the finest granularity allowed by the VM. A single step event is 38.255 generated whenever a thread reaches a new location. 38.256 Typically, single step events represent the completion of one VM 38.257 - instruction as defined in the <vmspeclink/>. However, some implementations 38.258 + instruction as defined in <vmspec/>. However, some implementations 38.259 may define locations differently. In any case the 38.260 <code>method</code> and <code>location</code> 38.261 parameters uniquely identify the current location and allow 38.262 @@ -13841,7 +13809,7 @@ 38.263 and can_get_source_debug_extension. 38.264 PopFrame cannot have a native calling method. 38.265 Removed incorrect statement in GetClassloaderClasses 38.266 - (see http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#79383). 38.267 + (see <vmspec chapter="4.4"/>). 38.268 </change> 38.269 <change date="24 July 2003" version="v79"> 38.270 XML and text fixes.
39.1 --- a/src/share/vm/prims/jvmti.xsl Wed May 11 15:47:12 2011 -0700 39.2 +++ b/src/share/vm/prims/jvmti.xsl Thu May 12 15:05:22 2011 -0700 39.3 @@ -1039,34 +1039,14 @@ 39.4 </a> 39.5 </xsl:template> 39.6 39.7 -<xsl:template match="vmspeclink"> 39.8 - <xsl:if test="count(@id)=1"> 39.9 - <a> 39.10 - <xsl:attribute name="href"> 39.11 - <xsl:text>http://java.sun.com/docs/books/vmspec/2nd-edition/html/</xsl:text> 39.12 - <xsl:value-of select="@id"/> 39.13 - </xsl:attribute> 39.14 - <xsl:value-of select="@name"/> 39.15 - </a> 39.16 - <xsl:text> </xsl:text> 39.17 - <xsl:choose> 39.18 - <xsl:when test="count(@preposition)=1"> 39.19 - <xsl:value-of select="@preposition"/> 39.20 - </xsl:when> 39.21 - <xsl:otherwise> 39.22 - <xsl:text>of</xsl:text> 39.23 - </xsl:otherwise> 39.24 - </xsl:choose> 39.25 - <xsl:text> the </xsl:text> 39.26 - </xsl:if> 39.27 - <a> 39.28 - <xsl:attribute name="href"> 39.29 - <xsl:text>http://java.sun.com/docs/books/vmspec/</xsl:text> 39.30 - </xsl:attribute> 39.31 - <i> 39.32 - <xsl:text>Java Virtual Machine Specification</xsl:text> 39.33 - </i> 39.34 - </a> 39.35 +<xsl:template match="vmspec"> 39.36 + <cite> 39.37 + <xsl:text>The Java™ Virtual Machine Specification</xsl:text> 39.38 + <xsl:if test="count(@chapter)=1"> 39.39 + <xsl:text>, Chapter </xsl:text> 39.40 + <xsl:value-of select="@chapter"/> 39.41 + </xsl:if> 39.42 + </cite> 39.43 </xsl:template> 39.44 39.45 <xsl:template match="internallink">
40.1 --- a/src/share/vm/runtime/arguments.cpp Wed May 11 15:47:12 2011 -0700 40.2 +++ b/src/share/vm/runtime/arguments.cpp Thu May 12 15:05:22 2011 -0700 40.3 @@ -960,7 +960,7 @@ 40.4 // Ensure Agent_OnLoad has the correct initial values. 40.5 // This may not be the final mode; mode may change later in onload phase. 40.6 PropertyList_unique_add(&_system_properties, "java.vm.info", 40.7 - (char*)Abstract_VM_Version::vm_info_string(), false); 40.8 + (char*)VM_Version::vm_info_string(), false); 40.9 40.10 UseInterpreter = true; 40.11 UseCompiler = true; 40.12 @@ -969,10 +969,10 @@ 40.13 #ifndef ZERO 40.14 // Turn these off for mixed and comp. Leave them on for Zero. 40.15 if (FLAG_IS_DEFAULT(UseFastAccessorMethods)) { 40.16 - UseFastAccessorMethods = mode == _int; 40.17 + UseFastAccessorMethods = (mode == _int); 40.18 } 40.19 if (FLAG_IS_DEFAULT(UseFastEmptyMethods)) { 40.20 - UseFastEmptyMethods = mode == _int; 40.21 + UseFastEmptyMethods = (mode == _int); 40.22 } 40.23 #endif 40.24 40.25 @@ -1992,6 +1992,9 @@ 40.26 Arguments::_ClipInlining = ClipInlining; 40.27 Arguments::_BackgroundCompilation = BackgroundCompilation; 40.28 40.29 + // Setup flags for mixed which is the default 40.30 + set_mode_flags(_mixed); 40.31 + 40.32 // Parse JAVA_TOOL_OPTIONS environment variable (if present) 40.33 jint result = parse_java_tool_options_environment_variable(&scp, &scp_assembly_required); 40.34 if (result != JNI_OK) {
41.1 --- a/src/share/vm/runtime/deoptimization.cpp Wed May 11 15:47:12 2011 -0700 41.2 +++ b/src/share/vm/runtime/deoptimization.cpp Thu May 12 15:05:22 2011 -0700 41.3 @@ -189,6 +189,10 @@ 41.4 assert(thread->deopt_nmethod() == NULL, "Pending deopt!"); 41.5 thread->set_deopt_nmethod(deoptee.cb()->as_nmethod_or_null()); 41.6 41.7 + if (VerifyStack) { 41.8 + thread->validate_frame_layout(); 41.9 + } 41.10 + 41.11 // Create a growable array of VFrames where each VFrame represents an inlined 41.12 // Java frame. This storage is allocated with the usual system arena. 41.13 assert(deoptee.is_compiled_frame(), "Wrong frame type"); 41.14 @@ -421,6 +425,21 @@ 41.15 frame deopt_sender = stub_frame.sender(&dummy_map); // First is the deoptee frame 41.16 deopt_sender = deopt_sender.sender(&dummy_map); // Now deoptee caller 41.17 41.18 + // It's possible that the number of paramters at the call site is 41.19 + // different than number of arguments in the callee when method 41.20 + // handles are used. If the caller is interpreted get the real 41.21 + // value so that the proper amount of space can be added to it's 41.22 + // frame. 41.23 + int sender_callee_parameters = callee_parameters; 41.24 + if (deopt_sender.is_interpreted_frame()) { 41.25 + methodHandle method = deopt_sender.interpreter_frame_method(); 41.26 + Bytecode_invoke cur = Bytecode_invoke_check(method, 41.27 + deopt_sender.interpreter_frame_bci()); 41.28 + Symbol* signature = method->constants()->signature_ref_at(cur.index()); 41.29 + ArgumentSizeComputer asc(signature); 41.30 + sender_callee_parameters = asc.size() + (cur.has_receiver() ? 1 : 0); 41.31 + } 41.32 + 41.33 // Compute the amount the oldest interpreter frame will have to adjust 41.34 // its caller's stack by. If the caller is a compiled frame then 41.35 // we pretend that the callee has no parameters so that the 41.36 @@ -435,14 +454,13 @@ 41.37 41.38 if (deopt_sender.is_compiled_frame()) { 41.39 caller_adjustment = last_frame_adjust(0, callee_locals); 41.40 - } else if (callee_locals > callee_parameters) { 41.41 + } else if (callee_locals > sender_callee_parameters) { 41.42 // The caller frame may need extending to accommodate 41.43 // non-parameter locals of the first unpacked interpreted frame. 41.44 // Compute that adjustment. 41.45 - caller_adjustment = last_frame_adjust(callee_parameters, callee_locals); 41.46 + caller_adjustment = last_frame_adjust(sender_callee_parameters, callee_locals); 41.47 } 41.48 41.49 - 41.50 // If the sender is deoptimized the we must retrieve the address of the handler 41.51 // since the frame will "magically" show the original pc before the deopt 41.52 // and we'd undo the deopt. 41.53 @@ -569,6 +587,8 @@ 41.54 if (VerifyStack) { 41.55 ResourceMark res_mark; 41.56 41.57 + thread->validate_frame_layout(); 41.58 + 41.59 // Verify that the just-unpacked frames match the interpreter's 41.60 // notions of expression stack and locals 41.61 vframeArray* cur_array = thread->vframe_array_last(); 41.62 @@ -1753,7 +1773,8 @@ 41.63 "constraint", 41.64 "div0_check", 41.65 "age", 41.66 - "predicate" 41.67 + "predicate", 41.68 + "loop_limit_check" 41.69 }; 41.70 const char* Deoptimization::_trap_action_name[Action_LIMIT] = { 41.71 // Note: Keep this in sync. with enum DeoptAction.
42.1 --- a/src/share/vm/runtime/deoptimization.hpp Wed May 11 15:47:12 2011 -0700 42.2 +++ b/src/share/vm/runtime/deoptimization.hpp Thu May 12 15:05:22 2011 -0700 42.3 @@ -56,6 +56,7 @@ 42.4 Reason_div0_check, // a null_check due to division by zero 42.5 Reason_age, // nmethod too old; tier threshold reached 42.6 Reason_predicate, // compiler generated predicate failed 42.7 + Reason_loop_limit_check, // compiler generated loop limits check failed 42.8 Reason_LIMIT, 42.9 // Note: Keep this enum in sync. with _trap_reason_name. 42.10 Reason_RECORDED_LIMIT = Reason_bimorphic // some are not recorded per bc 42.11 @@ -78,7 +79,7 @@ 42.12 42.13 enum { 42.14 _action_bits = 3, 42.15 - _reason_bits = 4, 42.16 + _reason_bits = 5, 42.17 _action_shift = 0, 42.18 _reason_shift = _action_shift+_action_bits, 42.19 BC_CASE_LIMIT = PRODUCT_ONLY(1) NOT_PRODUCT(4) // for _deoptimization_hist
43.1 --- a/src/share/vm/runtime/frame.cpp Wed May 11 15:47:12 2011 -0700 43.2 +++ b/src/share/vm/runtime/frame.cpp Thu May 12 15:05:22 2011 -0700 43.3 @@ -1308,6 +1308,72 @@ 43.4 guarantee((current - low_mark) % monitor_size == 0 , "Misaligned bottom of BasicObjectLock*"); 43.5 guarantee( current >= low_mark , "Current BasicObjectLock* below than low_mark"); 43.6 } 43.7 + 43.8 + 43.9 +void frame::describe(FrameValues& values, int frame_no) { 43.10 + if (is_entry_frame() || is_compiled_frame() || is_interpreted_frame() || is_native_frame()) { 43.11 + // Label values common to most frames 43.12 + values.describe(-1, unextended_sp(), err_msg("unextended_sp for #%d", frame_no)); 43.13 + values.describe(-1, sp(), err_msg("sp for #%d", frame_no)); 43.14 + values.describe(-1, fp(), err_msg("fp for #%d", frame_no)); 43.15 + } 43.16 + if (is_interpreted_frame()) { 43.17 + methodOop m = interpreter_frame_method(); 43.18 + int bci = interpreter_frame_bci(); 43.19 + 43.20 + // Label the method and current bci 43.21 + values.describe(-1, MAX2(sp(), fp()), 43.22 + FormatBuffer<1024>("#%d method %s @ %d", frame_no, m->name_and_sig_as_C_string(), bci), 2); 43.23 + values.describe(-1, MAX2(sp(), fp()), 43.24 + err_msg("- %d locals %d max stack", m->max_locals(), m->max_stack()), 1); 43.25 + if (m->max_locals() > 0) { 43.26 + intptr_t* l0 = interpreter_frame_local_at(0); 43.27 + intptr_t* ln = interpreter_frame_local_at(m->max_locals() - 1); 43.28 + values.describe(-1, MAX2(l0, ln), err_msg("locals for #%d", frame_no), 1); 43.29 + // Report each local and mark as owned by this frame 43.30 + for (int l = 0; l < m->max_locals(); l++) { 43.31 + intptr_t* l0 = interpreter_frame_local_at(l); 43.32 + values.describe(frame_no, l0, err_msg("local %d", l)); 43.33 + } 43.34 + } 43.35 + 43.36 + // Compute the actual expression stack size 43.37 + InterpreterOopMap mask; 43.38 + OopMapCache::compute_one_oop_map(m, bci, &mask); 43.39 + intptr_t* tos = NULL; 43.40 + // Report each stack element and mark as owned by this frame 43.41 + for (int e = 0; e < mask.expression_stack_size(); e++) { 43.42 + tos = MAX2(tos, interpreter_frame_expression_stack_at(e)); 43.43 + values.describe(frame_no, interpreter_frame_expression_stack_at(e), 43.44 + err_msg("stack %d", e)); 43.45 + } 43.46 + if (tos != NULL) { 43.47 + values.describe(-1, tos, err_msg("expression stack for #%d", frame_no), 1); 43.48 + } 43.49 + if (interpreter_frame_monitor_begin() != interpreter_frame_monitor_end()) { 43.50 + values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_begin(), "monitors begin"); 43.51 + values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_end(), "monitors end"); 43.52 + } 43.53 + } else if (is_entry_frame()) { 43.54 + // For now just label the frame 43.55 + values.describe(-1, MAX2(sp(), fp()), err_msg("#%d entry frame", frame_no), 2); 43.56 + } else if (is_compiled_frame()) { 43.57 + // For now just label the frame 43.58 + nmethod* nm = cb()->as_nmethod_or_null(); 43.59 + values.describe(-1, MAX2(sp(), fp()), 43.60 + FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for method %s%s", frame_no, 43.61 + nm, nm->method()->name_and_sig_as_C_string(), 43.62 + is_deoptimized_frame() ? " (deoptimized" : ""), 2); 43.63 + } else if (is_native_frame()) { 43.64 + // For now just label the frame 43.65 + nmethod* nm = cb()->as_nmethod_or_null(); 43.66 + values.describe(-1, MAX2(sp(), fp()), 43.67 + FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for native method %s", frame_no, 43.68 + nm, nm->method()->name_and_sig_as_C_string()), 2); 43.69 + } 43.70 + describe_pd(values, frame_no); 43.71 +} 43.72 + 43.73 #endif 43.74 43.75 43.76 @@ -1319,3 +1385,71 @@ 43.77 _fr = thread->last_frame(); 43.78 _is_done = false; 43.79 } 43.80 + 43.81 + 43.82 +#ifdef ASSERT 43.83 + 43.84 +void FrameValues::describe(int owner, intptr_t* location, const char* description, int priority) { 43.85 + FrameValue fv; 43.86 + fv.location = location; 43.87 + fv.owner = owner; 43.88 + fv.priority = priority; 43.89 + fv.description = NEW_RESOURCE_ARRAY(char, strlen(description) + 1); 43.90 + strcpy(fv.description, description); 43.91 + _values.append(fv); 43.92 +} 43.93 + 43.94 + 43.95 +bool FrameValues::validate() { 43.96 + _values.sort(compare); 43.97 + bool error = false; 43.98 + FrameValue prev; 43.99 + prev.owner = -1; 43.100 + for (int i = _values.length() - 1; i >= 0; i--) { 43.101 + FrameValue fv = _values.at(i); 43.102 + if (fv.owner == -1) continue; 43.103 + if (prev.owner == -1) { 43.104 + prev = fv; 43.105 + continue; 43.106 + } 43.107 + if (prev.location == fv.location) { 43.108 + if (fv.owner != prev.owner) { 43.109 + tty->print_cr("overlapping storage"); 43.110 + tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", prev.location, *prev.location, prev.description); 43.111 + tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", fv.location, *fv.location, fv.description); 43.112 + error = true; 43.113 + } 43.114 + } else { 43.115 + prev = fv; 43.116 + } 43.117 + } 43.118 + return error; 43.119 +} 43.120 + 43.121 + 43.122 +void FrameValues::print() { 43.123 + _values.sort(compare); 43.124 + intptr_t* v0 = _values.at(0).location; 43.125 + intptr_t* v1 = _values.at(_values.length() - 1).location; 43.126 + intptr_t* min = MIN2(v0, v1); 43.127 + intptr_t* max = MAX2(v0, v1); 43.128 + intptr_t* cur = max; 43.129 + intptr_t* last = NULL; 43.130 + for (int i = _values.length() - 1; i >= 0; i--) { 43.131 + FrameValue fv = _values.at(i); 43.132 + while (cur > fv.location) { 43.133 + tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT, cur, *cur); 43.134 + cur--; 43.135 + } 43.136 + if (last == fv.location) { 43.137 + const char* spacer = " " LP64_ONLY(" "); 43.138 + tty->print_cr(" %s %s %s", spacer, spacer, fv.description); 43.139 + } else { 43.140 + tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", fv.location, *fv.location, fv.description); 43.141 + last = fv.location; 43.142 + cur--; 43.143 + } 43.144 + } 43.145 +} 43.146 + 43.147 +#endif
44.1 --- a/src/share/vm/runtime/frame.hpp Wed May 11 15:47:12 2011 -0700 44.2 +++ b/src/share/vm/runtime/frame.hpp Thu May 12 15:05:22 2011 -0700 44.3 @@ -60,6 +60,7 @@ 44.4 typedef class BytecodeInterpreter* interpreterState; 44.5 44.6 class CodeBlob; 44.7 +class FrameValues; 44.8 class vframeArray; 44.9 44.10 44.11 @@ -381,6 +382,8 @@ 44.12 private: 44.13 const char* print_name() const; 44.14 44.15 + void describe_pd(FrameValues& values, int frame_no); 44.16 + 44.17 public: 44.18 void print_value() const { print_value_on(tty,NULL); } 44.19 void print_value_on(outputStream* st, JavaThread *thread) const; 44.20 @@ -388,6 +391,9 @@ 44.21 void interpreter_frame_print_on(outputStream* st) const; 44.22 void print_on_error(outputStream* st, char* buf, int buflen, bool verbose = false) const; 44.23 44.24 + // Add annotated descriptions of memory locations belonging to this frame to values 44.25 + void describe(FrameValues& values, int frame_no); 44.26 + 44.27 // Conversion from an VMReg to physical stack location 44.28 oop* oopmapreg_to_location(VMReg reg, const RegisterMap* regmap) const; 44.29 44.30 @@ -472,6 +478,41 @@ 44.31 44.32 }; 44.33 44.34 +#ifdef ASSERT 44.35 +// A simple class to describe a location on the stack 44.36 +class FrameValue VALUE_OBJ_CLASS_SPEC { 44.37 + public: 44.38 + intptr_t* location; 44.39 + char* description; 44.40 + int owner; 44.41 + int priority; 44.42 +}; 44.43 + 44.44 + 44.45 +// A collection of described stack values that can print a symbolic 44.46 +// description of the stack memory. Interpreter frame values can be 44.47 +// in the caller frames so all the values are collected first and then 44.48 +// sorted before being printed. 44.49 +class FrameValues { 44.50 + private: 44.51 + GrowableArray<FrameValue> _values; 44.52 + 44.53 + static int compare(FrameValue* a, FrameValue* b) { 44.54 + if (a->location == b->location) { 44.55 + return a->priority - b->priority; 44.56 + } 44.57 + return a->location - b->location; 44.58 + } 44.59 + 44.60 + public: 44.61 + // Used by frame functions to describe locations. 44.62 + void describe(int owner, intptr_t* location, const char* description, int priority = 0); 44.63 + 44.64 + bool validate(); 44.65 + void print(); 44.66 +}; 44.67 + 44.68 +#endif 44.69 44.70 // 44.71 // StackFrameStream iterates through the frames of a thread starting from
45.1 --- a/src/share/vm/runtime/globals.hpp Wed May 11 15:47:12 2011 -0700 45.2 +++ b/src/share/vm/runtime/globals.hpp Thu May 12 15:05:22 2011 -0700 45.3 @@ -2892,7 +2892,7 @@ 45.4 "Max. no. of lines in the stack trace for Java exceptions " \ 45.5 "(0 means all)") \ 45.6 \ 45.7 - NOT_EMBEDDED(develop(intx, GuaranteedSafepointInterval, 1000, \ 45.8 + NOT_EMBEDDED(diagnostic(intx, GuaranteedSafepointInterval, 1000, \ 45.9 "Guarantee a safepoint (at least) every so many milliseconds " \ 45.10 "(0 means none)")) \ 45.11 \
46.1 --- a/src/share/vm/runtime/thread.cpp Wed May 11 15:47:12 2011 -0700 46.2 +++ b/src/share/vm/runtime/thread.cpp Thu May 12 15:05:22 2011 -0700 46.3 @@ -31,6 +31,7 @@ 46.4 #include "compiler/compileBroker.hpp" 46.5 #include "interpreter/interpreter.hpp" 46.6 #include "interpreter/linkResolver.hpp" 46.7 +#include "interpreter/oopMapCache.hpp" 46.8 #include "jvmtifiles/jvmtiEnv.hpp" 46.9 #include "memory/oopFactory.hpp" 46.10 #include "memory/universe.inline.hpp" 46.11 @@ -2860,6 +2861,25 @@ 46.12 } 46.13 46.14 46.15 +// Print or validate the layout of stack frames 46.16 +void JavaThread::print_frame_layout(int depth, bool validate_only) { 46.17 + ResourceMark rm; 46.18 + PRESERVE_EXCEPTION_MARK; 46.19 + FrameValues values; 46.20 + int frame_no = 0; 46.21 + for(StackFrameStream fst(this, false); !fst.is_done(); fst.next()) { 46.22 + fst.current()->describe(values, ++frame_no); 46.23 + if (depth == frame_no) break; 46.24 + } 46.25 + if (validate_only) { 46.26 + values.validate(); 46.27 + } else { 46.28 + tty->print_cr("[Describe stack layout]"); 46.29 + values.print(); 46.30 + } 46.31 +} 46.32 + 46.33 + 46.34 void JavaThread::trace_stack_from(vframe* start_vf) { 46.35 ResourceMark rm; 46.36 int vframe_no = 1;
47.1 --- a/src/share/vm/runtime/thread.hpp Wed May 11 15:47:12 2011 -0700 47.2 +++ b/src/share/vm/runtime/thread.hpp Thu May 12 15:05:22 2011 -0700 47.3 @@ -1380,6 +1380,12 @@ 47.4 void trace_stack_from(vframe* start_vf) PRODUCT_RETURN; 47.5 void trace_frames() PRODUCT_RETURN; 47.6 47.7 + // Print an annotated view of the stack frames 47.8 + void print_frame_layout(int depth = 0, bool validate_only = false) PRODUCT_RETURN; 47.9 + void validate_frame_layout() { 47.10 + print_frame_layout(0, true); 47.11 + } 47.12 + 47.13 // Returns the number of stack frames on the stack 47.14 int depth() const; 47.15
48.1 --- a/src/share/vm/utilities/debug.cpp Wed May 11 15:47:12 2011 -0700 48.2 +++ b/src/share/vm/utilities/debug.cpp Thu May 12 15:05:22 2011 -0700 48.3 @@ -469,6 +469,7 @@ 48.4 extern "C" void pp(void* p) { 48.5 Command c("pp"); 48.6 FlagSetting fl(PrintVMMessages, true); 48.7 + FlagSetting f2(DisplayVMOutput, true); 48.8 if (Universe::heap()->is_in(p)) { 48.9 oop obj = oop(p); 48.10 obj->print(); 48.11 @@ -507,6 +508,17 @@ 48.12 48.13 } 48.14 48.15 +extern "C" void pfl() { 48.16 + // print frame layout 48.17 + Command c("pfl"); 48.18 + JavaThread* p = JavaThread::active(); 48.19 + tty->print(" for thread: "); 48.20 + p->print(); 48.21 + tty->cr(); 48.22 + if (p->has_last_Java_frame()) { 48.23 + p->print_frame_layout(); 48.24 + } 48.25 +} 48.26 48.27 extern "C" void psf() { // print stack frames 48.28 {
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 49.2 +++ b/test/compiler/5091921/Test5091921.java Thu May 12 15:05:22 2011 -0700 49.3 @@ -0,0 +1,309 @@ 49.4 +/* 49.5 + * Copyright (c) 2011 Hewlett-Packard Company. All rights reserved. 49.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 49.7 + * 49.8 + * This code is free software; you can redistribute it and/or modify it 49.9 + * under the terms of the GNU General Public License version 2 only, as 49.10 + * published by the Free Software Foundation. 49.11 + * 49.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 49.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 49.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 49.15 + * version 2 for more details (a copy is included in the LICENSE file that 49.16 + * accompanied this code). 49.17 + * 49.18 + * You should have received a copy of the GNU General Public License version 49.19 + * 2 along with this work; if not, write to the Free Software Foundation, 49.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 49.21 + * 49.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 49.23 + * or visit www.oracle.com if you need additional information or have any 49.24 + * questions. 49.25 + * 49.26 + */ 49.27 + 49.28 +/** 49.29 + * @test 49.30 + * @bug 5091921 49.31 + * @summary Sign flip issues in loop optimizer 49.32 + * 49.33 + * @run main/othervm -Xcomp -XX:CompileOnly=Test5091921 -XX:MaxInlineSize=1 Test5091921 49.34 + */ 49.35 + 49.36 +public class Test5091921 { 49.37 + private static int result = 0; 49.38 + 49.39 + 49.40 + /* Test for the bug of transforming indx >= MININT to indx > MININT-1 */ 49.41 + public static int test_ge1(int limit) { 49.42 + int indx; 49.43 + int sum = 0; 49.44 + for (indx = 500; indx >= limit; indx -= 2) { 49.45 + sum += 2000 / indx; 49.46 + result = sum; 49.47 + } 49.48 + return sum; 49.49 + } 49.50 + 49.51 + /* Test for the bug of transforming indx <= MAXINT to indx < MAXINT+1 */ 49.52 + public static int test_le1(int limit) { 49.53 + int indx; 49.54 + int sum = 0; 49.55 + for (indx = -500; indx <= limit; indx += 2) 49.56 + { 49.57 + sum += 3000 / indx; 49.58 + result = sum; 49.59 + } 49.60 + return sum; 49.61 + } 49.62 + 49.63 + /* Run with -Xcomp -XX:CompileOnly=wrap1.test1 -XX:MaxInlineSize=1 */ 49.64 + /* limit reset to ((limit-init+stride-1)/stride)*stride+init */ 49.65 + /* Calculation may overflow */ 49.66 + public static volatile int c = 1; 49.67 + public static int test_wrap1(int limit) 49.68 + { 49.69 + int indx; 49.70 + int sum = 0; 49.71 + for (indx = 0xffffffff; indx < limit; indx += 0x20000000) 49.72 + { 49.73 + sum += c; 49.74 + } 49.75 + return sum; 49.76 + } 49.77 + 49.78 + /* Test for range check elimination with bit flip issue for 49.79 + scale*i+offset<limit where offset is not 0 */ 49.80 + static int[] box5 = {1,2,3,4,5,6,7,8,9}; 49.81 + public static int test_rce5(int[] b, int limit) 49.82 + { 49.83 + int indx; 49.84 + int sum = b[1]; 49.85 + result = sum; 49.86 + for (indx = 0x80000000; indx < limit; ++indx) 49.87 + { 49.88 + if (indx > 0x80000000) 49.89 + { 49.90 + // this test is not issued in pre-loop but issued in main loop 49.91 + // trick rce into thinking expression is false when indx >= 0 49.92 + // in fact it is false when indx==0x80000001 49.93 + if (indx - 9 < -9) 49.94 + { 49.95 + sum += indx; 49.96 + result = sum; 49.97 + sum ^= b[indx & 7]; 49.98 + result = sum; 49.99 + } 49.100 + else 49.101 + break; 49.102 + } 49.103 + else 49.104 + { 49.105 + sum += b[indx & 3]; 49.106 + result = sum; 49.107 + } 49.108 + } 49.109 + return sum; 49.110 + } 49.111 + 49.112 + /* Test for range check elimination with bit flip issue for 49.113 + scale*i<limit where scale > 1 */ 49.114 + static int[] box6 = {1,2,3,4,5,6,7,8,9}; 49.115 + public static int test_rce6(int[] b, int limit) 49.116 + { 49.117 + int indx; 49.118 + int sum = b[1]; 49.119 + result = sum; 49.120 + for (indx = 0x80000000; indx < limit; ++indx) 49.121 + { 49.122 + if (indx > 0x80000000) 49.123 + { 49.124 + // harmless rce target 49.125 + if (indx < 0) 49.126 + { 49.127 + sum += result; 49.128 + result = sum; 49.129 + } 49.130 + else 49.131 + break; 49.132 + // this test is not issued in pre-loop but issued in main loop 49.133 + // trick rce into thinking expression is false when indx >= 0 49.134 + // in fact it is false when indx==0x80000001 49.135 + // In compilers that transform mulI to shiftI may mask this issue. 49.136 + if (indx * 28 + 1 < 0) 49.137 + { 49.138 + sum += indx; 49.139 + result = sum; 49.140 + sum ^= b[indx & 7]; 49.141 + result = sum; 49.142 + } 49.143 + else 49.144 + break; 49.145 + } 49.146 + else 49.147 + { 49.148 + sum += b[indx & 3]; 49.149 + result = sum; 49.150 + } 49.151 + } 49.152 + return sum; 49.153 + } 49.154 + 49.155 + /* Test for range check elimination with i <= limit */ 49.156 + static int[] box7 = {1,2,3,4,5,6,7,8,9,0x7fffffff}; 49.157 + public static int test_rce7(int[] b) 49.158 + { 49.159 + int indx; 49.160 + int max = b[9]; 49.161 + int sum = b[7]; 49.162 + result = sum; 49.163 + for (indx = 0; indx < b.length; ++indx) 49.164 + { 49.165 + if (indx <= max) 49.166 + { 49.167 + sum += (indx ^ 15) + ((result != 0) ? 0 : sum); 49.168 + result = sum; 49.169 + } 49.170 + else 49.171 + throw new RuntimeException(); 49.172 + } 49.173 + for (indx = -7; indx < b.length; ++indx) 49.174 + { 49.175 + if (indx <= 9) 49.176 + { 49.177 + sum += (sum ^ 15) + ((result != 0) ? 0 : sum); 49.178 + result = sum; 49.179 + } 49.180 + else 49.181 + throw new RuntimeException(); 49.182 + } 49.183 + return sum; 49.184 + } 49.185 + 49.186 + /* Test for range check elimination with i >= limit */ 49.187 + static int[] box8 = {-1,0,1,2,3,4,5,6,7,8,0x80000000}; 49.188 + public static int test_rce8(int[] b) 49.189 + { 49.190 + int indx; 49.191 + int sum = b[5]; 49.192 + int min = b[10]; 49.193 + result = sum; 49.194 + for (indx = b.length-1; indx >= 0; --indx) 49.195 + { 49.196 + if (indx >= min) 49.197 + { 49.198 + sum += (sum ^ 9) + ((result != 0) ? 0 :sum); 49.199 + result = sum; 49.200 + } 49.201 + else 49.202 + throw new RuntimeException(); 49.203 + } 49.204 + return sum; 49.205 + } 49.206 + 49.207 + public static void main(String[] args) 49.208 + { 49.209 + result=1; 49.210 + int r = 0; 49.211 + try { 49.212 + r = test_ge1(0x80000000); 49.213 + System.out.println(result); 49.214 + System.out.println("test_ge1 FAILED"); 49.215 + System.exit(1); 49.216 + } 49.217 + catch (ArithmeticException e1) { 49.218 + System.out.println("test_ge1: Expected exception caught"); 49.219 + if (result != 5986) { 49.220 + System.out.println(result); 49.221 + System.out.println("test_ge1 FAILED"); 49.222 + System.exit(97); 49.223 + } 49.224 + } 49.225 + System.out.println("test_ge1 WORKED"); 49.226 + 49.227 + result=0; 49.228 + try 49.229 + { 49.230 + r = test_le1(0x7fffffff); 49.231 + System.out.println(result); 49.232 + System.out.println("test_le1 FAILED"); 49.233 + System.exit(1); 49.234 + } 49.235 + catch (ArithmeticException e1) 49.236 + { 49.237 + System.out.println("test_le1: Expected exception caught"); 49.238 + if (result != -9039) 49.239 + { 49.240 + System.out.println(result); 49.241 + System.out.println("test_le1 FAILED"); 49.242 + System.exit(97); 49.243 + } 49.244 + } 49.245 + System.out.println("test_le1 WORKED"); 49.246 + 49.247 + result=0; 49.248 + r = test_wrap1(0x7fffffff); 49.249 + if (r != 4) 49.250 + { 49.251 + System.out.println(result); 49.252 + System.out.println("test_wrap1 FAILED"); 49.253 + System.exit(97); 49.254 + } 49.255 + else 49.256 + { 49.257 + System.out.println("test_wrap1 WORKED"); 49.258 + } 49.259 + 49.260 + result=0; 49.261 + r = test_rce5(box5,0x80000100); 49.262 + if (result != 3) 49.263 + { 49.264 + System.out.println(result); 49.265 + System.out.println("test_rce5 FAILED"); 49.266 + System.exit(97); 49.267 + } 49.268 + else 49.269 + { 49.270 + System.out.println("test_rce5 WORKED"); 49.271 + } 49.272 + 49.273 + result=0; 49.274 + r = test_rce6(box6,0x80000100); 49.275 + if (result != 6) 49.276 + { 49.277 + System.out.println(result); 49.278 + System.out.println("test_rce6 FAILED"); 49.279 + System.exit(97); 49.280 + } 49.281 + else 49.282 + { 49.283 + System.out.println("test_rce6 WORKED"); 49.284 + } 49.285 + 49.286 + result=0; 49.287 + r = test_rce7(box7); 49.288 + if (result != 14680079) 49.289 + { 49.290 + System.out.println(result); 49.291 + System.out.println("test_rce7 FAILED"); 49.292 + System.exit(97); 49.293 + } 49.294 + else 49.295 + { 49.296 + System.out.println("test_rce7 WORKED"); 49.297 + } 49.298 + 49.299 + result=0; 49.300 + r = test_rce8(box8); 49.301 + if (result != 16393) 49.302 + { 49.303 + System.out.println(result); 49.304 + System.out.println("test_rce8 FAILED"); 49.305 + System.exit(97); 49.306 + } 49.307 + else 49.308 + { 49.309 + System.out.println("test_rce8 WORKED"); 49.310 + } 49.311 + } 49.312 +}
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 50.2 +++ b/test/compiler/5091921/Test6186134.java Thu May 12 15:05:22 2011 -0700 50.3 @@ -0,0 +1,71 @@ 50.4 +/* 50.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 50.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 50.7 + * 50.8 + * This code is free software; you can redistribute it and/or modify it 50.9 + * under the terms of the GNU General Public License version 2 only, as 50.10 + * published by the Free Software Foundation. 50.11 + * 50.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 50.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 50.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 50.15 + * version 2 for more details (a copy is included in the LICENSE file that 50.16 + * accompanied this code). 50.17 + * 50.18 + * You should have received a copy of the GNU General Public License version 50.19 + * 2 along with this work; if not, write to the Free Software Foundation, 50.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 50.21 + * 50.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 50.23 + * or visit www.oracle.com if you need additional information or have any 50.24 + * questions. 50.25 + * 50.26 + */ 50.27 + 50.28 +/** 50.29 + * @test 50.30 + * @bug 6186134 50.31 + * @summary Server virtual machine produces/exeutes incorrect code. 50.32 + * 50.33 + * @run main Test6186134 100000 50.34 + */ 50.35 +import java.util.ArrayList; 50.36 + 50.37 +public class Test6186134 { 50.38 + 50.39 + int num = 0; 50.40 + 50.41 + public Test6186134(int n) { 50.42 + num = n; 50.43 + } 50.44 + 50.45 + public boolean more() { 50.46 + return num-- > 0; 50.47 + } 50.48 + 50.49 + public ArrayList test1() { 50.50 + ArrayList res = new ArrayList(); 50.51 + int maxResults = Integer.MAX_VALUE; 50.52 + int n = 0; 50.53 + boolean more = more(); 50.54 + while ((n++ < maxResults) && more) { 50.55 + res.add(new Object()); 50.56 + more = more(); 50.57 + } 50.58 + return res; 50.59 + } 50.60 + 50.61 + public static void main(String[] pars) { 50.62 + int n = Integer.parseInt(pars[0]); 50.63 + for (int i=0; i<n; i++) { 50.64 + Test6186134 t = new Test6186134(10); 50.65 + int size = t.test1().size(); 50.66 + if (size != 10) { 50.67 + System.out.println("wrong size: " + size +", should be 10"); 50.68 + System.exit(97); 50.69 + } 50.70 + } 50.71 + System.out.println("Passed"); 50.72 + } 50.73 +} 50.74 +
51.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 51.2 +++ b/test/compiler/5091921/Test6196102.java Thu May 12 15:05:22 2011 -0700 51.3 @@ -0,0 +1,47 @@ 51.4 +/* 51.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 51.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 51.7 + * 51.8 + * This code is free software; you can redistribute it and/or modify it 51.9 + * under the terms of the GNU General Public License version 2 only, as 51.10 + * published by the Free Software Foundation. 51.11 + * 51.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 51.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 51.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 51.15 + * version 2 for more details (a copy is included in the LICENSE file that 51.16 + * accompanied this code). 51.17 + * 51.18 + * You should have received a copy of the GNU General Public License version 51.19 + * 2 along with this work; if not, write to the Free Software Foundation, 51.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 51.21 + * 51.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 51.23 + * or visit www.oracle.com if you need additional information or have any 51.24 + * questions. 51.25 + * 51.26 + */ 51.27 + 51.28 +/** 51.29 + * @test 51.30 + * @bug 6196102 51.31 + * @summary Integer seems to be greater than Integer.MAX_VALUE 51.32 + * 51.33 + * @run main Test6196102 51.34 + */ 51.35 + 51.36 +public class Test6196102 { 51.37 + static public void main(String[] args) { 51.38 + int i1 = 0; 51.39 + int i2 = Integer.MAX_VALUE; 51.40 + 51.41 + while (i1 >= 0) { 51.42 + i1++; 51.43 + if (i1 > i2) { 51.44 + System.out.println("E R R O R: " + i1); 51.45 + System.exit(97); 51.46 + } 51.47 + } 51.48 + } 51.49 +} 51.50 +
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 52.2 +++ b/test/compiler/5091921/Test6357214.java Thu May 12 15:05:22 2011 -0700 52.3 @@ -0,0 +1,179 @@ 52.4 +/* 52.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 52.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 52.7 + * 52.8 + * This code is free software; you can redistribute it and/or modify it 52.9 + * under the terms of the GNU General Public License version 2 only, as 52.10 + * published by the Free Software Foundation. 52.11 + * 52.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 52.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 52.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 52.15 + * version 2 for more details (a copy is included in the LICENSE file that 52.16 + * accompanied this code). 52.17 + * 52.18 + * You should have received a copy of the GNU General Public License version 52.19 + * 2 along with this work; if not, write to the Free Software Foundation, 52.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 52.21 + * 52.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 52.23 + * or visit www.oracle.com if you need additional information or have any 52.24 + * questions. 52.25 + * 52.26 + */ 52.27 + 52.28 +/** 52.29 + * @test 52.30 + * @bug 6357214 52.31 + * @summary Hotspot server compiler gets integer comparison wrong 52.32 + * 52.33 + * @run main/othervm/timeout=60 -DshowAll=ffo -DeventID=444 Test6357214 52.34 + */ 52.35 + 52.36 +// The test hangs after few iterations before the fix. So it fails if timeout. 52.37 +class MyResult { 52.38 + public boolean next() { 52.39 + return true; 52.40 + } 52.41 + 52.42 + public String getString(String in) { 52.43 + if (in.equals("id")) 52.44 + return "idFoo"; 52.45 + if (in.equals("contentKey")) 52.46 + return "ckFoo"; 52.47 + return "Foo"; 52.48 + } 52.49 + 52.50 + public int getInt(String in) { 52.51 + if (in.equals("processingComplete")) 52.52 + return 0; 52.53 + return 1; 52.54 + } 52.55 + 52.56 + public byte[] getBytes(String in) { 52.57 + byte[] arr = null; 52.58 + if (in.equals("content")) { 52.59 + arr = new byte[65536]; 52.60 + byte j = 32; 52.61 + for (int i=0; i<65536; i++) { 52.62 + arr[i] = j; 52.63 + if (++j == 127) 52.64 + j=32; 52.65 + } 52.66 + } 52.67 + return arr; 52.68 + } 52.69 +} 52.70 + 52.71 +public class Test6357214 { 52.72 + public static volatile boolean bollocks = true; 52.73 + public String create(String context) throws Exception { 52.74 + 52.75 + // 52.76 + // Extract HTTP parameters 52.77 + // 52.78 + 52.79 + boolean showAll = System.getProperty("showAll") != null; 52.80 + String eventID = System.getProperty("eventID"); 52.81 + String eventContentKey = System.getProperty("cKey"); 52.82 + // 52.83 + // Build ContentStaging query based on eventID or eventContentKey 52.84 + // 52.85 + 52.86 + String sql = "select id, processingComplete, contentKey, content " 52.87 + + "from ContentStaging cs, ContentStagingKey csk " 52.88 + + "where cs.eventContentKey = csk.eventContentKey "; 52.89 + 52.90 + if (eventID != null) { 52.91 + sql += "and id = " + eventID; 52.92 + } 52.93 + else if (eventContentKey != null) { 52.94 + sql += "and cs.eventContentKey = '" 52.95 + + eventContentKey 52.96 + + "' having id = max(id)"; 52.97 + } 52.98 + else { 52.99 + throw new Exception("Need eventID or eventContentKey"); 52.100 + } 52.101 + 52.102 + // 52.103 + // This factory builds a static panel, there is no JSP 52.104 + // 52.105 + 52.106 + StringBuffer html = new StringBuffer(); 52.107 + 52.108 + try { 52.109 + 52.110 + MyResult result = new MyResult(); 52.111 + if (result.next()) { 52.112 + 52.113 + eventID = result.getString("id"); 52.114 + int processingComplete = result.getInt("processingComplete"); 52.115 + String contentKey = result.getString("contentKey"); 52.116 + byte[] bytes = result.getBytes("content"); 52.117 + 52.118 + // 52.119 + // Print content status and associated controls 52.120 + // 52.121 + 52.122 + html.append("<br/><font class=\"small\">"); 52.123 + html.append("Status: "); 52.124 + switch (processingComplete) { 52.125 + case 0 : 52.126 + case 1 : html.append("PENDING"); break; 52.127 + case 2 : html.append(contentKey); break; 52.128 + case 3 : html.append(eventID); break; 52.129 + default : html.append("UNKNONW"); 52.130 + } 52.131 + html.append("</font><br/>"); 52.132 + 52.133 + // 52.134 + // Print at most 20Kb of content unless "showAll" is set 52.135 + // 52.136 + 52.137 + int limit = showAll ? Integer.MAX_VALUE : 1024 * 20; 52.138 + System.out.println(limit); 52.139 + html.append("<pre>"); 52.140 + for (int i = 0; bytes != null && i < bytes.length; i++) { 52.141 + char c = (char) bytes[i]; 52.142 + switch (c) { 52.143 + case '<' : html.append("<"); break; 52.144 + case '>' : html.append(">"); break; 52.145 + case '&' : html.append("&"); break; 52.146 + default : html.append(c); 52.147 + } 52.148 + 52.149 + if (i > limit) { 52.150 + while (bollocks); 52.151 + // System.out.println("i is " + i); 52.152 + // System.out.println("limit is " + limit); 52.153 + html.append("...\n</pre>"); 52.154 + html.append(eventID); 52.155 + html.append("<pre>"); 52.156 + break; 52.157 + } 52.158 + } 52.159 + html.append("</pre>"); 52.160 + } 52.161 + } 52.162 + catch (Exception exception) { 52.163 + throw exception; 52.164 + } 52.165 + finally { 52.166 + html.append("Oof!!"); 52.167 + } 52.168 + String ret = html.toString(); 52.169 + System.out.println("Returning string length = "+ ret.length()); 52.170 + return ret; 52.171 + } 52.172 + 52.173 + public static void main(String[] args) throws Exception { 52.174 + int length=0; 52.175 + 52.176 + for (int i = 0; i < 100; i++) { 52.177 + length = new Test6357214().create("boo").length(); 52.178 + System.out.println(length); 52.179 + } 52.180 + } 52.181 +} 52.182 +
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 53.2 +++ b/test/compiler/5091921/Test6559156.java Thu May 12 15:05:22 2011 -0700 53.3 @@ -0,0 +1,81 @@ 53.4 +/* 53.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 53.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 53.7 + * 53.8 + * This code is free software; you can redistribute it and/or modify it 53.9 + * under the terms of the GNU General Public License version 2 only, as 53.10 + * published by the Free Software Foundation. 53.11 + * 53.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 53.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 53.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 53.15 + * version 2 for more details (a copy is included in the LICENSE file that 53.16 + * accompanied this code). 53.17 + * 53.18 + * You should have received a copy of the GNU General Public License version 53.19 + * 2 along with this work; if not, write to the Free Software Foundation, 53.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 53.21 + * 53.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 53.23 + * or visit www.oracle.com if you need additional information or have any 53.24 + * questions. 53.25 + * 53.26 + */ 53.27 + 53.28 +/** 53.29 + * @test 53.30 + * @bug 6559156 53.31 + * @summary Server compiler generates bad code for "<= Integer.MAX_VALUE" expression 53.32 + * 53.33 + * @run main Test6559156 53.34 + */ 53.35 + 53.36 +public class Test6559156 { 53.37 + 53.38 + static final int N_TESTS = 1000000; 53.39 + 53.40 + public static void main(String[] args) throws Exception { 53.41 + 53.42 + /* 53.43 + * If MAX_VALUE is changed to MAX_VALUE - 1 below, the test passes 53.44 + * because (apparently) bad code is only generated when comparing 53.45 + * <= MAX_VALUE in the doTest method. 53.46 + */ 53.47 + Test6559156 test = new Test6559156(); 53.48 + for (int i = 0; i < N_TESTS; i += 1) { 53.49 + test.doTest1(10, Integer.MAX_VALUE, i); 53.50 + test.doTest2(10, Integer.MAX_VALUE, i); 53.51 + } 53.52 + System.out.println("No failure"); 53.53 + } 53.54 + 53.55 + void doTest1(int expected, int max, int i) { 53.56 + int counted; 53.57 + for (counted = 0; 53.58 + (counted <= max) && (counted < expected); 53.59 + counted += 1) { 53.60 + } 53.61 + if (counted != expected) { 53.62 + throw new RuntimeException("Failed test1 iteration=" + i + 53.63 + " max=" + max + 53.64 + " counted=" + counted + 53.65 + " expected=" + expected); 53.66 + } 53.67 + } 53.68 + 53.69 + void doTest2(int expected, int max, int i) { 53.70 + int counted; 53.71 + for (counted = 0; 53.72 + // change test sequence. 53.73 + (counted < expected) && (counted <= max); 53.74 + counted += 1) { 53.75 + } 53.76 + if (counted != expected) { 53.77 + throw new RuntimeException("Failed test1 iteration=" + i + 53.78 + " max=" + max + 53.79 + " counted=" + counted + 53.80 + " expected=" + expected); 53.81 + } 53.82 + } 53.83 +} 53.84 +
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 54.2 +++ b/test/compiler/5091921/Test6753639.java Thu May 12 15:05:22 2011 -0700 54.3 @@ -0,0 +1,50 @@ 54.4 +/* 54.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 54.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 54.7 + * 54.8 + * This code is free software; you can redistribute it and/or modify it 54.9 + * under the terms of the GNU General Public License version 2 only, as 54.10 + * published by the Free Software Foundation. 54.11 + * 54.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 54.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 54.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 54.15 + * version 2 for more details (a copy is included in the LICENSE file that 54.16 + * accompanied this code). 54.17 + * 54.18 + * You should have received a copy of the GNU General Public License version 54.19 + * 2 along with this work; if not, write to the Free Software Foundation, 54.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 54.21 + * 54.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 54.23 + * or visit www.oracle.com if you need additional information or have any 54.24 + * questions. 54.25 + * 54.26 + */ 54.27 + 54.28 +/** 54.29 + * @test 54.30 + * @bug 6753639 54.31 + * @summary Strange optimisation in for loop with cyclic integer condition 54.32 + * 54.33 + * @run main/othervm -Xbatch Test6753639 54.34 + */ 54.35 + 54.36 +public class Test6753639 { 54.37 + public static void main(String[] args) throws InterruptedException { 54.38 + int END = Integer.MAX_VALUE; 54.39 + int count = 0; 54.40 + for(int i = Integer.MAX_VALUE - 5; i <= END; i++) { 54.41 + count++; 54.42 + if (count > 100000) { 54.43 + System.out.println("Passed"); 54.44 + System.exit(95); 54.45 + } 54.46 + } 54.47 + System.out.println("broken " + count); 54.48 + System.out.println("FAILED"); 54.49 + System.exit(97); 54.50 + } 54.51 +} 54.52 + 54.53 +
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 55.2 +++ b/test/compiler/5091921/Test6850611.java Thu May 12 15:05:22 2011 -0700 55.3 @@ -0,0 +1,53 @@ 55.4 +/* 55.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 55.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 55.7 + * 55.8 + * This code is free software; you can redistribute it and/or modify it 55.9 + * under the terms of the GNU General Public License version 2 only, as 55.10 + * published by the Free Software Foundation. 55.11 + * 55.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 55.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 55.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 55.15 + * version 2 for more details (a copy is included in the LICENSE file that 55.16 + * accompanied this code). 55.17 + * 55.18 + * You should have received a copy of the GNU General Public License version 55.19 + * 2 along with this work; if not, write to the Free Software Foundation, 55.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 55.21 + * 55.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 55.23 + * or visit www.oracle.com if you need additional information or have any 55.24 + * questions. 55.25 + * 55.26 + */ 55.27 + 55.28 +/** 55.29 + * @test 55.30 + * @bug 6850611 55.31 + * @summary int / long arithmetic seems to be broken in 1.6.0_14 HotSpot Server VM (Win XP) 55.32 + * 55.33 + * @run main Test6850611 55.34 + */ 55.35 + 55.36 +public class Test6850611 { 55.37 + 55.38 + public static void main(String[] args) { 55.39 + test(); 55.40 + } 55.41 + 55.42 + private static void test() { 55.43 + for (int j = 0; j < 5; ++j) { 55.44 + long x = 0; 55.45 + for (int i = Integer.MIN_VALUE; i < Integer.MAX_VALUE; ++i) { 55.46 + x += i; 55.47 + } 55.48 + System.out.println("sum: " + x); 55.49 + if (x != -4294967295l) { 55.50 + System.out.println("FAILED"); 55.51 + System.exit(97); 55.52 + } 55.53 + } 55.54 + } 55.55 +} 55.56 +
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 56.2 +++ b/test/compiler/5091921/Test6890943.java Thu May 12 15:05:22 2011 -0700 56.3 @@ -0,0 +1,189 @@ 56.4 +/* 56.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 56.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 56.7 + * 56.8 + * This code is free software; you can redistribute it and/or modify it 56.9 + * under the terms of the GNU General Public License version 2 only, as 56.10 + * published by the Free Software Foundation. 56.11 + * 56.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 56.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 56.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 56.15 + * version 2 for more details (a copy is included in the LICENSE file that 56.16 + * accompanied this code). 56.17 + * 56.18 + * You should have received a copy of the GNU General Public License version 56.19 + * 2 along with this work; if not, write to the Free Software Foundation, 56.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 56.21 + * 56.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 56.23 + * or visit www.oracle.com if you need additional information or have any 56.24 + * questions. 56.25 + * 56.26 + */ 56.27 + 56.28 +/** 56.29 + * @test 56.30 + * @bug 6890943 56.31 + * @summary JVM mysteriously gives wrong result on 64-bit 1.6 VMs in hotspot mode. 56.32 + * 56.33 + * @run shell Test6890943.sh 56.34 + */ 56.35 +import java.util.*; 56.36 +import java.io.*; 56.37 +import java.util.regex.*; 56.38 + 56.39 +public class Test6890943 { 56.40 + public static final boolean AIR = true, ROCK = false; 56.41 + public static void main(String[] args) { 56.42 + new Test6890943().go(); 56.43 + } 56.44 + 56.45 + int r, c, f, t; 56.46 + boolean[][] grid; 56.47 + 56.48 + public void go() { 56.49 + Scanner s = new Scanner(System.in); 56.50 + s.useDelimiter("\\s+"); 56.51 + int T = s.nextInt(); 56.52 + for (t = 0 ; t < T ; t++) { 56.53 + r = s.nextInt(); c = s.nextInt(); f = s.nextInt(); 56.54 + grid = new boolean[r][c]; 56.55 + for (int x = 0 ; x < r ; x++) { 56.56 + String line = s.next(); 56.57 + for (int y = 0 ; y < c ; y++) grid[x][y] = line.charAt(y) == '.'; 56.58 + } 56.59 + int digs = solve(); 56.60 + String res = digs == -1 ? "No" : "Yes " + digs; 56.61 + System.out.printf("Case #%d: %s\n", t+1, res); 56.62 + } 56.63 + } 56.64 + 56.65 + Map<Integer, Integer> M = new HashMap<Integer, Integer>(); 56.66 + 56.67 + private int solve() { 56.68 + M = new HashMap<Integer, Integer>(); 56.69 + M.put(calcWalkingRange(0, 0), 0); 56.70 + for (int digDown = 0 ; digDown < r ; digDown++) { 56.71 + Map<Integer, Integer> tries = new HashMap<Integer, Integer>(); 56.72 + for (Map.Entry<Integer, Integer> m : M.entrySet()) { 56.73 + int q = m.getKey(); 56.74 + if (depth(q) != (digDown)) continue; 56.75 + if (stuck(q)) continue; 56.76 + tries.put(q, m.getValue()); 56.77 + } 56.78 + 56.79 + for (Map.Entry<Integer, Integer> m : tries.entrySet()) { 56.80 + int q = m.getKey(); 56.81 + int fallLeftDelta = 0, fallRightDelta = 0; 56.82 + //fall left 56.83 + int fallLeft = fall(digDown, start(q)); 56.84 + if (fallLeft > 0) { 56.85 + fallLeftDelta = 1; 56.86 + if (fallLeft <= f) addToM(calcWalkingRange(digDown+fallLeft, start(q)), m.getValue()); 56.87 + } 56.88 + 56.89 + //fall right 56.90 + int fallRight = fall(digDown, end(q)); 56.91 + if (fallRight > 0) { 56.92 + fallRightDelta = 1; 56.93 + 56.94 + if (fallRight <= f) addToM(calcWalkingRange(digDown+fallRight, end(q)), m.getValue()); 56.95 + } 56.96 + 56.97 + for (int p = start(q) + fallLeftDelta ; p <= end(q) - fallRightDelta ; p++) { 56.98 + //goLeft 56.99 + for (int digSpot = p ; digSpot > start(q) +fallLeftDelta ; digSpot--) { 56.100 + int fallDown = 1+fall(digDown+1, digSpot); 56.101 + if (fallDown <= f) { 56.102 + if (fallDown == 1) { 56.103 + addToM(calcWalkingRange(digDown + 1, digSpot, digSpot, p), m.getValue() + Math.abs(digSpot-p)+1); 56.104 + } else { 56.105 + addToM(calcWalkingRange(digDown + fallDown, digSpot), m.getValue() + Math.abs(digSpot-p)+1); 56.106 + } 56.107 + } 56.108 + } 56.109 + 56.110 + //goRight 56.111 + for (int digSpot = p ; digSpot < end(q)-fallRightDelta ;digSpot++) { 56.112 + int fallDown = 1+fall(digDown+1, digSpot); 56.113 + if (fallDown <= f) { 56.114 + if (fallDown == 1) { 56.115 + addToM(calcWalkingRange(digDown + 1, digSpot, p, digSpot), m.getValue() + Math.abs(digSpot-p)+1); 56.116 + } else { 56.117 + addToM(calcWalkingRange(digDown + fallDown, digSpot), m.getValue() + Math.abs(digSpot-p)+1); 56.118 + } 56.119 + } 56.120 + } 56.121 + } 56.122 + } 56.123 + } 56.124 + 56.125 + int result = Integer.MAX_VALUE; 56.126 + for (Map.Entry<Integer, Integer> m : M.entrySet()) { 56.127 + if (depth(m.getKey()) == r-1) result = Math.min(m.getValue(), result); 56.128 + } 56.129 + 56.130 + if (result == Integer.MAX_VALUE) return -1; 56.131 + return result; 56.132 + } 56.133 + 56.134 + private void addToM(int q, int i) { 56.135 + Integer original = M.get(q); 56.136 + if ( original == null ) M.put(q, i); 56.137 + else M.put(q, Math.min(original, i)); 56.138 + } 56.139 + 56.140 + private int fall(int row, int column) { 56.141 + int res = 0; 56.142 + for ( int p = row+1 ; p < r ; p++) { 56.143 + if (grid[p][column] == AIR) res++; 56.144 + else break; 56.145 + } 56.146 + return res; 56.147 + } 56.148 + 56.149 + private boolean stuck(int q) { 56.150 + return start(q) == end(q); 56.151 + } 56.152 + 56.153 + private int depth(int q) { 56.154 + return q % 50; 56.155 + } 56.156 + 56.157 + private int start(int q) { 56.158 + return q / (50*50); 56.159 + } 56.160 + 56.161 + private int end(int q) { 56.162 + return (q / 50) % 50; 56.163 + } 56.164 + 56.165 + private int calcWalkingRange(int depth, int pos) { 56.166 + return calcWalkingRange(depth, pos, Integer.MAX_VALUE, Integer.MIN_VALUE); 56.167 + } 56.168 + 56.169 + private int calcWalkingRange(int depth, int pos, int airOverrideStart, int airOverrideEnd) { 56.170 + int left = pos, right = pos; 56.171 + if (depth >= r) return (c-1)*50 + depth; 56.172 + 56.173 + while (left > 0) { 56.174 + if (grid[depth][left-1] == ROCK && (left-1 < airOverrideStart || left-1 > airOverrideEnd)) break; 56.175 + if (depth < r-1 && grid[depth+1][left-1] == AIR) { 56.176 + left--; 56.177 + break; 56.178 + } 56.179 + left--; 56.180 + } 56.181 + while (right < c-1) { 56.182 + if (grid[depth][right+1] == ROCK && (right+1 < airOverrideStart || right+1 > airOverrideEnd)) break; 56.183 + if (depth < r-1 && grid[depth+1][right+1] == AIR) { 56.184 + right++; 56.185 + break; 56.186 + } 56.187 + right++; 56.188 + } 56.189 + 56.190 + return left *50*50 + right*50 + depth; 56.191 + } 56.192 +}
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 57.2 +++ b/test/compiler/5091921/Test6890943.sh Thu May 12 15:05:22 2011 -0700 57.3 @@ -0,0 +1,67 @@ 57.4 +#!/bin/sh 57.5 +# 57.6 +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 57.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 57.8 +# 57.9 +# This code is free software; you can redistribute it and/or modify it 57.10 +# under the terms of the GNU General Public License version 2 only, as 57.11 +# published by the Free Software Foundation. 57.12 +# 57.13 +# This code is distributed in the hope that it will be useful, but WITHOUT 57.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 57.15 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 57.16 +# version 2 for more details (a copy is included in the LICENSE file that 57.17 +# accompanied this code). 57.18 +# 57.19 +# You should have received a copy of the GNU General Public License version 57.20 +# 2 along with this work; if not, write to the Free Software Foundation, 57.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 57.22 +# 57.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 57.24 +# or visit www.oracle.com if you need additional information or have any 57.25 +# questions. 57.26 +# 57.27 +# 57.28 + 57.29 +if [ "${TESTSRC}" = "" ] 57.30 +then 57.31 + echo "TESTSRC not set. Test cannot execute. Failed." 57.32 + exit 1 57.33 +fi 57.34 +echo "TESTSRC=${TESTSRC}" 57.35 +if [ "${TESTJAVA}" = "" ] 57.36 +then 57.37 + echo "TESTJAVA not set. Test cannot execute. Failed." 57.38 + exit 1 57.39 +fi 57.40 +echo "TESTJAVA=${TESTJAVA}" 57.41 +if [ "${TESTCLASSES}" = "" ] 57.42 +then 57.43 + echo "TESTCLASSES not set. Test cannot execute. Failed." 57.44 + exit 1 57.45 +fi 57.46 +echo "TESTCLASSES=${TESTCLASSES}" 57.47 +echo "CLASSPATH=${CLASSPATH}" 57.48 + 57.49 +set -x 57.50 + 57.51 +cp ${TESTSRC}/Test6890943.java . 57.52 +cp ${TESTSRC}/input6890943.txt . 57.53 +cp ${TESTSRC}/output6890943.txt . 57.54 +cp ${TESTSRC}/Test6890943.sh . 57.55 + 57.56 +${TESTJAVA}/bin/javac -d . Test6890943.java 57.57 + 57.58 +${TESTJAVA}/bin/java ${TESTVMOPTS} Test6890943 < input6890943.txt > test.out 2>&1 57.59 + 57.60 +diff output6890943.txt test.out 57.61 + 57.62 +result=$? 57.63 +if [ $result -eq 0 ] 57.64 +then 57.65 + echo "Passed" 57.66 + exit 0 57.67 +else 57.68 + echo "Failed" 57.69 + exit 1 57.70 +fi
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 58.2 +++ b/test/compiler/5091921/Test6897150.java Thu May 12 15:05:22 2011 -0700 58.3 @@ -0,0 +1,58 @@ 58.4 +/* 58.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 58.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 58.7 + * 58.8 + * This code is free software; you can redistribute it and/or modify it 58.9 + * under the terms of the GNU General Public License version 2 only, as 58.10 + * published by the Free Software Foundation. 58.11 + * 58.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 58.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 58.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 58.15 + * version 2 for more details (a copy is included in the LICENSE file that 58.16 + * accompanied this code). 58.17 + * 58.18 + * You should have received a copy of the GNU General Public License version 58.19 + * 2 along with this work; if not, write to the Free Software Foundation, 58.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 58.21 + * 58.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 58.23 + * or visit www.oracle.com if you need additional information or have any 58.24 + * questions. 58.25 + * 58.26 + */ 58.27 + 58.28 +/** 58.29 + * @test 58.30 + * @bug 6897150 58.31 + * @summary Hotspot optimises away a valid loop 58.32 + * 58.33 + * @run main Test6897150 58.34 + */ 58.35 + 58.36 +// Should be compiled with javac from JDK1.3 to get bytecode which shows the problem. 58.37 +public class Test6897150 { 58.38 + public static void main(String[] args) { 58.39 + // This works 58.40 + loopAndPrint(Integer.MAX_VALUE -1); 58.41 + // This doesn't 58.42 + loopAndPrint(Integer.MAX_VALUE); 58.43 + } 58.44 + 58.45 + static void verify(int max, int a) { 58.46 + if ( a != (max - 1)) { 58.47 + System.out.println("Expected: " + (max - 1)); 58.48 + System.out.println("Actual : " + a); 58.49 + System.exit(97); 58.50 + } 58.51 + } 58.52 + static void loopAndPrint(int max) { 58.53 + int a = -1; 58.54 + int i = 1; 58.55 + for (; i < max; i++) { 58.56 + a = i; 58.57 + } 58.58 + verify(max, a); 58.59 + } 58.60 +} 58.61 +
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 59.2 +++ b/test/compiler/5091921/Test6905845.java Thu May 12 15:05:22 2011 -0700 59.3 @@ -0,0 +1,76 @@ 59.4 +/* 59.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 59.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 59.7 + * 59.8 + * This code is free software; you can redistribute it and/or modify it 59.9 + * under the terms of the GNU General Public License version 2 only, as 59.10 + * published by the Free Software Foundation. 59.11 + * 59.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 59.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 59.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 59.15 + * version 2 for more details (a copy is included in the LICENSE file that 59.16 + * accompanied this code). 59.17 + * 59.18 + * You should have received a copy of the GNU General Public License version 59.19 + * 2 along with this work; if not, write to the Free Software Foundation, 59.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 59.21 + * 59.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 59.23 + * or visit www.oracle.com if you need additional information or have any 59.24 + * questions. 59.25 + * 59.26 + */ 59.27 + 59.28 +/** 59.29 + * @test 59.30 + * @bug 6905845 59.31 + * @summary Server VM improperly optimizing away loop. 59.32 + * 59.33 + * @run main Test6905845 59.34 + */ 59.35 + 59.36 +public class Test6905845 { 59.37 + 59.38 + public static void main(String[] args){ 59.39 + for (int asdf = 0; asdf < 5; asdf++){ 59.40 + //test block 59.41 + { 59.42 + StringBuilder strBuf1 = new StringBuilder(65); 59.43 + long start = System.currentTimeMillis(); 59.44 + int count = 0; 59.45 + 59.46 + for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){ 59.47 + strBuf1.append(i); 59.48 + count++; 59.49 + strBuf1.delete(0, 65); 59.50 + } 59.51 + 59.52 + System.out.println(count); 59.53 + if (count != 54366674) { 59.54 + System.out.println("wrong count: " + count +", should be 54366674"); 59.55 + System.exit(97); 59.56 + } 59.57 + } 59.58 + //test block 59.59 + { 59.60 + StringBuilder strBuf1 = new StringBuilder(65); 59.61 + long start = System.currentTimeMillis(); 59.62 + int count = 0; 59.63 + 59.64 + for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){ 59.65 + strBuf1.append(i); 59.66 + count++; 59.67 + strBuf1.delete(0, 65); 59.68 + } 59.69 + 59.70 + System.out.println(count); 59.71 + if (count != 54366674) { 59.72 + System.out.println("wrong count: " + count +", should be 54366674"); 59.73 + System.exit(97); 59.74 + } 59.75 + } 59.76 + } 59.77 + } 59.78 +} 59.79 +
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 60.2 +++ b/test/compiler/5091921/Test6931567.java Thu May 12 15:05:22 2011 -0700 60.3 @@ -0,0 +1,62 @@ 60.4 +/* 60.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 60.7 + * 60.8 + * This code is free software; you can redistribute it and/or modify it 60.9 + * under the terms of the GNU General Public License version 2 only, as 60.10 + * published by the Free Software Foundation. 60.11 + * 60.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 60.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 60.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 60.15 + * version 2 for more details (a copy is included in the LICENSE file that 60.16 + * accompanied this code). 60.17 + * 60.18 + * You should have received a copy of the GNU General Public License version 60.19 + * 2 along with this work; if not, write to the Free Software Foundation, 60.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 60.21 + * 60.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 60.23 + * or visit www.oracle.com if you need additional information or have any 60.24 + * questions. 60.25 + * 60.26 + */ 60.27 + 60.28 +/** 60.29 + * @test 60.30 + * @bug 6931567 60.31 + * @summary JIT Error (on class file compiled with eclipse) on JVM x64 (but not on x32!). 60.32 + * 60.33 + * @run main Test6931567 60.34 + */ 60.35 + 60.36 +// Should be compiled with javac from JDK1.3 to get bytecode which shows the problem. 60.37 +public class Test6931567 { 60.38 + 60.39 + public static void main(final String[] args) { 60.40 + booleanInvert(Integer.MAX_VALUE); 60.41 + booleanInvert(Integer.MAX_VALUE - 1); 60.42 + } 60.43 + 60.44 + private static void booleanInvert(final int max) { 60.45 + boolean test1 = false; 60.46 + boolean test2 = false; 60.47 + 60.48 + for (int i = 0; i < max; i++) { 60.49 + test1 = !test1; 60.50 + } 60.51 + 60.52 + for (int i = 0; i < max; i++) { 60.53 + test2 ^= true; 60.54 + } 60.55 + 60.56 + if (test1 != test2) { 60.57 + System.out.println("ERROR: Boolean invert\n\ttest1=" + test1 60.58 + + "\n\ttest2=" + test2); 60.59 + System.exit(97); 60.60 + } else { 60.61 + System.out.println("Passed!"); 60.62 + } 60.63 + } 60.64 +} 60.65 +
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 61.2 +++ b/test/compiler/5091921/Test6935022.java Thu May 12 15:05:22 2011 -0700 61.3 @@ -0,0 +1,74 @@ 61.4 +/* 61.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 61.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 61.7 + * 61.8 + * This code is free software; you can redistribute it and/or modify it 61.9 + * under the terms of the GNU General Public License version 2 only, as 61.10 + * published by the Free Software Foundation. 61.11 + * 61.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 61.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 61.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 61.15 + * version 2 for more details (a copy is included in the LICENSE file that 61.16 + * accompanied this code). 61.17 + * 61.18 + * You should have received a copy of the GNU General Public License version 61.19 + * 2 along with this work; if not, write to the Free Software Foundation, 61.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 61.21 + * 61.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 61.23 + * or visit www.oracle.com if you need additional information or have any 61.24 + * questions. 61.25 + * 61.26 + */ 61.27 + 61.28 +/** 61.29 + * @test 61.30 + * @bug 6935022 61.31 + * @summary Server VM incorrectly breaks out of while loop 61.32 + * 61.33 + * @run main Test6935022 61.34 + */ 61.35 + 61.36 +public class Test6935022 { 61.37 + public static final void main(String[] args) throws Exception { 61.38 + Test6935022 test = new Test6935022(); 61.39 + 61.40 + int cnt = 0; 61.41 + 61.42 + while (cnt < 10000) { 61.43 + try { 61.44 + ++cnt; 61.45 + if ((cnt&1023) == 0) 61.46 + System.out.println("Thread="+Thread.currentThread().getName() + " iteration: " + cnt); 61.47 + test.loop(2147483647, (cnt&1023)); 61.48 + } 61.49 + 61.50 + catch (Exception e) { 61.51 + System.out.println("Caught on iteration " + cnt); 61.52 + e.printStackTrace(); 61.53 + System.exit(97); 61.54 + } 61.55 + } 61.56 + } 61.57 + 61.58 + private void loop(int endingRow, int mask) throws Exception { 61.59 + int rows = 1; 61.60 + boolean next = true; 61.61 + 61.62 + while(rows <= endingRow && next) { 61.63 + rows++; 61.64 + if (rows == mask) 61.65 + System.out.println("Rows="+rows+", end="+endingRow+", next="+next); 61.66 + next = next(rows); 61.67 + } 61.68 + 61.69 + if (next) 61.70 + throw new Exception("Ended on rows(no rs): " + rows); 61.71 + } 61.72 + 61.73 + private boolean next(int rows) { 61.74 + return rows < 12; 61.75 + } 61.76 +} 61.77 +
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 62.2 +++ b/test/compiler/5091921/Test6959129.java Thu May 12 15:05:22 2011 -0700 62.3 @@ -0,0 +1,90 @@ 62.4 +/* 62.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 62.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 62.7 + * 62.8 + * This code is free software; you can redistribute it and/or modify it 62.9 + * under the terms of the GNU General Public License version 2 only, as 62.10 + * published by the Free Software Foundation. 62.11 + * 62.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 62.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 62.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 62.15 + * version 2 for more details (a copy is included in the LICENSE file that 62.16 + * accompanied this code). 62.17 + * 62.18 + * You should have received a copy of the GNU General Public License version 62.19 + * 2 along with this work; if not, write to the Free Software Foundation, 62.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 62.21 + * 62.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 62.23 + * or visit www.oracle.com if you need additional information or have any 62.24 + * questions. 62.25 + * 62.26 + */ 62.27 + 62.28 +/** 62.29 + * @test 62.30 + * @bug 6959129 62.31 + * @summary COMPARISON WITH INTEGER.MAX_INT DOES NOT WORK CORRECTLY IN THE CLIENT VM. 62.32 + * 62.33 + * @run main/othervm -ea Test6959129 62.34 + */ 62.35 + 62.36 +public class Test6959129 { 62.37 + 62.38 + public static void main(String[] args) { 62.39 + long start = System.currentTimeMillis(); 62.40 + int min = Integer.MAX_VALUE-30000; 62.41 + int max = Integer.MAX_VALUE; 62.42 + long maxmoves = 0; 62.43 + try { 62.44 + maxmoves = maxMoves(min, max); 62.45 + } catch (AssertionError e) { 62.46 + System.out.println("Passed"); 62.47 + System.exit(95); 62.48 + } 62.49 + System.out.println("maxMove:" + maxmoves); 62.50 + System.out.println("FAILED"); 62.51 + System.exit(97); 62.52 + } 62.53 + /** 62.54 + * Imperative implementation that returns the length hailstone moves 62.55 + * for a given number. 62.56 + */ 62.57 + public static long hailstoneLengthImp(long n) { 62.58 + long moves = 0; 62.59 + while (n != 1) { 62.60 + assert n > 1; 62.61 + if (isEven(n)) { 62.62 + n = n / 2; 62.63 + } else { 62.64 + n = 3 * n + 1; 62.65 + } 62.66 + ++moves; 62.67 + } 62.68 + return moves; 62.69 + } 62.70 + 62.71 + private static boolean isEven(long n) { 62.72 + return n % 2 == 0; 62.73 + } 62.74 + 62.75 + /** 62.76 + * Returns the maximum length of the hailstone sequence for numbers 62.77 + * between min to max. 62.78 + * 62.79 + * For rec1 - Assume that min is bigger than max. 62.80 + */ 62.81 + public static long maxMoves(int min, int max) { 62.82 + long maxmoves = 0; 62.83 + for (int n = min; n <= max; n++) { 62.84 + if ((n & 1023) == 0) System.out.println(n); 62.85 + long moves = hailstoneLengthImp(n); 62.86 + if (moves > maxmoves) { 62.87 + maxmoves = moves; 62.88 + } 62.89 + } 62.90 + return maxmoves; 62.91 + } 62.92 +} 62.93 +
63.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 63.2 +++ b/test/compiler/5091921/Test6985295.java Thu May 12 15:05:22 2011 -0700 63.3 @@ -0,0 +1,53 @@ 63.4 +/* 63.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 63.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 63.7 + * 63.8 + * This code is free software; you can redistribute it and/or modify it 63.9 + * under the terms of the GNU General Public License version 2 only, as 63.10 + * published by the Free Software Foundation. 63.11 + * 63.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 63.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 63.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 63.15 + * version 2 for more details (a copy is included in the LICENSE file that 63.16 + * accompanied this code). 63.17 + * 63.18 + * You should have received a copy of the GNU General Public License version 63.19 + * 2 along with this work; if not, write to the Free Software Foundation, 63.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 63.21 + * 63.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 63.23 + * or visit www.oracle.com if you need additional information or have any 63.24 + * questions. 63.25 + * 63.26 + */ 63.27 + 63.28 +/** 63.29 + * @test 63.30 + * @bug 6985295 63.31 + * @summary JVM fails to evaluate condition randomly 63.32 + * 63.33 + * @run main/othervm -Xbatch Test6985295 63.34 + */ 63.35 + 63.36 +public class Test6985295 { 63.37 + 63.38 + public static void main(String[] args) { 63.39 + int min = Integer.MAX_VALUE-50000; 63.40 + int max = Integer.MAX_VALUE; 63.41 + System.out.println("max = " + max); 63.42 + long counter = 0; 63.43 + int i; 63.44 + for(i = min; i <= max; i++) { 63.45 + counter++; 63.46 + if (counter > 1000000) { 63.47 + System.out.println("Passed"); 63.48 + System.exit(95); 63.49 + } 63.50 + } 63.51 + System.out.println("iteration went " + counter + " times (" + i + ")"); 63.52 + System.out.println("FAILED"); 63.53 + System.exit(97); 63.54 + } 63.55 +} 63.56 +
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 64.2 +++ b/test/compiler/5091921/Test6992759.java Thu May 12 15:05:22 2011 -0700 64.3 @@ -0,0 +1,66 @@ 64.4 +/* 64.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 64.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 64.7 + * 64.8 + * This code is free software; you can redistribute it and/or modify it 64.9 + * under the terms of the GNU General Public License version 2 only, as 64.10 + * published by the Free Software Foundation. 64.11 + * 64.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 64.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 64.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 64.15 + * version 2 for more details (a copy is included in the LICENSE file that 64.16 + * accompanied this code). 64.17 + * 64.18 + * You should have received a copy of the GNU General Public License version 64.19 + * 2 along with this work; if not, write to the Free Software Foundation, 64.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 64.21 + * 64.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 64.23 + * or visit www.oracle.com if you need additional information or have any 64.24 + * questions. 64.25 + * 64.26 + */ 64.27 + 64.28 +/** 64.29 + * @test 64.30 + * @bug 6992759 64.31 + * @summary Bad code generated for integer <= comparison, fails for Integer.MAX_VALUE 64.32 + * 64.33 + * @run main Test6992759 64.34 + */ 64.35 + 64.36 +public class Test6992759 { 64.37 + 64.38 + static final int N_TESTS = 1000000000; 64.39 + 64.40 + public static void main(String[] args) throws Exception { 64.41 + 64.42 + /* 64.43 + * If MAX_VALUE is changed to MAX_VALUE - 1 below, the test passes 64.44 + * because (apparently) bad code is only generated when comparing 64.45 + * <= MAX_VALUE in the doTest method. 64.46 + */ 64.47 + Test6992759 test = new Test6992759(); 64.48 + for (int i = 0; i < N_TESTS; i += 1) { 64.49 + test.doTest(10, Integer.MAX_VALUE, i); 64.50 + //test.doTest(10, Integer.MAX_VALUE - 1, i); 64.51 + } 64.52 + System.out.println("No failure"); 64.53 + } 64.54 + 64.55 + void doTest(int expected, int max, int i) { 64.56 + int counted; 64.57 + for (counted = 0; 64.58 + (counted <= max) && (counted < expected); 64.59 + counted += 1) { 64.60 + } 64.61 + if (counted != expected) { 64.62 + throw new RuntimeException("Failed test iteration=" + i + 64.63 + " max=" + max + 64.64 + " counted=" + counted + 64.65 + " expected=" + expected); 64.66 + } 64.67 + } 64.68 +} 64.69 +
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 65.2 +++ b/test/compiler/5091921/Test7005594.java Thu May 12 15:05:22 2011 -0700 65.3 @@ -0,0 +1,59 @@ 65.4 +/* 65.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 65.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 65.7 + * 65.8 + * This code is free software; you can redistribute it and/or modify it 65.9 + * under the terms of the GNU General Public License version 2 only, as 65.10 + * published by the Free Software Foundation. 65.11 + * 65.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 65.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 65.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 65.15 + * version 2 for more details (a copy is included in the LICENSE file that 65.16 + * accompanied this code). 65.17 + * 65.18 + * You should have received a copy of the GNU General Public License version 65.19 + * 2 along with this work; if not, write to the Free Software Foundation, 65.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 65.21 + * 65.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 65.23 + * or visit www.oracle.com if you need additional information or have any 65.24 + * questions. 65.25 + * 65.26 + */ 65.27 + 65.28 +/** 65.29 + * @test 65.30 + * @bug 7005594 65.31 + * @summary Array overflow not handled correctly with loop optimzations 65.32 + * 65.33 + * @run main/othervm -Xms2048m -Xcomp -XX:CompileOnly=Test7005594.test Test7005594 65.34 + */ 65.35 + 65.36 +public class Test7005594 { 65.37 + 65.38 + static int test(byte a[]){ 65.39 + int result=0; 65.40 + for( int i=0; i<a.length; i+=((0x7fffffff>>1)+1) ){ 65.41 + result += a[i]; 65.42 + } 65.43 + return result; 65.44 + } 65.45 + 65.46 + public static void main(String [] args){ 65.47 + byte a[]=new byte[(0x7fffffff>>1)+2]; 65.48 + int result = 0; 65.49 + try { 65.50 + result = test(a); 65.51 + } catch (ArrayIndexOutOfBoundsException e) { 65.52 + e.printStackTrace(System.out); 65.53 + System.out.println("Passed"); 65.54 + System.exit(95); 65.55 + } 65.56 + System.out.println(result); 65.57 + System.out.println("FAILED"); 65.58 + System.exit(97); 65.59 + } 65.60 + 65.61 +} 65.62 +
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 66.2 +++ b/test/compiler/5091921/Test7020614.java Thu May 12 15:05:22 2011 -0700 66.3 @@ -0,0 +1,58 @@ 66.4 +/* 66.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 66.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 66.7 + * 66.8 + * This code is free software; you can redistribute it and/or modify it 66.9 + * under the terms of the GNU General Public License version 2 only, as 66.10 + * published by the Free Software Foundation. 66.11 + * 66.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 66.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 66.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 66.15 + * version 2 for more details (a copy is included in the LICENSE file that 66.16 + * accompanied this code). 66.17 + * 66.18 + * You should have received a copy of the GNU General Public License version 66.19 + * 2 along with this work; if not, write to the Free Software Foundation, 66.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 66.21 + * 66.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 66.23 + * or visit www.oracle.com if you need additional information or have any 66.24 + * questions. 66.25 + * 66.26 + */ 66.27 + 66.28 +/** 66.29 + * @test 66.30 + * @bug 7020614 66.31 + * @summary "-server" mode optimizer makes code hang 66.32 + * 66.33 + * @run main/othervm/timeout=30 -Xbatch Test7020614 66.34 + */ 66.35 + 66.36 +public class Test7020614 { 66.37 + 66.38 + private static final int ITERATIONS = 1000; 66.39 + private static int doNotOptimizeOut = 0; 66.40 + 66.41 + public static long bitCountShort() { 66.42 + long t0 = System.currentTimeMillis(); 66.43 + int sum = 0; 66.44 + for (int it = 0; it < ITERATIONS; ++it) { 66.45 + short value = 0; 66.46 + do { 66.47 + sum += Integer.bitCount(value); 66.48 + } while (++value != 0); 66.49 + } 66.50 + doNotOptimizeOut += sum; 66.51 + return System.currentTimeMillis() - t0; 66.52 + } 66.53 + 66.54 + public static void main(String[] args) { 66.55 + for (int i = 0; i < 4; ++i) { 66.56 + System.out.println((i + 1) + ": " + bitCountShort()); 66.57 + } 66.58 + System.out.println("doNotOptimizeOut value: " + doNotOptimizeOut); 66.59 + } 66.60 +} 66.61 +
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 67.2 +++ b/test/compiler/5091921/input6890943.txt Thu May 12 15:05:22 2011 -0700 67.3 @@ -0,0 +1,1543 @@ 67.4 +50 67.5 +4 5 1 67.6 +..... 67.7 +##### 67.8 +..### 67.9 +.#... 67.10 +4 5 1 67.11 +..... 67.12 +##### 67.13 +###.. 67.14 +...#. 67.15 +5 4 2 67.16 +.... 67.17 +#### 67.18 +..## 67.19 +.### 67.20 +.#.# 67.21 +6 10 5 67.22 +.......... 67.23 +####.##### 67.24 +####.##### 67.25 +####.##### 67.26 +####.##### 67.27 +####.##### 67.28 +6 10 4 67.29 +.......... 67.30 +#....##### 67.31 +#....##### 67.32 +#....##### 67.33 +#....##### 67.34 +#....##### 67.35 +6 10 1 67.36 +.......... 67.37 +####.##### 67.38 +####.##### 67.39 +####.##### 67.40 +####.##### 67.41 +####.##### 67.42 +6 10 2 67.43 +.......... 67.44 +####.##### 67.45 +####.##### 67.46 +####.##### 67.47 +####.##### 67.48 +####.##### 67.49 +6 11 2 67.50 +.....###### 67.51 +########### 67.52 +###.......# 67.53 +###.#.#...# 67.54 +###.#.##..# 67.55 +###.#.###.# 67.56 +6 11 1 67.57 +.....###### 67.58 +########### 67.59 +###.......# 67.60 +###.#.#...# 67.61 +###.#.##..# 67.62 +###.#.###.# 67.63 +6 11 2 67.64 +.......#### 67.65 +########### 67.66 +###.......# 67.67 +###.#.#...# 67.68 +###.#.##..# 67.69 +###.#.###.# 67.70 +7 11 1 67.71 +..#........ 67.72 +##.#....... 67.73 +###.#...... 67.74 +####.#..... 67.75 +#####.#.... 67.76 +######.#... 67.77 +#########.. 67.78 +13 16 2 67.79 +................ 67.80 +#.#.#.#.#.#.#.#. 67.81 +................ 67.82 +.#.#.#.#.#.#.#.# 67.83 +................ 67.84 +#.#.#.#.#.#.#.#. 67.85 +................ 67.86 +.#.#.#.#.#.#.#.# 67.87 +................ 67.88 +#.#.#.#.#.#.#.#. 67.89 +................ 67.90 +.#.#.#.#.#.#.#.# 67.91 +................ 67.92 +4 16 3 67.93 +................ 67.94 +#.#.#.#.#.#.#.#. 67.95 +.#.#.#.#.#.#.#.# 67.96 +................ 67.97 +50 50 1 67.98 +.................................................. 67.99 +################################################.# 67.100 +.#............#....#.......................#....## 67.101 +..#.....#......#....#.....................#....#.. 67.102 +...#.......#....#....#...................#....#... 67.103 +#...#....#.......#....#.................#....#.... 67.104 +##...#.......#....#....#...............#....#..... 67.105 +###...#....#.......#....#.............#....#...... 67.106 +####...#.......#....#....#...........#....#....... 67.107 +.####...#....#.......#....#.........#....#........ 67.108 +..####...#.......#....#....#.......#....#......... 67.109 +...####...#....#.......#....#.....#....#.......... 67.110 +....####...#.......#....#....#...#....#...###..... 67.111 +.....####...#....#.......#....#.#....#..##..###... 67.112 +......####...#.......#....#....#.............##... 67.113 +.......####...#....#.......#...............##..... 67.114 +........####...#.......#....#............##....... 67.115 +.........####...#....#.......#.........#######.... 67.116 +..###.....####...#.......#....#................... 67.117 +.#..###....####...#....#.......#.........####..... 67.118 +##...###....####...#.......#....#.......##..##.... 67.119 +##...........####...#....#.......#......##..##.... 67.120 +##..####......####...#.......#....##....##..##.... 67.121 +##....##.......####...#....#......##....##..##.... 67.122 +.###.##.........####.............##.....##..##.... 67.123 +..###............#######........##.......####..... 67.124 +.........###......######.......##................. 67.125 +.......##..##..........#......##.........####..... 67.126 +......##....##........#......##.........##..##.... 67.127 +......##.............#......##..........##..##.... 67.128 +......##............#......##...........##..##.... 67.129 +......##....#......#......##............##..##.... 67.130 +.......##..##.....#....########.........##..##.... 67.131 +........####.....#.....###.#...#.........####..... 67.132 +.#####..........#.....#..##.#...#................. 67.133 +...##..........#.....#....##.#...#.........####... 67.134 +...##.........#.....#..#...##.#...#.......##..##.. 67.135 +...##........#.....#..##....##.#...#......##..##.. 67.136 +...##.......#.....#....##....##.#...#.....##..##.. 67.137 +##.##......#.....#...###......##.#...#.....#####.. 67.138 +.###......#.....#..##..........##.#...#.......##.. 67.139 +.........#.....#...##..####.....##.#...#.....##... 67.140 +........#.....#...###..#.##......##.#...#...##.... 67.141 +.......#.....#....##.....###......##.#...#........ 67.142 +......#.....#..#.##...###..........##.#...#....... 67.143 +.....#.....#...##..#..#..##.##.#....##.#...#...... 67.144 +....#.....#........###.....##........##.#...#..... 67.145 +...#.....#.......##...####..###.......##.#...#.... 67.146 +..#.....#......##.#.#..#.#..##.........##.#...#... 67.147 +.#..............#.#.#.#.#.#.#...........##.#...#.. 67.148 +50 50 13 67.149 +.................................................. 67.150 +################################################## 67.151 +################################################## 67.152 +################################################## 67.153 +################################################## 67.154 +################################################## 67.155 +################################################## 67.156 +################################################## 67.157 +################################################## 67.158 +################################################## 67.159 +################################################## 67.160 +################################################## 67.161 +################################################## 67.162 +################################################## 67.163 +################################################## 67.164 +################################################## 67.165 +################################################## 67.166 +################################################## 67.167 +################################################## 67.168 +################################################## 67.169 +################################################## 67.170 +################################################## 67.171 +################################################## 67.172 +################################################## 67.173 +################################################## 67.174 +################################################## 67.175 +################################################## 67.176 +################################################## 67.177 +################################################## 67.178 +################################################## 67.179 +################################################## 67.180 +################################################## 67.181 +################################################## 67.182 +################################################## 67.183 +################################################## 67.184 +################################################## 67.185 +################################################## 67.186 +################################################## 67.187 +################################################## 67.188 +################################################## 67.189 +################################################## 67.190 +################################################## 67.191 +################################################## 67.192 +################################################## 67.193 +################################################## 67.194 +################################################## 67.195 +################################################## 67.196 +################################################## 67.197 +################################################## 67.198 +################################################## 67.199 +20 49 5 67.200 +................................................. 67.201 +################################################# 67.202 +################################################# 67.203 +##################################.############## 67.204 +################################################# 67.205 +################################################# 67.206 +################################################# 67.207 +################################################# 67.208 +################################################# 67.209 +################################################# 67.210 +############################.#################### 67.211 +################################################# 67.212 +######.########################################## 67.213 +################################################# 67.214 +################################################# 67.215 +################################################# 67.216 +################################################# 67.217 +################################################# 67.218 +################################################# 67.219 +################################################# 67.220 +49 49 48 67.221 +................................................. 67.222 +################################################# 67.223 +################################################. 67.224 +################################################# 67.225 +####################################.############ 67.226 +################################################# 67.227 +##########.###################################### 67.228 +#######.######################################### 67.229 +################################################# 67.230 +################################################# 67.231 +################################################# 67.232 +#######################################.######### 67.233 +################################################# 67.234 +################################################# 67.235 +################################################# 67.236 +################################################# 67.237 +################################################# 67.238 +###########################################.##### 67.239 +################################################# 67.240 +################################################# 67.241 +###.############################################# 67.242 +###############.################################# 67.243 +################################################# 67.244 +##.############################################## 67.245 +################################################# 67.246 +################################################# 67.247 +################################################# 67.248 +################################################# 67.249 +################################################# 67.250 +#####################################.########### 67.251 +################################################# 67.252 +################################################# 67.253 +################################################# 67.254 +################################################# 67.255 +################################################# 67.256 +################################################# 67.257 +################################################# 67.258 +#####.########################################### 67.259 +#####################.########################### 67.260 +################################################# 67.261 +###.############################################# 67.262 +################################################# 67.263 +################################################# 67.264 +################################################# 67.265 +#############.###########.####################### 67.266 +###.##############.####.######################### 67.267 +#########################################.####### 67.268 +################################################# 67.269 +########################################.######## 67.270 +40 49 10 67.271 +................................................. 67.272 +################################################# 67.273 +..#..............#............................... 67.274 +.......................#.......................#. 67.275 +..#....#...................#.................#... 67.276 +..........#...............................#...... 67.277 +............#..................#.......#......... 67.278 +........#............#............#.............. 67.279 +...................#.....#....................... 67.280 +....#..........#........................#........ 67.281 +....#.................................#......#... 67.282 +...........#..................................... 67.283 +....................#............................ 67.284 +.##........#................#.................... 67.285 +..............#.................................. 67.286 +........#......................................#. 67.287 +.................................#....#........#. 67.288 +................................................. 67.289 +.............................#..##............... 67.290 +...........................................#.#... 67.291 +........#..........#........#.............#.....# 67.292 +..........#.#.................................... 67.293 +.............................#............#...... 67.294 +.......#.......................#.........#....... 67.295 +..............................#.................. 67.296 +......#.......................................... 67.297 +.............#................#.................. 67.298 +......#.............................#............ 67.299 +#.................#..................#......#.... 67.300 +..............#.................................. 67.301 +...........#...........................#.....#... 67.302 +............#............#...#................... 67.303 +.......................#.......................#. 67.304 +............................#.................... 67.305 +..........................#...................... 67.306 +...........................#.............#...#... 67.307 +.#............................................... 67.308 +..................#.............................. 67.309 +...#..............................#.............. 67.310 +.....#..................#........................ 67.311 +49 49 20 67.312 +.........................................##..#..# 67.313 +########################################.##...#.# 67.314 +#.##..#....#####..####...#..#.##.###.#..#..#..... 67.315 +..#...#.##...##.#....#...##..#.#..###...###...... 67.316 +..#..##.#.###......#.....##.....#.......##.#.#.#. 67.317 +..##......###.#.##.....##.#..#.##.###..##.#.##### 67.318 +#.#.##....#..#..#.....#.#.##.#.#.##.#.....###.#.# 67.319 +..###.#..#..###...###..#.#.....#..######.#.#....# 67.320 +..#...#...##.#..##.#.#.#..###.#..#..#...#....##.. 67.321 +.#..#.#..##.#...##........##.##..#..........#.#.. 67.322 +#.#.###.####...#.#...#..###..#.##....#........... 67.323 +#..#.#######.#....#.#.##...#.#.............##.... 67.324 +###..###....#..#....#.#.###...#..##.#.#..##.##### 67.325 +....####...#.#...........##.#.#.#..#.#.#.##.#.#.. 67.326 +##.#...##..#..#...#..##..####.##.#...#.....#...#. 67.327 +...###.##.#..##.....#.#.##..#..###.#.###.#.#..#.# 67.328 +###....##...#.#.##.##..#.#...#...##....#.###..... 67.329 +##..#....###..#.....#..#....#.#.#.##.......##.### 67.330 +.#.#....#.....####..##....##...##...#.##..##.#... 67.331 +##....#....#.#.###.##...#..##.##...##....#.###### 67.332 +..#....#..##.....##.##.#.........##..##...#.#.... 67.333 +#..#..#.#....##.#.#...#.###..#...#..#.##.#.#....# 67.334 +.....#..#...###.....##...###....###.##.....#...#. 67.335 +#..#.#...###..#....#..####....#.#......#..##....# 67.336 +.....#.#...###...###.#..#.#.#.........#.#.#..#.## 67.337 +.#..##..##..#..#.#....##.........#..#.##.#..##... 67.338 +##.#.#.....##.##..###...#.#.#..#.#.####.#.###.#.. 67.339 +..#.#.......#.#.#...#####..#.##.#....#...#.#..... 67.340 +..########.####.....#..#.........#..#####.##.#... 67.341 +.#......##.####..###..#.####........#....#....#.# 67.342 +#.....#....#...#...#..###......#.##..#..#...#.### 67.343 +...#..###.....#....#..#..#......#.....#.#.#.#..## 67.344 +....#.##..####.#..###...#...#...#######..#..#.... 67.345 +.#..#...##...#...#......##...#####.##...#..##.... 67.346 +..#.#.#######.#....#.#.###....#.##...#..#.##..#.. 67.347 +#..#.##.#.#.##..###....#.##.#..#..#...##....##..# 67.348 +.###.#.#..##.###...#..##.#.#...#.#.####....#..### 67.349 +#.#......#...##.##...#.#.....##..#..##....#.##... 67.350 +#.#...#.#.##...##.###.#..##..##..####..##.#.#...# 67.351 +....#....#..####.##.....#.#....#..##..##....#..#. 67.352 +....#...###.....##..#..###....#........###..##..# 67.353 +.###....##...........#....#........####.#.####..# 67.354 +.#........##...#.###..###.#...##.##..###..###..## 67.355 +#.#######.#....###...#..##..#...#....##....#....# 67.356 +#....#..#......#..#...##.....##.#.#.#..#......##. 67.357 +#.##.##.#.#.##..#..##..######.##.###.#.#..#....#. 67.358 +.###.##.....#.##.#..###....###..##....#.#..#..... 67.359 +#####..#.#....#.#......##..##.#...........####.#. 67.360 +..#..#.#..#...##....###.##.#.#...#..#..#....#..## 67.361 +49 49 5 67.362 +.........................................#....### 67.363 +#########################################..#..... 67.364 +.....#.###...#...#...........##...#...#....#...#. 67.365 +....#.....#..#....#....##...#..###.#...#..##.#.## 67.366 +....#...###.##...........#.#.##.......#.#.#.#..#. 67.367 +...........#..###..#..##.....#.........#.....#... 67.368 +.....#......#.##.#..##.###.....#...###.#....#...# 67.369 +.#......##.#.......##...##.....###..#......#.##.. 67.370 +#.....#.#..#.#...#####...#.###.##.....#..#....... 67.371 +........##....#....#....#.#.#....####....#.##.### 67.372 +....#.#......#.##.....#..........##.............# 67.373 +#..##....#.#....#..#.....#.#.#....#.#.#....##...# 67.374 +...#..##..#...#....#.#....#..#....#..#..#.......# 67.375 +......#...##.#.####.....####.###.#..#........#### 67.376 +##..........#...........#..#.##......##......#.## 67.377 +....###....##...#.####.....#............#..#..... 67.378 +...#....#....##.....##.....#.#.....#..#.#..#..#.. 67.379 +...........#...#.##..##..##.#......#..#.#..##.... 67.380 +.#........##......#.........##..#..........#.#... 67.381 +#....##.#.##..#.....#.....##.....##....#......... 67.382 +.#.......###.......#..#.....#.....#..##.##...#..# 67.383 +###......##.....##...##..#.#....#...####.##...... 67.384 +....#..#....##...#.##.##.#.#...#...#.#..#.##.#..# 67.385 +..........#.#..#####..####....##..#.#.#.........# 67.386 +........##.#.###..###....#...#........##.#......# 67.387 +...........##.##..#.....#.#.#..#....#.###..#.###. 67.388 +#.#....#.#...##............#.#.....#....#...#.#.. 67.389 +..###.#.##...#....#..##.##...#........#.......... 67.390 +...........#...##...#..#..##.....#..#.......#..#. 67.391 +#.#.#......##.#.....#...#.#.#.#...#..#######.#.## 67.392 +...##..#.......###..#..#.##....#......####.#..... 67.393 +....##......#.#......#....##..#...##.......#..#.. 67.394 +#..###.##....##..##.#..#.###.##.....#...#........ 67.395 +#......#....####....#.........#.........#.##.##.. 67.396 +.#.#..###......#...##.#.##..#.#.....#...#.#...... 67.397 +......#.#...##.#....#..#.#.......#.#.....#.#.###. 67.398 +###..#.....#....#.#...##..#.#.....#.#.....#.#.#.. 67.399 +..........#........#....#...#..#...#...#.#.#.#... 67.400 +#..##..#...###....#.#..#....##....#...#..##....#. 67.401 +.#.#.#....#..##.#...#.....#.##..#....##........#. 67.402 +..#.##....###...#...#..#..#.....#..#..###..#...#. 67.403 +##....#........#..#..#..#......#...#.##....#.#.## 67.404 +....#.............#..#...#...#.#.#...##....#..#.# 67.405 +...#.........#....###.....#.#..#..#...#..#...#... 67.406 +.#.#.###..###..##.#.##...#...#..#................ 67.407 +.#......#..#..#.#.#...#.....................#..#. 67.408 +..#.....#.......#..##.......#...#...##.#.....#.#. 67.409 +#..####.#....#......#.........#.#...###...#....#. 67.410 +#.#.#.#....#......#..#.#........###..#....##..... 67.411 +31 47 7 67.412 +.........................#.#..##.#..#...#.#...# 67.413 +#########################.#.#...#...#.#........ 67.414 +...#...........#...#...#...##...#..#.#.#...#.## 67.415 +.#........#.......#.#.....#......#........#.... 67.416 +#.#....###...#...#....#....#......##...#....... 67.417 +#.#......##..##...#.....#.##.#.........#....... 67.418 +.......#.....##........#..#.......#.##...#..... 67.419 +..#.......##.#...#.#..#.#..#....#......#......# 67.420 +#.##.........#####..###.......#........#......# 67.421 +.#..#.#.#...#....####...#...........#....#..... 67.422 +##..##..#..###..###....##......#....#..##...#.# 67.423 +#......#........##...#.#.#..#..#....#..#...##.# 67.424 +.#.#.##..........#.#..#...##.##................ 67.425 +##.##.#...#....#.............#.#.....###...#.#. 67.426 +..#..#.#..#..#.#....#....#............#.##..#.. 67.427 +......###......#..##..#.#...##.........#.#.###. 67.428 +..#.##.#..#......##....#.#........#....##..#..# 67.429 +.........#.#.#.....##...#.#...#.##.....##.##... 67.430 +.#........#...#.###.........#.#.#.............. 67.431 +....##........#.....#....###....###.#..#....##. 67.432 +..#..#....#....#.#.......#.#.#..........###.... 67.433 +.#..###.#...#.###...##...#....#...#............ 67.434 +##.....#..##.#.##.##.......#.##.....###...##.#. 67.435 +.###.......#...#.....#.....###.........#...#... 67.436 +#.....#..####.....##...#........####..........# 67.437 +#..#...........##.#.#.#..............#....##... 67.438 +..#.#..........#..##.#.##...##..##.#.#..##..#.. 67.439 +#..........................###......#....##.... 67.440 +.....#..........#..#......#...#.#..#....#...#.. 67.441 +#......#....##.........#..#.......#..#.......#. 67.442 +.#......#...###...##....##.#..........#...#..#. 67.443 +44 35 13 67.444 +...........................##..#### 67.445 +############################.....## 67.446 +..###.#.##.#...#.##.####.###.###.## 67.447 +#.##.#.#.#.#..###.#..#...###.##..## 67.448 +.#.##.#.##..#.###.###.##.#.#...#.#. 67.449 +##....##.#..#####.#.####..##.##...# 67.450 +####.##..##.###.##.#.#...#.##.###.# 67.451 +#.#######.#.#.#..#.#..#..#...###.#. 67.452 +##.###.#..#.####.##.#.#########.##. 67.453 +#.##.#######..#.#.####.#..#..###### 67.454 +.#.##..########...##.###..#..##.##. 67.455 +#.#######.###...##.#...#.####.#..#. 67.456 +.###..###....#.#.##.###..##.##.##.# 67.457 +...#.###.#.##.#.####.##.####.#.#... 67.458 +#..#......##....#.##.#.#.###.#..#.. 67.459 +...##.###.###.#.####..#.#.#..###.#. 67.460 +.#####.#..#..##.#.#...##.#.#.##...# 67.461 +..##..#.#....##.#.#.###.##.##...#.. 67.462 +###.#..###....#######..#.#.###.##.# 67.463 +##.##.#.#.##..#.#.#.#.#..##.####... 67.464 +##.###...#.###.#.#.#..#####.###.#.. 67.465 +...#.#...##......#.##..##.##.#.#.## 67.466 +##..#..####..###...###.#........### 67.467 +##..#....#..#.#..##.#####..###.#... 67.468 +##...#.#####.###.##....###...####.. 67.469 +#.####.#..#.##.#.#...#.###.#...##.. 67.470 +####.#####.###.#.##...##...#...#.## 67.471 +#..##.##....###..#..####.##..#.#.## 67.472 +..#.###.##....####.##.#..###.#....# 67.473 +#.#.###.#..#.##.##...###.##..###### 67.474 +##.#.##.###.#..#...###.####..##.### 67.475 +.########.#....#..#........#..##..# 67.476 +####..#.##.#.##.####..#.###...##### 67.477 +#..##..#..##.###....####.#.#...#.#. 67.478 +.#...##.##.###.###...##..##..###... 67.479 +###.##...#.##...####.#.#.##..#.#### 67.480 +##.###..##.#....#.###..##.#...###.# 67.481 +##..##.###..#..#.####.#.....##.#### 67.482 +.#....##...#####.....####...#.##.#. 67.483 +##.#.#.....##...#..#...#....#....## 67.484 +#..#.#..#####.##..###.#.########### 67.485 +.#.###.#..###.##.###.#.###.##.#.### 67.486 +.###..####.#..##......#..##.######. 67.487 +...##..###.#.....##.#.#..##......#. 67.488 +6 10 2 67.489 +.......#.. 67.490 +########## 67.491 +##.#...#.. 67.492 +.#..###... 67.493 +#.##.##### 67.494 +.####..#.# 67.495 +7 9 4 67.496 +......##. 67.497 +######### 67.498 +.#.###.## 67.499 +..#...#.. 67.500 +.....##.# 67.501 +####...## 67.502 +.#..#.#.# 67.503 +10 9 2 67.504 +......... 67.505 +######### 67.506 +..###.### 67.507 +#..###.## 67.508 +.....#.#. 67.509 +..##..... 67.510 +###.#.... 67.511 +.##..#... 67.512 +##...#..# 67.513 +#..##..## 67.514 +10 7 1 67.515 +....#.. 67.516 +####..# 67.517 +####..# 67.518 +..#.#.. 67.519 +...##.# 67.520 +#....## 67.521 +..#..## 67.522 +#.#.... 67.523 +.##.#.. 67.524 +###...# 67.525 +6 10 2 67.526 +.......#.. 67.527 +#######.#. 67.528 +..##.#.##. 67.529 +..#..#.... 67.530 +.#.#....## 67.531 +..#....#.. 67.532 +40 40 5 67.533 +........................................ 67.534 +###############################..####### 67.535 +#..##############.....################## 67.536 +........................................ 67.537 +...........................##########... 67.538 +#####...################..############## 67.539 +##################.##################### 67.540 +.............................#####...... 67.541 +#.............................########## 67.542 +...............................####..... 67.543 +.........#################.............. 67.544 +..........................###........... 67.545 +........................................ 67.546 +....................#####............... 67.547 +##########....................########## 67.548 +.......##################............... 67.549 +########........###############..####### 67.550 +........................................ 67.551 +..........#########################..... 67.552 +#####................................... 67.553 +.........................####........... 67.554 +......................#####...######.... 67.555 +######..................################ 67.556 +........#########....................... 67.557 +############.........................### 67.558 +........####################............ 67.559 +......................################## 67.560 +....................######......#....... 67.561 +............################............ 67.562 +........................................ 67.563 +......................#########......... 67.564 +#######............##################### 67.565 +........###############................. 67.566 +........................................ 67.567 +.........###################............ 67.568 +.............................#.......... 67.569 +######................................## 67.570 +........................#############... 67.571 +......##................................ 67.572 +........................................ 67.573 +30 20 11 67.574 +.................... 67.575 +#################### 67.576 +......##.##......... 67.577 +#.....####....###### 67.578 +...##............... 67.579 +........#######.###. 67.580 +.......##........... 67.581 +....#####..##....... 67.582 +........##.#........ 67.583 +.....###...........# 67.584 +..##########.....##. 67.585 +..#........#.#...... 67.586 +......##...##....... 67.587 +....##...###..###... 67.588 +.####...#####...#### 67.589 +###................. 67.590 +.......##........... 67.591 +..........###..####. 67.592 +..####..#####.#####. 67.593 +..###....#.......##. 67.594 +......##....##...... 67.595 +....##.###.......... 67.596 +.##.....#####..#.... 67.597 +.................... 67.598 +......###........... 67.599 +####..###.#########. 67.600 +.......#######...... 67.601 +....###............. 67.602 +.........###.#####.. 67.603 +................#### 67.604 +50 20 17 67.605 +.................... 67.606 +###################. 67.607 +#..##............... 67.608 +.................... 67.609 +............####.... 67.610 +........#####....... 67.611 +..............#..#.. 67.612 +.........####...#### 67.613 +.............####... 67.614 +.....#....###....... 67.615 +####...............# 67.616 +.................... 67.617 +.....######......... 67.618 +......#............. 67.619 +.####......#####.... 67.620 +.............##..... 67.621 +#####....#####...... 67.622 +..#####............. 67.623 +##..####....###..### 67.624 +.................... 67.625 +.................... 67.626 +........######.###.. 67.627 +....####....#####... 67.628 +....########........ 67.629 +...#####............ 67.630 +.###................ 67.631 +...............###.. 67.632 +.......#########.... 67.633 +..................## 67.634 +.......####......... 67.635 +..#####............. 67.636 +...####............. 67.637 +.##..........#####.. 67.638 +.................... 67.639 +...#.##.......###... 67.640 +######.....##......# 67.641 +......####.......... 67.642 +......#............. 67.643 +.................... 67.644 +.................... 67.645 +.................... 67.646 +.....#.............. 67.647 +.....####....###.... 67.648 +......#.........#### 67.649 +.......######...###. 67.650 +.................... 67.651 +.................... 67.652 +##...........###...# 67.653 +.###................ 67.654 +......#######....... 67.655 +45 25 10 67.656 +......................... 67.657 +######################### 67.658 +#...................#..## 67.659 +....................#.... 67.660 +......................... 67.661 +......................... 67.662 +...................#####. 67.663 +##.....................## 67.664 +.#.....................#. 67.665 +##.....................## 67.666 +......................... 67.667 +.....####................ 67.668 +.....##.#................ 67.669 +.....##.#................ 67.670 +.....##.#............#### 67.671 +.....##.#.......###..#### 67.672 +.....##.#.......#.#...... 67.673 +.....##.######..#.#...... 67.674 +.....####....#..#.#..###. 67.675 +........#....#..#.#..###. 67.676 +...##...#....#..#.#...... 67.677 +...##...#....#..#.#...... 67.678 +...##...#....#..#.#...... 67.679 +...##...#....#..#.#...... 67.680 +...########..#..###...... 67.681 +##.##...#....#........### 67.682 +.#.##...######..#####.#.. 67.683 +.#.##...........#...#.#.. 67.684 +.#.##...........#...#.#.. 67.685 +.#..............#...#.#.. 67.686 +.#..............#...#.#.. 67.687 +.#.####.........#...#.#.. 67.688 +.#.#..#.........#...#.#.. 67.689 +.#.#..#.........#####.#.. 67.690 +##.#.##########.......### 67.691 +...#.####.....#.......... 67.692 +..#####.#.....#..####.... 67.693 +..#####.#.....#..#..#.... 67.694 +..#..#..#.....#..#..#.... 67.695 +..#..#..#.....#..#..#.... 67.696 +#.#..#..#.....#..#..#..## 67.697 +#.#..#..#######..#..#..#. 67.698 +#.####.......#####..#..#. 67.699 +#............#..##..#..#. 67.700 +#............########..#. 67.701 +25 45 5 67.702 +............................................. 67.703 +############################################# 67.704 +..........#...###################.#...#...... 67.705 +#########.#....############################## 67.706 +#########.#.............##################... 67.707 +####################....##################### 67.708 +#########..........#........################# 67.709 +####################........################# 67.710 +..................####################.....#. 67.711 +####..............#...........############### 67.712 +######################################.###### 67.713 +#########################.....#...########### 67.714 +###.###################.......#.....######### 67.715 +#####.#.........#.....#.....################# 67.716 +############################################# 67.717 +###.#############...####............######### 67.718 +......############################...#....#.. 67.719 +....#########....................#...######.. 67.720 +##########.##..............################## 67.721 +#####################......################## 67.722 +############################################# 67.723 +############################################# 67.724 +#######################################...### 67.725 +############################################# 67.726 +##########....############################### 67.727 +40 40 5 67.728 +...............................######### 67.729 +######################################## 67.730 +######################################## 67.731 +######################################## 67.732 +#########....########################### 67.733 +######################################## 67.734 +######################################## 67.735 +######################################## 67.736 +######################################## 67.737 +######################################## 67.738 +######################################## 67.739 +..#######.######################........ 67.740 +######################################## 67.741 +######################################## 67.742 +######################################## 67.743 +...........#####################........ 67.744 +####.................################### 67.745 +######################################## 67.746 +######################################## 67.747 +######################################## 67.748 +######################################## 67.749 +#####................################### 67.750 +###################...........########## 67.751 +######################################## 67.752 +######################################## 67.753 +.......##############################... 67.754 +######################################## 67.755 +######################################## 67.756 +######################################## 67.757 +##############..............############ 67.758 +######################################## 67.759 +######################################## 67.760 +######################################## 67.761 +######################################## 67.762 +######################################## 67.763 +######################################## 67.764 +######################################## 67.765 +######################################## 67.766 +######################################## 67.767 +######################################## 67.768 +30 20 2 67.769 +.................... 67.770 +#################### 67.771 +#############.....## 67.772 +##...############### 67.773 +#################### 67.774 +#################### 67.775 +#################### 67.776 +....##.....#...#.... 67.777 +#################### 67.778 +##########.######### 67.779 +###....############# 67.780 +#########....####### 67.781 +###....############# 67.782 +#################### 67.783 +....#######.....###. 67.784 +#################### 67.785 +########.########### 67.786 +#################### 67.787 +#############.....## 67.788 +....#####..######### 67.789 +#################### 67.790 +##..########.##.#### 67.791 +########.########### 67.792 +#########..######### 67.793 +#........########### 67.794 +#########..######.## 67.795 +###.################ 67.796 +#################### 67.797 +#################### 67.798 +##############...### 67.799 +50 20 7 67.800 +...................# 67.801 +#################### 67.802 +#####...############ 67.803 +#################### 67.804 +#################### 67.805 +#################### 67.806 +#################### 67.807 +#################### 67.808 +#################### 67.809 +.....##############. 67.810 +#################### 67.811 +#################### 67.812 +.........########... 67.813 +#################### 67.814 +#################### 67.815 +#################### 67.816 +#################### 67.817 +#################### 67.818 +#################### 67.819 +#################### 67.820 +#################### 67.821 +#################### 67.822 +#################### 67.823 +#################### 67.824 +#################### 67.825 +#################### 67.826 +#########.########## 67.827 +#################### 67.828 +#################### 67.829 +#################### 67.830 +....###########..... 67.831 +#################### 67.832 +#################### 67.833 +#################### 67.834 +#################### 67.835 +#################### 67.836 +#################### 67.837 +#################### 67.838 +#################### 67.839 +##........########## 67.840 +#################### 67.841 +#################### 67.842 +#################### 67.843 +#################### 67.844 +#################### 67.845 +#################### 67.846 +#################### 67.847 +#################### 67.848 +....##########...... 67.849 +#################### 67.850 +49 49 3 67.851 +................................................. 67.852 +################################################# 67.853 +################################################# 67.854 +################################################# 67.855 +################################################# 67.856 +################################################# 67.857 +################################################# 67.858 +################################################# 67.859 +################################################# 67.860 +################################################# 67.861 +################################################# 67.862 +################################################# 67.863 +################################################# 67.864 +################################################# 67.865 +################################################# 67.866 +################################################# 67.867 +################################################# 67.868 +################################################# 67.869 +................................................. 67.870 +................................................. 67.871 +################################################# 67.872 +################################################# 67.873 +################################################# 67.874 +################################################# 67.875 +################################################# 67.876 +################################################# 67.877 +################################################# 67.878 +........##########............................... 67.879 +################################################# 67.880 +###########..................#################### 67.881 +################################################# 67.882 +################################################# 67.883 +################################################# 67.884 +################################################# 67.885 +................................................. 67.886 +################################################# 67.887 +################################################# 67.888 +################################################# 67.889 +################################################# 67.890 +################################################# 67.891 +.......#####..................................... 67.892 +................................................. 67.893 +################################################# 67.894 +................................################. 67.895 +..................................###########.... 67.896 +################################################# 67.897 +################################################# 67.898 +################################################# 67.899 +################################################# 67.900 +45 25 4 67.901 +......................... 67.902 +######################### 67.903 +########............##### 67.904 +######################### 67.905 +......................... 67.906 +###############.#######.# 67.907 +###############.#######.# 67.908 +############....#######.# 67.909 +......................... 67.910 +############.#.########## 67.911 +############...########## 67.912 +######################### 67.913 +.................######.. 67.914 +################.######.# 67.915 +......................... 67.916 +....................##... 67.917 +......................... 67.918 +######################### 67.919 +######################### 67.920 +######################### 67.921 +######################### 67.922 +######################### 67.923 +######################### 67.924 +..........####........... 67.925 +##....................... 67.926 +##....................... 67.927 +#########.####.########## 67.928 +..........####........... 67.929 +######################### 67.930 +######################### 67.931 +######################### 67.932 +######################### 67.933 +######################### 67.934 +######################### 67.935 +......................... 67.936 +##################.###### 67.937 +##################.###### 67.938 +##################.###### 67.939 +......................... 67.940 +######################### 67.941 +######################### 67.942 +######################### 67.943 +......................... 67.944 +......................... 67.945 +......................... 67.946 +25 45 5 67.947 +............................................. 67.948 +############################################# 67.949 +####################################.######## 67.950 +###########.################################# 67.951 +###########.################################# 67.952 +###########.################################# 67.953 +############################################# 67.954 +############################################# 67.955 +############################################# 67.956 +############################################# 67.957 +############################################# 67.958 +############################################# 67.959 +############################################# 67.960 +############################################# 67.961 +############################################# 67.962 +#############################...############# 67.963 +#############################.#.############# 67.964 +#############################...############# 67.965 +############################################# 67.966 +############################################# 67.967 +############################################# 67.968 +###..######################################## 67.969 +###..######################################## 67.970 +#########################################.... 67.971 +####################################.####.##. 67.972 +50 50 18 67.973 +.................................................. 67.974 +################################################## 67.975 +..##..##..##..##..##..##..##..##..##..##..##..##.. 67.976 +.###.###.###.###.###.###.###.###.###.###.###.###.# 67.977 +....####....####....####....####....####....####.. 67.978 +.#.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# 67.979 +..######..######..######..######..######..######.. 67.980 +.#######.#######.#######.#######.#######.#######.# 67.981 +........########........########........########.. 67.982 +.#.#.#.#########.#.#.#.#########.#.#.#.#########.# 67.983 +..##..##########..##..##########..##..##########.. 67.984 +.###.###########.###.###########.###.###########.# 67.985 +....############....############....############.. 67.986 +.#.#############.#.#############.#.#############.# 67.987 +..##############..##############..##############.. 67.988 +.###############.###############.###############.# 67.989 +................################................## 67.990 +.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.#.### 67.991 +..##..##..##..##################..##..##..##..#### 67.992 +.###.###.###.###################.###.###.###.##### 67.993 +....####....####################....####....###### 67.994 +.#.#####.#.#####################.#.#####.#.####### 67.995 +..######..######################..######..######## 67.996 +.#######.#######################.#######.######### 67.997 +........########################........########## 67.998 +.#.#.#.#########################.#.#.#.########### 67.999 +..##..##########################..##..############ 67.1000 +.###.###########################.###.############# 67.1001 +....############################....############## 67.1002 +.#.#############################.#.############### 67.1003 +..##############################..################ 67.1004 +.###############################.################# 67.1005 +................................################## 67.1006 +.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.################### 67.1007 +..##..##..##..##..##..##..##..#################### 67.1008 +.###.###.###.###.###.###.###.##################### 67.1009 +....####....####....####....###################### 67.1010 +.#.#####.#.#####.#.#####.#.####################### 67.1011 +..######..######..######..######################## 67.1012 +.#######.#######.#######.######################### 67.1013 +........########........########################## 67.1014 +.#.#.#.#########.#.#.#.########################### 67.1015 +..##..##########..##..############################ 67.1016 +.###.###########.###.############################# 67.1017 +....############....############################## 67.1018 +.#.#############.#.############################### 67.1019 +..##############..################################ 67.1020 +.###############.################################# 67.1021 +................################################## 67.1022 +.#.#.#.#.#.#.#.################################### 67.1023 +50 50 19 67.1024 +.................................................. 67.1025 +################################################## 67.1026 +..##..##..##..##..##..##..##..##..##..##..##..##.. 67.1027 +.###.###.###.###.###.###.###.###.###.###.###.###.# 67.1028 +....####....####....####....####....####....####.. 67.1029 +.#.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# 67.1030 +..######..######..######..######..######..######.. 67.1031 +.#######.#######.#######.#######.#######.#######.# 67.1032 +........########........########........########.. 67.1033 +.#.#.#.#########.#.#.#.#########.#.#.#.#########.# 67.1034 +..##..##########..##..##########..##..##########.. 67.1035 +.###.###########.###.###########.###.###########.# 67.1036 +....############....############....############.. 67.1037 +.#.#############.#.#############.#.#############.# 67.1038 +..##############..##############..##############.. 67.1039 +.###############.###############.###############.# 67.1040 +................################................## 67.1041 +.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.#.### 67.1042 +..##..##..##..##################..##..##..##..#### 67.1043 +.###.###.###.###################.###.###.###.##### 67.1044 +....####....####################....####....###### 67.1045 +.#.#####.#.#####################.#.#####.#.####### 67.1046 +..######..######################..######..######## 67.1047 +.#######.#######################.#######.######### 67.1048 +........########################........########## 67.1049 +.#.#.#.#########################.#.#.#.########### 67.1050 +..##..##########################..##..############ 67.1051 +.###.###########################.###.############# 67.1052 +....############################....############## 67.1053 +.#.#############################.#.############### 67.1054 +..##############################..################ 67.1055 +.###############################.################# 67.1056 +................................################## 67.1057 +.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.################### 67.1058 +..##..##..##..##..##..##..##..#################### 67.1059 +.###.###.###.###.###.###.###.##################### 67.1060 +....####....####....####....###################### 67.1061 +.#.#####.#.#####.#.#####.#.####################### 67.1062 +..######..######..######..######################## 67.1063 +.#######.#######.#######.######################### 67.1064 +........########........########################## 67.1065 +.#.#.#.#########.#.#.#.########################### 67.1066 +..##..##########..##..############################ 67.1067 +.###.###########.###.############################# 67.1068 +....############....############################## 67.1069 +.#.#############.#.############################### 67.1070 +..##############..################################ 67.1071 +.###############.################################# 67.1072 +................################################## 67.1073 +.#.#.#.#.#.#.#.################################### 67.1074 +50 50 20 67.1075 +.................................................. 67.1076 +################################################## 67.1077 +..##..##..##..##..##..##..##..##..##..##..##..##.. 67.1078 +.###.###.###.###.###.###.###.###.###.###.###.###.# 67.1079 +....####....####....####....####....####....####.. 67.1080 +.#.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# 67.1081 +..######..######..######..######..######..######.. 67.1082 +.#######.#######.#######.#######.#######.#######.# 67.1083 +........########........########........########.. 67.1084 +.#.#.#.#########.#.#.#.#########.#.#.#.#########.# 67.1085 +..##..##########..##..##########..##..##########.. 67.1086 +.###.###########.###.###########.###.###########.# 67.1087 +....############....############....############.. 67.1088 +.#.#############.#.#############.#.#############.# 67.1089 +..##############..##############..##############.. 67.1090 +.###############.###############.###############.# 67.1091 +................################................## 67.1092 +.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.#.### 67.1093 +..##..##..##..##################..##..##..##..#### 67.1094 +.###.###.###.###################.###.###.###.##### 67.1095 +....####....####################....####....###### 67.1096 +.#.#####.#.#####################.#.#####.#.####### 67.1097 +..######..######################..######..######## 67.1098 +.#######.#######################.#######.######### 67.1099 +........########################........########## 67.1100 +.#.#.#.#########################.#.#.#.########### 67.1101 +..##..##########################..##..############ 67.1102 +.###.###########################.###.############# 67.1103 +....############################....############## 67.1104 +.#.#############################.#.############### 67.1105 +..##############################..################ 67.1106 +.###############################.################# 67.1107 +................................################## 67.1108 +.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.################### 67.1109 +..##..##..##..##..##..##..##..#################### 67.1110 +.###.###.###.###.###.###.###.##################### 67.1111 +....####....####....####....###################### 67.1112 +.#.#####.#.#####.#.#####.#.####################### 67.1113 +..######..######..######..######################## 67.1114 +.#######.#######.#######.######################### 67.1115 +........########........########################## 67.1116 +.#.#.#.#########.#.#.#.########################### 67.1117 +..##..##########..##..############################ 67.1118 +.###.###########.###.############################# 67.1119 +....############....############################## 67.1120 +.#.#############.#.############################### 67.1121 +..##############..################################ 67.1122 +.###############.################################# 67.1123 +................################################## 67.1124 +.#.#.#.#.#.#.#.################################### 67.1125 +49 48 5 67.1126 +................................................ 67.1127 +################################################ 67.1128 +################################.############### 67.1129 +###############################..##############. 67.1130 +##############################.#.#############.# 67.1131 +#############################....############... 67.1132 +############################.###.###########.### 67.1133 +###########################..##..##########..##. 67.1134 +##########################.#.#.#.#########.#.#.# 67.1135 +#########################........########....... 67.1136 +########################.#######.#######.####### 67.1137 +#######################..######..######..######. 67.1138 +######################.#.#####.#.#####.#.#####.# 67.1139 +#####################....####....####....####... 67.1140 +####################.###.###.###.###.###.###.### 67.1141 +###################..##..##..##..##..##..##..##. 67.1142 +##################.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# 67.1143 +#################............................... 67.1144 +################.############################### 67.1145 +###############..##############################. 67.1146 +##############.#.#############################.# 67.1147 +#############....############################... 67.1148 +############.###.###########################.### 67.1149 +###########..##..##########################..##. 67.1150 +##########.#.#.#.#########################.#.#.# 67.1151 +#########........########################....... 67.1152 +########.#######.#######################.####### 67.1153 +#######..######..######################..######. 67.1154 +######.#.#####.#.#####################.#.#####.# 67.1155 +#####....####....####################....####... 67.1156 +####.###.###.###.###################.###.###.### 67.1157 +###..##..##..##..##################..##..##..##. 67.1158 +##.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.# 67.1159 +#................################............... 67.1160 +.###############.###############.############### 67.1161 +.##############..##############..##############. 67.1162 +.#############.#.#############.#.#############.# 67.1163 +.############....############....############... 67.1164 +.###########.###.###########.###.###########.### 67.1165 +.##########..##..##########..##..##########..##. 67.1166 +.#########.#.#.#.#########.#.#.#.#########.#.#.# 67.1167 +.########........########........########....... 67.1168 +.#######.#######.#######.#######.#######.####### 67.1169 +.######..######..######..######..######..######. 67.1170 +.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# 67.1171 +.####....####....####....####....####....####... 67.1172 +.###.###.###.###.###.###.###.###.###.###.###.### 67.1173 +.##..##..##..##..##..##..##..##..##..##..##..##. 67.1174 +.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# 67.1175 +49 48 11 67.1176 +................................................ 67.1177 +################################################ 67.1178 +################################.############### 67.1179 +###############################..##############. 67.1180 +##############################.#.#############.# 67.1181 +#############################....############... 67.1182 +############################.###.###########.### 67.1183 +###########################..##..##########..##. 67.1184 +##########################.#.#.#.#########.#.#.# 67.1185 +#########################........########....... 67.1186 +########################.#######.#######.####### 67.1187 +#######################..######..######..######. 67.1188 +######################.#.#####.#.#####.#.#####.# 67.1189 +#####################....####....####....####... 67.1190 +####################.###.###.###.###.###.###.### 67.1191 +###################..##..##..##..##..##..##..##. 67.1192 +##################.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# 67.1193 +#################............................... 67.1194 +################.############################### 67.1195 +###############..##############################. 67.1196 +##############.#.#############################.# 67.1197 +#############....############################... 67.1198 +############.###.###########################.### 67.1199 +###########..##..##########################..##. 67.1200 +##########.#.#.#.#########################.#.#.# 67.1201 +#########........########################....... 67.1202 +########.#######.#######################.####### 67.1203 +#######..######..######################..######. 67.1204 +######.#.#####.#.#####################.#.#####.# 67.1205 +#####....####....####################....####... 67.1206 +####.###.###.###.###################.###.###.### 67.1207 +###..##..##..##..##################..##..##..##. 67.1208 +##.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.# 67.1209 +#................################............... 67.1210 +.###############.###############.############### 67.1211 +.##############..##############..##############. 67.1212 +.#############.#.#############.#.#############.# 67.1213 +.############....############....############... 67.1214 +.###########.###.###########.###.###########.### 67.1215 +.##########..##..##########..##..##########..##. 67.1216 +.#########.#.#.#.#########.#.#.#.#########.#.#.# 67.1217 +.########........########........########....... 67.1218 +.#######.#######.#######.#######.#######.####### 67.1219 +.######..######..######..######..######..######. 67.1220 +.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# 67.1221 +.####....####....####....####....####....####... 67.1222 +.###.###.###.###.###.###.###.###.###.###.###.### 67.1223 +.##..##..##..##..##..##..##..##..##..##..##..##. 67.1224 +.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# 67.1225 +49 48 30 67.1226 +................................................ 67.1227 +################################################ 67.1228 +################################.############### 67.1229 +###############################..##############. 67.1230 +##############################.#.#############.# 67.1231 +#############################....############... 67.1232 +############################.###.###########.### 67.1233 +###########################..##..##########..##. 67.1234 +##########################.#.#.#.#########.#.#.# 67.1235 +#########################........########....... 67.1236 +########################.#######.#######.####### 67.1237 +#######################..######..######..######. 67.1238 +######################.#.#####.#.#####.#.#####.# 67.1239 +#####################....####....####....####... 67.1240 +####################.###.###.###.###.###.###.### 67.1241 +###################..##..##..##..##..##..##..##. 67.1242 +##################.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# 67.1243 +#################............................... 67.1244 +################.############################### 67.1245 +###############..##############################. 67.1246 +##############.#.#############################.# 67.1247 +#############....############################... 67.1248 +############.###.###########################.### 67.1249 +###########..##..##########################..##. 67.1250 +##########.#.#.#.#########################.#.#.# 67.1251 +#########........########################....... 67.1252 +########.#######.#######################.####### 67.1253 +#######..######..######################..######. 67.1254 +######.#.#####.#.#####################.#.#####.# 67.1255 +#####....####....####################....####... 67.1256 +####.###.###.###.###################.###.###.### 67.1257 +###..##..##..##..##################..##..##..##. 67.1258 +##.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.# 67.1259 +#................################............... 67.1260 +.###############.###############.############### 67.1261 +.##############..##############..##############. 67.1262 +.#############.#.#############.#.#############.# 67.1263 +.############....############....############... 67.1264 +.###########.###.###########.###.###########.### 67.1265 +.##########..##..##########..##..##########..##. 67.1266 +.#########.#.#.#.#########.#.#.#.#########.#.#.# 67.1267 +.########........########........########....... 67.1268 +.#######.#######.#######.#######.#######.####### 67.1269 +.######..######..######..######..######..######. 67.1270 +.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# 67.1271 +.####....####....####....####....####....####... 67.1272 +.###.###.###.###.###.###.###.###.###.###.###.### 67.1273 +.##..##..##..##..##..##..##..##..##..##..##..##. 67.1274 +.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# 67.1275 +50 10 4 67.1276 +.......... 67.1277 +#####..... 67.1278 +#####..... 67.1279 +.####..... 67.1280 +#.###..... 67.1281 +##.##..... 67.1282 +.......... 67.1283 +#####..... 67.1284 +#####..... 67.1285 +####...... 67.1286 +###.#..... 67.1287 +##.##..... 67.1288 +.......... 67.1289 +#####..... 67.1290 +#####..... 67.1291 +.####..... 67.1292 +#.###..... 67.1293 +##.##..... 67.1294 +.......... 67.1295 +#####..... 67.1296 +#......... 67.1297 +.#........ 67.1298 +..#....... 67.1299 +...#...... 67.1300 +.......... 67.1301 +....#..... 67.1302 +...#...... 67.1303 +..#....... 67.1304 +.#........ 67.1305 +.......... 67.1306 +#####..... 67.1307 +#####..... 67.1308 +.####..... 67.1309 +#.###..... 67.1310 +##.##..... 67.1311 +.......... 67.1312 +#####..... 67.1313 +#####..... 67.1314 +####...... 67.1315 +###.#..... 67.1316 +##.##..... 67.1317 +.......... 67.1318 +#####..... 67.1319 +#####..... 67.1320 +#####..... 67.1321 +#####..... 67.1322 +#####..... 67.1323 +.......... 67.1324 +#####..... 67.1325 +#####..... 67.1326 +50 10 5 67.1327 +.......... 67.1328 +#####..... 67.1329 +...##..... 67.1330 +.......... 67.1331 +.......... 67.1332 +.......... 67.1333 +#####..... 67.1334 +##........ 67.1335 +.......... 67.1336 +.......... 67.1337 +.......... 67.1338 +#####..... 67.1339 +##........ 67.1340 +.......... 67.1341 +.......... 67.1342 +.......... 67.1343 +#####..... 67.1344 +#......... 67.1345 +.#........ 67.1346 +..#....... 67.1347 +...#...... 67.1348 +.......... 67.1349 +....#..... 67.1350 +...#...... 67.1351 +..#....... 67.1352 +.#........ 67.1353 +.......... 67.1354 +#####..... 67.1355 +#####..... 67.1356 +####...... 67.1357 +###.#..... 67.1358 +##.##..... 67.1359 +.......... 67.1360 +#####..... 67.1361 +#####..... 67.1362 +.####..... 67.1363 +#.###..... 67.1364 +##.##..... 67.1365 +.......... 67.1366 +#####..... 67.1367 +#......... 67.1368 +.#........ 67.1369 +..#....... 67.1370 +...#...... 67.1371 +.......... 67.1372 +....#..... 67.1373 +...#...... 67.1374 +..#....... 67.1375 +.#........ 67.1376 +.......... 67.1377 +50 10 4 67.1378 +.......... 67.1379 +#####..... 67.1380 +#......... 67.1381 +.#........ 67.1382 +..#....... 67.1383 +...#...... 67.1384 +.......... 67.1385 +....#..... 67.1386 +...#...... 67.1387 +..#....... 67.1388 +.#........ 67.1389 +.......... 67.1390 +#####..... 67.1391 +#####..... 67.1392 +####...... 67.1393 +###.#..... 67.1394 +##.##..... 67.1395 +.......... 67.1396 +#####..... 67.1397 +#####..... 67.1398 +#####..... 67.1399 +#####..... 67.1400 +#####..... 67.1401 +.......... 67.1402 +#####..... 67.1403 +##........ 67.1404 +.......... 67.1405 +.......... 67.1406 +.......... 67.1407 +#####..... 67.1408 +#####..... 67.1409 +#####..... 67.1410 +#####..... 67.1411 +#####..... 67.1412 +.......... 67.1413 +#####..... 67.1414 +##........ 67.1415 +.......... 67.1416 +.......... 67.1417 +.......... 67.1418 +#####..... 67.1419 +##........ 67.1420 +.......... 67.1421 +.......... 67.1422 +.......... 67.1423 +#####..... 67.1424 +#####..... 67.1425 +####...... 67.1426 +###.#..... 67.1427 +##.##..... 67.1428 +50 10 5 67.1429 +.......... 67.1430 +#####..... 67.1431 +##........ 67.1432 +.......... 67.1433 +.......... 67.1434 +.......... 67.1435 +#####..... 67.1436 +#####..... 67.1437 +#####..... 67.1438 +#####..... 67.1439 +#####..... 67.1440 +.......... 67.1441 +#####..... 67.1442 +##........ 67.1443 +.......... 67.1444 +.......... 67.1445 +.......... 67.1446 +#####..... 67.1447 +#####..... 67.1448 +.####..... 67.1449 +#.###..... 67.1450 +##.##..... 67.1451 +.......... 67.1452 +#####..... 67.1453 +#####..... 67.1454 +####...... 67.1455 +###.#..... 67.1456 +##.##..... 67.1457 +.......... 67.1458 +#####..... 67.1459 +...##..... 67.1460 +.......... 67.1461 +.......... 67.1462 +.......... 67.1463 +#####..... 67.1464 +#####..... 67.1465 +#####..... 67.1466 +#####..... 67.1467 +#####..... 67.1468 +.......... 67.1469 +#####..... 67.1470 +#####..... 67.1471 +####...... 67.1472 +###.#..... 67.1473 +##.##..... 67.1474 +.......... 67.1475 +#####..... 67.1476 +#......... 67.1477 +.#........ 67.1478 +..#....... 67.1479 +35 41 11 67.1480 +........................................# 67.1481 +######################################### 67.1482 +##.......####.#..######.##.###...#####.## 67.1483 +.##.#.#...#.###...##...#..#.#..##..###### 67.1484 +.#...##....#.###...##.#.##.#.###...####.. 67.1485 +.###...##.##..####..##.#.#####.#...#.#... 67.1486 +..#...#.##..#...##..###..##...###...#.#.. 67.1487 +.#.####.##.##.###.....#..#..##.###..#.##. 67.1488 +##..##..#...##.###.#...####...#..##....#. 67.1489 +#....#..##.#.#.#......####.#.....#...#.#. 67.1490 +#.##.#####......####......###.###..###.#. 67.1491 +##..######...######.##.#.##.......#...#.. 67.1492 +.#.....###......#####...#..#.#.###...##.# 67.1493 +...##.##.##..##...####.#.###...#..#.##..# 67.1494 +....###.#.#..#...###..###.###..#####...## 67.1495 +....##.##..#.#.#.#.#####...##..######.... 67.1496 +#.#.##.##.#...#####....##.#.#...#.##.#..# 67.1497 +#.##.##.##.#...#.#.####...#..#.......##.# 67.1498 +.##.#..###..####.#..###...#...###.##.##.. 67.1499 +.####.#.#######.#......##....#######..##. 67.1500 +.#..#...#.#.####..#.######.#.#..##.#.#### 67.1501 +...#.###..#.##.#.###.#.#....#.###.#.#...# 67.1502 +..#.#.####....###...#..##..#####.#.###### 67.1503 +#......####.#..##.....#####.##...###..... 67.1504 +##..##..####......#.#.##..##...###.#..... 67.1505 +#.#.####.####.......##......####.###..### 67.1506 +##...###.#...#.####.##.#........##..#.### 67.1507 +....#..#####.#....#.##...###..#####.#.### 67.1508 +####.#.###.........####..###.#..######.## 67.1509 +.#..########..###..#####.######.###.#...# 67.1510 +.##..#.##..#....####...#.###.....##.#...# 67.1511 +##.#..##.##..##.##...##.##.##.#.##.###### 67.1512 +..#..#..####..##...###.#...#.....###..#.. 67.1513 +####.#..####.###...##..#.#.###.#..#..#### 67.1514 +#...#..#..#.#...#...#.#.##.##.#...###.#.# 67.1515 +31 41 12 67.1516 +......................................... 67.1517 +#################################.....#.. 67.1518 +.#..........#.......#....##....#...#..... 67.1519 +.........#......#.#...#...#..#........#.. 67.1520 +#......#.#......#...#.........#.........# 67.1521 +.................#....#...#...##......... 67.1522 +.......#.#..#.....#..#.....##........#..# 67.1523 +.....#..#..#......................#..#... 67.1524 +..............#....##....#...#..#..#....# 67.1525 +...#.#.#........##.#..#..........#......# 67.1526 +...#......#..#......#....#....#....#..... 67.1527 +......##.#...#.##..........#............. 67.1528 +.......##.#.#..#...#.....#.#..#.......... 67.1529 +.........#..........#.................#.. 67.1530 +.#....#..#......#.......#.#..#..####.##.. 67.1531 +#...#................##...#..........#... 67.1532 +..........#...#.#..#..###..#...#......... 67.1533 +........##.......#.....##.#......#...#.#. 67.1534 +.#.....#.#..#.....#.#..##.#.#...........# 67.1535 +.......####...#.#.........#...#.#........ 67.1536 +.##.................#.#.#................ 67.1537 +.....###.#...#..#.#..............#....... 67.1538 +.....#...#.....#........#....##.......#.. 67.1539 +.........#...........##.#..#.....##...... 67.1540 +...#....#.........#...#...#.#............ 67.1541 +.....#..............#..............#....# 67.1542 +#.##...#.............#....#.#..#......#.. 67.1543 +........#...#...##.............#.#....... 67.1544 +.......#.......#..............#.......... 67.1545 +.....#.........#.........#..#...#..#....# 67.1546 +####..#...#.#.....##...........#.#.#.#.#.
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 68.2 +++ b/test/compiler/5091921/output6890943.txt Thu May 12 15:05:22 2011 -0700 68.3 @@ -0,0 +1,50 @@ 68.4 +Case #1: Yes 2 68.5 +Case #2: Yes 2 68.6 +Case #3: Yes 1 68.7 +Case #4: Yes 0 68.8 +Case #5: No 68.9 +Case #6: No 68.10 +Case #7: Yes 6 68.11 +Case #8: Yes 6 68.12 +Case #9: No 68.13 +Case #10: Yes 1 68.14 +Case #11: Yes 6 68.15 +Case #12: Yes 0 68.16 +Case #13: No 68.17 +Case #14: Yes 22 68.18 +Case #15: Yes 1225 68.19 +Case #16: Yes 178 68.20 +Case #17: No 68.21 +Case #18: Yes 1 68.22 +Case #19: Yes 7 68.23 +Case #20: Yes 2 68.24 +Case #21: Yes 1 68.25 +Case #22: No 68.26 +Case #23: Yes 3 68.27 +Case #24: Yes 1 68.28 +Case #25: Yes 7 68.29 +Case #26: No 68.30 +Case #27: Yes 2 68.31 +Case #28: Yes 4 68.32 +Case #29: Yes 2 68.33 +Case #30: Yes 1 68.34 +Case #31: Yes 2 68.35 +Case #32: Yes 20 68.36 +Case #33: Yes 161 68.37 +Case #34: Yes 48 68.38 +Case #35: No 68.39 +Case #36: Yes 218 68.40 +Case #37: Yes 51 68.41 +Case #38: Yes 247 68.42 +Case #39: Yes 32 68.43 +Case #40: Yes 31 68.44 +Case #41: Yes 31 68.45 +Case #42: Yes 25 68.46 +Case #43: Yes 17 68.47 +Case #44: Yes 2 68.48 +Case #45: Yes 61 68.49 +Case #46: Yes 25 68.50 +Case #47: No 68.51 +Case #48: No 68.52 +Case #49: Yes 8 68.53 +Case #50: Yes 0
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 69.2 +++ b/test/compiler/6796786/Test6796786.java Thu May 12 15:05:22 2011 -0700 69.3 @@ -0,0 +1,48 @@ 69.4 +/* 69.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 69.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 69.7 + * 69.8 + * This code is free software; you can redistribute it and/or modify it 69.9 + * under the terms of the GNU General Public License version 2 only, as 69.10 + * published by the Free Software Foundation. 69.11 + * 69.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 69.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 69.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 69.15 + * version 2 for more details (a copy is included in the LICENSE file that 69.16 + * accompanied this code). 69.17 + * 69.18 + * You should have received a copy of the GNU General Public License version 69.19 + * 2 along with this work; if not, write to the Free Software Foundation, 69.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 69.21 + * 69.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 69.23 + * or visit www.oracle.com if you need additional information or have any 69.24 + * questions. 69.25 + * 69.26 + */ 69.27 + 69.28 +/** 69.29 + * @test 69.30 + * @bug 6796786 69.31 + * @summary invalid FP identity transform - (a - b) -> b - a 69.32 + * 69.33 + * @run main/othervm -Xbatch Test6796786 69.34 + */ 69.35 + 69.36 +public class Test6796786 { 69.37 + static volatile float d1; 69.38 + static volatile float d2; 69.39 + 69.40 + public static void main(String[] args) { 69.41 + int total = 0; 69.42 + for (int i = 0; i < 100000; i++) { 69.43 + if (Float.floatToRawIntBits(- (d1 - d2)) == Float.floatToRawIntBits(-0.0f)) { 69.44 + total++; 69.45 + } 69.46 + } 69.47 + if (total != 100000) { 69.48 + throw new InternalError(); 69.49 + } 69.50 + } 69.51 +}
70.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 70.2 +++ b/test/compiler/7041100/Test7041100.java Thu May 12 15:05:22 2011 -0700 70.3 @@ -0,0 +1,53 @@ 70.4 +/* 70.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 70.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 70.7 + * 70.8 + * This code is free software; you can redistribute it and/or modify it 70.9 + * under the terms of the GNU General Public License version 2 only, as 70.10 + * published by the Free Software Foundation. 70.11 + * 70.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 70.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 70.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 70.15 + * version 2 for more details (a copy is included in the LICENSE file that 70.16 + * accompanied this code). 70.17 + * 70.18 + * You should have received a copy of the GNU General Public License version 70.19 + * 2 along with this work; if not, write to the Free Software Foundation, 70.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 70.21 + * 70.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 70.23 + * or visit www.oracle.com if you need additional information or have any 70.24 + * questions. 70.25 + * 70.26 + */ 70.27 + 70.28 +/** 70.29 + * @test 70.30 + * @bug 7041100 70.31 + * @summary The load in String.equals intrinsic executed before null check 70.32 + * 70.33 + * @run main/othervm -Xbatch Test7041100 abc def 70.34 + */ 70.35 + 70.36 +public class Test7041100 { 70.37 + 70.38 + static String n = null; 70.39 + public static void main(String[] args) throws Exception { 70.40 + for (int i = 0; i < 10000; i++) { 70.41 + stringEQ(args[0], args[1]); 70.42 + stringEQ(args[0], args[0]); 70.43 + stringEQ(args[0], n); 70.44 + stringEQ(n, args[0]); 70.45 + } 70.46 + } 70.47 + 70.48 + public static boolean stringEQ(String a, String b) { 70.49 + if (a == b) 70.50 + return true; 70.51 + if (a == null || b == null) 70.52 + return false; 70.53 + else 70.54 + return a.equals(b); 70.55 + } 70.56 +}