--- a/.hgtags Mon Jan 08 21:55:55 2018 -0800
+++ b/.hgtags Fri Jan 12 15:05:35 2018 -0800
@@ -463,3 +463,4 @@
cb54a299aa91419cb7caef3992592e7b22488163 jdk-10+36
4f830b447edf04fb4a52151a5ad44d9bb60723cd jdk-10+37
e569e83139fdfbecfeb3cd9014d560917787f158 jdk-10+38
+5b834ec962366e00d4445352a999a3ac14e26f64 jdk-10+39
--- a/make/gensrc/Gensrc-java.desktop.gmk Mon Jan 08 21:55:55 2018 -0800
+++ b/make/gensrc/Gensrc-java.desktop.gmk Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,6 @@
$(TOPDIR)/src/java.desktop/share/classes/sun/awt/resources \
$(TOPDIR)/src/java.desktop/share/classes/com/sun/accessibility/internal/resources \
$(TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/resources \
- $(TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/resources \
$(TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources \
$(TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources \
$(TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/synth/resources \
@@ -61,7 +60,10 @@
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
- PROP_SRC_DIRS += $(TOPDIR)/src/java.desktop/windows/classes/sun/awt/windows
+ PROP_SRC_DIRS += \
+ $(TOPDIR)/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/resources \
+ $(TOPDIR)/src/java.desktop/windows/classes/sun/awt/windows \
+ #
endif
ifeq ($(filter $(OPENJDK_TARGET_OS), windows macosx), )
--- a/src/hotspot/cpu/ppc/globalDefinitions_ppc.hpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/cpu/ppc/globalDefinitions_ppc.hpp Fri Jan 12 15:05:35 2018 -0800
@@ -55,5 +55,9 @@
#define SUPPORT_RESERVED_STACK_AREA
#define THREAD_LOCAL_POLL
+// If UseSIGTRAP is active, we only use the poll bit and no polling page.
+// Otherwise, we fall back to usage of the polling page in nmethods.
+// Define the condition to use this -XX flag.
+#define USE_POLL_BIT_ONLY UseSIGTRAP
#endif // CPU_PPC_VM_GLOBALDEFINITIONS_PPC_HPP
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp Fri Jan 12 15:05:35 2018 -0800
@@ -30,6 +30,7 @@
#include "asm/macroAssembler.hpp"
#include "asm/codeBuffer.hpp"
#include "code/codeCache.hpp"
+#include "runtime/safepointMechanism.hpp"
inline bool MacroAssembler::is_ld_largeoffset(address a) {
const int inst1 = *(int *)a;
@@ -261,7 +262,12 @@
// Read from the polling page, its address is already in a register.
inline void MacroAssembler::load_from_polling_page(Register polling_page_address, int offset) {
- ld(R0, offset, polling_page_address);
+ if (SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) {
+ int encoding = SafepointMechanism::poll_bit();
+ tdi(traptoGreaterThanUnsigned | traptoEqual, polling_page_address, encoding);
+ } else {
+ ld(R0, offset, polling_page_address);
+ }
}
// Trap-instruction-based checks.
--- a/src/hotspot/cpu/ppc/nativeInst_ppc.hpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/cpu/ppc/nativeInst_ppc.hpp Fri Jan 12 15:05:35 2018 -0800
@@ -31,6 +31,7 @@
#include "memory/allocation.hpp"
#include "runtime/icache.hpp"
#include "runtime/os.hpp"
+#include "runtime/safepointMechanism.hpp"
// We have interfaces for the following instructions:
//
@@ -93,6 +94,11 @@
bool is_safepoint_poll() {
// Is the current instruction a POTENTIAL read access to the polling page?
// The current arguments of the instruction are not checked!
+ if (SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) {
+ int encoding = SafepointMechanism::poll_bit();
+ return MacroAssembler::is_tdi(long_at(0), Assembler::traptoGreaterThanUnsigned | Assembler::traptoEqual,
+ -1, encoding);
+ }
return MacroAssembler::is_load_from_polling_page(long_at(0), NULL);
}
--- a/src/hotspot/os/aix/safepointMechanism_aix.cpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/os/aix/safepointMechanism_aix.cpp Fri Jan 12 15:05:35 2018 -0800
@@ -30,8 +30,18 @@
#include <sys/mman.h>
void SafepointMechanism::pd_initialize() {
+ // No special code needed if we can use SIGTRAP
+ if (ThreadLocalHandshakes && USE_POLL_BIT_ONLY) {
+ default_initialize();
+ return;
+ }
+
+ // Allocate one protected page
char* map_address = (char*)MAP_FAILED;
const size_t page_size = os::vm_page_size();
+ const int prot = PROT_READ;
+ const int flags = MAP_PRIVATE | MAP_ANONYMOUS;
+
// Use optimized addresses for the polling page,
// e.g. map it to a special 32-bit address.
if (OptimizePollingPageLocation) {
@@ -57,14 +67,14 @@
// Try to map with current address wish.
// AIX: AIX needs MAP_FIXED if we provide an address and mmap will
// fail if the address is already mapped.
- map_address = (char*) ::mmap(address_wishes[i] - (ssize_t)page_size,
- page_size, PROT_READ,
- MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,
+ map_address = (char*) ::mmap(address_wishes[i],
+ page_size, prot,
+ flags | MAP_FIXED,
-1, 0);
- log_debug(os)("SafePoint Polling Page address: %p (wish) => %p",
- address_wishes[i], map_address + (ssize_t)page_size);
+ log_debug(os)("SafePoint Polling Page address: %p (wish) => %p",
+ address_wishes[i], map_address);
- if (map_address + (ssize_t)page_size == address_wishes[i]) {
+ if (map_address == address_wishes[i]) {
// Map succeeded and map_address is at wished address, exit loop.
break;
}
@@ -78,8 +88,17 @@
}
}
if (map_address == (char*)MAP_FAILED) {
- map_address = os::reserve_memory(page_size, NULL, page_size);
+ map_address = (char*) ::mmap(NULL, page_size, prot, flags, -1, 0);
}
guarantee(map_address != (char*)MAP_FAILED, "SafepointMechanism::pd_initialize: failed to allocate polling page");
+ log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(map_address));
os::set_polling_page((address)(map_address));
+
+ // Use same page for ThreadLocalHandshakes without SIGTRAP
+ if (ThreadLocalHandshakes) {
+ set_uses_thread_local_poll();
+ intptr_t bad_page_val = reinterpret_cast<intptr_t>(map_address);
+ _poll_armed_value = reinterpret_cast<void*>(bad_page_val | poll_bit());
+ _poll_disarmed_value = NULL; // Readable on AIX
+ }
}
--- a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp Fri Jan 12 15:05:35 2018 -0800
@@ -47,6 +47,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/osThread.hpp"
+#include "runtime/safepointMechanism.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.inline.hpp"
@@ -374,9 +375,12 @@
goto run_stub;
}
- else if (sig == SIGSEGV && os::is_poll_address(addr)) {
+ else if ((SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY)
+ ? (sig == SIGTRAP && ((NativeInstruction*)pc)->is_safepoint_poll())
+ : (sig == SIGSEGV && os::is_poll_address(addr))) {
if (TraceTraps) {
- tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (SIGSEGV)", pc);
+ tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (%s)", p2i(pc),
+ (SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) ? "SIGTRAP" : "SIGSEGV");
}
stub = SharedRuntime::get_poll_stub(pc);
goto run_stub;
--- a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp Fri Jan 12 15:05:35 2018 -0800
@@ -46,6 +46,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/osThread.hpp"
+#include "runtime/safepointMechanism.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.inline.hpp"
@@ -382,7 +383,7 @@
stub = SharedRuntime::get_handle_wrong_method_stub();
}
- else if (sig == SIGSEGV &&
+ else if (sig == ((SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) ? SIGTRAP : SIGSEGV) &&
// A linux-ppc64 kernel before 2.6.6 doesn't set si_addr on some segfaults
// in 64bit mode (cf. http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.6),
// especially when we try to read from the safepoint polling page. So the check
@@ -393,7 +394,8 @@
((cb = CodeCache::find_blob(pc)) != NULL) &&
cb->is_compiled()) {
if (TraceTraps) {
- tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (SIGSEGV)", p2i(pc));
+ tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (%s)", p2i(pc),
+ (SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) ? "SIGTRAP" : "SIGSEGV");
}
stub = SharedRuntime::get_poll_stub(pc);
}
--- a/src/hotspot/share/ci/ciEnv.cpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/share/ci/ciEnv.cpp Fri Jan 12 15:05:35 2018 -0800
@@ -1164,28 +1164,30 @@
void ciEnv::dump_compile_data(outputStream* out) {
CompileTask* task = this->task();
- Method* method = task->method();
- int entry_bci = task->osr_bci();
- int comp_level = task->comp_level();
- out->print("compile %s %s %s %d %d",
- method->klass_name()->as_quoted_ascii(),
- method->name()->as_quoted_ascii(),
- method->signature()->as_quoted_ascii(),
- entry_bci, comp_level);
- if (compiler_data() != NULL) {
- if (is_c2_compile(comp_level)) {
+ if (task) {
+ Method* method = task->method();
+ int entry_bci = task->osr_bci();
+ int comp_level = task->comp_level();
+ out->print("compile %s %s %s %d %d",
+ method->klass_name()->as_quoted_ascii(),
+ method->name()->as_quoted_ascii(),
+ method->signature()->as_quoted_ascii(),
+ entry_bci, comp_level);
+ if (compiler_data() != NULL) {
+ if (is_c2_compile(comp_level)) {
#ifdef COMPILER2
- // Dump C2 inlining data.
- ((Compile*)compiler_data())->dump_inline_data(out);
+ // Dump C2 inlining data.
+ ((Compile*)compiler_data())->dump_inline_data(out);
#endif
- } else if (is_c1_compile(comp_level)) {
+ } else if (is_c1_compile(comp_level)) {
#ifdef COMPILER1
- // Dump C1 inlining data.
- ((Compilation*)compiler_data())->dump_inline_data(out);
+ // Dump C1 inlining data.
+ ((Compilation*)compiler_data())->dump_inline_data(out);
#endif
+ }
}
+ out->cr();
}
- out->cr();
}
void ciEnv::dump_replay_data_unsafe(outputStream* out) {
--- a/src/hotspot/share/classfile/systemDictionary.cpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/share/classfile/systemDictionary.cpp Fri Jan 12 15:05:35 2018 -0800
@@ -2734,43 +2734,58 @@
return method_type;
}
+Handle SystemDictionary::find_field_handle_type(Symbol* signature,
+ Klass* accessing_klass,
+ TRAPS) {
+ Handle empty;
+ ResourceMark rm(THREAD);
+ SignatureStream ss(signature, /*is_method=*/ false);
+ if (!ss.is_done()) {
+ Handle class_loader, protection_domain;
+ if (accessing_klass != NULL) {
+ class_loader = Handle(THREAD, accessing_klass->class_loader());
+ protection_domain = Handle(THREAD, accessing_klass->protection_domain());
+ }
+ oop mirror = ss.as_java_mirror(class_loader, protection_domain, SignatureStream::NCDFError, CHECK_(empty));
+ ss.next();
+ if (ss.is_done()) {
+ return Handle(THREAD, mirror);
+ }
+ }
+ return empty;
+}
+
// Ask Java code to find or construct a method handle constant.
Handle SystemDictionary::link_method_handle_constant(Klass* caller,
int ref_kind, //e.g., JVM_REF_invokeVirtual
Klass* callee,
- Symbol* name_sym,
+ Symbol* name,
Symbol* signature,
TRAPS) {
Handle empty;
- Handle name = java_lang_String::create_from_symbol(name_sym, CHECK_(empty));
- Handle type;
- if (signature->utf8_length() > 0 && signature->byte_at(0) == '(') {
- type = find_method_handle_type(signature, caller, CHECK_(empty));
- } else if (caller == NULL) {
- // This should not happen. JDK code should take care of that.
+ if (caller == NULL) {
THROW_MSG_(vmSymbols::java_lang_InternalError(), "bad MH constant", empty);
- } else {
- ResourceMark rm(THREAD);
- SignatureStream ss(signature, false);
- if (!ss.is_done()) {
- oop mirror = ss.as_java_mirror(Handle(THREAD, caller->class_loader()),
- Handle(THREAD, caller->protection_domain()),
- SignatureStream::NCDFError, CHECK_(empty));
- type = Handle(THREAD, mirror);
- ss.next();
- if (!ss.is_done()) type = Handle(); // error!
- }
}
- if (type.is_null()) {
- THROW_MSG_(vmSymbols::java_lang_LinkageError(), "bad signature", empty);
- }
+ Handle name_str = java_lang_String::create_from_symbol(name, CHECK_(empty));
+ Handle signature_str = java_lang_String::create_from_symbol(signature, CHECK_(empty));
+
+ // Put symbolic info from the MH constant into freshly created MemberName and resolve it.
+ Handle mname = MemberName_klass()->allocate_instance_handle(CHECK_(empty));
+ java_lang_invoke_MemberName::set_clazz(mname(), callee->java_mirror());
+ java_lang_invoke_MemberName::set_name (mname(), name_str());
+ java_lang_invoke_MemberName::set_type (mname(), signature_str());
+ java_lang_invoke_MemberName::set_flags(mname(), MethodHandles::ref_kind_to_flags(ref_kind));
+ MethodHandles::resolve_MemberName(mname, caller, CHECK_(empty));
+
+ // After method/field resolution succeeded, it's safe to resolve MH signature as well.
+ Handle type = MethodHandles::resolve_MemberName_type(mname, caller, CHECK_(empty));
// call java.lang.invoke.MethodHandleNatives::linkMethodHandleConstant(Class caller, int refKind, Class callee, String name, Object type) -> MethodHandle
JavaCallArguments args;
args.push_oop(Handle(THREAD, caller->java_mirror())); // the referring class
args.push_int(ref_kind);
args.push_oop(Handle(THREAD, callee->java_mirror())); // the target class
- args.push_oop(name);
+ args.push_oop(name_str);
args.push_oop(type);
JavaValue result(T_OBJECT);
JavaCalls::call_static(&result,
--- a/src/hotspot/share/classfile/systemDictionary.hpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/share/classfile/systemDictionary.hpp Fri Jan 12 15:05:35 2018 -0800
@@ -532,6 +532,11 @@
Klass* accessing_klass,
TRAPS);
+ // find a java.lang.Class object for a given signature
+ static Handle find_field_handle_type(Symbol* signature,
+ Klass* accessing_klass,
+ TRAPS);
+
// ask Java to compute a java.lang.invoke.MethodHandle object for a given CP entry
static Handle link_method_handle_constant(Klass* caller,
int ref_kind, //e.g., JVM_REF_invokeVirtual
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -4786,7 +4786,7 @@
timer->record_time_secs(G1GCPhaseTimes::YoungFreeCSet, worker_id, young_time);
}
if (has_non_young_time) {
- timer->record_time_secs(G1GCPhaseTimes::NonYoungFreeCSet, worker_id, young_time);
+ timer->record_time_secs(G1GCPhaseTimes::NonYoungFreeCSet, worker_id, non_young_time);
}
}
};
--- a/src/hotspot/share/prims/methodHandles.cpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/share/prims/methodHandles.cpp Fri Jan 12 15:05:35 2018 -0800
@@ -122,6 +122,48 @@
ALL_KINDS = IS_METHOD | IS_CONSTRUCTOR | IS_FIELD | IS_TYPE
};
+int MethodHandles::ref_kind_to_flags(int ref_kind) {
+ assert(ref_kind_is_valid(ref_kind), "%d", ref_kind);
+ int flags = (ref_kind << REFERENCE_KIND_SHIFT);
+ if (ref_kind_is_field(ref_kind)) {
+ flags |= IS_FIELD;
+ } else if (ref_kind_is_method(ref_kind)) {
+ flags |= IS_METHOD;
+ } else if (ref_kind == JVM_REF_newInvokeSpecial) {
+ flags |= IS_CONSTRUCTOR;
+ }
+ return flags;
+}
+
+Handle MethodHandles::resolve_MemberName_type(Handle mname, Klass* caller, TRAPS) {
+ Handle empty;
+ Handle type(THREAD, java_lang_invoke_MemberName::type(mname()));
+ if (!java_lang_String::is_instance_inlined(type())) {
+ return type; // already resolved
+ }
+ Symbol* signature = java_lang_String::as_symbol_or_null(type());
+ if (signature == NULL) {
+ return empty; // no such signature exists in the VM
+ }
+ Handle resolved;
+ int flags = java_lang_invoke_MemberName::flags(mname());
+ switch (flags & ALL_KINDS) {
+ case IS_METHOD:
+ case IS_CONSTRUCTOR:
+ resolved = SystemDictionary::find_method_handle_type(signature, caller, CHECK_(empty));
+ break;
+ case IS_FIELD:
+ resolved = SystemDictionary::find_field_handle_type(signature, caller, CHECK_(empty));
+ break;
+ default:
+ THROW_MSG_(vmSymbols::java_lang_InternalError(), "unrecognized MemberName format", empty);
+ }
+ if (resolved.is_null()) {
+ THROW_MSG_(vmSymbols::java_lang_InternalError(), "bad MemberName type", empty);
+ }
+ return resolved;
+}
+
oop MethodHandles::init_MemberName(Handle mname, Handle target, TRAPS) {
// This method is used from java.lang.invoke.MemberName constructors.
// It fills in the new MemberName from a java.lang.reflect.Member.
--- a/src/hotspot/share/prims/methodHandles.hpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/share/prims/methodHandles.hpp Fri Jan 12 15:05:35 2018 -0800
@@ -70,6 +70,8 @@
static int find_MemberNames(Klass* k, Symbol* name, Symbol* sig,
int mflags, Klass* caller,
int skip, objArrayHandle results, TRAPS);
+ static Handle resolve_MemberName_type(Handle mname, Klass* caller, TRAPS);
+
// bit values for suppress argument to expand_MemberName:
enum { _suppress_defc = 1, _suppress_name = 2, _suppress_type = 4 };
@@ -191,6 +193,8 @@
ref_kind == JVM_REF_invokeInterface);
}
+ static int ref_kind_to_flags(int ref_kind);
+
#include CPU_HEADER(methodHandles)
// Tracing
--- a/src/hotspot/share/runtime/safepointMechanism.cpp Mon Jan 08 21:55:55 2018 -0800
+++ b/src/hotspot/share/runtime/safepointMechanism.cpp Fri Jan 12 15:05:35 2018 -0800
@@ -36,23 +36,39 @@
void SafepointMechanism::default_initialize() {
if (ThreadLocalHandshakes) {
set_uses_thread_local_poll();
- const size_t page_size = os::vm_page_size();
- const size_t allocation_size = 2 * page_size;
- char* polling_page = os::reserve_memory(allocation_size, NULL, page_size);
- os::commit_memory_or_exit(polling_page, allocation_size, false, "Unable to commit Safepoint polling page");
+
+ // Poll bit values
+ intptr_t poll_armed_value = poll_bit();
+ intptr_t poll_disarmed_value = 0;
- char* bad_page = polling_page;
- char* good_page = polling_page + page_size;
+#ifdef USE_POLL_BIT_ONLY
+ if (!USE_POLL_BIT_ONLY)
+#endif
+ {
+ // Polling page
+ const size_t page_size = os::vm_page_size();
+ const size_t allocation_size = 2 * page_size;
+ char* polling_page = os::reserve_memory(allocation_size, NULL, page_size);
+ os::commit_memory_or_exit(polling_page, allocation_size, false, "Unable to commit Safepoint polling page");
- os::protect_memory(bad_page, page_size, os::MEM_PROT_NONE);
- os::protect_memory(good_page, page_size, os::MEM_PROT_READ);
+ char* bad_page = polling_page;
+ char* good_page = polling_page + page_size;
+
+ os::protect_memory(bad_page, page_size, os::MEM_PROT_NONE);
+ os::protect_memory(good_page, page_size, os::MEM_PROT_READ);
+
+ log_info(os)("SafePoint Polling address, bad (protected) page:" INTPTR_FORMAT ", good (unprotected) page:" INTPTR_FORMAT, p2i(bad_page), p2i(good_page));
+ os::set_polling_page((address)(bad_page));
- log_info(os)("SafePoint Polling address, bad (protected) page:" INTPTR_FORMAT ", good (unprotected) page:" INTPTR_FORMAT, p2i(bad_page), p2i(good_page));
- os::set_polling_page((address)(bad_page));
+ // Poll address values
+ intptr_t bad_page_val = reinterpret_cast<intptr_t>(bad_page),
+ good_page_val = reinterpret_cast<intptr_t>(good_page);
+ poll_armed_value |= bad_page_val;
+ poll_disarmed_value |= good_page_val;
+ }
- intptr_t poll_page_val = reinterpret_cast<intptr_t>(bad_page);
- _poll_armed_value = reinterpret_cast<void*>(poll_page_val | poll_bit());
- _poll_disarmed_value = good_page;
+ _poll_armed_value = reinterpret_cast<void*>(poll_armed_value);
+ _poll_disarmed_value = reinterpret_cast<void*>(poll_disarmed_value);
} else {
const size_t page_size = os::vm_page_size();
char* polling_page = os::reserve_memory(page_size, NULL, page_size);
--- a/src/java.base/share/classes/java/lang/invoke/MemberName.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/java.base/share/classes/java/lang/invoke/MemberName.java Fri Jan 12 15:05:35 2018 -0800
@@ -900,9 +900,9 @@
buf.append(getName(clazz));
buf.append('.');
}
- String name = getName();
+ String name = this.name; // avoid expanding from VM
buf.append(name == null ? "*" : name);
- Object type = getType();
+ Object type = this.type; // avoid expanding from VM
if (!isInvocable()) {
buf.append('/');
buf.append(type == null ? "*" : getName(type));
--- a/src/java.compiler/share/classes/javax/lang/model/overview.html Mon Jan 08 21:55:55 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!--
-Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation. Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-<html>
-<head>
-<title>javax.lang.model</title>
-</head>
-
-<body bgcolor="white">
-
-Packages used to model various aspects of the Java programming language.
-
-@since 1.6
-
-</body>
-</html>
--- a/src/java.compiler/share/classes/javax/tools/ToolProvider.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/java.compiler/share/classes/javax/tools/ToolProvider.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
package javax.tools;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Iterator;
@@ -101,17 +99,6 @@
return null;
}
- private static final boolean useLegacy;
-
- static {
- Class<?> c = null;
- try {
- c = Class.forName("java.lang.Module");
- } catch (Throwable t) {
- }
- useLegacy = (c == null);
- }
-
/**
* Get an instance of a system tool using the service loader.
* @implNote By default, this returns the implementation in the specified module.
@@ -126,14 +113,6 @@
* @return the specified implementation of the tool
*/
private static <T> T getSystemTool(Class<T> clazz, String moduleName, String className) {
- if (useLegacy) {
- try {
- return Class.forName(className, true, ClassLoader.getSystemClassLoader()).
- asSubclass(clazz).getConstructor().newInstance();
- } catch (ReflectiveOperationException e) {
- throw new Error(e);
- }
- }
try {
ServiceLoader<T> sl = ServiceLoader.load(clazz, ClassLoader.getSystemClassLoader());
@@ -150,24 +129,16 @@
/**
* Determine if this is the desired tool instance.
- * @param <T> the interface of the tool
- * @param tool the instance of the tool
- * @param moduleName the name of the module containing the desired implementation
+ * @param <T> the interface of the tool
+ * @param tool the instance of the tool
+ * @param moduleName the name of the module containing the desired implementation
* @return true if and only if the tool matches the specified criteria
*/
private static <T> boolean matches(T tool, String moduleName) {
PrivilegedAction<Boolean> pa = () -> {
- // for now, use reflection to implement
- // return moduleName.equals(tool.getClass().getModule().getName());
- try {
- Method getModuleMethod = Class.class.getDeclaredMethod("getModule");
- Object toolModule = getModuleMethod.invoke(tool.getClass());
- Method getNameMethod = toolModule.getClass().getDeclaredMethod("getName");
- String toolModuleName = (String) getNameMethod.invoke(toolModule);
- return moduleName.equals(toolModuleName);
- } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
- return false;
- }
+ Module toolModule = tool.getClass().getModule();
+ String toolModuleName = toolModule.getName();
+ return toolModuleName.equals(moduleName);
};
return AccessController.doPrivileged(pa);
}
--- a/src/java.compiler/share/classes/javax/tools/overview.html Mon Jan 08 21:55:55 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!--
-Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation. Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-
-<html>
-<head>
-<title>javax.tools</title>
-</head>
-<body>
-
-<p>
-The Java™ programming language compiler API is a set of interfaces that describes the
-functions provided by a compiler. This API has three
-main objectives:
-</p>
-
-<ul>
-
-<li>Allow invocation of a compiler from a program using
-standardized interfaces.</li>
-
-<li>Provide interfaces enabling the compiler to report diagnostics in a
-structured way.</li>
-
-<li>Provide interfaces enabling clients of the compiler to override
-how file objects are found. "File objects" is a file
-abstraction.</li>
-
-</ul>
-
-</body>
-</html>
--- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Fri Jan 12 15:05:35 2018 -0800
@@ -448,7 +448,7 @@
Win32ShellFolder2 sf = (Win32ShellFolder2)dir;
return (sf.isFileSystem() && sf.parent != null &&
- sf.parent.equals(Win32ShellFolder2.listRoots()));
+ sf.parent.equals(getDrives()));
}
String path = dir.getPath();
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -312,6 +312,7 @@
Assert.check(!hasExceptionIndex(), "exception_index already set");
Assert.check(exception_index >= 0, "Expected a valid index into exception table");
this.exception_index = exception_index;
+ this.isValidOffset = true;
}
public boolean hasCatchType() {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -3226,7 +3226,7 @@
JCVariableDecl indexdef = make.VarDef(index, make.Literal(INT, 0));
indexdef.init.type = indexdef.type = syms.intType.constType(0);
- List<JCStatement> loopinit = List.of(lencachedef, indexdef);
+ List<JCStatement> loopinit = List.of(arraycachedef, lencachedef, indexdef);
JCBinary cond = makeBinary(LT, make.Ident(index), make.Ident(lencache));
JCExpressionStatement step = make.Exec(makeUnary(PREINC, make.Ident(index)));
@@ -3236,20 +3236,18 @@
make.Ident(index)).setType(elemtype);
JCVariableDecl loopvardef = (JCVariableDecl)make.VarDef(tree.var.mods,
tree.var.name,
- tree.var.vartype, loopvarinit).setType(tree.var.type);
+ tree.var.vartype,
+ loopvarinit).setType(tree.var.type);
loopvardef.sym = tree.var.sym;
-
- JCBlock body = make.Block(0, List.of(loopvardef, tree.body));
-
- arraycachedef = translate(arraycachedef);
+ JCBlock body = make.
+ Block(0, List.of(loopvardef, tree.body));
+
result = translate(make.
ForLoop(loopinit,
cond,
List.of(step),
body));
patchTargets(body, tree, result);
- JCStatement nullAssignToArr = make.Assignment(arraycache, make.Literal(BOT, null).setType(syms.botType));
- result = make.Block(0, List.of(arraycachedef, (JCStatement)result, nullAssignToArr));
}
/** Patch up break and continue targets. */
private void patchTargets(JCTree body, final JCTree src, final JCTree dest) {
@@ -3303,7 +3301,7 @@
types.erasure(types.asSuper(iterator.type.getReturnType(), syms.iteratorType.tsym)),
currentMethodSym);
- JCStatement init = make.
+ JCStatement init = make.
VarDef(itvar, make.App(make.Select(tree.expr, iterator)
.setType(types.erasure(iterator.type))));
@@ -3328,15 +3326,12 @@
indexDef.sym = tree.var.sym;
JCBlock body = make.Block(0, List.of(indexDef, tree.body));
body.endpos = TreeInfo.endPos(tree.body);
- init = translate(init);
result = translate(make.
- ForLoop(List.nil(),
+ ForLoop(List.of(init),
cond,
List.nil(),
body));
patchTargets(body, tree, result);
- JCStatement nullAssignToIterator = make.Assignment(itvar, make.Literal(BOT, null).setType(syms.botType));
- result = make.Block(0, List.of(init, (JCStatement)result, nullAssignToIterator));
}
public void visitVarDef(JCVariableDecl tree) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2100,15 +2100,19 @@
}
private void fillLocalVarPosition(LocalVar lv) {
- if (lv == null || lv.sym == null || !lv.sym.hasTypeAnnotations())
+ if (lv == null || lv.sym == null || lv.sym.isExceptionParameter()|| !lv.sym.hasTypeAnnotations())
return;
+ LocalVar.Range widestRange = lv.getWidestRange();
for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) {
TypeAnnotationPosition p = ta.position;
- LocalVar.Range widestRange = lv.getWidestRange();
- p.lvarOffset = new int[] { (int)widestRange.start_pc };
- p.lvarLength = new int[] { (int)widestRange.length };
- p.lvarIndex = new int[] { (int)lv.reg };
- p.isValidOffset = true;
+ if (widestRange.closed() && widestRange.length > 0) {
+ p.lvarOffset = new int[] { (int)widestRange.start_pc };
+ p.lvarLength = new int[] { (int)widestRange.length };
+ p.lvarIndex = new int[] { (int)lv.reg };
+ p.isValidOffset = true;
+ } else {
+ p.isValidOffset = false;
+ }
}
}
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaAccessProvider.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaAccessProvider.java Fri Jan 12 15:05:35 2018 -0800
@@ -34,7 +34,6 @@
import java.util.Objects;
import jdk.vm.ci.code.CodeUtil;
-import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.meta.DeoptimizationAction;
import jdk.vm.ci.meta.DeoptimizationReason;
@@ -284,11 +283,9 @@
ResolvedJavaType elementType = lookupJavaType.getComponentType();
JavaKind elementKind = elementType.getJavaKind();
final int headerSize = getArrayBaseOffset(elementKind);
- TargetDescription target = runtime.getHostJVMCIBackend().getTarget();
int sizeOfElement = getArrayIndexScale(elementKind);
- int alignment = target.wordSize;
int log2ElementSize = CodeUtil.log2(sizeOfElement);
- return computeArrayAllocationSize(length, alignment, headerSize, log2ElementSize);
+ return computeArrayAllocationSize(length, headerSize, log2ElementSize);
}
return lookupJavaType.instanceSize();
}
@@ -303,11 +300,13 @@
* alignment requirements.
*
* @param length the number of elements in the array
- * @param alignment the object alignment requirement
* @param headerSize the size of the array header
* @param log2ElementSize log2 of the size of an element in the array
+ * @return the size of the memory chunk
*/
- public static int computeArrayAllocationSize(int length, int alignment, int headerSize, int log2ElementSize) {
+ public int computeArrayAllocationSize(int length, int headerSize, int log2ElementSize) {
+ HotSpotVMConfig config = runtime.getConfig();
+ int alignment = config.objectAlignment;
int size = (length << log2ElementSize) + headerSize + (alignment - 1);
int mask = ~(alignment - 1);
return size & mask;
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Fri Jan 12 15:05:35 2018 -0800
@@ -68,6 +68,8 @@
final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class);
+ final int objectAlignment = getFlag("ObjectAlignmentInBytes", Integer.class);
+
final int prototypeMarkWordOffset = getFieldOffset("Klass::_prototype_header", Integer.class, "markOop");
final int subklassOffset = getFieldOffset("Klass::_subklass", Integer.class, "Klass*");
final int nextSiblingOffset = getFieldOffset("Klass::_next_sibling", Integer.class, "Klass*");
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotReplacementsUtil.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotReplacementsUtil.java Fri Jan 12 15:05:35 2018 -0800
@@ -566,6 +566,28 @@
}
@Fold
+ public static int objectAlignment(@InjectedParameter GraalHotSpotVMConfig config) {
+ return config.objectAlignment;
+ }
+
+ /**
+ * Computes the size of the memory chunk allocated for an array. This size accounts for the
+ * array header size, body size and any padding after the last element to satisfy object
+ * alignment requirements.
+ *
+ * @param length the number of elements in the array
+ * @param headerSize the size of the array header
+ * @param log2ElementSize log2 of the size of an element in the array
+ * @return the size of the memory chunk
+ */
+ public static int arrayAllocationSize(int length, int headerSize, int log2ElementSize) {
+ int alignment = objectAlignment(INJECTED_VMCONFIG);
+ int size = (length << log2ElementSize) + headerSize + (alignment - 1);
+ int mask = ~(alignment - 1);
+ return size & mask;
+ }
+
+ @Fold
public static int instanceHeaderSize(@InjectedParameter GraalHotSpotVMConfig config) {
return config.useCompressedClassPointers ? (2 * wordSize()) - 4 : 2 * wordSize();
}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java Fri Jan 12 15:05:35 2018 -0800
@@ -23,7 +23,6 @@
package org.graalvm.compiler.hotspot.replacements;
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
-import static jdk.vm.ci.hotspot.HotSpotMetaAccessProvider.computeArrayAllocationSize;
import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
import static org.graalvm.compiler.core.common.calc.UnsignedMath.belowThan;
import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG;
@@ -33,6 +32,7 @@
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.PROTOTYPE_MARK_WORD_LOCATION;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.TLAB_END_LOCATION;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.TLAB_TOP_LOCATION;
+import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayAllocationSize;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayKlassOffset;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayLengthOffset;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.config;
@@ -52,7 +52,6 @@
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.useBiasedLocking;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.useTLAB;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.verifyOop;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.wordSize;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.writeTlabTop;
import static org.graalvm.compiler.hotspot.replacements.HotspotSnippetsOptions.ProfileAllocations;
import static org.graalvm.compiler.hotspot.replacements.HotspotSnippetsOptions.ProfileAllocationsContext;
@@ -315,8 +314,7 @@
private static Object allocateArrayImpl(KlassPointer hub, int length, Word prototypeMarkWord, int headerSize, int log2ElementSize, boolean fillContents, Register threadRegister,
boolean maybeUnroll, String typeContext, boolean skipNegativeCheck, OptionValues options, Counters counters) {
Object result;
- int alignment = wordSize();
- int allocationSize = computeArrayAllocationSize(length, alignment, headerSize, log2ElementSize);
+ int allocationSize = arrayAllocationSize(length, headerSize, log2ElementSize);
Word thread = registerAsWord(threadRegister);
Word top = readTlabTop(thread);
Word end = readTlabEnd(thread);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewArrayStub.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewArrayStub.java Fri Jan 12 15:05:35 2018 -0800
@@ -23,6 +23,7 @@
package org.graalvm.compiler.hotspot.stubs;
import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG;
+import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayAllocationSize;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayPrototypeMarkWord;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.getAndClearObjectResult;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperElementTypeMask;
@@ -34,7 +35,6 @@
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.readLayoutHelper;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.useCMSIncrementalMode;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.wordSize;
import static org.graalvm.compiler.hotspot.replacements.NewObjectSnippets.MAX_ARRAY_FAST_PATH_ALLOCATION_LENGTH;
import static org.graalvm.compiler.hotspot.replacements.NewObjectSnippets.formatArray;
import static org.graalvm.compiler.hotspot.stubs.NewInstanceStub.refillAllocate;
@@ -42,7 +42,6 @@
import static org.graalvm.compiler.hotspot.stubs.StubUtil.newDescriptor;
import static org.graalvm.compiler.hotspot.stubs.StubUtil.printf;
import static org.graalvm.compiler.hotspot.stubs.StubUtil.verifyObject;
-import static jdk.vm.ci.hotspot.HotSpotMetaAccessProvider.computeArrayAllocationSize;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Snippet;
@@ -112,7 +111,7 @@
int log2ElementSize = (layoutHelper >> layoutHelperLog2ElementSizeShift(INJECTED_VMCONFIG)) & layoutHelperLog2ElementSizeMask(INJECTED_VMCONFIG);
int headerSize = (layoutHelper >> layoutHelperHeaderSizeShift(INJECTED_VMCONFIG)) & layoutHelperHeaderSizeMask(INJECTED_VMCONFIG);
int elementKind = (layoutHelper >> layoutHelperElementTypeShift(INJECTED_VMCONFIG)) & layoutHelperElementTypeMask(INJECTED_VMCONFIG);
- int sizeInBytes = computeArrayAllocationSize(length, wordSize(), headerSize, log2ElementSize);
+ int sizeInBytes = arrayAllocationSize(length, headerSize, log2ElementSize);
if (logging(options)) {
printf("newArray: element kind %d\n", elementKind);
printf("newArray: array length %d\n", length);
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ToolOption.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ToolOption.java Fri Jan 12 15:05:35 2018 -0800
@@ -212,6 +212,13 @@
}
},
+ ADD_OPENS("--add-opens", true) {
+ @Override
+ public void process(Helper helper, String arg) throws InvalidValueException {
+ Option.ADD_OPENS.process(helper.getOptionHelper(), opt, arg);
+ }
+ },
+
// ----- doclet options -----
DOCLET("-doclet", true), // handled in setDocletInvoker
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -204,9 +204,10 @@
public boolean frames = true;
/**
- * This is the HTML version of the generated pages. HTML 4.01 is the default output version.
+ * This is the HTML version of the generated pages.
+ * The default value is determined later.
*/
- public HtmlVersion htmlVersion = HtmlVersion.HTML4;
+ public HtmlVersion htmlVersion = null;
/**
* Collected set of doclint options
@@ -298,6 +299,12 @@
if (!generalValidOptions()) {
return false;
}
+
+ if (htmlVersion == null) {
+ reporter.print(WARNING, getText("doclet.HTML_version_not_specified", helpfile));
+ htmlVersion = HtmlVersion.HTML4;
+ }
+
// check if helpfile exists
if (!helpfile.isEmpty()) {
DocFile help = DocFile.createFileForInput(this, helpfile);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Mon Jan 08 21:55:55 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Fri Jan 12 15:05:35 2018 -0800
@@ -384,3 +384,11 @@
name prefix followed by .*, which expands to all sub-packages\n\
of the given package. Prefix the package specifier with - to\n\
disable checks for the specified packages.
+
+# L10N: do not localize the option names -html4 and -html5
+doclet.HTML_version_not_specified=\
+ You have not specified the version of HTML to use.\n\
+ The default is currently HTML 4.01, but this will change to HTML5\n\
+ in a future release. To suppress this warning, please specify the\n\
+ version of HTML used in your documentation comments and to be\n\
+ generated by this doclet, using the -html4 or -html5 options.
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java Mon Jan 08 21:55:55 2018 -0800
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -189,6 +189,13 @@
}
},
+ ADD_OPENS("--add-opens", HIDDEN, true) {
+ @Override
+ public void process(Helper helper, String arg) throws InvalidValueException {
+ Option.ADD_OPENS.process(helper.getOptionHelper(), primaryName, arg);
+ }
+ },
+
// ----- doclet options -----
DOCLET("-doclet", STANDARD, true), // handled in setDocletInvoker
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/overview.html Mon Jan 08 21:55:55 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
- <head>
- <title>javap: class file disassembler</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- </head>
- <body>
- Javap is a class file disassembler.
- </body>
-</html>
--- a/test/hotspot/jtreg/ProblemList.txt Mon Jan 08 21:55:55 2018 -0800
+++ b/test/hotspot/jtreg/ProblemList.txt Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,7 @@
compiler/ciReplay/TestSAServer.java 8029528 generic-all
compiler/codecache/stress/OverloadCompileQueueTest.java 8166554 generic-all
+compiler/codegen/Test6896617.java 8193479 generic-all
compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8140405 generic-all
compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java 8158860 generic-all
compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java 8163894 generic-all
@@ -66,6 +67,7 @@
gc/g1/logging/TestG1LoggingFailure.java 8169634 generic-all
gc/g1/humongousObjects/TestHeapCounters.java 8178918 generic-all
gc/g1/TestVerifyGCType.java 8193067 generic-all
+gc/stress/gclocker/TestGCLockerWithParallel.java 8180622 generic-all
gc/stress/gclocker/TestGCLockerWithG1.java 8179226 generic-all
gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java 8177765 generic-all
--- a/test/hotspot/jtreg/compiler/tiered/LevelTransitionTest.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/hotspot/jtreg/compiler/tiered/LevelTransitionTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
* java.management
*
* @build sun.hotspot.WhiteBox
+ * compiler.tiered.LevelTransitionTest
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
--- a/test/hotspot/jtreg/runtime/appcds/TestCommon.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/TestCommon.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
*/
import jdk.test.lib.Utils;
+import jdk.test.lib.BuildHelper;
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.Platform;
import jdk.test.lib.cds.CDSOptions;
@@ -107,6 +108,19 @@
return createArchive(opts);
}
+ // If you use -XX:+UseAppCDS or -XX:-UseAppCDS in your JVM command-line, call this method
+ // to wrap the arguments. On commercial builds, -XX:+UnlockCommercialFeatures will be
+ // prepended to the command-line. See JDK-8193664.
+ public static String[] makeCommandLineForAppCDS(String... args) throws Exception {
+ if (BuildHelper.isCommercialBuild()) {
+ String[] newArgs = new String[args.length + 1];
+ newArgs[0] = "-XX:+UnlockCommercialFeatures";
+ System.arraycopy(args, 0, newArgs, 1, args.length);
+ return newArgs;
+ } else {
+ return args;
+ }
+ }
// Create AppCDS archive using appcds options
public static OutputAnalyzer createArchive(AppCDSOptions opts)
@@ -139,7 +153,7 @@
for (String s : opts.suffix) cmd.add(s);
String[] cmdLine = cmd.toArray(new String[cmd.size()]);
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmdLine);
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, makeCommandLineForAppCDS(cmdLine));
return executeAndLog(pb, "dump");
}
@@ -166,7 +180,7 @@
for (String s : opts.suffix) cmd.add(s);
String[] cmdLine = cmd.toArray(new String[cmd.size()]);
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmdLine);
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, makeCommandLineForAppCDS(cmdLine));
return executeAndLog(pb, "exec");
}
--- a/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -122,14 +122,14 @@
static void dumpLoadedClasses(boolean useAppCDS, String[] expectedClasses,
String[] unexpectedClasses) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- true,
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
+ TestCommon.makeCommandLineForAppCDS(
"-XX:DumpLoadedClassList=" + CLASSLIST_FILE,
"-cp",
TESTJAR,
useAppCDS ? "-XX:+UseAppCDS" : "-XX:-UseAppCDS",
TESTNAME,
- TEST_OUT);
+ TEST_OUT));
OutputAnalyzer output = TestCommon.executeAndLog(pb, "dump-loaded-classes")
.shouldHaveExitValue(0).shouldContain(TEST_OUT);
@@ -152,8 +152,8 @@
static void dumpArchive(boolean useAppCDS, String[] expectedClasses,
String[] unexpectedClasses) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- true,
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
+ TestCommon.makeCommandLineForAppCDS(
useAppCDS ? "-XX:-UnlockDiagnosticVMOptions" :
"-XX:+UnlockDiagnosticVMOptions",
"-cp",
@@ -162,7 +162,7 @@
"-XX:SharedClassListFile=" + CLASSLIST_FILE,
"-XX:SharedArchiveFile=" + ARCHIVE_FILE,
"-Xlog:cds",
- "-Xshare:dump");
+ "-Xshare:dump"));
OutputAnalyzer output = TestCommon.executeAndLog(pb, "dump-archive")
.shouldHaveExitValue(0);
@@ -179,8 +179,8 @@
static void useArchive(boolean useAppCDS, String[] expectedClasses,
String[] unexpectedClasses) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- true,
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
+ TestCommon.makeCommandLineForAppCDS(
useAppCDS ? "-XX:-UnlockDiagnosticVMOptions" :
"-XX:+UnlockDiagnosticVMOptions",
"-cp",
@@ -190,7 +190,7 @@
"-verbose:class",
"-Xshare:on",
TESTNAME,
- TEST_OUT );
+ TEST_OUT));
OutputAnalyzer output = TestCommon.executeAndLog(pb, "use-archive");
if (CDSTestUtils.isUnableToMap(output))
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,7 @@
TestCommon.getSourceFile("SharedStringsBasic.txt").toString();
ProcessBuilder dumpPb = ProcessTools.createJavaProcessBuilder(true,
+ TestCommon.makeCommandLineForAppCDS(
"-XX:+UseAppCDS",
"-XX:+UseCompressedOops",
"-XX:+UseG1GC",
@@ -57,13 +58,14 @@
"-XX:SharedArchiveConfigFile=" + sharedArchiveConfigFile,
"-XX:SharedArchiveFile=./SharedStringsBasic.jsa",
"-Xshare:dump",
- "-Xlog:cds,cds+hashtables");
+ "-Xlog:cds,cds+hashtables"));
TestCommon.executeAndLog(dumpPb, "dump")
.shouldContain("Shared string table stats")
.shouldHaveExitValue(0);
ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true,
+ TestCommon.makeCommandLineForAppCDS(
"-XX:+UseAppCDS",
"-XX:+UseCompressedOops",
"-XX:+UseG1GC",
@@ -71,7 +73,7 @@
"-XX:SharedArchiveFile=./SharedStringsBasic.jsa",
"-Xshare:auto",
"-showversion",
- "HelloString");
+ "HelloString"));
TestCommon.executeAndLog(runPb, "run").shouldHaveExitValue(0);
}
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,21 +42,23 @@
// SharedBaseAddress=0 puts the archive at a very high address on solaris,
// which provokes the crash.
ProcessBuilder dumpPb = ProcessTools.createJavaProcessBuilder(true,
+ TestCommon.makeCommandLineForAppCDS(
"-XX:+UseG1GC", "-XX:MaxRAMPercentage=12.5",
"-XX:+UseAppCDS",
"-cp", ".",
"-XX:SharedBaseAddress=0", "-XX:SharedArchiveFile=./SysDictCrash.jsa",
"-Xshare:dump",
- "-showversion", "-Xlog:cds,cds+hashtables");
+ "-showversion", "-Xlog:cds,cds+hashtables"));
TestCommon.checkDump(TestCommon.executeAndLog(dumpPb, "dump"));
ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true,
+ TestCommon.makeCommandLineForAppCDS(
"-XX:+UseG1GC", "-XX:MaxRAMPercentage=12.5",
"-XX:+UseAppCDS",
"-XX:SharedArchiveFile=./SysDictCrash.jsa",
"-Xshare:on",
- "-version");
+ "-version"));
TestCommon.checkExec(TestCommon.executeAndLog(runPb, "exec"));
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/invokedynamic/MethodHandleConstantHelper.jasm Fri Jan 12 15:05:35 2018 -0800
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package runtime/invokedynamic;
+
+super public class MethodHandleConstantHelper
+ version 51:0
+{
+
+static Field "testField":"I";
+
+static Method "testMethod":"()V"
+{
+ return;
+}
+
+public static Method "testMethodSignatureResolutionFailure":"()V"
+ stack 1 locals 1
+{
+ ldc MethodHandle REF_invokeStatic:
+ MethodHandleConstantHelper.testMethod:
+ "(LNotExist;)V";
+
+ return;
+}
+
+public static Method "testFieldSignatureResolutionFailure":"()V"
+ stack 1 locals 1
+{
+ ldc MethodHandle REF_getField:
+ MethodHandleConstantHelper.testField:
+ "LNotExist;";
+
+ return;
+}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/invokedynamic/MethodHandleConstantTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8188145
+ * @compile MethodHandleConstantHelper.jasm
+ * @run main runtime.invokedynamic.MethodHandleConstantTest
+ */
+package runtime.invokedynamic;
+
+import java.lang.invoke.*;
+
+public class MethodHandleConstantTest {
+ static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
+ static final MethodType TEST_MT = MethodType.methodType(void.class);
+ static final Class<?> TEST_CLASS;
+
+ static {
+ try {
+ TEST_CLASS = Class.forName("runtime.invokedynamic.MethodHandleConstantHelper");
+ } catch (ClassNotFoundException e) {
+ throw new Error(e);
+ }
+ }
+
+ static void test(String testName, Class<? extends Throwable> expectedError) {
+ System.out.print(testName);
+ try {
+ LOOKUP.findStatic(TEST_CLASS, testName, TEST_MT).invokeExact();
+ } catch (Throwable e) {
+ if (expectedError.isInstance(e)) {
+ // expected
+ } else {
+ e.printStackTrace();
+ String msg = String.format("%s: wrong exception: %s, but %s expected",
+ testName, e.getClass().getName(), expectedError.getName());
+ throw new AssertionError(msg);
+ }
+ }
+ System.out.println(": PASSED");
+ }
+
+ public static void main(String[] args) throws Throwable {
+ test("testMethodSignatureResolutionFailure", NoSuchMethodError.class);
+ test("testFieldSignatureResolutionFailure", NoSuchFieldError.class);
+ }
+}
--- a/test/hotspot/jtreg/runtime/logging/OsCpuLoggingTest.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/hotspot/jtreg/runtime/logging/OsCpuLoggingTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -40,10 +40,7 @@
public class OsCpuLoggingTest {
static void analyzeOutputForOsLog(OutputAnalyzer output) throws Exception {
- // Aix has it's own logging
- if (!Platform.isAix()) {
- output.shouldContain("SafePoint Polling address");
- }
+ output.shouldContain("SafePoint Polling address");
output.shouldHaveExitValue(0);
}
@@ -58,7 +55,10 @@
OutputAnalyzer output = new OutputAnalyzer(pb.start());
analyzeOutputForOsCpuLog(output);
- pb = ProcessTools.createJavaProcessBuilder("-Xlog:os", "-version");
+ // PPC64 only uses polling pages when UseSIGTRAP is off.
+ pb = (Platform.isPPC() && Platform.is64bit())
+ ? ProcessTools.createJavaProcessBuilder("-Xlog:os", "-XX:-UseSIGTRAP", "-version")
+ : ProcessTools.createJavaProcessBuilder("-Xlog:os", "-version");
output = new OutputAnalyzer(pb.start());
analyzeOutputForOsLog(output);
}
--- a/test/hotspot/jtreg/serviceability/sa/JhsdbThreadInfoTest.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/JhsdbThreadInfoTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,6 +21,11 @@
* questions.
*/
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.JDKToolLauncher;
import jdk.test.lib.Platform;
@@ -69,7 +74,18 @@
out.shouldMatch(" JavaThread state: _thread_.+");
out.shouldNotContain(" java.lang.Thread.State: UNKNOWN");
- out.stderrShouldBeEmpty();
+
+ // stderr should be empty except for VM warnings.
+ if (!out.getStderr().isEmpty()) {
+ List<String> lines = Arrays.asList(out.getStderr().split("(\\r\\n|\\n|\\r)"));
+ Pattern p = Pattern.compile(".*VM warning.*");
+ for (String line : lines) {
+ Matcher m = p.matcher(line);
+ if (!m.matches()) {
+ throw new RuntimeException("Stderr has output other than VM warnings");
+ }
+ }
+ }
System.out.println("Test Completed");
} catch (InterruptedException ie) {
--- a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackLock.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackLock.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,11 @@
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Asserts;
import jdk.test.lib.JDKToolLauncher;
@@ -76,7 +80,19 @@
out.shouldMatch("^\\s+- waiting to lock <0x[0-9a-f]+> \\(a java\\.lang\\.Class for LingeredAppWithLock\\)$");
out.shouldMatch("^\\s+- locked <0x[0-9a-f]+> \\(a java\\.lang\\.Thread\\)$");
out.shouldMatch("^\\s+- locked <0x[0-9a-f]+> \\(a java\\.lang\\.Class for int\\)$");
- out.stderrShouldBeEmpty();
+
+ // stderr should be empty except for VM warnings.
+ if (!out.getStderr().isEmpty()) {
+ List<String> lines = Arrays.asList(out.getStderr().split("(\\r\\n|\\n|\\r)"));
+ Pattern p = Pattern.compile(".*VM warning.*");
+ for (String line : lines) {
+ Matcher m = p.matcher(line);
+ if (!m.matches()) {
+ throw new RuntimeException("Stderr has output other than VM warnings");
+ }
+ }
+ }
+
System.out.println("Test Completed");
} finally {
--- a/test/jdk/java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -22,7 +22,8 @@
*/
/**
- * @test 8155740
+ * @test
+ * @bug 8155740
* @key headful
* @summary See <rdar://problem/3429130>: Events: actionPerformed() method not
* called when it is button is clicked (system load related)
--- a/test/jdk/java/awt/Dialog/NestedDialogs/Modeless/NestedModelessDialogTest.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/awt/Dialog/NestedDialogs/Modeless/NestedModelessDialogTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -22,7 +22,8 @@
*/
/**
- * @test 8155740
+ * @test
+ * @bug 8155740
* @key headful
* @summary See <rdar://problem/3429130>: Events: actionPerformed() method not
* called when it is button is clicked (system load related)
--- a/test/jdk/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -36,7 +36,8 @@
import static jdk.testlibrary.Asserts.assertTrue;
/*
- * @test 8155742
+ * @test
+ * @bug 8155742
* @key headful
* @summary Make sure that modifier key mask is set when robot press
* some key with one or more modifiers.
--- a/test/jdk/java/awt/TrayIcon/TrayIconMouseTest/TrayIconMouseTest.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/awt/TrayIcon/TrayIconMouseTest/TrayIconMouseTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -29,7 +29,8 @@
import java.awt.image.BufferedImage;
/*
- * @test 6384991
+ * @test
+ * @bug 6384991
* @summary Check if ActionEvent is triggered by a TrayIcon when
* it is double clicked with mouse button 1 on windows
* or single clicked with button 3 on Mac OS X
--- a/test/jdk/java/lang/StackWalker/SecurityExceptions.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/lang/StackWalker/SecurityExceptions.java Fri Jan 12 15:05:35 2018 -0800
@@ -22,7 +22,8 @@
*/
/*
- * @test 8020968
+ * @test
+ * @bug 8020968
* @summary Test security permission check
* @run main/othervm/java.security.policy=noperms.policy SecurityExceptions true
* @run main/othervm/java.security.policy=stackwalk.policy SecurityExceptions false
--- a/test/jdk/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/SystemLoggerInPlatformLoader/SystemLoggerInPlatformLoader.java Fri Jan 12 15:05:35 2018 -0800
@@ -31,7 +31,8 @@
import java.lang.reflect.Method;
/*
- * @test 8163162
+ * @test
+ * @bug 8163162
* @summary Checks that LazyLoggers are returned for System.Logger instances
* created by modules in the platform class loader.
* @modules java.base/java.lang:open
--- a/test/jdk/java/security/cert/PKIXBuilderParameters/InvalidParameters.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/security/cert/PKIXBuilderParameters/InvalidParameters.java Fri Jan 12 15:05:35 2018 -0800
@@ -23,7 +23,7 @@
/*
* @test
- * @test 4422738
+ * @bug 4422738
* @compile InvalidParameters.java
* @run main InvalidParameters
* @summary Make sure PKIXBuilderParameters(Set) detects invalid
--- a/test/jdk/java/security/cert/PKIXParameters/InvalidParameters.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/security/cert/PKIXParameters/InvalidParameters.java Fri Jan 12 15:05:35 2018 -0800
@@ -23,7 +23,7 @@
/**
* @test
- * @test 4422738
+ * @bug 4422738
* @compile InvalidParameters.java
* @run main InvalidParameters
* @summary Make sure PKIXParameters(Set) and setTrustAnchors() detects invalid
--- a/test/jdk/java/util/Arrays/StreamAndSpliterator.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/util/Arrays/StreamAndSpliterator.java Fri Jan 12 15:05:35 2018 -0800
@@ -22,7 +22,8 @@
*/
/**
- * @test 8037857
+ * @test
+ * @bug 8037857
* @summary tests for stream and spliterator factory methods
* @run testng StreamAndSpliterator
*/
--- a/test/jdk/java/util/Arrays/largeMemory/ParallelPrefix.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/util/Arrays/largeMemory/ParallelPrefix.java Fri Jan 12 15:05:35 2018 -0800
@@ -22,7 +22,8 @@
*/
/**
- * @test 8014076 8025067
+ * @test
+ * @bug 8014076 8025067
* @summary unit test for Arrays.ParallelPrefix().
* @author Tristan Yan
* @modules java.management jdk.management
--- a/test/jdk/java/util/Base64/TestBase64.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/util/Base64/TestBase64.java Fri Jan 12 15:05:35 2018 -0800
@@ -22,8 +22,9 @@
*/
/**
- * @test 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925
- * 8014217 8025003 8026330 8028397 8129544 8165243
+ * @test
+ * @bug 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925
+ * 8014217 8025003 8026330 8028397 8129544 8165243
* @summary tests java.util.Base64
* @library /test/lib
* @build jdk.test.lib.RandomFactory
--- a/test/jdk/java/util/Base64/TestBase64Golden.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/util/Base64/TestBase64Golden.java Fri Jan 12 15:05:35 2018 -0800
@@ -22,7 +22,8 @@
*/
/*
- * @test 4235519
+ * @test
+ * @bug 4235519
* @author Eric Wang <yiming.wang@oracle.com>
* @summary tests java.util.Base64
*/
--- a/test/jdk/java/util/logging/LogManager/LinkageErrorTest.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/java/util/logging/LogManager/LinkageErrorTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -28,7 +28,8 @@
import java.util.logging.Logger;
/**
- * @test 8152515
+ * @test
+ * @bug 8152515
* @summary Checks that LinkageError are ignored when closing handlers
* during Shutdown.
* @build LinkageErrorTest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/JFileChooser/8194044/FileSystemRootTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8194044
+ * @summary Test if Win32ShellFolder2 root folder object gets identified as such.
+ * @requires os.family=="windows"
+ * @modules java.desktop/sun.awt.shell
+ * @run main FileSystemRootTest
+ */
+
+import sun.awt.shell.ShellFolder;
+import javax.swing.filechooser.FileSystemView;
+import java.io.File;
+
+public class FileSystemRootTest {
+ public static void main(String[] args) throws Exception {
+ FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+
+ /*
+ * This is the only way to get the Win32ShellFolder2 object, since
+ * it is an internal class, which cannot be instantiated directly.
+ * On windows, this returns "C:\Users\<user-name>\Documents"
+ */
+ File def = fileSystemView.getDefaultDirectory();
+ File root = fileSystemView.getParentDirectory(
+ fileSystemView.getParentDirectory(
+ fileSystemView.getParentDirectory(def)));
+
+ if (! (root instanceof ShellFolder && ShellFolder.isFileSystemRoot(root))) {
+ throw new RuntimeException("Test failed: root drive reported as false");
+ }
+
+ if (fileSystemView.getSystemDisplayName(root).isEmpty()) {
+ throw new RuntimeException("Root drive display name is empty.");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/UIManager/8193673/TestProperties.java Fri Jan 12 15:05:35 2018 -0800
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.UIManager;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import javax.swing.plaf.nimbus.NimbusLookAndFeel;
+
+/**
+ * @test
+ * @bug 8193673
+ * @summary The test verifies that l&f specific properties are accessible
+ */
+public final class TestProperties {
+
+ private static final String[] windowsProperties = {
+ "FileChooser.viewMenuButtonToolTipText",
+ "FileChooser.viewMenuButtonAccessibleName",
+ };
+
+ private static final String[] aquaProperties = {
+ "FileChooser.mac.newFolder",
+ };
+
+ private static final String[] gtkProperties = {
+ "FileChooser.renameFileDialogText",
+ };
+
+ private static final String[] motifProperties = {
+ "FileChooser.enterFolderNameLabel.textAndMnemonic",
+ };
+
+ private static final String[] nimbusProperties = {
+ "FileChooser.refreshActionLabelText",
+ };
+
+ private static final String[] metalProperties = {
+ "MetalTitlePane.iconify.titleAndMnemonic",
+ };
+
+ public static void main(final String[] args) throws Exception {
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ test(metalProperties);
+
+ UIManager.setLookAndFeel(new NimbusLookAndFeel());
+ test(nimbusProperties);
+
+ UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
+ test(motifProperties);
+
+ try {
+ UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+ test(windowsProperties);
+ } catch (Exception e) {
+ // ignore
+ }
+
+ try {
+ UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel");
+ test(aquaProperties);
+ } catch (Exception e) {
+ // ignore
+ }
+
+ try {
+ UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
+ test(gtkProperties);
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ private static void test(final String[] properties) {
+ for (final String name : properties) {
+ String value = UIManager.getString(name);
+ if (value == null) {
+ System.err.println("Current LookAndFeel = "
+ + UIManager.getLookAndFeel().getDescription());
+ System.err.printf("The value for %s property is null\n", name);
+ throw new Error();
+ }
+ }
+ }
+}
--- a/test/jdk/tools/launcher/FXLauncherTest.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/tools/launcher/FXLauncherTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
* jfx app class, a main-class for the manifest, a bogus one and none.
* All should execute except the incorrect fx app class entries.
* @run main/othervm FXLauncherTest
- * @key intermittent
+ * @key intermittent headful
*/
import java.io.File;
import java.io.IOException;
--- a/test/jdk/tools/launcher/RunpathTest.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/jdk/tools/launcher/RunpathTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -71,6 +71,10 @@
public static void main(String... args) throws Exception {
if (isSolaris || isLinux) {
RunpathTest rp = new RunpathTest();
+ if (rp.elfreaderCmd == null) {
+ System.err.println("Warning: test passes vacuously");
+ return;
+ }
rp.testRpath();
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testHtmlWarning/TestHtmlWarning.java Fri Jan 12 15:05:35 2018 -0800
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8194955
+ * @summary Warn when default HTML version is used.
+ * @library ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester
+ * @run main TestHtmlWarning
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+public class TestHtmlWarning extends JavadocTester {
+
+ public static void main(String... args) throws Exception {
+ Files.write(testFile,
+ List.of("/** Comment. */", "public class C { }"));
+
+ TestHtmlWarning tester = new TestHtmlWarning();
+ tester.runTests();
+ }
+
+ private static final Path testFile = Paths.get("C.java");
+ private static final String warning =
+ "javadoc: warning - You have not specified the version of HTML to use.";
+
+ @Test
+ void testHtml4() {
+ javadoc("-d", "out-4",
+ "-html4",
+ testFile.toString());
+ checkExit(Exit.OK);
+
+ checkOutput(Output.OUT, false, warning);
+ }
+
+ @Test
+ void testHtml5() {
+ javadoc("-d", "out-5",
+ "-html5",
+ testFile.toString());
+ checkExit(Exit.OK);
+
+ checkOutput(Output.OUT, false, warning);
+ }
+
+ @Test
+ void testDefault() {
+ javadoc("-d", "out-default",
+ testFile.toString());
+ checkExit(Exit.OK);
+
+ checkOutput(Output.OUT, true, warning);
+ }
+}
--- a/test/langtools/jdk/javadoc/tool/6958836/Test.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/langtools/jdk/javadoc/tool/6958836/Test.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,6 +63,7 @@
// For some reason, this must be the first option when used.
opts.addAll(list("-locale", "en_US"));
opts.add("-Xdoclint:none");
+ opts.add("-html4");
opts.addAll(list("-classpath", System.getProperty("test.src")));
opts.addAll(list("-d", testOutDir.getPath()));
opts.addAll(testOpts);
--- a/test/langtools/jdk/javadoc/tool/6964914/Test.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/langtools/jdk/javadoc/tool/6964914/Test.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,7 @@
File testSrc = new File(System.getProperty("test.src"));
String[] args = {
"-Xdoclint:none",
+ "-html4",
"-source", "8",
"-classpath", ".",
"-package",
--- a/test/langtools/jdk/javadoc/tool/6964914/TestStdDoclet.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/langtools/jdk/javadoc/tool/6964914/TestStdDoclet.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,6 +58,7 @@
cmdArgs.addAll(Arrays.asList(
"-classpath", ".", // insulates us from ambient classpath
"-Xdoclint:none",
+ "-html4",
"-package",
new File(testSrc, thisClassName + ".java").getPath()
));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/tool/AddOpensTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8181878
+ * @summary javadoc should support/ignore --add-opens
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.main
+ * @modules jdk.javadoc/jdk.javadoc.internal.api
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @library /tools/lib
+ * @build toolbox.JavacTask toolbox.JavadocTask toolbox.TestRunner toolbox.ToolBox
+ * @run main AddOpensTest
+ */
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import toolbox.JavadocTask;
+import toolbox.Task;
+import toolbox.TestRunner;
+import toolbox.ToolBox;
+
+public class AddOpensTest extends TestRunner {
+ public static void main(String... args) throws Exception {
+ AddOpensTest t = new AddOpensTest();
+ t.runTests();
+ }
+
+ private final ToolBox tb = new ToolBox();
+ private final Path src = Paths.get("src");
+ private final Path api = Paths.get("api");
+
+ AddOpensTest() throws Exception {
+ super(System.err);
+ init();
+ }
+
+ void init() throws IOException {
+ tb.writeJavaFiles(src, "public class C { }");
+ }
+
+ @Test
+ public void testEncoding() {
+ Task.Result result = new JavadocTask(tb, Task.Mode.EXEC)
+ .options("-d", api.toString(),
+ "--add-opens", "some.module")
+ .files(src.resolve("C.java"))
+ .run(Task.Expect.SUCCESS)
+ .writeAll();
+ }
+}
+
--- a/test/langtools/jdk/javadoc/tool/MaxWarns.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/langtools/jdk/javadoc/tool/MaxWarns.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@
String javadoc(File f) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
- String[] args = { "-Xdoclint:none", "-d", "api", f.getPath() };
+ String[] args = { "-Xdoclint:none", "-html4", "-d", "api", f.getPath() };
int rc = jdk.javadoc.internal.tool.Main.execute(args, pw);
pw.flush();
return sw.toString();
--- a/test/langtools/jdk/javadoc/tool/QuietOption.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/langtools/jdk/javadoc/tool/QuietOption.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -62,6 +62,7 @@
void run1() throws Exception {
List<String> output = doTest(javadoc.getPath(),
"-classpath", ".", // insulates us from ambient classpath
+ "-html4",
"-quiet",
new File(testSrc, thisClassName + ".java").getPath());
--- a/test/langtools/jdk/javadoc/tool/doclint/DocLintTest.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/langtools/jdk/javadoc/tool/doclint/DocLintTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -92,6 +92,7 @@
/* 05 */ "}\n";
private final String rawDiags = "-XDrawDiagnostics";
+ private final String htmlVersion = "-html4";
private enum Message {
// doclint messages
@@ -141,66 +142,66 @@
javadoc = ToolProvider.getSystemDocumentationTool();
fm = javadoc.getStandardFileManager(null, null, null);
try {
- fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
+ fm.setLocation(StandardLocation.CLASS_OUTPUT, List.of(new File(".")));
fm.setLocation(StandardLocation.CLASS_PATH, Collections.<File>emptyList());
- files = Arrays.asList(new TestJFO("Test.java", code));
+ files = List.of(new TestJFO("Test.java", code));
- test(Collections.<String>emptyList(),
+ test(List.of(htmlVersion),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR9A, Message.DL_WRN12A));
- test(Arrays.asList(rawDiags),
+ test(List.of(htmlVersion, rawDiags),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR9, Message.DL_WRN12));
-// test(Arrays.asList("-Xdoclint:none"),
+// test(List.of("-Xdoclint:none"),
// Main.Result.OK,
// EnumSet.of(Message.JD_WRN10, Message.JD_WRN13));
- test(Arrays.asList(rawDiags, "-Xdoclint"),
+ test(List.of(htmlVersion, rawDiags, "-Xdoclint"),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR9, Message.DL_WRN12));
- test(Arrays.asList(rawDiags, "-Xdoclint:all/public"),
+ test(List.of(htmlVersion, rawDiags, "-Xdoclint:all/public"),
Main.Result.ERROR,
EnumSet.of(Message.OPT_BADQUAL));
- test(Arrays.asList(rawDiags, "-Xdoclint:all", "-public"),
+ test(List.of(htmlVersion, rawDiags, "-Xdoclint:all", "-public"),
Main.Result.OK,
EnumSet.of(Message.DL_WRN12));
- test(Arrays.asList(rawDiags, "-Xdoclint:syntax"),
+ test(List.of(htmlVersion, rawDiags, "-Xdoclint:syntax"),
Main.Result.OK,
EnumSet.of(Message.DL_WRN12));
- test(Arrays.asList(rawDiags, "-private"),
+ test(List.of(htmlVersion, rawDiags, "-private"),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR6, Message.DL_ERR9, Message.DL_WRN12));
- test(Arrays.asList(rawDiags, "-Xdoclint:syntax", "-private"),
+ test(List.of(htmlVersion, rawDiags, "-Xdoclint:syntax", "-private"),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR6, Message.DL_WRN12));
- test(Arrays.asList(rawDiags, "-Xdoclint:reference"),
+ test(List.of(htmlVersion, rawDiags, "-Xdoclint:reference"),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR9));
- test(Arrays.asList(rawDiags, "-Xdoclint:badarg"),
+ test(List.of(htmlVersion, rawDiags, "-Xdoclint:badarg"),
Main.Result.ERROR,
EnumSet.of(Message.OPT_BADARG));
- files = Arrays.asList(new TestJFO("p1/P1Test.java", p1Code),
+ files = List.of(new TestJFO("p1/P1Test.java", p1Code),
new TestJFO("p2/P2Test.java", p2Code));
- test(Arrays.asList(rawDiags),
+ test(List.of(htmlVersion, rawDiags),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR_P1TEST, Message.DL_ERR_P2TEST));
- test(Arrays.asList(rawDiags, "-Xdoclint/package:p1"),
+ test(List.of(htmlVersion, rawDiags, "-Xdoclint/package:p1"),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR_P1TEST));
- test(Arrays.asList(rawDiags, "-Xdoclint/package:*p"),
+ test(List.of(htmlVersion, rawDiags, "-Xdoclint/package:*p"),
Main.Result.ERROR,
EnumSet.of(Message.OPT_BADPACKAGEARG));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/T8187805/BogusRTTAForUnusedVarTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test 8187805
+ * @summary bogus RuntimeVisibleTypeAnnotations for unused local in a block
+ * @modules jdk.jdeps/com.sun.tools.classfile
+ * jdk.compiler/com.sun.tools.javac.util
+ * @run main BogusRTTAForUnusedVarTest
+ */
+
+import com.sun.tools.classfile.*;
+
+import java.io.File;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
+import com.sun.tools.classfile.TypeAnnotation;
+import com.sun.tools.classfile.TypeAnnotation.Position;
+import com.sun.tools.javac.util.Assert;
+
+public class BogusRTTAForUnusedVarTest {
+
+ class Foo {
+ void something() {
+ {
+ @MyAnno Object o = new Object();
+ }
+ }
+ }
+
+ @Target(ElementType.TYPE_USE)
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface MyAnno {}
+
+ public static void main(String args[]) throws Throwable {
+ new BogusRTTAForUnusedVarTest().run();
+ }
+
+ void run() throws Throwable {
+ checkRTTA();
+ }
+
+ void checkRTTA() throws Throwable {
+ File testClasses = new File(System.getProperty("test.classes"));
+ File file = new File(testClasses,
+ BogusRTTAForUnusedVarTest.class.getName() + "$Foo.class");
+ ClassFile classFile = ClassFile.read(file);
+ for (Method m : classFile.methods) {
+ if (m.getName(classFile.constant_pool).equals("something")) {
+ for (Attribute a : m.attributes) {
+ if (a.getName(classFile.constant_pool).equals("Code")) {
+ Code_attribute code = (Code_attribute)a;
+ for (Attribute codeAttrs : code.attributes) {
+ if (codeAttrs.getName(classFile.constant_pool).equals("RuntimeVisibleTypeAnnotations")) {
+ throw new AssertionError("no RuntimeVisibleTypeAnnotations attribute should have been generated in this case");
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
--- a/test/langtools/tools/javac/T8192885/AddGotoAfterForLoopToLNTTest.java Mon Jan 08 21:55:55 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8192885
- * @summary Compiler in JDK 10-ea+33 misses to include entry in LineNumberTable for goto instruction of foreach loop
- * @library /tools/lib
- * @modules jdk.jdeps/com.sun.tools.classfile
- * jdk.compiler/com.sun.tools.javac.api
- * jdk.compiler/com.sun.tools.javac.main
- * jdk.compiler/com.sun.tools.javac.util
- * jdk.jdeps/com.sun.tools.javap
- * @build toolbox.ToolBox toolbox.JavacTask
- * @run main AddGotoAfterForLoopToLNTTest
- */
-
-import java.io.File;
-import java.nio.file.Paths;
-
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.LineNumberTable_attribute;
-import com.sun.tools.classfile.Method;
-import com.sun.tools.javac.util.Assert;
-
-import toolbox.JavacTask;
-import toolbox.ToolBox;
-
-public class AddGotoAfterForLoopToLNTTest {
-
- static final String testSource =
- /* 01 */ "class GotoAtEnhancedForTest {\n" +
- /* 02 */ " void lookForThisMethod() {\n" +
- /* 03 */ " for (Object o : java.util.Collections.emptyList()) {\n" +
- /* 04 */ " }\n" +
- /* 05 */ " }\n" +
- /* 06 */ "}";
-
- static final int[][] expectedLNT = {
- // {line-number, start-pc},
- {3, 0},
- {4, 25},
- {3, 28},
- {5, 30},
- };
-
- static final String methodToLookFor = "lookForThisMethod";
-
- public static void main(String[] args) throws Exception {
- new AddGotoAfterForLoopToLNTTest().run();
- }
-
- ToolBox tb = new ToolBox();
-
- void run() throws Exception {
- compileTestClass();
- checkClassFile(new File(Paths.get(System.getProperty("user.dir"),
- "GotoAtEnhancedForTest.class").toUri()), methodToLookFor);
- }
-
- void compileTestClass() throws Exception {
- new JavacTask(tb)
- .sources(testSource)
- .run();
- }
-
- void checkClassFile(final File cfile, String methodToFind) throws Exception {
- ClassFile classFile = ClassFile.read(cfile);
- boolean methodFound = false;
- for (Method method : classFile.methods) {
- if (method.getName(classFile.constant_pool).equals(methodToFind)) {
- methodFound = true;
- Code_attribute code = (Code_attribute) method.attributes.get("Code");
- LineNumberTable_attribute lnt =
- (LineNumberTable_attribute) code.attributes.get("LineNumberTable");
- Assert.check(lnt.line_number_table_length == expectedLNT.length,
- "The LineNumberTable found has a length different to the expected one");
- int i = 0;
- for (LineNumberTable_attribute.Entry entry: lnt.line_number_table) {
- Assert.check(entry.line_number == expectedLNT[i][0] &&
- entry.start_pc == expectedLNT[i][1],
- "LNT entry at pos " + i + " differ from expected." +
- "Found " + entry.line_number + ":" + entry.start_pc +
- ". Expected " + expectedLNT[i][0] + ":" + expectedLNT[i][1]);
- i++;
- }
- }
- }
- Assert.check(methodFound, "The seek method was not found");
- }
-
- void error(String msg) {
- throw new AssertionError(msg);
- }
-}
--- a/test/langtools/tools/javac/flow/tests/TestCaseForEach.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/langtools/tools/javac/flow/tests/TestCaseForEach.java Fri Jan 12 15:05:35 2018 -0800
@@ -3,7 +3,7 @@
public class TestCaseForEach {
@AliveRange(varName="o", bytecodeStart=25, bytecodeLength=11)
- @AliveRange(varName="o", bytecodeStart=41, bytecodeLength=1)
+ @AliveRange(varName="o", bytecodeStart=39, bytecodeLength=1)
void m(String[] args) {
Object o;
for (String s : args) {
--- a/test/langtools/tools/javadoc/6964914/TestStdDoclet.java Mon Jan 08 21:55:55 2018 -0800
+++ b/test/langtools/tools/javadoc/6964914/TestStdDoclet.java Fri Jan 12 15:05:35 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -57,6 +57,7 @@
cmdArgs.add(javadoc.getPath());
cmdArgs.addAll(Arrays.asList(
"-classpath", ".", // insulates us from ambient classpath
+ "-html4",
"-Xdoclint:none",
"-package",
new File(testSrc, thisClassName + ".java").getPath()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javadoc/AddOpensTest.java Fri Jan 12 15:05:35 2018 -0800
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8181878
+ * @summary javadoc should support/ignore --add-opens
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * @modules jdk.compiler/com.sun.tools.javac.main
+ * @modules jdk.javadoc/jdk.javadoc.internal.api
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @library /tools/lib /tools/javadoc/lib
+ * @build toolbox.JavacTask toolbox.JavadocTask toolbox.TestRunner toolbox.ToolBox ToyDoclet
+ * @run main AddOpensTest
+ */
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import toolbox.JavadocTask;
+import toolbox.Task;
+import toolbox.TestRunner;
+import toolbox.ToolBox;
+
+public class AddOpensTest extends TestRunner {
+ public static void main(String... args) throws Exception {
+ AddOpensTest t = new AddOpensTest();
+ t.runTests();
+ }
+
+ private final ToolBox tb = new ToolBox();
+ private final Path src = Paths.get("src");
+ private final Path api = Paths.get("api");
+
+ AddOpensTest() throws Exception {
+ super(System.err);
+ init();
+ }
+
+ void init() throws IOException {
+ tb.writeJavaFiles(src, "public class C { }");
+ }
+
+ @Test
+ public void testEncoding() {
+ Task.Result result = new JavadocTask(tb, Task.Mode.EXEC)
+ .options("-docletpath", System.getProperty("test.class.path"),
+ "-doclet", "ToyDoclet",
+ "--add-opens", "some.module")
+ .files(src.resolve("C.java"))
+ .run(Task.Expect.SUCCESS)
+ .writeAll();
+ }
+}
+