# HG changeset patch # User shade # Date 1528806313 -7200 # Node ID 6d3a485a01dc2e83b003cea9fca52af41e7a8cfe # Parent 774caae3a3ce96e18504d59f9bb41bd3519bd46a# Parent 12be4323b0a51b63d129456cffe84105c19ea21a Merge diff -r 774caae3a3ce -r 6d3a485a01dc make/launcher/Launcher-jdk.pack.gmk --- a/make/launcher/Launcher-jdk.pack.gmk Tue Jun 12 10:01:23 2018 +0200 +++ b/make/launcher/Launcher-jdk.pack.gmk Tue Jun 12 14:25:13 2018 +0200 @@ -90,7 +90,6 @@ CFLAGS_linux := -fPIC, \ CFLAGS_solaris := -KPIC, \ CFLAGS_macosx := -fPIC, \ - DISABLED_WARNINGS_gcc := unused-result implicit-fallthrough, \ LDFLAGS := $(UNPACKEXE_ZIPOBJS) \ $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ diff -r 774caae3a3ce -r 6d3a485a01dc src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp --- a/src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp Tue Jun 12 10:01:23 2018 +0200 +++ b/src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp Tue Jun 12 14:25:13 2018 +0200 @@ -73,19 +73,20 @@ } if (_index->is_cpu_register()) { - __ mov(r22, _index->as_register()); + __ mov(rscratch1, _index->as_register()); } else { - __ mov(r22, _index->as_jint()); + __ mov(rscratch1, _index->as_jint()); } Runtime1::StubID stub_id; if (_throw_index_out_of_bounds_exception) { stub_id = Runtime1::throw_index_exception_id; } else { assert(_array != NULL, "sanity"); - __ mov(r23, _array->as_pointer_register()); + __ mov(rscratch2, _array->as_pointer_register()); stub_id = Runtime1::throw_range_check_failed_id; } - __ far_call(RuntimeAddress(Runtime1::entry_for(stub_id)), NULL, rscratch2); + __ lea(lr, RuntimeAddress(Runtime1::entry_for(stub_id))); + __ blr(lr); ce->add_call_info_here(_info); ce->verify_oop_map(_info); debug_only(__ should_not_reach_here()); diff -r 774caae3a3ce -r 6d3a485a01dc src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp --- a/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp Tue Jun 12 10:01:23 2018 +0200 +++ b/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp Tue Jun 12 14:25:13 2018 +0200 @@ -323,7 +323,7 @@ // target: the entry point of the method that creates and posts the exception oop -// has_argument: true if the exception needs arguments (passed in r22 and r23) +// has_argument: true if the exception needs arguments (passed in rscratch1 and rscratch2) OopMapSet* Runtime1::generate_exception_throw(StubAssembler* sasm, address target, bool has_argument) { // make a frame and preserve the caller's caller-save registers @@ -332,7 +332,9 @@ if (!has_argument) { call_offset = __ call_RT(noreg, noreg, target); } else { - call_offset = __ call_RT(noreg, noreg, target, r22, r23); + __ mov(c_rarg1, rscratch1); + __ mov(c_rarg2, rscratch2); + call_offset = __ call_RT(noreg, noreg, target); } OopMapSet* oop_maps = new OopMapSet(); oop_maps->add_gc_map(call_offset, oop_map); diff -r 774caae3a3ce -r 6d3a485a01dc src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp Tue Jun 12 10:01:23 2018 +0200 +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp Tue Jun 12 14:25:13 2018 +0200 @@ -2113,7 +2113,6 @@ #endif void MacroAssembler::resolve_jobject(Register value, Register thread, Register tmp) { - BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler(); Label done, not_weak; cbz(value, done); // Use NULL as-is. @@ -2121,15 +2120,15 @@ tbz(r0, 0, not_weak); // Test for jweak tag. // Resolve jweak. - bs->load_at(this, IN_ROOT | ON_PHANTOM_OOP_REF, T_OBJECT, - value, Address(value, -JNIHandles::weak_tag_value), tmp, thread); + access_load_at(T_OBJECT, IN_ROOT | ON_PHANTOM_OOP_REF, value, + Address(value, -JNIHandles::weak_tag_value), tmp, thread); verify_oop(value); b(done); bind(not_weak); // Resolve (untagged) jobject. - bs->load_at(this, IN_CONCURRENT_ROOT, T_OBJECT, - value, Address(value, 0), tmp, thread); + access_load_at(T_OBJECT, IN_CONCURRENT_ROOT, value, Address(value, 0), tmp, + thread); verify_oop(value); bind(done); } @@ -3664,9 +3663,8 @@ // ((OopHandle)result).resolve(); void MacroAssembler::resolve_oop_handle(Register result, Register tmp) { // OopHandle::resolve is an indirection. - BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler(); - bs->load_at(this, IN_CONCURRENT_ROOT, T_OBJECT, - result, Address(result, 0), tmp, rthread); + access_load_at(T_OBJECT, IN_CONCURRENT_ROOT, + result, Address(result, 0), tmp, noreg); } void MacroAssembler::load_mirror(Register dst, Register method, Register tmp) { diff -r 774caae3a3ce -r 6d3a485a01dc src/hotspot/share/code/codeCache.cpp --- a/src/hotspot/share/code/codeCache.cpp Tue Jun 12 10:01:23 2018 +0200 +++ b/src/hotspot/share/code/codeCache.cpp Tue Jun 12 14:25:13 2018 +0200 @@ -1609,6 +1609,7 @@ } void CodeCache::print_summary(outputStream* st, bool detailed) { + int full_count = 0; FOR_ALL_HEAPS(heap_iterator) { CodeHeap* heap = (*heap_iterator); size_t total = (heap->high_boundary() - heap->low_boundary()); @@ -1627,6 +1628,8 @@ p2i(heap->low_boundary()), p2i(heap->high()), p2i(heap->high_boundary())); + + full_count += get_codemem_full_count(heap->code_blob_type()); } } @@ -1638,6 +1641,10 @@ "enabled" : Arguments::mode() == Arguments::_int ? "disabled (interpreter mode)" : "disabled (not enough contiguous free space left)"); + st->print_cr(" stopped_count=%d, restarted_count=%d", + CompileBroker::get_total_compiler_stopped_count(), + CompileBroker::get_total_compiler_restarted_count()); + st->print_cr(" full_count=%d", full_count); } } diff -r 774caae3a3ce -r 6d3a485a01dc src/hotspot/share/compiler/compileBroker.cpp --- a/src/hotspot/share/compiler/compileBroker.cpp Tue Jun 12 10:01:23 2018 +0200 +++ b/src/hotspot/share/compiler/compileBroker.cpp Tue Jun 12 14:25:13 2018 +0200 @@ -170,21 +170,23 @@ elapsedTimer CompileBroker::_t_invalidated_compilation; elapsedTimer CompileBroker::_t_bailedout_compilation; -int CompileBroker::_total_bailout_count = 0; -int CompileBroker::_total_invalidated_count = 0; -int CompileBroker::_total_compile_count = 0; -int CompileBroker::_total_osr_compile_count = 0; -int CompileBroker::_total_standard_compile_count = 0; +int CompileBroker::_total_bailout_count = 0; +int CompileBroker::_total_invalidated_count = 0; +int CompileBroker::_total_compile_count = 0; +int CompileBroker::_total_osr_compile_count = 0; +int CompileBroker::_total_standard_compile_count = 0; +int CompileBroker::_total_compiler_stopped_count = 0; +int CompileBroker::_total_compiler_restarted_count = 0; -int CompileBroker::_sum_osr_bytes_compiled = 0; -int CompileBroker::_sum_standard_bytes_compiled = 0; -int CompileBroker::_sum_nmethod_size = 0; -int CompileBroker::_sum_nmethod_code_size = 0; +int CompileBroker::_sum_osr_bytes_compiled = 0; +int CompileBroker::_sum_standard_bytes_compiled = 0; +int CompileBroker::_sum_nmethod_size = 0; +int CompileBroker::_sum_nmethod_code_size = 0; -long CompileBroker::_peak_compilation_time = 0; +long CompileBroker::_peak_compilation_time = 0; -CompileQueue* CompileBroker::_c2_compile_queue = NULL; -CompileQueue* CompileBroker::_c1_compile_queue = NULL; +CompileQueue* CompileBroker::_c2_compile_queue = NULL; +CompileQueue* CompileBroker::_c1_compile_queue = NULL; diff -r 774caae3a3ce -r 6d3a485a01dc src/hotspot/share/compiler/compileBroker.hpp --- a/src/hotspot/share/compiler/compileBroker.hpp Tue Jun 12 10:01:23 2018 +0200 +++ b/src/hotspot/share/compiler/compileBroker.hpp Tue Jun 12 14:25:13 2018 +0200 @@ -219,6 +219,8 @@ static int _total_native_compile_count; static int _total_osr_compile_count; static int _total_standard_compile_count; + static int _total_compiler_stopped_count; + static int _total_compiler_restarted_count; static int _sum_osr_bytes_compiled; static int _sum_standard_bytes_compiled; static int _sum_nmethod_size; @@ -338,7 +340,15 @@ static bool set_should_compile_new_jobs(jint new_state) { // Return success if the current caller set it jint old = Atomic::cmpxchg(new_state, &_should_compile_new_jobs, 1-new_state); - return (old == (1-new_state)); + bool success = (old == (1-new_state)); + if (success) { + if (new_state == run_compilation) { + _total_compiler_restarted_count++; + } else { + _total_compiler_stopped_count++; + } + } + return success; } static void disable_compilation_forever() { @@ -393,18 +403,20 @@ static CompileLog* get_log(CompilerThread* ct); - static int get_total_compile_count() { return _total_compile_count; } - static int get_total_bailout_count() { return _total_bailout_count; } - static int get_total_invalidated_count() { return _total_invalidated_count; } - static int get_total_native_compile_count() { return _total_native_compile_count; } - static int get_total_osr_compile_count() { return _total_osr_compile_count; } - static int get_total_standard_compile_count() { return _total_standard_compile_count; } - static int get_sum_osr_bytes_compiled() { return _sum_osr_bytes_compiled; } - static int get_sum_standard_bytes_compiled() { return _sum_standard_bytes_compiled; } - static int get_sum_nmethod_size() { return _sum_nmethod_size;} - static int get_sum_nmethod_code_size() { return _sum_nmethod_code_size; } - static long get_peak_compilation_time() { return _peak_compilation_time; } - static long get_total_compilation_time() { return _t_total_compilation.milliseconds(); } + static int get_total_compile_count() { return _total_compile_count; } + static int get_total_bailout_count() { return _total_bailout_count; } + static int get_total_invalidated_count() { return _total_invalidated_count; } + static int get_total_native_compile_count() { return _total_native_compile_count; } + static int get_total_osr_compile_count() { return _total_osr_compile_count; } + static int get_total_standard_compile_count() { return _total_standard_compile_count; } + static int get_total_compiler_stopped_count() { return _total_compiler_stopped_count; } + static int get_total_compiler_restarted_count() { return _total_compiler_restarted_count; } + static int get_sum_osr_bytes_compiled() { return _sum_osr_bytes_compiled; } + static int get_sum_standard_bytes_compiled() { return _sum_standard_bytes_compiled; } + static int get_sum_nmethod_size() { return _sum_nmethod_size;} + static int get_sum_nmethod_code_size() { return _sum_nmethod_code_size; } + static long get_peak_compilation_time() { return _peak_compilation_time; } + static long get_total_compilation_time() { return _t_total_compilation.milliseconds(); } // Log that compilation profiling is skipped because metaspace is full. static void log_metaspace_failure(); diff -r 774caae3a3ce -r 6d3a485a01dc src/hotspot/share/utilities/exceptions.cpp --- a/src/hotspot/share/utilities/exceptions.cpp Tue Jun 12 10:01:23 2018 +0200 +++ b/src/hotspot/share/utilities/exceptions.cpp Tue Jun 12 14:25:13 2018 +0200 @@ -37,6 +37,7 @@ #include "runtime/os.hpp" #include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" +#include "runtime/atomic.hpp" #include "utilities/events.hpp" #include "utilities/exceptions.hpp" @@ -151,6 +152,10 @@ count_out_of_memory_exceptions(h_exception); } + if (h_exception->is_a(SystemDictionary::LinkageError_klass())) { + Atomic::inc(&_linkage_errors); + } + assert(h_exception->is_a(SystemDictionary::Throwable_klass()), "exception is not a subclass of java/lang/Throwable"); // set the pending exception @@ -425,6 +430,7 @@ // Exception counting for hs_err file volatile int Exceptions::_stack_overflow_errors = 0; +volatile int Exceptions::_linkage_errors = 0; volatile int Exceptions::_out_of_memory_error_java_heap_errors = 0; volatile int Exceptions::_out_of_memory_error_metaspace_errors = 0; volatile int Exceptions::_out_of_memory_error_class_metaspace_errors = 0; @@ -458,6 +464,9 @@ if (_stack_overflow_errors > 0) { st->print_cr("StackOverflowErrors=%d", _stack_overflow_errors); } + if (_linkage_errors > 0) { + st->print_cr("LinkageErrors=%d", _linkage_errors); + } } // Implementation of ExceptionMark diff -r 774caae3a3ce -r 6d3a485a01dc src/hotspot/share/utilities/exceptions.hpp --- a/src/hotspot/share/utilities/exceptions.hpp Tue Jun 12 10:01:23 2018 +0200 +++ b/src/hotspot/share/utilities/exceptions.hpp Tue Jun 12 14:25:13 2018 +0200 @@ -108,6 +108,9 @@ static volatile int _out_of_memory_error_java_heap_errors; static volatile int _out_of_memory_error_metaspace_errors; static volatile int _out_of_memory_error_class_metaspace_errors; + + // Count linkage errors + static volatile int _linkage_errors; public: // this enum is defined to indicate whether it is safe to // ignore the encoding scheme of the original message string. diff -r 774caae3a3ce -r 6d3a485a01dc src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Tue Jun 12 10:01:23 2018 +0200 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Tue Jun 12 14:25:13 2018 +0200 @@ -2562,7 +2562,9 @@ Type argType = arityMismatch ? syms.errType : actuals.head; - setSyntheticVariableType(params.head, argType); + if (params.head.isImplicitlyTyped()) { + setSyntheticVariableType(params.head, argType); + } params.head.sym = null; actuals = actuals.isEmpty() ? actuals : diff -r 774caae3a3ce -r 6d3a485a01dc src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java Tue Jun 12 10:01:23 2018 +0200 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java Tue Jun 12 14:25:13 2018 +0200 @@ -1702,6 +1702,7 @@ } for (JCVariableDecl param: params) { if (param.vartype != null && isRestrictedLocalVarTypeName(param.vartype)) { + param.startPos = TreeInfo.getStartPos(param.vartype); param.vartype = null; } } diff -r 774caae3a3ce -r 6d3a485a01dc src/jdk.pack/share/native/common-unpack/unpack.cpp --- a/src/jdk.pack/share/native/common-unpack/unpack.cpp Tue Jun 12 10:01:23 2018 +0200 +++ b/src/jdk.pack/share/native/common-unpack/unpack.cpp Tue Jun 12 14:25:13 2018 +0200 @@ -1799,6 +1799,7 @@ case 'B': case 'H': case 'I': case 'V': // unsigned_int case 'S': // signed_int --lp; // reparse + /* fall through */ case 'F': lp = parseIntLayout(lp, b, EK_INT); break; diff -r 774caae3a3ce -r 6d3a485a01dc src/jdk.pack/share/native/common-unpack/zip.cpp --- a/src/jdk.pack/share/native/common-unpack/zip.cpp Tue Jun 12 10:01:23 2018 +0200 +++ b/src/jdk.pack/share/native/common-unpack/zip.cpp Tue Jun 12 14:25:13 2018 +0200 @@ -533,6 +533,8 @@ char* bufptr = (char*) buf; char* inbuf = u->gzin->inbuf; size_t inbuflen = sizeof(u->gzin->inbuf); + // capture return values from fread to avoid -Werror=unused-result issues + size_t ret = 0; unpacker::read_input_fn_t read_gzin_fn = (unpacker::read_input_fn_t) u->gzin->read_input_fn; z_stream& zs = *(z_stream*) u->gzin->zstream; @@ -579,8 +581,8 @@ fseek(u->infileptr, -TRAILER_LEN, SEEK_END); uint filecrc; uint filelen; - fread(&filecrc, sizeof(filecrc), 1, u->infileptr); - fread(&filelen, sizeof(filelen), 1, u->infileptr); + ret = fread(&filecrc, sizeof(filecrc), 1, u->infileptr); + ret = fread(&filelen, sizeof(filelen), 1, u->infileptr); filecrc = SWAP_INT(filecrc); filelen = SWAP_INT(filelen); if (u->gzin->gzcrc != filecrc || diff -r 774caae3a3ce -r 6d3a485a01dc test/langtools/tools/javac/tree/VarTree.java --- a/test/langtools/tools/javac/tree/VarTree.java Tue Jun 12 10:01:23 2018 +0200 +++ b/test/langtools/tools/javac/tree/VarTree.java Tue Jun 12 14:25:13 2018 +0200 @@ -23,7 +23,7 @@ /* * @test - * @bug 8188225 + * @bug 8188225 8204674 * @summary Check that variables of type var have a consistent model * @modules jdk.compiler/com.sun.tools.javac.api */ @@ -42,6 +42,7 @@ import javax.tools.ToolProvider; import com.sun.source.tree.VariableTree; +import com.sun.source.util.JavacTask; import com.sun.source.util.TreeScanner; import com.sun.source.util.Trees; @@ -64,6 +65,10 @@ "java.lang.String testVar"); test.run("java.util.function.Consumer c = (|testVar|) -> {};", "java.lang.String testVar"); + test.run("java.util.function.Consumer c = (|var testVar|) -> {};", + "java.lang.String testVar"); + test.run("java.util.function.IntBinaryOperator c = (var x, |testType|) -> 1;", + "testType "); } void run(String code, String expected) throws IOException { @@ -81,9 +86,12 @@ null, Arrays.asList(new MyFileObject(src))); Iterable units = ct.parse(); + + runSpanCheck(ct, units, src, prefix.length() + parts[0].length(), prefix.length() + parts[0].length() + parts[1].length()); + ct.analyze(); - Trees trees = Trees.instance(ct); + runSpanCheck(ct, units, src, prefix.length() + parts[0].length(), prefix.length() + parts[0].length() + parts[1].length()); for (CompilationUnitTree cut : units) { new TreeScanner() { @@ -93,13 +101,34 @@ if (!expected.equals(node.toString())) { throw new AssertionError("Unexpected tree: " + node.toString()); } + } + if (String.valueOf(node.getType()).equals("testType")) { + if (!expected.equals(node.toString())) { + throw new AssertionError("Unexpected tree: " + node.toString()); + } + } + return super.visitVariable(node, p); + } + }.scan(cut, null); + } + } + + private void runSpanCheck(JavacTask ct, Iterable units, String src, int spanStart, int spanEnd) { + Trees trees = Trees.instance(ct); + boolean[] found = new boolean[1]; + + for (CompilationUnitTree cut : units) { + new TreeScanner() { + @Override + public Void visitVariable(VariableTree node, Void p) { + if (node.getName().contentEquals("testVar")) { int start = (int) trees.getSourcePositions().getStartPosition(cut, node); int end = (int) trees.getSourcePositions().getEndPosition(cut, node); String snip = src.substring(start, end); - if (start != prefix.length() + parts[0].length() || end != prefix.length() + parts[0].length() + parts[1].length()) { + if (start != spanStart || end != spanEnd) { throw new AssertionError("Unexpected span: " + snip); } @@ -109,13 +138,32 @@ if (typeStart != (-1) && typeEnd != (-1)) { throw new AssertionError("Unexpected type position: " + typeStart + ", " + typeEnd); } + + found[0] = true; + } + if (String.valueOf(node.getType()).equals("testType")) { + int start = (int) trees.getSourcePositions().getStartPosition(cut, node); + int end = (int) trees.getSourcePositions().getEndPosition(cut, node); + + String snip = src.substring(start, end); + + if (start != spanStart || end != spanEnd) { + throw new AssertionError("Unexpected span: " + snip); + } + + found[0] = true; } return super.visitVariable(node, p); } }.scan(cut, null); } + + if (!found[0]) { + throw new AssertionError("Didn't find the test variable."); + } } + class MyFileObject extends SimpleJavaFileObject { private String text;