From b9d46eee2cf17e61d0510b76facd0acbb0f3d700 Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Wed, 10 Sep 2014 11:55:33 +0200 Subject: [PATCH 01/81] 8057799: Unnecessary NULL check in G1KeepAliveClosure Reviewed-by: tschatzl, stefank --- hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index b7bf1ffdb9c..706fb1970bd 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -5448,9 +5448,10 @@ public: void do_oop(narrowOop* p) { guarantee(false, "Not needed"); } void do_oop(oop* p) { oop obj = *p; + assert(obj != NULL, "the caller should have filtered out NULL values"); G1CollectedHeap::in_cset_state_t cset_state = _g1->in_cset_state(obj); - if (obj == NULL || cset_state == G1CollectedHeap::InNeither) { + if (cset_state == G1CollectedHeap::InNeither) { return; } if (cset_state == G1CollectedHeap::InCSet) { From a2d9ba3fd6712b2406d035de7614e8da86bac237 Mon Sep 17 00:00:00 2001 From: Mikael Gerdin Date: Tue, 26 Aug 2014 11:53:24 +0200 Subject: [PATCH 02/81] 8056039: Hotspot does not compile with clang 3.4 on Linux Reviewed-by: brutisso, sla --- hotspot/src/os/aix/vm/os_aix.cpp | 4 ---- hotspot/src/os/bsd/vm/os_bsd.cpp | 5 ----- hotspot/src/os/linux/vm/os_linux.cpp | 4 ---- hotspot/src/os/solaris/vm/os_solaris.cpp | 21 ------------------- .../share/vm/utilities/globalDefinitions.hpp | 3 +++ .../vm/utilities/globalDefinitions_gcc.hpp | 7 ++++--- .../globalDefinitions_sparcWorks.hpp | 8 ------- 7 files changed, 7 insertions(+), 45 deletions(-) diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp index 6d8c55bf541..387a679bc6d 100644 --- a/hotspot/src/os/aix/vm/os_aix.cpp +++ b/hotspot/src/os/aix/vm/os_aix.cpp @@ -4002,10 +4002,6 @@ bool os::check_heap(bool force) { return true; } -// int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) { -// return ::vsnprintf(buf, count, format, args); -// } - // Is a (classpath) directory empty? bool os::dir_is_empty(const char* path) { DIR *dir = NULL; diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp index 4f54ad94a6a..d0797359042 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.cpp +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp @@ -3797,11 +3797,6 @@ bool os::check_heap(bool force) { return true; } -ATTRIBUTE_PRINTF(3, 0) -int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) { - return ::vsnprintf(buf, count, format, args); -} - // Is a (classpath) directory empty? bool os::dir_is_empty(const char* path) { DIR *dir = NULL; diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 586f46a26b3..61aa11d1790 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -5007,10 +5007,6 @@ bool os::check_heap(bool force) { return true; } -int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) { - return ::vsnprintf(buf, count, format, args); -} - // Is a (classpath) directory empty? bool os::dir_is_empty(const char* path) { DIR *dir = NULL; diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 21cb27a3c0e..0a61f78370e 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -4729,27 +4729,6 @@ void os::make_polling_page_readable(void) { bool os::check_heap(bool force) { return true; } -typedef int (*vsnprintf_t)(char* buf, size_t count, const char* fmt, va_list argptr); -static vsnprintf_t sol_vsnprintf = NULL; - -int local_vsnprintf(char* buf, size_t count, const char* fmt, va_list argptr) { - if (!sol_vsnprintf) { - //search for the named symbol in the objects that were loaded after libjvm - void* where = RTLD_NEXT; - if ((sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "__vsnprintf"))) == NULL) - sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "vsnprintf")); - if (!sol_vsnprintf){ - //search for the named symbol in the objects that were loaded before libjvm - where = RTLD_DEFAULT; - if ((sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "__vsnprintf"))) == NULL) - sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "vsnprintf")); - assert(sol_vsnprintf != NULL, "vsnprintf not found"); - } - } - return (*sol_vsnprintf)(buf, count, fmt, argptr); -} - - // Is a (classpath) directory empty? bool os::dir_is_empty(const char* path) { DIR *dir = NULL; diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 269853ee674..187ac4c2caa 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -66,6 +66,9 @@ #ifndef ATTRIBUTE_PRINTF #define ATTRIBUTE_PRINTF(fmt, vargs) #endif +#ifndef ATTRIBUTE_SCANF +#define ATTRIBUTE_SCANF(fmt, vargs) +#endif #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp index 576b0235af4..9a00b912048 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp @@ -271,15 +271,16 @@ inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); } #define PRAGMA_IMPLEMENTATION #pragma implementation #define VALUE_OBJ_CLASS_SPEC -#ifndef ATTRIBUTE_PRINTF // Diagnostic pragmas like the ones defined below in PRAGMA_FORMAT_NONLITERAL_IGNORED // were only introduced in GCC 4.2. Because we have no other possibility to ignore // these warnings for older versions of GCC, we simply don't decorate our printf-style // functions with __attribute__(format) in that case. #if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || (__GNUC__ > 4) +#ifndef ATTRIBUTE_PRINTF #define ATTRIBUTE_PRINTF(fmt,vargs) __attribute__((format(printf, fmt, vargs))) -#else -#define ATTRIBUTE_PRINTF(fmt,vargs) +#endif +#ifndef ATTRIBUTE_SCANF +#define ATTRIBUTE_SCANF(fmt,vargs) __attribute__((format(scanf, fmt, vargs))) #endif #endif diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp index b64bbf8da0f..352d2c709f7 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp @@ -265,14 +265,6 @@ inline int g_isfinite(jdouble f) { return finite(f); } inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); } - -// Misc -// NOTE: This one leads to an infinite recursion on Linux -#ifndef LINUX -int local_vsnprintf(char* buf, size_t count, const char* fmt, va_list argptr); -#define vsnprintf local_vsnprintf -#endif - // Portability macros #define PRAGMA_INTERFACE #define PRAGMA_IMPLEMENTATION From f494735340ae63bba754d49f5b5599b2148d9598 Mon Sep 17 00:00:00 2001 From: Andrey Zakharov Date: Thu, 11 Sep 2014 14:21:13 +0200 Subject: [PATCH 03/81] 8041946: CMM Testing: 8u40 an allocated humongous object at the end of the heap should not prevents shrinking the heap New test added Reviewed-by: jwilhelm, tschatzl --- .../gc/g1/TestShrinkDefragmentedHeap.java | 188 ++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java diff --git a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java new file mode 100644 index 00000000000..94eb690e97d --- /dev/null +++ b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2014, 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 TestShrinkDefragmentedHeap + * @bug 8038423 + * @summary Verify that heap shrinks after GC in the presence of fragmentation due to humongous objects + * 1. allocate small objects mixed with humongous ones + * "ssssHssssHssssHssssHssssHssssHssssH" + * 2. release all allocated object except the last humongous one + * "..................................H" + * 3. invoke gc and check that memory returned to the system (amount of committed memory got down) + * + * @library /testlibrary + */ +import java.lang.management.ManagementFactory; +import java.lang.management.MemoryUsage; +import java.util.ArrayList; +import java.util.List; +import sun.management.ManagementFactoryHelper; +import static com.oracle.java.testlibrary.Asserts.*; +import com.oracle.java.testlibrary.ProcessTools; +import com.oracle.java.testlibrary.OutputAnalyzer; + +public class TestShrinkDefragmentedHeap { + // Since we store all the small objects, they become old and old regions are also allocated at the bottom of the heap + // together with humongous regions. So if there are a lot of old regions in the lower part of the heap, + // the humongous regions will be allocated in the upper part of the heap anyway. + // To avoid this the Eden needs to be big enough to fit all the small objects. + private static final int INITIAL_HEAP_SIZE = 200 * 1024 * 1024; + private static final int MINIMAL_YOUNG_SIZE = 190 * 1024 * 1024; + private static final int REGION_SIZE = 1 * 1024 * 1024; + + public static void main(String[] args) throws Exception, Throwable { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:InitialHeapSize=" + INITIAL_HEAP_SIZE, + "-Xmn" + MINIMAL_YOUNG_SIZE, + "-XX:MinHeapFreeRatio=10", + "-XX:MaxHeapFreeRatio=11", + "-XX:+UseG1GC", + "-XX:G1HeapRegionSize=" + REGION_SIZE, + "-verbose:gc", + GCTest.class.getName() + ); + + OutputAnalyzer output = ProcessTools.executeProcess(pb); + output.shouldHaveExitValue(0); + } + + static class GCTest { + + private static final String MIN_FREE_RATIO_FLAG_NAME = "MinHeapFreeRatio"; + private static final String MAX_FREE_RATIO_FLAG_NAME = "MaxHeapFreeRatio"; + private static final String NEW_SIZE_FLAG_NAME = "NewSize"; + + private static final ArrayList> garbage = new ArrayList<>(); + + private static final int SMALL_OBJS_SIZE = 10 * 1024; // 10kB + private static final int SMALL_OBJS_COUNT = MINIMAL_YOUNG_SIZE / (SMALL_OBJS_SIZE-1); + private static final int ALLOCATE_COUNT = 3; + // try to put all humongous object into gap between min young size and initial heap size + // to avoid implicit GCs + private static final int HUMONG_OBJS_SIZE = (int) Math.max( + (INITIAL_HEAP_SIZE - MINIMAL_YOUNG_SIZE) / ALLOCATE_COUNT / 4, + REGION_SIZE * 1.1 + ); + + private static final long initialHeapSize = getHeapMemoryUsage().getUsed(); + + public static void main(String[] args) throws InterruptedException { + new GCTest().test(); + } + + private void test() throws InterruptedException { + MemoryUsagePrinter.printMemoryUsage("init"); + + allocate(); + System.gc(); + MemoryUsage muFull = getHeapMemoryUsage(); + MemoryUsagePrinter.printMemoryUsage("allocated"); + + free(); + //Thread.sleep(1000); // sleep before measures due lags in JMX + MemoryUsage muFree = getHeapMemoryUsage(); + MemoryUsagePrinter.printMemoryUsage("free"); + + assertLessThan(muFree.getCommitted(), muFull.getCommitted(), prepareMessageCommittedIsNotLess() ); + } + + private void allocate() { + System.out.format("Will allocate objects of small size = %s and humongous size = %s", + MemoryUsagePrinter.humanReadableByteCount(SMALL_OBJS_SIZE, false), + MemoryUsagePrinter.humanReadableByteCount(HUMONG_OBJS_SIZE, false) + ); + + for (int i = 0; i < ALLOCATE_COUNT; i++) { + ArrayList stuff = new ArrayList<>(); + allocateList(stuff, SMALL_OBJS_COUNT / ALLOCATE_COUNT, SMALL_OBJS_SIZE); + garbage.add(stuff); + + ArrayList humongousStuff = new ArrayList<>(); + allocateList(humongousStuff, 4, HUMONG_OBJS_SIZE); + garbage.add(humongousStuff); + } + } + + private void free() { + // do not free last one list + garbage.subList(0, garbage.size() - 1).clear(); + + // do not free last one element from last list + ArrayList stuff = garbage.get(garbage.size() - 1); + if (stuff.size() > 1) { + stuff.subList(0, stuff.size() - 1).clear(); + } + System.gc(); + } + + private String prepareMessageCommittedIsNotLess() { + return String.format( + "committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n" + + "%s = %s%n%s = %s", + MIN_FREE_RATIO_FLAG_NAME, + ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(), + MAX_FREE_RATIO_FLAG_NAME, + ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue() + ); + } + + private static void allocateList(List garbage, int count, int size) { + for (int i = 0; i < count; i++) { + garbage.add(new byte[size]); + } + } + } + + static MemoryUsage getHeapMemoryUsage() { + return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage(); + } + + /** + * Prints memory usage to standard output + */ + static class MemoryUsagePrinter { + + public static String humanReadableByteCount(long bytes, boolean si) { + int unit = si ? 1000 : 1024; + if (bytes < unit) { + return bytes + " B"; + } + int exp = (int) (Math.log(bytes) / Math.log(unit)); + String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i"); + return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre); + } + + public static void printMemoryUsage(String label) { + MemoryUsage memusage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage(); + float freeratio = 1f - (float) memusage.getUsed() / memusage.getCommitted(); + System.out.format("[%-24s] init: %-7s, used: %-7s, comm: %-7s, freeRatio ~= %.1f%%%n", + label, + humanReadableByteCount(memusage.getInit(), false), + humanReadableByteCount(memusage.getUsed(), false), + humanReadableByteCount(memusage.getCommitted(), false), + freeratio * 100 + ); + } + } +} From debb101f7b751c9bbcb160c1fecc5910f84de5b7 Mon Sep 17 00:00:00 2001 From: Andrey Zakharov Date: Thu, 11 Sep 2014 14:21:24 +0200 Subject: [PATCH 04/81] 8056237: [TESTBUG] gc/g1/TestHumongousShrinkHeap.java fails due to OOM Added respect for available memory. Renamed function names Reviewed-by: jwilhelm, tschatzl --- .../test/gc/g1/TestHumongousShrinkHeap.java | 47 +++++++++++-------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java index 5a15f9f11d8..97d60546b25 100644 --- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java +++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java @@ -26,7 +26,7 @@ * @bug 8036025 8056043 * @summary Verify that heap shrinks after GC in the presence of fragmentation due to humongous objects * @library /testlibrary - * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc TestHumongousShrinkHeap + * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc TestHumongousShrinkHeap */ import java.lang.management.ManagementFactory; @@ -41,12 +41,24 @@ public class TestHumongousShrinkHeap { public static final String MIN_FREE_RATIO_FLAG_NAME = "MinHeapFreeRatio"; public static final String MAX_FREE_RATIO_FLAG_NAME = "MaxHeapFreeRatio"; - private static final ArrayList> garbage = new ArrayList<>(); - private static final int PAGE_SIZE = 1024 * 1024; // 1M - private static final int PAGES_NUM = 5; + private static final List> garbage = new ArrayList(); + private static final int REGION_SIZE = 1024 * 1024; // 1M + private static final int LISTS_COUNT = 10; + private static final int HUMON_SIZE = Math.round(.9f * REGION_SIZE); + private static final long AVAILABLE_MEMORY + = Runtime.getRuntime().freeMemory(); + private static final int HUMON_COUNT + = (int) ((AVAILABLE_MEMORY / HUMON_SIZE) + / LISTS_COUNT); public static void main(String[] args) { + System.out.format("Running with %s max heap size. " + + "Will allocate humongous object of %s size %d times.%n", + MemoryUsagePrinter.humanReadableByteCount(AVAILABLE_MEMORY, false), + MemoryUsagePrinter.humanReadableByteCount(HUMON_SIZE, false), + HUMON_COUNT + ); new TestHumongousShrinkHeap().test(); } @@ -54,8 +66,8 @@ public class TestHumongousShrinkHeap { System.gc(); MemoryUsagePrinter.printMemoryUsage("init"); - eat(); - MemoryUsagePrinter.printMemoryUsage("eaten"); + allocate(); + MemoryUsagePrinter.printMemoryUsage("allocated"); MemoryUsage muFull = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage(); free(); @@ -72,15 +84,12 @@ public class TestHumongousShrinkHeap { )); } - private void eat() { - int HumongousObjectSize = Math.round(.9f * PAGE_SIZE); - System.out.println("Will allocate objects of size=" + - MemoryUsagePrinter.humanReadableByteCount(HumongousObjectSize, true)); + private void allocate() { - for (int i = 0; i < PAGES_NUM; i++) { - ArrayList stuff = new ArrayList<>(); - eatList(stuff, 100, HumongousObjectSize); - MemoryUsagePrinter.printMemoryUsage("eat #" + i); + for (int i = 0; i < LISTS_COUNT; i++) { + List stuff = new ArrayList(); + allocateList(stuff, HUMON_COUNT, HUMON_SIZE); + MemoryUsagePrinter.printMemoryUsage("allocate #" + (i+1)); garbage.add(stuff); } } @@ -90,12 +99,12 @@ public class TestHumongousShrinkHeap { garbage.subList(0, garbage.size() - 1).clear(); // do not free last one element from last list - ArrayList stuff = garbage.get(garbage.size() - 1); + List stuff = garbage.get(garbage.size() - 1); stuff.subList(0, stuff.size() - 1).clear(); System.gc(); } - private static void eatList(List garbage, int count, int size) { + private static void allocateList(List garbage, int count, int size) { for (int i = 0; i < count; i++) { garbage.add(new byte[size]); } @@ -122,9 +131,9 @@ class MemoryUsagePrinter { float freeratio = 1f - (float) memusage.getUsed() / memusage.getCommitted(); System.out.format("[%-24s] init: %-7s, used: %-7s, comm: %-7s, freeRatio ~= %.1f%%%n", label, - humanReadableByteCount(memusage.getInit(), true), - humanReadableByteCount(memusage.getUsed(), true), - humanReadableByteCount(memusage.getCommitted(), true), + humanReadableByteCount(memusage.getInit(), false), + humanReadableByteCount(memusage.getUsed(), false), + humanReadableByteCount(memusage.getCommitted(), false), freeratio * 100 ); } From 1d4a5e9412ccfd2fff9167772a6c661ea8c91d09 Mon Sep 17 00:00:00 2001 From: Erik Helin Date: Mon, 15 Sep 2014 10:57:22 +0200 Subject: [PATCH 05/81] 8049536: os::commit_memory on Solaris uses aligment_hint as page size Reviewed-by: stefank, tschatzl --- hotspot/src/os/solaris/vm/os_solaris.cpp | 56 +++++++++++------ hotspot/src/os/solaris/vm/os_solaris.hpp | 2 + .../LargePages/TestLargePageSizeInBytes.java | 61 +++++++++++++++++++ 3 files changed, 99 insertions(+), 20 deletions(-) create mode 100644 hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 0a61f78370e..9c94232e3e1 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -2525,29 +2525,30 @@ void os::pd_commit_memory_or_exit(char* addr, size_t bytes, bool exec, } } +size_t os::Solaris::page_size_for_alignment(size_t alignment) { + assert(is_size_aligned(alignment, (size_t) vm_page_size()), + err_msg(SIZE_FORMAT " is not aligned to " SIZE_FORMAT, + alignment, (size_t) vm_page_size())); + + for (int i = 0; _page_sizes[i] != 0; i++) { + if (is_size_aligned(alignment, _page_sizes[i])) { + return _page_sizes[i]; + } + } + + return (size_t) vm_page_size(); +} + int os::Solaris::commit_memory_impl(char* addr, size_t bytes, size_t alignment_hint, bool exec) { int err = Solaris::commit_memory_impl(addr, bytes, exec); - if (err == 0) { - if (UseLargePages && (alignment_hint > (size_t)vm_page_size())) { - // If the large page size has been set and the VM - // is using large pages, use the large page size - // if it is smaller than the alignment hint. This is - // a case where the VM wants to use a larger alignment size - // for its own reasons but still want to use large pages - // (which is what matters to setting the mpss range. - size_t page_size = 0; - if (large_page_size() < alignment_hint) { - assert(UseLargePages, "Expected to be here for large page use only"); - page_size = large_page_size(); - } else { - // If the alignment hint is less than the large page - // size, the VM wants a particular alignment (thus the hint) - // for internal reasons. Try to set the mpss range using - // the alignment_hint. - page_size = alignment_hint; - } - // Since this is a hint, ignore any failures. + if (err == 0 && UseLargePages && alignment_hint > 0) { + assert(is_size_aligned(bytes, alignment_hint), + err_msg(SIZE_FORMAT " is not aligned to " SIZE_FORMAT, bytes, alignment_hint)); + + // The syscall memcntl requires an exact page size (see man memcntl for details). + size_t page_size = page_size_for_alignment(alignment_hint); + if (page_size > (size_t) vm_page_size()) { (void)Solaris::setup_large_pages(addr, bytes, page_size); } } @@ -3080,7 +3081,22 @@ void os::large_page_init() { } } +bool os::Solaris::is_valid_page_size(size_t bytes) { + for (int i = 0; _page_sizes[i] != 0; i++) { + if (_page_sizes[i] == bytes) { + return true; + } + } + return false; +} + bool os::Solaris::setup_large_pages(caddr_t start, size_t bytes, size_t align) { + assert(is_valid_page_size(align), err_msg(SIZE_FORMAT " is not a valid page size", align)); + assert(is_ptr_aligned((void*) start, align), + err_msg(PTR_FORMAT " is not aligned to " SIZE_FORMAT, p2i((void*) start), align)); + assert(is_size_aligned(bytes, align), + err_msg(SIZE_FORMAT " is not aligned to " SIZE_FORMAT, bytes, align)); + // Signal to OS that we want large pages for addresses // from addr, addr + bytes struct memcntl_mha mpss_struct; diff --git a/hotspot/src/os/solaris/vm/os_solaris.hpp b/hotspot/src/os/solaris/vm/os_solaris.hpp index ab0ab85f438..58589eac584 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.hpp +++ b/hotspot/src/os/solaris/vm/os_solaris.hpp @@ -97,6 +97,8 @@ class Solaris { static meminfo_func_t _meminfo; // Large Page Support + static bool is_valid_page_size(size_t bytes); + static size_t page_size_for_alignment(size_t alignment); static bool setup_large_pages(caddr_t start, size_t bytes, size_t align); static void init_thread_fpu_state(void); diff --git a/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java b/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java new file mode 100644 index 00000000000..0f90d5fb1ab --- /dev/null +++ b/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2014, 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 TestLargePageSizeInBytes + * @summary Tests that the flag -XX:LargePageSizeInBytes does not cause warnings on Solaris + * @bug 8049536 + * @library /testlibrary + * @run driver TestLargePageSizeInBytes + */ + +import com.oracle.java.testlibrary.OutputAnalyzer; +import com.oracle.java.testlibrary.Platform; +import com.oracle.java.testlibrary.ProcessTools; + +public class TestLargePageSizeInBytes { + private static long M = 1024L * 1024L; + private static long G = 1024L * M; + + public static void main(String[] args) throws Exception { + if (!Platform.isSolaris()) { + // We only use the syscall mencntl on Solaris + return; + } + + testLargePageSizeInBytes(4 * M); + testLargePageSizeInBytes(256 * M); + testLargePageSizeInBytes(512 * M); + testLargePageSizeInBytes(2 * G); + } + + private static void testLargePageSizeInBytes(long size) throws Exception { + ProcessBuilder pb = + ProcessTools.createJavaProcessBuilder("-XX:+UseLargePages", + "-XX:LargePageSizeInBytes=" + size, + "-version"); + + OutputAnalyzer out = new OutputAnalyzer(pb.start()); + out.shouldNotContain("Attempt to use MPSS failed."); + out.shouldHaveExitValue(0); + } +} From a2984b6c881d0018cef11f2cbb8f552288e0f1a5 Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Mon, 15 Sep 2014 12:19:31 +0200 Subject: [PATCH 06/81] 8057768: Make heap region region type in G1 HeapRegion explicit Reviewed-by: brutisso, tschatzl --- .../gc_implementation/g1/concurrentMark.cpp | 15 +- .../gc_implementation/g1/g1CollectedHeap.cpp | 85 +++++------ .../g1/g1CollectorPolicy.cpp | 12 +- .../g1/g1CollectorPolicy.hpp | 4 +- .../gc_implementation/g1/g1HotCardCache.cpp | 2 - .../gc_implementation/g1/g1RemSetSummary.cpp | 10 +- .../g1/g1SATBCardTableModRefBS.hpp | 5 - .../vm/gc_implementation/g1/heapRegion.cpp | 32 +---- .../vm/gc_implementation/g1/heapRegion.hpp | 63 ++++---- .../vm/gc_implementation/g1/heapRegionSet.cpp | 10 +- .../vm/gc_implementation/g1/heapRegionSet.hpp | 12 +- .../gc_implementation/g1/heapRegionType.cpp | 69 +++++++++ .../gc_implementation/g1/heapRegionType.hpp | 134 ++++++++++++++++++ 13 files changed, 309 insertions(+), 144 deletions(-) create mode 100644 hotspot/src/share/vm/gc_implementation/g1/heapRegionType.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/heapRegionType.hpp diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index e02b4e7a320..f22bc262d2a 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -4737,7 +4737,7 @@ void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes, } bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) { - const char* type = ""; + const char* type = r->get_type_str(); HeapWord* bottom = r->bottom(); HeapWord* end = r->end(); size_t capacity_bytes = r->capacity(); @@ -4748,15 +4748,7 @@ bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) { size_t remset_bytes = r->rem_set()->mem_size(); size_t strong_code_roots_bytes = r->rem_set()->strong_code_roots_mem_size(); - if (r->used() == 0) { - type = "FREE"; - } else if (r->is_survivor()) { - type = "SURV"; - } else if (r->is_young()) { - type = "EDEN"; - } else if (r->startsHumongous()) { - type = "HUMS"; - + if (r->startsHumongous()) { assert(_hum_used_bytes == 0 && _hum_capacity_bytes == 0 && _hum_prev_live_bytes == 0 && _hum_next_live_bytes == 0, "they should have been zeroed after the last time we used them"); @@ -4769,12 +4761,9 @@ bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) { &prev_live_bytes, &next_live_bytes); end = bottom + HeapRegion::GrainWords; } else if (r->continuesHumongous()) { - type = "HUMC"; get_hum_bytes(&used_bytes, &capacity_bytes, &prev_live_bytes, &next_live_bytes); assert(end == bottom + HeapRegion::GrainWords, "invariant"); - } else { - type = "OLD"; } _total_used_bytes += used_bytes; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 706fb1970bd..021dbe406e0 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -211,7 +211,10 @@ void YoungList::empty_list(HeapRegion* list) { HeapRegion* next = list->get_next_young_region(); list->set_next_young_region(NULL); list->uninstall_surv_rate_group(); - list->set_not_young(); + // This is called before a Full GC and all the non-empty / + // non-humongous regions at the end of the Full GC will end up as + // old anyway. + list->set_old(); list = next; } } @@ -370,7 +373,7 @@ void YoungList::print() { if (curr == NULL) gclog_or_tty->print_cr(" empty"); while (curr != NULL) { - gclog_or_tty->print_cr(" "HR_FORMAT", P: "PTR_FORMAT "N: "PTR_FORMAT", age: %4d", + gclog_or_tty->print_cr(" "HR_FORMAT", P: "PTR_FORMAT ", N: "PTR_FORMAT", age: %4d", HR_FORMAT_PARAMS(curr), curr->prev_top_at_mark_start(), curr->next_top_at_mark_start(), @@ -802,6 +805,7 @@ HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) { #ifdef ASSERT for (uint i = first; i < first + obj_regions; ++i) { HeapRegion* hr = region_at(i); + assert(hr->is_free(), "sanity"); assert(hr->is_empty(), "sanity"); assert(is_on_master_free_list(hr), "sanity"); } @@ -1225,21 +1229,21 @@ private: public: bool doHeapRegion(HeapRegion* hr) { assert(!hr->is_young(), "not expecting to find young regions"); - // We only generate output for non-empty regions. - if (!hr->is_empty()) { - if (!hr->isHumongous()) { - _hr_printer->post_compaction(hr, G1HRPrinter::Old); - } else if (hr->startsHumongous()) { - if (hr->region_num() == 1) { - // single humongous region - _hr_printer->post_compaction(hr, G1HRPrinter::SingleHumongous); - } else { - _hr_printer->post_compaction(hr, G1HRPrinter::StartsHumongous); - } + if (hr->is_free()) { + // We only generate output for non-empty regions. + } else if (hr->startsHumongous()) { + if (hr->region_num() == 1) { + // single humongous region + _hr_printer->post_compaction(hr, G1HRPrinter::SingleHumongous); } else { - assert(hr->continuesHumongous(), "only way to get here"); - _hr_printer->post_compaction(hr, G1HRPrinter::ContinuesHumongous); + _hr_printer->post_compaction(hr, G1HRPrinter::StartsHumongous); } + } else if (hr->continuesHumongous()) { + _hr_printer->post_compaction(hr, G1HRPrinter::ContinuesHumongous); + } else if (hr->is_old()) { + _hr_printer->post_compaction(hr, G1HRPrinter::Old); + } else { + ShouldNotReachHere(); } return false; } @@ -2121,8 +2125,8 @@ jint G1CollectedHeap::initialize() { // We'll re-use the same region whether the alloc region will // require BOT updates or not and, if it doesn't, then a non-young // region will complain that it cannot support allocations without - // BOT updates. So we'll tag the dummy region as young to avoid that. - dummy_region->set_young(); + // BOT updates. So we'll tag the dummy region as eden to avoid that. + dummy_region->set_eden(); // Make sure it's full. dummy_region->set_top(dummy_region->end()); G1AllocRegion::setup(this, dummy_region); @@ -4031,14 +4035,6 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { if (_hr_printer.is_active()) { HeapRegion* hr = g1_policy()->collection_set(); while (hr != NULL) { - G1HRPrinter::RegionType type; - if (!hr->is_young()) { - type = G1HRPrinter::Old; - } else if (hr->is_survivor()) { - type = G1HRPrinter::Survivor; - } else { - type = G1HRPrinter::Eden; - } _hr_printer.cset(hr); hr = hr->next_in_collection_set(); } @@ -6063,7 +6059,7 @@ void G1CollectedHeap::free_region(HeapRegion* hr, FreeRegionList* free_list, bool par, bool locked) { - assert(!hr->isHumongous(), "this is only for non-humongous regions"); + assert(!hr->is_free(), "the region should not be free"); assert(!hr->is_empty(), "the region should not be empty"); assert(_hrm.is_available(hr->hrm_index()), "region should be committed"); assert(free_list != NULL, "pre-condition"); @@ -6093,14 +6089,14 @@ void G1CollectedHeap::free_humongous_region(HeapRegion* hr, // We need to read this before we make the region non-humongous, // otherwise the information will be gone. uint last_index = hr->last_hc_index(); - hr->set_notHumongous(); + hr->clear_humongous(); free_region(hr, free_list, par); uint i = hr->hrm_index() + 1; while (i < last_index) { HeapRegion* curr_hr = region_at(i); assert(curr_hr->continuesHumongous(), "invariant"); - curr_hr->set_notHumongous(); + curr_hr->clear_humongous(); free_region(curr_hr, free_list, par); i += 1; } @@ -6408,9 +6404,9 @@ void G1CollectedHeap::free_collection_set(HeapRegion* cs_head, EvacuationInfo& e if (cur->is_young()) { cur->set_young_index_in_cset(-1); } - cur->set_not_young(); cur->set_evacuation_failed(false); // The region is now considered to be old. + cur->set_old(); _old_set.add(cur); evacuation_info.increment_collectionset_used_after(cur->used()); } @@ -6697,16 +6693,15 @@ public: TearDownRegionSetsClosure(HeapRegionSet* old_set) : _old_set(old_set) { } bool doHeapRegion(HeapRegion* r) { - if (r->is_empty()) { - // We ignore empty regions, we'll empty the free list afterwards - } else if (r->is_young()) { - // We ignore young regions, we'll empty the young list afterwards - } else if (r->isHumongous()) { - // We ignore humongous regions, we're not tearing down the - // humongous region set - } else { - // The rest should be old + if (r->is_old()) { _old_set->remove(r); + } else { + // We ignore free regions, we'll empty the free list afterwards. + // We ignore young regions, we'll empty the young list afterwards. + // We ignore humongous regions, we're not tearing down the + // humongous regions set. + assert(r->is_free() || r->is_young() || r->isHumongous(), + "it cannot be another type"); } return false; } @@ -6756,6 +6751,7 @@ public: if (r->is_empty()) { // Add free regions to the free list + r->set_free(); _hrm->insert_into_free_list(r); } else if (!_free_list_only) { assert(!r->is_young(), "we should not come across young regions"); @@ -6763,7 +6759,11 @@ public: if (r->isHumongous()) { // We ignore humongous regions, we left the humongous set unchanged } else { - // The rest should be old, add them to the old set + // Objects that were compacted would have ended up on regions + // that were previously old or free. + assert(r->is_free() || r->is_old(), "invariant"); + // We now consider them old, so register as such. + r->set_old(); _old_set->add(r); } _total_used += r->used(); @@ -6830,7 +6830,7 @@ HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size, void G1CollectedHeap::retire_mutator_alloc_region(HeapRegion* alloc_region, size_t allocated_bytes) { assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); - assert(alloc_region->is_young(), "all mutator alloc regions should be young"); + assert(alloc_region->is_eden(), "all mutator alloc regions should be eden"); g1_policy()->add_region_to_incremental_cset_lhs(alloc_region); _summary_bytes_used += allocated_bytes; @@ -6889,6 +6889,7 @@ HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size, _hr_printer.alloc(new_alloc_region, G1HRPrinter::Survivor); check_bitmaps("Survivor Region Allocation", new_alloc_region); } else { + new_alloc_region->set_old(); _hr_printer.alloc(new_alloc_region, G1HRPrinter::Old); check_bitmaps("Old Region Allocation", new_alloc_region); } @@ -7000,9 +7001,11 @@ public: } else if (hr->is_empty()) { assert(_hrm->is_free(hr), err_msg("Heap region %u is empty but not on the free list.", hr->hrm_index())); _free_count.increment(1u, hr->capacity()); - } else { + } else if (hr->is_old()) { assert(hr->containing_set() == _old_set, err_msg("Heap region %u is old but not in the old set.", hr->hrm_index())); _old_count.increment(1u, hr->capacity()); + } else { + ShouldNotReachHere(); } return false; } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index 931c4e3d25e..a2f33d12c38 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -1665,7 +1665,7 @@ G1CollectorPolicy::record_concurrent_mark_cleanup_end(int no_of_gc_threads) { // Add the heap region at the head of the non-incremental collection set void G1CollectorPolicy::add_old_region_to_cset(HeapRegion* hr) { assert(_inc_cset_build_state == Active, "Precondition"); - assert(!hr->is_young(), "non-incremental add of young region"); + assert(hr->is_old(), "the region should be old"); assert(!hr->in_collection_set(), "should not already be in the CSet"); hr->set_in_collection_set(true); @@ -1811,7 +1811,7 @@ void G1CollectorPolicy::add_region_to_incremental_cset_common(HeapRegion* hr) { // Add the region at the RHS of the incremental cset void G1CollectorPolicy::add_region_to_incremental_cset_rhs(HeapRegion* hr) { // We should only ever be appending survivors at the end of a pause - assert( hr->is_survivor(), "Logic"); + assert(hr->is_survivor(), "Logic"); // Do the 'common' stuff add_region_to_incremental_cset_common(hr); @@ -1829,7 +1829,7 @@ void G1CollectorPolicy::add_region_to_incremental_cset_rhs(HeapRegion* hr) { // Add the region to the LHS of the incremental cset void G1CollectorPolicy::add_region_to_incremental_cset_lhs(HeapRegion* hr) { // Survivors should be added to the RHS at the end of a pause - assert(!hr->is_survivor(), "Logic"); + assert(hr->is_eden(), "Logic"); // Do the 'common' stuff add_region_to_incremental_cset_common(hr); @@ -1989,7 +1989,11 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms, EvacuationInf HeapRegion* hr = young_list->first_survivor_region(); while (hr != NULL) { assert(hr->is_survivor(), "badly formed young list"); - hr->set_young(); + // There is a convention that all the young regions in the CSet + // are tagged as "eden", so we do this for the survivors here. We + // use the special set_eden_pre_gc() as it doesn't check that the + // region is free (which is not the case here). + hr->set_eden_pre_gc(); hr = hr->get_next_young_region(); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp index 4f141892e1f..4746e0aac8a 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @@ -299,13 +299,13 @@ public: // Accessors void set_region_eden(HeapRegion* hr, int young_index_in_cset) { - hr->set_young(); + hr->set_eden(); hr->install_surv_rate_group(_short_lived_surv_rate_group); hr->set_young_index_in_cset(young_index_in_cset); } void set_region_survivor(HeapRegion* hr, int young_index_in_cset) { - assert(hr->is_young() && hr->is_survivor(), "pre-condition"); + assert(hr->is_survivor(), "pre-condition"); hr->install_surv_rate_group(_survivor_surv_rate_group); hr->set_young_index_in_cset(young_index_in_cset); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp index 79655933da7..9a86e0f2e7f 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp @@ -27,7 +27,6 @@ #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" #include "gc_implementation/g1/g1HotCardCache.hpp" #include "gc_implementation/g1/g1RemSet.hpp" -#include "gc_implementation/g1/heapRegion.hpp" #include "runtime/atomic.inline.hpp" G1HotCardCache::G1HotCardCache(G1CollectedHeap *g1h): @@ -136,7 +135,6 @@ void G1HotCardCache::drain(uint worker_i, } void G1HotCardCache::reset_card_counts(HeapRegion* hr) { - assert(!hr->isHumongous(), "Should have been cleared"); _card_counts.clear_region(hr); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp index 69b1c1f8707..c55165bdc7b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp @@ -259,14 +259,16 @@ public: size_t code_root_elems = hrrs->strong_code_roots_list_length(); RegionTypeCounter* current = NULL; - if (r->is_young()) { + if (r->is_free()) { + current = &_free; + } else if (r->is_young()) { current = &_young; } else if (r->isHumongous()) { current = &_humonguous; - } else if (r->is_empty()) { - current = &_free; - } else { + } else if (r->is_old()) { current = &_old; + } else { + ShouldNotReachHere(); } current->add(rs_mem_sz, occupied_cards, code_root_mem_sz, code_root_elems); _all.add(rs_mem_sz, occupied_cards, code_root_mem_sz, code_root_elems); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp index f02c28c227b..80c402e9954 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp @@ -31,8 +31,6 @@ #include "oops/oop.inline.hpp" #include "utilities/macros.hpp" -#if INCLUDE_ALL_GCS - class DirtyCardQueueSet; class G1SATBCardTableLoggingModRefBS; @@ -180,7 +178,4 @@ class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS { void write_ref_array_work(MemRegion mr) { invalidate(mr); } }; - -#endif // INCLUDE_ALL_GCS - #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1SATBCARDTABLEMODREFBS_HPP diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index 0c7c3906cb3..26c83211d6b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -211,8 +211,6 @@ void HeapRegion::reset_after_compaction() { } void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) { - assert(_humongous_type == NotHumongous, - "we should have already filtered out humongous regions"); assert(_humongous_start_region == NULL, "we should have already filtered out humongous regions"); assert(_end == _orig_end, @@ -222,7 +220,7 @@ void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) { set_young_index_in_cset(-1); uninstall_surv_rate_group(); - set_young_type(NotYoung); + set_free(); reset_pre_dummy_top(); if (!par) { @@ -273,7 +271,7 @@ void HeapRegion::set_startsHumongous(HeapWord* new_top, HeapWord* new_end) { assert(top() == bottom(), "should be empty"); assert(bottom() <= new_top && new_top <= new_end, "pre-condition"); - _humongous_type = StartsHumongous; + _type.set_starts_humongous(); _humongous_start_region = this; set_end(new_end); @@ -287,11 +285,11 @@ void HeapRegion::set_continuesHumongous(HeapRegion* first_hr) { assert(top() == bottom(), "should be empty"); assert(first_hr->startsHumongous(), "pre-condition"); - _humongous_type = ContinuesHumongous; + _type.set_continues_humongous(); _humongous_start_region = first_hr; } -void HeapRegion::set_notHumongous() { +void HeapRegion::clear_humongous() { assert(isHumongous(), "pre-condition"); if (startsHumongous()) { @@ -307,7 +305,6 @@ void HeapRegion::set_notHumongous() { } assert(capacity() == HeapRegion::GrainBytes, "pre-condition"); - _humongous_type = NotHumongous; _humongous_start_region = NULL; } @@ -327,12 +324,12 @@ HeapRegion::HeapRegion(uint hrm_index, MemRegion mr) : G1OffsetTableContigSpace(sharedOffsetArray, mr), _hrm_index(hrm_index), - _humongous_type(NotHumongous), _humongous_start_region(NULL), + _humongous_start_region(NULL), _in_collection_set(false), _next_in_special_set(NULL), _orig_end(NULL), _claimed(InitialClaimValue), _evacuation_failed(false), _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0), - _young_type(NotYoung), _next_young_region(NULL), + _next_young_region(NULL), _next_dirty_cards_region(NULL), _next(NULL), _prev(NULL), #ifdef ASSERT _containing_set(NULL), @@ -686,26 +683,11 @@ void HeapRegion::verify_strong_code_roots(VerifyOption vo, bool* failures) const void HeapRegion::print() const { print_on(gclog_or_tty); } void HeapRegion::print_on(outputStream* st) const { - if (isHumongous()) { - if (startsHumongous()) - st->print(" HS"); - else - st->print(" HC"); - } else { - st->print(" "); - } + st->print(" %2s", get_short_type_str()); if (in_collection_set()) st->print(" CS"); else st->print(" "); - if (is_young()) - st->print(is_survivor() ? " SU" : " Y "); - else - st->print(" "); - if (is_empty()) - st->print(" F"); - else - st->print(" "); st->print(" TS %5d", _gc_time_stamp); st->print(" PTAMS "PTR_FORMAT" NTAMS "PTR_FORMAT, prev_top_at_mark_start(), next_top_at_mark_start()); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp index a311fd5e92d..0484fc3aa89 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp @@ -27,6 +27,7 @@ #include "gc_implementation/g1/g1BlockOffsetTable.hpp" #include "gc_implementation/g1/g1_specialized_oop_closures.hpp" +#include "gc_implementation/g1/heapRegionType.hpp" #include "gc_implementation/g1/survRateGroup.hpp" #include "gc_implementation/shared/ageTable.hpp" #include "gc_implementation/shared/spaceDecorator.hpp" @@ -34,8 +35,6 @@ #include "memory/watermark.hpp" #include "utilities/macros.hpp" -#if INCLUDE_ALL_GCS - // A HeapRegion is the smallest piece of a G1CollectedHeap that // can be collected independently. @@ -55,10 +54,7 @@ class nmethod; #define HR_FORMAT "%u:(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]" #define HR_FORMAT_PARAMS(_hr_) \ (_hr_)->hrm_index(), \ - (_hr_)->is_survivor() ? "S" : (_hr_)->is_young() ? "E" : \ - (_hr_)->startsHumongous() ? "HS" : \ - (_hr_)->continuesHumongous() ? "HC" : \ - !(_hr_)->is_empty() ? "O" : "F", \ + (_hr_)->get_short_type_str(), \ p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end()) // sentinel value for hrm_index @@ -215,12 +211,6 @@ class HeapRegion: public G1OffsetTableContigSpace { friend class VMStructs; private: - enum HumongousType { - NotHumongous = 0, - StartsHumongous, - ContinuesHumongous - }; - // The remembered set for this region. // (Might want to make this "inline" later, to avoid some alloc failure // issues.) @@ -232,7 +222,8 @@ class HeapRegion: public G1OffsetTableContigSpace { // The index of this region in the heap region sequence. uint _hrm_index; - HumongousType _humongous_type; + HeapRegionType _type; + // For a humongous region, region in which it starts. HeapRegion* _humongous_start_region; // For the start region of a humongous sequence, it's original end(). @@ -274,13 +265,6 @@ class HeapRegion: public G1OffsetTableContigSpace { // The calculated GC efficiency of the region. double _gc_efficiency; - enum YoungType { - NotYoung, // a region is not young - Young, // a region is young - Survivor // a region is young and it contains survivors - }; - - volatile YoungType _young_type; int _young_index_in_cset; SurvRateGroup* _surv_rate_group; int _age_index; @@ -305,12 +289,6 @@ class HeapRegion: public G1OffsetTableContigSpace { _next_top_at_mark_start = bot; } - void set_young_type(YoungType new_type) { - //assert(_young_type != new_type, "setting the same type" ); - // TODO: add more assertions here - _young_type = new_type; - } - // Cached attributes used in the collection set policy information // The RSet length that was added to the total value @@ -430,9 +408,21 @@ class HeapRegion: public G1OffsetTableContigSpace { _prev_marked_bytes = _next_marked_bytes = 0; } - bool isHumongous() const { return _humongous_type != NotHumongous; } - bool startsHumongous() const { return _humongous_type == StartsHumongous; } - bool continuesHumongous() const { return _humongous_type == ContinuesHumongous; } + const char* get_type_str() const { return _type.get_str(); } + const char* get_short_type_str() const { return _type.get_short_str(); } + + bool is_free() const { return _type.is_free(); } + + bool is_young() const { return _type.is_young(); } + bool is_eden() const { return _type.is_eden(); } + bool is_survivor() const { return _type.is_survivor(); } + + bool isHumongous() const { return _type.is_humongous(); } + bool startsHumongous() const { return _type.is_starts_humongous(); } + bool continuesHumongous() const { return _type.is_continues_humongous(); } + + bool is_old() const { return _type.is_old(); } + // For a humongous region, region in which it starts. HeapRegion* humongous_start_region() const { return _humongous_start_region; @@ -496,7 +486,7 @@ class HeapRegion: public G1OffsetTableContigSpace { void set_continuesHumongous(HeapRegion* first_hr); // Unsets the humongous-related fields on the region. - void set_notHumongous(); + void clear_humongous(); // If the region has a remembered set, return a pointer to it. HeapRegionRemSet* rem_set() const { @@ -623,9 +613,6 @@ class HeapRegion: public G1OffsetTableContigSpace { void calc_gc_efficiency(void); double gc_efficiency() { return _gc_efficiency;} - bool is_young() const { return _young_type != NotYoung; } - bool is_survivor() const { return _young_type == Survivor; } - int young_index_in_cset() const { return _young_index_in_cset; } void set_young_index_in_cset(int index) { assert( (index == -1) || is_young(), "pre-condition" ); @@ -677,11 +664,13 @@ class HeapRegion: public G1OffsetTableContigSpace { } } - void set_young() { set_young_type(Young); } + void set_free() { _type.set_free(); } - void set_survivor() { set_young_type(Survivor); } + void set_eden() { _type.set_eden(); } + void set_eden_pre_gc() { _type.set_eden_pre_gc(); } + void set_survivor() { _type.set_survivor(); } - void set_not_young() { set_young_type(NotYoung); } + void set_old() { _type.set_old(); } // Determine if an object has been allocated since the last // mark performed by the collector. This returns true iff the object @@ -809,6 +798,4 @@ class HeapRegionClosure : public StackObj { bool complete() { return _complete; } }; -#endif // INCLUDE_ALL_GCS - #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_HPP diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp index 7f3e76ad15c..8fde2455f1d 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp @@ -42,7 +42,9 @@ void HeapRegionSetBase::verify_region(HeapRegion* hr) { assert(hr->containing_set() == this, err_msg("Inconsistent containing set for %u", hr->hrm_index())); assert(!hr->is_young(), err_msg("Adding young region %u", hr->hrm_index())); // currently we don't use these sets for young regions assert(hr->isHumongous() == regions_humongous(), err_msg("Wrong humongous state for region %u and set %s", hr->hrm_index(), name())); - assert(hr->is_empty() == regions_empty(), err_msg("Wrong empty state for region %u and set %s", hr->hrm_index(), name())); + assert(hr->is_free() == regions_free(), err_msg("Wrong free state for region %u and set %s", hr->hrm_index(), name())); + assert(!hr->is_free() || hr->is_empty(), err_msg("Free region %u is not empty for set %s", hr->hrm_index(), name())); + assert(!hr->is_empty() || hr->is_free(), err_msg("Empty region %u is not free for set %s", hr->hrm_index(), name())); assert(hr->rem_set()->verify_ready_for_par_iteration(), err_msg("Wrong iteration state %u", hr->hrm_index())); } #endif @@ -85,16 +87,16 @@ void HeapRegionSetBase::print_on(outputStream* out, bool print_contents) { out->print_cr("Set: %s ("PTR_FORMAT")", name(), this); out->print_cr(" Region Assumptions"); out->print_cr(" humongous : %s", BOOL_TO_STR(regions_humongous())); - out->print_cr(" empty : %s", BOOL_TO_STR(regions_empty())); + out->print_cr(" free : %s", BOOL_TO_STR(regions_free())); out->print_cr(" Attributes"); out->print_cr(" length : %14u", length()); out->print_cr(" total capacity : "SIZE_FORMAT_W(14)" bytes", total_capacity_bytes()); } -HeapRegionSetBase::HeapRegionSetBase(const char* name, bool humongous, bool empty, HRSMtSafeChecker* mt_safety_checker) +HeapRegionSetBase::HeapRegionSetBase(const char* name, bool humongous, bool free, HRSMtSafeChecker* mt_safety_checker) : _name(name), _verify_in_progress(false), - _is_humongous(humongous), _is_empty(empty), _mt_safety_checker(mt_safety_checker), + _is_humongous(humongous), _is_free(free), _mt_safety_checker(mt_safety_checker), _count() { } diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp index db501993685..9a9267c4b9b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp @@ -81,7 +81,7 @@ class HeapRegionSetBase VALUE_OBJ_CLASS_SPEC { friend class VMStructs; private: bool _is_humongous; - bool _is_empty; + bool _is_free; HRSMtSafeChecker* _mt_safety_checker; protected: @@ -102,9 +102,9 @@ protected: // not. Only used during verification. bool regions_humongous() { return _is_humongous; } - // Indicates whether all regions in the set should be empty or + // Indicates whether all regions in the set should be free or // not. Only used during verification. - bool regions_empty() { return _is_empty; } + bool regions_free() { return _is_free; } void check_mt_safety() { if (_mt_safety_checker != NULL) { @@ -114,7 +114,7 @@ protected: virtual void fill_in_ext_msg_extra(hrs_ext_msg* msg) { } - HeapRegionSetBase(const char* name, bool humongous, bool empty, HRSMtSafeChecker* mt_safety_checker); + HeapRegionSetBase(const char* name, bool humongous, bool free, HRSMtSafeChecker* mt_safety_checker); public: const char* name() { return _name; } @@ -171,7 +171,7 @@ public: do { \ assert(((_set1_)->regions_humongous() == \ (_set2_)->regions_humongous()) && \ - ((_set1_)->regions_empty() == (_set2_)->regions_empty()), \ + ((_set1_)->regions_free() == (_set2_)->regions_free()), \ hrs_err_msg("the contents of set %s and set %s should match", \ (_set1_)->name(), (_set2_)->name())); \ } while (0) @@ -184,7 +184,7 @@ public: class HeapRegionSet : public HeapRegionSetBase { public: HeapRegionSet(const char* name, bool humongous, HRSMtSafeChecker* mt_safety_checker): - HeapRegionSetBase(name, humongous, false /* empty */, mt_safety_checker) { } + HeapRegionSetBase(name, humongous, false /* free */, mt_safety_checker) { } void bulk_remove(const HeapRegionSetCount& removed) { _count.decrement(removed.length(), removed.capacity()); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionType.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionType.cpp new file mode 100644 index 00000000000..347b58d7996 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionType.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2014, 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. + * + */ + +#include "precompiled.hpp" +#include "gc_implementation/g1/heapRegionType.hpp" + +bool HeapRegionType::is_valid(Tag tag) { + switch (tag) { + case FreeTag: + case EdenTag: + case SurvTag: + case HumStartsTag: + case HumContTag: + case OldTag: + return true; + } + return false; +} + +const char* HeapRegionType::get_str() const { + hrt_assert_is_valid(_tag); + switch (_tag) { + case FreeTag: return "FREE"; + case EdenTag: return "EDEN"; + case SurvTag: return "SURV"; + case HumStartsTag: return "HUMS"; + case HumContTag: return "HUMC"; + case OldTag: return "OLD"; + } + ShouldNotReachHere(); + // keep some compilers happy + return NULL; +} + +const char* HeapRegionType::get_short_str() const { + hrt_assert_is_valid(_tag); + switch (_tag) { + case FreeTag: return "F"; + case EdenTag: return "E"; + case SurvTag: return "S"; + case HumStartsTag: return "HS"; + case HumContTag: return "HC"; + case OldTag: return "O"; + } + ShouldNotReachHere(); + // keep some compilers happy + return NULL; +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionType.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionType.hpp new file mode 100644 index 00000000000..b00590a6b78 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionType.hpp @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2014, 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. + * + */ + +#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONTYPE_HPP +#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONTYPE_HPP + +#include "memory/allocation.hpp" + +#define hrt_assert_is_valid(tag) \ + assert(is_valid((tag)), err_msg("invalid HR type: %u", (uint) (tag))) + +class HeapRegionType VALUE_OBJ_CLASS_SPEC { +private: + // We encode the value of the heap region type so the generation can be + // determined quickly. The tag is split into two parts: + // + // major type (young, humongous) : top N-1 bits + // minor type (eden / survivor, starts / cont hum, etc.) : bottom 1 bit + // + // If there's need to increase the number of minor types in the + // future, we'll have to increase the size of the latter and hence + // decrease the size of the former. + // + // 0000 0 [ 0] Free + // + // 0001 0 Young Mask + // 0001 0 [ 2] Eden + // 0001 1 [ 3] Survivor + // + // 0010 0 Humongous Mask + // 0010 0 [ 4] Humongous Starts + // 0010 1 [ 5] Humongous Continues + // + // 01000 [ 8] Old + typedef enum { + FreeTag = 0, + + YoungMask = 2, + EdenTag = YoungMask, + SurvTag = YoungMask + 1, + + HumMask = 4, + HumStartsTag = HumMask, + HumContTag = HumMask + 1, + + OldTag = 8 + } Tag; + + volatile Tag _tag; + + static bool is_valid(Tag tag); + + Tag get() const { + hrt_assert_is_valid(_tag); + return _tag; + } + + // Sets the type to 'tag'. + void set(Tag tag) { + hrt_assert_is_valid(tag); + hrt_assert_is_valid(_tag); + _tag = tag; + } + + // Sets the type to 'tag', expecting the type to be 'before'. This + // is available for when we want to add sanity checking to the type + // transition. + void set_from(Tag tag, Tag before) { + hrt_assert_is_valid(tag); + hrt_assert_is_valid(before); + hrt_assert_is_valid(_tag); + assert(_tag == before, + err_msg("HR tag: %u, expected: %u new tag; %u", _tag, before, tag)); + _tag = tag; + } + +public: + // Queries + + bool is_free() const { return get() == FreeTag; } + + bool is_young() const { return (get() & YoungMask) != 0; } + bool is_eden() const { return get() == EdenTag; } + bool is_survivor() const { return get() == SurvTag; } + + bool is_humongous() const { return (get() & HumMask) != 0; } + bool is_starts_humongous() const { return get() == HumStartsTag; } + bool is_continues_humongous() const { return get() == HumContTag; } + + bool is_old() const { return get() == OldTag; } + + // Setters + + void set_free() { set(FreeTag); } + + void set_eden() { set_from(EdenTag, FreeTag); } + void set_eden_pre_gc() { set_from(EdenTag, SurvTag); } + void set_survivor() { set_from(SurvTag, FreeTag); } + + void set_starts_humongous() { set_from(HumStartsTag, FreeTag); } + void set_continues_humongous() { set_from(HumContTag, FreeTag); } + + void set_old() { set(OldTag); } + + // Misc + + const char* get_str() const; + const char* get_short_str() const; + + HeapRegionType() : _tag(FreeTag) { hrt_assert_is_valid(_tag); } +}; + +#endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONTYPE_HPP From 3eff7a8f6401db1c34304bdecbbb6e4946f5cfdc Mon Sep 17 00:00:00 2001 From: Erik Helin Date: Tue, 24 Jun 2014 15:50:50 +0200 Subject: [PATCH 07/81] 8049864: TestParallelHeapSizeFlags fails with unexpected heap size Reviewed-by: sjohanss, jmasa --- .../parallelScavenge/generationSizer.cpp | 7 +- .../parallelScavenge/parMarkBitMap.cpp | 2 +- .../parallelScavenge/psParallelCompact.cpp | 2 +- hotspot/src/share/vm/memory/heap.cpp | 10 ++- hotspot/src/share/vm/prims/jni.cpp | 2 + hotspot/src/share/vm/runtime/os.cpp | 81 +++++++++++++++---- hotspot/src/share/vm/runtime/os.hpp | 18 ++--- hotspot/src/share/vm/runtime/virtualspace.cpp | 6 +- .../arguments/TestParallelHeapSizeFlags.java | 1 - 9 files changed, 89 insertions(+), 40 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp index ff4b53057b8..e5defc98edc 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp @@ -66,9 +66,10 @@ void GenerationSizer::initialize_flags() { void GenerationSizer::initialize_size_info() { trace_gen_sizes("ps heap raw"); - const size_t page_sz = os::page_size_for_region(_min_heap_byte_size, - _max_heap_byte_size, - 8); + const size_t max_page_sz = os::page_size_for_region(_max_heap_byte_size, 8); + const size_t min_pages = 4; // 1 for eden + 1 for each survivor + 1 for old + const size_t min_page_sz = os::page_size_for_region(_min_heap_byte_size, min_pages); + const size_t page_sz = MIN2(max_page_sz, min_page_sz); // Can a page size be something else than a power of two? assert(is_power_of_2((intptr_t)page_sz), "must be a power of 2"); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp index 47d5068a9c3..a8ab19357ce 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp @@ -41,7 +41,7 @@ ParMarkBitMap::initialize(MemRegion covered_region) const size_t words = bits / BitsPerWord; const size_t raw_bytes = words * sizeof(idx_t); - const size_t page_sz = os::page_size_for_region(raw_bytes, raw_bytes, 10); + const size_t page_sz = os::page_size_for_region(raw_bytes, 10); const size_t granularity = os::vm_allocation_granularity(); _reserved_byte_size = align_size_up(raw_bytes, MAX2(page_sz, granularity)); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index 1a2fd30c6ce..be903293269 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -403,7 +403,7 @@ PSVirtualSpace* ParallelCompactData::create_vspace(size_t count, size_t element_size) { const size_t raw_bytes = count * element_size; - const size_t page_sz = os::page_size_for_region(raw_bytes, raw_bytes, 10); + const size_t page_sz = os::page_size_for_region(raw_bytes, 10); const size_t granularity = os::vm_allocation_granularity(); _reserved_byte_size = align_size_up(raw_bytes, MAX2(page_sz, granularity)); diff --git a/hotspot/src/share/vm/memory/heap.cpp b/hotspot/src/share/vm/memory/heap.cpp index db0105fb3a1..cf137e74a00 100644 --- a/hotspot/src/share/vm/memory/heap.cpp +++ b/hotspot/src/share/vm/memory/heap.cpp @@ -98,9 +98,13 @@ bool CodeHeap::reserve(size_t reserved_size, size_t committed_size, _log2_segment_size = exact_log2(segment_size); // Reserve and initialize space for _memory. - const size_t page_size = os::can_execute_large_page_memory() ? - os::page_size_for_region(committed_size, reserved_size, 8) : - os::vm_page_size(); + size_t page_size = os::vm_page_size(); + if (os::can_execute_large_page_memory()) { + const size_t min_pages = 8; + page_size = MIN2(os::page_size_for_region(committed_size, min_pages), + os::page_size_for_region(reserved_size, min_pages)); + } + const size_t granularity = os::vm_allocation_granularity(); const size_t r_align = MAX2(page_size, granularity); const size_t r_size = align_size_up(reserved_size, r_align); diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp index c404b4c7de5..398ad5d2270 100644 --- a/hotspot/src/share/vm/prims/jni.cpp +++ b/hotspot/src/share/vm/prims/jni.cpp @@ -3848,6 +3848,7 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_GetDefaultJavaVMInitArgs(void *args_) { unit_test_function_call // Forward declaration +void TestOS_test(); void TestReservedSpace_test(); void TestReserveMemorySpecial_test(); void TestVirtualSpace_test(); @@ -3871,6 +3872,7 @@ void FreeRegionList_test(); void execute_internal_vm_tests() { if (ExecuteInternalVMTests) { tty->print_cr("Running internal VM tests"); + run_unit_test(TestOS_test()); run_unit_test(TestReservedSpace_test()); run_unit_test(TestReserveMemorySpecial_test()); run_unit_test(TestVirtualSpace_test()); diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp index 5d8d0d598a9..8d7450b1d97 100644 --- a/hotspot/src/share/vm/runtime/os.cpp +++ b/hotspot/src/share/vm/runtime/os.cpp @@ -1406,24 +1406,15 @@ bool os::stack_shadow_pages_available(Thread *thread, methodHandle method) { return (sp > (stack_limit + reserved_area)); } -size_t os::page_size_for_region(size_t region_min_size, size_t region_max_size, - uint min_pages) -{ +size_t os::page_size_for_region(size_t region_size, size_t min_pages) { assert(min_pages > 0, "sanity"); if (UseLargePages) { - const size_t max_page_size = region_max_size / min_pages; + const size_t max_page_size = region_size / min_pages; - for (unsigned int i = 0; _page_sizes[i] != 0; ++i) { - const size_t sz = _page_sizes[i]; - const size_t mask = sz - 1; - if ((region_min_size & mask) == 0 && (region_max_size & mask) == 0) { - // The largest page size with no fragmentation. - return sz; - } - - if (sz <= max_page_size) { - // The largest page size that satisfies the min_pages requirement. - return sz; + for (size_t i = 0; _page_sizes[i] != 0; ++i) { + const size_t page_size = _page_sizes[i]; + if (page_size <= max_page_size && is_size_aligned(region_size, page_size)) { + return page_size; } } } @@ -1660,3 +1651,63 @@ os::SuspendResume::State os::SuspendResume::switch_state(os::SuspendResume::Stat return result; } #endif + +/////////////// Unit tests /////////////// + +#ifndef PRODUCT + +#define assert_eq(a,b) assert(a == b, err_msg(SIZE_FORMAT " != " SIZE_FORMAT, a, b)) + +class TestOS : AllStatic { + static size_t small_page_size() { + return os::vm_page_size(); + } + + static size_t large_page_size() { + const size_t large_page_size_example = 4 * M; + return os::page_size_for_region(large_page_size_example, 1); + } + + static void test_page_size_for_region() { + if (UseLargePages) { + const size_t small_page = small_page_size(); + const size_t large_page = large_page_size(); + + if (large_page > small_page) { + size_t num_small_pages_in_large = large_page / small_page; + size_t page = os::page_size_for_region(large_page, num_small_pages_in_large); + + assert_eq(page, small_page); + } + } + } + + static void test_page_size_for_region_alignment() { + if (UseLargePages) { + const size_t small_page = small_page_size(); + const size_t large_page = large_page_size(); + if (large_page > small_page) { + const size_t unaligned_region = large_page + 17; + size_t page = os::page_size_for_region(unaligned_region, 1); + assert_eq(page, small_page); + + const size_t num_pages = 5; + const size_t aligned_region = large_page * num_pages; + page = os::page_size_for_region(aligned_region, num_pages); + assert_eq(page, large_page); + } + } + } + + public: + static void run_tests() { + test_page_size_for_region(); + test_page_size_for_region_alignment(); + } +}; + +void TestOS_test() { + TestOS::run_tests(); +} + +#endif // PRODUCT diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp index 350a998aca4..8e43fd1c193 100644 --- a/hotspot/src/share/vm/runtime/os.hpp +++ b/hotspot/src/share/vm/runtime/os.hpp @@ -265,19 +265,11 @@ class os: AllStatic { // Return the default page size. static int vm_page_size(); - // Return the page size to use for a region of memory. The min_pages argument - // is a hint intended to limit fragmentation; it says the returned page size - // should be <= region_max_size / min_pages. Because min_pages is a hint, - // this routine may return a size larger than region_max_size / min_pages. - // - // The current implementation ignores min_pages if a larger page size is an - // exact multiple of both region_min_size and region_max_size. This allows - // larger pages to be used when doing so would not cause fragmentation; in - // particular, a single page can be used when region_min_size == - // region_max_size == a supported page size. - static size_t page_size_for_region(size_t region_min_size, - size_t region_max_size, - uint min_pages); + // Returns the page size to use for a region of memory. + // region_size / min_pages will always be greater than or equal to the + // returned value. + static size_t page_size_for_region(size_t region_size, size_t min_pages); + // Return the largest page size that can be used static size_t max_page_size() { // The _page_sizes array is sorted in descending order. diff --git a/hotspot/src/share/vm/runtime/virtualspace.cpp b/hotspot/src/share/vm/runtime/virtualspace.cpp index 4cc2e04c1a1..ea557f338e2 100644 --- a/hotspot/src/share/vm/runtime/virtualspace.cpp +++ b/hotspot/src/share/vm/runtime/virtualspace.cpp @@ -38,7 +38,7 @@ ReservedSpace::ReservedSpace() : _base(NULL), _size(0), _noaccess_prefix(0), } ReservedSpace::ReservedSpace(size_t size) { - size_t page_size = os::page_size_for_region(size, size, 1); + size_t page_size = os::page_size_for_region(size, 1); bool large_pages = page_size != (size_t)os::vm_page_size(); // Don't force the alignment to be large page aligned, // since that will waste memory. @@ -357,7 +357,7 @@ VirtualSpace::VirtualSpace() { bool VirtualSpace::initialize(ReservedSpace rs, size_t committed_size) { - const size_t max_commit_granularity = os::page_size_for_region(rs.size(), rs.size(), 1); + const size_t max_commit_granularity = os::page_size_for_region(rs.size(), 1); return initialize_with_granularity(rs, committed_size, max_commit_granularity); } @@ -992,7 +992,7 @@ class TestVirtualSpace : AllStatic { case Disable: return vs.initialize_with_granularity(rs, 0, os::vm_page_size()); case Commit: - return vs.initialize_with_granularity(rs, 0, os::page_size_for_region(rs.size(), rs.size(), 1)); + return vs.initialize_with_granularity(rs, 0, os::page_size_for_region(rs.size(), 1)); } } diff --git a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java index bf627db8b0e..c9837f50b7c 100644 --- a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java +++ b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java @@ -22,7 +22,6 @@ */ /* - * @ignore 8049864 * @test TestParallelHeapSizeFlags * @key gc * @bug 8006088 From 26ed1b4780ca9cc289411917aba2414adf9b5b38 Mon Sep 17 00:00:00 2001 From: Alexander Zvegintsev Date: Tue, 9 Sep 2014 16:08:34 +0400 Subject: [PATCH 08/81] 8057770: api/javax_swing/JScrollPane/indexTGF.html#UpdateUI failed with MotifLookAndFeel on all platform Reviewed-by: alexsch, serb --- .../sun/java/swing/plaf/motif/MotifScrollPaneUI.java | 10 +++++++--- .../unix/classes/sun/awt/X11/XTextAreaPeer.java | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifScrollPaneUI.java b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifScrollPaneUI.java index 2a12ed8ede6..52bc7385518 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifScrollPaneUI.java +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifScrollPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -56,19 +56,22 @@ public class MotifScrollPaneUI extends BasicScrollPaneUI private PropertyChangeListener propertyChangeHandler; + @Override protected void installListeners(JScrollPane scrollPane) { super.installListeners(scrollPane); propertyChangeHandler = createPropertyChangeHandler(); scrollPane.addPropertyChangeListener(propertyChangeHandler); } - protected void uninstallListeners(JScrollPane scrollPane) { + @Override + protected void uninstallListeners(JComponent scrollPane) { super.uninstallListeners(scrollPane); scrollPane.removePropertyChangeListener(propertyChangeHandler); } private PropertyChangeListener createPropertyChangeHandler() { return new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName(); @@ -92,6 +95,7 @@ public class MotifScrollPaneUI extends BasicScrollPaneUI }}; } + @Override protected void installDefaults(JScrollPane scrollpane) { super.installDefaults(scrollpane); @@ -115,7 +119,7 @@ public class MotifScrollPaneUI extends BasicScrollPaneUI } } - + @Override protected void uninstallDefaults(JScrollPane c) { super.uninstallDefaults(c); diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java index 9f0a717e5e4..e87eb28bcee 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java @@ -1025,7 +1025,8 @@ final class XTextAreaPeer extends XComponentPeer implements TextAreaPeer { } } - protected void uninstallListeners(JScrollPane scrollPane) { + @Override + protected void uninstallListeners(JComponent scrollPane) { super.uninstallListeners(scrollPane); scrollPane.removePropertyChangeListener(propertyChangeHandler); } From 2a90745d9d794a37350411a4df66152a93083931 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Tue, 9 Sep 2014 18:32:44 +0400 Subject: [PATCH 09/81] 8057819: No CCC approving removing final modifier from javax.swing.SwingUtilities.isRectangleContainingRectangle static method Reviewed-by: azvegint, alexsch --- .../java.desktop/share/classes/javax/swing/SwingUtilities.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/java.desktop/share/classes/javax/swing/SwingUtilities.java b/jdk/src/java.desktop/share/classes/javax/swing/SwingUtilities.java index 07705f4a812..0b2dff8e962 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/SwingUtilities.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/SwingUtilities.java @@ -111,7 +111,7 @@ public class SwingUtilities implements SwingConstants * * @return {@code true} if @{code a} contains {@code b} */ - public static boolean isRectangleContainingRectangle(Rectangle a,Rectangle b) { + public static final boolean isRectangleContainingRectangle(Rectangle a,Rectangle b) { return b.x >= a.x && (b.x + b.width) <= (a.x + a.width) && b.y >= a.y && (b.y + b.height) <= (a.y + a.height); } From eb8950df45bfc212b62fac52eab4acd6f73957a1 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Wed, 10 Sep 2014 00:44:16 -0400 Subject: [PATCH 10/81] 8056183: os::is_MP() always reports true when NMT is enabled Reviewed-by: shade, coleenp, bdelsart --- hotspot/src/share/vm/runtime/os.hpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp index d6a4eafb2b1..b81bf8d47e1 100644 --- a/hotspot/src/share/vm/runtime/os.hpp +++ b/hotspot/src/share/vm/runtime/os.hpp @@ -214,13 +214,14 @@ class os: AllStatic { // Interface for detecting multiprocessor system static inline bool is_MP() { -#if !INCLUDE_NMT - assert(_processor_count > 0, "invalid processor count"); - return _processor_count > 1 || AssumeMP; -#else - // NMT needs atomic operations before this initialization. - return true; -#endif + // During bootstrap if _processor_count is not yet initialized + // we claim to be MP as that is safest. If any platform has a + // stub generator that might be triggered in this phase and for + // which being declared MP when in fact not, is a problem - then + // the bootstrap routine for the stub generator needs to check + // the processor count directly and leave the bootstrap routine + // in place until called after initialization has ocurred. + return (_processor_count != 1) || AssumeMP; } static julong available_memory(); static julong physical_memory(); From 138a20315d61132b7ba2eded07ea038af035e78e Mon Sep 17 00:00:00 2001 From: Volker Simonis Date: Wed, 10 Sep 2014 11:01:59 +0200 Subject: [PATCH 11/81] 8057934: Upgrade to LittleCMS 2.6 breaks AIX build Reviewed-by: prr, serb --- jdk/src/java.desktop/share/native/liblcms/cmscgats.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.desktop/share/native/liblcms/cmscgats.c b/jdk/src/java.desktop/share/native/liblcms/cmscgats.c index 4610a232f5f..e3079d10983 100644 --- a/jdk/src/java.desktop/share/native/liblcms/cmscgats.c +++ b/jdk/src/java.desktop/share/native/liblcms/cmscgats.c @@ -77,7 +77,7 @@ // Symbols typedef enum { - SNONE, + SUNDEFINED, SINUM, // Integer SDNUM, // Real SIDENT, // Identifier @@ -550,7 +550,7 @@ SYMBOL BinSrchKey(const char *id) else l = x + 1; } - return SNONE; + return SUNDEFINED; } @@ -735,7 +735,7 @@ void InSymbol(cmsIT8* it8) key = BinSrchKey(it8->id); - if (key == SNONE) it8->sy = SIDENT; + if (key == SUNDEFINED) it8->sy = SIDENT; else it8->sy = key; } @@ -1326,7 +1326,7 @@ cmsHANDLE CMSEXPORT cmsIT8Alloc(cmsContext ContextID) it8->ValidKeywords = NULL; it8->ValidSampleID = NULL; - it8 -> sy = SNONE; + it8 -> sy = SUNDEFINED; it8 -> ch = ' '; it8 -> Source = NULL; it8 -> inum = 0; From 251addac33b00e284212baed9526721cf1f304cc Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Wed, 10 Sep 2014 15:09:31 +0400 Subject: [PATCH 12/81] 8057940: JCK test api/java_awt/Image/renderable/ParameterBlock fails with StackOverflowError Reviewed-by: serb, prr --- .../classes/java/awt/image/renderable/ParameterBlock.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/renderable/ParameterBlock.java b/jdk/src/java.desktop/share/classes/java/awt/image/renderable/ParameterBlock.java index b08e13481ee..c84bdc17952 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/renderable/ParameterBlock.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/renderable/ParameterBlock.java @@ -370,7 +370,7 @@ public class ParameterBlock implements Cloneable, Serializable { * the specified parameter. */ public ParameterBlock add(int i) { - return add(i); + return add(Integer.valueOf(i)); } /** @@ -489,7 +489,7 @@ public class ParameterBlock implements Cloneable, Serializable { * the specified parameter. */ public ParameterBlock set(int i, int index) { - return set(i, index); + return set(Integer.valueOf(i), index); } /** From 3ad47cdbeb274344af938ebbeaf77c390d181869 Mon Sep 17 00:00:00 2001 From: Christian Tornqvist Date: Wed, 10 Sep 2014 07:06:37 -0700 Subject: [PATCH 13/81] 8055719: Clean out support for old VC versions from ProjectCreator Clean out support for old VC versions from ProjectCreator Reviewed-by: sla, allwin --- .../windows/makefiles/projectcreator.make | 4 - .../ProjectCreator/FileTreeCreatorVC7.java | 156 -------- .../ProjectCreator/WinGammaPlatformVC10.java | 2 +- .../ProjectCreator/WinGammaPlatformVC7.java | 353 ------------------ .../ProjectCreator/WinGammaPlatformVC8.java | 68 ---- .../ProjectCreator/WinGammaPlatformVC9.java | 32 -- 6 files changed, 1 insertion(+), 614 deletions(-) delete mode 100644 hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC7.java delete mode 100644 hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java delete mode 100644 hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC8.java delete mode 100644 hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC9.java diff --git a/hotspot/make/windows/makefiles/projectcreator.make b/hotspot/make/windows/makefiles/projectcreator.make index f4ee4d14236..ce960ef39c9 100644 --- a/hotspot/make/windows/makefiles/projectcreator.make +++ b/hotspot/make/windows/makefiles/projectcreator.make @@ -31,12 +31,8 @@ ProjectCreatorSources=\ $(WorkSpace)\src\share\tools\ProjectCreator\ProjectCreator.java \ $(WorkSpace)\src\share\tools\ProjectCreator\FileTreeCreator.java \ - $(WorkSpace)\src\share\tools\ProjectCreator\FileTreeCreatorVC7.java \ $(WorkSpace)\src\share\tools\ProjectCreator\FileTreeCreatorVC10.java \ $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatform.java \ - $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC7.java \ - $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC8.java \ - $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC9.java \ $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC10.java \ $(WorkSpace)\src\share\tools\ProjectCreator\Util.java \ $(WorkSpace)\src\share\tools\ProjectCreator\BuildConfig.java \ diff --git a/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC7.java b/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC7.java deleted file mode 100644 index 9a431845719..00000000000 --- a/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC7.java +++ /dev/null @@ -1,156 +0,0 @@ -import static java.nio.file.FileVisitResult.CONTINUE; - -import java.io.IOException; -import java.nio.file.FileSystems; -import java.nio.file.FileVisitResult; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.attribute.BasicFileAttributes; -import java.util.Stack; -import java.util.Vector; - -public class FileTreeCreatorVC7 extends FileTreeCreator { - - public FileTreeCreatorVC7(Path startDir, Vector allConfigs, WinGammaPlatform wg) { - super(startDir, allConfigs, wg); - } - - @Override - public FileVisitResult visitFile(Path file, BasicFileAttributes attr) { - DirAttributes currentFileAttr = attributes.peek().clone(); - boolean usePch = false; - boolean disablePch = false; - boolean useIgnore = false; - String fileName = file.getFileName().toString(); - - // usePch applies to all configs for a file. - if (fileName.equals(BuildConfig.getFieldString(null, "UseToGeneratePch"))) { - usePch = true; - } - - for (BuildConfig cfg : allConfigs) { - if (cfg.lookupHashFieldInContext("IgnoreFile", fileName) != null) { - useIgnore = true; - currentFileAttr.setIgnore(cfg); - } else if (cfg.matchesIgnoredPath(file.toAbsolutePath().toString())) { - useIgnore = true; - currentFileAttr.setIgnore(cfg); - } - - if (cfg.lookupHashFieldInContext("DisablePch", fileName) != null) { - disablePch = true; - currentFileAttr.setDisablePch(cfg); - } - - Vector rv = new Vector(); - cfg.collectRelevantVectors(rv, "AdditionalFile"); - for(String addFile : rv) { - if (addFile.equals(fileName)) { - // supress any ignore - currentFileAttr.removeFromIgnored(cfg); - } - } - } - - if (!useIgnore && !disablePch && !usePch) { - wg.tag("File", new String[] { "RelativePath", vcProjLocation.relativize(file).toString()}); - } else { - wg.startTag( - "File", - new String[] { "RelativePath", vcProjLocation.relativize(file).toString()}); - - for (BuildConfig cfg : allConfigs) { - boolean ignore = currentFileAttr.hasIgnore(cfg); - String [] fileConfAttr; - - if (ignore) { - fileConfAttr = new String[] {"Name", cfg.get("Name"), "ExcludedFromBuild", "TRUE" }; - } else { - fileConfAttr = new String[] {"Name", cfg.get("Name")}; - } - - if (!disablePch && !usePch && !ignore) { - continue; - } else if (!disablePch && !usePch) { - wg.tag("FileConfiguration", fileConfAttr); - } else { - wg.startTag("FileConfiguration", fileConfAttr); - if (usePch) { - // usePch always applies to all configs, might not always be so. - wg.tag("Tool", new String[] { - "Name", "VCCLCompilerTool", "UsePrecompiledHeader", - "1" }); - assert(!disablePch); - } - if (disablePch) { - if (currentFileAttr.hasDisablePch(cfg)) { - wg.tag("Tool", new String[] { - "Name", "VCCLCompilerTool", "UsePrecompiledHeader", - "0" }); - } - assert(!usePch); - } - wg.endTag(); - } - } - wg.endTag(); - } - - return CONTINUE; - } - - @Override - public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attrs) - throws IOException { - Boolean hide = false; - DirAttributes newAttr = attributes.peek().clone(); - - String rPath; - if (path.toAbsolutePath().toString().equals(this.startDir.toAbsolutePath().toString())){ - rPath = startDir.toString(); - } else { - rPath = path.getFileName().toString(); - } - - // check per config ignorePaths! - for (BuildConfig cfg : allConfigs) { - if (cfg.matchesIgnoredPath(path.toAbsolutePath().toString())) { - newAttr.setIgnore(cfg); - } - - // Hide is always on all configs. And additional files are never hiddden - if (cfg.matchesHidePath(path.toAbsolutePath().toString())) { - hide = true; - break; - } - } - - if (!hide) { - wg.startTag("Filter", new String[] { - "Name", rPath}); - - attributes.push(newAttr); - return super.preVisitDirectory(path, attrs); - } else { - return FileVisitResult.SKIP_SUBTREE; - } - } - - @Override - public FileVisitResult postVisitDirectory(Path dir, IOException exc) { - //end matching attributes set by ignorepath - wg.endTag(); - attributes.pop(); - - return CONTINUE; - } - - @Override - public FileVisitResult visitFileFailed(Path file, IOException exc) { - return CONTINUE; - } - - public void writeFileTree() throws IOException { - Files.walkFileTree(this.startDir, this); - } - } \ No newline at end of file diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java index 08768b623f5..0f183b3a17b 100644 --- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java +++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java @@ -33,7 +33,7 @@ import java.util.LinkedList; import java.util.UUID; import java.util.Vector; -public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 { +public class WinGammaPlatformVC10 extends WinGammaPlatform { LinkedList filters = new LinkedList(); diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java deleted file mode 100644 index f9f44a467a2..00000000000 --- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java +++ /dev/null @@ -1,353 +0,0 @@ -/* - * 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. - * - * 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 java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.nio.file.FileSystems; -import java.util.Vector; - -public class WinGammaPlatformVC7 extends WinGammaPlatform { - - // TODO How about moving all globals configs to its own BuildConfig? - - String projectVersion() { - return "7.10"; - }; - - public void writeProjectFile(String projectFileName, String projectName, - Vector allConfigs) throws IOException { - System.out.println(); - System.out.println(" Writing .vcproj file: " + projectFileName); - // If we got this far without an error, we're safe to actually - // write the .vcproj file - printWriter = new PrintWriter(new FileWriter(projectFileName)); - - printWriter - .println(""); - startTag("VisualStudioProject", new String[] { "ProjectType", - "Visual C++", "Version", projectVersion(), "Name", projectName, - "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}", - "SccProjectName", "", "SccLocalPath", "" }); - startTag("Platforms"); - tag("Platform", - new String[] { "Name", - (String) BuildConfig.getField(null, "PlatformName") }); - endTag(); - - startTag("Configurations"); - - for (BuildConfig cfg : allConfigs) { - writeConfiguration(cfg); - } - - endTag(); - - tag("References"); - - writeFiles(allConfigs); - - tag("Globals"); - - endTag(); - printWriter.close(); - - System.out.println(" Done."); - } - - void writeCustomToolConfig(Vector configs, String[] customToolAttrs) { - for (BuildConfig cfg : configs) { - startTag("FileConfiguration", - new String[] { "Name", (String) cfg.get("Name") }); - tag("Tool", customToolAttrs); - - endTag(); - } - } - - void writeFiles(Vector allConfigs) { - - // This code assummes there are no config specific includes. - startTag("Files"); - String sourceBase = BuildConfig.getFieldString(null, "SourceBase"); - - // Use first config for all global absolute includes. - BuildConfig baseConfig = allConfigs.firstElement(); - Vector rv = new Vector(); - - // Then use first config for all relative includes - Vector ri = new Vector(); - baseConfig.collectRelevantVectors(ri, "RelativeSrcInclude"); - for (String f : ri) { - rv.add(sourceBase + Util.sep + f); - } - - baseConfig.collectRelevantVectors(rv, "AbsoluteSrcInclude"); - - handleIncludes(rv, allConfigs); - - startTag("Filter", new String[] { "Name", "Resource Files", "Filter", - "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" }); - endTag(); - - endTag(); - } - - // Will visit file tree for each include - private void handleIncludes(Vector includes, Vector allConfigs) { - for (String path : includes) { - FileTreeCreatorVC7 ftc = new FileTreeCreatorVC7(FileSystems.getDefault().getPath(path) , allConfigs, this); - try { - ftc.writeFileTree(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - void writeConfiguration(BuildConfig cfg) { - startTag("Configuration", new String[] { "Name", cfg.get("Name"), - "OutputDirectory", cfg.get("OutputDir"), - "IntermediateDirectory", cfg.get("OutputDir"), - "ConfigurationType", "2", "UseOfMFC", "0", - "ATLMinimizesCRunTimeLibraryUsage", "FALSE" }); - - tagV("Tool", cfg.getV("CompilerFlags")); - - tag("Tool", new String[] { "Name", "VCCustomBuildTool" }); - - tagV("Tool", cfg.getV("LinkerFlags")); - - String postBuildCmd = BuildConfig.getFieldString(null, - "PostbuildCommand"); - if (postBuildCmd != null) { - tag("Tool", - new String[] { - "Name", - "VCPostBuildEventTool", - "Description", - BuildConfig - .getFieldString(null, "PostbuildDescription"), - // Caution: String.replace(String,String) is available - // from JDK5 onwards only - "CommandLine", - cfg.expandFormat(postBuildCmd.replace("\t", - " ")) }); - } - - tag("Tool", new String[] { "Name", "VCPreBuildEventTool" }); - - tag("Tool", - new String[] { - "Name", - "VCPreLinkEventTool", - "Description", - BuildConfig.getFieldString(null, "PrelinkDescription"), - // Caution: String.replace(String,String) is available - // from JDK5 onwards only - "CommandLine", - cfg.expandFormat(BuildConfig.getFieldString(null, - "PrelinkCommand").replace("\t", " ")) }); - - tag("Tool", new String[] { "Name", "VCResourceCompilerTool", - "PreprocessorDefinitions", "NDEBUG", "Culture", "1033" }); - - tag("Tool", new String[] { "Name", "VCMIDLTool", - "PreprocessorDefinitions", "NDEBUG", "MkTypLibCompatible", - "TRUE", "SuppressStartupBanner", "TRUE", "TargetEnvironment", - "1", "TypeLibraryName", - cfg.get("OutputDir") + Util.sep + "vm.tlb", "HeaderFileName", - "" }); - - endTag(); - } - - - - protected String getProjectExt() { - return ".vcproj"; - } -} - -class CompilerInterfaceVC7 extends CompilerInterface { - void getBaseCompilerFlags_common(Vector defines, Vector includes, - String outDir, Vector rv) { - - // advanced M$ IDE (2003) can only recognize name if it's first or - // second attribute in the tag - go guess - addAttr(rv, "Name", "VCCLCompilerTool"); - addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes)); - addAttr(rv, "PreprocessorDefinitions", - Util.join(";", defines).replace("\"", """)); - addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp"); - addAttr(rv, "PrecompiledHeaderFile", outDir + Util.sep + "vm.pch"); - addAttr(rv, "AssemblerListingLocation", outDir); - addAttr(rv, "ObjectFile", outDir + Util.sep); - addAttr(rv, "ProgramDataBaseFileName", outDir + Util.sep + "jvm.pdb"); - // Set /nologo optin - addAttr(rv, "SuppressStartupBanner", "TRUE"); - // Surpass the default /Tc or /Tp. 0 is compileAsDefault - addAttr(rv, "CompileAs", "0"); - // Set /W3 option. 3 is warningLevel_3 - addAttr(rv, "WarningLevel", "3"); - // Set /WX option, - addAttr(rv, "WarnAsError", "TRUE"); - // Set /GS option - addAttr(rv, "BufferSecurityCheck", "FALSE"); - // Set /Zi option. 3 is debugEnabled - addAttr(rv, "DebugInformationFormat", "3"); - } - - Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { - Vector rv = new Vector(); - - getBaseCompilerFlags_common(defines, includes, outDir, rv); - // Set /Yu option. 3 is pchUseUsingSpecific - // Note: Starting VC8 pchUseUsingSpecific is 2 !!! - addAttr(rv, "UsePrecompiledHeader", "3"); - // Set /EHsc- option - addAttr(rv, "ExceptionHandling", "FALSE"); - - return rv; - } - - Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { - Vector rv = new Vector(); - - addAttr(rv, "Name", "VCLinkerTool"); - addAttr(rv, "AdditionalOptions", - "/export:JNI_GetDefaultJavaVMInitArgs " - + "/export:JNI_CreateJavaVM " - + "/export:JVM_FindClassFromBootLoader " - + "/export:JNI_GetCreatedJavaVMs " - + "/export:jio_snprintf /export:jio_printf " - + "/export:jio_fprintf /export:jio_vfprintf " - + "/export:jio_vsnprintf " - + "/export:JVM_GetVersionInfo " - + "/export:JVM_GetThreadStateNames " - + "/export:JVM_GetThreadStateValues " - + "/export:JVM_InitAgentProperties "); - addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib"); - addAttr(rv, "OutputFile", outDll); - // Set /INCREMENTAL option. 1 is linkIncrementalNo - addAttr(rv, "LinkIncremental", "1"); - addAttr(rv, "SuppressStartupBanner", "TRUE"); - addAttr(rv, "ModuleDefinitionFile", outDir + Util.sep + "vm.def"); - addAttr(rv, "ProgramDatabaseFile", outDir + Util.sep + "jvm.pdb"); - // Set /SUBSYSTEM option. 2 is subSystemWindows - addAttr(rv, "SubSystem", "2"); - addAttr(rv, "BaseAddress", "0x8000000"); - addAttr(rv, "ImportLibrary", outDir + Util.sep + "jvm.lib"); - if (platformName.equals("Win32")) { - // Set /MACHINE option. 1 is X86 - addAttr(rv, "TargetMachine", "1"); - } else { - // Set /MACHINE option. 17 is X64 - addAttr(rv, "TargetMachine", "17"); - } - - return rv; - } - - void getDebugCompilerFlags_common(String opt, Vector rv) { - - // Set /On option - addAttr(rv, "Optimization", opt); - // Set /FR option. 1 is brAllInfo - addAttr(rv, "BrowseInformation", "1"); - addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep); - // Set /MD option. 2 is rtMultiThreadedDLL - addAttr(rv, "RuntimeLibrary", "2"); - // Set /Oy- option - addAttr(rv, "OmitFramePointers", "FALSE"); - - } - - Vector getDebugCompilerFlags(String opt, String platformName) { - Vector rv = new Vector(); - - getDebugCompilerFlags_common(opt, rv); - - return rv; - } - - Vector getDebugLinkerFlags() { - Vector rv = new Vector(); - - addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option - - return rv; - } - - void getAdditionalNonKernelLinkerFlags(Vector rv) { - extAttr(rv, "AdditionalOptions", "/export:AsyncGetCallTrace "); - } - - void getProductCompilerFlags_common(Vector rv) { - // Set /O2 option. 2 is optimizeMaxSpeed - addAttr(rv, "Optimization", "2"); - // Set /Oy- option - addAttr(rv, "OmitFramePointers", "FALSE"); - // Set /Ob option. 1 is expandOnlyInline - addAttr(rv, "InlineFunctionExpansion", "1"); - // Set /GF option. - addAttr(rv, "StringPooling", "TRUE"); - // Set /MD option. 2 is rtMultiThreadedDLL - addAttr(rv, "RuntimeLibrary", "2"); - // Set /Gy option - addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); - } - - Vector getProductCompilerFlags() { - Vector rv = new Vector(); - - getProductCompilerFlags_common(rv); - - return rv; - } - - Vector getProductLinkerFlags() { - Vector rv = new Vector(); - - // Set /OPT:REF option. 2 is optReferences - addAttr(rv, "OptimizeReferences", "2"); - // Set /OPT:optFolding option. 2 is optFolding - addAttr(rv, "EnableCOMDATFolding", "2"); - - return rv; - } - - String getOptFlag() { - return "2"; - } - - String getNoOptFlag() { - return "0"; - } - - String makeCfgName(String flavourBuild, String platform) { - return flavourBuild + "|" + platform; - } - -} diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC8.java b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC8.java deleted file mode 100644 index 5aee9ac66f0..00000000000 --- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC8.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2005, 2010, 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 java.util.Vector; - -public class WinGammaPlatformVC8 extends WinGammaPlatformVC7 { - - String projectVersion() {return "8.00";}; - -} - -class CompilerInterfaceVC8 extends CompilerInterfaceVC7 { - - Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { - Vector rv = new Vector(); - - getBaseCompilerFlags_common(defines,includes, outDir, rv); - // Set /Yu option. 2 is pchUseUsingSpecific - addAttr(rv, "UsePrecompiledHeader", "2"); - // Set /EHsc- option. 0 is cppExceptionHandlingNo - addAttr(rv, "ExceptionHandling", "0"); - - // enable multi process builds - extAttr(rv, "AdditionalOptions", "/MP"); - - return rv; - } - - - Vector getDebugCompilerFlags(String opt, String platformName) { - Vector rv = new Vector(); - - getDebugCompilerFlags_common(opt,rv); - - return rv; - } - - Vector getProductCompilerFlags() { - Vector rv = new Vector(); - - getProductCompilerFlags_common(rv); - - return rv; - } - - -} diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC9.java b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC9.java deleted file mode 100644 index 273ea7aceac..00000000000 --- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC9.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2005, 2010, 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. - * - */ - -public class WinGammaPlatformVC9 extends WinGammaPlatformVC8 { - - String projectVersion() {return "9.00";}; - -} - -class CompilerInterfaceVC9 extends CompilerInterfaceVC8 { -} From 497f5c44a66249ed5b67f28122c44be433974074 Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Wed, 10 Sep 2014 09:52:41 -0700 Subject: [PATCH 14/81] 8057744: (process) Synchronize exiting of threads and process [win] Reviewed-by: dholmes, dcubed, sla --- hotspot/src/os/aix/vm/os_aix.inline.hpp | 4 + hotspot/src/os/bsd/vm/os_bsd.inline.hpp | 4 + hotspot/src/os/linux/vm/os_linux.inline.hpp | 4 + .../src/os/solaris/vm/os_solaris.inline.hpp | 4 + hotspot/src/os/windows/vm/os_windows.cpp | 99 +++++++++++++++---- hotspot/src/os/windows/vm/os_windows.hpp | 13 ++- .../src/os/windows/vm/os_windows.inline.hpp | 4 + hotspot/src/share/vm/runtime/java.cpp | 6 +- hotspot/src/share/vm/runtime/os.hpp | 4 +- 9 files changed, 112 insertions(+), 30 deletions(-) diff --git a/hotspot/src/os/aix/vm/os_aix.inline.hpp b/hotspot/src/os/aix/vm/os_aix.inline.hpp index b6a20fedd14..bb3232bfbc7 100644 --- a/hotspot/src/os/aix/vm/os_aix.inline.hpp +++ b/hotspot/src/os/aix/vm/os_aix.inline.hpp @@ -269,4 +269,8 @@ inline bool os::supports_monotonic_clock() { return true; } +inline void os::exit(int num) { + ::exit(num); +} + #endif // OS_AIX_VM_OS_AIX_INLINE_HPP diff --git a/hotspot/src/os/bsd/vm/os_bsd.inline.hpp b/hotspot/src/os/bsd/vm/os_bsd.inline.hpp index bf19a3b53f1..1eafb9c76e9 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.inline.hpp +++ b/hotspot/src/os/bsd/vm/os_bsd.inline.hpp @@ -274,4 +274,8 @@ inline bool os::supports_monotonic_clock() { #endif } +inline void os::exit(int num) { + ::exit(num); +} + #endif // OS_BSD_VM_OS_BSD_INLINE_HPP diff --git a/hotspot/src/os/linux/vm/os_linux.inline.hpp b/hotspot/src/os/linux/vm/os_linux.inline.hpp index 913f336b946..d83fb5b7930 100644 --- a/hotspot/src/os/linux/vm/os_linux.inline.hpp +++ b/hotspot/src/os/linux/vm/os_linux.inline.hpp @@ -263,4 +263,8 @@ inline bool os::supports_monotonic_clock() { return Linux::_clock_gettime != NULL; } +inline void os::exit(int num) { + ::exit(num); +} + #endif // OS_LINUX_VM_OS_LINUX_INLINE_HPP diff --git a/hotspot/src/os/solaris/vm/os_solaris.inline.hpp b/hotspot/src/os/solaris/vm/os_solaris.inline.hpp index 0edfb117d31..7609abac014 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.inline.hpp +++ b/hotspot/src/os/solaris/vm/os_solaris.inline.hpp @@ -157,4 +157,8 @@ inline bool os::supports_monotonic_clock() { return true; } +inline void os::exit(int num) { + ::exit(num); +} + #endif // OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index 7f862ad5844..dc24e9021ab 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -22,8 +22,8 @@ * */ -// Must be at least Windows 2000 or XP to use IsDebuggerPresent -#define _WIN32_WINNT 0x500 +// Must be at least Windows Vista or Server 2008 to use InitOnceExecuteOnce +#define _WIN32_WINNT 0x0600 // no precompiled headers #include "classfile/classLoader.hpp" @@ -409,8 +409,6 @@ struct tm* os::localtime_pd(const time_t* clock, struct tm* res) { LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo); -extern jint volatile vm_getting_terminated; - // Thread start routine for all new Java threads static unsigned __stdcall java_start(Thread* thread) { // Try to randomize the cache line index of hot stack frames. @@ -432,13 +430,10 @@ static unsigned __stdcall java_start(Thread* thread) { } } - // Diagnostic code to investigate JDK-6573254 (Part I) - unsigned res = 90115; // non-java thread + // Diagnostic code to investigate JDK-6573254 + int res = 90115; // non-java thread if (thread->is_Java_thread()) { - JavaThread* java_thread = (JavaThread*)thread; - res = java_lang_Thread::is_daemon(java_thread->threadObj()) - ? 70115 // java daemon thread - : 80115; // java non-daemon thread + res = 60115; // java thread } // Install a win32 structured exception handler around every thread created @@ -458,12 +453,9 @@ static unsigned __stdcall java_start(Thread* thread) { Atomic::dec_ptr((intptr_t*)&os::win32::_os_thread_count); } - // Diagnostic code to investigate JDK-6573254 (Part II) - if (OrderAccess::load_acquire(&vm_getting_terminated)) { - return res; - } - - return 0; + // Thread must not return from exit_process_or_thread(), but if it does, + // let it proceed to exit normally + return (unsigned)os::win32::exit_process_or_thread(os::win32::EPT_THREAD, res); } static OSThread* create_os_thread(Thread* thread, HANDLE thread_handle, int thread_id) { @@ -1062,17 +1054,15 @@ void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* } - -void os::abort(bool dump_core) -{ +void os::abort(bool dump_core) { os::shutdown(); // no core dump on Windows - ::exit(1); + win32::exit_process_or_thread(win32::EPT_PROCESS, 1); } // Die immediately, no exit hook, no abort hook, no cleanup. void os::die() { - _exit(-1); + win32::exit_process_or_thread(win32::EPT_PROCESS_DIE, -1); } // Directory routines copied from src/win32/native/java/io/dirent_md.c @@ -3632,6 +3622,10 @@ bool os::win32::_is_nt = false; bool os::win32::_is_windows_2003 = false; bool os::win32::_is_windows_server = false; +// 6573254 +// Currently, the bug is observed across all the supported Windows releases, +// including the latest one (as of this writing - Windows Server 2012 R2) +bool os::win32::_has_exit_bug = true; bool os::win32::_has_performance_count = 0; void os::win32::initialize_system_info() { @@ -3728,6 +3722,69 @@ HINSTANCE os::win32::load_Windows_dll(const char* name, char *ebuf, int ebuflen) return NULL; } +#define MIN_EXIT_MUTEXES 1 +#define MAX_EXIT_MUTEXES 16 + +struct ExitMutexes { + DWORD count; + HANDLE handles[MAX_EXIT_MUTEXES]; +}; + +static BOOL CALLBACK init_muts_call(PINIT_ONCE, PVOID ppmuts, PVOID*) { + static ExitMutexes muts; + + muts.count = os::processor_count(); + if (muts.count < MIN_EXIT_MUTEXES) { + muts.count = MIN_EXIT_MUTEXES; + } else if (muts.count > MAX_EXIT_MUTEXES) { + muts.count = MAX_EXIT_MUTEXES; + } + + for (DWORD i = 0; i < muts.count; ++i) { + muts.handles[i] = CreateMutex(NULL, FALSE, NULL); + if (muts.handles[i] == NULL) { + return FALSE; + } + } + *((ExitMutexes**)ppmuts) = &muts; + return TRUE; +} + +int os::win32::exit_process_or_thread(Ept what, int exit_code) { + if (os::win32::has_exit_bug()) { + static INIT_ONCE init_once_muts = INIT_ONCE_STATIC_INIT; + static ExitMutexes* pmuts; + + if (!InitOnceExecuteOnce(&init_once_muts, init_muts_call, &pmuts, NULL)) { + warning("ExitMutex initialization failed in %s: %d\n", __FILE__, __LINE__); + } else if (WaitForMultipleObjects(pmuts->count, pmuts->handles, + (what != EPT_THREAD), // exiting process waits for all mutexes + INFINITE) == WAIT_FAILED) { + warning("ExitMutex acquisition failed in %s: %d\n", __FILE__, __LINE__); + } + } + + switch (what) { + case EPT_THREAD: + _endthreadex((unsigned)exit_code); + break; + + case EPT_PROCESS: + ::exit(exit_code); + break; + + case EPT_PROCESS_DIE: + _exit(exit_code); + break; + } + + // should not reach here + return exit_code; +} + +#undef MIN_EXIT_MUTEXES +#undef MAX_EXIT_MUTEXES + void os::win32::setmode_streams() { _setmode(_fileno(stdin), _O_BINARY); _setmode(_fileno(stdout), _O_BINARY); diff --git a/hotspot/src/os/windows/vm/os_windows.hpp b/hotspot/src/os/windows/vm/os_windows.hpp index 46ea8aebde3..eb299ab36c9 100644 --- a/hotspot/src/os/windows/vm/os_windows.hpp +++ b/hotspot/src/os/windows/vm/os_windows.hpp @@ -36,6 +36,7 @@ static const char* path_separator() { return ";"; } class win32 { friend class os; + friend unsigned __stdcall java_start(class Thread*); protected: static int _vm_page_size; @@ -47,6 +48,7 @@ class win32 { static bool _is_nt; static bool _is_windows_2003; static bool _is_windows_server; + static bool _has_exit_bug; static bool _has_performance_count; static void print_windows_version(outputStream* st); @@ -69,8 +71,12 @@ class win32 { // load dll from Windows system directory or Windows directory static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen); - private: - static void initialize_performance_counter(); + private: + enum Ept { EPT_THREAD, EPT_PROCESS, EPT_PROCESS_DIE }; + // Wrapper around _endthreadex(), exit() and _exit() + static int exit_process_or_thread(Ept what, int exit_code); + + static void initialize_performance_counter(); public: // Generic interface: @@ -88,6 +94,9 @@ class win32 { // Tells whether the platform is Windows 2003 static bool is_windows_2003() { return _is_windows_2003; } + // Tells whether there can be the race bug during process exit on this platform + static bool has_exit_bug() { return _has_exit_bug; } + // Returns the byte size of a virtual memory page static int vm_page_size() { return _vm_page_size; } diff --git a/hotspot/src/os/windows/vm/os_windows.inline.hpp b/hotspot/src/os/windows/vm/os_windows.inline.hpp index 1e031f6aa79..deb8821ac70 100644 --- a/hotspot/src/os/windows/vm/os_windows.inline.hpp +++ b/hotspot/src/os/windows/vm/os_windows.inline.hpp @@ -100,6 +100,10 @@ inline bool os::supports_monotonic_clock() { return win32::_has_performance_count; } +inline void os::exit(int num) { + win32::exit_process_or_thread(win32::EPT_PROCESS, num); +} + #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) \ os::win32::call_test_func_with_wrapper(f) diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp index cf7865ecb0b..2cbf58deca0 100644 --- a/hotspot/src/share/vm/runtime/java.cpp +++ b/hotspot/src/share/vm/runtime/java.cpp @@ -430,8 +430,6 @@ extern "C" { } } -jint volatile vm_getting_terminated = 0; - // Note: before_exit() can be executed only once, if more than one threads // are trying to shutdown the VM at the same time, only one thread // can run before_exit() and all other threads must wait. @@ -462,8 +460,6 @@ void before_exit(JavaThread * thread) { } } - OrderAccess::release_store(&vm_getting_terminated, 1); - // The only difference between this and Win32's _onexit procs is that // this version is invoked before any threads get killed. ExitProc* current = exit_procs; @@ -587,7 +583,7 @@ void notify_vm_shutdown() { void vm_direct_exit(int code) { notify_vm_shutdown(); os::wait_for_keypress_at_exit(); - ::exit(code); + os::exit(code); } void vm_perform_shutdown_actions() { diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp index b81bf8d47e1..64406254ab9 100644 --- a/hotspot/src/share/vm/runtime/os.hpp +++ b/hotspot/src/share/vm/runtime/os.hpp @@ -482,8 +482,8 @@ class os: AllStatic { // run cmd in a separate process and return its exit code; or -1 on failures static int fork_and_exec(char *cmd); - // os::exit() is merged with vm_exit() - // static void exit(int num); + // Call ::exit() on all platforms but Windows + static void exit(int num); // Terminate the VM, but don't exit the process static void shutdown(); From e1a36d62a083306c60f7f7b24fc80f9c0add8720 Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Wed, 10 Sep 2014 11:48:20 -0600 Subject: [PATCH 15/81] 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket Reviewed-by: fparain, sspitsyn, coleenp --- hotspot/src/os/bsd/vm/os_bsd.cpp | 468 +-- hotspot/src/os/bsd/vm/os_bsd.hpp | 88 +- hotspot/src/os/linux/vm/os_linux.cpp | 616 ++-- hotspot/src/os/linux/vm/os_linux.hpp | 108 +- hotspot/src/os/solaris/vm/os_solaris.cpp | 688 ++-- hotspot/src/os/solaris/vm/os_solaris.hpp | 106 +- hotspot/src/os/windows/vm/os_windows.cpp | 1012 +++--- hotspot/src/share/vm/runtime/atomic.hpp | 16 +- hotspot/src/share/vm/runtime/mutex.cpp | 118 +- .../src/share/vm/runtime/objectMonitor.cpp | 2770 ++++++++--------- .../src/share/vm/runtime/objectMonitor.hpp | 22 +- .../src/share/vm/runtime/sharedRuntime.hpp | 8 +- hotspot/src/share/vm/runtime/synchronizer.cpp | 1038 +++--- hotspot/src/share/vm/runtime/thread.cpp | 374 +-- hotspot/src/share/vm/runtime/thread.hpp | 96 +- 15 files changed, 3764 insertions(+), 3764 deletions(-) diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp index 51e9f866cf2..40c12c3e938 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.cpp +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp @@ -260,11 +260,11 @@ void os::Bsd::initialize_system_info() { mib[1] = HW_NCPU; len = sizeof(cpu_val); if (sysctl(mib, 2, &cpu_val, &len, NULL, 0) != -1 && cpu_val >= 1) { - assert(len == sizeof(cpu_val), "unexpected data size"); - set_processor_count(cpu_val); + assert(len == sizeof(cpu_val), "unexpected data size"); + set_processor_count(cpu_val); } else { - set_processor_count(1); // fallback + set_processor_count(1); // fallback } /* get physical memory via hw.memsize sysctl (hw.memsize is used @@ -284,19 +284,19 @@ void os::Bsd::initialize_system_info() { len = sizeof(mem_val); if (sysctl(mib, 2, &mem_val, &len, NULL, 0) != -1) { - assert(len == sizeof(mem_val), "unexpected data size"); - _physical_memory = mem_val; + assert(len == sizeof(mem_val), "unexpected data size"); + _physical_memory = mem_val; } else { - _physical_memory = 256*1024*1024; // fallback (XXXBSD?) + _physical_memory = 256*1024*1024; // fallback (XXXBSD?) } #ifdef __OpenBSD__ { - // limit _physical_memory memory view on OpenBSD since - // datasize rlimit restricts us anyway. - struct rlimit limits; - getrlimit(RLIMIT_DATA, &limits); - _physical_memory = MIN2(_physical_memory, (julong)limits.rlim_cur); + // limit _physical_memory memory view on OpenBSD since + // datasize rlimit restricts us anyway. + struct rlimit limits; + getrlimit(RLIMIT_DATA, &limits); + _physical_memory = MIN2(_physical_memory, (julong)limits.rlim_cur); } #endif } @@ -561,14 +561,14 @@ debug_only(static bool signal_sets_initialized = false); static sigset_t unblocked_sigs, vm_sigs, allowdebug_blocked_sigs; bool os::Bsd::is_sig_ignored(int sig) { - struct sigaction oact; - sigaction(sig, (struct sigaction*)NULL, &oact); - void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction) - : CAST_FROM_FN_PTR(void*, oact.sa_handler); - if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) - return true; - else - return false; + struct sigaction oact; + sigaction(sig, (struct sigaction*)NULL, &oact); + void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction) + : CAST_FROM_FN_PTR(void*, oact.sa_handler); + if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) + return true; + else + return false; } void os::Bsd::signal_sets_init() { @@ -596,18 +596,18 @@ void os::Bsd::signal_sets_init() { sigaddset(&unblocked_sigs, SR_signum); if (!ReduceSignalUsage) { - if (!os::Bsd::is_sig_ignored(SHUTDOWN1_SIGNAL)) { + if (!os::Bsd::is_sig_ignored(SHUTDOWN1_SIGNAL)) { sigaddset(&unblocked_sigs, SHUTDOWN1_SIGNAL); sigaddset(&allowdebug_blocked_sigs, SHUTDOWN1_SIGNAL); - } - if (!os::Bsd::is_sig_ignored(SHUTDOWN2_SIGNAL)) { + } + if (!os::Bsd::is_sig_ignored(SHUTDOWN2_SIGNAL)) { sigaddset(&unblocked_sigs, SHUTDOWN2_SIGNAL); sigaddset(&allowdebug_blocked_sigs, SHUTDOWN2_SIGNAL); - } - if (!os::Bsd::is_sig_ignored(SHUTDOWN3_SIGNAL)) { + } + if (!os::Bsd::is_sig_ignored(SHUTDOWN3_SIGNAL)) { sigaddset(&unblocked_sigs, SHUTDOWN3_SIGNAL); sigaddset(&allowdebug_blocked_sigs, SHUTDOWN3_SIGNAL); - } + } } // Fill in signals that are blocked by all but the VM thread. sigemptyset(&vm_sigs); @@ -846,9 +846,9 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { // Aborted due to thread limit being reached if (state == ZOMBIE) { - thread->set_osthread(NULL); - delete osthread; - return false; + thread->set_osthread(NULL); + delete osthread; + return false; } // The thread is returned suspended (in state INITIALIZED), @@ -868,7 +868,7 @@ bool os::create_main_thread(JavaThread* thread) { bool os::create_attached_thread(JavaThread* thread) { #ifdef ASSERT - thread->verify_not_published(); + thread->verify_not_published(); #endif // Allocate the OSThread object @@ -919,7 +919,7 @@ void os::free_thread(OSThread* osthread) { // Restore caller's signal mask sigset_t sigmask = osthread->caller_sigmask(); pthread_sigmask(SIG_SETMASK, &sigmask, NULL); - } + } delete osthread; } @@ -1023,27 +1023,27 @@ void os::Bsd::clock_init() { #ifdef __APPLE__ jlong os::javaTimeNanos() { - const uint64_t tm = mach_absolute_time(); - const uint64_t now = (tm * Bsd::_timebase_info.numer) / Bsd::_timebase_info.denom; - const uint64_t prev = Bsd::_max_abstime; - if (now <= prev) { - return prev; // same or retrograde time; - } - const uint64_t obsv = Atomic::cmpxchg(now, (volatile jlong*)&Bsd::_max_abstime, prev); - assert(obsv >= prev, "invariant"); // Monotonicity - // If the CAS succeeded then we're done and return "now". - // If the CAS failed and the observed value "obsv" is >= now then - // we should return "obsv". If the CAS failed and now > obsv > prv then - // some other thread raced this thread and installed a new value, in which case - // we could either (a) retry the entire operation, (b) retry trying to install now - // or (c) just return obsv. We use (c). No loop is required although in some cases - // we might discard a higher "now" value in deference to a slightly lower but freshly - // installed obsv value. That's entirely benign -- it admits no new orderings compared - // to (a) or (b) -- and greatly reduces coherence traffic. - // We might also condition (c) on the magnitude of the delta between obsv and now. - // Avoiding excessive CAS operations to hot RW locations is critical. - // See https://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate - return (prev == obsv) ? now : obsv; + const uint64_t tm = mach_absolute_time(); + const uint64_t now = (tm * Bsd::_timebase_info.numer) / Bsd::_timebase_info.denom; + const uint64_t prev = Bsd::_max_abstime; + if (now <= prev) { + return prev; // same or retrograde time; + } + const uint64_t obsv = Atomic::cmpxchg(now, (volatile jlong*)&Bsd::_max_abstime, prev); + assert(obsv >= prev, "invariant"); // Monotonicity + // If the CAS succeeded then we're done and return "now". + // If the CAS failed and the observed value "obsv" is >= now then + // we should return "obsv". If the CAS failed and now > obsv > prv then + // some other thread raced this thread and installed a new value, in which case + // we could either (a) retry the entire operation, (b) retry trying to install now + // or (c) just return obsv. We use (c). No loop is required although in some cases + // we might discard a higher "now" value in deference to a slightly lower but freshly + // installed obsv value. That's entirely benign -- it admits no new orderings compared + // to (a) or (b) -- and greatly reduces coherence traffic. + // We might also condition (c) on the magnitude of the delta between obsv and now. + // Avoiding excessive CAS operations to hot RW locations is critical. + // See https://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate + return (prev == obsv) ? now : obsv; } #else // __APPLE__ @@ -1307,7 +1307,7 @@ bool os::dll_build_name(char* buffer, size_t buflen, continue; // skip the empty path values } snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, - pelements[i], fname); + pelements[i], fname); if (file_exists(buffer)) { retval = true; break; @@ -1372,14 +1372,14 @@ bool os::dll_address_to_function_name(address addr, char *buf, if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), buf, buflen, offset, dlinfo.dli_fname)) { - return true; + return true; } } // Handle non-dynamic manually: if (dlinfo.dli_fbase != NULL && Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, - dlinfo.dli_fbase)) { + dlinfo.dli_fbase)) { if (!Decoder::demangle(localbuf, buf, buflen)) { jio_snprintf(buf, buflen, "%s", localbuf); } @@ -1465,7 +1465,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) bool failed_to_read_elf_head= (sizeof(elf_head)!= - (::read(file_descriptor, &elf_head,sizeof(elf_head)))); + (::read(file_descriptor, &elf_head,sizeof(elf_head)))); ::close(file_descriptor); if (failed_to_read_elf_head) { @@ -1525,33 +1525,33 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) }; #if (defined IA32) - static Elf32_Half running_arch_code=EM_386; + static Elf32_Half running_arch_code=EM_386; #elif (defined AMD64) - static Elf32_Half running_arch_code=EM_X86_64; + static Elf32_Half running_arch_code=EM_X86_64; #elif (defined IA64) - static Elf32_Half running_arch_code=EM_IA_64; + static Elf32_Half running_arch_code=EM_IA_64; #elif (defined __sparc) && (defined _LP64) - static Elf32_Half running_arch_code=EM_SPARCV9; + static Elf32_Half running_arch_code=EM_SPARCV9; #elif (defined __sparc) && (!defined _LP64) - static Elf32_Half running_arch_code=EM_SPARC; + static Elf32_Half running_arch_code=EM_SPARC; #elif (defined __powerpc64__) - static Elf32_Half running_arch_code=EM_PPC64; + static Elf32_Half running_arch_code=EM_PPC64; #elif (defined __powerpc__) - static Elf32_Half running_arch_code=EM_PPC; + static Elf32_Half running_arch_code=EM_PPC; #elif (defined ARM) - static Elf32_Half running_arch_code=EM_ARM; + static Elf32_Half running_arch_code=EM_ARM; #elif (defined S390) - static Elf32_Half running_arch_code=EM_S390; + static Elf32_Half running_arch_code=EM_S390; #elif (defined ALPHA) - static Elf32_Half running_arch_code=EM_ALPHA; + static Elf32_Half running_arch_code=EM_ALPHA; #elif (defined MIPSEL) - static Elf32_Half running_arch_code=EM_MIPS_RS3_LE; + static Elf32_Half running_arch_code=EM_MIPS_RS3_LE; #elif (defined PARISC) - static Elf32_Half running_arch_code=EM_PARISC; + static Elf32_Half running_arch_code=EM_PARISC; #elif (defined MIPS) - static Elf32_Half running_arch_code=EM_MIPS; + static Elf32_Half running_arch_code=EM_MIPS; #elif (defined M68K) - static Elf32_Half running_arch_code=EM_68K; + static Elf32_Half running_arch_code=EM_68K; #else #error Method os::dll_load requires that one of following is defined:\ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K @@ -1574,7 +1574,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) } assert(running_arch_index != -1, - "Didn't find running architecture code (running_arch_code) in arch_array"); + "Didn't find running architecture code (running_arch_code) in arch_array"); if (running_arch_index == -1) { // Even though running architecture detection failed // we may still continue with reporting dlerror() message @@ -1596,13 +1596,13 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) { if (lib_arch.name!=NULL) { ::snprintf(diag_msg_buf, diag_msg_max_length-1, - " (Possible cause: can't load %s-bit .so on a %s-bit platform)", - lib_arch.name, arch_array[running_arch_index].name); + " (Possible cause: can't load %s-bit .so on a %s-bit platform)", + lib_arch.name, arch_array[running_arch_index].name); } else { ::snprintf(diag_msg_buf, diag_msg_max_length-1, - " (Possible cause: can't load this .so (machine code=0x%x) on a %s-bit platform)", - lib_arch.code, - arch_array[running_arch_index].name); + " (Possible cause: can't load this .so (machine code=0x%x) on a %s-bit platform)", + lib_arch.code, + arch_array[running_arch_index].name); } } @@ -1630,7 +1630,7 @@ void* os::dll_lookup(void* handle, const char* name) { static bool _print_ascii_file(const char* filename, outputStream* st) { int fd = ::open(filename, O_RDONLY); if (fd == -1) { - return false; + return false; } char buf[32]; @@ -1785,8 +1785,8 @@ void os::jvm_path(char *buf, jint buflen) { char dli_fname[MAXPATHLEN]; bool ret = dll_address_to_library_name( - CAST_FROM_FN_PTR(address, os::jvm_path), - dli_fname, sizeof(dli_fname), NULL); + CAST_FROM_FN_PTR(address, os::jvm_path), + dli_fname, sizeof(dli_fname), NULL); assert(ret, "cannot locate libjvm"); char *rp = NULL; if (ret && dli_fname[0] != '\0') { @@ -1884,12 +1884,12 @@ UserHandler(int sig, void *siginfo, void *context) { // the program is interrupted by Ctrl-C, SIGINT is sent to every thread. We // don't want to flood the manager thread with sem_post requests. if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1) - return; + return; // Ctrl-C is pressed during error reporting, likely because the error // handler fails to abort. Let VM die immediately. if (sig == SIGINT && is_error_reported()) { - os::die(); + os::die(); } os::signal_notify(sig); @@ -1952,16 +1952,16 @@ typedef sem_t os_semaphore_t; #endif class Semaphore : public StackObj { - public: - Semaphore(); - ~Semaphore(); - void signal(); - void wait(); - bool trywait(); - bool timedwait(unsigned int sec, int nsec); - private: - jlong currenttime() const; - os_semaphore_t _semaphore; + public: + Semaphore(); + ~Semaphore(); + void signal(); + void wait(); + bool trywait(); + bool timedwait(unsigned int sec, int nsec); + private: + jlong currenttime() const; + os_semaphore_t _semaphore; }; Semaphore::Semaphore() : _semaphore(0) { @@ -1981,9 +1981,9 @@ void Semaphore::wait() { } jlong Semaphore::currenttime() const { - struct timeval tv; - gettimeofday(&tv, NULL); - return (tv.tv_sec * NANOSECS_PER_SEC) + (tv.tv_usec * 1000); + struct timeval tv; + gettimeofday(&tv, NULL); + return (tv.tv_sec * NANOSECS_PER_SEC) + (tv.tv_usec * 1000); } #ifdef __APPLE__ @@ -2180,7 +2180,7 @@ bool os::pd_commit_memory(char* addr, size_t size, bool exec) { } #else uintptr_t res = (uintptr_t) ::mmap(addr, size, prot, - MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0); + MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0); if (res != (uintptr_t) MAP_FAILED) { return true; } @@ -2194,7 +2194,7 @@ bool os::pd_commit_memory(char* addr, size_t size, bool exec) { } bool os::pd_commit_memory(char* addr, size_t size, size_t alignment_hint, - bool exec) { + bool exec) { // alignment_hint is ignored on this OS return pd_commit_memory(addr, size, exec); } @@ -2262,7 +2262,7 @@ bool os::pd_uncommit_memory(char* addr, size_t size) { return ::mprotect(addr, size, PROT_NONE) == 0; #else uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE, - MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0); + MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0); return res != (uintptr_t) MAP_FAILED; #endif } @@ -2323,7 +2323,7 @@ static int anon_munmap(char * addr, size_t size) { } char* os::pd_reserve_memory(size_t bytes, char* requested_addr, - size_t alignment_hint) { + size_t alignment_hint) { return anon_mmap(requested_addr, bytes, (requested_addr != NULL)); } @@ -2401,24 +2401,24 @@ char* os::reserve_memory_special(size_t bytes, size_t alignment, char* req_addr, // Currently, size is the total size of the heap int shmid = shmget(key, bytes, IPC_CREAT|SHM_R|SHM_W); if (shmid == -1) { - // Possible reasons for shmget failure: - // 1. shmmax is too small for Java heap. - // > check shmmax value: cat /proc/sys/kernel/shmmax - // > increase shmmax value: echo "0xffffffff" > /proc/sys/kernel/shmmax - // 2. not enough large page memory. - // > check available large pages: cat /proc/meminfo - // > increase amount of large pages: - // echo new_value > /proc/sys/vm/nr_hugepages - // Note 1: different Bsd may use different name for this property, - // e.g. on Redhat AS-3 it is "hugetlb_pool". - // Note 2: it's possible there's enough physical memory available but - // they are so fragmented after a long run that they can't - // coalesce into large pages. Try to reserve large pages when - // the system is still "fresh". - if (warn_on_failure) { - warning("Failed to reserve shared memory (errno = %d).", errno); - } - return NULL; + // Possible reasons for shmget failure: + // 1. shmmax is too small for Java heap. + // > check shmmax value: cat /proc/sys/kernel/shmmax + // > increase shmmax value: echo "0xffffffff" > /proc/sys/kernel/shmmax + // 2. not enough large page memory. + // > check available large pages: cat /proc/meminfo + // > increase amount of large pages: + // echo new_value > /proc/sys/vm/nr_hugepages + // Note 1: different Bsd may use different name for this property, + // e.g. on Redhat AS-3 it is "hugetlb_pool". + // Note 2: it's possible there's enough physical memory available but + // they are so fragmented after a long run that they can't + // coalesce into large pages. Try to reserve large pages when + // the system is still "fresh". + if (warn_on_failure) { + warning("Failed to reserve shared memory (errno = %d).", errno); + } + return NULL; } // attach to the region @@ -2432,10 +2432,10 @@ char* os::reserve_memory_special(size_t bytes, size_t alignment, char* req_addr, shmctl(shmid, IPC_RMID, NULL); if ((intptr_t)addr == -1) { - if (warn_on_failure) { - warning("Failed to attach shared memory (errno = %d).", err); - } - return NULL; + if (warn_on_failure) { + warning("Failed to attach shared memory (errno = %d).", err); + } + return NULL; } // The memory is committed @@ -2506,12 +2506,12 @@ char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) { // if kernel honors the hint then we can return immediately. char * addr = anon_mmap(requested_addr, bytes, false); if (addr == requested_addr) { - return requested_addr; + return requested_addr; } if (addr != NULL) { - // mmap() is successful but it fails to reserve at the requested address - anon_munmap(addr, bytes); + // mmap() is successful but it fails to reserve at the requested address + anon_munmap(addr, bytes); } int i; @@ -2839,12 +2839,12 @@ static int SR_initialize() { if ((s = ::getenv("_JAVA_SR_SIGNUM")) != 0) { int sig = ::strtol(s, 0, 10); if (sig > 0 || sig < NSIG) { - SR_signum = sig; + SR_signum = sig; } } assert(SR_signum > SIGSEGV && SR_signum > SIGBUS, - "SR_signum must be greater than max(SIGSEGV, SIGBUS), see 4355769"); + "SR_signum must be greater than max(SIGSEGV, SIGBUS), see 4355769"); sigemptyset(&SR_sigset); sigaddset(&SR_sigset, SR_signum); @@ -2977,7 +2977,7 @@ static void do_resume(OSThread* osthread) { // extern "C" JNIEXPORT int JVM_handle_bsd_signal(int signo, siginfo_t* siginfo, - void* ucontext, int abort_if_unrecognized); + void* ucontext, int abort_if_unrecognized); void signalHandler(int sig, siginfo_t* info, void* uc) { assert(info != NULL && uc != NULL, "it must be old kernel"); @@ -3168,12 +3168,12 @@ void os::Bsd::install_signal_handlers() { signal_setting_t begin_signal_setting = NULL; signal_setting_t end_signal_setting = NULL; begin_signal_setting = CAST_TO_FN_PTR(signal_setting_t, - dlsym(RTLD_DEFAULT, "JVM_begin_signal_setting")); + dlsym(RTLD_DEFAULT, "JVM_begin_signal_setting")); if (begin_signal_setting != NULL) { end_signal_setting = CAST_TO_FN_PTR(signal_setting_t, - dlsym(RTLD_DEFAULT, "JVM_end_signal_setting")); + dlsym(RTLD_DEFAULT, "JVM_end_signal_setting")); get_signal_action = CAST_TO_FN_PTR(get_signal_t, - dlsym(RTLD_DEFAULT, "JVM_get_signal_action")); + dlsym(RTLD_DEFAULT, "JVM_get_signal_action")); libjsig_is_loaded = true; assert(UseSignalChaining, "should enable signal-chaining"); } @@ -3203,10 +3203,10 @@ void os::Bsd::install_signal_handlers() { // exception handling, while leaving the standard BSD signal handlers functional. kern_return_t kr; kr = task_set_exception_ports(mach_task_self(), - EXC_MASK_BAD_ACCESS | EXC_MASK_ARITHMETIC, - MACH_PORT_NULL, - EXCEPTION_STATE_IDENTITY, - MACHINE_THREAD_STATE); + EXC_MASK_BAD_ACCESS | EXC_MASK_ARITHMETIC, + MACH_PORT_NULL, + EXCEPTION_STATE_IDENTITY, + MACHINE_THREAD_STATE); assert(kr == KERN_SUCCESS, "could not set mach task signal handler"); #endif @@ -3302,7 +3302,7 @@ static void print_signal_handler(outputStream* st, int sig, // Check: is it our handler? if (handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) || - handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler)) { + handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler)) { // It is our signal handler // check for flags, reset system-used one! if ((int)sa.sa_flags != os::Bsd::get_our_sigflags(sig)) { @@ -3542,22 +3542,22 @@ jint os::init_2(void) // Add in 2*BytesPerWord times page size to account for VM stack during // class initialization depending on 32 or 64 bit VM. os::Bsd::min_stack_allowed = MAX2(os::Bsd::min_stack_allowed, - (size_t)(StackYellowPages+StackRedPages+StackShadowPages+ - 2*BytesPerWord COMPILER2_PRESENT(+1)) * Bsd::page_size()); + (size_t)(StackYellowPages+StackRedPages+StackShadowPages+ + 2*BytesPerWord COMPILER2_PRESENT(+1)) * Bsd::page_size()); size_t threadStackSizeInBytes = ThreadStackSize * K; if (threadStackSizeInBytes != 0 && threadStackSizeInBytes < os::Bsd::min_stack_allowed) { - tty->print_cr("\nThe stack size specified is too small, " - "Specify at least %dk", - os::Bsd::min_stack_allowed/ K); - return JNI_ERR; + tty->print_cr("\nThe stack size specified is too small, " + "Specify at least %dk", + os::Bsd::min_stack_allowed/ K); + return JNI_ERR; } // Make the stack size a multiple of the page size so that // the yellow/red zones can be guarded. JavaThread::set_stack_size_at_create(round_to(threadStackSizeInBytes, - vm_page_size())); + vm_page_size())); if (MaxFDLimit) { // set the number of file descriptors to max. print out error @@ -3670,12 +3670,12 @@ void os::SuspendedThreadTask::internal_do_task() { /// class PcFetcher : public os::SuspendedThreadTask { -public: + public: PcFetcher(Thread* thread) : os::SuspendedThreadTask(thread) {} ExtendedPC result(); -protected: + protected: void do_task(const os::SuspendedThreadTaskContext& context); -private: + private: ExtendedPC _epc; }; @@ -3722,7 +3722,7 @@ bool os::find(address addr, outputStream* st) { st->print(PTR_FORMAT ": ", addr); if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { st->print("%s+%#x", dlinfo.dli_sname, - addr - (intptr_t)dlinfo.dli_saddr); + addr - (intptr_t)dlinfo.dli_saddr); } else if (dlinfo.dli_fbase != NULL) { st->print("", addr - (intptr_t)dlinfo.dli_fbase); } else { @@ -3892,11 +3892,11 @@ int os::open(const char *path, int oflag, int mode) { * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9 */ #ifdef FD_CLOEXEC - { - int flags = ::fcntl(fd, F_GETFD); - if (flags != -1) - ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC); - } + { + int flags = ::fcntl(fd, F_GETFD); + if (flags != -1) + ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC); + } #endif if (o_delete != 0) { @@ -3960,23 +3960,23 @@ int os::available(int fd, jlong *bytes) { } int os::socket_available(int fd, jint *pbytes) { - if (fd < 0) - return OS_OK; + if (fd < 0) + return OS_OK; - int ret; + int ret; - RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret); + RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret); - //%% note ioctl can return 0 when successful, JVM_SocketAvailable - // is expected to return 0 on failure and 1 on success to the jdk. + //%% note ioctl can return 0 when successful, JVM_SocketAvailable + // is expected to return 0 on failure and 1 on success to the jdk. - return (ret == OS_ERR) ? 0 : 1; + return (ret == OS_ERR) ? 0 : 1; } // Map a block of memory. char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset, - char *addr, size_t bytes, bool read_only, - bool allow_exec) { + char *addr, size_t bytes, bool read_only, + bool allow_exec) { int prot; int flags; @@ -4007,8 +4007,8 @@ char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset, // Remap a block of memory. char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset, - char *addr, size_t bytes, bool read_only, - bool allow_exec) { + char *addr, size_t bytes, bool read_only, + bool allow_exec) { // same as map_memory() on this OS return os::map_memory(fd, file_name, file_offset, addr, bytes, read_only, allow_exec); @@ -4127,7 +4127,7 @@ void os::pause() { } } else { jio_fprintf(stderr, - "Could not open pause file '%s', continuing immediately.\n", filename); + "Could not open pause file '%s', continuing immediately.\n", filename); } } @@ -4223,28 +4223,28 @@ void os::PlatformEvent::park() { // AKA "down()" int v; for (;;) { - v = _Event; - if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; + v = _Event; + if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; } guarantee(v >= 0, "invariant"); if (v == 0) { - // Do this the hard way by blocking ... - int status = pthread_mutex_lock(_mutex); - assert_status(status == 0, status, "mutex_lock"); - guarantee(_nParked == 0, "invariant"); - ++_nParked; - while (_Event < 0) { - status = pthread_cond_wait(_cond, _mutex); - // for some reason, under 2.7 lwp_cond_wait() may return ETIME ... - // Treat this the same as if the wait was interrupted - if (status == ETIMEDOUT) { status = EINTR; } - assert_status(status == 0 || status == EINTR, status, "cond_wait"); - } - --_nParked; + // Do this the hard way by blocking ... + int status = pthread_mutex_lock(_mutex); + assert_status(status == 0, status, "mutex_lock"); + guarantee(_nParked == 0, "invariant"); + ++_nParked; + while (_Event < 0) { + status = pthread_cond_wait(_cond, _mutex); + // for some reason, under 2.7 lwp_cond_wait() may return ETIME ... + // Treat this the same as if the wait was interrupted + if (status == ETIMEDOUT) { status = EINTR; } + assert_status(status == 0 || status == EINTR, status, "cond_wait"); + } + --_nParked; _Event = 0; - status = pthread_mutex_unlock(_mutex); - assert_status(status == 0, status, "mutex_unlock"); + status = pthread_mutex_unlock(_mutex); + assert_status(status == 0, status, "mutex_unlock"); // Paranoia to ensure our locked and lock-free paths interact // correctly with each other. OrderAccess::fence(); @@ -4257,8 +4257,8 @@ int os::PlatformEvent::park(jlong millis) { int v; for (;;) { - v = _Event; - if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; + v = _Event; + if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; } guarantee(v >= 0, "invariant"); if (v != 0) return OS_OK; @@ -4302,7 +4302,7 @@ int os::PlatformEvent::park(jlong millis) { } --_nParked; if (_Event >= 0) { - ret = OS_OK; + ret = OS_OK; } _Event = 0; status = pthread_mutex_unlock(_mutex); @@ -4532,17 +4532,17 @@ void Parker::unpark() { const int s = _counter; _counter = 1; if (s < 1) { - if (WorkAroundNPTLTimedWaitHang) { - status = pthread_cond_signal(_cond); - assert(status == 0, "invariant"); - status = pthread_mutex_unlock(_mutex); - assert(status == 0, "invariant"); - } else { - status = pthread_mutex_unlock(_mutex); - assert(status == 0, "invariant"); - status = pthread_cond_signal(_cond); - assert(status == 0, "invariant"); - } + if (WorkAroundNPTLTimedWaitHang) { + status = pthread_cond_signal(_cond); + assert(status == 0, "invariant"); + status = pthread_mutex_unlock(_mutex); + assert(status == 0, "invariant"); + } else { + status = pthread_mutex_unlock(_mutex); + assert(status == 0, "invariant"); + status = pthread_cond_signal(_cond); + assert(status == 0, "invariant"); + } } else { pthread_mutex_unlock(_mutex); assert(status == 0, "invariant"); @@ -4600,26 +4600,26 @@ int os::fork_and_exec(char* cmd) { // Wait for the child process to exit. This returns immediately if // the child has already exited. */ while (waitpid(pid, &status, 0) < 0) { - switch (errno) { - case ECHILD: return 0; - case EINTR: break; - default: return -1; - } + switch (errno) { + case ECHILD: return 0; + case EINTR: break; + default: return -1; + } } if (WIFEXITED(status)) { - // The child exited normally; get its exit code. - return WEXITSTATUS(status); + // The child exited normally; get its exit code. + return WEXITSTATUS(status); } else if (WIFSIGNALED(status)) { - // The child exited because of a signal - // The best value to return is 0x80 + signal number, - // because that is what all Unix shells do, and because - // it allows callers to distinguish between process exit and - // process death by signal. - return 0x80 + WTERMSIG(status); + // The child exited because of a signal + // The best value to return is 0x80 + signal number, + // because that is what all Unix shells do, and because + // it allows callers to distinguish between process exit and + // process death by signal. + return 0x80 + WTERMSIG(status); } else { - // Unknown exit code; pass it through - return status; + // Unknown exit code; pass it through + return status; } } } @@ -4634,40 +4634,40 @@ int os::fork_and_exec(char* cmd) { // bool os::is_headless_jre() { #ifdef __APPLE__ - // We no longer build headless-only on Mac OS X - return false; + // We no longer build headless-only on Mac OS X + return false; #else - struct stat statbuf; - char buf[MAXPATHLEN]; - char libmawtpath[MAXPATHLEN]; - const char *xawtstr = "/xawt/libmawt" JNI_LIB_SUFFIX; - const char *new_xawtstr = "/libawt_xawt" JNI_LIB_SUFFIX; - char *p; + struct stat statbuf; + char buf[MAXPATHLEN]; + char libmawtpath[MAXPATHLEN]; + const char *xawtstr = "/xawt/libmawt" JNI_LIB_SUFFIX; + const char *new_xawtstr = "/libawt_xawt" JNI_LIB_SUFFIX; + char *p; - // Get path to libjvm.so - os::jvm_path(buf, sizeof(buf)); + // Get path to libjvm.so + os::jvm_path(buf, sizeof(buf)); - // Get rid of libjvm.so - p = strrchr(buf, '/'); - if (p == NULL) return false; - else *p = '\0'; + // Get rid of libjvm.so + p = strrchr(buf, '/'); + if (p == NULL) return false; + else *p = '\0'; - // Get rid of client or server - p = strrchr(buf, '/'); - if (p == NULL) return false; - else *p = '\0'; + // Get rid of client or server + p = strrchr(buf, '/'); + if (p == NULL) return false; + else *p = '\0'; - // check xawt/libmawt.so - strcpy(libmawtpath, buf); - strcat(libmawtpath, xawtstr); - if (::stat(libmawtpath, &statbuf) == 0) return false; + // check xawt/libmawt.so + strcpy(libmawtpath, buf); + strcat(libmawtpath, xawtstr); + if (::stat(libmawtpath, &statbuf) == 0) return false; - // check libawt_xawt.so - strcpy(libmawtpath, buf); - strcat(libmawtpath, new_xawtstr); - if (::stat(libmawtpath, &statbuf) == 0) return false; + // check libawt_xawt.so + strcpy(libmawtpath, buf); + strcat(libmawtpath, new_xawtstr); + if (::stat(libmawtpath, &statbuf) == 0) return false; - return true; + return true; #endif } diff --git a/hotspot/src/os/bsd/vm/os_bsd.hpp b/hotspot/src/os/bsd/vm/os_bsd.hpp index 2c1ebaf5eea..ed31695cd4a 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.hpp +++ b/hotspot/src/os/bsd/vm/os_bsd.hpp @@ -108,7 +108,7 @@ class Bsd { // that file provides extensions to the os class and not the // Bsd class. static ExtendedPC fetch_frame_from_ucontext(Thread* thread, ucontext_t* uc, - intptr_t** ret_sp, intptr_t** ret_fp); + intptr_t** ret_sp, intptr_t** ret_fp); // This boolean allows users to forward their own non-matching signals // to JVM_handle_bsd_signal, harmlessly. @@ -147,7 +147,7 @@ class Bsd { // BsdThreads work-around for 6292965 static int safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime); -private: + private: typedef int (*sched_getcpu_func_t)(void); typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen); typedef int (*numa_max_node_func_t)(void); @@ -170,7 +170,7 @@ private: static void set_numa_tonode_memory(numa_tonode_memory_func_t func) { _numa_tonode_memory = func; } static void set_numa_interleave_memory(numa_interleave_memory_func_t func) { _numa_interleave_memory = func; } static void set_numa_all_nodes(unsigned long* ptr) { _numa_all_nodes = ptr; } -public: + public: static int sched_getcpu() { return _sched_getcpu != NULL ? _sched_getcpu() : -1; } static int numa_node_to_cpus(int node, unsigned long *buffer, int bufferlen) { return _numa_node_to_cpus != NULL ? _numa_node_to_cpus(node, buffer, bufferlen) : -1; @@ -190,55 +190,55 @@ public: class PlatformEvent : public CHeapObj { - private: - double CachePad[4]; // increase odds that _mutex is sole occupant of cache line - volatile int _Event; - volatile int _nParked; - pthread_mutex_t _mutex[1]; - pthread_cond_t _cond[1]; - double PostPad[2]; - Thread * _Assoc; + private: + double CachePad[4]; // increase odds that _mutex is sole occupant of cache line + volatile int _Event; + volatile int _nParked; + pthread_mutex_t _mutex[1]; + pthread_cond_t _cond[1]; + double PostPad[2]; + Thread * _Assoc; - public: // TODO-FIXME: make dtor private - ~PlatformEvent() { guarantee(0, "invariant"); } + public: // TODO-FIXME: make dtor private + ~PlatformEvent() { guarantee(0, "invariant"); } - public: - PlatformEvent() { - int status; - status = pthread_cond_init (_cond, NULL); - assert_status(status == 0, status, "cond_init"); - status = pthread_mutex_init (_mutex, NULL); - assert_status(status == 0, status, "mutex_init"); - _Event = 0; - _nParked = 0; - _Assoc = NULL; - } + public: + PlatformEvent() { + int status; + status = pthread_cond_init (_cond, NULL); + assert_status(status == 0, status, "cond_init"); + status = pthread_mutex_init (_mutex, NULL); + assert_status(status == 0, status, "mutex_init"); + _Event = 0; + _nParked = 0; + _Assoc = NULL; + } - // Use caution with reset() and fired() -- they may require MEMBARs - void reset() { _Event = 0; } - int fired() { return _Event; } - void park(); - void unpark(); - int park(jlong millis); - void SetAssociation(Thread * a) { _Assoc = a; } + // Use caution with reset() and fired() -- they may require MEMBARs + void reset() { _Event = 0; } + int fired() { return _Event; } + void park(); + void unpark(); + int park(jlong millis); + void SetAssociation(Thread * a) { _Assoc = a; } }; class PlatformParker : public CHeapObj { - protected: - pthread_mutex_t _mutex[1]; - pthread_cond_t _cond[1]; + protected: + pthread_mutex_t _mutex[1]; + pthread_cond_t _cond[1]; - public: // TODO-FIXME: make dtor private - ~PlatformParker() { guarantee(0, "invariant"); } + public: // TODO-FIXME: make dtor private + ~PlatformParker() { guarantee(0, "invariant"); } - public: - PlatformParker() { - int status; - status = pthread_cond_init (_cond, NULL); - assert_status(status == 0, status, "cond_init"); - status = pthread_mutex_init (_mutex, NULL); - assert_status(status == 0, status, "mutex_init"); - } + public: + PlatformParker() { + int status; + status = pthread_cond_init (_cond, NULL); + assert_status(status == 0, status, "cond_init"); + status = pthread_mutex_init (_mutex, NULL); + assert_status(status == 0, status, "mutex_init"); + } }; #endif // OS_BSD_VM_OS_BSD_HPP diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 586f46a26b3..fb06bf0f87c 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -290,10 +290,10 @@ static char cpu_arch[] = "sparc"; pid_t os::Linux::gettid() { int rslt = syscall(SYS_gettid); if (rslt == -1) { - // old kernel, no NPTL support - return getpid(); + // old kernel, no NPTL support + return getpid(); } else { - return (pid_t)rslt; + return (pid_t)rslt; } } @@ -465,14 +465,14 @@ debug_only(static bool signal_sets_initialized = false); static sigset_t unblocked_sigs, vm_sigs, allowdebug_blocked_sigs; bool os::Linux::is_sig_ignored(int sig) { - struct sigaction oact; - sigaction(sig, (struct sigaction*)NULL, &oact); - void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction) - : CAST_FROM_FN_PTR(void*, oact.sa_handler); - if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) - return true; - else - return false; + struct sigaction oact; + sigaction(sig, (struct sigaction*)NULL, &oact); + void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction) + : CAST_FROM_FN_PTR(void*, oact.sa_handler); + if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) + return true; + else + return false; } void os::Linux::signal_sets_init() { @@ -503,18 +503,18 @@ void os::Linux::signal_sets_init() { sigaddset(&unblocked_sigs, SR_signum); if (!ReduceSignalUsage) { - if (!os::Linux::is_sig_ignored(SHUTDOWN1_SIGNAL)) { + if (!os::Linux::is_sig_ignored(SHUTDOWN1_SIGNAL)) { sigaddset(&unblocked_sigs, SHUTDOWN1_SIGNAL); sigaddset(&allowdebug_blocked_sigs, SHUTDOWN1_SIGNAL); - } - if (!os::Linux::is_sig_ignored(SHUTDOWN2_SIGNAL)) { + } + if (!os::Linux::is_sig_ignored(SHUTDOWN2_SIGNAL)) { sigaddset(&unblocked_sigs, SHUTDOWN2_SIGNAL); sigaddset(&allowdebug_blocked_sigs, SHUTDOWN2_SIGNAL); - } - if (!os::Linux::is_sig_ignored(SHUTDOWN3_SIGNAL)) { + } + if (!os::Linux::is_sig_ignored(SHUTDOWN3_SIGNAL)) { sigaddset(&unblocked_sigs, SHUTDOWN3_SIGNAL); sigaddset(&allowdebug_blocked_sigs, SHUTDOWN3_SIGNAL); - } + } } // Fill in signals that are blocked by all but the VM thread. sigemptyset(&vm_sigs); @@ -583,50 +583,50 @@ void os::Linux::libpthread_init() { size_t n = confstr(_CS_GNU_LIBC_VERSION, NULL, 0); if (n > 0) { - char *str = (char *)malloc(n, mtInternal); - confstr(_CS_GNU_LIBC_VERSION, str, n); - os::Linux::set_glibc_version(str); + char *str = (char *)malloc(n, mtInternal); + confstr(_CS_GNU_LIBC_VERSION, str, n); + os::Linux::set_glibc_version(str); } else { - // _CS_GNU_LIBC_VERSION is not supported, try gnu_get_libc_version() - static char _gnu_libc_version[32]; - jio_snprintf(_gnu_libc_version, sizeof(_gnu_libc_version), - "glibc %s %s", gnu_get_libc_version(), gnu_get_libc_release()); - os::Linux::set_glibc_version(_gnu_libc_version); + // _CS_GNU_LIBC_VERSION is not supported, try gnu_get_libc_version() + static char _gnu_libc_version[32]; + jio_snprintf(_gnu_libc_version, sizeof(_gnu_libc_version), + "glibc %s %s", gnu_get_libc_version(), gnu_get_libc_release()); + os::Linux::set_glibc_version(_gnu_libc_version); } n = confstr(_CS_GNU_LIBPTHREAD_VERSION, NULL, 0); if (n > 0) { - char *str = (char *)malloc(n, mtInternal); - confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n); - // Vanilla RH-9 (glibc 2.3.2) has a bug that confstr() always tells - // us "NPTL-0.29" even we are running with LinuxThreads. Check if this - // is the case. LinuxThreads has a hard limit on max number of threads. - // So sysconf(_SC_THREAD_THREADS_MAX) will return a positive value. - // On the other hand, NPTL does not have such a limit, sysconf() - // will return -1 and errno is not changed. Check if it is really NPTL. - if (strcmp(os::Linux::glibc_version(), "glibc 2.3.2") == 0 && - strstr(str, "NPTL") && - sysconf(_SC_THREAD_THREADS_MAX) > 0) { - free(str); - os::Linux::set_libpthread_version("linuxthreads"); - } else { - os::Linux::set_libpthread_version(str); - } + char *str = (char *)malloc(n, mtInternal); + confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n); + // Vanilla RH-9 (glibc 2.3.2) has a bug that confstr() always tells + // us "NPTL-0.29" even we are running with LinuxThreads. Check if this + // is the case. LinuxThreads has a hard limit on max number of threads. + // So sysconf(_SC_THREAD_THREADS_MAX) will return a positive value. + // On the other hand, NPTL does not have such a limit, sysconf() + // will return -1 and errno is not changed. Check if it is really NPTL. + if (strcmp(os::Linux::glibc_version(), "glibc 2.3.2") == 0 && + strstr(str, "NPTL") && + sysconf(_SC_THREAD_THREADS_MAX) > 0) { + free(str); + os::Linux::set_libpthread_version("linuxthreads"); + } else { + os::Linux::set_libpthread_version(str); + } } else { // glibc before 2.3.2 only has LinuxThreads. os::Linux::set_libpthread_version("linuxthreads"); } if (strstr(libpthread_version(), "NPTL")) { - os::Linux::set_is_NPTL(); + os::Linux::set_is_NPTL(); } else { - os::Linux::set_is_LinuxThreads(); + os::Linux::set_is_LinuxThreads(); } // LinuxThreads have two flavors: floating-stack mode, which allows variable // stack size; and fixed-stack mode. NPTL is always floating-stack. if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) { - os::Linux::set_is_floating_stack(); + os::Linux::set_is_floating_stack(); } } @@ -935,9 +935,9 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { // Aborted due to thread limit being reached if (state == ZOMBIE) { - thread->set_osthread(NULL); - delete osthread; - return false; + thread->set_osthread(NULL); + delete osthread; + return false; } // The thread is returned suspended (in state INITIALIZED), @@ -957,7 +957,7 @@ bool os::create_main_thread(JavaThread* thread) { bool os::create_attached_thread(JavaThread* thread) { #ifdef ASSERT - thread->verify_not_published(); + thread->verify_not_published(); #endif // Allocate the OSThread object @@ -1029,7 +1029,7 @@ void os::free_thread(OSThread* osthread) { // Restore caller's signal mask sigset_t sigmask = osthread->caller_sigmask(); pthread_sigmask(SIG_SETMASK, &sigmask, NULL); - } + } delete osthread; } @@ -1085,7 +1085,7 @@ bool os::Linux::is_initial_thread(void) { "os::init did not locate initial thread's stack region"); if ((address)&dummy >= initial_thread_stack_bottom() && (address)&dummy < initial_thread_stack_bottom() + initial_thread_stack_size()) - return true; + return true; else return false; } @@ -1097,10 +1097,10 @@ static bool find_vma(address addr, address* vma_low, address* vma_high) { while (!feof(fp)) { if (fscanf(fp, "%p-%p", &low, &high) == 2) { if (low <= addr && addr < high) { - if (vma_low) *vma_low = low; - if (vma_high) *vma_high = high; - fclose(fp); - return true; + if (vma_low) *vma_low = low; + if (vma_high) *vma_high = high; + fclose(fp); + return true; } } for (;;) { @@ -1137,7 +1137,7 @@ void os::Linux::capture_initial_stack(size_t max_size) { // FIXME: alt signal stack is gone, maybe we can relax this constraint? // Problem still exists RH7.2 (IA64 anyway) but 2MB is a little small if (stack_size > 2 * K * K IA64_ONLY(*2)) - stack_size = 2 * K * K IA64_ONLY(*2); + stack_size = 2 * K * K IA64_ONLY(*2); // Try to figure out where the stack base (top) is. This is harder. // // When an application is started, glibc saves the initial stack pointer in @@ -1224,43 +1224,43 @@ void os::Linux::capture_initial_stack(size_t max_size) { /* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 */ /* 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 */ i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld " _UFM _UFM _DFM _UFM _UFM _UFM _UFM, - &state, /* 3 %c */ - &ppid, /* 4 %d */ - &pgrp, /* 5 %d */ - &session, /* 6 %d */ - &nr, /* 7 %d */ - &tpgrp, /* 8 %d */ - &flags, /* 9 %lu */ - &minflt, /* 10 %lu */ - &cminflt, /* 11 %lu */ - &majflt, /* 12 %lu */ - &cmajflt, /* 13 %lu */ - &utime, /* 14 %lu */ - &stime, /* 15 %lu */ - &cutime, /* 16 %ld */ - &cstime, /* 17 %ld */ - &prio, /* 18 %ld */ - &nice, /* 19 %ld */ - &junk, /* 20 %ld */ - &it_real, /* 21 %ld */ - &start, /* 22 UINTX_FORMAT */ - &vsize, /* 23 UINTX_FORMAT */ - &rss, /* 24 INTX_FORMAT */ - &rsslim, /* 25 UINTX_FORMAT */ - &scodes, /* 26 UINTX_FORMAT */ - &ecode, /* 27 UINTX_FORMAT */ - &stack_start); /* 28 UINTX_FORMAT */ + &state, /* 3 %c */ + &ppid, /* 4 %d */ + &pgrp, /* 5 %d */ + &session, /* 6 %d */ + &nr, /* 7 %d */ + &tpgrp, /* 8 %d */ + &flags, /* 9 %lu */ + &minflt, /* 10 %lu */ + &cminflt, /* 11 %lu */ + &majflt, /* 12 %lu */ + &cmajflt, /* 13 %lu */ + &utime, /* 14 %lu */ + &stime, /* 15 %lu */ + &cutime, /* 16 %ld */ + &cstime, /* 17 %ld */ + &prio, /* 18 %ld */ + &nice, /* 19 %ld */ + &junk, /* 20 %ld */ + &it_real, /* 21 %ld */ + &start, /* 22 UINTX_FORMAT */ + &vsize, /* 23 UINTX_FORMAT */ + &rss, /* 24 INTX_FORMAT */ + &rsslim, /* 25 UINTX_FORMAT */ + &scodes, /* 26 UINTX_FORMAT */ + &ecode, /* 27 UINTX_FORMAT */ + &stack_start); /* 28 UINTX_FORMAT */ } #undef _UFM #undef _DFM if (i != 28 - 2) { - assert(false, "Bad conversion from /proc/self/stat"); - // product mode - assume we are the initial thread, good luck in the - // embedded case. - warning("Can't detect initial thread stack location - bad conversion"); - stack_start = (uintptr_t) &rlim; + assert(false, "Bad conversion from /proc/self/stat"); + // product mode - assume we are the initial thread, good luck in the + // embedded case. + warning("Can't detect initial thread stack location - bad conversion"); + stack_start = (uintptr_t) &rlim; } } else { // For some reason we can't open /proc/self/stat (for example, running on @@ -1298,9 +1298,9 @@ void os::Linux::capture_initial_stack(size_t max_size) { stack_top = align_size_up(stack_top, page_size()); if (max_size && stack_size > max_size) { - _initial_thread_stack_size = max_size; + _initial_thread_stack_size = max_size; } else { - _initial_thread_stack_size = stack_size; + _initial_thread_stack_size = stack_size; } _initial_thread_stack_size = align_size_down(_initial_thread_stack_size, page_size()); @@ -1423,8 +1423,8 @@ void os::Linux::fast_thread_clock_init() { // better than 1 sec. This is extra check for reliability. if (pthread_getcpuclockid_func && - pthread_getcpuclockid_func(_main_thread, &clockid) == 0 && - sys_clock_getres(clockid, &tp) == 0 && tp.tv_sec == 0) { + pthread_getcpuclockid_func(_main_thread, &clockid) == 0 && + sys_clock_getres(clockid, &tp) == 0 && tp.tv_sec == 0) { _supports_fast_thread_cpu_time = true; _pthread_getcpuclockid = pthread_getcpuclockid_func; @@ -1769,9 +1769,9 @@ bool os::dll_address_to_library_name(address addr, char* buf, int rslt = dl_iterate_phdr(address_to_library_name_callback, (void *)&data); if (rslt) { - // buf already contains library name - if (offset) *offset = addr - data.base; - return true; + // buf already contains library name + if (offset) *offset = addr - data.base; + return true; } if (dladdr((void*)addr, &dlinfo) != 0) { if (dlinfo.dli_fname != NULL) { @@ -1788,9 +1788,9 @@ bool os::dll_address_to_library_name(address addr, char* buf, return false; } - // Loads .dll/.so and - // in case of error it checks if .dll/.so was built for the - // same architecture as Hotspot is running on +// Loads .dll/.so and +// in case of error it checks if .dll/.so was built for the +// same architecture as Hotspot is running on // Remember the stack's state. The Linux dynamic linker will change @@ -1905,7 +1905,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) bool failed_to_read_elf_head= (sizeof(elf_head)!= - (::read(file_descriptor, &elf_head,sizeof(elf_head)))); + (::read(file_descriptor, &elf_head,sizeof(elf_head)))); ::close(file_descriptor); if (failed_to_read_elf_head) { @@ -1949,33 +1949,33 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) }; #if (defined IA32) - static Elf32_Half running_arch_code=EM_386; + static Elf32_Half running_arch_code=EM_386; #elif (defined AMD64) - static Elf32_Half running_arch_code=EM_X86_64; + static Elf32_Half running_arch_code=EM_X86_64; #elif (defined IA64) - static Elf32_Half running_arch_code=EM_IA_64; + static Elf32_Half running_arch_code=EM_IA_64; #elif (defined __sparc) && (defined _LP64) - static Elf32_Half running_arch_code=EM_SPARCV9; + static Elf32_Half running_arch_code=EM_SPARCV9; #elif (defined __sparc) && (!defined _LP64) - static Elf32_Half running_arch_code=EM_SPARC; + static Elf32_Half running_arch_code=EM_SPARC; #elif (defined __powerpc64__) - static Elf32_Half running_arch_code=EM_PPC64; + static Elf32_Half running_arch_code=EM_PPC64; #elif (defined __powerpc__) - static Elf32_Half running_arch_code=EM_PPC; + static Elf32_Half running_arch_code=EM_PPC; #elif (defined ARM) - static Elf32_Half running_arch_code=EM_ARM; + static Elf32_Half running_arch_code=EM_ARM; #elif (defined S390) - static Elf32_Half running_arch_code=EM_S390; + static Elf32_Half running_arch_code=EM_S390; #elif (defined ALPHA) - static Elf32_Half running_arch_code=EM_ALPHA; + static Elf32_Half running_arch_code=EM_ALPHA; #elif (defined MIPSEL) - static Elf32_Half running_arch_code=EM_MIPS_RS3_LE; + static Elf32_Half running_arch_code=EM_MIPS_RS3_LE; #elif (defined PARISC) - static Elf32_Half running_arch_code=EM_PARISC; + static Elf32_Half running_arch_code=EM_PARISC; #elif (defined MIPS) - static Elf32_Half running_arch_code=EM_MIPS; + static Elf32_Half running_arch_code=EM_MIPS; #elif (defined M68K) - static Elf32_Half running_arch_code=EM_68K; + static Elf32_Half running_arch_code=EM_68K; #else #error Method os::dll_load requires that one of following is defined:\ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K @@ -1998,7 +1998,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) } assert(running_arch_index != -1, - "Didn't find running architecture code (running_arch_code) in arch_array"); + "Didn't find running architecture code (running_arch_code) in arch_array"); if (running_arch_index == -1) { // Even though running architecture detection failed // we may still continue with reporting dlerror() message @@ -2020,13 +2020,13 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) { if (lib_arch.name!=NULL) { ::snprintf(diag_msg_buf, diag_msg_max_length-1, - " (Possible cause: can't load %s-bit .so on a %s-bit platform)", - lib_arch.name, arch_array[running_arch_index].name); + " (Possible cause: can't load %s-bit .so on a %s-bit platform)", + lib_arch.name, arch_array[running_arch_index].name); } else { ::snprintf(diag_msg_buf, diag_msg_max_length-1, - " (Possible cause: can't load this .so (machine code=0x%x) on a %s-bit platform)", - lib_arch.code, - arch_array[running_arch_index].name); + " (Possible cause: can't load this .so (machine code=0x%x) on a %s-bit platform)", + lib_arch.code, + arch_array[running_arch_index].name); } } @@ -2093,7 +2093,7 @@ void* os::get_default_process_handle() { static bool _print_ascii_file(const char* filename, outputStream* st) { int fd = ::open(filename, O_RDONLY); if (fd == -1) { - return false; + return false; } char buf[32]; @@ -2108,16 +2108,16 @@ static bool _print_ascii_file(const char* filename, outputStream* st) { } void os::print_dll_info(outputStream *st) { - st->print_cr("Dynamic libraries:"); + st->print_cr("Dynamic libraries:"); - char fname[32]; - pid_t pid = os::Linux::gettid(); + char fname[32]; + pid_t pid = os::Linux::gettid(); - jio_snprintf(fname, sizeof(fname), "/proc/%d/maps", pid); + jio_snprintf(fname, sizeof(fname), "/proc/%d/maps", pid); - if (!_print_ascii_file(fname, st)) { - st->print("Can not get library information for pid = %d\n", pid); - } + if (!_print_ascii_file(fname, st)) { + st->print("Can not get library information for pid = %d\n", pid); + } } void os::print_os_info_brief(outputStream* st) { @@ -2173,28 +2173,28 @@ void os::print_os_info(outputStream* st) { // an informative string like "6.0.6" or "wheezy/sid". Because of this // "Debian " is printed before the contents of the debian_version file. void os::Linux::print_distro_info(outputStream* st) { - if (!_print_ascii_file("/etc/oracle-release", st) && - !_print_ascii_file("/etc/mandriva-release", st) && - !_print_ascii_file("/etc/mandrake-release", st) && - !_print_ascii_file("/etc/sun-release", st) && - !_print_ascii_file("/etc/redhat-release", st) && - !_print_ascii_file("/etc/lsb-release", st) && - !_print_ascii_file("/etc/SuSE-release", st) && - !_print_ascii_file("/etc/turbolinux-release", st) && - !_print_ascii_file("/etc/gentoo-release", st) && - !_print_ascii_file("/etc/ltib-release", st) && - !_print_ascii_file("/etc/angstrom-version", st) && - !_print_ascii_file("/etc/system-release", st) && - !_print_ascii_file("/etc/os-release", st)) { + if (!_print_ascii_file("/etc/oracle-release", st) && + !_print_ascii_file("/etc/mandriva-release", st) && + !_print_ascii_file("/etc/mandrake-release", st) && + !_print_ascii_file("/etc/sun-release", st) && + !_print_ascii_file("/etc/redhat-release", st) && + !_print_ascii_file("/etc/lsb-release", st) && + !_print_ascii_file("/etc/SuSE-release", st) && + !_print_ascii_file("/etc/turbolinux-release", st) && + !_print_ascii_file("/etc/gentoo-release", st) && + !_print_ascii_file("/etc/ltib-release", st) && + !_print_ascii_file("/etc/angstrom-version", st) && + !_print_ascii_file("/etc/system-release", st) && + !_print_ascii_file("/etc/os-release", st)) { - if (file_exists("/etc/debian_version")) { - st->print("Debian "); - _print_ascii_file("/etc/debian_version", st); - } else { - st->print("Linux"); - } - } - st->cr(); + if (file_exists("/etc/debian_version")) { + st->print("Debian "); + _print_ascii_file("/etc/debian_version", st); + } else { + st->print("Linux"); + } + } + st->cr(); } void os::Linux::print_libversion_info(outputStream* st) { @@ -2203,15 +2203,15 @@ void os::Linux::print_libversion_info(outputStream* st) { st->print("%s ", os::Linux::glibc_version()); st->print("%s ", os::Linux::libpthread_version()); if (os::Linux::is_LinuxThreads()) { - st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed"); + st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed"); } st->cr(); } void os::Linux::print_full_memory_info(outputStream* st) { - st->print("\n/proc/meminfo:\n"); - _print_ascii_file("/proc/meminfo", st); - st->cr(); + st->print("\n/proc/meminfo:\n"); + _print_ascii_file("/proc/meminfo", st); + st->cr(); } void os::print_memory_info(outputStream* st) { @@ -2301,8 +2301,8 @@ void os::jvm_path(char *buf, jint buflen) { char dli_fname[MAXPATHLEN]; bool ret = dll_address_to_library_name( - CAST_FROM_FN_PTR(address, os::jvm_path), - dli_fname, sizeof(dli_fname), NULL); + CAST_FROM_FN_PTR(address, os::jvm_path), + dli_fname, sizeof(dli_fname), NULL); assert(ret, "cannot locate libjvm"); char *rp = NULL; if (ret && dli_fname[0] != '\0') { @@ -2386,12 +2386,12 @@ UserHandler(int sig, void *siginfo, void *context) { // the program is interrupted by Ctrl-C, SIGINT is sent to every thread. We // don't want to flood the manager thread with sem_post requests. if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1) - return; + return; // Ctrl-C is pressed during error reporting, likely because the error // handler fails to abort. Let VM die immediately. if (sig == SIGINT && is_error_reported()) { - os::die(); + os::die(); } os::signal_notify(sig); @@ -2402,15 +2402,15 @@ void* os::user_handler() { } class Semaphore : public StackObj { - public: - Semaphore(); - ~Semaphore(); - void signal(); - void wait(); - bool trywait(); - bool timedwait(unsigned int sec, int nsec); - private: - sem_t _semaphore; + public: + Semaphore(); + ~Semaphore(); + void signal(); + void wait(); + bool trywait(); + bool timedwait(unsigned int sec, int nsec); + private: + sem_t _semaphore; }; Semaphore::Semaphore() { @@ -2661,7 +2661,7 @@ static void warn_fail_commit_memory(char* addr, size_t size, int os::Linux::commit_memory_impl(char* addr, size_t size, bool exec) { int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE; uintptr_t res = (uintptr_t) ::mmap(addr, size, prot, - MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0); + MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0); if (res != (uintptr_t) MAP_FAILED) { if (UseNUMAInterleaving) { numa_make_global(addr, size); @@ -2866,9 +2866,9 @@ bool os::Linux::libnuma_init() { set_numa_tonode_memory(CAST_TO_FN_PTR(numa_tonode_memory_func_t, libnuma_dlsym(handle, "numa_tonode_memory"))); set_numa_interleave_memory(CAST_TO_FN_PTR(numa_interleave_memory_func_t, - libnuma_dlsym(handle, "numa_interleave_memory"))); + libnuma_dlsym(handle, "numa_interleave_memory"))); set_numa_set_bind_policy(CAST_TO_FN_PTR(numa_set_bind_policy_func_t, - libnuma_dlsym(handle, "numa_set_bind_policy"))); + libnuma_dlsym(handle, "numa_set_bind_policy"))); if (numa_available() != -1) { @@ -2940,7 +2940,7 @@ unsigned long* os::Linux::_numa_all_nodes; bool os::pd_uncommit_memory(char* addr, size_t size) { uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE, - MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0); + MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0); return res != (uintptr_t) MAP_FAILED; } @@ -3031,8 +3031,8 @@ bool os::pd_create_stack_guard_pages(char* addr, size_t size) { if (mincore((address)stack_extent, os::vm_page_size(), vec) == -1) { // Fallback to slow path on all errors, including EAGAIN stack_extent = (uintptr_t) get_stack_commited_bottom( - os::Linux::initial_thread_stack_bottom(), - (size_t)addr - stack_extent); + os::Linux::initial_thread_stack_bottom(), + (size_t)addr - stack_extent); } if (stack_extent < (uintptr_t)addr) { @@ -3105,7 +3105,7 @@ static int anon_munmap(char * addr, size_t size) { } char* os::pd_reserve_memory(size_t bytes, char* requested_addr, - size_t alignment_hint) { + size_t alignment_hint) { return anon_mmap(requested_addr, bytes, (requested_addr != NULL)); } @@ -3296,8 +3296,8 @@ size_t os::Linux::find_large_page_size() { if (!FLAG_IS_DEFAULT(LargePageSizeInBytes) && LargePageSizeInBytes != large_page_size) { warning("Setting LargePageSizeInBytes has no effect on this OS. Large page size is " - SIZE_FORMAT "%s.", byte_size_in_proper_unit(large_page_size), - proper_unit_for_byte_size(large_page_size)); + SIZE_FORMAT "%s.", byte_size_in_proper_unit(large_page_size), + proper_unit_for_byte_size(large_page_size)); } return large_page_size; @@ -3404,25 +3404,25 @@ char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, char // Currently, size is the total size of the heap int shmid = shmget(key, bytes, SHM_HUGETLB|IPC_CREAT|SHM_R|SHM_W); if (shmid == -1) { - // Possible reasons for shmget failure: - // 1. shmmax is too small for Java heap. - // > check shmmax value: cat /proc/sys/kernel/shmmax - // > increase shmmax value: echo "0xffffffff" > /proc/sys/kernel/shmmax - // 2. not enough large page memory. - // > check available large pages: cat /proc/meminfo - // > increase amount of large pages: - // echo new_value > /proc/sys/vm/nr_hugepages - // Note 1: different Linux may use different name for this property, - // e.g. on Redhat AS-3 it is "hugetlb_pool". - // Note 2: it's possible there's enough physical memory available but - // they are so fragmented after a long run that they can't - // coalesce into large pages. Try to reserve large pages when - // the system is still "fresh". - if (warn_on_failure) { - jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno); - warning("%s", msg); - } - return NULL; + // Possible reasons for shmget failure: + // 1. shmmax is too small for Java heap. + // > check shmmax value: cat /proc/sys/kernel/shmmax + // > increase shmmax value: echo "0xffffffff" > /proc/sys/kernel/shmmax + // 2. not enough large page memory. + // > check available large pages: cat /proc/meminfo + // > increase amount of large pages: + // echo new_value > /proc/sys/vm/nr_hugepages + // Note 1: different Linux may use different name for this property, + // e.g. on Redhat AS-3 it is "hugetlb_pool". + // Note 2: it's possible there's enough physical memory available but + // they are so fragmented after a long run that they can't + // coalesce into large pages. Try to reserve large pages when + // the system is still "fresh". + if (warn_on_failure) { + jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno); + warning("%s", msg); + } + return NULL; } // attach to the region @@ -3436,11 +3436,11 @@ char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, char shmctl(shmid, IPC_RMID, NULL); if ((intptr_t)addr == -1) { - if (warn_on_failure) { - jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err); - warning("%s", msg); - } - return NULL; + if (warn_on_failure) { + jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err); + warning("%s", msg); + } + return NULL; } return addr; @@ -3457,7 +3457,7 @@ static void warn_on_large_pages_failure(char* req_addr, size_t bytes, int error) if (warn_on_failure) { char msg[128]; jio_snprintf(msg, sizeof(msg), "Failed to reserve large pages memory req_addr: " - PTR_FORMAT " bytes: " SIZE_FORMAT " (errno = %d).", req_addr, bytes, error); + PTR_FORMAT " bytes: " SIZE_FORMAT " (errno = %d).", req_addr, bytes, error); warning("%s", msg); } } @@ -3562,9 +3562,9 @@ char* os::Linux::reserve_memory_special_huge_tlbfs_mixed(size_t bytes, size_t al } if (lp_end != end) { - result = ::mmap(lp_end, end - lp_end, prot, - MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, - -1, 0); + result = ::mmap(lp_end, end - lp_end, prot, + MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, + -1, 0); if (result == MAP_FAILED) { ::munmap(start, lp_end - start); return NULL; @@ -3698,12 +3698,12 @@ char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) { // if kernel honors the hint then we can return immediately. char * addr = anon_mmap(requested_addr, bytes, false); if (addr == requested_addr) { - return requested_addr; + return requested_addr; } if (addr != NULL) { - // mmap() is successful but it fails to reserve at the requested address - anon_munmap(addr, bytes); + // mmap() is successful but it fails to reserve at the requested address + anon_munmap(addr, bytes); } int i; @@ -3988,12 +3988,12 @@ static int SR_initialize() { if ((s = ::getenv("_JAVA_SR_SIGNUM")) != 0) { int sig = ::strtol(s, 0, 10); if (sig > 0 || sig < _NSIG) { - SR_signum = sig; + SR_signum = sig; } } assert(SR_signum > SIGSEGV && SR_signum > SIGBUS, - "SR_signum must be greater than max(SIGSEGV, SIGBUS), see 4355769"); + "SR_signum must be greater than max(SIGSEGV, SIGBUS), see 4355769"); sigemptyset(&SR_sigset); sigaddset(&SR_sigset, SR_signum); @@ -4304,12 +4304,12 @@ void os::Linux::install_signal_handlers() { signal_setting_t begin_signal_setting = NULL; signal_setting_t end_signal_setting = NULL; begin_signal_setting = CAST_TO_FN_PTR(signal_setting_t, - dlsym(RTLD_DEFAULT, "JVM_begin_signal_setting")); + dlsym(RTLD_DEFAULT, "JVM_begin_signal_setting")); if (begin_signal_setting != NULL) { end_signal_setting = CAST_TO_FN_PTR(signal_setting_t, - dlsym(RTLD_DEFAULT, "JVM_end_signal_setting")); + dlsym(RTLD_DEFAULT, "JVM_end_signal_setting")); get_signal_action = CAST_TO_FN_PTR(get_signal_t, - dlsym(RTLD_DEFAULT, "JVM_get_signal_action")); + dlsym(RTLD_DEFAULT, "JVM_get_signal_action")); libjsig_is_loaded = true; assert(UseSignalChaining, "should enable signal-chaining"); } @@ -4434,7 +4434,7 @@ static void print_signal_handler(outputStream* st, int sig, // Check: is it our handler? if (handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)signalHandler) || - handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler)) { + handler == CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler)) { // It is our signal handler // check for flags, reset system-used one! if ((int)sa.sa_flags != os::Linux::get_our_sigflags(sig)) { @@ -4698,22 +4698,22 @@ jint os::init_2(void) // Add in 2*BytesPerWord times page size to account for VM stack during // class initialization depending on 32 or 64 bit VM. os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed, - (size_t)(StackYellowPages+StackRedPages+StackShadowPages) * Linux::page_size() + - (2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::vm_default_page_size()); + (size_t)(StackYellowPages+StackRedPages+StackShadowPages) * Linux::page_size() + + (2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::vm_default_page_size()); size_t threadStackSizeInBytes = ThreadStackSize * K; if (threadStackSizeInBytes != 0 && threadStackSizeInBytes < os::Linux::min_stack_allowed) { - tty->print_cr("\nThe stack size specified is too small, " - "Specify at least %dk", - os::Linux::min_stack_allowed/ K); - return JNI_ERR; + tty->print_cr("\nThe stack size specified is too small, " + "Specify at least %dk", + os::Linux::min_stack_allowed/ K); + return JNI_ERR; } // Make the stack size a multiple of the page size so that // the yellow/red zones can be guarded. JavaThread::set_stack_size_at_create(round_to(threadStackSizeInBytes, - vm_page_size())); + vm_page_size())); Linux::capture_initial_stack(JavaThread::stack_size_at_create()); @@ -4723,9 +4723,9 @@ jint os::init_2(void) Linux::libpthread_init(); if (PrintMiscellaneous && (Verbose || WizardMode)) { - tty->print_cr("[HotSpot is running with %s, %s(%s)]\n", - Linux::glibc_version(), Linux::libpthread_version(), - Linux::is_floating_stack() ? "floating stack" : "fixed stack"); + tty->print_cr("[HotSpot is running with %s, %s(%s)]\n", + Linux::glibc_version(), Linux::libpthread_version(), + Linux::is_floating_stack() ? "floating stack" : "fixed stack"); } if (UseNUMA) { @@ -4865,12 +4865,12 @@ void os::SuspendedThreadTask::internal_do_task() { } class PcFetcher : public os::SuspendedThreadTask { -public: + public: PcFetcher(Thread* thread) : os::SuspendedThreadTask(thread) {} ExtendedPC result(); -protected: + protected: void do_task(const os::SuspendedThreadTaskContext& context); -private: + private: ExtendedPC _epc; }; @@ -4904,17 +4904,17 @@ ExtendedPC os::get_thread_pc(Thread* thread) { int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime) { - if (is_NPTL()) { - return pthread_cond_timedwait(_cond, _mutex, _abstime); - } else { - // 6292965: LinuxThreads pthread_cond_timedwait() resets FPU control - // word back to default 64bit precision if condvar is signaled. Java - // wants 53bit precision. Save and restore current value. - int fpu = get_fpu_control_word(); - int status = pthread_cond_timedwait(_cond, _mutex, _abstime); - set_fpu_control_word(fpu); - return status; - } + if (is_NPTL()) { + return pthread_cond_timedwait(_cond, _mutex, _abstime); + } else { + // 6292965: LinuxThreads pthread_cond_timedwait() resets FPU control + // word back to default 64bit precision if condvar is signaled. Java + // wants 53bit precision. Save and restore current value. + int fpu = get_fpu_control_word(); + int status = pthread_cond_timedwait(_cond, _mutex, _abstime); + set_fpu_control_word(fpu); + return status; + } } //////////////////////////////////////////////////////////////////////////////// @@ -4927,7 +4927,7 @@ bool os::find(address addr, outputStream* st) { st->print(PTR_FORMAT ": ", addr); if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { st->print("%s+%#x", dlinfo.dli_sname, - addr - (intptr_t)dlinfo.dli_saddr); + addr - (intptr_t)dlinfo.dli_saddr); } else if (dlinfo.dli_fbase != NULL) { st->print("", addr - (intptr_t)dlinfo.dli_fbase); } else { @@ -5096,11 +5096,11 @@ int os::open(const char *path, int oflag, int mode) { * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9 */ #ifdef FD_CLOEXEC - { - int flags = ::fcntl(fd, F_GETFD); - if (flags != -1) - ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC); - } + { + int flags = ::fcntl(fd, F_GETFD); + if (flags != -1) + ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC); + } #endif if (o_delete != 0) { @@ -5174,8 +5174,8 @@ int os::socket_available(int fd, jint *pbytes) { // Map a block of memory. char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset, - char *addr, size_t bytes, bool read_only, - bool allow_exec) { + char *addr, size_t bytes, bool read_only, + bool allow_exec) { int prot; int flags = MAP_PRIVATE; @@ -5204,8 +5204,8 @@ char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset, // Remap a block of memory. char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset, - char *addr, size_t bytes, bool read_only, - bool allow_exec) { + char *addr, size_t bytes, bool read_only, + bool allow_exec) { // same as map_memory() on this OS return os::map_memory(fd, file_name, file_offset, addr, bytes, read_only, allow_exec); @@ -5360,7 +5360,7 @@ void os::pause() { } } else { jio_fprintf(stderr, - "Could not open pause file '%s', continuing immediately.\n", filename); + "Could not open pause file '%s', continuing immediately.\n", filename); } } @@ -5471,28 +5471,28 @@ void os::PlatformEvent::park() { // AKA "down()" int v; for (;;) { - v = _Event; - if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; + v = _Event; + if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; } guarantee(v >= 0, "invariant"); if (v == 0) { - // Do this the hard way by blocking ... - int status = pthread_mutex_lock(_mutex); - assert_status(status == 0, status, "mutex_lock"); - guarantee(_nParked == 0, "invariant"); - ++_nParked; - while (_Event < 0) { - status = pthread_cond_wait(_cond, _mutex); - // for some reason, under 2.7 lwp_cond_wait() may return ETIME ... - // Treat this the same as if the wait was interrupted - if (status == ETIME) { status = EINTR; } - assert_status(status == 0 || status == EINTR, status, "cond_wait"); - } - --_nParked; + // Do this the hard way by blocking ... + int status = pthread_mutex_lock(_mutex); + assert_status(status == 0, status, "mutex_lock"); + guarantee(_nParked == 0, "invariant"); + ++_nParked; + while (_Event < 0) { + status = pthread_cond_wait(_cond, _mutex); + // for some reason, under 2.7 lwp_cond_wait() may return ETIME ... + // Treat this the same as if the wait was interrupted + if (status == ETIME) { status = EINTR; } + assert_status(status == 0 || status == EINTR, status, "cond_wait"); + } + --_nParked; _Event = 0; - status = pthread_mutex_unlock(_mutex); - assert_status(status == 0, status, "mutex_unlock"); + status = pthread_mutex_unlock(_mutex); + assert_status(status == 0, status, "mutex_unlock"); // Paranoia to ensure our locked and lock-free paths interact // correctly with each other. OrderAccess::fence(); @@ -5505,8 +5505,8 @@ int os::PlatformEvent::park(jlong millis) { int v; for (;;) { - v = _Event; - if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; + v = _Event; + if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; } guarantee(v >= 0, "invariant"); if (v != 0) return OS_OK; @@ -5550,7 +5550,7 @@ int os::PlatformEvent::park(jlong millis) { } --_nParked; if (_Event >= 0) { - ret = OS_OK; + ret = OS_OK; } _Event = 0; status = pthread_mutex_unlock(_mutex); @@ -5849,7 +5849,7 @@ int os::fork_and_exec(char* cmd) { // On IA64 there's no fork syscall, we have to use fork() and hope for // the best... pid_t pid = NOT_IA64(syscall(__NR_fork);) - IA64_ONLY(fork();) + IA64_ONLY(fork();) if (pid < 0) { // fork failed @@ -5880,26 +5880,26 @@ int os::fork_and_exec(char* cmd) { // Wait for the child process to exit. This returns immediately if // the child has already exited. */ while (waitpid(pid, &status, 0) < 0) { - switch (errno) { - case ECHILD: return 0; - case EINTR: break; - default: return -1; - } + switch (errno) { + case ECHILD: return 0; + case EINTR: break; + default: return -1; + } } if (WIFEXITED(status)) { - // The child exited normally; get its exit code. - return WEXITSTATUS(status); + // The child exited normally; get its exit code. + return WEXITSTATUS(status); } else if (WIFSIGNALED(status)) { - // The child exited because of a signal - // The best value to return is 0x80 + signal number, - // because that is what all Unix shells do, and because - // it allows callers to distinguish between process exit and - // process death by signal. - return 0x80 + WTERMSIG(status); + // The child exited because of a signal + // The best value to return is 0x80 + signal number, + // because that is what all Unix shells do, and because + // it allows callers to distinguish between process exit and + // process death by signal. + return 0x80 + WTERMSIG(status); } else { - // Unknown exit code; pass it through - return status; + // Unknown exit code; pass it through + return status; } } } @@ -5913,37 +5913,37 @@ int os::fork_and_exec(char* cmd) { // as libawt.so, and renamed libawt_xawt.so // bool os::is_headless_jre() { - struct stat statbuf; - char buf[MAXPATHLEN]; - char libmawtpath[MAXPATHLEN]; - const char *xawtstr = "/xawt/libmawt.so"; - const char *new_xawtstr = "/libawt_xawt.so"; - char *p; + struct stat statbuf; + char buf[MAXPATHLEN]; + char libmawtpath[MAXPATHLEN]; + const char *xawtstr = "/xawt/libmawt.so"; + const char *new_xawtstr = "/libawt_xawt.so"; + char *p; - // Get path to libjvm.so - os::jvm_path(buf, sizeof(buf)); + // Get path to libjvm.so + os::jvm_path(buf, sizeof(buf)); - // Get rid of libjvm.so - p = strrchr(buf, '/'); - if (p == NULL) return false; - else *p = '\0'; + // Get rid of libjvm.so + p = strrchr(buf, '/'); + if (p == NULL) return false; + else *p = '\0'; - // Get rid of client or server - p = strrchr(buf, '/'); - if (p == NULL) return false; - else *p = '\0'; + // Get rid of client or server + p = strrchr(buf, '/'); + if (p == NULL) return false; + else *p = '\0'; - // check xawt/libmawt.so - strcpy(libmawtpath, buf); - strcat(libmawtpath, xawtstr); - if (::stat(libmawtpath, &statbuf) == 0) return false; + // check xawt/libmawt.so + strcpy(libmawtpath, buf); + strcat(libmawtpath, xawtstr); + if (::stat(libmawtpath, &statbuf) == 0) return false; - // check libawt_xawt.so - strcpy(libmawtpath, buf); - strcat(libmawtpath, new_xawtstr); - if (::stat(libmawtpath, &statbuf) == 0) return false; + // check libawt_xawt.so + strcpy(libmawtpath, buf); + strcat(libmawtpath, new_xawtstr); + if (::stat(libmawtpath, &statbuf) == 0) return false; - return true; + return true; } // Get the default path to the core file @@ -6025,7 +6025,7 @@ void MemNotifyThread::start() { int fd; fd = open ("/dev/mem_notify", O_RDONLY, 0); if (fd < 0) { - return; + return; } if (memnotify_thread() == NULL) { @@ -6089,11 +6089,11 @@ class TestReserveMemorySpecial : AllStatic { static void test_reserve_memory_special_huge_tlbfs_mixed(size_t size, size_t alignment) { if (!UseHugeTLBFS) { - return; + return; } test_log("test_reserve_memory_special_huge_tlbfs_mixed(" SIZE_FORMAT ", " SIZE_FORMAT ")", - size, alignment); + size, alignment); assert(size >= os::large_page_size(), "Incorrect input to test"); diff --git a/hotspot/src/os/linux/vm/os_linux.hpp b/hotspot/src/os/linux/vm/os_linux.hpp index cf9b71b4033..f972ae461cc 100644 --- a/hotspot/src/os/linux/vm/os_linux.hpp +++ b/hotspot/src/os/linux/vm/os_linux.hpp @@ -151,7 +151,7 @@ class Linux { // that file provides extensions to the os class and not the // Linux class. static ExtendedPC fetch_frame_from_ucontext(Thread* thread, ucontext_t* uc, - intptr_t** ret_sp, intptr_t** ret_fp); + intptr_t** ret_sp, intptr_t** ret_fp); // This boolean allows users to forward their own non-matching signals // to JVM_handle_linux_signal, harmlessly. @@ -222,10 +222,10 @@ class Linux { static jlong fast_thread_cpu_time(clockid_t clockid); // pthread_cond clock suppport - private: + private: static pthread_condattr_t _condattr[1]; - public: + public: static pthread_condattr_t* condAttr() { return _condattr; } // Stack repair handling @@ -235,7 +235,7 @@ class Linux { // LinuxThreads work-around for 6292965 static int safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime); -private: + private: typedef int (*sched_getcpu_func_t)(void); typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen); typedef int (*numa_max_node_func_t)(void); @@ -262,7 +262,7 @@ private: static void set_numa_set_bind_policy(numa_set_bind_policy_func_t func) { _numa_set_bind_policy = func; } static void set_numa_all_nodes(unsigned long* ptr) { _numa_all_nodes = ptr; } static int sched_getcpu_syscall(void); -public: + public: static int sched_getcpu() { return _sched_getcpu != NULL ? _sched_getcpu() : -1; } static int numa_node_to_cpus(int node, unsigned long *buffer, int bufferlen) { return _numa_node_to_cpus != NULL ? _numa_node_to_cpus(node, buffer, bufferlen) : -1; @@ -287,63 +287,63 @@ public: class PlatformEvent : public CHeapObj { - private: - double CachePad[4]; // increase odds that _mutex is sole occupant of cache line - volatile int _Event; - volatile int _nParked; - pthread_mutex_t _mutex[1]; - pthread_cond_t _cond[1]; - double PostPad[2]; - Thread * _Assoc; + private: + double CachePad[4]; // increase odds that _mutex is sole occupant of cache line + volatile int _Event; + volatile int _nParked; + pthread_mutex_t _mutex[1]; + pthread_cond_t _cond[1]; + double PostPad[2]; + Thread * _Assoc; - public: // TODO-FIXME: make dtor private - ~PlatformEvent() { guarantee(0, "invariant"); } + public: // TODO-FIXME: make dtor private + ~PlatformEvent() { guarantee(0, "invariant"); } - public: - PlatformEvent() { - int status; - status = pthread_cond_init (_cond, os::Linux::condAttr()); - assert_status(status == 0, status, "cond_init"); - status = pthread_mutex_init (_mutex, NULL); - assert_status(status == 0, status, "mutex_init"); - _Event = 0; - _nParked = 0; - _Assoc = NULL; - } + public: + PlatformEvent() { + int status; + status = pthread_cond_init (_cond, os::Linux::condAttr()); + assert_status(status == 0, status, "cond_init"); + status = pthread_mutex_init (_mutex, NULL); + assert_status(status == 0, status, "mutex_init"); + _Event = 0; + _nParked = 0; + _Assoc = NULL; + } - // Use caution with reset() and fired() -- they may require MEMBARs - void reset() { _Event = 0; } - int fired() { return _Event; } - void park(); - void unpark(); - int park(jlong millis); // relative timed-wait only - void SetAssociation(Thread * a) { _Assoc = a; } + // Use caution with reset() and fired() -- they may require MEMBARs + void reset() { _Event = 0; } + int fired() { return _Event; } + void park(); + void unpark(); + int park(jlong millis); // relative timed-wait only + void SetAssociation(Thread * a) { _Assoc = a; } }; class PlatformParker : public CHeapObj { - protected: - enum { - REL_INDEX = 0, - ABS_INDEX = 1 - }; - int _cur_index; // which cond is in use: -1, 0, 1 - pthread_mutex_t _mutex[1]; - pthread_cond_t _cond[2]; // one for relative times and one for abs. + protected: + enum { + REL_INDEX = 0, + ABS_INDEX = 1 + }; + int _cur_index; // which cond is in use: -1, 0, 1 + pthread_mutex_t _mutex[1]; + pthread_cond_t _cond[2]; // one for relative times and one for abs. - public: // TODO-FIXME: make dtor private - ~PlatformParker() { guarantee(0, "invariant"); } + public: // TODO-FIXME: make dtor private + ~PlatformParker() { guarantee(0, "invariant"); } - public: - PlatformParker() { - int status; - status = pthread_cond_init (&_cond[REL_INDEX], os::Linux::condAttr()); - assert_status(status == 0, status, "cond_init rel"); - status = pthread_cond_init (&_cond[ABS_INDEX], NULL); - assert_status(status == 0, status, "cond_init abs"); - status = pthread_mutex_init (_mutex, NULL); - assert_status(status == 0, status, "mutex_init"); - _cur_index = -1; // mark as unused - } + public: + PlatformParker() { + int status; + status = pthread_cond_init (&_cond[REL_INDEX], os::Linux::condAttr()); + assert_status(status == 0, status, "cond_init rel"); + status = pthread_cond_init (&_cond[ABS_INDEX], NULL); + assert_status(status == 0, status, "cond_init abs"); + status = pthread_mutex_init (_mutex, NULL); + assert_status(status == 0, status, "mutex_init"); + _cur_index = -1; // mark as unused + } }; #endif // OS_LINUX_VM_OS_LINUX_HPP diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 21cb27a3c0e..379fff39073 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -210,8 +210,8 @@ Thread* ThreadLocalStorage::get_thread_via_cache_slowly(uintptr_t raw_id, address sp = os::current_stack_pointer(); guarantee(thread->_stack_base == NULL || (sp <= thread->_stack_base && - sp >= thread->_stack_base - thread->_stack_size) || - is_error_reported(), + sp >= thread->_stack_base - thread->_stack_size) || + is_error_reported(), "sp must be inside of selected thread stack"); thread->set_self_raw_id(raw_id); // mark for quick retrieval @@ -332,7 +332,7 @@ void os::Solaris::try_enable_extended_io() { static int _processors_online = 0; - jint os::Solaris::_os_thread_limit = 0; +jint os::Solaris::_os_thread_limit = 0; volatile jint os::Solaris::_os_thread_count = 0; julong os::available_memory() { @@ -346,7 +346,7 @@ julong os::Solaris::available_memory() { julong os::Solaris::_physical_memory = 0; julong os::physical_memory() { - return Solaris::physical_memory(); + return Solaris::physical_memory(); } static hrtime_t first_hrtime = 0; @@ -432,14 +432,14 @@ static bool find_processors_online(processorid_t** id_array, next += 1; } if (found < *id_length) { - // The loop above didn't identify the expected number of processors. - // We could always retry the operation, calling sysconf(_SC_NPROCESSORS_ONLN) - // and re-running the loop, above, but there's no guarantee of progress - // if the system configuration is in flux. Instead, we just return what - // we've got. Note that in the worst case find_processors_online() could - // return an empty set. (As a fall-back in the case of the empty set we - // could just return the ID of the current processor). - *id_length = found; + // The loop above didn't identify the expected number of processors. + // We could always retry the operation, calling sysconf(_SC_NPROCESSORS_ONLN) + // and re-running the loop, above, but there's no guarantee of progress + // if the system configuration is in flux. Instead, we just return what + // we've got. Note that in the worst case find_processors_online() could + // return an empty set. (As a fall-back in the case of the empty set we + // could just return the ID of the current processor). + *id_length = found; } return true; @@ -557,7 +557,7 @@ bool os::bind_to_processor(uint processor_id) { bool os::getenv(const char* name, char* buffer, int len) { char* val = ::getenv(name); if (val == NULL - || strlen(val) + 1 > len ) { + || strlen(val) + 1 > len ) { if (len > 0) buffer[0] = 0; // return a null string return false; } @@ -932,7 +932,7 @@ bool os::create_attached_thread(JavaThread* thread) { #endif OSThread* osthread = create_os_thread(thread, thr_self()); if (osthread == NULL) { - return false; + return false; } // Initial thread state is RUNNABLE @@ -952,9 +952,9 @@ bool os::create_main_thread(JavaThread* thread) { #endif if (_starting_thread == NULL) { _starting_thread = create_os_thread(thread, main_thread); - if (_starting_thread == NULL) { - return false; - } + if (_starting_thread == NULL) { + return false; + } } // The primodial thread is runnable from the start @@ -980,27 +980,27 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { if (ThreadPriorityVerbose) { char *thrtyp; switch (thr_type) { - case vm_thread: - thrtyp = (char *)"vm"; - break; - case cgc_thread: - thrtyp = (char *)"cgc"; - break; - case pgc_thread: - thrtyp = (char *)"pgc"; - break; - case java_thread: - thrtyp = (char *)"java"; - break; - case compiler_thread: - thrtyp = (char *)"compiler"; - break; - case watcher_thread: - thrtyp = (char *)"watcher"; - break; - default: - thrtyp = (char *)"unknown"; - break; + case vm_thread: + thrtyp = (char *)"vm"; + break; + case cgc_thread: + thrtyp = (char *)"cgc"; + break; + case pgc_thread: + thrtyp = (char *)"pgc"; + break; + case java_thread: + thrtyp = (char *)"java"; + break; + case compiler_thread: + thrtyp = (char *)"compiler"; + break; + case watcher_thread: + thrtyp = (char *)"watcher"; + break; + default: + thrtyp = (char *)"unknown"; + break; } tty->print_cr("In create_thread, creating a %s thread\n", thrtyp); } @@ -1104,14 +1104,14 @@ int os::Solaris::_SIGinterrupt = INTERRUPT_SIGNAL; int os::Solaris::_SIGasync = ASYNC_SIGNAL; bool os::Solaris::is_sig_ignored(int sig) { - struct sigaction oact; - sigaction(sig, (struct sigaction*)NULL, &oact); - void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction) - : CAST_FROM_FN_PTR(void*, oact.sa_handler); - if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) - return true; - else - return false; + struct sigaction oact; + sigaction(sig, (struct sigaction*)NULL, &oact); + void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction) + : CAST_FROM_FN_PTR(void*, oact.sa_handler); + if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) + return true; + else + return false; } // Note: SIGRTMIN is a macro that calls sysconf() so it will @@ -1158,18 +1158,18 @@ void os::Solaris::signal_sets_init() { sigaddset(&unblocked_sigs, os::Solaris::SIGasync()); if (!ReduceSignalUsage) { - if (!os::Solaris::is_sig_ignored(SHUTDOWN1_SIGNAL)) { + if (!os::Solaris::is_sig_ignored(SHUTDOWN1_SIGNAL)) { sigaddset(&unblocked_sigs, SHUTDOWN1_SIGNAL); sigaddset(&allowdebug_blocked_sigs, SHUTDOWN1_SIGNAL); - } - if (!os::Solaris::is_sig_ignored(SHUTDOWN2_SIGNAL)) { + } + if (!os::Solaris::is_sig_ignored(SHUTDOWN2_SIGNAL)) { sigaddset(&unblocked_sigs, SHUTDOWN2_SIGNAL); sigaddset(&allowdebug_blocked_sigs, SHUTDOWN2_SIGNAL); - } - if (!os::Solaris::is_sig_ignored(SHUTDOWN3_SIGNAL)) { + } + if (!os::Solaris::is_sig_ignored(SHUTDOWN3_SIGNAL)) { sigaddset(&unblocked_sigs, SHUTDOWN3_SIGNAL); sigaddset(&allowdebug_blocked_sigs, SHUTDOWN3_SIGNAL); - } + } } // Fill in signals that are blocked by all but the VM thread. sigemptyset(&vm_sigs); @@ -1245,20 +1245,20 @@ void os::initialize_thread(Thread* thr) { if (stack_size > jt->stack_size()) { NOT_PRODUCT( - struct rlimit limits; - getrlimit(RLIMIT_STACK, &limits); - size_t size = adjust_stack_size(base, (size_t)limits.rlim_cur); - assert(size >= jt->stack_size(), "Stack size problem in main thread"); - ) + struct rlimit limits; + getrlimit(RLIMIT_STACK, &limits); + size_t size = adjust_stack_size(base, (size_t)limits.rlim_cur); + assert(size >= jt->stack_size(), "Stack size problem in main thread"); + ) tty->print_cr( - "Stack size of %d Kb exceeds current limit of %d Kb.\n" - "(Stack sizes are rounded up to a multiple of the system page size.)\n" - "See limit(1) to increase the stack size limit.", - stack_size / K, jt->stack_size() / K); + "Stack size of %d Kb exceeds current limit of %d Kb.\n" + "(Stack sizes are rounded up to a multiple of the system page size.)\n" + "See limit(1) to increase the stack size limit.", + stack_size / K, jt->stack_size() / K); vm_exit(1); } assert(jt->stack_size() >= stack_size, - "Attempt to map more stack than was allocated"); + "Attempt to map more stack than was allocated"); jt->set_stack_size(stack_size); } @@ -1281,7 +1281,7 @@ void os::free_thread(OSThread* osthread) { // The main thread must take the VMThread down synchronously // before the main thread exits and frees up CodeHeap guarantee((Thread::current()->osthread() == osthread - || (osthread == VMThread::vm_thread()->osthread())), "os::free_thread but not current thread"); + || (osthread == VMThread::vm_thread()->osthread())), "os::free_thread but not current thread"); if (Thread::current()->osthread() == osthread) { // Restore caller's signal mask sigset_t sigmask = osthread->caller_sigmask(); @@ -1338,19 +1338,19 @@ void os::free_thread_local_storage(int index) { } #define SMALLINT 32 // libthread allocate for tsd_common is a version specific - // small number - point is NO swap space available +// small number - point is NO swap space available void os::thread_local_storage_at_put(int index, void* value) { // %%% this is used only in threadLocalStorage.cpp if (thr_setspecific((thread_key_t)index, value)) { if (errno == ENOMEM) { - vm_exit_out_of_memory(SMALLINT, OOM_MALLOC_ERROR, - "thr_setspecific: out of swap space"); + vm_exit_out_of_memory(SMALLINT, OOM_MALLOC_ERROR, + "thr_setspecific: out of swap space"); } else { fatal(err_msg("os::thread_local_storage_at_put: thr_setspecific failed " "(%s)", strerror(errno))); } } else { - ThreadLocalStorage::set_thread_in_slot((Thread *) value); + ThreadLocalStorage::set_thread_in_slot((Thread *) value); } } @@ -1402,14 +1402,14 @@ jlong os::elapsed_counter() { } jlong os::elapsed_frequency() { - return hrtime_hz; + return hrtime_hz; } // Return the real, user, and system times in seconds from an // arbitrary fixed point in the past. bool os::getTimesSecs(double* process_real_time, - double* process_user_time, - double* process_system_time) { + double* process_user_time, + double* process_system_time) { struct tms ticks; clock_t real_ticks = times(&ticks); @@ -1759,9 +1759,9 @@ void os::print_dll_info(outputStream * st) { dlclose(handle); } - // Loads .dll/.so and - // in case of error it checks if .dll/.so was built for the - // same architecture as Hotspot is running on +// Loads .dll/.so and +// in case of error it checks if .dll/.so was built for the +// same architecture as Hotspot is running on void * os::dll_load(const char *filename, char *ebuf, int ebuflen) { @@ -1795,7 +1795,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) bool failed_to_read_elf_head= (sizeof(elf_head)!= - (::read(file_descriptor, &elf_head,sizeof(elf_head)))); + (::read(file_descriptor, &elf_head,sizeof(elf_head)))); ::close(file_descriptor); if (failed_to_read_elf_head) { @@ -1825,21 +1825,21 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) }; #if (defined IA32) - static Elf32_Half running_arch_code=EM_386; + static Elf32_Half running_arch_code=EM_386; #elif (defined AMD64) - static Elf32_Half running_arch_code=EM_X86_64; + static Elf32_Half running_arch_code=EM_X86_64; #elif (defined IA64) - static Elf32_Half running_arch_code=EM_IA_64; + static Elf32_Half running_arch_code=EM_IA_64; #elif (defined __sparc) && (defined _LP64) - static Elf32_Half running_arch_code=EM_SPARCV9; + static Elf32_Half running_arch_code=EM_SPARCV9; #elif (defined __sparc) && (!defined _LP64) - static Elf32_Half running_arch_code=EM_SPARC; + static Elf32_Half running_arch_code=EM_SPARC; #elif (defined __powerpc64__) - static Elf32_Half running_arch_code=EM_PPC64; + static Elf32_Half running_arch_code=EM_PPC64; #elif (defined __powerpc__) - static Elf32_Half running_arch_code=EM_PPC; + static Elf32_Half running_arch_code=EM_PPC; #elif (defined ARM) - static Elf32_Half running_arch_code=EM_ARM; + static Elf32_Half running_arch_code=EM_ARM; #else #error Method os::dll_load requires that one of following is defined:\ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, ARM @@ -1862,7 +1862,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) } assert(running_arch_index != -1, - "Didn't find running architecture code (running_arch_code) in arch_array"); + "Didn't find running architecture code (running_arch_code) in arch_array"); if (running_arch_index == -1) { // Even though running architecture detection failed // we may still continue with reporting dlerror() message @@ -1882,13 +1882,13 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) { if (lib_arch.name!=NULL) { ::snprintf(diag_msg_buf, diag_msg_max_length-1, - " (Possible cause: can't load %s-bit .so on a %s-bit platform)", - lib_arch.name, arch_array[running_arch_index].name); + " (Possible cause: can't load %s-bit .so on a %s-bit platform)", + lib_arch.name, arch_array[running_arch_index].name); } else { ::snprintf(diag_msg_buf, diag_msg_max_length-1, - " (Possible cause: can't load this .so (machine code=0x%x) on a %s-bit platform)", - lib_arch.code, - arch_array[running_arch_index].name); + " (Possible cause: can't load this .so (machine code=0x%x) on a %s-bit platform)", + lib_arch.code, + arch_array[running_arch_index].name); } } @@ -1916,7 +1916,7 @@ int os::stat(const char *path, struct stat *sbuf) { static bool _print_ascii_file(const char* filename, outputStream* st) { int fd = ::open(filename, O_RDONLY); if (fd == -1) { - return false; + return false; } char buf[32]; @@ -1954,9 +1954,9 @@ void os::print_os_info(outputStream* st) { void os::Solaris::print_distro_info(outputStream* st) { if (!_print_ascii_file("/etc/release", st)) { - st->print("Solaris"); - } - st->cr(); + st->print("Solaris"); + } + st->cr(); } void os::Solaris::print_libversion_info(outputStream* st) { @@ -2055,7 +2055,7 @@ static const char* get_signal_handler_name(address handler, } static void print_signal_handler(outputStream* st, int sig, - char* buf, size_t buflen) { + char* buf, size_t buflen) { struct sigaction sa; sigaction(sig, NULL, &sa); @@ -2089,13 +2089,13 @@ static void print_signal_handler(outputStream* st, int sig, // Check: is it our handler? if (handler == CAST_FROM_FN_PTR(address, signalHandler) || - handler == CAST_FROM_FN_PTR(address, sigINTRHandler)) { + handler == CAST_FROM_FN_PTR(address, sigINTRHandler)) { // It is our signal handler // check for flags if (sa.sa_flags != os::Solaris::get_our_sigflags(sig)) { st->print( - ", flags was changed from " PTR32_FORMAT ", consider using jsig library", - os::Solaris::get_our_sigflags(sig)); + ", flags was changed from " PTR32_FORMAT ", consider using jsig library", + os::Solaris::get_our_sigflags(sig)); } } st->cr(); @@ -2240,7 +2240,7 @@ extern "C" { // Ctrl-C is pressed during error reporting, likely because the error // handler fails to abort. Let VM die immediately. if (sig == SIGINT && is_error_reported()) { - os::die(); + os::die(); } os::signal_notify(sig); @@ -2253,15 +2253,15 @@ void* os::user_handler() { } class Semaphore : public StackObj { - public: - Semaphore(); - ~Semaphore(); - void signal(); - void wait(); - bool trywait(); - bool timedwait(unsigned int sec, int nsec); - private: - sema_t _semaphore; + public: + Semaphore(); + ~Semaphore(); + void signal(); + void wait(); + bool trywait(); + bool timedwait(unsigned int sec, int nsec); + private: + sema_t _semaphore; }; @@ -2360,11 +2360,11 @@ void os::Solaris::init_signal_mem() { memset(pending_signals, 0, (sizeof(jint) * (Sigexit+1))); if (UseSignalChaining) { - chainedsigactions = (struct sigaction *)malloc(sizeof(struct sigaction) - * (Maxsignum + 1), mtInternal); - memset(chainedsigactions, 0, (sizeof(struct sigaction) * (Maxsignum + 1))); - preinstalled_sigs = (int *)os::malloc(sizeof(int) * (Maxsignum + 1), mtInternal); - memset(preinstalled_sigs, 0, (sizeof(int) * (Maxsignum + 1))); + chainedsigactions = (struct sigaction *)malloc(sizeof(struct sigaction) + * (Maxsignum + 1), mtInternal); + memset(chainedsigactions, 0, (sizeof(struct sigaction) * (Maxsignum + 1))); + preinstalled_sigs = (int *)os::malloc(sizeof(int) * (Maxsignum + 1), mtInternal); + memset(preinstalled_sigs, 0, (sizeof(int) * (Maxsignum + 1))); } ourSigFlags = (int*)malloc(sizeof(int) * (Maxsignum + 1 ), mtInternal); memset(ourSigFlags, 0, sizeof(int) * (Maxsignum + 1)); @@ -2405,7 +2405,7 @@ static int check_pending_signals(bool wait_for_signal) { thread->set_suspend_equivalent(); // cleared by handle_special_suspend_equivalent_condition() or java_suspend_self() while ((ret = ::sema_wait(&sig_sem)) == EINTR) - ; + ; assert(ret == 0, "sema_wait() failed"); // were we externally suspended while we were waiting? @@ -2622,37 +2622,37 @@ size_t os::numa_get_groups_num() { // doesn't have any children. Typical leaf group is a CPU or a CPU/memory // board. An LWP is assigned to one of these groups upon creation. size_t os::numa_get_leaf_groups(int *ids, size_t size) { - if ((ids[0] = Solaris::lgrp_root(Solaris::lgrp_cookie())) == -1) { - ids[0] = 0; - return 1; - } - int result_size = 0, top = 1, bottom = 0, cur = 0; - for (int k = 0; k < size; k++) { - int r = Solaris::lgrp_children(Solaris::lgrp_cookie(), ids[cur], - (Solaris::lgrp_id_t*)&ids[top], size - top); - if (r == -1) { - ids[0] = 0; - return 1; - } - if (!r) { - // That's a leaf node. - assert(bottom <= cur, "Sanity check"); - // Check if the node has memory - if (Solaris::lgrp_resources(Solaris::lgrp_cookie(), ids[cur], - NULL, 0, LGRP_RSRC_MEM) > 0) { - ids[bottom++] = ids[cur]; - } - } - top += r; - cur++; - } - if (bottom == 0) { - // Handle a situation, when the OS reports no memory available. - // Assume UMA architecture. - ids[0] = 0; - return 1; - } - return bottom; + if ((ids[0] = Solaris::lgrp_root(Solaris::lgrp_cookie())) == -1) { + ids[0] = 0; + return 1; + } + int result_size = 0, top = 1, bottom = 0, cur = 0; + for (int k = 0; k < size; k++) { + int r = Solaris::lgrp_children(Solaris::lgrp_cookie(), ids[cur], + (Solaris::lgrp_id_t*)&ids[top], size - top); + if (r == -1) { + ids[0] = 0; + return 1; + } + if (!r) { + // That's a leaf node. + assert(bottom <= cur, "Sanity check"); + // Check if the node has memory + if (Solaris::lgrp_resources(Solaris::lgrp_cookie(), ids[cur], + NULL, 0, LGRP_RSRC_MEM) > 0) { + ids[bottom++] = ids[cur]; + } + } + top += r; + cur++; + } + if (bottom == 0) { + // Handle a situation, when the OS reports no memory available. + // Assume UMA architecture. + ids[0] = 0; + return 1; + } + return bottom; } // Detect the topology change. Typically happens during CPU plugging-unplugging. @@ -2742,9 +2742,9 @@ char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info break; } } else - if (page_expected->size != 0) { - break; - } + if (page_expected->size != 0) { + break; + } if ((validity[i] & 2) != 0 && page_expected->lgrp_id > 0) { if (outdata[types * i] != page_expected->lgrp_id) { @@ -3132,7 +3132,7 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) { size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) { size_t res; assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native, - "Assumed _thread_in_native"); + "Assumed _thread_in_native"); RESTARTABLE(::read(fd, buf, (size_t) nBytes), res); return res; } @@ -3227,9 +3227,9 @@ void os::naked_yield() { // sched class attributes typedef struct { - int schedPolicy; // classID - int maxPrio; - int minPrio; + int schedPolicy; // classID + int maxPrio; + int minPrio; } SchedInfo; @@ -3392,7 +3392,7 @@ int scale_to_lwp_priority (int rMin, int rMax, int x) int v; if (x == 127) return rMax; // avoid round-down - v = (((x*(rMax-rMin)))/128)+rMin; + v = (((x*(rMax-rMin)))/128)+rMin; return v; } @@ -3425,8 +3425,8 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid, if (lwpid <= 0) { if (ThreadPriorityVerbose) { tty->print_cr("deferring the set_lwp_class_and_priority of thread " - INTPTR_FORMAT " to %d, lwpid not set", - ThreadID, newPrio); + INTPTR_FORMAT " to %d, lwpid not set", + ThreadID, newPrio); } return 0; } @@ -3459,7 +3459,7 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid, iaparms_t* iaInfo = (iaparms_t*)ParmInfo.pc_clparms; int maxClamped = MIN2(iaLimits.maxPrio, cur_class == new_class - ? (int)iaInfo->ia_uprilim : iaLimits.maxPrio); + ? (int)iaInfo->ia_uprilim : iaLimits.maxPrio); iaInfo->ia_upri = scale ? scale_to_lwp_priority(iaLimits.minPrio, maxClamped, newPrio) : newPrio; @@ -3474,7 +3474,7 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid, tsparms_t* tsInfo = (tsparms_t*)ParmInfo.pc_clparms; int maxClamped = MIN2(tsLimits.maxPrio, cur_class == new_class - ? (int)tsInfo->ts_uprilim : tsLimits.maxPrio); + ? (int)tsInfo->ts_uprilim : tsLimits.maxPrio); tsInfo->ts_upri = scale ? scale_to_lwp_priority(tsLimits.minPrio, maxClamped, newPrio) : newPrio; @@ -3488,7 +3488,7 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid, fxparms_t* fxInfo = (fxparms_t*)ParmInfo.pc_clparms; int maxClamped = MIN2(fxLimits.maxPrio, cur_class == new_class - ? (int)fxInfo->fx_uprilim : fxLimits.maxPrio); + ? (int)fxInfo->fx_uprilim : fxLimits.maxPrio); fxInfo->fx_upri = scale ? scale_to_lwp_priority(fxLimits.minPrio, maxClamped, newPrio) : newPrio; @@ -3625,16 +3625,16 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) { int lwp_status = set_lwp_class_and_priority(osthread->thread_id(), - osthread->lwp_id(), - newpri, - fxcritical ? fxLimits.schedPolicy : myClass, - !fxcritical); + osthread->lwp_id(), + newpri, + fxcritical ? fxLimits.schedPolicy : myClass, + !fxcritical); if (lwp_status != 0 && fxcritical) { // Try again, this time without changing the scheduling class newpri = java_MaxPriority_to_os_priority; lwp_status = set_lwp_class_and_priority(osthread->thread_id(), - osthread->lwp_id(), - newpri, myClass, false); + osthread->lwp_id(), + newpri, myClass, false); } status |= lwp_status; return (status == 0) ? OS_OK : OS_ERR; @@ -3830,12 +3830,12 @@ void os::SuspendedThreadTask::internal_do_task() { } class PcFetcher : public os::SuspendedThreadTask { -public: + public: PcFetcher(Thread* thread) : os::SuspendedThreadTask(thread) {} ExtendedPC result(); -protected: + protected: void do_task(const os::SuspendedThreadTaskContext& context); -private: + private: ExtendedPC _epc; }; @@ -3918,12 +3918,12 @@ void signalHandler(int sig, siginfo_t* info, void* ucVoid) { does NOT participate in signal chaining due to requirement for NOT setting SA_RESTART to make EINTR work. */ extern "C" void sigINTRHandler(int sig, siginfo_t* info, void* ucVoid) { - if (UseSignalChaining) { - struct sigaction *actp = os::Solaris::get_chained_signal_action(sig); - if (actp && actp->sa_handler) { - vm_exit_during_initialization("Signal chaining detected for VM interrupt signal, try -XX:+UseAltSigs"); - } - } + if (UseSignalChaining) { + struct sigaction *actp = os::Solaris::get_chained_signal_action(sig); + if (actp && actp->sa_handler) { + vm_exit_during_initialization("Signal chaining detected for VM interrupt signal, try -XX:+UseAltSigs"); + } + } } // This boolean allows users to forward their own non-matching signals @@ -4059,8 +4059,8 @@ void os::Solaris::set_signal_handler(int sig, bool set_installed, bool oktochain // not using stack banging if (!UseStackBanging && sig == SIGSEGV) { sigAct.sa_flags = SA_SIGINFO | SA_RESTART | SA_ONSTACK; - // Interruptible i/o requires SA_RESTART cleared so EINTR - // is returned instead of restarting system calls + // Interruptible i/o requires SA_RESTART cleared so EINTR + // is returned instead of restarting system calls } else if (sig == os::Solaris::SIGinterrupt()) { sigemptyset(&sigAct.sa_mask); sigAct.sa_handler = NULL; @@ -4142,34 +4142,34 @@ void os::Solaris::check_signal_handler(int sig) { switch (sig) { - case SIGSEGV: - case SIGBUS: - case SIGFPE: - case SIGPIPE: - case SIGXFSZ: - case SIGILL: + case SIGSEGV: + case SIGBUS: + case SIGFPE: + case SIGPIPE: + case SIGXFSZ: + case SIGILL: + jvmHandler = CAST_FROM_FN_PTR(address, signalHandler); + break; + + case SHUTDOWN1_SIGNAL: + case SHUTDOWN2_SIGNAL: + case SHUTDOWN3_SIGNAL: + case BREAK_SIGNAL: + jvmHandler = (address)user_handler(); + break; + + default: + int intrsig = os::Solaris::SIGinterrupt(); + int asynsig = os::Solaris::SIGasync(); + + if (sig == intrsig) { + jvmHandler = CAST_FROM_FN_PTR(address, sigINTRHandler); + } else if (sig == asynsig) { jvmHandler = CAST_FROM_FN_PTR(address, signalHandler); - break; - - case SHUTDOWN1_SIGNAL: - case SHUTDOWN2_SIGNAL: - case SHUTDOWN3_SIGNAL: - case BREAK_SIGNAL: - jvmHandler = (address)user_handler(); - break; - - default: - int intrsig = os::Solaris::SIGinterrupt(); - int asynsig = os::Solaris::SIGasync(); - - if (sig == intrsig) { - jvmHandler = CAST_FROM_FN_PTR(address, sigINTRHandler); - } else if (sig == asynsig) { - jvmHandler = CAST_FROM_FN_PTR(address, signalHandler); - } else { - return; - } - break; + } else { + return; + } + break; } @@ -4240,7 +4240,7 @@ void os::Solaris::install_signal_handlers() { // Pre-1.4.1 Libjsig limited to signal chaining signals <= 32 so // can not register overridable signals which might be > 32 if (libjsig_is_loaded && libjsigversion <= JSIG_VERSION_1_4_1) { - // Tell libjsig jvm has finished setting signal handlers + // Tell libjsig jvm has finished setting signal handlers (*end_signal_setting)(); libjsigdone = true; } @@ -4293,9 +4293,9 @@ const char* os::exception_name(int exception_code, char* buf, size_t size) { if (0 < exception_code && exception_code <= SIGRTMAX) { // signal if (exception_code < sizeof(signames)/sizeof(const char*)) { - jio_snprintf(buf, size, "%s", signames[exception_code]); + jio_snprintf(buf, size, "%s", signames[exception_code]); } else { - jio_snprintf(buf, size, "SIG%d", exception_code); + jio_snprintf(buf, size, "SIG%d", exception_code); } return buf; } else { @@ -4436,7 +4436,7 @@ bool os::Solaris::liblgrp_init() { os::Solaris::set_lgrp_resources(CAST_TO_FN_PTR(lgrp_resources_func_t, dlsym(handle, "lgrp_resources"))); os::Solaris::set_lgrp_nlgrps(CAST_TO_FN_PTR(lgrp_nlgrps_func_t, dlsym(handle, "lgrp_nlgrps"))); os::Solaris::set_lgrp_cookie_stale(CAST_TO_FN_PTR(lgrp_cookie_stale_func_t, - dlsym(handle, "lgrp_cookie_stale"))); + dlsym(handle, "lgrp_cookie_stale"))); lgrp_cookie_t c = lgrp_init(LGRP_VIEW_CALLER); set_lgrp_cookie(c); @@ -4587,12 +4587,12 @@ jint os::init_2(void) { // Add in 2*BytesPerWord times page size to account for VM stack during // class initialization depending on 32 or 64 bit VM. os::Solaris::min_stack_allowed = MAX2(os::Solaris::min_stack_allowed, - (size_t)(StackYellowPages+StackRedPages+StackShadowPages+ - 2*BytesPerWord COMPILER2_PRESENT(+1)) * page_size); + (size_t)(StackYellowPages+StackRedPages+StackShadowPages+ + 2*BytesPerWord COMPILER2_PRESENT(+1)) * page_size); size_t threadStackSizeInBytes = ThreadStackSize * K; if (threadStackSizeInBytes != 0 && - threadStackSizeInBytes < os::Solaris::min_stack_allowed) { + threadStackSizeInBytes < os::Solaris::min_stack_allowed) { tty->print_cr("\nThe stack size specified is too small, Specify at least %dk", os::Solaris::min_stack_allowed/K); return JNI_ERR; @@ -4606,17 +4606,17 @@ jint os::init_2(void) { // should be to fix the guard page mechanism. if (vm_page_size() > 8*K) { - threadStackSizeInBytes = (threadStackSizeInBytes != 0) - ? threadStackSizeInBytes + - ((StackYellowPages + StackRedPages) * vm_page_size()) - : 0; - ThreadStackSize = threadStackSizeInBytes/K; + threadStackSizeInBytes = (threadStackSizeInBytes != 0) + ? threadStackSizeInBytes + + ((StackYellowPages + StackRedPages) * vm_page_size()) + : 0; + ThreadStackSize = threadStackSizeInBytes/K; } // Make the stack size a multiple of the page size so that // the yellow/red zones can be guarded. JavaThread::set_stack_size_at_create(round_to(threadStackSizeInBytes, - vm_page_size())); + vm_page_size())); Solaris::libthread_init(); @@ -4737,7 +4737,7 @@ int local_vsnprintf(char* buf, size_t count, const char* fmt, va_list argptr) { //search for the named symbol in the objects that were loaded after libjvm void* where = RTLD_NEXT; if ((sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "__vsnprintf"))) == NULL) - sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "vsnprintf")); + sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "vsnprintf")); if (!sol_vsnprintf){ //search for the named symbol in the objects that were loaded before libjvm where = RTLD_DEFAULT; @@ -4846,13 +4846,13 @@ int os::open(const char *path, int oflag, int mode) { * http://technopark02.blogspot.com/2005_05_01_archive.html */ #ifndef _LP64 - if ((!enabled_extended_FILE_stdio) && fd < 256) { - int newfd = ::fcntl(fd, F_DUPFD, 256); - if (newfd != -1) { - ::close(fd); - fd = newfd; - } - } + if ((!enabled_extended_FILE_stdio) && fd < 256) { + int newfd = ::fcntl(fd, F_DUPFD, 256); + if (newfd != -1) { + ::close(fd); + fd = newfd; + } + } #endif // 32-bit Solaris /* * All file descriptors that are opened in the JVM and not @@ -4877,11 +4877,11 @@ int os::open(const char *path, int oflag, int mode) { * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9 */ #ifdef FD_CLOEXEC - { - int flags = ::fcntl(fd, F_GETFD); - if (flags != -1) - ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC); - } + { + int flags = ::fcntl(fd, F_GETFD); + if (flags != -1) + ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC); + } #endif if (o_delete != 0) { @@ -4927,7 +4927,7 @@ int os::fsync(int fd) { int os::available(int fd, jlong *bytes) { assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native, - "Assumed _thread_in_native"); + "Assumed _thread_in_native"); jlong cur, end; int mode; struct stat64 buf64; @@ -4939,7 +4939,7 @@ int os::available(int fd, jlong *bytes) { RESTARTABLE(::ioctl(fd, FIONREAD, &n), ioctl_return); if (ioctl_return>= 0) { - *bytes = n; + *bytes = n; return 1; } } @@ -4957,8 +4957,8 @@ int os::available(int fd, jlong *bytes) { // Map a block of memory. char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset, - char *addr, size_t bytes, bool read_only, - bool allow_exec) { + char *addr, size_t bytes, bool read_only, + bool allow_exec) { int prot; int flags; @@ -4989,8 +4989,8 @@ char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset, // Remap a block of memory. char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset, - char *addr, size_t bytes, bool read_only, - bool allow_exec) { + char *addr, size_t bytes, bool read_only, + bool allow_exec) { // same as map_memory() on this OS return os::map_memory(fd, file_name, file_offset, addr, bytes, read_only, allow_exec); @@ -5019,7 +5019,7 @@ void os::pause() { } } else { jio_fprintf(stderr, - "Could not open pause file '%s', continuing immediately.\n", filename); + "Could not open pause file '%s', continuing immediately.\n", filename); } } @@ -5208,16 +5208,16 @@ jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { int fd; sprintf(proc_name, "/proc/%d/lwp/%d/lwpusage", - getpid(), - thread->osthread()->lwp_id()); + getpid(), + thread->osthread()->lwp_id()); fd = ::open(proc_name, O_RDONLY); if (fd == -1) return -1; do { count = ::pread(fd, - (void *)&prusage.pr_utime, - thr_time_size, - thr_time_off); + (void *)&prusage.pr_utime, + thr_time_size, + thr_time_off); } while (count < 0 && errno == EINTR); ::close(fd); if (count < 0) return -1; @@ -5413,15 +5413,15 @@ static timestruc_t* compute_abstime(timestruc_t* abstime, jlong millis) { // leave it alone rather than always rounding down. if (millis > 0 && millis < ROUNDINGFIX) millis = ROUNDINGFIX; - // It appears that when we go directly through Solaris _lwp_cond_timedwait() - // the acceptable max time threshold is smaller than for libthread on 2.5.1 and 2.6 - max_wait_period = 21000000; + // It appears that when we go directly through Solaris _lwp_cond_timedwait() + // the acceptable max time threshold is smaller than for libthread on 2.5.1 and 2.6 + max_wait_period = 21000000; } else { max_wait_period = 50000000; } millis %= 1000; if (seconds > max_wait_period) { // see man cond_timedwait(3T) - seconds = max_wait_period; + seconds = max_wait_period; } abstime->tv_sec = now.tv_sec + seconds; long usec = now.tv_usec + millis * 1000; @@ -5440,34 +5440,34 @@ void os::PlatformEvent::park() { // AKA: down() int v; for (;;) { - v = _Event; - if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; + v = _Event; + if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; } guarantee(v >= 0, "invariant"); if (v == 0) { - // Do this the hard way by blocking ... - // See http://monaco.sfbay/detail.jsf?cr=5094058. - // TODO-FIXME: for Solaris SPARC set fprs.FEF=0 prior to parking. - // Only for SPARC >= V8PlusA + // Do this the hard way by blocking ... + // See http://monaco.sfbay/detail.jsf?cr=5094058. + // TODO-FIXME: for Solaris SPARC set fprs.FEF=0 prior to parking. + // Only for SPARC >= V8PlusA #if defined(__sparc) && defined(COMPILER2) - if (ClearFPUAtPark) { _mark_fpu_nosave(); } + if (ClearFPUAtPark) { _mark_fpu_nosave(); } #endif - int status = os::Solaris::mutex_lock(_mutex); - assert_status(status == 0, status, "mutex_lock"); - guarantee(_nParked == 0, "invariant"); - ++_nParked; - while (_Event < 0) { - // for some reason, under 2.7 lwp_cond_wait() may return ETIME ... - // Treat this the same as if the wait was interrupted - // With usr/lib/lwp going to kernel, always handle ETIME - status = os::Solaris::cond_wait(_cond, _mutex); - if (status == ETIME) status = EINTR; - assert_status(status == 0 || status == EINTR, status, "cond_wait"); - } - --_nParked; - _Event = 0; - status = os::Solaris::mutex_unlock(_mutex); - assert_status(status == 0, status, "mutex_unlock"); + int status = os::Solaris::mutex_lock(_mutex); + assert_status(status == 0, status, "mutex_lock"); + guarantee(_nParked == 0, "invariant"); + ++_nParked; + while (_Event < 0) { + // for some reason, under 2.7 lwp_cond_wait() may return ETIME ... + // Treat this the same as if the wait was interrupted + // With usr/lib/lwp going to kernel, always handle ETIME + status = os::Solaris::cond_wait(_cond, _mutex); + if (status == ETIME) status = EINTR; + assert_status(status == 0 || status == EINTR, status, "cond_wait"); + } + --_nParked; + _Event = 0; + status = os::Solaris::mutex_unlock(_mutex); + assert_status(status == 0, status, "mutex_unlock"); // Paranoia to ensure our locked and lock-free paths interact // correctly with each other. OrderAccess::fence(); @@ -5478,8 +5478,8 @@ int os::PlatformEvent::park(jlong millis) { guarantee(_nParked == 0, "invariant"); int v; for (;;) { - v = _Event; - if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; + v = _Event; + if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; } guarantee(v >= 0, "invariant"); if (v != 0) return OS_OK; @@ -5492,20 +5492,20 @@ int os::PlatformEvent::park(jlong millis) { // For Solaris SPARC set fprs.FEF=0 prior to parking. // Only for SPARC >= V8PlusA #if defined(__sparc) && defined(COMPILER2) - if (ClearFPUAtPark) { _mark_fpu_nosave(); } + if (ClearFPUAtPark) { _mark_fpu_nosave(); } #endif int status = os::Solaris::mutex_lock(_mutex); assert_status(status == 0, status, "mutex_lock"); guarantee(_nParked == 0, "invariant"); ++_nParked; while (_Event < 0) { - int status = os::Solaris::cond_timedwait(_cond, _mutex, &abst); - assert_status(status == 0 || status == EINTR || - status == ETIME || status == ETIMEDOUT, - status, "cond_timedwait"); - if (!FilterSpuriousWakeups) break; // previous semantics - if (status == ETIME || status == ETIMEDOUT) break; - // We consume and ignore EINTR and spurious wakeups. + int status = os::Solaris::cond_timedwait(_cond, _mutex, &abst); + assert_status(status == 0 || status == EINTR || + status == ETIME || status == ETIMEDOUT, + status, "cond_timedwait"); + if (!FilterSpuriousWakeups) break; // previous semantics + if (status == ETIME || status == ETIMEDOUT) break; + // We consume and ignore EINTR and spurious wakeups. } --_nParked; if (_Event >= 0) ret = OS_OK; @@ -5786,26 +5786,26 @@ int os::fork_and_exec(char* cmd) { // Wait for the child process to exit. This returns immediately if // the child has already exited. */ while (waitpid(pid, &status, 0) < 0) { - switch (errno) { - case ECHILD: return 0; - case EINTR: break; - default: return -1; - } + switch (errno) { + case ECHILD: return 0; + case EINTR: break; + default: return -1; + } } if (WIFEXITED(status)) { - // The child exited normally; get its exit code. - return WEXITSTATUS(status); + // The child exited normally; get its exit code. + return WEXITSTATUS(status); } else if (WIFSIGNALED(status)) { - // The child exited because of a signal - // The best value to return is 0x80 + signal number, - // because that is what all Unix shells do, and because - // it allows callers to distinguish between process exit and - // process death by signal. - return 0x80 + WTERMSIG(status); + // The child exited because of a signal + // The best value to return is 0x80 + signal number, + // because that is what all Unix shells do, and because + // it allows callers to distinguish between process exit and + // process death by signal. + return 0x80 + WTERMSIG(status); } else { - // Unknown exit code; pass it through - return status; + // Unknown exit code; pass it through + return status; } } } @@ -5819,43 +5819,43 @@ int os::fork_and_exec(char* cmd) { // as libawt.so, and renamed libawt_xawt.so // bool os::is_headless_jre() { - struct stat statbuf; - char buf[MAXPATHLEN]; - char libmawtpath[MAXPATHLEN]; - const char *xawtstr = "/xawt/libmawt.so"; - const char *new_xawtstr = "/libawt_xawt.so"; - char *p; + struct stat statbuf; + char buf[MAXPATHLEN]; + char libmawtpath[MAXPATHLEN]; + const char *xawtstr = "/xawt/libmawt.so"; + const char *new_xawtstr = "/libawt_xawt.so"; + char *p; - // Get path to libjvm.so - os::jvm_path(buf, sizeof(buf)); + // Get path to libjvm.so + os::jvm_path(buf, sizeof(buf)); - // Get rid of libjvm.so - p = strrchr(buf, '/'); - if (p == NULL) return false; - else *p = '\0'; + // Get rid of libjvm.so + p = strrchr(buf, '/'); + if (p == NULL) return false; + else *p = '\0'; - // Get rid of client or server - p = strrchr(buf, '/'); - if (p == NULL) return false; - else *p = '\0'; + // Get rid of client or server + p = strrchr(buf, '/'); + if (p == NULL) return false; + else *p = '\0'; - // check xawt/libmawt.so - strcpy(libmawtpath, buf); - strcat(libmawtpath, xawtstr); - if (::stat(libmawtpath, &statbuf) == 0) return false; + // check xawt/libmawt.so + strcpy(libmawtpath, buf); + strcat(libmawtpath, xawtstr); + if (::stat(libmawtpath, &statbuf) == 0) return false; - // check libawt_xawt.so - strcpy(libmawtpath, buf); - strcat(libmawtpath, new_xawtstr); - if (::stat(libmawtpath, &statbuf) == 0) return false; + // check libawt_xawt.so + strcpy(libmawtpath, buf); + strcat(libmawtpath, new_xawtstr); + if (::stat(libmawtpath, &statbuf) == 0) return false; - return true; + return true; } size_t os::write(int fd, const void *buf, unsigned int nBytes) { size_t res; assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native, - "Assumed _thread_in_native"); + "Assumed _thread_in_native"); RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res); return res; } @@ -5870,13 +5870,13 @@ int os::socket_close(int fd) { int os::recv(int fd, char* buf, size_t nBytes, uint flags) { assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native, - "Assumed _thread_in_native"); + "Assumed _thread_in_native"); RESTARTABLE_RETURN_INT((int)::recv(fd, buf, nBytes, flags)); } int os::send(int fd, char* buf, size_t nBytes, uint flags) { assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native, - "Assumed _thread_in_native"); + "Assumed _thread_in_native"); RESTARTABLE_RETURN_INT((int)::send(fd, buf, nBytes, flags)); } @@ -5899,7 +5899,7 @@ int os::timeout(int fd, long timeout) { pfd.events = POLLIN; assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native, - "Assumed _thread_in_native"); + "Assumed _thread_in_native"); gettimeofday(&t, &aNull); prevtime = ((julong)t.tv_sec * 1000) + t.tv_usec / 1000; @@ -5907,14 +5907,14 @@ int os::timeout(int fd, long timeout) { for (;;) { res = ::poll(&pfd, 1, timeout); if (res == OS_ERR && errno == EINTR) { - if (timeout != -1) { - gettimeofday(&t, &aNull); - newtime = ((julong)t.tv_sec * 1000) + t.tv_usec /1000; - timeout -= newtime - prevtime; - if (timeout <= 0) - return OS_OK; - prevtime = newtime; - } + if (timeout != -1) { + gettimeofday(&t, &aNull); + newtime = ((julong)t.tv_sec * 1000) + t.tv_usec /1000; + timeout -= newtime - prevtime; + if (timeout <= 0) + return OS_OK; + prevtime = newtime; + } } else return res; } } @@ -5944,40 +5944,40 @@ int os::connect(int fd, struct sockaddr *him, socklen_t len) { // EISCONN The socket is already connected. if (_result == OS_ERR && errno == EINTR) { /* restarting a connect() changes its errno semantics */ - RESTARTABLE(::connect(fd, him, len), _result); + RESTARTABLE(::connect(fd, him, len), _result); /* undo these changes */ - if (_result == OS_ERR) { - if (errno == EALREADY) { - errno = EINPROGRESS; /* fall through */ - } else if (errno == EISCONN) { - errno = 0; - return OS_OK; - } - } - } - return _result; - } + if (_result == OS_ERR) { + if (errno == EALREADY) { + errno = EINPROGRESS; /* fall through */ + } else if (errno == EISCONN) { + errno = 0; + return OS_OK; + } + } + } + return _result; +} int os::accept(int fd, struct sockaddr* him, socklen_t* len) { if (fd < 0) { return OS_ERR; } assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native, - "Assumed _thread_in_native"); + "Assumed _thread_in_native"); RESTARTABLE_RETURN_INT((int)::accept(fd, him, len)); } int os::recvfrom(int fd, char* buf, size_t nBytes, uint flags, sockaddr* from, socklen_t* fromlen) { assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native, - "Assumed _thread_in_native"); + "Assumed _thread_in_native"); RESTARTABLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, flags, from, fromlen)); } int os::sendto(int fd, char* buf, size_t len, uint flags, struct sockaddr* to, socklen_t tolen) { assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native, - "Assumed _thread_in_native"); + "Assumed _thread_in_native"); RESTARTABLE_RETURN_INT((int)::sendto(fd, buf, len, flags, to, tolen)); } @@ -5994,8 +5994,8 @@ int os::socket_available(int fd, jint *pbytes) { int os::bind(int fd, struct sockaddr* him, socklen_t len) { assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native, - "Assumed _thread_in_native"); - return ::bind(fd, him, len); + "Assumed _thread_in_native"); + return ::bind(fd, him, len); } // Get the default path to the core file diff --git a/hotspot/src/os/solaris/vm/os_solaris.hpp b/hotspot/src/os/solaris/vm/os_solaris.hpp index ab0ab85f438..264ffe7c25b 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.hpp +++ b/hotspot/src/os/solaris/vm/os_solaris.hpp @@ -61,8 +61,8 @@ class Solaris { typedef id_t lgrp_id_t; typedef int lgrp_rsrc_t; typedef enum lgrp_view { - LGRP_VIEW_CALLER, /* what's available to the caller */ - LGRP_VIEW_OS /* what's available to operating system */ + LGRP_VIEW_CALLER, /* what's available to the caller */ + LGRP_VIEW_OS /* what's available to operating system */ } lgrp_view_t; typedef uint_t (*getisax_func_t)(uint32_t* array, uint_t n); @@ -74,8 +74,8 @@ class Solaris { typedef int (*lgrp_children_func_t)(lgrp_cookie_t cookie, lgrp_id_t parent, lgrp_id_t *lgrp_array, uint_t lgrp_array_size); typedef int (*lgrp_resources_func_t)(lgrp_cookie_t cookie, lgrp_id_t lgrp, - lgrp_id_t *lgrp_array, uint_t lgrp_array_size, - lgrp_rsrc_t type); + lgrp_id_t *lgrp_array, uint_t lgrp_array_size, + lgrp_rsrc_t type); typedef int (*lgrp_nlgrps_func_t)(lgrp_cookie_t cookie); typedef int (*lgrp_cookie_stale_func_t)(lgrp_cookie_t cookie); typedef int (*meminfo_func_t)(const uint64_t inaddr[], int addr_count, @@ -128,7 +128,7 @@ class Solaris { static bool valid_stack_address(Thread* thread, address sp); static bool valid_ucontext(Thread* thread, ucontext_t* valid, ucontext_t* suspect); static ucontext_t* get_valid_uc_in_signal_handler(Thread* thread, - ucontext_t* uc); + ucontext_t* uc); static ExtendedPC ucontext_get_ExtendedPC(ucontext_t* uc); static intptr_t* ucontext_get_sp(ucontext_t* uc); @@ -143,7 +143,7 @@ class Solaris { // os_solaris_i486.hpp and os_solaris_sparc.hpp, but that file // provides extensions to the os class and not the Solaris class. static ExtendedPC fetch_frame_from_ucontext(Thread* thread, ucontext_t* uc, - intptr_t** ret_sp, intptr_t** ret_fp); + intptr_t** ret_sp, intptr_t** ret_fp); static void hotspot_sigmask(Thread* thread); @@ -249,7 +249,7 @@ class Solaris { static int lgrp_fini(lgrp_cookie_t cookie) { return _lgrp_fini != NULL ? _lgrp_fini(cookie) : -1; } static lgrp_id_t lgrp_root(lgrp_cookie_t cookie) { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; }; static int lgrp_children(lgrp_cookie_t cookie, lgrp_id_t parent, - lgrp_id_t *lgrp_array, uint_t lgrp_array_size) { + lgrp_id_t *lgrp_array, uint_t lgrp_array_size) { return _lgrp_children != NULL ? _lgrp_children(cookie, parent, lgrp_array, lgrp_array_size) : -1; } static int lgrp_resources(lgrp_cookie_t cookie, lgrp_id_t lgrp, @@ -269,8 +269,8 @@ class Solaris { static void set_meminfo(meminfo_func_t func) { _meminfo = func; } static int meminfo (const uint64_t inaddr[], int addr_count, - const uint_t info_req[], int info_count, - uint64_t outdata[], uint_t validity[]) { + const uint_t info_req[], int info_count, + uint64_t outdata[], uint_t validity[]) { return _meminfo != NULL ? _meminfo(inaddr, addr_count, info_req, info_count, outdata, validity) : -1; } @@ -300,57 +300,57 @@ class Solaris { }; class PlatformEvent : public CHeapObj { - private: - double CachePad[4]; // increase odds that _mutex is sole occupant of cache line - volatile int _Event; - int _nParked; - int _pipev[2]; - mutex_t _mutex[1]; - cond_t _cond[1]; - double PostPad[2]; + private: + double CachePad[4]; // increase odds that _mutex is sole occupant of cache line + volatile int _Event; + int _nParked; + int _pipev[2]; + mutex_t _mutex[1]; + cond_t _cond[1]; + double PostPad[2]; - protected: - // Defining a protected ctor effectively gives us an abstract base class. - // That is, a PlatformEvent can never be instantiated "naked" but only - // as a part of a ParkEvent (recall that ParkEvent extends PlatformEvent). - // TODO-FIXME: make dtor private - ~PlatformEvent() { guarantee(0, "invariant"); } - PlatformEvent() { - int status; - status = os::Solaris::cond_init(_cond); - assert_status(status == 0, status, "cond_init"); - status = os::Solaris::mutex_init(_mutex); - assert_status(status == 0, status, "mutex_init"); - _Event = 0; - _nParked = 0; - _pipev[0] = _pipev[1] = -1; - } + protected: + // Defining a protected ctor effectively gives us an abstract base class. + // That is, a PlatformEvent can never be instantiated "naked" but only + // as a part of a ParkEvent (recall that ParkEvent extends PlatformEvent). + // TODO-FIXME: make dtor private + ~PlatformEvent() { guarantee(0, "invariant"); } + PlatformEvent() { + int status; + status = os::Solaris::cond_init(_cond); + assert_status(status == 0, status, "cond_init"); + status = os::Solaris::mutex_init(_mutex); + assert_status(status == 0, status, "mutex_init"); + _Event = 0; + _nParked = 0; + _pipev[0] = _pipev[1] = -1; + } - public: - // Exercise caution using reset() and fired() -- they may require MEMBARs - void reset() { _Event = 0; } - int fired() { return _Event; } - void park(); - int park(jlong millis); - void unpark(); + public: + // Exercise caution using reset() and fired() -- they may require MEMBARs + void reset() { _Event = 0; } + int fired() { return _Event; } + void park(); + int park(jlong millis); + void unpark(); }; class PlatformParker : public CHeapObj { - protected: - mutex_t _mutex[1]; - cond_t _cond[1]; + protected: + mutex_t _mutex[1]; + cond_t _cond[1]; - public: // TODO-FIXME: make dtor private - ~PlatformParker() { guarantee(0, "invariant"); } + public: // TODO-FIXME: make dtor private + ~PlatformParker() { guarantee(0, "invariant"); } - public: - PlatformParker() { - int status; - status = os::Solaris::cond_init(_cond); - assert_status(status == 0, status, "cond_init"); - status = os::Solaris::mutex_init(_mutex); - assert_status(status == 0, status, "mutex_init"); - } + public: + PlatformParker() { + int status; + status = os::Solaris::cond_init(_cond); + assert_status(status == 0, status, "cond_init"); + status = os::Solaris::mutex_init(_mutex); + assert_status(status == 0, status, "mutex_init"); + } }; #endif // OS_SOLARIS_VM_OS_SOLARIS_HPP diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index ae9cbe3b397..37b343f25b8 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -126,18 +126,18 @@ HINSTANCE vm_lib_handle; BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) { switch (reason) { - case DLL_PROCESS_ATTACH: - vm_lib_handle = hinst; - if (ForceTimeHighResolution) - timeBeginPeriod(1L); - break; - case DLL_PROCESS_DETACH: - if (ForceTimeHighResolution) - timeEndPeriod(1L); + case DLL_PROCESS_ATTACH: + vm_lib_handle = hinst; + if (ForceTimeHighResolution) + timeBeginPeriod(1L); + break; + case DLL_PROCESS_DETACH: + if (ForceTimeHighResolution) + timeEndPeriod(1L); - break; - default: - break; + break; + default: + break; } return true; } @@ -153,8 +153,8 @@ static inline double fileTimeAsDouble(FILETIME* time) { // Implementation of os bool os::getenv(const char* name, char* buffer, int len) { - int result = GetEnvironmentVariable(name, buffer, len); - return result > 0 && result < len; + int result = GetEnvironmentVariable(name, buffer, len); + return result > 0 && result < len; } bool os::unsetenv(const char* name) { @@ -182,41 +182,41 @@ LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo); void os::init_system_properties_values() { /* sysclasspath, java_home, dll_dir */ { - char *home_path; - char *dll_path; - char *pslash; - char *bin = "\\bin"; - char home_dir[MAX_PATH]; + char *home_path; + char *dll_path; + char *pslash; + char *bin = "\\bin"; + char home_dir[MAX_PATH]; - if (!getenv("_ALT_JAVA_HOME_DIR", home_dir, MAX_PATH)) { - os::jvm_path(home_dir, sizeof(home_dir)); - // Found the full path to jvm.dll. - // Now cut the path to /jre if we can. - *(strrchr(home_dir, '\\')) = '\0'; /* get rid of \jvm.dll */ - pslash = strrchr(home_dir, '\\'); - if (pslash != NULL) { - *pslash = '\0'; /* get rid of \{client|server} */ - pslash = strrchr(home_dir, '\\'); - if (pslash != NULL) - *pslash = '\0'; /* get rid of \bin */ - } + if (!getenv("_ALT_JAVA_HOME_DIR", home_dir, MAX_PATH)) { + os::jvm_path(home_dir, sizeof(home_dir)); + // Found the full path to jvm.dll. + // Now cut the path to /jre if we can. + *(strrchr(home_dir, '\\')) = '\0'; /* get rid of \jvm.dll */ + pslash = strrchr(home_dir, '\\'); + if (pslash != NULL) { + *pslash = '\0'; /* get rid of \{client|server} */ + pslash = strrchr(home_dir, '\\'); + if (pslash != NULL) + *pslash = '\0'; /* get rid of \bin */ } + } - home_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + 1, mtInternal); - if (home_path == NULL) - return; - strcpy(home_path, home_dir); - Arguments::set_java_home(home_path); + home_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + 1, mtInternal); + if (home_path == NULL) + return; + strcpy(home_path, home_dir); + Arguments::set_java_home(home_path); - dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1, mtInternal); - if (dll_path == NULL) - return; - strcpy(dll_path, home_dir); - strcat(dll_path, bin); - Arguments::set_dll_dir(dll_path); + dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1, mtInternal); + if (dll_path == NULL) + return; + strcpy(dll_path, home_dir); + strcat(dll_path, bin); + Arguments::set_dll_dir(dll_path); - if (!set_boot_path('\\', ';')) - return; + if (!set_boot_path('\\', ';')) + return; } /* library_path */ @@ -239,7 +239,7 @@ void os::init_system_properties_values() { char *path_str = ::getenv("PATH"); library_path = NEW_C_HEAP_ARRAY(char, MAX_PATH * 5 + sizeof(PACKAGE_DIR) + - sizeof(BIN_DIR) + (path_str ? strlen(path_str) : 0) + 10, mtInternal); + sizeof(BIN_DIR) + (path_str ? strlen(path_str) : 0) + 10, mtInternal); library_path[0] = '\0'; @@ -261,8 +261,8 @@ void os::init_system_properties_values() { strcat(library_path, tmp); if (path_str) { - strcat(library_path, ";"); - strcat(library_path, path_str); + strcat(library_path, ";"); + strcat(library_path, path_str); } strcat(library_path, ";."); @@ -277,7 +277,7 @@ void os::init_system_properties_values() { char buf[2 * MAX_PATH + 2 * sizeof(EXT_DIR) + sizeof(PACKAGE_DIR) + 1]; GetWindowsDirectory(path, MAX_PATH); sprintf(buf, "%s%s;%s%s%s", Arguments::get_java_home(), EXT_DIR, - path, PACKAGE_DIR, EXT_DIR); + path, PACKAGE_DIR, EXT_DIR); Arguments::set_ext_dirs(buf); } #undef EXT_DIR @@ -322,7 +322,7 @@ int os::get_native_stack(address* stack, int frames, int toSkip) { toSkip ++; #endif int captured = Kernel32Dll::RtlCaptureStackBackTrace(toSkip + 1, frames, - (PVOID*)stack, NULL); + (PVOID*)stack, NULL); for (int index = captured; index < frames; index ++) { stack[index] = NULL; } @@ -445,10 +445,10 @@ static unsigned __stdcall java_start(Thread* thread) { // by VM, so VM can generate error dump when an exception occurred in non- // Java thread (e.g. VM thread). __try { - thread->run(); + thread->run(); } __except(topLevelExceptionFilter( - (_EXCEPTION_POINTERS*)_exception_info())) { - // Nothing to do. + (_EXCEPTION_POINTERS*)_exception_info())) { + // Nothing to do. } // One less thread is executing @@ -509,7 +509,7 @@ bool os::create_attached_thread(JavaThread* thread) { OSThread* osthread = create_os_thread(thread, thread_h, (int)current_thread_id()); if (osthread == NULL) { - return false; + return false; } // Initial thread state is RUNNABLE @@ -525,9 +525,9 @@ bool os::create_main_thread(JavaThread* thread) { #endif if (_starting_thread == NULL) { _starting_thread = create_os_thread(thread, main_thread, main_thread_id); - if (_starting_thread == NULL) { - return false; - } + if (_starting_thread == NULL) { + return false; + } } // The primordial thread is runnable from the start) @@ -616,12 +616,12 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { // perhaps STACK_SIZE_PARAM_IS_A_RESERVATION is not supported, try again // without the flag. thread_handle = - (HANDLE)_beginthreadex(NULL, - (unsigned)stack_size, - (unsigned (__stdcall *)(void*)) java_start, - thread, - CREATE_SUSPENDED, - &thread_id); + (HANDLE)_beginthreadex(NULL, + (unsigned)stack_size, + (unsigned (__stdcall *)(void*)) java_start, + thread, + CREATE_SUSPENDED, + &thread_id); } if (thread_handle == NULL) { // Need to clean up stuff we've allocated so far @@ -683,8 +683,8 @@ jlong os::elapsed_frequency() { if (win32::_has_performance_count) { return performance_frequency; } else { - // the FILETIME time is the number of 100-nanosecond intervals since January 1,1601. - return 10000000; + // the FILETIME time is the number of 100-nanosecond intervals since January 1,1601. + return 10000000; } } @@ -916,15 +916,15 @@ char* os::local_time_string(char *buf, size_t buflen) { } bool os::getTimesSecs(double* process_real_time, - double* process_user_time, - double* process_system_time) { + double* process_user_time, + double* process_system_time) { HANDLE h_process = GetCurrentProcess(); FILETIME create_time, exit_time, kernel_time, user_time; BOOL result = GetProcessTimes(h_process, - &create_time, - &exit_time, - &kernel_time, - &user_time); + &create_time, + &exit_time, + &kernel_time, + &user_time); if (result != 0) { FILETIME wt; GetSystemTimeAsFileTime(&wt); @@ -997,9 +997,9 @@ void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* } _MiniDumpWriteDump = CAST_TO_FN_PTR( - BOOL(WINAPI *)( HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, - PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION), - GetProcAddress(dbghelp, "MiniDumpWriteDump")); + BOOL(WINAPI *)( HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, + PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION), + GetProcAddress(dbghelp, "MiniDumpWriteDump")); if (_MiniDumpWriteDump == NULL) { VMError::report_coredump_status("Failed to find MiniDumpWriteDump() in module dbghelp.dll", false); @@ -1012,7 +1012,7 @@ void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* // API_VERSION_NUMBER 11 or higher contains the ones we want though #if API_VERSION_NUMBER >= 11 dumpType = (MINIDUMP_TYPE)(dumpType | MiniDumpWithFullMemoryInfo | MiniDumpWithThreadInfo | - MiniDumpWithUnloadedModules); + MiniDumpWithUnloadedModules); #endif cwd = get_current_directory(NULL, 0); @@ -1039,21 +1039,21 @@ void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then. if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) == false && _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL) == false) { - DWORD error = GetLastError(); - LPTSTR msgbuf = NULL; + DWORD error = GetLastError(); + LPTSTR msgbuf = NULL; - if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, 0, (LPTSTR)&msgbuf, 0, NULL) != 0) { - jio_snprintf(buffer, bufferSize, "Call to MiniDumpWriteDump() failed (Error 0x%x: %s)", error, msgbuf); - LocalFree(msgbuf); - } else { - // Call to FormatMessage failed, just include the result from GetLastError - jio_snprintf(buffer, bufferSize, "Call to MiniDumpWriteDump() failed (Error 0x%x)", error); - } - VMError::report_coredump_status(buffer, false); + jio_snprintf(buffer, bufferSize, "Call to MiniDumpWriteDump() failed (Error 0x%x: %s)", error, msgbuf); + LocalFree(msgbuf); + } else { + // Call to FormatMessage failed, just include the result from GetLastError + jio_snprintf(buffer, bufferSize, "Call to MiniDumpWriteDump() failed (Error 0x%x)", error); + } + VMError::report_coredump_status(buffer, false); } else { VMError::report_coredump_status(buffer, true); } @@ -1086,70 +1086,70 @@ void os::die() { DIR * os::opendir(const char *dirname) { - assert(dirname != NULL, "just checking"); // hotspot change - DIR *dirp = (DIR *)malloc(sizeof(DIR), mtInternal); - DWORD fattr; // hotspot change - char alt_dirname[4] = { 0, 0, 0, 0 }; + assert(dirname != NULL, "just checking"); // hotspot change + DIR *dirp = (DIR *)malloc(sizeof(DIR), mtInternal); + DWORD fattr; // hotspot change + char alt_dirname[4] = { 0, 0, 0, 0 }; - if (dirp == 0) { - errno = ENOMEM; - return 0; - } + if (dirp == 0) { + errno = ENOMEM; + return 0; + } /* * Win32 accepts "\" in its POSIX stat(), but refuses to treat it * as a directory in FindFirstFile(). We detect this case here and * prepend the current drive name. */ - if (dirname[1] == '\0' && dirname[0] == '\\') { - alt_dirname[0] = _getdrive() + 'A' - 1; - alt_dirname[1] = ':'; - alt_dirname[2] = '\\'; - alt_dirname[3] = '\0'; - dirname = alt_dirname; - } + if (dirname[1] == '\0' && dirname[0] == '\\') { + alt_dirname[0] = _getdrive() + 'A' - 1; + alt_dirname[1] = ':'; + alt_dirname[2] = '\\'; + alt_dirname[3] = '\0'; + dirname = alt_dirname; + } - dirp->path = (char *)malloc(strlen(dirname) + 5, mtInternal); - if (dirp->path == 0) { - free(dirp, mtInternal); - errno = ENOMEM; - return 0; - } - strcpy(dirp->path, dirname); + dirp->path = (char *)malloc(strlen(dirname) + 5, mtInternal); + if (dirp->path == 0) { + free(dirp, mtInternal); + errno = ENOMEM; + return 0; + } + strcpy(dirp->path, dirname); - fattr = GetFileAttributes(dirp->path); - if (fattr == 0xffffffff) { - free(dirp->path, mtInternal); - free(dirp, mtInternal); - errno = ENOENT; - return 0; - } else if ((fattr & FILE_ATTRIBUTE_DIRECTORY) == 0) { - free(dirp->path, mtInternal); - free(dirp, mtInternal); - errno = ENOTDIR; - return 0; - } + fattr = GetFileAttributes(dirp->path); + if (fattr == 0xffffffff) { + free(dirp->path, mtInternal); + free(dirp, mtInternal); + errno = ENOENT; + return 0; + } else if ((fattr & FILE_ATTRIBUTE_DIRECTORY) == 0) { + free(dirp->path, mtInternal); + free(dirp, mtInternal); + errno = ENOTDIR; + return 0; + } /* Append "*.*", or possibly "\\*.*", to path */ - if (dirp->path[1] == ':' - && (dirp->path[2] == '\0' - || (dirp->path[2] == '\\' && dirp->path[3] == '\0'))) { + if (dirp->path[1] == ':' + && (dirp->path[2] == '\0' + || (dirp->path[2] == '\\' && dirp->path[3] == '\0'))) { /* No '\\' needed for cases like "Z:" or "Z:\" */ - strcat(dirp->path, "*.*"); - } else { - strcat(dirp->path, "\\*.*"); - } + strcat(dirp->path, "*.*"); + } else { + strcat(dirp->path, "\\*.*"); + } - dirp->handle = FindFirstFile(dirp->path, &dirp->find_data); - if (dirp->handle == INVALID_HANDLE_VALUE) { - if (GetLastError() != ERROR_FILE_NOT_FOUND) { - free(dirp->path, mtInternal); - free(dirp, mtInternal); - errno = EACCES; - return 0; - } + dirp->handle = FindFirstFile(dirp->path, &dirp->find_data); + if (dirp->handle == INVALID_HANDLE_VALUE) { + if (GetLastError() != ERROR_FILE_NOT_FOUND) { + free(dirp->path, mtInternal); + free(dirp, mtInternal); + errno = EACCES; + return 0; } - return dirp; + } + return dirp; } /* parameter dbuf unused on Windows */ @@ -1157,39 +1157,39 @@ os::opendir(const char *dirname) struct dirent * os::readdir(DIR *dirp, dirent *dbuf) { - assert(dirp != NULL, "just checking"); // hotspot change - if (dirp->handle == INVALID_HANDLE_VALUE) { - return 0; + assert(dirp != NULL, "just checking"); // hotspot change + if (dirp->handle == INVALID_HANDLE_VALUE) { + return 0; + } + + strcpy(dirp->dirent.d_name, dirp->find_data.cFileName); + + if (!FindNextFile(dirp->handle, &dirp->find_data)) { + if (GetLastError() == ERROR_INVALID_HANDLE) { + errno = EBADF; + return 0; } + FindClose(dirp->handle); + dirp->handle = INVALID_HANDLE_VALUE; + } - strcpy(dirp->dirent.d_name, dirp->find_data.cFileName); - - if (!FindNextFile(dirp->handle, &dirp->find_data)) { - if (GetLastError() == ERROR_INVALID_HANDLE) { - errno = EBADF; - return 0; - } - FindClose(dirp->handle); - dirp->handle = INVALID_HANDLE_VALUE; - } - - return &dirp->dirent; + return &dirp->dirent; } int os::closedir(DIR *dirp) { - assert(dirp != NULL, "just checking"); // hotspot change - if (dirp->handle != INVALID_HANDLE_VALUE) { - if (!FindClose(dirp->handle)) { - errno = EBADF; - return -1; - } - dirp->handle = INVALID_HANDLE_VALUE; + assert(dirp != NULL, "just checking"); // hotspot change + if (dirp->handle != INVALID_HANDLE_VALUE) { + if (!FindClose(dirp->handle)) { + errno = EBADF; + return -1; } - free(dirp->path, mtInternal); - free(dirp, mtInternal); - return 0; + dirp->handle = INVALID_HANDLE_VALUE; + } + free(dirp->path, mtInternal); + free(dirp, mtInternal); + return 0; } // This must be hard coded because it's the system's temporary @@ -1290,11 +1290,11 @@ static bool _addr_in_ntdll( address addr ) hmod = GetModuleHandle("NTDLL.DLL"); if (hmod == NULL) return false; if (!os::PSApiDll::GetModuleInformation( GetCurrentProcess(), hmod, - &minfo, sizeof(MODULEINFO)) ) + &minfo, sizeof(MODULEINFO)) ) return false; if ((addr >= minfo.lpBaseOfDll) && - (addr < (address)((uintptr_t)minfo.lpBaseOfDll + (uintptr_t)minfo.SizeOfImage))) + (addr < (address)((uintptr_t)minfo.lpBaseOfDll + (uintptr_t)minfo.SizeOfImage))) return true; else return false; @@ -1338,9 +1338,9 @@ static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void DWORD size_needed; if (!os::PSApiDll::EnumProcessModules(hProcess, modules, - sizeof(modules), &size_needed)) { - CloseHandle(hProcess); - return 0; + sizeof(modules), &size_needed)) { + CloseHandle(hProcess); + return 0; } // number of modules that are currently loaded @@ -1349,15 +1349,15 @@ static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void for (int i = 0; i < MIN2(num_modules, MAX_NUM_MODULES); i++) { // Get Full pathname: if (!os::PSApiDll::GetModuleFileNameEx(hProcess, modules[i], - filename, sizeof(filename))) { - filename[0] = '\0'; + filename, sizeof(filename))) { + filename[0] = '\0'; } MODULEINFO modinfo; if (!os::PSApiDll::GetModuleInformation(hProcess, modules[i], - &modinfo, sizeof(modinfo))) { - modinfo.lpBaseOfDll = NULL; - modinfo.SizeOfImage = 0; + &modinfo, sizeof(modinfo))) { + modinfo.lpBaseOfDll = NULL; + modinfo.SizeOfImage = 0; } // Invoke callback function @@ -1385,7 +1385,7 @@ static int _enumerate_modules_windows( int pid, EnumModulesCallbackFunc func, vo // Get a handle to a Toolhelp snapshot of the system hSnapShot = os::Kernel32Dll::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid); if (hSnapShot == INVALID_HANDLE_VALUE) { - return FALSE; + return FALSE; } // iterate through all modules @@ -1416,27 +1416,27 @@ int enumerate_modules( int pid, EnumModulesCallbackFunc func, void * param ) } struct _modinfo { - address addr; - char* full_path; // point to a char buffer - int buflen; // size of the buffer - address base_addr; + address addr; + char* full_path; // point to a char buffer + int buflen; // size of the buffer + address base_addr; }; static int _locate_module_by_addr(int pid, char * mod_fname, address base_addr, unsigned size, void * param) { - struct _modinfo *pmod = (struct _modinfo *)param; - if (!pmod) return -1; + struct _modinfo *pmod = (struct _modinfo *)param; + if (!pmod) return -1; - if (base_addr <= pmod->addr && - base_addr+size > pmod->addr) { - // if a buffer is provided, copy path name to the buffer - if (pmod->full_path) { - jio_snprintf(pmod->full_path, pmod->buflen, "%s", mod_fname); - } - pmod->base_addr = base_addr; - return 1; - } - return 0; + if (base_addr <= pmod->addr && + base_addr+size > pmod->addr) { + // if a buffer is provided, copy path name to the buffer + if (pmod->full_path) { + jio_snprintf(pmod->full_path, pmod->buflen, "%s", mod_fname); + } + pmod->base_addr = base_addr; + return 1; + } + return 0; } bool os::dll_address_to_library_name(address addr, char* buf, @@ -1480,16 +1480,16 @@ bool os::dll_address_to_function_name(address addr, char *buf, // save the start and end address of jvm.dll into param[0] and param[1] static int _locate_jvm_dll(int pid, char* mod_fname, address base_addr, - unsigned size, void * param) { - if (!param) return -1; + unsigned size, void * param) { + if (!param) return -1; - if (base_addr <= (address)_locate_jvm_dll && - base_addr+size > (address)_locate_jvm_dll) { - ((address*)param)[0] = base_addr; - ((address*)param)[1] = base_addr + size; - return 1; - } - return 0; + if (base_addr <= (address)_locate_jvm_dll && + base_addr+size > (address)_locate_jvm_dll) { + ((address*)param)[0] = base_addr; + ((address*)param)[1] = base_addr + size; + return 1; + } + return 0; } address vm_lib_location[2]; // start and end address of jvm.dll @@ -1510,13 +1510,13 @@ bool os::address_is_in_vm(address addr) { // print module info; param is outputStream* static int _print_module(int pid, char* fname, address base, unsigned size, void* param) { - if (!param) return -1; + if (!param) return -1; - outputStream* st = (outputStream*)param; + outputStream* st = (outputStream*)param; - address end_addr = base + size; - st->print(PTR_FORMAT " - " PTR_FORMAT " \t%s\n", base, end_addr, fname); - return 0; + address end_addr = base + size; + st->print(PTR_FORMAT " - " PTR_FORMAT " \t%s\n", base, end_addr, fname); + return 0; } // Loads .dll/.so and @@ -1556,24 +1556,24 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen) uint32_t signature_offset; uint16_t lib_arch=0; bool failed_to_get_lib_arch= - ( + ( //Go to position 3c in the dll - (os::seek_to_file_offset(file_descriptor,IMAGE_FILE_PTR_TO_SIGNATURE)<0) - || - // Read loacation of signature - (sizeof(signature_offset)!= - (os::read(file_descriptor, (void*)&signature_offset,sizeof(signature_offset)))) - || - //Go to COFF File Header in dll - //that is located after"signature" (4 bytes long) - (os::seek_to_file_offset(file_descriptor, - signature_offset+IMAGE_FILE_SIGNATURE_LENGTH)<0) - || - //Read field that contains code of architecture - // that dll was build for - (sizeof(lib_arch)!= - (os::read(file_descriptor, (void*)&lib_arch,sizeof(lib_arch)))) - ); + (os::seek_to_file_offset(file_descriptor,IMAGE_FILE_PTR_TO_SIGNATURE)<0) + || + // Read loacation of signature + (sizeof(signature_offset)!= + (os::read(file_descriptor, (void*)&signature_offset,sizeof(signature_offset)))) + || + //Go to COFF File Header in dll + //that is located after"signature" (4 bytes long) + (os::seek_to_file_offset(file_descriptor, + signature_offset+IMAGE_FILE_SIGNATURE_LENGTH)<0) + || + //Read field that contains code of architecture + // that dll was build for + (sizeof(lib_arch)!= + (os::read(file_descriptor, (void*)&lib_arch,sizeof(lib_arch)))) + ); ::close(file_descriptor); if (failed_to_get_lib_arch) @@ -1594,11 +1594,11 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen) {IMAGE_FILE_MACHINE_IA64, (char*)"IA 64"} }; #if (defined _M_IA64) - static const uint16_t running_arch=IMAGE_FILE_MACHINE_IA64; + static const uint16_t running_arch=IMAGE_FILE_MACHINE_IA64; #elif (defined _M_AMD64) - static const uint16_t running_arch=IMAGE_FILE_MACHINE_AMD64; + static const uint16_t running_arch=IMAGE_FILE_MACHINE_AMD64; #elif (defined _M_IX86) - static const uint16_t running_arch=IMAGE_FILE_MACHINE_I386; + static const uint16_t running_arch=IMAGE_FILE_MACHINE_I386; #else #error Method os::dll_load requires that one of following \ is defined :_M_IA64,_M_AMD64 or _M_IX86 @@ -1618,7 +1618,7 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen) } assert(running_arch_str, - "Didn't find runing architecture code in arch_array"); + "Didn't find runing architecture code in arch_array"); // If the architure is right // but some other error took place - report os::lasterror(...) msg @@ -1630,15 +1630,15 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen) if (lib_arch_str!=NULL) { ::_snprintf(ebuf, ebuflen-1, - "Can't load %s-bit .dll on a %s-bit platform", - lib_arch_str,running_arch_str); + "Can't load %s-bit .dll on a %s-bit platform", + lib_arch_str,running_arch_str); } else { // don't know what architecture this dll was build for ::_snprintf(ebuf, ebuflen-1, - "Can't load this .dll (machine code=0x%x) on a %s-bit platform", - lib_arch,running_arch_str); + "Can't load this .dll (machine code=0x%x) on a %s-bit platform", + lib_arch,running_arch_str); } return NULL; @@ -1646,9 +1646,9 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen) void os::print_dll_info(outputStream *st) { - int pid = os::current_process_id(); - st->print_cr("Dynamic libraries:"); - enumerate_modules(pid, _print_module, (void *)st); + int pid = os::current_process_id(); + st->print_cr("Dynamic libraries:"); + enumerate_modules(pid, _print_module, (void *)st); } void os::print_os_info_brief(outputStream* st) { @@ -1785,13 +1785,13 @@ void os::print_siginfo(outputStream *st, void *siginfo) { if (er->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && er->NumberParameters >= 2) { - switch (er->ExceptionInformation[0]) { - case 0: st->print(", reading address"); break; - case 1: st->print(", writing address"); break; - default: st->print(", ExceptionInformation=" INTPTR_FORMAT, - er->ExceptionInformation[0]); - } - st->print(" " INTPTR_FORMAT, er->ExceptionInformation[1]); + switch (er->ExceptionInformation[0]) { + case 0: st->print(", reading address"); break; + case 1: st->print(", writing address"); break; + default: st->print(", ExceptionInformation=" INTPTR_FORMAT, + er->ExceptionInformation[0]); + } + st->print(" " INTPTR_FORMAT, er->ExceptionInformation[1]); } else if (er->ExceptionCode == EXCEPTION_IN_PAGE_ERROR && er->NumberParameters >= 2 && UseSharedSpaces) { FileMapInfo* mapinfo = FileMapInfo::current_info(); @@ -1886,13 +1886,13 @@ size_t os::lasterror(char* buf, size_t len) { if ((errval = GetLastError()) != 0) { // DOS error size_t n = (size_t)FormatMessage( - FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - errval, - 0, - buf, - (DWORD)len, - NULL); + FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + errval, + 0, + buf, + (DWORD)len, + NULL); if (n > 3) { // Drop final '.', CR, LF if (buf[n - 1] == '\n') n--; @@ -1961,44 +1961,44 @@ void os::signal_raise(int signal_number) { // static BOOL WINAPI consoleHandler(DWORD event) { switch (event) { - case CTRL_C_EVENT: - if (is_error_reported()) { - // Ctrl-C is pressed during error reporting, likely because the error - // handler fails to abort. Let VM die immediately. - os::die(); - } + case CTRL_C_EVENT: + if (is_error_reported()) { + // Ctrl-C is pressed during error reporting, likely because the error + // handler fails to abort. Let VM die immediately. + os::die(); + } - os::signal_raise(SIGINT); - return TRUE; - break; - case CTRL_BREAK_EVENT: - if (sigbreakHandler != NULL) { - (*sigbreakHandler)(SIGBREAK); - } - return TRUE; - break; - case CTRL_LOGOFF_EVENT: { - // Don't terminate JVM if it is running in a non-interactive session, - // such as a service process. - USEROBJECTFLAGS flags; - HANDLE handle = GetProcessWindowStation(); - if (handle != NULL && - GetUserObjectInformation(handle, UOI_FLAGS, &flags, - sizeof(USEROBJECTFLAGS), NULL)) { - // If it is a non-interactive session, let next handler to deal - // with it. - if ((flags.dwFlags & WSF_VISIBLE) == 0) { - return FALSE; - } + os::signal_raise(SIGINT); + return TRUE; + break; + case CTRL_BREAK_EVENT: + if (sigbreakHandler != NULL) { + (*sigbreakHandler)(SIGBREAK); + } + return TRUE; + break; + case CTRL_LOGOFF_EVENT: { + // Don't terminate JVM if it is running in a non-interactive session, + // such as a service process. + USEROBJECTFLAGS flags; + HANDLE handle = GetProcessWindowStation(); + if (handle != NULL && + GetUserObjectInformation(handle, UOI_FLAGS, &flags, + sizeof(USEROBJECTFLAGS), NULL)) { + // If it is a non-interactive session, let next handler to deal + // with it. + if ((flags.dwFlags & WSF_VISIBLE) == 0) { + return FALSE; } } - case CTRL_CLOSE_EVENT: - case CTRL_SHUTDOWN_EVENT: - os::signal_raise(SIGTERM); - return TRUE; - break; - default: - break; + } + case CTRL_CLOSE_EVENT: + case CTRL_SHUTDOWN_EVENT: + os::signal_raise(SIGTERM); + return TRUE; + break; + default: + break; } return FALSE; } @@ -2221,8 +2221,8 @@ struct siglabel exceptlabels[] = { const char* os::exception_name(int exception_code, char *buf, size_t size) { for (int i = 0; exceptlabels[i].name != NULL; i++) { if (exceptlabels[i].number == exception_code) { - jio_snprintf(buf, size, "%s", exceptlabels[i].name); - return buf; + jio_snprintf(buf, size, "%s", exceptlabels[i].name); + return buf; } } @@ -2269,21 +2269,21 @@ LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) { DWORD exception_code = exceptionInfo->ExceptionRecord->ExceptionCode; switch (exception_code) { - case EXCEPTION_FLT_DENORMAL_OPERAND: - case EXCEPTION_FLT_DIVIDE_BY_ZERO: - case EXCEPTION_FLT_INEXACT_RESULT: - case EXCEPTION_FLT_INVALID_OPERATION: - case EXCEPTION_FLT_OVERFLOW: - case EXCEPTION_FLT_STACK_CHECK: - case EXCEPTION_FLT_UNDERFLOW: - jint fp_control_word = (* (jint*) StubRoutines::addr_fpu_cntrl_wrd_std()); - if (fp_control_word != ctx->FloatSave.ControlWord) { - // Restore FPCW and mask out FLT exceptions - ctx->FloatSave.ControlWord = fp_control_word | 0xffffffc0; - // Mask out pending FLT exceptions - ctx->FloatSave.StatusWord &= 0xffffff00; - return EXCEPTION_CONTINUE_EXECUTION; - } + case EXCEPTION_FLT_DENORMAL_OPERAND: + case EXCEPTION_FLT_DIVIDE_BY_ZERO: + case EXCEPTION_FLT_INEXACT_RESULT: + case EXCEPTION_FLT_INVALID_OPERATION: + case EXCEPTION_FLT_OVERFLOW: + case EXCEPTION_FLT_STACK_CHECK: + case EXCEPTION_FLT_UNDERFLOW: + jint fp_control_word = (* (jint*) StubRoutines::addr_fpu_cntrl_wrd_std()); + if (fp_control_word != ctx->FloatSave.ControlWord) { + // Restore FPCW and mask out FLT exceptions + ctx->FloatSave.ControlWord = fp_control_word | 0xffffffc0; + // Mask out pending FLT exceptions + ctx->FloatSave.StatusWord &= 0xffffff00; + return EXCEPTION_CONTINUE_EXECUTION; + } } if (prev_uef_handler != NULL) { @@ -2296,13 +2296,13 @@ LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) { On Windows, the mxcsr control bits are non-volatile across calls See also CR 6192333 */ - jint MxCsr = INITIAL_MXCSR; - // we can't use StubRoutines::addr_mxcsr_std() - // because in Win64 mxcsr is not saved there - if (MxCsr != ctx->MxCsr) { - ctx->MxCsr = MxCsr; - return EXCEPTION_CONTINUE_EXECUTION; - } + jint MxCsr = INITIAL_MXCSR; + // we can't use StubRoutines::addr_mxcsr_std() + // because in Win64 mxcsr is not saved there + if (MxCsr != ctx->MxCsr) { + ctx->MxCsr = MxCsr; + return EXCEPTION_CONTINUE_EXECUTION; + } #endif // !_WIN64 return EXCEPTION_CONTINUE_SEARCH; @@ -2488,7 +2488,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { thread->enable_register_stack_red_zone(); return Handle_Exception(exceptionInfo, - SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)); + SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)); } #endif if (thread->stack_yellow_zone_enabled()) { @@ -2498,8 +2498,8 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { thread->disable_stack_yellow_zone(); // If not in java code, return and hope for the best. return in_java ? Handle_Exception(exceptionInfo, - SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)) - : EXCEPTION_CONTINUE_EXECUTION; + SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)) + : EXCEPTION_CONTINUE_EXECUTION; } else { // Fatal red zone violation. thread->disable_stack_red_zone(); @@ -2513,7 +2513,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { // a one-time-only guard page, which it has released to us. The next // stack overflow on this thread will result in an ACCESS_VIOLATION. return Handle_Exception(exceptionInfo, - SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)); + SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)); } else { // Can only return and hope for the best. Further stack growth will // result in an ACCESS_VIOLATION. @@ -2528,9 +2528,9 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { if (addr < stack_end && addr >= stack_end - os::vm_page_size()) { // Stack overflow. assert(!os::uses_stack_guard_pages(), - "should be caught by red zone code above."); + "should be caught by red zone code above."); return Handle_Exception(exceptionInfo, - SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)); + SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)); } // // Check for safepoint polling and implicit null @@ -2552,11 +2552,11 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord; address addr = (address) exceptionRecord->ExceptionInformation[1]; if (addr > thread->stack_yellow_zone_base() && addr < thread->stack_base()) { - addr = (address)((uintptr_t)addr & - (~((uintptr_t)os::vm_page_size() - (uintptr_t)1))); - os::commit_memory((char *)addr, thread->stack_base() - addr, - !ExecMem); - return EXCEPTION_CONTINUE_EXECUTION; + addr = (address)((uintptr_t)addr & + (~((uintptr_t)os::vm_page_size() - (uintptr_t)1))); + os::commit_memory((char *)addr, thread->stack_base() - addr, + !ExecMem); + return EXCEPTION_CONTINUE_EXECUTION; } else #endif @@ -2578,7 +2578,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { *(bundle_start + 1), *bundle_start); } return Handle_Exception(exceptionInfo, - SharedRuntime::continuation_for_implicit_exception(thread, pc_unix_format, SharedRuntime::IMPLICIT_NULL)); + SharedRuntime::continuation_for_implicit_exception(thread, pc_unix_format, SharedRuntime::IMPLICIT_NULL)); } } @@ -2632,7 +2632,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { // 1. must be first instruction in bundle // 2. must be a break instruction with appropriate code if ((((uint64_t) pc & 0x0F) == 0) && - (((IPF_Bundle*) pc)->get_slot0() == handle_wrong_method_break.bits())) { + (((IPF_Bundle*) pc)->get_slot0() == handle_wrong_method_break.bits())) { return Handle_Exception(exceptionInfo, (address)SharedRuntime::get_handle_wrong_method_stub()); } @@ -2651,8 +2651,8 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { } // switch } if (((thread->thread_state() == _thread_in_Java) || - (thread->thread_state() == _thread_in_native)) && - exception_code != EXCEPTION_UNCAUGHT_CXX_EXCEPTION) + (thread->thread_state() == _thread_in_native)) && + exception_code != EXCEPTION_UNCAUGHT_CXX_EXCEPTION) { LONG result=Handle_FLT_Exception(exceptionInfo); if (result==EXCEPTION_CONTINUE_EXECUTION) return result; @@ -2704,15 +2704,15 @@ DEFINE_FAST_GETFIELD(jdouble, double, Double) address os::win32::fast_jni_accessor_wrapper(BasicType type) { switch (type) { - case T_BOOLEAN: return (address)jni_fast_GetBooleanField_wrapper; - case T_BYTE: return (address)jni_fast_GetByteField_wrapper; - case T_CHAR: return (address)jni_fast_GetCharField_wrapper; - case T_SHORT: return (address)jni_fast_GetShortField_wrapper; - case T_INT: return (address)jni_fast_GetIntField_wrapper; - case T_LONG: return (address)jni_fast_GetLongField_wrapper; - case T_FLOAT: return (address)jni_fast_GetFloatField_wrapper; - case T_DOUBLE: return (address)jni_fast_GetDoubleField_wrapper; - default: ShouldNotReachHere(); + case T_BOOLEAN: return (address)jni_fast_GetBooleanField_wrapper; + case T_BYTE: return (address)jni_fast_GetByteField_wrapper; + case T_CHAR: return (address)jni_fast_GetCharField_wrapper; + case T_SHORT: return (address)jni_fast_GetShortField_wrapper; + case T_INT: return (address)jni_fast_GetIntField_wrapper; + case T_LONG: return (address)jni_fast_GetLongField_wrapper; + case T_FLOAT: return (address)jni_fast_GetFloatField_wrapper; + case T_DOUBLE: return (address)jni_fast_GetDoubleField_wrapper; + default: ShouldNotReachHere(); } return (address)-1; } @@ -2724,7 +2724,7 @@ void os::win32::call_test_func_with_wrapper(void (*funcPtr)(void)) { __try { (*funcPtr)(); } __except(topLevelExceptionFilter( - (_EXCEPTION_POINTERS*)_exception_info())) { + (_EXCEPTION_POINTERS*)_exception_info())) { // Nothing to do. } } @@ -2763,7 +2763,7 @@ static HANDLE _hToken; // Container for NUMA node list info class NUMANodeListHolder { -private: + private: int *_numa_used_node_list; // allocated below int _numa_used_node_count; @@ -2773,7 +2773,7 @@ private: } } -public: + public: NUMANodeListHolder() { _numa_used_node_count = 0; _numa_used_node_list = NULL; @@ -2821,7 +2821,7 @@ static bool resolve_functions_for_large_page_init() { static bool request_lock_memory_privilege() { _hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, - os::current_process_id()); + os::current_process_id()); LUID luid; if (_hProcess != NULL && @@ -2981,7 +2981,7 @@ static char* allocate_pages_individually(size_t bytes, char* addr, DWORD flags, // need to create a dummy 'reserve' record to match // the release. MemTracker::record_virtual_memory_reserve((address)p_buf, - bytes_to_release, CALLER_PC); + bytes_to_release, CALLER_PC); os::release_memory(p_buf, bytes_to_release); } #ifdef ASSERT @@ -3065,7 +3065,7 @@ void os::large_page_init() { // all or nothing deal. When we split a reservation, we must break the // reservation into two reservations. void os::pd_split_reserved_memory(char *base, size_t size, size_t split, - bool realloc) { + bool realloc) { if (size > 0) { release_memory(base, size); if (realloc) { @@ -3082,7 +3082,7 @@ void os::pd_split_reserved_memory(char *base, size_t size, size_t split, // Windows prevents multiple thread from remapping over each other so this loop is thread-safe. char* os::reserve_memory_aligned(size_t size, size_t alignment) { assert((alignment & (os::vm_allocation_granularity() - 1)) == 0, - "Alignment must be a multiple of allocation granularity (page size)"); + "Alignment must be a multiple of allocation granularity (page size)"); assert((size & (alignment -1)) == 0, "size must be 'alignment' aligned"); size_t extra_size = size + alignment; @@ -3176,7 +3176,7 @@ char* os::reserve_memory_special(size_t bytes, size_t alignment, char* addr, boo // 2) NUMA Interleaving is enabled, in which case we use a different node for each page if (UseLargePagesIndividualAllocation || UseNUMAInterleaving) { if (TracePageSizes && Verbose) { - tty->print_cr("Reserving large pages individually."); + tty->print_cr("Reserving large pages individually."); } char * p_buf = allocate_pages_individually(bytes, addr, flags, prot, LargePagesIndividualAllocationInjectError); if (p_buf == NULL) { @@ -3195,7 +3195,7 @@ char* os::reserve_memory_special(size_t bytes, size_t alignment, char* addr, boo } else { if (TracePageSizes && Verbose) { - tty->print_cr("Reserving large pages in a single large chunk."); + tty->print_cr("Reserving large pages in a single large chunk."); } // normal policy just allocate it all at once DWORD flag = MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES; @@ -3288,7 +3288,7 @@ bool os::pd_commit_memory(char* addr, size_t bytes, bool exec) { } bool os::pd_commit_memory(char* addr, size_t size, size_t alignment_hint, - bool exec) { + bool exec) { // alignment_hint is ignored on this OS return pd_commit_memory(addr, size, exec); } @@ -3436,9 +3436,9 @@ class HighResolutionInterval : public CHeapObj { // to decreased efficiency related to increased timer "tick" rates. We want to minimize // (a) calls to timeBeginPeriod() and timeEndPeriod() and (b) time spent with high // resolution timers running. -private: - jlong resolution; -public: + private: + jlong resolution; + public: HighResolutionInterval(jlong ms) { resolution = ms % 10L; if (resolution != 0) { @@ -3684,7 +3684,7 @@ int os::win32::_processor_level = 0; julong os::win32::_physical_memory = 0; size_t os::win32::_default_stack_size = 0; - intx os::win32::_os_thread_limit = 0; +intx os::win32::_os_thread_limit = 0; volatile intx os::win32::_os_thread_count = 0; bool os::win32::_is_nt = false; @@ -3714,27 +3714,27 @@ void os::win32::initialize_system_info() { oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); GetVersionEx((OSVERSIONINFO*)&oi); switch (oi.dwPlatformId) { - case VER_PLATFORM_WIN32_WINDOWS: _is_nt = false; break; - case VER_PLATFORM_WIN32_NT: - _is_nt = true; - { - int os_vers = oi.dwMajorVersion * 1000 + oi.dwMinorVersion; - if (os_vers == 5002) { - _is_windows_2003 = true; - } - if (oi.wProductType == VER_NT_DOMAIN_CONTROLLER || - oi.wProductType == VER_NT_SERVER) { - _is_windows_server = true; - } + case VER_PLATFORM_WIN32_WINDOWS: _is_nt = false; break; + case VER_PLATFORM_WIN32_NT: + _is_nt = true; + { + int os_vers = oi.dwMajorVersion * 1000 + oi.dwMinorVersion; + if (os_vers == 5002) { + _is_windows_2003 = true; } - break; - default: fatal("Unknown platform"); + if (oi.wProductType == VER_NT_DOMAIN_CONTROLLER || + oi.wProductType == VER_NT_SERVER) { + _is_windows_server = true; + } + } + break; + default: fatal("Unknown platform"); } _default_stack_size = os::current_stack_size(); assert(_default_stack_size > (size_t) _vm_page_size, "invalid stack size"); assert((_default_stack_size & (_vm_page_size - 1)) == 0, - "stack size not a multiple of page size"); + "stack size not a multiple of page size"); initialize_performance_counter(); @@ -3760,7 +3760,7 @@ HINSTANCE os::win32::load_Windows_dll(const char* name, char *ebuf, int ebuflen) assert(strchr(name, ':') == NULL, "path not allowed"); if (strchr(name, '\\') != NULL || strchr(name, ':') != NULL) { jio_snprintf(ebuf, ebuflen, - "Invalid parameter while calling os::win32::load_windows_dll(): cannot take path: %s", name); + "Invalid parameter while calling os::win32::load_windows_dll(): cannot take path: %s", name); return NULL; } @@ -3783,7 +3783,7 @@ HINSTANCE os::win32::load_Windows_dll(const char* name, char *ebuf, int ebuflen) } jio_snprintf(ebuf, ebuflen, - "os::win32::load_windows_dll() cannot load %s from system directories.", name); + "os::win32::load_windows_dll() cannot load %s from system directories.", name); return NULL; } @@ -3872,11 +3872,11 @@ void os::init(void) { // This may be overridden later when argument processing is done. FLAG_SET_ERGO(bool, UseLargePagesIndividualAllocation, - os::win32::is_windows_2003()); + os::win32::is_windows_2003()); // Initialize main_process and main_thread main_process = GetCurrentProcess(); // Remember main_process is a pseudo handle - if (!DuplicateHandle(main_process, GetCurrentThread(), main_process, + if (!DuplicateHandle(main_process, GetCurrentThread(), main_process, &main_thread, THREAD_ALL_ACCESS, false, 0)) { fatal("DuplicateHandle failed\n"); } @@ -3959,7 +3959,7 @@ jint os::init_2(void) { // class initialization depending on 32 or 64 bit VM. size_t min_stack_allowed = (size_t)(StackYellowPages+StackRedPages+StackShadowPages+ - 2*BytesPerWord COMPILER2_PRESENT(+1)) * os::vm_page_size(); + 2*BytesPerWord COMPILER2_PRESENT(+1)) * os::vm_page_size(); if (actual_reserve_size < min_stack_allowed) { tty->print_cr("\nThe stack size specified is too small, " "Specify at least %dk", @@ -4120,14 +4120,14 @@ jlong os::thread_cpu_time(Thread* thread, bool user_sys_cpu_time) { FILETIME UserTime; if (GetThreadTimes(thread->osthread()->thread_handle(), - &CreationTime, &ExitTime, &KernelTime, &UserTime) == 0) + &CreationTime, &ExitTime, &KernelTime, &UserTime) == 0) return -1; else if (user_sys_cpu_time) { return (FT2INT64(UserTime) + FT2INT64(KernelTime)) * 100; - } else { - return FT2INT64(UserTime) * 100; - } + } else { + return FT2INT64(UserTime) * 100; + } } else { return (jlong) timeGetTime() * 1000000; } @@ -4156,7 +4156,7 @@ bool os::is_thread_cpu_time_supported() { FILETIME UserTime; if (GetThreadTimes(GetCurrentThread(), - &CreationTime, &ExitTime, &KernelTime, &UserTime) == 0) + &CreationTime, &ExitTime, &KernelTime, &UserTime) == 0) return false; else return true; @@ -4204,7 +4204,7 @@ int os::open(const char *path, int oflag, int mode) { if (strlen(path) > MAX_PATH - 1) { errno = ENAMETOOLONG; - return -1; + return -1; } os::native_path(strcpy(pathbuf, path)); return ::open(pathbuf, oflag | O_BINARY | O_NOINHERIT, mode); @@ -4270,9 +4270,9 @@ char * os::native_path(char *path) { /* Assumption: '/', '\\', ':', and drive letters are never lead bytes */ assert(((!::IsDBCSLeadByte('/')) - && (!::IsDBCSLeadByte('\\')) - && (!::IsDBCSLeadByte(':'))), - "Illegal lead byte"); + && (!::IsDBCSLeadByte('\\')) + && (!::IsDBCSLeadByte(':'))), + "Illegal lead byte"); /* Check for leading separators */ #define isfilesep(c) ((c) == '/' || (c) == '\\') @@ -4350,8 +4350,8 @@ char * os::native_path(char *path) { /* For "z:", add "." to work around a bug in the C runtime library */ if (colon == dst - 1) { - path[2] = '.'; - path[3] = '\0'; + path[2] = '.'; + path[3] = '\0'; } return path; @@ -4371,7 +4371,7 @@ int os::ftruncate(int fd, jlong length) { ret = ::SetFilePointer(h, (long)(length), &high, FILE_BEGIN); if ((ret == 0xFFFFFFFF) && (::GetLastError() != NO_ERROR)) { - return -1; + return -1; } if (::SetEndOfFile(h) == FALSE) { @@ -4390,7 +4390,7 @@ int os::fsync(int fd) { HANDLE handle = (HANDLE)::_get_osfhandle(fd); if ((!::FlushFileBuffers(handle)) && - (GetLastError() != ERROR_ACCESS_DENIED) ) { + (GetLastError() != ERROR_ACCESS_DENIED) ) { /* from winerror.h */ return -1; } @@ -4484,7 +4484,7 @@ static int stdinAvailable(int fd, long *pbytes) { INPUT_RECORD *lpBuffer; /* Pointer to records of input events */ if ((han = ::GetStdHandle(STD_INPUT_HANDLE)) == INVALID_HANDLE_VALUE) { - return FALSE; + return FALSE; } /* Construct an array of input records in the console buffer */ @@ -4535,8 +4535,8 @@ static int stdinAvailable(int fd, long *pbytes) { // Map a block of memory. char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset, - char *addr, size_t bytes, bool read_only, - bool allow_exec) { + char *addr, size_t bytes, bool read_only, + bool allow_exec) { HANDLE hFile; char* base; @@ -4655,8 +4655,8 @@ char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset, // Remap a block of memory. char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset, - char *addr, size_t bytes, bool read_only, - bool allow_exec) { + char *addr, size_t bytes, bool read_only, + bool allow_exec) { // This OS does not allow existing memory maps to be remapped so we // have to unmap the memory before we remap it. if (!os::unmap_memory(addr, bytes)) { @@ -4668,7 +4668,7 @@ char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset, // code may be able to access an address that is no longer mapped. return os::map_memory(fd, file_name, file_offset, addr, bytes, - read_only, allow_exec); + read_only, allow_exec); } @@ -4704,7 +4704,7 @@ void os::pause() { } } else { jio_fprintf(stderr, - "Could not open pause file '%s', continuing immediately.\n", filename); + "Could not open pause file '%s', continuing immediately.\n", filename); } } @@ -4722,7 +4722,7 @@ os::WatcherThreadCrashProtection::WatcherThreadCrashProtection() { bool os::WatcherThreadCrashProtection::call(os::CrashProtectionCallback& cb) { assert(Thread::current()->is_Watcher_thread(), "Only for WatcherThread"); assert(!WatcherThread::watcher_thread()->has_crash_protection(), - "crash_protection already set?"); + "crash_protection already set?"); bool success = true; __try { @@ -4788,85 +4788,85 @@ bool os::WatcherThreadCrashProtection::call(os::CrashProtectionCallback& cb) { // with explicit "PARKED" and "SIGNALED" bits. int os::PlatformEvent::park (jlong Millis) { - guarantee(_ParkHandle != NULL , "Invariant"); - guarantee(Millis > 0 , "Invariant"); - int v; + guarantee(_ParkHandle != NULL , "Invariant"); + guarantee(Millis > 0 , "Invariant"); + int v; - // CONSIDER: defer assigning a CreateEvent() handle to the Event until - // the initial park() operation. + // CONSIDER: defer assigning a CreateEvent() handle to the Event until + // the initial park() operation. - for (;;) { - v = _Event; - if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; - } - guarantee((v == 0) || (v == 1), "invariant"); - if (v != 0) return OS_OK; - - // Do this the hard way by blocking ... - // TODO: consider a brief spin here, gated on the success of recent - // spin attempts by this thread. - // - // We decompose long timeouts into series of shorter timed waits. - // Evidently large timo values passed in WaitForSingleObject() are problematic on some - // versions of Windows. See EventWait() for details. This may be superstition. Or not. - // We trust the WAIT_TIMEOUT indication and don't track the elapsed wait time - // with os::javaTimeNanos(). Furthermore, we assume that spurious returns from - // ::WaitForSingleObject() caused by latent ::setEvent() operations will tend - // to happen early in the wait interval. Specifically, after a spurious wakeup (rv == - // WAIT_OBJECT_0 but _Event is still < 0) we don't bother to recompute Millis to compensate - // for the already waited time. This policy does not admit any new outcomes. - // In the future, however, we might want to track the accumulated wait time and - // adjust Millis accordingly if we encounter a spurious wakeup. - - const int MAXTIMEOUT = 0x10000000; - DWORD rv = WAIT_TIMEOUT; - while (_Event < 0 && Millis > 0) { - DWORD prd = Millis; // set prd = MAX (Millis, MAXTIMEOUT) - if (Millis > MAXTIMEOUT) { - prd = MAXTIMEOUT; - } - rv = ::WaitForSingleObject(_ParkHandle, prd); - assert(rv == WAIT_OBJECT_0 || rv == WAIT_TIMEOUT, "WaitForSingleObject failed"); - if (rv == WAIT_TIMEOUT) { - Millis -= prd; - } - } + for (;;) { v = _Event; - _Event = 0; - // see comment at end of os::PlatformEvent::park() below: - OrderAccess::fence(); - // If we encounter a nearly simultanous timeout expiry and unpark() - // we return OS_OK indicating we awoke via unpark(). - // Implementor's license -- returning OS_TIMEOUT would be equally valid, however. - return (v >= 0) ? OS_OK : OS_TIMEOUT; + if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; + } + guarantee((v == 0) || (v == 1), "invariant"); + if (v != 0) return OS_OK; + + // Do this the hard way by blocking ... + // TODO: consider a brief spin here, gated on the success of recent + // spin attempts by this thread. + // + // We decompose long timeouts into series of shorter timed waits. + // Evidently large timo values passed in WaitForSingleObject() are problematic on some + // versions of Windows. See EventWait() for details. This may be superstition. Or not. + // We trust the WAIT_TIMEOUT indication and don't track the elapsed wait time + // with os::javaTimeNanos(). Furthermore, we assume that spurious returns from + // ::WaitForSingleObject() caused by latent ::setEvent() operations will tend + // to happen early in the wait interval. Specifically, after a spurious wakeup (rv == + // WAIT_OBJECT_0 but _Event is still < 0) we don't bother to recompute Millis to compensate + // for the already waited time. This policy does not admit any new outcomes. + // In the future, however, we might want to track the accumulated wait time and + // adjust Millis accordingly if we encounter a spurious wakeup. + + const int MAXTIMEOUT = 0x10000000; + DWORD rv = WAIT_TIMEOUT; + while (_Event < 0 && Millis > 0) { + DWORD prd = Millis; // set prd = MAX (Millis, MAXTIMEOUT) + if (Millis > MAXTIMEOUT) { + prd = MAXTIMEOUT; + } + rv = ::WaitForSingleObject(_ParkHandle, prd); + assert(rv == WAIT_OBJECT_0 || rv == WAIT_TIMEOUT, "WaitForSingleObject failed"); + if (rv == WAIT_TIMEOUT) { + Millis -= prd; + } + } + v = _Event; + _Event = 0; + // see comment at end of os::PlatformEvent::park() below: + OrderAccess::fence(); + // If we encounter a nearly simultanous timeout expiry and unpark() + // we return OS_OK indicating we awoke via unpark(). + // Implementor's license -- returning OS_TIMEOUT would be equally valid, however. + return (v >= 0) ? OS_OK : OS_TIMEOUT; } void os::PlatformEvent::park() { - guarantee(_ParkHandle != NULL, "Invariant"); - // Invariant: Only the thread associated with the Event/PlatformEvent - // may call park(). - int v; - for (;;) { - v = _Event; - if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; - } - guarantee((v == 0) || (v == 1), "invariant"); - if (v != 0) return; + guarantee(_ParkHandle != NULL, "Invariant"); + // Invariant: Only the thread associated with the Event/PlatformEvent + // may call park(). + int v; + for (;;) { + v = _Event; + if (Atomic::cmpxchg(v-1, &_Event, v) == v) break; + } + guarantee((v == 0) || (v == 1), "invariant"); + if (v != 0) return; - // Do this the hard way by blocking ... - // TODO: consider a brief spin here, gated on the success of recent - // spin attempts by this thread. - while (_Event < 0) { - DWORD rv = ::WaitForSingleObject(_ParkHandle, INFINITE); - assert(rv == WAIT_OBJECT_0, "WaitForSingleObject failed"); - } + // Do this the hard way by blocking ... + // TODO: consider a brief spin here, gated on the success of recent + // spin attempts by this thread. + while (_Event < 0) { + DWORD rv = ::WaitForSingleObject(_ParkHandle, INFINITE); + assert(rv == WAIT_OBJECT_0, "WaitForSingleObject failed"); + } - // Usually we'll find _Event == 0 at this point, but as - // an optional optimization we clear it, just in case can - // multiple unpark() operations drove _Event up to 1. - _Event = 0; - OrderAccess::fence(); - guarantee(_Event >= 0, "invariant"); + // Usually we'll find _Event == 0 at this point, but as + // an optional optimization we clear it, just in case can + // multiple unpark() operations drove _Event up to 1. + _Event = 0; + OrderAccess::fence(); + guarantee(_Event >= 0, "invariant"); } void os::PlatformEvent::unpark() { @@ -4929,7 +4929,7 @@ void Parker::park(bool isAbsolute, jlong time) { // Don't wait if interrupted or already triggered if (Thread::is_interrupted(thread, false) || - WaitForSingleObject(_ParkEvent, 0) == WAIT_OBJECT_0) { + WaitForSingleObject(_ParkEvent, 0) == WAIT_OBJECT_0) { ResetEvent(_ParkEvent); return; } @@ -5057,13 +5057,13 @@ static jint initSock() { if (!os::WinSock2Dll::WinSock2Available()) { jio_fprintf(stderr, "Could not load Winsock (error: %d)\n", - ::GetLastError()); + ::GetLastError()); return JNI_ERR; } if (os::WinSock2Dll::WSAStartup(MAKEWORD(2,2), &wsadata) != 0) { jio_fprintf(stderr, "Could not initialize Winsock (error: %d)\n", - ::GetLastError()); + ::GetLastError()); return JNI_ERR; } return JNI_OK; @@ -5244,7 +5244,7 @@ RtlCaptureStackBackTrace_Fn os::Kernel32Dll::_RtlCaptureStackBackTrace = NULL; BOOL os::Kernel32Dll::initialized = FALSE; SIZE_T os::Kernel32Dll::GetLargePageMinimum() { assert(initialized && _GetLargePageMinimum != NULL, - "GetLargePageMinimumAvailable() not yet called"); + "GetLargePageMinimumAvailable() not yet called"); return _GetLargePageMinimum(); } @@ -5264,37 +5264,37 @@ BOOL os::Kernel32Dll::NumaCallsAvailable() { LPVOID os::Kernel32Dll::VirtualAllocExNuma(HANDLE hProc, LPVOID addr, SIZE_T bytes, DWORD flags, DWORD prot, DWORD node) { assert(initialized && _VirtualAllocExNuma != NULL, - "NUMACallsAvailable() not yet called"); + "NUMACallsAvailable() not yet called"); return _VirtualAllocExNuma(hProc, addr, bytes, flags, prot, node); } BOOL os::Kernel32Dll::GetNumaHighestNodeNumber(PULONG ptr_highest_node_number) { assert(initialized && _GetNumaHighestNodeNumber != NULL, - "NUMACallsAvailable() not yet called"); + "NUMACallsAvailable() not yet called"); return _GetNumaHighestNodeNumber(ptr_highest_node_number); } BOOL os::Kernel32Dll::GetNumaNodeProcessorMask(UCHAR node, PULONGLONG proc_mask) { assert(initialized && _GetNumaNodeProcessorMask != NULL, - "NUMACallsAvailable() not yet called"); + "NUMACallsAvailable() not yet called"); return _GetNumaNodeProcessorMask(node, proc_mask); } USHORT os::Kernel32Dll::RtlCaptureStackBackTrace(ULONG FrameToSkip, - ULONG FrameToCapture, PVOID* BackTrace, PULONG BackTraceHash) { - if (!initialized) { - initialize(); - } + ULONG FrameToCapture, PVOID* BackTrace, PULONG BackTraceHash) { + if (!initialized) { + initialize(); + } - if (_RtlCaptureStackBackTrace != NULL) { - return _RtlCaptureStackBackTrace(FrameToSkip, FrameToCapture, - BackTrace, BackTraceHash); - } else { - return 0; - } + if (_RtlCaptureStackBackTrace != NULL) { + return _RtlCaptureStackBackTrace(FrameToSkip, FrameToCapture, + BackTrace, BackTraceHash); + } else { + return 0; + } } void os::Kernel32Dll::initializeCommon() { @@ -5328,7 +5328,7 @@ inline BOOL os::Kernel32Dll::SwitchToThreadAvailable() { return true; } - // Help tools +// Help tools inline BOOL os::Kernel32Dll::HelpToolsAvailable() { return true; } @@ -5387,15 +5387,15 @@ inline BOOL os::WinSock2Dll::WinSock2Available() { // Advapi API inline BOOL os::Advapi32Dll::AdjustTokenPrivileges(HANDLE TokenHandle, - BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, - PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength) { - return ::AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges, NewState, - BufferLength, PreviousState, ReturnLength); + BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, + PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength) { + return ::AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges, NewState, + BufferLength, PreviousState, ReturnLength); } inline BOOL os::Advapi32Dll::OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, - PHANDLE TokenHandle) { - return ::OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle); + PHANDLE TokenHandle) { + return ::OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle); } inline BOOL os::Advapi32Dll::LookupPrivilegeValue(LPCTSTR lpSystemName, LPCTSTR lpName, PLUID lpLuid) { @@ -5508,7 +5508,7 @@ void os::Kernel32Dll::initialize() { BOOL os::Kernel32Dll::SwitchToThread() { assert(initialized && _SwitchToThread != NULL, - "SwitchToThreadAvailable() not yet called"); + "SwitchToThreadAvailable() not yet called"); return _SwitchToThread(); } @@ -5532,21 +5532,21 @@ BOOL os::Kernel32Dll::HelpToolsAvailable() { HANDLE os::Kernel32Dll::CreateToolhelp32Snapshot(DWORD dwFlags,DWORD th32ProcessId) { assert(initialized && _CreateToolhelp32Snapshot != NULL, - "HelpToolsAvailable() not yet called"); + "HelpToolsAvailable() not yet called"); return _CreateToolhelp32Snapshot(dwFlags, th32ProcessId); } BOOL os::Kernel32Dll::Module32First(HANDLE hSnapshot,LPMODULEENTRY32 lpme) { assert(initialized && _Module32First != NULL, - "HelpToolsAvailable() not yet called"); + "HelpToolsAvailable() not yet called"); return _Module32First(hSnapshot, lpme); } inline BOOL os::Kernel32Dll::Module32Next(HANDLE hSnapshot,LPMODULEENTRY32 lpme) { assert(initialized && _Module32Next != NULL, - "HelpToolsAvailable() not yet called"); + "HelpToolsAvailable() not yet called"); return _Module32Next(hSnapshot, lpme); } @@ -5561,7 +5561,7 @@ BOOL os::Kernel32Dll::GetNativeSystemInfoAvailable() { void os::Kernel32Dll::GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo) { assert(initialized && _GetNativeSystemInfo != NULL, - "GetNativeSystemInfoAvailable() not yet called"); + "GetNativeSystemInfoAvailable() not yet called"); _GetNativeSystemInfo(lpSystemInfo); } @@ -5583,11 +5583,11 @@ void os::PSApiDll::initialize() { HMODULE handle = os::win32::load_Windows_dll("PSAPI.DLL", NULL, 0); if (handle != NULL) { _EnumProcessModules = (EnumProcessModules_Fn)::GetProcAddress(handle, - "EnumProcessModules"); + "EnumProcessModules"); _GetModuleFileNameEx = (GetModuleFileNameEx_Fn)::GetProcAddress(handle, - "GetModuleFileNameExA"); + "GetModuleFileNameExA"); _GetModuleInformation = (GetModuleInformation_Fn)::GetProcAddress(handle, - "GetModuleInformation"); + "GetModuleInformation"); } initialized = TRUE; } @@ -5597,19 +5597,19 @@ void os::PSApiDll::initialize() { BOOL os::PSApiDll::EnumProcessModules(HANDLE hProcess, HMODULE *lpModule, DWORD cb, LPDWORD lpcbNeeded) { assert(initialized && _EnumProcessModules != NULL, - "PSApiAvailable() not yet called"); + "PSApiAvailable() not yet called"); return _EnumProcessModules(hProcess, lpModule, cb, lpcbNeeded); } DWORD os::PSApiDll::GetModuleFileNameEx(HANDLE hProcess, HMODULE hModule, LPTSTR lpFilename, DWORD nSize) { assert(initialized && _GetModuleFileNameEx != NULL, - "PSApiAvailable() not yet called"); + "PSApiAvailable() not yet called"); return _GetModuleFileNameEx(hProcess, hModule, lpFilename, nSize); } BOOL os::PSApiDll::GetModuleInformation(HANDLE hProcess, HMODULE hModule, LPMODULEINFO lpmodinfo, DWORD cb) { assert(initialized && _GetModuleInformation != NULL, - "PSApiAvailable() not yet called"); + "PSApiAvailable() not yet called"); return _GetModuleInformation(hProcess, hModule, lpmodinfo, cb); } @@ -5645,13 +5645,13 @@ void os::WinSock2Dll::initialize() { BOOL os::WinSock2Dll::WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData) { assert(initialized && _WSAStartup != NULL, - "WinSock2Available() not yet called"); + "WinSock2Available() not yet called"); return _WSAStartup(wVersionRequested, lpWSAData); } struct hostent* os::WinSock2Dll::gethostbyname(const char *name) { assert(initialized && _gethostbyname != NULL, - "WinSock2Available() not yet called"); + "WinSock2Available() not yet called"); return _gethostbyname(name); } @@ -5677,35 +5677,35 @@ void os::Advapi32Dll::initialize() { HMODULE handle = os::win32::load_Windows_dll("advapi32.dll", NULL, 0); if (handle != NULL) { _AdjustTokenPrivileges = (AdjustTokenPrivileges_Fn)::GetProcAddress(handle, - "AdjustTokenPrivileges"); + "AdjustTokenPrivileges"); _OpenProcessToken = (OpenProcessToken_Fn)::GetProcAddress(handle, - "OpenProcessToken"); + "OpenProcessToken"); _LookupPrivilegeValue = (LookupPrivilegeValue_Fn)::GetProcAddress(handle, - "LookupPrivilegeValueA"); + "LookupPrivilegeValueA"); } initialized = TRUE; } } BOOL os::Advapi32Dll::AdjustTokenPrivileges(HANDLE TokenHandle, - BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, - PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength) { - assert(initialized && _AdjustTokenPrivileges != NULL, - "AdvapiAvailable() not yet called"); - return _AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges, NewState, - BufferLength, PreviousState, ReturnLength); + BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, + PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength) { + assert(initialized && _AdjustTokenPrivileges != NULL, + "AdvapiAvailable() not yet called"); + return _AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges, NewState, + BufferLength, PreviousState, ReturnLength); } BOOL os::Advapi32Dll::OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, - PHANDLE TokenHandle) { - assert(initialized && _OpenProcessToken != NULL, - "AdvapiAvailable() not yet called"); - return _OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle); + PHANDLE TokenHandle) { + assert(initialized && _OpenProcessToken != NULL, + "AdvapiAvailable() not yet called"); + return _OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle); } BOOL os::Advapi32Dll::LookupPrivilegeValue(LPCTSTR lpSystemName, LPCTSTR lpName, PLUID lpLuid) { - assert(initialized && _LookupPrivilegeValue != NULL, - "AdvapiAvailable() not yet called"); + assert(initialized && _LookupPrivilegeValue != NULL, + "AdvapiAvailable() not yet called"); return _LookupPrivilegeValue(lpSystemName, lpName, lpLuid); } @@ -5753,7 +5753,7 @@ void TestReserveMemorySpecial_test() { if (result == NULL) { if (VerboseInternalVMTests) { gclog_or_tty->print("Failed to allocate control block with size "SIZE_FORMAT". Skipping remainder of test.", - large_allocation_size); + large_allocation_size); } } else { os::release_memory_special(result, large_allocation_size); @@ -5766,15 +5766,15 @@ void TestReserveMemorySpecial_test() { if (actual_location == NULL) { if (VerboseInternalVMTests) { gclog_or_tty->print("Failed to allocate any memory at "PTR_FORMAT" size "SIZE_FORMAT". Skipping remainder of test.", - expected_location, large_allocation_size); + expected_location, large_allocation_size); } } else { // release memory os::release_memory_special(actual_location, expected_allocation_size); // only now check, after releasing any memory to avoid any leaks. assert(actual_location == expected_location, - err_msg("Failed to allocate memory at requested location "PTR_FORMAT" of size "SIZE_FORMAT", is "PTR_FORMAT" instead", - expected_location, expected_allocation_size, actual_location)); + err_msg("Failed to allocate memory at requested location "PTR_FORMAT" of size "SIZE_FORMAT", is "PTR_FORMAT" instead", + expected_location, expected_allocation_size, actual_location)); } } diff --git a/hotspot/src/share/vm/runtime/atomic.hpp b/hotspot/src/share/vm/runtime/atomic.hpp index 52e122fce48..7cc5a00843b 100644 --- a/hotspot/src/share/vm/runtime/atomic.hpp +++ b/hotspot/src/share/vm/runtime/atomic.hpp @@ -74,12 +74,12 @@ class Atomic : AllStatic { inline static intptr_t add_ptr(intptr_t add_value, volatile intptr_t* dest); inline static void* add_ptr(intptr_t add_value, volatile void* dest); // See comment above about using jlong atomics on 32-bit platforms - static jlong add (jlong add_value, volatile jlong* dest); + static jlong add (jlong add_value, volatile jlong* dest); // Atomically increment location. inc*() provide: // increment-dest inline static void inc (volatile jint* dest); - static void inc (volatile jshort* dest); + static void inc (volatile jshort* dest); inline static void inc (volatile size_t* dest); inline static void inc_ptr(volatile intptr_t* dest); inline static void inc_ptr(volatile void* dest); @@ -87,7 +87,7 @@ class Atomic : AllStatic { // Atomically decrement a location. dec*() provide: // decrement-dest inline static void dec (volatile jint* dest); - static void dec (volatile jshort* dest); + static void dec (volatile jshort* dest); inline static void dec (volatile size_t* dest); inline static void dec_ptr(volatile intptr_t* dest); inline static void dec_ptr(volatile void* dest); @@ -96,7 +96,7 @@ class Atomic : AllStatic { // prior value of *dest. xchg*() provide: // exchange-value-with-dest inline static jint xchg(jint exchange_value, volatile jint* dest); - static unsigned int xchg(unsigned int exchange_value, volatile unsigned int* dest); + static unsigned int xchg(unsigned int exchange_value, volatile unsigned int* dest); inline static intptr_t xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest); inline static void* xchg_ptr(void* exchange_value, volatile void* dest); @@ -105,14 +105,14 @@ class Atomic : AllStatic { // *dest with exchange_value if the comparison succeeded. Returns prior // value of *dest. cmpxchg*() provide: // compare-and-exchange - static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value); + static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value); inline static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value); // See comment above about using jlong atomics on 32-bit platforms inline static jlong cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value); - static unsigned int cmpxchg(unsigned int exchange_value, - volatile unsigned int* dest, - unsigned int compare_value); + static unsigned int cmpxchg(unsigned int exchange_value, + volatile unsigned int* dest, + unsigned int compare_value); inline static intptr_t cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value); inline static void* cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value); diff --git a/hotspot/src/share/vm/runtime/mutex.cpp b/hotspot/src/share/vm/runtime/mutex.cpp index aa10bfbc761..a2db8cb949d 100644 --- a/hotspot/src/share/vm/runtime/mutex.cpp +++ b/hotspot/src/share/vm/runtime/mutex.cpp @@ -407,7 +407,7 @@ static int ParkCommon (ParkEvent * ev, jlong timo) { // Diagnostic support - periodically unwedge blocked threads intx nmt = NativeMonitorTimeout; if (nmt > 0 && (nmt < timo || timo <= 0)) { - timo = nmt; + timo = nmt; } int err = OS_OK; if (0 == timo) { @@ -590,7 +590,7 @@ void Monitor::IUnlock (bool RelaxAssert) { // as a diagnostic measure consider setting w->_ListNext = BAD assert(UNS(_OnDeck) == _LBIT, "invariant"); _OnDeck = w; // pass OnDeck to w. - // w will clear OnDeck once it acquires the outer lock + // w will clear OnDeck once it acquires the outer lock // Another optional optimization ... // For heavily contended locks it's not uncommon that some other @@ -1082,14 +1082,14 @@ bool Monitor::wait(bool no_safepoint_check, long timeout, bool as_suspend_equiva guarantee(no_safepoint_check || Self->is_Java_thread(), "invariant"); #ifdef ASSERT - Monitor * least = get_least_ranked_lock_besides_this(Self->owned_locks()); - assert(least != this, "Specification of get_least_... call above"); - if (least != NULL && least->rank() <= special) { - tty->print("Attempting to wait on monitor %s/%d while holding" - " lock %s/%d -- possible deadlock", - name(), rank(), least->name(), least->rank()); - assert(false, "Shouldn't block(wait) while holding a lock of rank special"); - } + Monitor * least = get_least_ranked_lock_besides_this(Self->owned_locks()); + assert(least != this, "Specification of get_least_... call above"); + if (least != NULL && least->rank() <= special) { + tty->print("Attempting to wait on monitor %s/%d while holding" + " lock %s/%d -- possible deadlock", + name(), rank(), least->name(), least->rank()); + assert(false, "Shouldn't block(wait) while holding a lock of rank special"); + } #endif // ASSERT int wait_status; @@ -1173,8 +1173,8 @@ Mutex::~Mutex() { Mutex::Mutex (int Rank, const char * name, bool allow_vm_block) { ClearMonitor((Monitor *) this, name); #ifdef ASSERT - _allow_vm_block = allow_vm_block; - _rank = Rank; + _allow_vm_block = allow_vm_block; + _rank = Rank; #endif } @@ -1280,38 +1280,38 @@ void Monitor::set_owner_implementation(Thread *new_owner) { // link "this" into the owned locks list #ifdef ASSERT // Thread::_owned_locks is under the same ifdef - Monitor* locks = get_least_ranked_lock(new_owner->owned_locks()); - // Mutex::set_owner_implementation is a friend of Thread + Monitor* locks = get_least_ranked_lock(new_owner->owned_locks()); + // Mutex::set_owner_implementation is a friend of Thread - assert(this->rank() >= 0, "bad lock rank"); + assert(this->rank() >= 0, "bad lock rank"); - // Deadlock avoidance rules require us to acquire Mutexes only in - // a global total order. For example m1 is the lowest ranked mutex - // that the thread holds and m2 is the mutex the thread is trying - // to acquire, then deadlock avoidance rules require that the rank - // of m2 be less than the rank of m1. - // The rank Mutex::native is an exception in that it is not subject - // to the verification rules. - // Here are some further notes relating to mutex acquisition anomalies: - // . under Solaris, the interrupt lock gets acquired when doing - // profiling, so any lock could be held. - // . it is also ok to acquire Safepoint_lock at the very end while we - // already hold Terminator_lock - may happen because of periodic safepoints - if (this->rank() != Mutex::native && - this->rank() != Mutex::suspend_resume && - locks != NULL && locks->rank() <= this->rank() && - !SafepointSynchronize::is_at_safepoint() && - this != Interrupt_lock && this != ProfileVM_lock && - !(this == Safepoint_lock && contains(locks, Terminator_lock) && - SafepointSynchronize::is_synchronizing())) { - new_owner->print_owned_locks(); - fatal(err_msg("acquiring lock %s/%d out of order with lock %s/%d -- " - "possible deadlock", this->name(), this->rank(), - locks->name(), locks->rank())); - } + // Deadlock avoidance rules require us to acquire Mutexes only in + // a global total order. For example m1 is the lowest ranked mutex + // that the thread holds and m2 is the mutex the thread is trying + // to acquire, then deadlock avoidance rules require that the rank + // of m2 be less than the rank of m1. + // The rank Mutex::native is an exception in that it is not subject + // to the verification rules. + // Here are some further notes relating to mutex acquisition anomalies: + // . under Solaris, the interrupt lock gets acquired when doing + // profiling, so any lock could be held. + // . it is also ok to acquire Safepoint_lock at the very end while we + // already hold Terminator_lock - may happen because of periodic safepoints + if (this->rank() != Mutex::native && + this->rank() != Mutex::suspend_resume && + locks != NULL && locks->rank() <= this->rank() && + !SafepointSynchronize::is_at_safepoint() && + this != Interrupt_lock && this != ProfileVM_lock && + !(this == Safepoint_lock && contains(locks, Terminator_lock) && + SafepointSynchronize::is_synchronizing())) { + new_owner->print_owned_locks(); + fatal(err_msg("acquiring lock %s/%d out of order with lock %s/%d -- " + "possible deadlock", this->name(), this->rank(), + locks->name(), locks->rank())); + } - this->_next = new_owner->_owned_locks; - new_owner->_owned_locks = this; + this->_next = new_owner->_owned_locks; + new_owner->_owned_locks = this; #endif } else { @@ -1326,25 +1326,25 @@ void Monitor::set_owner_implementation(Thread *new_owner) { _owner = NULL; // set the owner #ifdef ASSERT - Monitor *locks = old_owner->owned_locks(); + Monitor *locks = old_owner->owned_locks(); - // remove "this" from the owned locks list + // remove "this" from the owned locks list - Monitor *prev = NULL; - bool found = false; - for (; locks != NULL; prev = locks, locks = locks->next()) { - if (locks == this) { - found = true; - break; - } + Monitor *prev = NULL; + bool found = false; + for (; locks != NULL; prev = locks, locks = locks->next()) { + if (locks == this) { + found = true; + break; } - assert(found, "Removing a lock not owned"); - if (prev == NULL) { - old_owner->_owned_locks = _next; - } else { - prev->_next = _next; - } - _next = NULL; + } + assert(found, "Removing a lock not owned"); + if (prev == NULL) { + old_owner->_owned_locks = _next; + } else { + prev->_next = _next; + } + _next = NULL; #endif } } @@ -1360,11 +1360,11 @@ void Monitor::check_prelock_state(Thread *thread) { name())); } debug_only(if (rank() != Mutex::special) \ - thread->check_for_valid_safepoint_state(false);) + thread->check_for_valid_safepoint_state(false);) } if (thread->is_Watcher_thread()) { assert(!WatcherThread::watcher_thread()->has_crash_protection(), - "locking not allowed when crash protection is set"); + "locking not allowed when crash protection is set"); } } diff --git a/hotspot/src/share/vm/runtime/objectMonitor.cpp b/hotspot/src/share/vm/runtime/objectMonitor.cpp index 186154e5e48..414ce666c1e 100644 --- a/hotspot/src/share/vm/runtime/objectMonitor.cpp +++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp @@ -45,7 +45,7 @@ #include "utilities/preserveException.hpp" #if defined(__GNUC__) && !defined(IA64) && !defined(PPC64) - // Need to inhibit inlining for older versions of GCC to avoid build-time failures +// Need to inhibit inlining for older versions of GCC to avoid build-time failures #define NOINLINE __attribute__((noinline)) #else #define NOINLINE @@ -254,11 +254,11 @@ static volatile int InitDone = 0; bool ObjectMonitor::try_enter(Thread* THREAD) { if (THREAD != _owner) { if (THREAD->is_lock_owned ((address)_owner)) { - assert(_recursions == 0, "internal state error"); - _owner = THREAD; - _recursions = 1; - OwnerIsThread = 1; - return true; + assert(_recursions == 0, "internal state error"); + _owner = THREAD; + _recursions = 1; + OwnerIsThread = 1; + return true; } if (Atomic::cmpxchg_ptr (THREAD, &_owner, NULL) != NULL) { return false; @@ -277,17 +277,17 @@ void NOINLINE ObjectMonitor::enter(TRAPS) { void * cur = Atomic::cmpxchg_ptr (Self, &_owner, NULL); if (cur == NULL) { - // Either ASSERT _recursions == 0 or explicitly set _recursions = 0. - assert(_recursions == 0 , "invariant"); - assert(_owner == Self, "invariant"); - // CONSIDER: set or assert OwnerIsThread == 1 - return; + // Either ASSERT _recursions == 0 or explicitly set _recursions = 0. + assert(_recursions == 0 , "invariant"); + assert(_owner == Self, "invariant"); + // CONSIDER: set or assert OwnerIsThread == 1 + return; } if (cur == Self) { - // TODO-FIXME: check for integer overflow! BUGID 6557169. - _recursions++; - return; + // TODO-FIXME: check for integer overflow! BUGID 6557169. + _recursions++; + return; } if (Self->is_lock_owned ((address)cur)) { @@ -310,11 +310,11 @@ void NOINLINE ObjectMonitor::enter(TRAPS) { // Note that if we acquire the monitor from an initial spin // we forgo posting JVMTI events and firing DTRACE probes. if (Knob_SpinEarly && TrySpin (Self) > 0) { - assert(_owner == Self , "invariant"); - assert(_recursions == 0 , "invariant"); - assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant"); - Self->_Stalled = 0; - return; + assert(_owner == Self , "invariant"); + assert(_recursions == 0 , "invariant"); + assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant"); + Self->_Stalled = 0; + return; } assert(_owner != Self , "invariant"); @@ -367,7 +367,7 @@ void NOINLINE ObjectMonitor::enter(TRAPS) { // the monitor while suspended because that would surprise the // thread that suspended us. // - _recursions = 0; + _recursions = 0; _succ = NULL; exit(false, Self); @@ -426,7 +426,7 @@ void NOINLINE ObjectMonitor::enter(TRAPS) { } if (ObjectMonitor::_sync_ContendedLockAttempts != NULL) { - ObjectMonitor::_sync_ContendedLockAttempts->inc(); + ObjectMonitor::_sync_ContendedLockAttempts->inc(); } } @@ -452,244 +452,244 @@ int ObjectMonitor::TryLock (Thread * Self) { } void NOINLINE ObjectMonitor::EnterI (TRAPS) { - Thread * const Self = THREAD; - assert(Self->is_Java_thread(), "invariant"); - assert(((JavaThread *) Self)->thread_state() == _thread_blocked , "invariant"); + Thread * const Self = THREAD; + assert(Self->is_Java_thread(), "invariant"); + assert(((JavaThread *) Self)->thread_state() == _thread_blocked , "invariant"); - // Try the lock - TATAS + // Try the lock - TATAS + if (TryLock (Self) > 0) { + assert(_succ != Self , "invariant"); + assert(_owner == Self , "invariant"); + assert(_Responsible != Self , "invariant"); + return; + } + + DeferredInitialize(); + + // We try one round of spinning *before* enqueueing Self. + // + // If the _owner is ready but OFFPROC we could use a YieldTo() + // operation to donate the remainder of this thread's quantum + // to the owner. This has subtle but beneficial affinity + // effects. + + if (TrySpin (Self) > 0) { + assert(_owner == Self , "invariant"); + assert(_succ != Self , "invariant"); + assert(_Responsible != Self , "invariant"); + return; + } + + // The Spin failed -- Enqueue and park the thread ... + assert(_succ != Self , "invariant"); + assert(_owner != Self , "invariant"); + assert(_Responsible != Self , "invariant"); + + // Enqueue "Self" on ObjectMonitor's _cxq. + // + // Node acts as a proxy for Self. + // As an aside, if were to ever rewrite the synchronization code mostly + // in Java, WaitNodes, ObjectMonitors, and Events would become 1st-class + // Java objects. This would avoid awkward lifecycle and liveness issues, + // as well as eliminate a subset of ABA issues. + // TODO: eliminate ObjectWaiter and enqueue either Threads or Events. + // + + ObjectWaiter node(Self); + Self->_ParkEvent->reset(); + node._prev = (ObjectWaiter *) 0xBAD; + node.TState = ObjectWaiter::TS_CXQ; + + // Push "Self" onto the front of the _cxq. + // Once on cxq/EntryList, Self stays on-queue until it acquires the lock. + // Note that spinning tends to reduce the rate at which threads + // enqueue and dequeue on EntryList|cxq. + ObjectWaiter * nxt; + for (;;) { + node._next = nxt = _cxq; + if (Atomic::cmpxchg_ptr(&node, &_cxq, nxt) == nxt) break; + + // Interference - the CAS failed because _cxq changed. Just retry. + // As an optional optimization we retry the lock. if (TryLock (Self) > 0) { - assert(_succ != Self , "invariant"); - assert(_owner == Self , "invariant"); - assert(_Responsible != Self , "invariant"); - return; + assert(_succ != Self , "invariant"); + assert(_owner == Self , "invariant"); + assert(_Responsible != Self , "invariant"); + return; + } + } + + // Check for cxq|EntryList edge transition to non-null. This indicates + // the onset of contention. While contention persists exiting threads + // will use a ST:MEMBAR:LD 1-1 exit protocol. When contention abates exit + // operations revert to the faster 1-0 mode. This enter operation may interleave + // (race) a concurrent 1-0 exit operation, resulting in stranding, so we + // arrange for one of the contending thread to use a timed park() operations + // to detect and recover from the race. (Stranding is form of progress failure + // where the monitor is unlocked but all the contending threads remain parked). + // That is, at least one of the contended threads will periodically poll _owner. + // One of the contending threads will become the designated "Responsible" thread. + // The Responsible thread uses a timed park instead of a normal indefinite park + // operation -- it periodically wakes and checks for and recovers from potential + // strandings admitted by 1-0 exit operations. We need at most one Responsible + // thread per-monitor at any given moment. Only threads on cxq|EntryList may + // be responsible for a monitor. + // + // Currently, one of the contended threads takes on the added role of "Responsible". + // A viable alternative would be to use a dedicated "stranding checker" thread + // that periodically iterated over all the threads (or active monitors) and unparked + // successors where there was risk of stranding. This would help eliminate the + // timer scalability issues we see on some platforms as we'd only have one thread + // -- the checker -- parked on a timer. + + if ((SyncFlags & 16) == 0 && nxt == NULL && _EntryList == NULL) { + // Try to assume the role of responsible thread for the monitor. + // CONSIDER: ST vs CAS vs { if (Responsible==null) Responsible=Self } + Atomic::cmpxchg_ptr(Self, &_Responsible, NULL); + } + + // The lock might have been released while this thread was occupied queueing + // itself onto _cxq. To close the race and avoid "stranding" and + // progress-liveness failure we must resample-retry _owner before parking. + // Note the Dekker/Lamport duality: ST cxq; MEMBAR; LD Owner. + // In this case the ST-MEMBAR is accomplished with CAS(). + // + // TODO: Defer all thread state transitions until park-time. + // Since state transitions are heavy and inefficient we'd like + // to defer the state transitions until absolutely necessary, + // and in doing so avoid some transitions ... + + TEVENT(Inflated enter - Contention); + int nWakeups = 0; + int RecheckInterval = 1; + + for (;;) { + + if (TryLock(Self) > 0) break; + assert(_owner != Self, "invariant"); + + if ((SyncFlags & 2) && _Responsible == NULL) { + Atomic::cmpxchg_ptr(Self, &_Responsible, NULL); } - DeferredInitialize(); - - // We try one round of spinning *before* enqueueing Self. - // - // If the _owner is ready but OFFPROC we could use a YieldTo() - // operation to donate the remainder of this thread's quantum - // to the owner. This has subtle but beneficial affinity - // effects. - - if (TrySpin (Self) > 0) { - assert(_owner == Self , "invariant"); - assert(_succ != Self , "invariant"); - assert(_Responsible != Self , "invariant"); - return; + // park self + if (_Responsible == Self || (SyncFlags & 1)) { + TEVENT(Inflated enter - park TIMED); + Self->_ParkEvent->park((jlong) RecheckInterval); + // Increase the RecheckInterval, but clamp the value. + RecheckInterval *= 8; + if (RecheckInterval > 1000) RecheckInterval = 1000; + } else { + TEVENT(Inflated enter - park UNTIMED); + Self->_ParkEvent->park(); } - // The Spin failed -- Enqueue and park the thread ... - assert(_succ != Self , "invariant"); - assert(_owner != Self , "invariant"); - assert(_Responsible != Self , "invariant"); + if (TryLock(Self) > 0) break; - // Enqueue "Self" on ObjectMonitor's _cxq. - // - // Node acts as a proxy for Self. - // As an aside, if were to ever rewrite the synchronization code mostly - // in Java, WaitNodes, ObjectMonitors, and Events would become 1st-class - // Java objects. This would avoid awkward lifecycle and liveness issues, - // as well as eliminate a subset of ABA issues. - // TODO: eliminate ObjectWaiter and enqueue either Threads or Events. - // - - ObjectWaiter node(Self); - Self->_ParkEvent->reset(); - node._prev = (ObjectWaiter *) 0xBAD; - node.TState = ObjectWaiter::TS_CXQ; - - // Push "Self" onto the front of the _cxq. - // Once on cxq/EntryList, Self stays on-queue until it acquires the lock. - // Note that spinning tends to reduce the rate at which threads - // enqueue and dequeue on EntryList|cxq. - ObjectWaiter * nxt; - for (;;) { - node._next = nxt = _cxq; - if (Atomic::cmpxchg_ptr(&node, &_cxq, nxt) == nxt) break; - - // Interference - the CAS failed because _cxq changed. Just retry. - // As an optional optimization we retry the lock. - if (TryLock (Self) > 0) { - assert(_succ != Self , "invariant"); - assert(_owner == Self , "invariant"); - assert(_Responsible != Self , "invariant"); - return; - } + // The lock is still contested. + // Keep a tally of the # of futile wakeups. + // Note that the counter is not protected by a lock or updated by atomics. + // That is by design - we trade "lossy" counters which are exposed to + // races during updates for a lower probe effect. + TEVENT(Inflated enter - Futile wakeup); + if (ObjectMonitor::_sync_FutileWakeups != NULL) { + ObjectMonitor::_sync_FutileWakeups->inc(); } + ++nWakeups; - // Check for cxq|EntryList edge transition to non-null. This indicates - // the onset of contention. While contention persists exiting threads - // will use a ST:MEMBAR:LD 1-1 exit protocol. When contention abates exit - // operations revert to the faster 1-0 mode. This enter operation may interleave - // (race) a concurrent 1-0 exit operation, resulting in stranding, so we - // arrange for one of the contending thread to use a timed park() operations - // to detect and recover from the race. (Stranding is form of progress failure - // where the monitor is unlocked but all the contending threads remain parked). - // That is, at least one of the contended threads will periodically poll _owner. - // One of the contending threads will become the designated "Responsible" thread. - // The Responsible thread uses a timed park instead of a normal indefinite park - // operation -- it periodically wakes and checks for and recovers from potential - // strandings admitted by 1-0 exit operations. We need at most one Responsible - // thread per-monitor at any given moment. Only threads on cxq|EntryList may - // be responsible for a monitor. - // - // Currently, one of the contended threads takes on the added role of "Responsible". - // A viable alternative would be to use a dedicated "stranding checker" thread - // that periodically iterated over all the threads (or active monitors) and unparked - // successors where there was risk of stranding. This would help eliminate the - // timer scalability issues we see on some platforms as we'd only have one thread - // -- the checker -- parked on a timer. + // Assuming this is not a spurious wakeup we'll normally find _succ == Self. + // We can defer clearing _succ until after the spin completes + // TrySpin() must tolerate being called with _succ == Self. + // Try yet another round of adaptive spinning. + if ((Knob_SpinAfterFutile & 1) && TrySpin(Self) > 0) break; - if ((SyncFlags & 16) == 0 && nxt == NULL && _EntryList == NULL) { - // Try to assume the role of responsible thread for the monitor. - // CONSIDER: ST vs CAS vs { if (Responsible==null) Responsible=Self } - Atomic::cmpxchg_ptr(Self, &_Responsible, NULL); + // We can find that we were unpark()ed and redesignated _succ while + // we were spinning. That's harmless. If we iterate and call park(), + // park() will consume the event and return immediately and we'll + // just spin again. This pattern can repeat, leaving _succ to simply + // spin on a CPU. Enable Knob_ResetEvent to clear pending unparks(). + // Alternately, we can sample fired() here, and if set, forgo spinning + // in the next iteration. + + if ((Knob_ResetEvent & 1) && Self->_ParkEvent->fired()) { + Self->_ParkEvent->reset(); + OrderAccess::fence(); } - - // The lock might have been released while this thread was occupied queueing - // itself onto _cxq. To close the race and avoid "stranding" and - // progress-liveness failure we must resample-retry _owner before parking. - // Note the Dekker/Lamport duality: ST cxq; MEMBAR; LD Owner. - // In this case the ST-MEMBAR is accomplished with CAS(). - // - // TODO: Defer all thread state transitions until park-time. - // Since state transitions are heavy and inefficient we'd like - // to defer the state transitions until absolutely necessary, - // and in doing so avoid some transitions ... - - TEVENT(Inflated enter - Contention); - int nWakeups = 0; - int RecheckInterval = 1; - - for (;;) { - - if (TryLock(Self) > 0) break; - assert(_owner != Self, "invariant"); - - if ((SyncFlags & 2) && _Responsible == NULL) { - Atomic::cmpxchg_ptr(Self, &_Responsible, NULL); - } - - // park self - if (_Responsible == Self || (SyncFlags & 1)) { - TEVENT(Inflated enter - park TIMED); - Self->_ParkEvent->park((jlong) RecheckInterval); - // Increase the RecheckInterval, but clamp the value. - RecheckInterval *= 8; - if (RecheckInterval > 1000) RecheckInterval = 1000; - } else { - TEVENT(Inflated enter - park UNTIMED); - Self->_ParkEvent->park(); - } - - if (TryLock(Self) > 0) break; - - // The lock is still contested. - // Keep a tally of the # of futile wakeups. - // Note that the counter is not protected by a lock or updated by atomics. - // That is by design - we trade "lossy" counters which are exposed to - // races during updates for a lower probe effect. - TEVENT(Inflated enter - Futile wakeup); - if (ObjectMonitor::_sync_FutileWakeups != NULL) { - ObjectMonitor::_sync_FutileWakeups->inc(); - } - ++nWakeups; - - // Assuming this is not a spurious wakeup we'll normally find _succ == Self. - // We can defer clearing _succ until after the spin completes - // TrySpin() must tolerate being called with _succ == Self. - // Try yet another round of adaptive spinning. - if ((Knob_SpinAfterFutile & 1) && TrySpin(Self) > 0) break; - - // We can find that we were unpark()ed and redesignated _succ while - // we were spinning. That's harmless. If we iterate and call park(), - // park() will consume the event and return immediately and we'll - // just spin again. This pattern can repeat, leaving _succ to simply - // spin on a CPU. Enable Knob_ResetEvent to clear pending unparks(). - // Alternately, we can sample fired() here, and if set, forgo spinning - // in the next iteration. - - if ((Knob_ResetEvent & 1) && Self->_ParkEvent->fired()) { - Self->_ParkEvent->reset(); - OrderAccess::fence(); - } - if (_succ == Self) _succ = NULL; - - // Invariant: after clearing _succ a thread *must* retry _owner before parking. - OrderAccess::fence(); - } - - // Egress : - // Self has acquired the lock -- Unlink Self from the cxq or EntryList. - // Normally we'll find Self on the EntryList . - // From the perspective of the lock owner (this thread), the - // EntryList is stable and cxq is prepend-only. - // The head of cxq is volatile but the interior is stable. - // In addition, Self.TState is stable. - - assert(_owner == Self , "invariant"); - assert(object() != NULL , "invariant"); - // I'd like to write: - // guarantee (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ; - // but as we're at a safepoint that's not safe. - - UnlinkAfterAcquire(Self, &node); if (_succ == Self) _succ = NULL; - assert(_succ != Self, "invariant"); - if (_Responsible == Self) { - _Responsible = NULL; - OrderAccess::fence(); // Dekker pivot-point + // Invariant: after clearing _succ a thread *must* retry _owner before parking. + OrderAccess::fence(); + } - // We may leave threads on cxq|EntryList without a designated - // "Responsible" thread. This is benign. When this thread subsequently - // exits the monitor it can "see" such preexisting "old" threads -- - // threads that arrived on the cxq|EntryList before the fence, above -- - // by LDing cxq|EntryList. Newly arrived threads -- that is, threads - // that arrive on cxq after the ST:MEMBAR, above -- will set Responsible - // non-null and elect a new "Responsible" timer thread. - // - // This thread executes: - // ST Responsible=null; MEMBAR (in enter epilogue - here) - // LD cxq|EntryList (in subsequent exit) - // - // Entering threads in the slow/contended path execute: - // ST cxq=nonnull; MEMBAR; LD Responsible (in enter prolog) - // The (ST cxq; MEMBAR) is accomplished with CAS(). - // - // The MEMBAR, above, prevents the LD of cxq|EntryList in the subsequent - // exit operation from floating above the ST Responsible=null. - } + // Egress : + // Self has acquired the lock -- Unlink Self from the cxq or EntryList. + // Normally we'll find Self on the EntryList . + // From the perspective of the lock owner (this thread), the + // EntryList is stable and cxq is prepend-only. + // The head of cxq is volatile but the interior is stable. + // In addition, Self.TState is stable. - // We've acquired ownership with CAS(). - // CAS is serializing -- it has MEMBAR/FENCE-equivalent semantics. - // But since the CAS() this thread may have also stored into _succ, - // EntryList, cxq or Responsible. These meta-data updates must be - // visible __before this thread subsequently drops the lock. - // Consider what could occur if we didn't enforce this constraint -- - // STs to monitor meta-data and user-data could reorder with (become - // visible after) the ST in exit that drops ownership of the lock. - // Some other thread could then acquire the lock, but observe inconsistent - // or old monitor meta-data and heap data. That violates the JMM. - // To that end, the 1-0 exit() operation must have at least STST|LDST - // "release" barrier semantics. Specifically, there must be at least a - // STST|LDST barrier in exit() before the ST of null into _owner that drops - // the lock. The barrier ensures that changes to monitor meta-data and data - // protected by the lock will be visible before we release the lock, and - // therefore before some other thread (CPU) has a chance to acquire the lock. - // See also: http://gee.cs.oswego.edu/dl/jmm/cookbook.html. + assert(_owner == Self , "invariant"); + assert(object() != NULL , "invariant"); + // I'd like to write: + // guarantee (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ; + // but as we're at a safepoint that's not safe. + + UnlinkAfterAcquire(Self, &node); + if (_succ == Self) _succ = NULL; + + assert(_succ != Self, "invariant"); + if (_Responsible == Self) { + _Responsible = NULL; + OrderAccess::fence(); // Dekker pivot-point + + // We may leave threads on cxq|EntryList without a designated + // "Responsible" thread. This is benign. When this thread subsequently + // exits the monitor it can "see" such preexisting "old" threads -- + // threads that arrived on the cxq|EntryList before the fence, above -- + // by LDing cxq|EntryList. Newly arrived threads -- that is, threads + // that arrive on cxq after the ST:MEMBAR, above -- will set Responsible + // non-null and elect a new "Responsible" timer thread. // - // Critically, any prior STs to _succ or EntryList must be visible before - // the ST of null into _owner in the *subsequent* (following) corresponding - // monitorexit. Recall too, that in 1-0 mode monitorexit does not necessarily - // execute a serializing instruction. + // This thread executes: + // ST Responsible=null; MEMBAR (in enter epilogue - here) + // LD cxq|EntryList (in subsequent exit) + // + // Entering threads in the slow/contended path execute: + // ST cxq=nonnull; MEMBAR; LD Responsible (in enter prolog) + // The (ST cxq; MEMBAR) is accomplished with CAS(). + // + // The MEMBAR, above, prevents the LD of cxq|EntryList in the subsequent + // exit operation from floating above the ST Responsible=null. + } - if (SyncFlags & 8) { - OrderAccess::fence(); - } - return; + // We've acquired ownership with CAS(). + // CAS is serializing -- it has MEMBAR/FENCE-equivalent semantics. + // But since the CAS() this thread may have also stored into _succ, + // EntryList, cxq or Responsible. These meta-data updates must be + // visible __before this thread subsequently drops the lock. + // Consider what could occur if we didn't enforce this constraint -- + // STs to monitor meta-data and user-data could reorder with (become + // visible after) the ST in exit that drops ownership of the lock. + // Some other thread could then acquire the lock, but observe inconsistent + // or old monitor meta-data and heap data. That violates the JMM. + // To that end, the 1-0 exit() operation must have at least STST|LDST + // "release" barrier semantics. Specifically, there must be at least a + // STST|LDST barrier in exit() before the ST of null into _owner that drops + // the lock. The barrier ensures that changes to monitor meta-data and data + // protected by the lock will be visible before we release the lock, and + // therefore before some other thread (CPU) has a chance to acquire the lock. + // See also: http://gee.cs.oswego.edu/dl/jmm/cookbook.html. + // + // Critically, any prior STs to _succ or EntryList must be visible before + // the ST of null into _owner in the *subsequent* (following) corresponding + // monitorexit. Recall too, that in 1-0 mode monitorexit does not necessarily + // execute a serializing instruction. + + if (SyncFlags & 8) { + OrderAccess::fence(); + } + return; } // ReenterI() is a specialized inline form of the latter half of the @@ -701,91 +701,91 @@ void NOINLINE ObjectMonitor::EnterI (TRAPS) { // loop accordingly. void NOINLINE ObjectMonitor::ReenterI (Thread * Self, ObjectWaiter * SelfNode) { - assert(Self != NULL , "invariant"); - assert(SelfNode != NULL , "invariant"); - assert(SelfNode->_thread == Self , "invariant"); - assert(_waiters > 0 , "invariant"); - assert(((oop)(object()))->mark() == markOopDesc::encode(this) , "invariant"); - assert(((JavaThread *)Self)->thread_state() != _thread_blocked, "invariant"); - JavaThread * jt = (JavaThread *) Self; + assert(Self != NULL , "invariant"); + assert(SelfNode != NULL , "invariant"); + assert(SelfNode->_thread == Self , "invariant"); + assert(_waiters > 0 , "invariant"); + assert(((oop)(object()))->mark() == markOopDesc::encode(this) , "invariant"); + assert(((JavaThread *)Self)->thread_state() != _thread_blocked, "invariant"); + JavaThread * jt = (JavaThread *) Self; - int nWakeups = 0; - for (;;) { - ObjectWaiter::TStates v = SelfNode->TState; - guarantee(v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant"); - assert(_owner != Self, "invariant"); + int nWakeups = 0; + for (;;) { + ObjectWaiter::TStates v = SelfNode->TState; + guarantee(v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant"); + assert(_owner != Self, "invariant"); - if (TryLock(Self) > 0) break; - if (TrySpin(Self) > 0) break; + if (TryLock(Self) > 0) break; + if (TrySpin(Self) > 0) break; - TEVENT(Wait Reentry - parking); + TEVENT(Wait Reentry - parking); - // State transition wrappers around park() ... - // ReenterI() wisely defers state transitions until - // it's clear we must park the thread. - { - OSThreadContendState osts(Self->osthread()); - ThreadBlockInVM tbivm(jt); + // State transition wrappers around park() ... + // ReenterI() wisely defers state transitions until + // it's clear we must park the thread. + { + OSThreadContendState osts(Self->osthread()); + ThreadBlockInVM tbivm(jt); - // cleared by handle_special_suspend_equivalent_condition() - // or java_suspend_self() - jt->set_suspend_equivalent(); - if (SyncFlags & 1) { - Self->_ParkEvent->park((jlong)1000); - } else { - Self->_ParkEvent->park(); - } + // cleared by handle_special_suspend_equivalent_condition() + // or java_suspend_self() + jt->set_suspend_equivalent(); + if (SyncFlags & 1) { + Self->_ParkEvent->park((jlong)1000); + } else { + Self->_ParkEvent->park(); + } - // were we externally suspended while we were waiting? - for (;;) { - if (!ExitSuspendEquivalent(jt)) break; - if (_succ == Self) { _succ = NULL; OrderAccess::fence(); } - jt->java_suspend_self(); - jt->set_suspend_equivalent(); - } - } - - // Try again, but just so we distinguish between futile wakeups and - // successful wakeups. The following test isn't algorithmically - // necessary, but it helps us maintain sensible statistics. - if (TryLock(Self) > 0) break; - - // The lock is still contested. - // Keep a tally of the # of futile wakeups. - // Note that the counter is not protected by a lock or updated by atomics. - // That is by design - we trade "lossy" counters which are exposed to - // races during updates for a lower probe effect. - TEVENT(Wait Reentry - futile wakeup); - ++nWakeups; - - // Assuming this is not a spurious wakeup we'll normally - // find that _succ == Self. - if (_succ == Self) _succ = NULL; - - // Invariant: after clearing _succ a contending thread - // *must* retry _owner before parking. - OrderAccess::fence(); - - if (ObjectMonitor::_sync_FutileWakeups != NULL) { - ObjectMonitor::_sync_FutileWakeups->inc(); - } + // were we externally suspended while we were waiting? + for (;;) { + if (!ExitSuspendEquivalent(jt)) break; + if (_succ == Self) { _succ = NULL; OrderAccess::fence(); } + jt->java_suspend_self(); + jt->set_suspend_equivalent(); + } } - // Self has acquired the lock -- Unlink Self from the cxq or EntryList . - // Normally we'll find Self on the EntryList. - // Unlinking from the EntryList is constant-time and atomic-free. - // From the perspective of the lock owner (this thread), the - // EntryList is stable and cxq is prepend-only. - // The head of cxq is volatile but the interior is stable. - // In addition, Self.TState is stable. + // Try again, but just so we distinguish between futile wakeups and + // successful wakeups. The following test isn't algorithmically + // necessary, but it helps us maintain sensible statistics. + if (TryLock(Self) > 0) break; - assert(_owner == Self, "invariant"); - assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant"); - UnlinkAfterAcquire(Self, SelfNode); + // The lock is still contested. + // Keep a tally of the # of futile wakeups. + // Note that the counter is not protected by a lock or updated by atomics. + // That is by design - we trade "lossy" counters which are exposed to + // races during updates for a lower probe effect. + TEVENT(Wait Reentry - futile wakeup); + ++nWakeups; + + // Assuming this is not a spurious wakeup we'll normally + // find that _succ == Self. if (_succ == Self) _succ = NULL; - assert(_succ != Self, "invariant"); - SelfNode->TState = ObjectWaiter::TS_RUN; - OrderAccess::fence(); // see comments at the end of EnterI() + + // Invariant: after clearing _succ a contending thread + // *must* retry _owner before parking. + OrderAccess::fence(); + + if (ObjectMonitor::_sync_FutileWakeups != NULL) { + ObjectMonitor::_sync_FutileWakeups->inc(); + } + } + + // Self has acquired the lock -- Unlink Self from the cxq or EntryList . + // Normally we'll find Self on the EntryList. + // Unlinking from the EntryList is constant-time and atomic-free. + // From the perspective of the lock owner (this thread), the + // EntryList is stable and cxq is prepend-only. + // The head of cxq is volatile but the interior is stable. + // In addition, Self.TState is stable. + + assert(_owner == Self, "invariant"); + assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant"); + UnlinkAfterAcquire(Self, SelfNode); + if (_succ == Self) _succ = NULL; + assert(_succ != Self, "invariant"); + SelfNode->TState = ObjectWaiter::TS_RUN; + OrderAccess::fence(); // see comments at the end of EnterI() } // By convention we unlink a contending thread from EntryList|cxq immediately @@ -794,66 +794,66 @@ void NOINLINE ObjectMonitor::ReenterI (Thread * Self, ObjectWaiter * SelfNode) { void ObjectMonitor::UnlinkAfterAcquire (Thread * Self, ObjectWaiter * SelfNode) { - assert(_owner == Self, "invariant"); - assert(SelfNode->_thread == Self, "invariant"); + assert(_owner == Self, "invariant"); + assert(SelfNode->_thread == Self, "invariant"); - if (SelfNode->TState == ObjectWaiter::TS_ENTER) { - // Normal case: remove Self from the DLL EntryList . - // This is a constant-time operation. - ObjectWaiter * nxt = SelfNode->_next; - ObjectWaiter * prv = SelfNode->_prev; - if (nxt != NULL) nxt->_prev = prv; - if (prv != NULL) prv->_next = nxt; - if (SelfNode == _EntryList) _EntryList = nxt; - assert(nxt == NULL || nxt->TState == ObjectWaiter::TS_ENTER, "invariant"); - assert(prv == NULL || prv->TState == ObjectWaiter::TS_ENTER, "invariant"); - TEVENT(Unlink from EntryList); - } else { - assert(SelfNode->TState == ObjectWaiter::TS_CXQ, "invariant"); - // Inopportune interleaving -- Self is still on the cxq. - // This usually means the enqueue of self raced an exiting thread. - // Normally we'll find Self near the front of the cxq, so - // dequeueing is typically fast. If needbe we can accelerate - // this with some MCS/CHL-like bidirectional list hints and advisory - // back-links so dequeueing from the interior will normally operate - // in constant-time. - // Dequeue Self from either the head (with CAS) or from the interior - // with a linear-time scan and normal non-atomic memory operations. - // CONSIDER: if Self is on the cxq then simply drain cxq into EntryList - // and then unlink Self from EntryList. We have to drain eventually, - // so it might as well be now. + if (SelfNode->TState == ObjectWaiter::TS_ENTER) { + // Normal case: remove Self from the DLL EntryList . + // This is a constant-time operation. + ObjectWaiter * nxt = SelfNode->_next; + ObjectWaiter * prv = SelfNode->_prev; + if (nxt != NULL) nxt->_prev = prv; + if (prv != NULL) prv->_next = nxt; + if (SelfNode == _EntryList) _EntryList = nxt; + assert(nxt == NULL || nxt->TState == ObjectWaiter::TS_ENTER, "invariant"); + assert(prv == NULL || prv->TState == ObjectWaiter::TS_ENTER, "invariant"); + TEVENT(Unlink from EntryList); + } else { + assert(SelfNode->TState == ObjectWaiter::TS_CXQ, "invariant"); + // Inopportune interleaving -- Self is still on the cxq. + // This usually means the enqueue of self raced an exiting thread. + // Normally we'll find Self near the front of the cxq, so + // dequeueing is typically fast. If needbe we can accelerate + // this with some MCS/CHL-like bidirectional list hints and advisory + // back-links so dequeueing from the interior will normally operate + // in constant-time. + // Dequeue Self from either the head (with CAS) or from the interior + // with a linear-time scan and normal non-atomic memory operations. + // CONSIDER: if Self is on the cxq then simply drain cxq into EntryList + // and then unlink Self from EntryList. We have to drain eventually, + // so it might as well be now. - ObjectWaiter * v = _cxq; - assert(v != NULL, "invariant"); - if (v != SelfNode || Atomic::cmpxchg_ptr (SelfNode->_next, &_cxq, v) != v) { - // The CAS above can fail from interference IFF a "RAT" arrived. - // In that case Self must be in the interior and can no longer be - // at the head of cxq. - if (v == SelfNode) { - assert(_cxq != v, "invariant"); - v = _cxq; // CAS above failed - start scan at head of list - } - ObjectWaiter * p; - ObjectWaiter * q = NULL; - for (p = v; p != NULL && p != SelfNode; p = p->_next) { - q = p; - assert(p->TState == ObjectWaiter::TS_CXQ, "invariant"); - } - assert(v != SelfNode, "invariant"); - assert(p == SelfNode, "Node not found on cxq"); - assert(p != _cxq, "invariant"); - assert(q != NULL, "invariant"); - assert(q->_next == p, "invariant"); - q->_next = p->_next; - } - TEVENT(Unlink from cxq); + ObjectWaiter * v = _cxq; + assert(v != NULL, "invariant"); + if (v != SelfNode || Atomic::cmpxchg_ptr (SelfNode->_next, &_cxq, v) != v) { + // The CAS above can fail from interference IFF a "RAT" arrived. + // In that case Self must be in the interior and can no longer be + // at the head of cxq. + if (v == SelfNode) { + assert(_cxq != v, "invariant"); + v = _cxq; // CAS above failed - start scan at head of list + } + ObjectWaiter * p; + ObjectWaiter * q = NULL; + for (p = v; p != NULL && p != SelfNode; p = p->_next) { + q = p; + assert(p->TState == ObjectWaiter::TS_CXQ, "invariant"); + } + assert(v != SelfNode, "invariant"); + assert(p == SelfNode, "Node not found on cxq"); + assert(p != _cxq, "invariant"); + assert(q != NULL, "invariant"); + assert(q->_next == p, "invariant"); + q->_next = p->_next; } + TEVENT(Unlink from cxq); + } #ifdef ASSERT - // Diagnostic hygiene ... - SelfNode->_prev = (ObjectWaiter *) 0xBAD; - SelfNode->_next = (ObjectWaiter *) 0xBAD; - SelfNode->TState = ObjectWaiter::TS_RUN; + // Diagnostic hygiene ... + SelfNode->_prev = (ObjectWaiter *) 0xBAD; + SelfNode->_next = (ObjectWaiter *) 0xBAD; + SelfNode->TState = ObjectWaiter::TS_RUN; #endif } @@ -915,331 +915,331 @@ void ObjectMonitor::UnlinkAfterAcquire (Thread * Self, ObjectWaiter * SelfNode) // of such futile wakups is low. void NOINLINE ObjectMonitor::exit(bool not_suspended, TRAPS) { - Thread * const Self = THREAD; - if (THREAD != _owner) { - if (THREAD->is_lock_owned((address) _owner)) { - // Transmute _owner from a BasicLock pointer to a Thread address. - // We don't need to hold _mutex for this transition. - // Non-null to Non-null is safe as long as all readers can - // tolerate either flavor. - assert(_recursions == 0, "invariant"); - _owner = THREAD; - _recursions = 0; - OwnerIsThread = 1; - } else { - // Apparent unbalanced locking ... - // Naively we'd like to throw IllegalMonitorStateException. - // As a practical matter we can neither allocate nor throw an - // exception as ::exit() can be called from leaf routines. - // see x86_32.ad Fast_Unlock() and the I1 and I2 properties. - // Upon deeper reflection, however, in a properly run JVM the only - // way we should encounter this situation is in the presence of - // unbalanced JNI locking. TODO: CheckJNICalls. - // See also: CR4414101 - TEVENT(Exit - Throw IMSX); - assert(false, "Non-balanced monitor enter/exit! Likely JNI locking"); - return; - } - } + Thread * const Self = THREAD; + if (THREAD != _owner) { + if (THREAD->is_lock_owned((address) _owner)) { + // Transmute _owner from a BasicLock pointer to a Thread address. + // We don't need to hold _mutex for this transition. + // Non-null to Non-null is safe as long as all readers can + // tolerate either flavor. + assert(_recursions == 0, "invariant"); + _owner = THREAD; + _recursions = 0; + OwnerIsThread = 1; + } else { + // Apparent unbalanced locking ... + // Naively we'd like to throw IllegalMonitorStateException. + // As a practical matter we can neither allocate nor throw an + // exception as ::exit() can be called from leaf routines. + // see x86_32.ad Fast_Unlock() and the I1 and I2 properties. + // Upon deeper reflection, however, in a properly run JVM the only + // way we should encounter this situation is in the presence of + // unbalanced JNI locking. TODO: CheckJNICalls. + // See also: CR4414101 + TEVENT(Exit - Throw IMSX); + assert(false, "Non-balanced monitor enter/exit! Likely JNI locking"); + return; + } + } - if (_recursions != 0) { - _recursions--; // this is simple recursive enter - TEVENT(Inflated exit - recursive); - return; - } + if (_recursions != 0) { + _recursions--; // this is simple recursive enter + TEVENT(Inflated exit - recursive); + return; + } - // Invariant: after setting Responsible=null an thread must execute - // a MEMBAR or other serializing instruction before fetching EntryList|cxq. - if ((SyncFlags & 4) == 0) { - _Responsible = NULL; - } + // Invariant: after setting Responsible=null an thread must execute + // a MEMBAR or other serializing instruction before fetching EntryList|cxq. + if ((SyncFlags & 4) == 0) { + _Responsible = NULL; + } #if INCLUDE_TRACE - // get the owner's thread id for the MonitorEnter event - // if it is enabled and the thread isn't suspended - if (not_suspended && Tracing::is_event_enabled(TraceJavaMonitorEnterEvent)) { - _previous_owner_tid = SharedRuntime::get_java_tid(Self); - } + // get the owner's thread id for the MonitorEnter event + // if it is enabled and the thread isn't suspended + if (not_suspended && Tracing::is_event_enabled(TraceJavaMonitorEnterEvent)) { + _previous_owner_tid = SharedRuntime::get_java_tid(Self); + } #endif - for (;;) { - assert(THREAD == _owner, "invariant"); + for (;;) { + assert(THREAD == _owner, "invariant"); - if (Knob_ExitPolicy == 0) { - // release semantics: prior loads and stores from within the critical section - // must not float (reorder) past the following store that drops the lock. - // On SPARC that requires MEMBAR #loadstore|#storestore. - // But of course in TSO #loadstore|#storestore is not required. - // I'd like to write one of the following: - // A. OrderAccess::release() ; _owner = NULL - // B. OrderAccess::loadstore(); OrderAccess::storestore(); _owner = NULL; - // Unfortunately OrderAccess::release() and OrderAccess::loadstore() both - // store into a _dummy variable. That store is not needed, but can result - // in massive wasteful coherency traffic on classic SMP systems. - // Instead, I use release_store(), which is implemented as just a simple - // ST on x64, x86 and SPARC. - OrderAccess::release_store_ptr(&_owner, NULL); // drop the lock - OrderAccess::storeload(); // See if we need to wake a successor - if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) { - TEVENT(Inflated exit - simple egress); - return; - } - TEVENT(Inflated exit - complex egress); - // Other threads are blocked trying to acquire the lock. + if (Knob_ExitPolicy == 0) { + // release semantics: prior loads and stores from within the critical section + // must not float (reorder) past the following store that drops the lock. + // On SPARC that requires MEMBAR #loadstore|#storestore. + // But of course in TSO #loadstore|#storestore is not required. + // I'd like to write one of the following: + // A. OrderAccess::release() ; _owner = NULL + // B. OrderAccess::loadstore(); OrderAccess::storestore(); _owner = NULL; + // Unfortunately OrderAccess::release() and OrderAccess::loadstore() both + // store into a _dummy variable. That store is not needed, but can result + // in massive wasteful coherency traffic on classic SMP systems. + // Instead, I use release_store(), which is implemented as just a simple + // ST on x64, x86 and SPARC. + OrderAccess::release_store_ptr(&_owner, NULL); // drop the lock + OrderAccess::storeload(); // See if we need to wake a successor + if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) { + TEVENT(Inflated exit - simple egress); + return; + } + TEVENT(Inflated exit - complex egress); + // Other threads are blocked trying to acquire the lock. - // Normally the exiting thread is responsible for ensuring succession, - // but if other successors are ready or other entering threads are spinning - // then this thread can simply store NULL into _owner and exit without - // waking a successor. The existence of spinners or ready successors - // guarantees proper succession (liveness). Responsibility passes to the - // ready or running successors. The exiting thread delegates the duty. - // More precisely, if a successor already exists this thread is absolved - // of the responsibility of waking (unparking) one. - // - // The _succ variable is critical to reducing futile wakeup frequency. - // _succ identifies the "heir presumptive" thread that has been made - // ready (unparked) but that has not yet run. We need only one such - // successor thread to guarantee progress. - // See http://www.usenix.org/events/jvm01/full_papers/dice/dice.pdf - // section 3.3 "Futile Wakeup Throttling" for details. - // - // Note that spinners in Enter() also set _succ non-null. - // In the current implementation spinners opportunistically set - // _succ so that exiting threads might avoid waking a successor. - // Another less appealing alternative would be for the exiting thread - // to drop the lock and then spin briefly to see if a spinner managed - // to acquire the lock. If so, the exiting thread could exit - // immediately without waking a successor, otherwise the exiting - // thread would need to dequeue and wake a successor. - // (Note that we'd need to make the post-drop spin short, but no - // shorter than the worst-case round-trip cache-line migration time. - // The dropped lock needs to become visible to the spinner, and then - // the acquisition of the lock by the spinner must become visible to - // the exiting thread). - // + // Normally the exiting thread is responsible for ensuring succession, + // but if other successors are ready or other entering threads are spinning + // then this thread can simply store NULL into _owner and exit without + // waking a successor. The existence of spinners or ready successors + // guarantees proper succession (liveness). Responsibility passes to the + // ready or running successors. The exiting thread delegates the duty. + // More precisely, if a successor already exists this thread is absolved + // of the responsibility of waking (unparking) one. + // + // The _succ variable is critical to reducing futile wakeup frequency. + // _succ identifies the "heir presumptive" thread that has been made + // ready (unparked) but that has not yet run. We need only one such + // successor thread to guarantee progress. + // See http://www.usenix.org/events/jvm01/full_papers/dice/dice.pdf + // section 3.3 "Futile Wakeup Throttling" for details. + // + // Note that spinners in Enter() also set _succ non-null. + // In the current implementation spinners opportunistically set + // _succ so that exiting threads might avoid waking a successor. + // Another less appealing alternative would be for the exiting thread + // to drop the lock and then spin briefly to see if a spinner managed + // to acquire the lock. If so, the exiting thread could exit + // immediately without waking a successor, otherwise the exiting + // thread would need to dequeue and wake a successor. + // (Note that we'd need to make the post-drop spin short, but no + // shorter than the worst-case round-trip cache-line migration time. + // The dropped lock needs to become visible to the spinner, and then + // the acquisition of the lock by the spinner must become visible to + // the exiting thread). + // - // It appears that an heir-presumptive (successor) must be made ready. - // Only the current lock owner can manipulate the EntryList or - // drain _cxq, so we need to reacquire the lock. If we fail - // to reacquire the lock the responsibility for ensuring succession - // falls to the new owner. - // - if (Atomic::cmpxchg_ptr (THREAD, &_owner, NULL) != NULL) { - return; - } - TEVENT(Exit - Reacquired); + // It appears that an heir-presumptive (successor) must be made ready. + // Only the current lock owner can manipulate the EntryList or + // drain _cxq, so we need to reacquire the lock. If we fail + // to reacquire the lock the responsibility for ensuring succession + // falls to the new owner. + // + if (Atomic::cmpxchg_ptr (THREAD, &_owner, NULL) != NULL) { + return; + } + TEVENT(Exit - Reacquired); + } else { + if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) { + OrderAccess::release_store_ptr(&_owner, NULL); // drop the lock + OrderAccess::storeload(); + // Ratify the previously observed values. + if (_cxq == NULL || _succ != NULL) { + TEVENT(Inflated exit - simple egress); + return; + } + + // inopportune interleaving -- the exiting thread (this thread) + // in the fast-exit path raced an entering thread in the slow-enter + // path. + // We have two choices: + // A. Try to reacquire the lock. + // If the CAS() fails return immediately, otherwise + // we either restart/rerun the exit operation, or simply + // fall-through into the code below which wakes a successor. + // B. If the elements forming the EntryList|cxq are TSM + // we could simply unpark() the lead thread and return + // without having set _succ. + if (Atomic::cmpxchg_ptr (THREAD, &_owner, NULL) != NULL) { + TEVENT(Inflated exit - reacquired succeeded); + return; + } + TEVENT(Inflated exit - reacquired failed); } else { - if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) { - OrderAccess::release_store_ptr(&_owner, NULL); // drop the lock - OrderAccess::storeload(); - // Ratify the previously observed values. - if (_cxq == NULL || _succ != NULL) { - TEVENT(Inflated exit - simple egress); - return; - } - - // inopportune interleaving -- the exiting thread (this thread) - // in the fast-exit path raced an entering thread in the slow-enter - // path. - // We have two choices: - // A. Try to reacquire the lock. - // If the CAS() fails return immediately, otherwise - // we either restart/rerun the exit operation, or simply - // fall-through into the code below which wakes a successor. - // B. If the elements forming the EntryList|cxq are TSM - // we could simply unpark() the lead thread and return - // without having set _succ. - if (Atomic::cmpxchg_ptr (THREAD, &_owner, NULL) != NULL) { - TEVENT(Inflated exit - reacquired succeeded); - return; - } - TEVENT(Inflated exit - reacquired failed); - } else { - TEVENT(Inflated exit - complex egress); - } + TEVENT(Inflated exit - complex egress); } + } - guarantee(_owner == THREAD, "invariant"); + guarantee(_owner == THREAD, "invariant"); - ObjectWaiter * w = NULL; - int QMode = Knob_QMode; + ObjectWaiter * w = NULL; + int QMode = Knob_QMode; - if (QMode == 2 && _cxq != NULL) { - // QMode == 2 : cxq has precedence over EntryList. - // Try to directly wake a successor from the cxq. - // If successful, the successor will need to unlink itself from cxq. - w = _cxq; - assert(w != NULL, "invariant"); - assert(w->TState == ObjectWaiter::TS_CXQ, "Invariant"); - ExitEpilog(Self, w); - return; - } - - if (QMode == 3 && _cxq != NULL) { - // Aggressively drain cxq into EntryList at the first opportunity. - // This policy ensure that recently-run threads live at the head of EntryList. - // Drain _cxq into EntryList - bulk transfer. - // First, detach _cxq. - // The following loop is tantamount to: w = swap (&cxq, NULL) - w = _cxq; - for (;;) { - assert(w != NULL, "Invariant"); - ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w); - if (u == w) break; - w = u; - } - assert(w != NULL , "invariant"); - - ObjectWaiter * q = NULL; - ObjectWaiter * p; - for (p = w; p != NULL; p = p->_next) { - guarantee(p->TState == ObjectWaiter::TS_CXQ, "Invariant"); - p->TState = ObjectWaiter::TS_ENTER; - p->_prev = q; - q = p; - } - - // Append the RATs to the EntryList - // TODO: organize EntryList as a CDLL so we can locate the tail in constant-time. - ObjectWaiter * Tail; - for (Tail = _EntryList; Tail != NULL && Tail->_next != NULL; Tail = Tail->_next); - if (Tail == NULL) { - _EntryList = w; - } else { - Tail->_next = w; - w->_prev = Tail; - } - - // Fall thru into code that tries to wake a successor from EntryList - } - - if (QMode == 4 && _cxq != NULL) { - // Aggressively drain cxq into EntryList at the first opportunity. - // This policy ensure that recently-run threads live at the head of EntryList. - - // Drain _cxq into EntryList - bulk transfer. - // First, detach _cxq. - // The following loop is tantamount to: w = swap (&cxq, NULL) - w = _cxq; - for (;;) { - assert(w != NULL, "Invariant"); - ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w); - if (u == w) break; - w = u; - } - assert(w != NULL , "invariant"); - - ObjectWaiter * q = NULL; - ObjectWaiter * p; - for (p = w; p != NULL; p = p->_next) { - guarantee(p->TState == ObjectWaiter::TS_CXQ, "Invariant"); - p->TState = ObjectWaiter::TS_ENTER; - p->_prev = q; - q = p; - } - - // Prepend the RATs to the EntryList - if (_EntryList != NULL) { - q->_next = _EntryList; - _EntryList->_prev = q; - } - _EntryList = w; - - // Fall thru into code that tries to wake a successor from EntryList - } - - w = _EntryList; - if (w != NULL) { - // I'd like to write: guarantee (w->_thread != Self). - // But in practice an exiting thread may find itself on the EntryList. - // Let's say thread T1 calls O.wait(). Wait() enqueues T1 on O's waitset and - // then calls exit(). Exit release the lock by setting O._owner to NULL. - // Let's say T1 then stalls. T2 acquires O and calls O.notify(). The - // notify() operation moves T1 from O's waitset to O's EntryList. T2 then - // release the lock "O". T2 resumes immediately after the ST of null into - // _owner, above. T2 notices that the EntryList is populated, so it - // reacquires the lock and then finds itself on the EntryList. - // Given all that, we have to tolerate the circumstance where "w" is - // associated with Self. - assert(w->TState == ObjectWaiter::TS_ENTER, "invariant"); - ExitEpilog(Self, w); - return; - } - - // If we find that both _cxq and EntryList are null then just - // re-run the exit protocol from the top. + if (QMode == 2 && _cxq != NULL) { + // QMode == 2 : cxq has precedence over EntryList. + // Try to directly wake a successor from the cxq. + // If successful, the successor will need to unlink itself from cxq. w = _cxq; - if (w == NULL) continue; + assert(w != NULL, "invariant"); + assert(w->TState == ObjectWaiter::TS_CXQ, "Invariant"); + ExitEpilog(Self, w); + return; + } + + if (QMode == 3 && _cxq != NULL) { + // Aggressively drain cxq into EntryList at the first opportunity. + // This policy ensure that recently-run threads live at the head of EntryList. + // Drain _cxq into EntryList - bulk transfer. + // First, detach _cxq. + // The following loop is tantamount to: w = swap (&cxq, NULL) + w = _cxq; + for (;;) { + assert(w != NULL, "Invariant"); + ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w); + if (u == w) break; + w = u; + } + assert(w != NULL , "invariant"); + + ObjectWaiter * q = NULL; + ObjectWaiter * p; + for (p = w; p != NULL; p = p->_next) { + guarantee(p->TState == ObjectWaiter::TS_CXQ, "Invariant"); + p->TState = ObjectWaiter::TS_ENTER; + p->_prev = q; + q = p; + } + + // Append the RATs to the EntryList + // TODO: organize EntryList as a CDLL so we can locate the tail in constant-time. + ObjectWaiter * Tail; + for (Tail = _EntryList; Tail != NULL && Tail->_next != NULL; Tail = Tail->_next); + if (Tail == NULL) { + _EntryList = w; + } else { + Tail->_next = w; + w->_prev = Tail; + } + + // Fall thru into code that tries to wake a successor from EntryList + } + + if (QMode == 4 && _cxq != NULL) { + // Aggressively drain cxq into EntryList at the first opportunity. + // This policy ensure that recently-run threads live at the head of EntryList. // Drain _cxq into EntryList - bulk transfer. // First, detach _cxq. // The following loop is tantamount to: w = swap (&cxq, NULL) + w = _cxq; for (;;) { - assert(w != NULL, "Invariant"); - ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w); - if (u == w) break; - w = u; + assert(w != NULL, "Invariant"); + ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w); + if (u == w) break; + w = u; } - TEVENT(Inflated exit - drain cxq into EntryList); - assert(w != NULL , "invariant"); - assert(_EntryList == NULL , "invariant"); - // Convert the LIFO SLL anchored by _cxq into a DLL. - // The list reorganization step operates in O(LENGTH(w)) time. - // It's critical that this step operate quickly as - // "Self" still holds the outer-lock, restricting parallelism - // and effectively lengthening the critical section. - // Invariant: s chases t chases u. - // TODO-FIXME: consider changing EntryList from a DLL to a CDLL so - // we have faster access to the tail. - - if (QMode == 1) { - // QMode == 1 : drain cxq to EntryList, reversing order - // We also reverse the order of the list. - ObjectWaiter * s = NULL; - ObjectWaiter * t = w; - ObjectWaiter * u = NULL; - while (t != NULL) { - guarantee(t->TState == ObjectWaiter::TS_CXQ, "invariant"); - t->TState = ObjectWaiter::TS_ENTER; - u = t->_next; - t->_prev = u; - t->_next = s; - s = t; - t = u; - } - _EntryList = s; - assert(s != NULL, "invariant"); - } else { - // QMode == 0 or QMode == 2 - _EntryList = w; - ObjectWaiter * q = NULL; - ObjectWaiter * p; - for (p = w; p != NULL; p = p->_next) { - guarantee(p->TState == ObjectWaiter::TS_CXQ, "Invariant"); - p->TState = ObjectWaiter::TS_ENTER; - p->_prev = q; - q = p; - } + ObjectWaiter * q = NULL; + ObjectWaiter * p; + for (p = w; p != NULL; p = p->_next) { + guarantee(p->TState == ObjectWaiter::TS_CXQ, "Invariant"); + p->TState = ObjectWaiter::TS_ENTER; + p->_prev = q; + q = p; } - // In 1-0 mode we need: ST EntryList; MEMBAR #storestore; ST _owner = NULL - // The MEMBAR is satisfied by the release_store() operation in ExitEpilog(). - - // See if we can abdicate to a spinner instead of waking a thread. - // A primary goal of the implementation is to reduce the - // context-switch rate. - if (_succ != NULL) continue; - - w = _EntryList; - if (w != NULL) { - guarantee(w->TState == ObjectWaiter::TS_ENTER, "invariant"); - ExitEpilog(Self, w); - return; + // Prepend the RATs to the EntryList + if (_EntryList != NULL) { + q->_next = _EntryList; + _EntryList->_prev = q; } - } + _EntryList = w; + + // Fall thru into code that tries to wake a successor from EntryList + } + + w = _EntryList; + if (w != NULL) { + // I'd like to write: guarantee (w->_thread != Self). + // But in practice an exiting thread may find itself on the EntryList. + // Let's say thread T1 calls O.wait(). Wait() enqueues T1 on O's waitset and + // then calls exit(). Exit release the lock by setting O._owner to NULL. + // Let's say T1 then stalls. T2 acquires O and calls O.notify(). The + // notify() operation moves T1 from O's waitset to O's EntryList. T2 then + // release the lock "O". T2 resumes immediately after the ST of null into + // _owner, above. T2 notices that the EntryList is populated, so it + // reacquires the lock and then finds itself on the EntryList. + // Given all that, we have to tolerate the circumstance where "w" is + // associated with Self. + assert(w->TState == ObjectWaiter::TS_ENTER, "invariant"); + ExitEpilog(Self, w); + return; + } + + // If we find that both _cxq and EntryList are null then just + // re-run the exit protocol from the top. + w = _cxq; + if (w == NULL) continue; + + // Drain _cxq into EntryList - bulk transfer. + // First, detach _cxq. + // The following loop is tantamount to: w = swap (&cxq, NULL) + for (;;) { + assert(w != NULL, "Invariant"); + ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w); + if (u == w) break; + w = u; + } + TEVENT(Inflated exit - drain cxq into EntryList); + + assert(w != NULL , "invariant"); + assert(_EntryList == NULL , "invariant"); + + // Convert the LIFO SLL anchored by _cxq into a DLL. + // The list reorganization step operates in O(LENGTH(w)) time. + // It's critical that this step operate quickly as + // "Self" still holds the outer-lock, restricting parallelism + // and effectively lengthening the critical section. + // Invariant: s chases t chases u. + // TODO-FIXME: consider changing EntryList from a DLL to a CDLL so + // we have faster access to the tail. + + if (QMode == 1) { + // QMode == 1 : drain cxq to EntryList, reversing order + // We also reverse the order of the list. + ObjectWaiter * s = NULL; + ObjectWaiter * t = w; + ObjectWaiter * u = NULL; + while (t != NULL) { + guarantee(t->TState == ObjectWaiter::TS_CXQ, "invariant"); + t->TState = ObjectWaiter::TS_ENTER; + u = t->_next; + t->_prev = u; + t->_next = s; + s = t; + t = u; + } + _EntryList = s; + assert(s != NULL, "invariant"); + } else { + // QMode == 0 or QMode == 2 + _EntryList = w; + ObjectWaiter * q = NULL; + ObjectWaiter * p; + for (p = w; p != NULL; p = p->_next) { + guarantee(p->TState == ObjectWaiter::TS_CXQ, "Invariant"); + p->TState = ObjectWaiter::TS_ENTER; + p->_prev = q; + q = p; + } + } + + // In 1-0 mode we need: ST EntryList; MEMBAR #storestore; ST _owner = NULL + // The MEMBAR is satisfied by the release_store() operation in ExitEpilog(). + + // See if we can abdicate to a spinner instead of waking a thread. + // A primary goal of the implementation is to reduce the + // context-switch rate. + if (_succ != NULL) continue; + + w = _EntryList; + if (w != NULL) { + guarantee(w->TState == ObjectWaiter::TS_ENTER, "invariant"); + ExitEpilog(Self, w); + return; + } + } } // ExitSuspendEquivalent: @@ -1278,52 +1278,52 @@ void NOINLINE ObjectMonitor::exit(bool not_suspended, TRAPS) { bool ObjectMonitor::ExitSuspendEquivalent (JavaThread * jSelf) { - const int Mode = Knob_FastHSSEC; - if (Mode && !jSelf->is_external_suspend()) { - assert(jSelf->is_suspend_equivalent(), "invariant"); - jSelf->clear_suspend_equivalent(); - if (2 == Mode) OrderAccess::storeload(); - if (!jSelf->is_external_suspend()) return false; - // We raced a suspension -- fall thru into the slow path - TEVENT(ExitSuspendEquivalent - raced); - jSelf->set_suspend_equivalent(); - } - return jSelf->handle_special_suspend_equivalent_condition(); + const int Mode = Knob_FastHSSEC; + if (Mode && !jSelf->is_external_suspend()) { + assert(jSelf->is_suspend_equivalent(), "invariant"); + jSelf->clear_suspend_equivalent(); + if (2 == Mode) OrderAccess::storeload(); + if (!jSelf->is_external_suspend()) return false; + // We raced a suspension -- fall thru into the slow path + TEVENT(ExitSuspendEquivalent - raced); + jSelf->set_suspend_equivalent(); + } + return jSelf->handle_special_suspend_equivalent_condition(); } void ObjectMonitor::ExitEpilog (Thread * Self, ObjectWaiter * Wakee) { - assert(_owner == Self, "invariant"); + assert(_owner == Self, "invariant"); - // Exit protocol: - // 1. ST _succ = wakee - // 2. membar #loadstore|#storestore; - // 2. ST _owner = NULL - // 3. unpark(wakee) + // Exit protocol: + // 1. ST _succ = wakee + // 2. membar #loadstore|#storestore; + // 2. ST _owner = NULL + // 3. unpark(wakee) - _succ = Knob_SuccEnabled ? Wakee->_thread : NULL; - ParkEvent * Trigger = Wakee->_event; + _succ = Knob_SuccEnabled ? Wakee->_thread : NULL; + ParkEvent * Trigger = Wakee->_event; - // Hygiene -- once we've set _owner = NULL we can't safely dereference Wakee again. - // The thread associated with Wakee may have grabbed the lock and "Wakee" may be - // out-of-scope (non-extant). - Wakee = NULL; + // Hygiene -- once we've set _owner = NULL we can't safely dereference Wakee again. + // The thread associated with Wakee may have grabbed the lock and "Wakee" may be + // out-of-scope (non-extant). + Wakee = NULL; - // Drop the lock - OrderAccess::release_store_ptr(&_owner, NULL); - OrderAccess::fence(); // ST _owner vs LD in unpark() + // Drop the lock + OrderAccess::release_store_ptr(&_owner, NULL); + OrderAccess::fence(); // ST _owner vs LD in unpark() - if (SafepointSynchronize::do_call_back()) { - TEVENT(unpark before SAFEPOINT); - } + if (SafepointSynchronize::do_call_back()) { + TEVENT(unpark before SAFEPOINT); + } - DTRACE_MONITOR_PROBE(contended__exit, this, object(), Self); - Trigger->unpark(); + DTRACE_MONITOR_PROBE(contended__exit, this, object(), Self); + Trigger->unpark(); - // Maintain stats and report events to JVMTI - if (ObjectMonitor::_sync_Parks != NULL) { - ObjectMonitor::_sync_Parks->inc(); - } + // Maintain stats and report events to JVMTI + if (ObjectMonitor::_sync_Parks != NULL) { + ObjectMonitor::_sync_Parks->inc(); + } } @@ -1337,41 +1337,41 @@ void ObjectMonitor::ExitEpilog (Thread * Self, ObjectWaiter * Wakee) { // inflated monitor, e.g. the monitor can be inflated by a non-owning // thread due to contention. intptr_t ObjectMonitor::complete_exit(TRAPS) { - Thread * const Self = THREAD; - assert(Self->is_Java_thread(), "Must be Java thread!"); - JavaThread *jt = (JavaThread *)THREAD; + Thread * const Self = THREAD; + assert(Self->is_Java_thread(), "Must be Java thread!"); + JavaThread *jt = (JavaThread *)THREAD; - DeferredInitialize(); + DeferredInitialize(); - if (THREAD != _owner) { + if (THREAD != _owner) { if (THREAD->is_lock_owned ((address)_owner)) { - assert(_recursions == 0, "internal state error"); - _owner = THREAD; /* Convert from basiclock addr to Thread addr */ - _recursions = 0; - OwnerIsThread = 1; + assert(_recursions == 0, "internal state error"); + _owner = THREAD; /* Convert from basiclock addr to Thread addr */ + _recursions = 0; + OwnerIsThread = 1; } - } + } - guarantee(Self == _owner, "complete_exit not owner"); - intptr_t save = _recursions; // record the old recursion count - _recursions = 0; // set the recursion level to be 0 - exit(true, Self); // exit the monitor - guarantee(_owner != Self, "invariant"); - return save; + guarantee(Self == _owner, "complete_exit not owner"); + intptr_t save = _recursions; // record the old recursion count + _recursions = 0; // set the recursion level to be 0 + exit(true, Self); // exit the monitor + guarantee(_owner != Self, "invariant"); + return save; } // reenter() enters a lock and sets recursion count // complete_exit/reenter operate as a wait without waiting void ObjectMonitor::reenter(intptr_t recursions, TRAPS) { - Thread * const Self = THREAD; - assert(Self->is_Java_thread(), "Must be Java thread!"); - JavaThread *jt = (JavaThread *)THREAD; + Thread * const Self = THREAD; + assert(Self->is_Java_thread(), "Must be Java thread!"); + JavaThread *jt = (JavaThread *)THREAD; - guarantee(_owner != Self, "reenter already owner"); - enter(THREAD); // enter the monitor - guarantee(_recursions == 0, "reenter recursion"); - _recursions = recursions; - return; + guarantee(_owner != Self, "reenter already owner"); + enter(THREAD); // enter the monitor + guarantee(_recursions == 0, "reenter recursion"); + _recursions = recursions; + return; } @@ -1412,9 +1412,9 @@ static int Adjust (volatile int * adr, int dx) { // helper method for posting a monitor wait event void ObjectMonitor::post_monitor_wait_event(EventJavaMonitorWait* event, - jlong notifier_tid, - jlong timeout, - bool timedout) { + jlong notifier_tid, + jlong timeout, + bool timedout) { event->set_klass(((oop)this->object())->klass()); event->set_timeout((TYPE_ULONG)timeout); event->set_address((TYPE_ADDRESS)(uintptr_t)(this->object_addr())); @@ -1429,232 +1429,232 @@ void ObjectMonitor::post_monitor_wait_event(EventJavaMonitorWait* event, // Note: a subset of changes to ObjectMonitor::wait() // will need to be replicated in complete_exit void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) { - Thread * const Self = THREAD; - assert(Self->is_Java_thread(), "Must be Java thread!"); - JavaThread *jt = (JavaThread *)THREAD; + Thread * const Self = THREAD; + assert(Self->is_Java_thread(), "Must be Java thread!"); + JavaThread *jt = (JavaThread *)THREAD; - DeferredInitialize(); + DeferredInitialize(); - // Throw IMSX or IEX. - CHECK_OWNER(); + // Throw IMSX or IEX. + CHECK_OWNER(); - EventJavaMonitorWait event; + EventJavaMonitorWait event; - // check for a pending interrupt - if (interruptible && Thread::is_interrupted(Self, true) && !HAS_PENDING_EXCEPTION) { - // post monitor waited event. Note that this is past-tense, we are done waiting. - if (JvmtiExport::should_post_monitor_waited()) { - // Note: 'false' parameter is passed here because the - // wait was not timed out due to thread interrupt. - JvmtiExport::post_monitor_waited(jt, this, false); + // check for a pending interrupt + if (interruptible && Thread::is_interrupted(Self, true) && !HAS_PENDING_EXCEPTION) { + // post monitor waited event. Note that this is past-tense, we are done waiting. + if (JvmtiExport::should_post_monitor_waited()) { + // Note: 'false' parameter is passed here because the + // wait was not timed out due to thread interrupt. + JvmtiExport::post_monitor_waited(jt, this, false); - // In this short circuit of the monitor wait protocol, the - // current thread never drops ownership of the monitor and - // never gets added to the wait queue so the current thread - // cannot be made the successor. This means that the - // JVMTI_EVENT_MONITOR_WAITED event handler cannot accidentally - // consume an unpark() meant for the ParkEvent associated with - // this ObjectMonitor. - } - if (event.should_commit()) { - post_monitor_wait_event(&event, 0, millis, false); - } - TEVENT(Wait - Throw IEX); - THROW(vmSymbols::java_lang_InterruptedException()); - return; - } + // In this short circuit of the monitor wait protocol, the + // current thread never drops ownership of the monitor and + // never gets added to the wait queue so the current thread + // cannot be made the successor. This means that the + // JVMTI_EVENT_MONITOR_WAITED event handler cannot accidentally + // consume an unpark() meant for the ParkEvent associated with + // this ObjectMonitor. + } + if (event.should_commit()) { + post_monitor_wait_event(&event, 0, millis, false); + } + TEVENT(Wait - Throw IEX); + THROW(vmSymbols::java_lang_InterruptedException()); + return; + } - TEVENT(Wait); + TEVENT(Wait); - assert(Self->_Stalled == 0, "invariant"); - Self->_Stalled = intptr_t(this); - jt->set_current_waiting_monitor(this); + assert(Self->_Stalled == 0, "invariant"); + Self->_Stalled = intptr_t(this); + jt->set_current_waiting_monitor(this); - // create a node to be put into the queue - // Critically, after we reset() the event but prior to park(), we must check - // for a pending interrupt. - ObjectWaiter node(Self); - node.TState = ObjectWaiter::TS_WAIT; - Self->_ParkEvent->reset(); - OrderAccess::fence(); // ST into Event; membar ; LD interrupted-flag + // create a node to be put into the queue + // Critically, after we reset() the event but prior to park(), we must check + // for a pending interrupt. + ObjectWaiter node(Self); + node.TState = ObjectWaiter::TS_WAIT; + Self->_ParkEvent->reset(); + OrderAccess::fence(); // ST into Event; membar ; LD interrupted-flag - // Enter the waiting queue, which is a circular doubly linked list in this case - // but it could be a priority queue or any data structure. - // _WaitSetLock protects the wait queue. Normally the wait queue is accessed only - // by the the owner of the monitor *except* in the case where park() - // returns because of a timeout of interrupt. Contention is exceptionally rare - // so we use a simple spin-lock instead of a heavier-weight blocking lock. + // Enter the waiting queue, which is a circular doubly linked list in this case + // but it could be a priority queue or any data structure. + // _WaitSetLock protects the wait queue. Normally the wait queue is accessed only + // by the the owner of the monitor *except* in the case where park() + // returns because of a timeout of interrupt. Contention is exceptionally rare + // so we use a simple spin-lock instead of a heavier-weight blocking lock. - Thread::SpinAcquire(&_WaitSetLock, "WaitSet - add"); - AddWaiter(&node); - Thread::SpinRelease(&_WaitSetLock); + Thread::SpinAcquire(&_WaitSetLock, "WaitSet - add"); + AddWaiter(&node); + Thread::SpinRelease(&_WaitSetLock); - if ((SyncFlags & 4) == 0) { - _Responsible = NULL; - } - intptr_t save = _recursions; // record the old recursion count - _waiters++; // increment the number of waiters - _recursions = 0; // set the recursion level to be 1 - exit(true, Self); // exit the monitor - guarantee(_owner != Self, "invariant"); + if ((SyncFlags & 4) == 0) { + _Responsible = NULL; + } + intptr_t save = _recursions; // record the old recursion count + _waiters++; // increment the number of waiters + _recursions = 0; // set the recursion level to be 1 + exit(true, Self); // exit the monitor + guarantee(_owner != Self, "invariant"); - // The thread is on the WaitSet list - now park() it. - // On MP systems it's conceivable that a brief spin before we park - // could be profitable. - // - // TODO-FIXME: change the following logic to a loop of the form - // while (!timeout && !interrupted && _notified == 0) park() + // The thread is on the WaitSet list - now park() it. + // On MP systems it's conceivable that a brief spin before we park + // could be profitable. + // + // TODO-FIXME: change the following logic to a loop of the form + // while (!timeout && !interrupted && _notified == 0) park() - int ret = OS_OK; - int WasNotified = 0; - { // State transition wrappers - OSThread* osthread = Self->osthread(); - OSThreadWaitState osts(osthread, true); - { - ThreadBlockInVM tbivm(jt); - // Thread is in thread_blocked state and oop access is unsafe. - jt->set_suspend_equivalent(); + int ret = OS_OK; + int WasNotified = 0; + { // State transition wrappers + OSThread* osthread = Self->osthread(); + OSThreadWaitState osts(osthread, true); + { + ThreadBlockInVM tbivm(jt); + // Thread is in thread_blocked state and oop access is unsafe. + jt->set_suspend_equivalent(); - if (interruptible && (Thread::is_interrupted(THREAD, false) || HAS_PENDING_EXCEPTION)) { - // Intentionally empty - } else - if (node._notified == 0) { - if (millis <= 0) { - Self->_ParkEvent->park(); - } else { - ret = Self->_ParkEvent->park(millis); - } - } + if (interruptible && (Thread::is_interrupted(THREAD, false) || HAS_PENDING_EXCEPTION)) { + // Intentionally empty + } else + if (node._notified == 0) { + if (millis <= 0) { + Self->_ParkEvent->park(); + } else { + ret = Self->_ParkEvent->park(millis); + } + } - // were we externally suspended while we were waiting? - if (ExitSuspendEquivalent (jt)) { - // TODO-FIXME: add -- if succ == Self then succ = null. - jt->java_suspend_self(); - } + // were we externally suspended while we were waiting? + if (ExitSuspendEquivalent (jt)) { + // TODO-FIXME: add -- if succ == Self then succ = null. + jt->java_suspend_self(); + } - } // Exit thread safepoint: transition _thread_blocked -> _thread_in_vm + } // Exit thread safepoint: transition _thread_blocked -> _thread_in_vm - // Node may be on the WaitSet, the EntryList (or cxq), or in transition - // from the WaitSet to the EntryList. - // See if we need to remove Node from the WaitSet. - // We use double-checked locking to avoid grabbing _WaitSetLock - // if the thread is not on the wait queue. - // - // Note that we don't need a fence before the fetch of TState. - // In the worst case we'll fetch a old-stale value of TS_WAIT previously - // written by the is thread. (perhaps the fetch might even be satisfied - // by a look-aside into the processor's own store buffer, although given - // the length of the code path between the prior ST and this load that's - // highly unlikely). If the following LD fetches a stale TS_WAIT value - // then we'll acquire the lock and then re-fetch a fresh TState value. - // That is, we fail toward safety. + // Node may be on the WaitSet, the EntryList (or cxq), or in transition + // from the WaitSet to the EntryList. + // See if we need to remove Node from the WaitSet. + // We use double-checked locking to avoid grabbing _WaitSetLock + // if the thread is not on the wait queue. + // + // Note that we don't need a fence before the fetch of TState. + // In the worst case we'll fetch a old-stale value of TS_WAIT previously + // written by the is thread. (perhaps the fetch might even be satisfied + // by a look-aside into the processor's own store buffer, although given + // the length of the code path between the prior ST and this load that's + // highly unlikely). If the following LD fetches a stale TS_WAIT value + // then we'll acquire the lock and then re-fetch a fresh TState value. + // That is, we fail toward safety. - if (node.TState == ObjectWaiter::TS_WAIT) { - Thread::SpinAcquire(&_WaitSetLock, "WaitSet - unlink"); - if (node.TState == ObjectWaiter::TS_WAIT) { - DequeueSpecificWaiter(&node); // unlink from WaitSet - assert(node._notified == 0, "invariant"); - node.TState = ObjectWaiter::TS_RUN; - } - Thread::SpinRelease(&_WaitSetLock); - } + if (node.TState == ObjectWaiter::TS_WAIT) { + Thread::SpinAcquire(&_WaitSetLock, "WaitSet - unlink"); + if (node.TState == ObjectWaiter::TS_WAIT) { + DequeueSpecificWaiter(&node); // unlink from WaitSet + assert(node._notified == 0, "invariant"); + node.TState = ObjectWaiter::TS_RUN; + } + Thread::SpinRelease(&_WaitSetLock); + } - // The thread is now either on off-list (TS_RUN), - // on the EntryList (TS_ENTER), or on the cxq (TS_CXQ). - // The Node's TState variable is stable from the perspective of this thread. - // No other threads will asynchronously modify TState. - guarantee(node.TState != ObjectWaiter::TS_WAIT, "invariant"); - OrderAccess::loadload(); - if (_succ == Self) _succ = NULL; - WasNotified = node._notified; + // The thread is now either on off-list (TS_RUN), + // on the EntryList (TS_ENTER), or on the cxq (TS_CXQ). + // The Node's TState variable is stable from the perspective of this thread. + // No other threads will asynchronously modify TState. + guarantee(node.TState != ObjectWaiter::TS_WAIT, "invariant"); + OrderAccess::loadload(); + if (_succ == Self) _succ = NULL; + WasNotified = node._notified; - // Reentry phase -- reacquire the monitor. - // re-enter contended monitor after object.wait(). - // retain OBJECT_WAIT state until re-enter successfully completes - // Thread state is thread_in_vm and oop access is again safe, - // although the raw address of the object may have changed. - // (Don't cache naked oops over safepoints, of course). + // Reentry phase -- reacquire the monitor. + // re-enter contended monitor after object.wait(). + // retain OBJECT_WAIT state until re-enter successfully completes + // Thread state is thread_in_vm and oop access is again safe, + // although the raw address of the object may have changed. + // (Don't cache naked oops over safepoints, of course). - // post monitor waited event. Note that this is past-tense, we are done waiting. - if (JvmtiExport::should_post_monitor_waited()) { - JvmtiExport::post_monitor_waited(jt, this, ret == OS_TIMEOUT); + // post monitor waited event. Note that this is past-tense, we are done waiting. + if (JvmtiExport::should_post_monitor_waited()) { + JvmtiExport::post_monitor_waited(jt, this, ret == OS_TIMEOUT); - if (node._notified != 0 && _succ == Self) { - // In this part of the monitor wait-notify-reenter protocol it - // is possible (and normal) for another thread to do a fastpath - // monitor enter-exit while this thread is still trying to get - // to the reenter portion of the protocol. - // - // The ObjectMonitor was notified and the current thread is - // the successor which also means that an unpark() has already - // been done. The JVMTI_EVENT_MONITOR_WAITED event handler can - // consume the unpark() that was done when the successor was - // set because the same ParkEvent is shared between Java - // monitors and JVM/TI RawMonitors (for now). - // - // We redo the unpark() to ensure forward progress, i.e., we - // don't want all pending threads hanging (parked) with none - // entering the unlocked monitor. - node._event->unpark(); - } - } + if (node._notified != 0 && _succ == Self) { + // In this part of the monitor wait-notify-reenter protocol it + // is possible (and normal) for another thread to do a fastpath + // monitor enter-exit while this thread is still trying to get + // to the reenter portion of the protocol. + // + // The ObjectMonitor was notified and the current thread is + // the successor which also means that an unpark() has already + // been done. The JVMTI_EVENT_MONITOR_WAITED event handler can + // consume the unpark() that was done when the successor was + // set because the same ParkEvent is shared between Java + // monitors and JVM/TI RawMonitors (for now). + // + // We redo the unpark() to ensure forward progress, i.e., we + // don't want all pending threads hanging (parked) with none + // entering the unlocked monitor. + node._event->unpark(); + } + } - if (event.should_commit()) { - post_monitor_wait_event(&event, node._notifier_tid, millis, ret == OS_TIMEOUT); - } + if (event.should_commit()) { + post_monitor_wait_event(&event, node._notifier_tid, millis, ret == OS_TIMEOUT); + } - OrderAccess::fence(); + OrderAccess::fence(); - assert(Self->_Stalled != 0, "invariant"); - Self->_Stalled = 0; + assert(Self->_Stalled != 0, "invariant"); + Self->_Stalled = 0; - assert(_owner != Self, "invariant"); - ObjectWaiter::TStates v = node.TState; - if (v == ObjectWaiter::TS_RUN) { - enter(Self); - } else { - guarantee(v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant"); - ReenterI(Self, &node); - node.wait_reenter_end(this); - } + assert(_owner != Self, "invariant"); + ObjectWaiter::TStates v = node.TState; + if (v == ObjectWaiter::TS_RUN) { + enter(Self); + } else { + guarantee(v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, "invariant"); + ReenterI(Self, &node); + node.wait_reenter_end(this); + } - // Self has reacquired the lock. - // Lifecycle - the node representing Self must not appear on any queues. - // Node is about to go out-of-scope, but even if it were immortal we wouldn't - // want residual elements associated with this thread left on any lists. - guarantee(node.TState == ObjectWaiter::TS_RUN, "invariant"); - assert(_owner == Self, "invariant"); - assert(_succ != Self , "invariant"); - } // OSThreadWaitState() + // Self has reacquired the lock. + // Lifecycle - the node representing Self must not appear on any queues. + // Node is about to go out-of-scope, but even if it were immortal we wouldn't + // want residual elements associated with this thread left on any lists. + guarantee(node.TState == ObjectWaiter::TS_RUN, "invariant"); + assert(_owner == Self, "invariant"); + assert(_succ != Self , "invariant"); + } // OSThreadWaitState() - jt->set_current_waiting_monitor(NULL); + jt->set_current_waiting_monitor(NULL); - guarantee(_recursions == 0, "invariant"); - _recursions = save; // restore the old recursion count - _waiters--; // decrement the number of waiters + guarantee(_recursions == 0, "invariant"); + _recursions = save; // restore the old recursion count + _waiters--; // decrement the number of waiters - // Verify a few postconditions - assert(_owner == Self , "invariant"); - assert(_succ != Self , "invariant"); - assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant"); + // Verify a few postconditions + assert(_owner == Self , "invariant"); + assert(_succ != Self , "invariant"); + assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant"); - if (SyncFlags & 32) { - OrderAccess::fence(); - } + if (SyncFlags & 32) { + OrderAccess::fence(); + } - // check if the notification happened - if (!WasNotified) { - // no, it could be timeout or Thread.interrupt() or both - // check for interrupt event, otherwise it is timeout - if (interruptible && Thread::is_interrupted(Self, true) && !HAS_PENDING_EXCEPTION) { - TEVENT(Wait - throw IEX from epilog); - THROW(vmSymbols::java_lang_InterruptedException()); - } - } + // check if the notification happened + if (!WasNotified) { + // no, it could be timeout or Thread.interrupt() or both + // check for interrupt event, otherwise it is timeout + if (interruptible && Thread::is_interrupted(Self, true) && !HAS_PENDING_EXCEPTION) { + TEVENT(Wait - throw IEX from epilog); + THROW(vmSymbols::java_lang_InterruptedException()); + } + } - // NOTE: Spurious wake up will be consider as timeout. - // Monitor notify has precedence over thread interrupt. + // NOTE: Spurious wake up will be consider as timeout. + // Monitor notify has precedence over thread interrupt. } @@ -1666,8 +1666,8 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) { void ObjectMonitor::notify(TRAPS) { CHECK_OWNER(); if (_WaitSet == NULL) { - TEVENT(Empty-Notify); - return; + TEVENT(Empty-Notify); + return; } DTRACE_MONITOR_PROBE(notify, this, object(), THREAD); @@ -1676,108 +1676,108 @@ void ObjectMonitor::notify(TRAPS) { Thread::SpinAcquire(&_WaitSetLock, "WaitSet - notify"); ObjectWaiter * iterator = DequeueWaiter(); if (iterator != NULL) { - TEVENT(Notify1 - Transfer); - guarantee(iterator->TState == ObjectWaiter::TS_WAIT, "invariant"); - guarantee(iterator->_notified == 0, "invariant"); - if (Policy != 4) { - iterator->TState = ObjectWaiter::TS_ENTER; - } - iterator->_notified = 1; - Thread * Self = THREAD; - iterator->_notifier_tid = Self->osthread()->thread_id(); + TEVENT(Notify1 - Transfer); + guarantee(iterator->TState == ObjectWaiter::TS_WAIT, "invariant"); + guarantee(iterator->_notified == 0, "invariant"); + if (Policy != 4) { + iterator->TState = ObjectWaiter::TS_ENTER; + } + iterator->_notified = 1; + Thread * Self = THREAD; + iterator->_notifier_tid = Self->osthread()->thread_id(); - ObjectWaiter * List = _EntryList; - if (List != NULL) { - assert(List->_prev == NULL, "invariant"); - assert(List->TState == ObjectWaiter::TS_ENTER, "invariant"); - assert(List != iterator, "invariant"); - } + ObjectWaiter * List = _EntryList; + if (List != NULL) { + assert(List->_prev == NULL, "invariant"); + assert(List->TState == ObjectWaiter::TS_ENTER, "invariant"); + assert(List != iterator, "invariant"); + } - if (Policy == 0) { // prepend to EntryList - if (List == NULL) { - iterator->_next = iterator->_prev = NULL; - _EntryList = iterator; - } else { - List->_prev = iterator; - iterator->_next = List; - iterator->_prev = NULL; - _EntryList = iterator; - } - } else - if (Policy == 1) { // append to EntryList - if (List == NULL) { - iterator->_next = iterator->_prev = NULL; - _EntryList = iterator; - } else { - // CONSIDER: finding the tail currently requires a linear-time walk of - // the EntryList. We can make tail access constant-time by converting to - // a CDLL instead of using our current DLL. - ObjectWaiter * Tail; - for (Tail = List; Tail->_next != NULL; Tail = Tail->_next); - assert(Tail != NULL && Tail->_next == NULL, "invariant"); - Tail->_next = iterator; - iterator->_prev = Tail; - iterator->_next = NULL; - } - } else - if (Policy == 2) { // prepend to cxq - // prepend to cxq - if (List == NULL) { - iterator->_next = iterator->_prev = NULL; - _EntryList = iterator; - } else { - iterator->TState = ObjectWaiter::TS_CXQ; - for (;;) { - ObjectWaiter * Front = _cxq; - iterator->_next = Front; - if (Atomic::cmpxchg_ptr (iterator, &_cxq, Front) == Front) { - break; - } - } - } - } else - if (Policy == 3) { // append to cxq + if (Policy == 0) { // prepend to EntryList + if (List == NULL) { + iterator->_next = iterator->_prev = NULL; + _EntryList = iterator; + } else { + List->_prev = iterator; + iterator->_next = List; + iterator->_prev = NULL; + _EntryList = iterator; + } + } else + if (Policy == 1) { // append to EntryList + if (List == NULL) { + iterator->_next = iterator->_prev = NULL; + _EntryList = iterator; + } else { + // CONSIDER: finding the tail currently requires a linear-time walk of + // the EntryList. We can make tail access constant-time by converting to + // a CDLL instead of using our current DLL. + ObjectWaiter * Tail; + for (Tail = List; Tail->_next != NULL; Tail = Tail->_next); + assert(Tail != NULL && Tail->_next == NULL, "invariant"); + Tail->_next = iterator; + iterator->_prev = Tail; + iterator->_next = NULL; + } + } else + if (Policy == 2) { // prepend to cxq + // prepend to cxq + if (List == NULL) { + iterator->_next = iterator->_prev = NULL; + _EntryList = iterator; + } else { iterator->TState = ObjectWaiter::TS_CXQ; for (;;) { - ObjectWaiter * Tail; - Tail = _cxq; - if (Tail == NULL) { - iterator->_next = NULL; - if (Atomic::cmpxchg_ptr (iterator, &_cxq, NULL) == NULL) { - break; - } - } else { - while (Tail->_next != NULL) Tail = Tail->_next; - Tail->_next = iterator; - iterator->_prev = Tail; - iterator->_next = NULL; - break; - } + ObjectWaiter * Front = _cxq; + iterator->_next = Front; + if (Atomic::cmpxchg_ptr (iterator, &_cxq, Front) == Front) { + break; + } } - } else { - ParkEvent * ev = iterator->_event; - iterator->TState = ObjectWaiter::TS_RUN; - OrderAccess::fence(); - ev->unpark(); - } + } + } else + if (Policy == 3) { // append to cxq + iterator->TState = ObjectWaiter::TS_CXQ; + for (;;) { + ObjectWaiter * Tail; + Tail = _cxq; + if (Tail == NULL) { + iterator->_next = NULL; + if (Atomic::cmpxchg_ptr (iterator, &_cxq, NULL) == NULL) { + break; + } + } else { + while (Tail->_next != NULL) Tail = Tail->_next; + Tail->_next = iterator; + iterator->_prev = Tail; + iterator->_next = NULL; + break; + } + } + } else { + ParkEvent * ev = iterator->_event; + iterator->TState = ObjectWaiter::TS_RUN; + OrderAccess::fence(); + ev->unpark(); + } - if (Policy < 4) { - iterator->wait_reenter_begin(this); - } + if (Policy < 4) { + iterator->wait_reenter_begin(this); + } - // _WaitSetLock protects the wait queue, not the EntryList. We could - // move the add-to-EntryList operation, above, outside the critical section - // protected by _WaitSetLock. In practice that's not useful. With the - // exception of wait() timeouts and interrupts the monitor owner - // is the only thread that grabs _WaitSetLock. There's almost no contention - // on _WaitSetLock so it's not profitable to reduce the length of the - // critical section. + // _WaitSetLock protects the wait queue, not the EntryList. We could + // move the add-to-EntryList operation, above, outside the critical section + // protected by _WaitSetLock. In practice that's not useful. With the + // exception of wait() timeouts and interrupts the monitor owner + // is the only thread that grabs _WaitSetLock. There's almost no contention + // on _WaitSetLock so it's not profitable to reduce the length of the + // critical section. } Thread::SpinRelease(&_WaitSetLock); if (iterator != NULL && ObjectMonitor::_sync_Notifications != NULL) { - ObjectMonitor::_sync_Notifications->inc(); + ObjectMonitor::_sync_Notifications->inc(); } } @@ -1786,8 +1786,8 @@ void ObjectMonitor::notifyAll(TRAPS) { CHECK_OWNER(); ObjectWaiter* iterator; if (_WaitSet == NULL) { - TEVENT(Empty-NotifyAll); - return; + TEVENT(Empty-NotifyAll); + return; } DTRACE_MONITOR_PROBE(notifyAll, this, object(), THREAD); @@ -1796,112 +1796,112 @@ void ObjectMonitor::notifyAll(TRAPS) { Thread::SpinAcquire(&_WaitSetLock, "WaitSet - notifyall"); for (;;) { - iterator = DequeueWaiter(); - if (iterator == NULL) break; - TEVENT(NotifyAll - Transfer1); - ++Tally; + iterator = DequeueWaiter(); + if (iterator == NULL) break; + TEVENT(NotifyAll - Transfer1); + ++Tally; - // Disposition - what might we do with iterator ? - // a. add it directly to the EntryList - either tail or head. - // b. push it onto the front of the _cxq. - // For now we use (a). + // Disposition - what might we do with iterator ? + // a. add it directly to the EntryList - either tail or head. + // b. push it onto the front of the _cxq. + // For now we use (a). - guarantee(iterator->TState == ObjectWaiter::TS_WAIT, "invariant"); - guarantee(iterator->_notified == 0, "invariant"); - iterator->_notified = 1; - Thread * Self = THREAD; - iterator->_notifier_tid = Self->osthread()->thread_id(); - if (Policy != 4) { - iterator->TState = ObjectWaiter::TS_ENTER; - } + guarantee(iterator->TState == ObjectWaiter::TS_WAIT, "invariant"); + guarantee(iterator->_notified == 0, "invariant"); + iterator->_notified = 1; + Thread * Self = THREAD; + iterator->_notifier_tid = Self->osthread()->thread_id(); + if (Policy != 4) { + iterator->TState = ObjectWaiter::TS_ENTER; + } - ObjectWaiter * List = _EntryList; - if (List != NULL) { - assert(List->_prev == NULL, "invariant"); - assert(List->TState == ObjectWaiter::TS_ENTER, "invariant"); - assert(List != iterator, "invariant"); - } + ObjectWaiter * List = _EntryList; + if (List != NULL) { + assert(List->_prev == NULL, "invariant"); + assert(List->TState == ObjectWaiter::TS_ENTER, "invariant"); + assert(List != iterator, "invariant"); + } - if (Policy == 0) { // prepend to EntryList - if (List == NULL) { - iterator->_next = iterator->_prev = NULL; - _EntryList = iterator; - } else { - List->_prev = iterator; - iterator->_next = List; - iterator->_prev = NULL; - _EntryList = iterator; + if (Policy == 0) { // prepend to EntryList + if (List == NULL) { + iterator->_next = iterator->_prev = NULL; + _EntryList = iterator; + } else { + List->_prev = iterator; + iterator->_next = List; + iterator->_prev = NULL; + _EntryList = iterator; + } + } else + if (Policy == 1) { // append to EntryList + if (List == NULL) { + iterator->_next = iterator->_prev = NULL; + _EntryList = iterator; + } else { + // CONSIDER: finding the tail currently requires a linear-time walk of + // the EntryList. We can make tail access constant-time by converting to + // a CDLL instead of using our current DLL. + ObjectWaiter * Tail; + for (Tail = List; Tail->_next != NULL; Tail = Tail->_next); + assert(Tail != NULL && Tail->_next == NULL, "invariant"); + Tail->_next = iterator; + iterator->_prev = Tail; + iterator->_next = NULL; + } + } else + if (Policy == 2) { // prepend to cxq + // prepend to cxq + iterator->TState = ObjectWaiter::TS_CXQ; + for (;;) { + ObjectWaiter * Front = _cxq; + iterator->_next = Front; + if (Atomic::cmpxchg_ptr (iterator, &_cxq, Front) == Front) { + break; } - } else - if (Policy == 1) { // append to EntryList - if (List == NULL) { - iterator->_next = iterator->_prev = NULL; - _EntryList = iterator; - } else { - // CONSIDER: finding the tail currently requires a linear-time walk of - // the EntryList. We can make tail access constant-time by converting to - // a CDLL instead of using our current DLL. - ObjectWaiter * Tail; - for (Tail = List; Tail->_next != NULL; Tail = Tail->_next); - assert(Tail != NULL && Tail->_next == NULL, "invariant"); - Tail->_next = iterator; - iterator->_prev = Tail; - iterator->_next = NULL; + } + } else + if (Policy == 3) { // append to cxq + iterator->TState = ObjectWaiter::TS_CXQ; + for (;;) { + ObjectWaiter * Tail; + Tail = _cxq; + if (Tail == NULL) { + iterator->_next = NULL; + if (Atomic::cmpxchg_ptr (iterator, &_cxq, NULL) == NULL) { + break; + } + } else { + while (Tail->_next != NULL) Tail = Tail->_next; + Tail->_next = iterator; + iterator->_prev = Tail; + iterator->_next = NULL; + break; } - } else - if (Policy == 2) { // prepend to cxq - // prepend to cxq - iterator->TState = ObjectWaiter::TS_CXQ; - for (;;) { - ObjectWaiter * Front = _cxq; - iterator->_next = Front; - if (Atomic::cmpxchg_ptr (iterator, &_cxq, Front) == Front) { - break; - } - } - } else - if (Policy == 3) { // append to cxq - iterator->TState = ObjectWaiter::TS_CXQ; - for (;;) { - ObjectWaiter * Tail; - Tail = _cxq; - if (Tail == NULL) { - iterator->_next = NULL; - if (Atomic::cmpxchg_ptr (iterator, &_cxq, NULL) == NULL) { - break; - } - } else { - while (Tail->_next != NULL) Tail = Tail->_next; - Tail->_next = iterator; - iterator->_prev = Tail; - iterator->_next = NULL; - break; - } - } - } else { - ParkEvent * ev = iterator->_event; - iterator->TState = ObjectWaiter::TS_RUN; - OrderAccess::fence(); - ev->unpark(); - } + } + } else { + ParkEvent * ev = iterator->_event; + iterator->TState = ObjectWaiter::TS_RUN; + OrderAccess::fence(); + ev->unpark(); + } - if (Policy < 4) { - iterator->wait_reenter_begin(this); - } + if (Policy < 4) { + iterator->wait_reenter_begin(this); + } - // _WaitSetLock protects the wait queue, not the EntryList. We could - // move the add-to-EntryList operation, above, outside the critical section - // protected by _WaitSetLock. In practice that's not useful. With the - // exception of wait() timeouts and interrupts the monitor owner - // is the only thread that grabs _WaitSetLock. There's almost no contention - // on _WaitSetLock so it's not profitable to reduce the length of the - // critical section. + // _WaitSetLock protects the wait queue, not the EntryList. We could + // move the add-to-EntryList operation, above, outside the critical section + // protected by _WaitSetLock. In practice that's not useful. With the + // exception of wait() timeouts and interrupts the monitor owner + // is the only thread that grabs _WaitSetLock. There's almost no contention + // on _WaitSetLock so it's not profitable to reduce the length of the + // critical section. } Thread::SpinRelease(&_WaitSetLock); if (Tally != 0 && ObjectMonitor::_sync_Notifications != NULL) { - ObjectMonitor::_sync_Notifications->inc(Tally); + ObjectMonitor::_sync_Notifications->inc(Tally); } } @@ -1979,227 +1979,227 @@ int (*ObjectMonitor::SpinCallbackFunction)(intptr_t, int) = NULL; int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) { - // Dumb, brutal spin. Good for comparative measurements against adaptive spinning. - int ctr = Knob_FixedSpin; - if (ctr != 0) { - while (--ctr >= 0) { - if (TryLock(Self) > 0) return 1; - SpinPause(); - } - return 0; + // Dumb, brutal spin. Good for comparative measurements against adaptive spinning. + int ctr = Knob_FixedSpin; + if (ctr != 0) { + while (--ctr >= 0) { + if (TryLock(Self) > 0) return 1; + SpinPause(); + } + return 0; + } + + for (ctr = Knob_PreSpin + 1; --ctr >= 0;) { + if (TryLock(Self) > 0) { + // Increase _SpinDuration ... + // Note that we don't clamp SpinDuration precisely at SpinLimit. + // Raising _SpurDuration to the poverty line is key. + int x = _SpinDuration; + if (x < Knob_SpinLimit) { + if (x < Knob_Poverty) x = Knob_Poverty; + _SpinDuration = x + Knob_BonusB; + } + return 1; + } + SpinPause(); + } + + // Admission control - verify preconditions for spinning + // + // We always spin a little bit, just to prevent _SpinDuration == 0 from + // becoming an absorbing state. Put another way, we spin briefly to + // sample, just in case the system load, parallelism, contention, or lock + // modality changed. + // + // Consider the following alternative: + // Periodically set _SpinDuration = _SpinLimit and try a long/full + // spin attempt. "Periodically" might mean after a tally of + // the # of failed spin attempts (or iterations) reaches some threshold. + // This takes us into the realm of 1-out-of-N spinning, where we + // hold the duration constant but vary the frequency. + + ctr = _SpinDuration; + if (ctr < Knob_SpinBase) ctr = Knob_SpinBase; + if (ctr <= 0) return 0; + + if (Knob_SuccRestrict && _succ != NULL) return 0; + if (Knob_OState && NotRunnable (Self, (Thread *) _owner)) { + TEVENT(Spin abort - notrunnable [TOP]); + return 0; + } + + int MaxSpin = Knob_MaxSpinners; + if (MaxSpin >= 0) { + if (_Spinner > MaxSpin) { + TEVENT(Spin abort -- too many spinners); + return 0; + } + // Slightly racy, but benign ... + Adjust(&_Spinner, 1); + } + + // We're good to spin ... spin ingress. + // CONSIDER: use Prefetch::write() to avoid RTS->RTO upgrades + // when preparing to LD...CAS _owner, etc and the CAS is likely + // to succeed. + int hits = 0; + int msk = 0; + int caspty = Knob_CASPenalty; + int oxpty = Knob_OXPenalty; + int sss = Knob_SpinSetSucc; + if (sss && _succ == NULL) _succ = Self; + Thread * prv = NULL; + + // There are three ways to exit the following loop: + // 1. A successful spin where this thread has acquired the lock. + // 2. Spin failure with prejudice + // 3. Spin failure without prejudice + + while (--ctr >= 0) { + + // Periodic polling -- Check for pending GC + // Threads may spin while they're unsafe. + // We don't want spinning threads to delay the JVM from reaching + // a stop-the-world safepoint or to steal cycles from GC. + // If we detect a pending safepoint we abort in order that + // (a) this thread, if unsafe, doesn't delay the safepoint, and (b) + // this thread, if safe, doesn't steal cycles from GC. + // This is in keeping with the "no loitering in runtime" rule. + // We periodically check to see if there's a safepoint pending. + if ((ctr & 0xFF) == 0) { + if (SafepointSynchronize::do_call_back()) { + TEVENT(Spin: safepoint); + goto Abort; // abrupt spin egress + } + if (Knob_UsePause & 1) SpinPause(); + + int (*scb)(intptr_t,int) = SpinCallbackFunction; + if (hits > 50 && scb != NULL) { + int abend = (*scb)(SpinCallbackArgument, 0); + } } - for (ctr = Knob_PreSpin + 1; --ctr >= 0;) { - if (TryLock(Self) > 0) { - // Increase _SpinDuration ... + if (Knob_UsePause & 2) SpinPause(); + + // Exponential back-off ... Stay off the bus to reduce coherency traffic. + // This is useful on classic SMP systems, but is of less utility on + // N1-style CMT platforms. + // + // Trade-off: lock acquisition latency vs coherency bandwidth. + // Lock hold times are typically short. A histogram + // of successful spin attempts shows that we usually acquire + // the lock early in the spin. That suggests we want to + // sample _owner frequently in the early phase of the spin, + // but then back-off and sample less frequently as the spin + // progresses. The back-off makes a good citizen on SMP big + // SMP systems. Oversampling _owner can consume excessive + // coherency bandwidth. Relatedly, if we _oversample _owner we + // can inadvertently interfere with the the ST m->owner=null. + // executed by the lock owner. + if (ctr & msk) continue; + ++hits; + if ((hits & 0xF) == 0) { + // The 0xF, above, corresponds to the exponent. + // Consider: (msk+1)|msk + msk = ((msk << 2)|3) & BackOffMask; + } + + // Probe _owner with TATAS + // If this thread observes the monitor transition or flicker + // from locked to unlocked to locked, then the odds that this + // thread will acquire the lock in this spin attempt go down + // considerably. The same argument applies if the CAS fails + // or if we observe _owner change from one non-null value to + // another non-null value. In such cases we might abort + // the spin without prejudice or apply a "penalty" to the + // spin count-down variable "ctr", reducing it by 100, say. + + Thread * ox = (Thread *) _owner; + if (ox == NULL) { + ox = (Thread *) Atomic::cmpxchg_ptr(Self, &_owner, NULL); + if (ox == NULL) { + // The CAS succeeded -- this thread acquired ownership + // Take care of some bookkeeping to exit spin state. + if (sss && _succ == Self) { + _succ = NULL; + } + if (MaxSpin > 0) Adjust(&_Spinner, -1); + + // Increase _SpinDuration : + // The spin was successful (profitable) so we tend toward + // longer spin attempts in the future. + // CONSIDER: factor "ctr" into the _SpinDuration adjustment. + // If we acquired the lock early in the spin cycle it + // makes sense to increase _SpinDuration proportionally. // Note that we don't clamp SpinDuration precisely at SpinLimit. - // Raising _SpurDuration to the poverty line is key. int x = _SpinDuration; if (x < Knob_SpinLimit) { - if (x < Knob_Poverty) x = Knob_Poverty; - _SpinDuration = x + Knob_BonusB; + if (x < Knob_Poverty) x = Knob_Poverty; + _SpinDuration = x + Knob_Bonus; } return 1; } - SpinPause(); - } - // Admission control - verify preconditions for spinning - // - // We always spin a little bit, just to prevent _SpinDuration == 0 from - // becoming an absorbing state. Put another way, we spin briefly to - // sample, just in case the system load, parallelism, contention, or lock - // modality changed. - // - // Consider the following alternative: - // Periodically set _SpinDuration = _SpinLimit and try a long/full - // spin attempt. "Periodically" might mean after a tally of - // the # of failed spin attempts (or iterations) reaches some threshold. - // This takes us into the realm of 1-out-of-N spinning, where we - // hold the duration constant but vary the frequency. - - ctr = _SpinDuration; - if (ctr < Knob_SpinBase) ctr = Knob_SpinBase; - if (ctr <= 0) return 0; - - if (Knob_SuccRestrict && _succ != NULL) return 0; - if (Knob_OState && NotRunnable (Self, (Thread *) _owner)) { - TEVENT(Spin abort - notrunnable [TOP]); - return 0; - } - - int MaxSpin = Knob_MaxSpinners; - if (MaxSpin >= 0) { - if (_Spinner > MaxSpin) { - TEVENT(Spin abort -- too many spinners); - return 0; - } - // Slightly racy, but benign ... - Adjust(&_Spinner, 1); - } - - // We're good to spin ... spin ingress. - // CONSIDER: use Prefetch::write() to avoid RTS->RTO upgrades - // when preparing to LD...CAS _owner, etc and the CAS is likely - // to succeed. - int hits = 0; - int msk = 0; - int caspty = Knob_CASPenalty; - int oxpty = Knob_OXPenalty; - int sss = Knob_SpinSetSucc; - if (sss && _succ == NULL) _succ = Self; - Thread * prv = NULL; - - // There are three ways to exit the following loop: - // 1. A successful spin where this thread has acquired the lock. - // 2. Spin failure with prejudice - // 3. Spin failure without prejudice - - while (--ctr >= 0) { - - // Periodic polling -- Check for pending GC - // Threads may spin while they're unsafe. - // We don't want spinning threads to delay the JVM from reaching - // a stop-the-world safepoint or to steal cycles from GC. - // If we detect a pending safepoint we abort in order that - // (a) this thread, if unsafe, doesn't delay the safepoint, and (b) - // this thread, if safe, doesn't steal cycles from GC. - // This is in keeping with the "no loitering in runtime" rule. - // We periodically check to see if there's a safepoint pending. - if ((ctr & 0xFF) == 0) { - if (SafepointSynchronize::do_call_back()) { - TEVENT(Spin: safepoint); - goto Abort; // abrupt spin egress - } - if (Knob_UsePause & 1) SpinPause(); - - int (*scb)(intptr_t,int) = SpinCallbackFunction; - if (hits > 50 && scb != NULL) { - int abend = (*scb)(SpinCallbackArgument, 0); - } - } - - if (Knob_UsePause & 2) SpinPause(); - - // Exponential back-off ... Stay off the bus to reduce coherency traffic. - // This is useful on classic SMP systems, but is of less utility on - // N1-style CMT platforms. - // - // Trade-off: lock acquisition latency vs coherency bandwidth. - // Lock hold times are typically short. A histogram - // of successful spin attempts shows that we usually acquire - // the lock early in the spin. That suggests we want to - // sample _owner frequently in the early phase of the spin, - // but then back-off and sample less frequently as the spin - // progresses. The back-off makes a good citizen on SMP big - // SMP systems. Oversampling _owner can consume excessive - // coherency bandwidth. Relatedly, if we _oversample _owner we - // can inadvertently interfere with the the ST m->owner=null. - // executed by the lock owner. - if (ctr & msk) continue; - ++hits; - if ((hits & 0xF) == 0) { - // The 0xF, above, corresponds to the exponent. - // Consider: (msk+1)|msk - msk = ((msk << 2)|3) & BackOffMask; - } - - // Probe _owner with TATAS - // If this thread observes the monitor transition or flicker - // from locked to unlocked to locked, then the odds that this - // thread will acquire the lock in this spin attempt go down - // considerably. The same argument applies if the CAS fails - // or if we observe _owner change from one non-null value to - // another non-null value. In such cases we might abort - // the spin without prejudice or apply a "penalty" to the - // spin count-down variable "ctr", reducing it by 100, say. - - Thread * ox = (Thread *) _owner; - if (ox == NULL) { - ox = (Thread *) Atomic::cmpxchg_ptr(Self, &_owner, NULL); - if (ox == NULL) { - // The CAS succeeded -- this thread acquired ownership - // Take care of some bookkeeping to exit spin state. - if (sss && _succ == Self) { - _succ = NULL; - } - if (MaxSpin > 0) Adjust(&_Spinner, -1); - - // Increase _SpinDuration : - // The spin was successful (profitable) so we tend toward - // longer spin attempts in the future. - // CONSIDER: factor "ctr" into the _SpinDuration adjustment. - // If we acquired the lock early in the spin cycle it - // makes sense to increase _SpinDuration proportionally. - // Note that we don't clamp SpinDuration precisely at SpinLimit. - int x = _SpinDuration; - if (x < Knob_SpinLimit) { - if (x < Knob_Poverty) x = Knob_Poverty; - _SpinDuration = x + Knob_Bonus; - } - return 1; - } - - // The CAS failed ... we can take any of the following actions: - // * penalize: ctr -= Knob_CASPenalty - // * exit spin with prejudice -- goto Abort; - // * exit spin without prejudice. - // * Since CAS is high-latency, retry again immediately. - prv = ox; - TEVENT(Spin: cas failed); - if (caspty == -2) break; - if (caspty == -1) goto Abort; - ctr -= caspty; - continue; - } - - // Did lock ownership change hands ? - if (ox != prv && prv != NULL) { - TEVENT(spin: Owner changed) - if (oxpty == -2) break; - if (oxpty == -1) goto Abort; - ctr -= oxpty; - } + // The CAS failed ... we can take any of the following actions: + // * penalize: ctr -= Knob_CASPenalty + // * exit spin with prejudice -- goto Abort; + // * exit spin without prejudice. + // * Since CAS is high-latency, retry again immediately. prv = ox; + TEVENT(Spin: cas failed); + if (caspty == -2) break; + if (caspty == -1) goto Abort; + ctr -= caspty; + continue; + } - // Abort the spin if the owner is not executing. - // The owner must be executing in order to drop the lock. - // Spinning while the owner is OFFPROC is idiocy. - // Consider: ctr -= RunnablePenalty ; - if (Knob_OState && NotRunnable (Self, ox)) { - TEVENT(Spin abort - notrunnable); - goto Abort; - } - if (sss && _succ == NULL) _succ = Self; - } + // Did lock ownership change hands ? + if (ox != prv && prv != NULL) { + TEVENT(spin: Owner changed) + if (oxpty == -2) break; + if (oxpty == -1) goto Abort; + ctr -= oxpty; + } + prv = ox; - // Spin failed with prejudice -- reduce _SpinDuration. - // TODO: Use an AIMD-like policy to adjust _SpinDuration. - // AIMD is globally stable. - TEVENT(Spin failure); - { - int x = _SpinDuration; - if (x > 0) { - // Consider an AIMD scheme like: x -= (x >> 3) + 100 - // This is globally sample and tends to damp the response. - x -= Knob_Penalty; - if (x < 0) x = 0; - _SpinDuration = x; - } - } + // Abort the spin if the owner is not executing. + // The owner must be executing in order to drop the lock. + // Spinning while the owner is OFFPROC is idiocy. + // Consider: ctr -= RunnablePenalty ; + if (Knob_OState && NotRunnable (Self, ox)) { + TEVENT(Spin abort - notrunnable); + goto Abort; + } + if (sss && _succ == NULL) _succ = Self; + } + + // Spin failed with prejudice -- reduce _SpinDuration. + // TODO: Use an AIMD-like policy to adjust _SpinDuration. + // AIMD is globally stable. + TEVENT(Spin failure); + { + int x = _SpinDuration; + if (x > 0) { + // Consider an AIMD scheme like: x -= (x >> 3) + 100 + // This is globally sample and tends to damp the response. + x -= Knob_Penalty; + if (x < 0) x = 0; + _SpinDuration = x; + } + } Abort: - if (MaxSpin >= 0) Adjust(&_Spinner, -1); - if (sss && _succ == Self) { - _succ = NULL; - // Invariant: after setting succ=null a contending thread - // must recheck-retry _owner before parking. This usually happens - // in the normal usage of TrySpin(), but it's safest - // to make TrySpin() as foolproof as possible. - OrderAccess::fence(); - if (TryLock(Self) > 0) return 1; - } - return 0; + if (MaxSpin >= 0) Adjust(&_Spinner, -1); + if (sss && _succ == Self) { + _succ = NULL; + // Invariant: after setting succ=null a contending thread + // must recheck-retry _owner before parking. This usually happens + // in the normal usage of TrySpin(), but it's safest + // to make TrySpin() as foolproof as possible. + OrderAccess::fence(); + if (TryLock(Self) > 0) return 1; + } + return 0; } // NotRunnable() -- informed spinning @@ -2242,29 +2242,29 @@ int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) { int ObjectMonitor::NotRunnable (Thread * Self, Thread * ox) { - // Check either OwnerIsThread or ox->TypeTag == 2BAD. - if (!OwnerIsThread) return 0; + // Check either OwnerIsThread or ox->TypeTag == 2BAD. + if (!OwnerIsThread) return 0; - if (ox == NULL) return 0; + if (ox == NULL) return 0; - // Avoid transitive spinning ... - // Say T1 spins or blocks trying to acquire L. T1._Stalled is set to L. - // Immediately after T1 acquires L it's possible that T2, also - // spinning on L, will see L.Owner=T1 and T1._Stalled=L. - // This occurs transiently after T1 acquired L but before - // T1 managed to clear T1.Stalled. T2 does not need to abort - // its spin in this circumstance. - intptr_t BlockedOn = SafeFetchN((intptr_t *) &ox->_Stalled, intptr_t(1)); + // Avoid transitive spinning ... + // Say T1 spins or blocks trying to acquire L. T1._Stalled is set to L. + // Immediately after T1 acquires L it's possible that T2, also + // spinning on L, will see L.Owner=T1 and T1._Stalled=L. + // This occurs transiently after T1 acquired L but before + // T1 managed to clear T1.Stalled. T2 does not need to abort + // its spin in this circumstance. + intptr_t BlockedOn = SafeFetchN((intptr_t *) &ox->_Stalled, intptr_t(1)); - if (BlockedOn == 1) return 1; - if (BlockedOn != 0) { - return BlockedOn != intptr_t(this) && _owner == ox; - } + if (BlockedOn == 1) return 1; + if (BlockedOn != 0) { + return BlockedOn != intptr_t(this) && _owner == ox; + } - assert(sizeof(((JavaThread *)ox)->_thread_state == sizeof(int)), "invariant"); - int jst = SafeFetch32((int *) &((JavaThread *) ox)->_thread_state, -1);; - // consider also: jst != _thread_in_Java -- but that's overspecific. - return jst == _thread_blocked || jst == _thread_in_native; + assert(sizeof(((JavaThread *)ox)->_thread_state == sizeof(int)), "invariant"); + int jst = SafeFetch32((int *) &((JavaThread *) ox)->_thread_state, -1);; + // consider also: jst != _thread_in_Java -- but that's overspecific. + return jst == _thread_blocked || jst == _thread_in_native; } @@ -2377,27 +2377,27 @@ void ObjectMonitor::Initialize() { assert(InitializationCompleted == 0, "invariant"); InitializationCompleted = 1; if (UsePerfData) { - EXCEPTION_MARK; + EXCEPTION_MARK; #define NEWPERFCOUNTER(n) {n = PerfDataManager::create_counter(SUN_RT, #n, PerfData::U_Events,CHECK); } #define NEWPERFVARIABLE(n) {n = PerfDataManager::create_variable(SUN_RT, #n, PerfData::U_Events,CHECK); } - NEWPERFCOUNTER(_sync_Inflations); - NEWPERFCOUNTER(_sync_Deflations); - NEWPERFCOUNTER(_sync_ContendedLockAttempts); - NEWPERFCOUNTER(_sync_FutileWakeups); - NEWPERFCOUNTER(_sync_Parks); - NEWPERFCOUNTER(_sync_EmptyNotifications); - NEWPERFCOUNTER(_sync_Notifications); - NEWPERFCOUNTER(_sync_SlowEnter); - NEWPERFCOUNTER(_sync_SlowExit); - NEWPERFCOUNTER(_sync_SlowNotify); - NEWPERFCOUNTER(_sync_SlowNotifyAll); - NEWPERFCOUNTER(_sync_FailedSpins); - NEWPERFCOUNTER(_sync_SuccessfulSpins); - NEWPERFCOUNTER(_sync_PrivateA); - NEWPERFCOUNTER(_sync_PrivateB); - NEWPERFCOUNTER(_sync_MonInCirculation); - NEWPERFCOUNTER(_sync_MonScavenged); - NEWPERFVARIABLE(_sync_MonExtant); + NEWPERFCOUNTER(_sync_Inflations); + NEWPERFCOUNTER(_sync_Deflations); + NEWPERFCOUNTER(_sync_ContendedLockAttempts); + NEWPERFCOUNTER(_sync_FutileWakeups); + NEWPERFCOUNTER(_sync_Parks); + NEWPERFCOUNTER(_sync_EmptyNotifications); + NEWPERFCOUNTER(_sync_Notifications); + NEWPERFCOUNTER(_sync_SlowEnter); + NEWPERFCOUNTER(_sync_SlowExit); + NEWPERFCOUNTER(_sync_SlowNotify); + NEWPERFCOUNTER(_sync_SlowNotifyAll); + NEWPERFCOUNTER(_sync_FailedSpins); + NEWPERFCOUNTER(_sync_SuccessfulSpins); + NEWPERFCOUNTER(_sync_PrivateA); + NEWPERFCOUNTER(_sync_PrivateB); + NEWPERFCOUNTER(_sync_MonInCirculation); + NEWPERFCOUNTER(_sync_MonScavenged); + NEWPERFVARIABLE(_sync_MonExtant); #undef NEWPERFCOUNTER } } @@ -2417,33 +2417,33 @@ void ObjectMonitor::ctAsserts() { static char * kvGet (char * kvList, const char * Key) { - if (kvList == NULL) return NULL; - size_t n = strlen(Key); - char * Search; - for (Search = kvList; *Search; Search += strlen(Search) + 1) { - if (strncmp (Search, Key, n) == 0) { - if (Search[n] == '=') return Search + n + 1; - if (Search[n] == 0) return(char *) "1"; - } + if (kvList == NULL) return NULL; + size_t n = strlen(Key); + char * Search; + for (Search = kvList; *Search; Search += strlen(Search) + 1) { + if (strncmp (Search, Key, n) == 0) { + if (Search[n] == '=') return Search + n + 1; + if (Search[n] == 0) return(char *) "1"; } - return NULL; + } + return NULL; } static int kvGetInt (char * kvList, const char * Key, int Default) { - char * v = kvGet(kvList, Key); - int rslt = v ? ::strtol(v, NULL, 0) : Default; - if (Knob_ReportSettings && v != NULL) { - ::printf (" SyncKnob: %s %d(%d)\n", Key, rslt, Default) ; - ::fflush(stdout); - } - return rslt; + char * v = kvGet(kvList, Key); + int rslt = v ? ::strtol(v, NULL, 0) : Default; + if (Knob_ReportSettings && v != NULL) { + ::printf (" SyncKnob: %s %d(%d)\n", Key, rslt, Default) ; + ::fflush(stdout); + } + return rslt; } void ObjectMonitor::DeferredInitialize() { if (InitDone > 0) return; if (Atomic::cmpxchg (-1, &InitDone, 0) != 0) { - while (InitDone != 1); - return; + while (InitDone != 1); + return; } // One-shot global initialization ... @@ -2457,13 +2457,13 @@ void ObjectMonitor::DeferredInitialize() { size_t sz = strlen(SyncKnobs); char * knobs = (char *) malloc(sz + 2); if (knobs == NULL) { - vm_exit_out_of_memory(sz + 2, OOM_MALLOC_ERROR, "Parse SyncKnobs"); - guarantee(0, "invariant"); + vm_exit_out_of_memory(sz + 2, OOM_MALLOC_ERROR, "Parse SyncKnobs"); + guarantee(0, "invariant"); } strcpy(knobs, SyncKnobs); knobs[sz+1] = 0; for (char * p = knobs; *p; p++) { - if (*p == ':') *p = 0; + if (*p == ':') *p = 0; } #define SETKNOB(x) { Knob_##x = kvGetInt (knobs, #x, Knob_##x); } @@ -2502,18 +2502,18 @@ void ObjectMonitor::DeferredInitialize() { } if (os::is_MP()) { - BackOffMask = (1 << Knob_SpinBackOff) - 1; - if (Knob_ReportSettings) ::printf("BackOffMask=%X\n", BackOffMask); - // CONSIDER: BackOffMask = ROUNDUP_NEXT_POWER2 (ncpus-1) + BackOffMask = (1 << Knob_SpinBackOff) - 1; + if (Knob_ReportSettings) ::printf("BackOffMask=%X\n", BackOffMask); + // CONSIDER: BackOffMask = ROUNDUP_NEXT_POWER2 (ncpus-1) } else { - Knob_SpinLimit = 0; - Knob_SpinBase = 0; - Knob_PreSpin = 0; - Knob_FixedSpin = -1; + Knob_SpinLimit = 0; + Knob_SpinBase = 0; + Knob_PreSpin = 0; + Knob_FixedSpin = -1; } if (Knob_LogSpins == 0) { - ObjectMonitor::_sync_FailedSpins = NULL; + ObjectMonitor::_sync_FailedSpins = NULL; } free(knobs); diff --git a/hotspot/src/share/vm/runtime/objectMonitor.hpp b/hotspot/src/share/vm/runtime/objectMonitor.hpp index 655211a0b1f..914aeebc999 100644 --- a/hotspot/src/share/vm/runtime/objectMonitor.hpp +++ b/hotspot/src/share/vm/runtime/objectMonitor.hpp @@ -141,7 +141,7 @@ class ObjectMonitor { _header = NULL; _count = 0; _waiters = 0, - _recursions = 0; + _recursions = 0; _object = NULL; _owner = NULL; _WaitSet = NULL; @@ -158,12 +158,12 @@ class ObjectMonitor { } ~ObjectMonitor() { - // TODO: Add asserts ... - // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0 - // _count == 0 _EntryList == NULL etc + // TODO: Add asserts ... + // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0 + // _count == 0 _EntryList == NULL etc } -private: + private: void Recycle() { // TODO: add stronger asserts ... // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0 @@ -180,7 +180,7 @@ private: OwnerIsThread = 0; } -public: + public: void* object() const; void* object_addr(); @@ -225,9 +225,9 @@ public: void ExitEpilog(Thread * Self, ObjectWaiter * Wakee); bool ExitSuspendEquivalent(JavaThread * Self); void post_monitor_wait_event(EventJavaMonitorWait * event, - jlong notifier_tid, - jlong timeout, - bool timedout); + jlong notifier_tid, + jlong timeout, + bool timedout); private: friend class ObjectSynchronizer; @@ -253,8 +253,8 @@ public: private: int OwnerIsThread; // _owner is (Thread *) vs SP/BasicLock ObjectWaiter * volatile _cxq; // LL of recently-arrived threads blocked on entry. - // The list is actually composed of WaitNodes, acting - // as proxies for Threads. + // The list is actually composed of WaitNodes, acting + // as proxies for Threads. protected: ObjectWaiter * volatile _EntryList; // Threads blocked on entry or reentry. private: diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.hpp b/hotspot/src/share/vm/runtime/sharedRuntime.hpp index 93fa35d1b2f..ebbee25453c 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp @@ -50,8 +50,8 @@ class SharedRuntime: AllStatic { private: static methodHandle resolve_sub_helper(JavaThread *thread, - bool is_virtual, - bool is_optimized, TRAPS); + bool is_virtual, + bool is_optimized, TRAPS); // Shared stub locations @@ -309,11 +309,11 @@ class SharedRuntime: AllStatic { bool is_virtual, bool is_optimized, TRAPS); - private: + private: // deopt blob static void generate_deopt_blob(void); - public: + public: static DeoptimizationBlob* deopt_blob(void) { return _deopt_blob; } // Resets a call-site in compiled code so it will get resolved again. diff --git a/hotspot/src/share/vm/runtime/synchronizer.cpp b/hotspot/src/share/vm/runtime/synchronizer.cpp index 8a4d386321e..83565a90a3c 100644 --- a/hotspot/src/share/vm/runtime/synchronizer.cpp +++ b/hotspot/src/share/vm/runtime/synchronizer.cpp @@ -43,7 +43,7 @@ #include "utilities/preserveException.hpp" #if defined(__GNUC__) && !defined(PPC64) - // Need to inhibit inlining for older versions of GCC to avoid build-time failures +// Need to inhibit inlining for older versions of GCC to avoid build-time failures #define NOINLINE __attribute__((noinline)) #else #define NOINLINE @@ -128,7 +128,7 @@ static volatile int MonitorPopulation = 0; // # Extant -- in circulation // extremely sensitive to race condition. Be careful. void ObjectSynchronizer::fast_enter(Handle obj, BasicLock* lock, bool attempt_rebias, TRAPS) { - if (UseBiasedLocking) { + if (UseBiasedLocking) { if (!SafepointSynchronize::is_at_safepoint()) { BiasedLocking::Condition cond = BiasedLocking::revoke_and_rebias(obj, attempt_rebias, THREAD); if (cond == BiasedLocking::BIAS_REVOKED_AND_REBIASED) { @@ -139,9 +139,9 @@ void ObjectSynchronizer::fast_enter(Handle obj, BasicLock* lock, bool attempt_re BiasedLocking::revoke_at_safepoint(obj); } assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); - } + } - slow_enter(obj, lock, THREAD); + slow_enter(obj, lock, THREAD); } void ObjectSynchronizer::fast_exit(oop object, BasicLock* lock, TRAPS) { @@ -150,19 +150,19 @@ void ObjectSynchronizer::fast_exit(oop object, BasicLock* lock, TRAPS) { markOop dhw = lock->displaced_header(); markOop mark; if (dhw == NULL) { - // Recursive stack-lock. - // Diagnostics -- Could be: stack-locked, inflating, inflated. - mark = object->mark(); - assert(!mark->is_neutral(), "invariant"); - if (mark->has_locker() && mark != markOopDesc::INFLATING()) { - assert(THREAD->is_lock_owned((address)mark->locker()), "invariant"); - } - if (mark->has_monitor()) { - ObjectMonitor * m = mark->monitor(); - assert(((oop)(m->object()))->mark() == mark, "invariant"); - assert(m->is_entered(THREAD), "invariant"); - } - return; + // Recursive stack-lock. + // Diagnostics -- Could be: stack-locked, inflating, inflated. + mark = object->mark(); + assert(!mark->is_neutral(), "invariant"); + if (mark->has_locker() && mark != markOopDesc::INFLATING()) { + assert(THREAD->is_lock_owned((address)mark->locker()), "invariant"); + } + if (mark->has_monitor()) { + ObjectMonitor * m = mark->monitor(); + assert(((oop)(m->object()))->mark() == mark, "invariant"); + assert(m->is_entered(THREAD), "invariant"); + } + return; } mark = object->mark(); @@ -170,11 +170,11 @@ void ObjectSynchronizer::fast_exit(oop object, BasicLock* lock, TRAPS) { // If the object is stack-locked by the current thread, try to // swing the displaced header from the box back to the mark. if (mark == (markOop) lock) { - assert(dhw->is_neutral(), "invariant"); - if ((markOop) Atomic::cmpxchg_ptr (dhw, object->mark_addr(), mark) == mark) { - TEVENT(fast_exit: release stacklock); - return; - } + assert(dhw->is_neutral(), "invariant"); + if ((markOop) Atomic::cmpxchg_ptr (dhw, object->mark_addr(), mark) == mark) { + TEVENT(fast_exit: release stacklock); + return; + } } ObjectSynchronizer::inflate(THREAD, object)->exit(true, THREAD); @@ -299,7 +299,7 @@ void ObjectSynchronizer::jni_exit(oop obj, Thread* THREAD) { // If this thread has locked the object, exit the monitor. Note: can't use // monitor->check(CHECK); must exit even if an exception is pending. if (monitor->check(THREAD)) { - monitor->exit(true, THREAD); + monitor->exit(true, THREAD); } } @@ -362,7 +362,7 @@ void ObjectSynchronizer::waitUninterruptibly (Handle obj, jlong millis, TRAPS) { } void ObjectSynchronizer::notify(Handle obj, TRAPS) { - if (UseBiasedLocking) { + if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(obj, false, THREAD); assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); } @@ -410,16 +410,16 @@ void ObjectSynchronizer::notifyall(Handle obj, TRAPS) { // performed by the CPU(s) or platform. struct SharedGlobals { - // These are highly shared mostly-read variables. - // To avoid false-sharing they need to be the sole occupants of a $ line. - double padPrefix[8]; - volatile int stwRandom; - volatile int stwCycle; + // These are highly shared mostly-read variables. + // To avoid false-sharing they need to be the sole occupants of a $ line. + double padPrefix[8]; + volatile int stwRandom; + volatile int stwCycle; - // Hot RW variables -- Sequester to avoid false-sharing - double padSuffix[16]; - volatile int hcSequence; - double padFinal[8]; + // Hot RW variables -- Sequester to avoid false-sharing + double padSuffix[16]; + volatile int hcSequence; + double padFinal[8]; }; static SharedGlobals GVars; @@ -451,45 +451,45 @@ static markOop ReadStableMark (oop obj) { ++its; if (its > 10000 || !os::is_MP()) { - if (its & 1) { - os::naked_yield(); - TEVENT(Inflate: INFLATING - yield); - } else { - // Note that the following code attenuates the livelock problem but is not - // a complete remedy. A more complete solution would require that the inflating - // thread hold the associated inflation lock. The following code simply restricts - // the number of spinners to at most one. We'll have N-2 threads blocked - // on the inflationlock, 1 thread holding the inflation lock and using - // a yield/park strategy, and 1 thread in the midst of inflation. - // A more refined approach would be to change the encoding of INFLATING - // to allow encapsulation of a native thread pointer. Threads waiting for - // inflation to complete would use CAS to push themselves onto a singly linked - // list rooted at the markword. Once enqueued, they'd loop, checking a per-thread flag - // and calling park(). When inflation was complete the thread that accomplished inflation - // would detach the list and set the markword to inflated with a single CAS and - // then for each thread on the list, set the flag and unpark() the thread. - // This is conceptually similar to muxAcquire-muxRelease, except that muxRelease - // wakes at most one thread whereas we need to wake the entire list. - int ix = (cast_from_oop(obj) >> 5) & (NINFLATIONLOCKS-1); - int YieldThenBlock = 0; - assert(ix >= 0 && ix < NINFLATIONLOCKS, "invariant"); - assert((NINFLATIONLOCKS & (NINFLATIONLOCKS-1)) == 0, "invariant"); - Thread::muxAcquire(InflationLocks + ix, "InflationLock"); - while (obj->mark() == markOopDesc::INFLATING()) { - // Beware: NakedYield() is advisory and has almost no effect on some platforms - // so we periodically call Self->_ParkEvent->park(1). - // We use a mixed spin/yield/block mechanism. - if ((YieldThenBlock++) >= 16) { - Thread::current()->_ParkEvent->park(1); - } else { - os::naked_yield(); - } - } - Thread::muxRelease(InflationLocks + ix); - TEVENT(Inflate: INFLATING - yield/park); - } + if (its & 1) { + os::naked_yield(); + TEVENT(Inflate: INFLATING - yield); + } else { + // Note that the following code attenuates the livelock problem but is not + // a complete remedy. A more complete solution would require that the inflating + // thread hold the associated inflation lock. The following code simply restricts + // the number of spinners to at most one. We'll have N-2 threads blocked + // on the inflationlock, 1 thread holding the inflation lock and using + // a yield/park strategy, and 1 thread in the midst of inflation. + // A more refined approach would be to change the encoding of INFLATING + // to allow encapsulation of a native thread pointer. Threads waiting for + // inflation to complete would use CAS to push themselves onto a singly linked + // list rooted at the markword. Once enqueued, they'd loop, checking a per-thread flag + // and calling park(). When inflation was complete the thread that accomplished inflation + // would detach the list and set the markword to inflated with a single CAS and + // then for each thread on the list, set the flag and unpark() the thread. + // This is conceptually similar to muxAcquire-muxRelease, except that muxRelease + // wakes at most one thread whereas we need to wake the entire list. + int ix = (cast_from_oop(obj) >> 5) & (NINFLATIONLOCKS-1); + int YieldThenBlock = 0; + assert(ix >= 0 && ix < NINFLATIONLOCKS, "invariant"); + assert((NINFLATIONLOCKS & (NINFLATIONLOCKS-1)) == 0, "invariant"); + Thread::muxAcquire(InflationLocks + ix, "InflationLock"); + while (obj->mark() == markOopDesc::INFLATING()) { + // Beware: NakedYield() is advisory and has almost no effect on some platforms + // so we periodically call Self->_ParkEvent->park(1). + // We use a mixed spin/yield/block mechanism. + if ((YieldThenBlock++) >= 16) { + Thread::current()->_ParkEvent->park(1); + } else { + os::naked_yield(); + } + } + Thread::muxRelease(InflationLocks + ix); + TEVENT(Inflate: INFLATING - yield/park); + } } else { - SpinPause(); // SMP-polite spinning + SpinPause(); // SMP-polite spinning } } } @@ -515,40 +515,40 @@ static markOop ReadStableMark (oop obj) { static inline intptr_t get_next_hash(Thread * Self, oop obj) { intptr_t value = 0; if (hashCode == 0) { - // This form uses an unguarded global Park-Miller RNG, - // so it's possible for two threads to race and generate the same RNG. - // On MP system we'll have lots of RW access to a global, so the - // mechanism induces lots of coherency traffic. - value = os::random(); + // This form uses an unguarded global Park-Miller RNG, + // so it's possible for two threads to race and generate the same RNG. + // On MP system we'll have lots of RW access to a global, so the + // mechanism induces lots of coherency traffic. + value = os::random(); } else if (hashCode == 1) { - // This variation has the property of being stable (idempotent) - // between STW operations. This can be useful in some of the 1-0 - // synchronization schemes. - intptr_t addrBits = cast_from_oop(obj) >> 3; - value = addrBits ^ (addrBits >> 5) ^ GVars.stwRandom; + // This variation has the property of being stable (idempotent) + // between STW operations. This can be useful in some of the 1-0 + // synchronization schemes. + intptr_t addrBits = cast_from_oop(obj) >> 3; + value = addrBits ^ (addrBits >> 5) ^ GVars.stwRandom; } else if (hashCode == 2) { - value = 1; // for sensitivity testing + value = 1; // for sensitivity testing } else if (hashCode == 3) { - value = ++GVars.hcSequence; + value = ++GVars.hcSequence; } else if (hashCode == 4) { - value = cast_from_oop(obj); + value = cast_from_oop(obj); } else { - // Marsaglia's xor-shift scheme with thread-specific state - // This is probably the best overall implementation -- we'll - // likely make this the default in future releases. - unsigned t = Self->_hashStateX; - t ^= (t << 11); - Self->_hashStateX = Self->_hashStateY; - Self->_hashStateY = Self->_hashStateZ; - Self->_hashStateZ = Self->_hashStateW; - unsigned v = Self->_hashStateW; - v = (v ^ (v >> 19)) ^ (t ^ (t >> 8)); - Self->_hashStateW = v; - value = v; + // Marsaglia's xor-shift scheme with thread-specific state + // This is probably the best overall implementation -- we'll + // likely make this the default in future releases. + unsigned t = Self->_hashStateX; + t ^= (t << 11); + Self->_hashStateX = Self->_hashStateY; + Self->_hashStateY = Self->_hashStateZ; + Self->_hashStateZ = Self->_hashStateW; + unsigned v = Self->_hashStateW; + v = (v ^ (v >> 19)) ^ (t ^ (t >> 8)); + Self->_hashStateW = v; + value = v; } value &= markOopDesc::hash_mask; @@ -572,7 +572,7 @@ intptr_t ObjectSynchronizer::FastHashCode (Thread * Self, oop obj) { Handle hobj(Self, obj); // Relaxing assertion for bug 6320749. assert(Universe::verify_in_progress() || - !SafepointSynchronize::is_at_safepoint(), + !SafepointSynchronize::is_at_safepoint(), "biases should not be seen by VM thread here"); BiasedLocking::revoke_and_rebias(hobj, false, JavaThread::current()); obj = hobj(); @@ -583,9 +583,9 @@ intptr_t ObjectSynchronizer::FastHashCode (Thread * Self, oop obj) { // hashCode() is a heap mutator ... // Relaxing assertion for bug 6320749. assert(Universe::verify_in_progress() || - !SafepointSynchronize::is_at_safepoint(), "invariant"); + !SafepointSynchronize::is_at_safepoint(), "invariant"); assert(Universe::verify_in_progress() || - Self->is_Java_thread() , "invariant"); + Self->is_Java_thread() , "invariant"); assert(Universe::verify_in_progress() || ((JavaThread *)Self)->thread_state() != _thread_blocked, "invariant"); @@ -887,143 +887,143 @@ static void InduceScavenge (Thread * Self, const char * Whence) { } void ObjectSynchronizer::verifyInUse (Thread *Self) { - ObjectMonitor* mid; - int inusetally = 0; - for (mid = Self->omInUseList; mid != NULL; mid = mid->FreeNext) { - inusetally++; - } - assert(inusetally == Self->omInUseCount, "inuse count off"); + ObjectMonitor* mid; + int inusetally = 0; + for (mid = Self->omInUseList; mid != NULL; mid = mid->FreeNext) { + inusetally++; + } + assert(inusetally == Self->omInUseCount, "inuse count off"); - int freetally = 0; - for (mid = Self->omFreeList; mid != NULL; mid = mid->FreeNext) { - freetally++; - } - assert(freetally == Self->omFreeCount, "free count off"); + int freetally = 0; + for (mid = Self->omFreeList; mid != NULL; mid = mid->FreeNext) { + freetally++; + } + assert(freetally == Self->omFreeCount, "free count off"); } ObjectMonitor * NOINLINE ObjectSynchronizer::omAlloc (Thread * Self) { - // A large MAXPRIVATE value reduces both list lock contention - // and list coherency traffic, but also tends to increase the - // number of objectMonitors in circulation as well as the STW - // scavenge costs. As usual, we lean toward time in space-time - // tradeoffs. - const int MAXPRIVATE = 1024; - for (;;) { - ObjectMonitor * m; + // A large MAXPRIVATE value reduces both list lock contention + // and list coherency traffic, but also tends to increase the + // number of objectMonitors in circulation as well as the STW + // scavenge costs. As usual, we lean toward time in space-time + // tradeoffs. + const int MAXPRIVATE = 1024; + for (;;) { + ObjectMonitor * m; - // 1: try to allocate from the thread's local omFreeList. - // Threads will attempt to allocate first from their local list, then - // from the global list, and only after those attempts fail will the thread - // attempt to instantiate new monitors. Thread-local free lists take - // heat off the ListLock and improve allocation latency, as well as reducing - // coherency traffic on the shared global list. - m = Self->omFreeList; - if (m != NULL) { - Self->omFreeList = m->FreeNext; - Self->omFreeCount--; - // CONSIDER: set m->FreeNext = BAD -- diagnostic hygiene - guarantee(m->object() == NULL, "invariant"); - if (MonitorInUseLists) { - m->FreeNext = Self->omInUseList; - Self->omInUseList = m; - Self->omInUseCount++; - if (ObjectMonitor::Knob_VerifyInUse) { - verifyInUse(Self); - } - } else { - m->FreeNext = NULL; - } - return m; + // 1: try to allocate from the thread's local omFreeList. + // Threads will attempt to allocate first from their local list, then + // from the global list, and only after those attempts fail will the thread + // attempt to instantiate new monitors. Thread-local free lists take + // heat off the ListLock and improve allocation latency, as well as reducing + // coherency traffic on the shared global list. + m = Self->omFreeList; + if (m != NULL) { + Self->omFreeList = m->FreeNext; + Self->omFreeCount--; + // CONSIDER: set m->FreeNext = BAD -- diagnostic hygiene + guarantee(m->object() == NULL, "invariant"); + if (MonitorInUseLists) { + m->FreeNext = Self->omInUseList; + Self->omInUseList = m; + Self->omInUseCount++; + if (ObjectMonitor::Knob_VerifyInUse) { + verifyInUse(Self); } - - // 2: try to allocate from the global gFreeList - // CONSIDER: use muxTry() instead of muxAcquire(). - // If the muxTry() fails then drop immediately into case 3. - // If we're using thread-local free lists then try - // to reprovision the caller's free list. - if (gFreeList != NULL) { - // Reprovision the thread's omFreeList. - // Use bulk transfers to reduce the allocation rate and heat - // on various locks. - Thread::muxAcquire(&ListLock, "omAlloc"); - for (int i = Self->omFreeProvision; --i >= 0 && gFreeList != NULL;) { - MonitorFreeCount--; - ObjectMonitor * take = gFreeList; - gFreeList = take->FreeNext; - guarantee(take->object() == NULL, "invariant"); - guarantee(!take->is_busy(), "invariant"); - take->Recycle(); - omRelease(Self, take, false); - } - Thread::muxRelease(&ListLock); - Self->omFreeProvision += 1 + (Self->omFreeProvision/2); - if (Self->omFreeProvision > MAXPRIVATE) Self->omFreeProvision = MAXPRIVATE; - TEVENT(omFirst - reprovision); - - const int mx = MonitorBound; - if (mx > 0 && (MonitorPopulation-MonitorFreeCount) > mx) { - // We can't safely induce a STW safepoint from omAlloc() as our thread - // state may not be appropriate for such activities and callers may hold - // naked oops, so instead we defer the action. - InduceScavenge(Self, "omAlloc"); - } - continue; - } - - // 3: allocate a block of new ObjectMonitors - // Both the local and global free lists are empty -- resort to malloc(). - // In the current implementation objectMonitors are TSM - immortal. - assert(_BLOCKSIZE > 1, "invariant"); - ObjectMonitor * temp = new ObjectMonitor[_BLOCKSIZE]; - - // NOTE: (almost) no way to recover if allocation failed. - // We might be able to induce a STW safepoint and scavenge enough - // objectMonitors to permit progress. - if (temp == NULL) { - vm_exit_out_of_memory(sizeof (ObjectMonitor[_BLOCKSIZE]), OOM_MALLOC_ERROR, - "Allocate ObjectMonitors"); - } - - // Format the block. - // initialize the linked list, each monitor points to its next - // forming the single linked free list, the very first monitor - // will points to next block, which forms the block list. - // The trick of using the 1st element in the block as gBlockList - // linkage should be reconsidered. A better implementation would - // look like: class Block { Block * next; int N; ObjectMonitor Body [N] ; } - - for (int i = 1; i < _BLOCKSIZE; i++) { - temp[i].FreeNext = &temp[i+1]; - } - - // terminate the last monitor as the end of list - temp[_BLOCKSIZE - 1].FreeNext = NULL; - - // Element [0] is reserved for global list linkage - temp[0].set_object(CHAINMARKER); - - // Consider carving out this thread's current request from the - // block in hand. This avoids some lock traffic and redundant - // list activity. - - // Acquire the ListLock to manipulate BlockList and FreeList. - // An Oyama-Taura-Yonezawa scheme might be more efficient. - Thread::muxAcquire(&ListLock, "omAlloc [2]"); - MonitorPopulation += _BLOCKSIZE-1; - MonitorFreeCount += _BLOCKSIZE-1; - - // Add the new block to the list of extant blocks (gBlockList). - // The very first objectMonitor in a block is reserved and dedicated. - // It serves as blocklist "next" linkage. - temp[0].FreeNext = gBlockList; - gBlockList = temp; - - // Add the new string of objectMonitors to the global free list - temp[_BLOCKSIZE - 1].FreeNext = gFreeList; - gFreeList = temp + 1; - Thread::muxRelease(&ListLock); - TEVENT(Allocate block of monitors); + } else { + m->FreeNext = NULL; + } + return m; } + + // 2: try to allocate from the global gFreeList + // CONSIDER: use muxTry() instead of muxAcquire(). + // If the muxTry() fails then drop immediately into case 3. + // If we're using thread-local free lists then try + // to reprovision the caller's free list. + if (gFreeList != NULL) { + // Reprovision the thread's omFreeList. + // Use bulk transfers to reduce the allocation rate and heat + // on various locks. + Thread::muxAcquire(&ListLock, "omAlloc"); + for (int i = Self->omFreeProvision; --i >= 0 && gFreeList != NULL;) { + MonitorFreeCount--; + ObjectMonitor * take = gFreeList; + gFreeList = take->FreeNext; + guarantee(take->object() == NULL, "invariant"); + guarantee(!take->is_busy(), "invariant"); + take->Recycle(); + omRelease(Self, take, false); + } + Thread::muxRelease(&ListLock); + Self->omFreeProvision += 1 + (Self->omFreeProvision/2); + if (Self->omFreeProvision > MAXPRIVATE) Self->omFreeProvision = MAXPRIVATE; + TEVENT(omFirst - reprovision); + + const int mx = MonitorBound; + if (mx > 0 && (MonitorPopulation-MonitorFreeCount) > mx) { + // We can't safely induce a STW safepoint from omAlloc() as our thread + // state may not be appropriate for such activities and callers may hold + // naked oops, so instead we defer the action. + InduceScavenge(Self, "omAlloc"); + } + continue; + } + + // 3: allocate a block of new ObjectMonitors + // Both the local and global free lists are empty -- resort to malloc(). + // In the current implementation objectMonitors are TSM - immortal. + assert(_BLOCKSIZE > 1, "invariant"); + ObjectMonitor * temp = new ObjectMonitor[_BLOCKSIZE]; + + // NOTE: (almost) no way to recover if allocation failed. + // We might be able to induce a STW safepoint and scavenge enough + // objectMonitors to permit progress. + if (temp == NULL) { + vm_exit_out_of_memory(sizeof (ObjectMonitor[_BLOCKSIZE]), OOM_MALLOC_ERROR, + "Allocate ObjectMonitors"); + } + + // Format the block. + // initialize the linked list, each monitor points to its next + // forming the single linked free list, the very first monitor + // will points to next block, which forms the block list. + // The trick of using the 1st element in the block as gBlockList + // linkage should be reconsidered. A better implementation would + // look like: class Block { Block * next; int N; ObjectMonitor Body [N] ; } + + for (int i = 1; i < _BLOCKSIZE; i++) { + temp[i].FreeNext = &temp[i+1]; + } + + // terminate the last monitor as the end of list + temp[_BLOCKSIZE - 1].FreeNext = NULL; + + // Element [0] is reserved for global list linkage + temp[0].set_object(CHAINMARKER); + + // Consider carving out this thread's current request from the + // block in hand. This avoids some lock traffic and redundant + // list activity. + + // Acquire the ListLock to manipulate BlockList and FreeList. + // An Oyama-Taura-Yonezawa scheme might be more efficient. + Thread::muxAcquire(&ListLock, "omAlloc [2]"); + MonitorPopulation += _BLOCKSIZE-1; + MonitorFreeCount += _BLOCKSIZE-1; + + // Add the new block to the list of extant blocks (gBlockList). + // The very first objectMonitor in a block is reserved and dedicated. + // It serves as blocklist "next" linkage. + temp[0].FreeNext = gBlockList; + gBlockList = temp; + + // Add the new string of objectMonitors to the global free list + temp[_BLOCKSIZE - 1].FreeNext = gFreeList; + gFreeList = temp + 1; + Thread::muxRelease(&ListLock); + TEVENT(Allocate block of monitors); + } } // Place "m" on the caller's private per-thread omFreeList. @@ -1035,27 +1035,27 @@ ObjectMonitor * NOINLINE ObjectSynchronizer::omAlloc (Thread * Self) { // void ObjectSynchronizer::omRelease (Thread * Self, ObjectMonitor * m, bool fromPerThreadAlloc) { - guarantee(m->object() == NULL, "invariant"); + guarantee(m->object() == NULL, "invariant"); - // Remove from omInUseList - if (MonitorInUseLists && fromPerThreadAlloc) { - ObjectMonitor* curmidinuse = NULL; - for (ObjectMonitor* mid = Self->omInUseList; mid != NULL;) { - if (m == mid) { - // extract from per-thread in-use-list - if (mid == Self->omInUseList) { - Self->omInUseList = mid->FreeNext; - } else if (curmidinuse != NULL) { - curmidinuse->FreeNext = mid->FreeNext; // maintain the current thread inuselist - } - Self->omInUseCount--; - if (ObjectMonitor::Knob_VerifyInUse) { - verifyInUse(Self); - } - break; - } else { - curmidinuse = mid; - mid = mid->FreeNext; + // Remove from omInUseList + if (MonitorInUseLists && fromPerThreadAlloc) { + ObjectMonitor* curmidinuse = NULL; + for (ObjectMonitor* mid = Self->omInUseList; mid != NULL;) { + if (m == mid) { + // extract from per-thread in-use-list + if (mid == Self->omInUseList) { + Self->omInUseList = mid->FreeNext; + } else if (curmidinuse != NULL) { + curmidinuse->FreeNext = mid->FreeNext; // maintain the current thread inuselist + } + Self->omInUseCount--; + if (ObjectMonitor::Knob_VerifyInUse) { + verifyInUse(Self); + } + break; + } else { + curmidinuse = mid; + mid = mid->FreeNext; } } } @@ -1087,53 +1087,53 @@ void ObjectSynchronizer::omRelease (Thread * Self, ObjectMonitor * m, bool fromP // operator. void ObjectSynchronizer::omFlush (Thread * Self) { - ObjectMonitor * List = Self->omFreeList; // Null-terminated SLL - Self->omFreeList = NULL; - ObjectMonitor * Tail = NULL; - int Tally = 0; - if (List != NULL) { - ObjectMonitor * s; - for (s = List; s != NULL; s = s->FreeNext) { - Tally++; - Tail = s; - guarantee(s->object() == NULL, "invariant"); - guarantee(!s->is_busy(), "invariant"); - s->set_owner(NULL); // redundant but good hygiene - TEVENT(omFlush - Move one); - } - guarantee(Tail != NULL && List != NULL, "invariant"); + ObjectMonitor * List = Self->omFreeList; // Null-terminated SLL + Self->omFreeList = NULL; + ObjectMonitor * Tail = NULL; + int Tally = 0; + if (List != NULL) { + ObjectMonitor * s; + for (s = List; s != NULL; s = s->FreeNext) { + Tally++; + Tail = s; + guarantee(s->object() == NULL, "invariant"); + guarantee(!s->is_busy(), "invariant"); + s->set_owner(NULL); // redundant but good hygiene + TEVENT(omFlush - Move one); } + guarantee(Tail != NULL && List != NULL, "invariant"); + } - ObjectMonitor * InUseList = Self->omInUseList; - ObjectMonitor * InUseTail = NULL; - int InUseTally = 0; - if (InUseList != NULL) { - Self->omInUseList = NULL; - ObjectMonitor *curom; - for (curom = InUseList; curom != NULL; curom = curom->FreeNext) { - InUseTail = curom; - InUseTally++; - } - assert(Self->omInUseCount == InUseTally, "inuse count off"); - Self->omInUseCount = 0; - guarantee(InUseTail != NULL && InUseList != NULL, "invariant"); + ObjectMonitor * InUseList = Self->omInUseList; + ObjectMonitor * InUseTail = NULL; + int InUseTally = 0; + if (InUseList != NULL) { + Self->omInUseList = NULL; + ObjectMonitor *curom; + for (curom = InUseList; curom != NULL; curom = curom->FreeNext) { + InUseTail = curom; + InUseTally++; } + assert(Self->omInUseCount == InUseTally, "inuse count off"); + Self->omInUseCount = 0; + guarantee(InUseTail != NULL && InUseList != NULL, "invariant"); + } - Thread::muxAcquire(&ListLock, "omFlush"); - if (Tail != NULL) { - Tail->FreeNext = gFreeList; - gFreeList = List; - MonitorFreeCount += Tally; - } + Thread::muxAcquire(&ListLock, "omFlush"); + if (Tail != NULL) { + Tail->FreeNext = gFreeList; + gFreeList = List; + MonitorFreeCount += Tally; + } - if (InUseTail != NULL) { - InUseTail->FreeNext = gOmInUseList; - gOmInUseList = InUseList; - gOmInUseCount += InUseTally; - } + if (InUseTail != NULL) { + InUseTail->FreeNext = gOmInUseList; + gOmInUseList = InUseList; + gOmInUseCount += InUseTally; + } - Thread::muxRelease(&ListLock); - TEVENT(omFlush); + Thread::muxRelease(&ListLock); + TEVENT(omFlush); } // Fast path code shared by multiple functions @@ -1156,189 +1156,189 @@ ObjectMonitor * NOINLINE ObjectSynchronizer::inflate (Thread * Self, oop object) // Inflate mutates the heap ... // Relaxing assertion for bug 6320749. assert(Universe::verify_in_progress() || - !SafepointSynchronize::is_at_safepoint(), "invariant"); + !SafepointSynchronize::is_at_safepoint(), "invariant"); for (;;) { - const markOop mark = object->mark(); - assert(!mark->has_bias_pattern(), "invariant"); + const markOop mark = object->mark(); + assert(!mark->has_bias_pattern(), "invariant"); - // The mark can be in one of the following states: - // * Inflated - just return - // * Stack-locked - coerce it to inflated - // * INFLATING - busy wait for conversion to complete - // * Neutral - aggressively inflate the object. - // * BIASED - Illegal. We should never see this + // The mark can be in one of the following states: + // * Inflated - just return + // * Stack-locked - coerce it to inflated + // * INFLATING - busy wait for conversion to complete + // * Neutral - aggressively inflate the object. + // * BIASED - Illegal. We should never see this - // CASE: inflated - if (mark->has_monitor()) { - ObjectMonitor * inf = mark->monitor(); - assert(inf->header()->is_neutral(), "invariant"); - assert(inf->object() == object, "invariant"); - assert(ObjectSynchronizer::verify_objmon_isinpool(inf), "monitor is invalid"); - return inf; - } + // CASE: inflated + if (mark->has_monitor()) { + ObjectMonitor * inf = mark->monitor(); + assert(inf->header()->is_neutral(), "invariant"); + assert(inf->object() == object, "invariant"); + assert(ObjectSynchronizer::verify_objmon_isinpool(inf), "monitor is invalid"); + return inf; + } - // CASE: inflation in progress - inflating over a stack-lock. - // Some other thread is converting from stack-locked to inflated. - // Only that thread can complete inflation -- other threads must wait. - // The INFLATING value is transient. - // Currently, we spin/yield/park and poll the markword, waiting for inflation to finish. - // We could always eliminate polling by parking the thread on some auxiliary list. - if (mark == markOopDesc::INFLATING()) { - TEVENT(Inflate: spin while INFLATING); - ReadStableMark(object); - continue; - } + // CASE: inflation in progress - inflating over a stack-lock. + // Some other thread is converting from stack-locked to inflated. + // Only that thread can complete inflation -- other threads must wait. + // The INFLATING value is transient. + // Currently, we spin/yield/park and poll the markword, waiting for inflation to finish. + // We could always eliminate polling by parking the thread on some auxiliary list. + if (mark == markOopDesc::INFLATING()) { + TEVENT(Inflate: spin while INFLATING); + ReadStableMark(object); + continue; + } - // CASE: stack-locked - // Could be stack-locked either by this thread or by some other thread. - // - // Note that we allocate the objectmonitor speculatively, _before_ attempting - // to install INFLATING into the mark word. We originally installed INFLATING, - // allocated the objectmonitor, and then finally STed the address of the - // objectmonitor into the mark. This was correct, but artificially lengthened - // the interval in which INFLATED appeared in the mark, thus increasing - // the odds of inflation contention. - // - // We now use per-thread private objectmonitor free lists. - // These list are reprovisioned from the global free list outside the - // critical INFLATING...ST interval. A thread can transfer - // multiple objectmonitors en-mass from the global free list to its local free list. - // This reduces coherency traffic and lock contention on the global free list. - // Using such local free lists, it doesn't matter if the omAlloc() call appears - // before or after the CAS(INFLATING) operation. - // See the comments in omAlloc(). + // CASE: stack-locked + // Could be stack-locked either by this thread or by some other thread. + // + // Note that we allocate the objectmonitor speculatively, _before_ attempting + // to install INFLATING into the mark word. We originally installed INFLATING, + // allocated the objectmonitor, and then finally STed the address of the + // objectmonitor into the mark. This was correct, but artificially lengthened + // the interval in which INFLATED appeared in the mark, thus increasing + // the odds of inflation contention. + // + // We now use per-thread private objectmonitor free lists. + // These list are reprovisioned from the global free list outside the + // critical INFLATING...ST interval. A thread can transfer + // multiple objectmonitors en-mass from the global free list to its local free list. + // This reduces coherency traffic and lock contention on the global free list. + // Using such local free lists, it doesn't matter if the omAlloc() call appears + // before or after the CAS(INFLATING) operation. + // See the comments in omAlloc(). - if (mark->has_locker()) { - ObjectMonitor * m = omAlloc(Self); - // Optimistically prepare the objectmonitor - anticipate successful CAS - // We do this before the CAS in order to minimize the length of time - // in which INFLATING appears in the mark. - m->Recycle(); - m->_Responsible = NULL; - m->OwnerIsThread = 0; - m->_recursions = 0; - m->_SpinDuration = ObjectMonitor::Knob_SpinLimit; // Consider: maintain by type/class - - markOop cmp = (markOop) Atomic::cmpxchg_ptr(markOopDesc::INFLATING(), object->mark_addr(), mark); - if (cmp != mark) { - omRelease(Self, m, true); - continue; // Interference -- just retry - } - - // We've successfully installed INFLATING (0) into the mark-word. - // This is the only case where 0 will appear in a mark-work. - // Only the singular thread that successfully swings the mark-word - // to 0 can perform (or more precisely, complete) inflation. - // - // Why do we CAS a 0 into the mark-word instead of just CASing the - // mark-word from the stack-locked value directly to the new inflated state? - // Consider what happens when a thread unlocks a stack-locked object. - // It attempts to use CAS to swing the displaced header value from the - // on-stack basiclock back into the object header. Recall also that the - // header value (hashcode, etc) can reside in (a) the object header, or - // (b) a displaced header associated with the stack-lock, or (c) a displaced - // header in an objectMonitor. The inflate() routine must copy the header - // value from the basiclock on the owner's stack to the objectMonitor, all - // the while preserving the hashCode stability invariants. If the owner - // decides to release the lock while the value is 0, the unlock will fail - // and control will eventually pass from slow_exit() to inflate. The owner - // will then spin, waiting for the 0 value to disappear. Put another way, - // the 0 causes the owner to stall if the owner happens to try to - // drop the lock (restoring the header from the basiclock to the object) - // while inflation is in-progress. This protocol avoids races that might - // would otherwise permit hashCode values to change or "flicker" for an object. - // Critically, while object->mark is 0 mark->displaced_mark_helper() is stable. - // 0 serves as a "BUSY" inflate-in-progress indicator. - - - // fetch the displaced mark from the owner's stack. - // The owner can't die or unwind past the lock while our INFLATING - // object is in the mark. Furthermore the owner can't complete - // an unlock on the object, either. - markOop dmw = mark->displaced_mark_helper(); - assert(dmw->is_neutral(), "invariant"); - - // Setup monitor fields to proper values -- prepare the monitor - m->set_header(dmw); - - // Optimization: if the mark->locker stack address is associated - // with this thread we could simply set m->_owner = Self and - // m->OwnerIsThread = 1. Note that a thread can inflate an object - // that it has stack-locked -- as might happen in wait() -- directly - // with CAS. That is, we can avoid the xchg-NULL .... ST idiom. - m->set_owner(mark->locker()); - m->set_object(object); - // TODO-FIXME: assert BasicLock->dhw != 0. - - // Must preserve store ordering. The monitor state must - // be stable at the time of publishing the monitor address. - guarantee(object->mark() == markOopDesc::INFLATING(), "invariant"); - object->release_set_mark(markOopDesc::encode(m)); - - // Hopefully the performance counters are allocated on distinct cache lines - // to avoid false sharing on MP systems ... - if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc(); - TEVENT(Inflate: overwrite stacklock); - if (TraceMonitorInflation) { - if (object->is_instance()) { - ResourceMark rm; - tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", - (void *) object, (intptr_t) object->mark(), - object->klass()->external_name()); - } - } - return m; - } - - // CASE: neutral - // TODO-FIXME: for entry we currently inflate and then try to CAS _owner. - // If we know we're inflating for entry it's better to inflate by swinging a - // pre-locked objectMonitor pointer into the object header. A successful - // CAS inflates the object *and* confers ownership to the inflating thread. - // In the current implementation we use a 2-step mechanism where we CAS() - // to inflate and then CAS() again to try to swing _owner from NULL to Self. - // An inflateTry() method that we could call from fast_enter() and slow_enter() - // would be useful. - - assert(mark->is_neutral(), "invariant"); + if (mark->has_locker()) { ObjectMonitor * m = omAlloc(Self); - // prepare m for installation - set monitor to initial state + // Optimistically prepare the objectmonitor - anticipate successful CAS + // We do this before the CAS in order to minimize the length of time + // in which INFLATING appears in the mark. m->Recycle(); - m->set_header(mark); - m->set_owner(NULL); - m->set_object(object); - m->OwnerIsThread = 1; - m->_recursions = 0; m->_Responsible = NULL; - m->_SpinDuration = ObjectMonitor::Knob_SpinLimit; // consider: keep metastats by type/class + m->OwnerIsThread = 0; + m->_recursions = 0; + m->_SpinDuration = ObjectMonitor::Knob_SpinLimit; // Consider: maintain by type/class - if (Atomic::cmpxchg_ptr (markOopDesc::encode(m), object->mark_addr(), mark) != mark) { - m->set_object(NULL); - m->set_owner(NULL); - m->OwnerIsThread = 0; - m->Recycle(); - omRelease(Self, m, true); - m = NULL; - continue; - // interference - the markword changed - just retry. - // The state-transitions are one-way, so there's no chance of - // live-lock -- "Inflated" is an absorbing state. + markOop cmp = (markOop) Atomic::cmpxchg_ptr(markOopDesc::INFLATING(), object->mark_addr(), mark); + if (cmp != mark) { + omRelease(Self, m, true); + continue; // Interference -- just retry } - // Hopefully the performance counters are allocated on distinct - // cache lines to avoid false sharing on MP systems ... + // We've successfully installed INFLATING (0) into the mark-word. + // This is the only case where 0 will appear in a mark-work. + // Only the singular thread that successfully swings the mark-word + // to 0 can perform (or more precisely, complete) inflation. + // + // Why do we CAS a 0 into the mark-word instead of just CASing the + // mark-word from the stack-locked value directly to the new inflated state? + // Consider what happens when a thread unlocks a stack-locked object. + // It attempts to use CAS to swing the displaced header value from the + // on-stack basiclock back into the object header. Recall also that the + // header value (hashcode, etc) can reside in (a) the object header, or + // (b) a displaced header associated with the stack-lock, or (c) a displaced + // header in an objectMonitor. The inflate() routine must copy the header + // value from the basiclock on the owner's stack to the objectMonitor, all + // the while preserving the hashCode stability invariants. If the owner + // decides to release the lock while the value is 0, the unlock will fail + // and control will eventually pass from slow_exit() to inflate. The owner + // will then spin, waiting for the 0 value to disappear. Put another way, + // the 0 causes the owner to stall if the owner happens to try to + // drop the lock (restoring the header from the basiclock to the object) + // while inflation is in-progress. This protocol avoids races that might + // would otherwise permit hashCode values to change or "flicker" for an object. + // Critically, while object->mark is 0 mark->displaced_mark_helper() is stable. + // 0 serves as a "BUSY" inflate-in-progress indicator. + + + // fetch the displaced mark from the owner's stack. + // The owner can't die or unwind past the lock while our INFLATING + // object is in the mark. Furthermore the owner can't complete + // an unlock on the object, either. + markOop dmw = mark->displaced_mark_helper(); + assert(dmw->is_neutral(), "invariant"); + + // Setup monitor fields to proper values -- prepare the monitor + m->set_header(dmw); + + // Optimization: if the mark->locker stack address is associated + // with this thread we could simply set m->_owner = Self and + // m->OwnerIsThread = 1. Note that a thread can inflate an object + // that it has stack-locked -- as might happen in wait() -- directly + // with CAS. That is, we can avoid the xchg-NULL .... ST idiom. + m->set_owner(mark->locker()); + m->set_object(object); + // TODO-FIXME: assert BasicLock->dhw != 0. + + // Must preserve store ordering. The monitor state must + // be stable at the time of publishing the monitor address. + guarantee(object->mark() == markOopDesc::INFLATING(), "invariant"); + object->release_set_mark(markOopDesc::encode(m)); + + // Hopefully the performance counters are allocated on distinct cache lines + // to avoid false sharing on MP systems ... if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc(); - TEVENT(Inflate: overwrite neutral); + TEVENT(Inflate: overwrite stacklock); if (TraceMonitorInflation) { if (object->is_instance()) { ResourceMark rm; tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", - (void *) object, (intptr_t) object->mark(), - object->klass()->external_name()); + (void *) object, (intptr_t) object->mark(), + object->klass()->external_name()); } } return m; + } + + // CASE: neutral + // TODO-FIXME: for entry we currently inflate and then try to CAS _owner. + // If we know we're inflating for entry it's better to inflate by swinging a + // pre-locked objectMonitor pointer into the object header. A successful + // CAS inflates the object *and* confers ownership to the inflating thread. + // In the current implementation we use a 2-step mechanism where we CAS() + // to inflate and then CAS() again to try to swing _owner from NULL to Self. + // An inflateTry() method that we could call from fast_enter() and slow_enter() + // would be useful. + + assert(mark->is_neutral(), "invariant"); + ObjectMonitor * m = omAlloc(Self); + // prepare m for installation - set monitor to initial state + m->Recycle(); + m->set_header(mark); + m->set_owner(NULL); + m->set_object(object); + m->OwnerIsThread = 1; + m->_recursions = 0; + m->_Responsible = NULL; + m->_SpinDuration = ObjectMonitor::Knob_SpinLimit; // consider: keep metastats by type/class + + if (Atomic::cmpxchg_ptr (markOopDesc::encode(m), object->mark_addr(), mark) != mark) { + m->set_object(NULL); + m->set_owner(NULL); + m->OwnerIsThread = 0; + m->Recycle(); + omRelease(Self, m, true); + m = NULL; + continue; + // interference - the markword changed - just retry. + // The state-transitions are one-way, so there's no chance of + // live-lock -- "Inflated" is an absorbing state. + } + + // Hopefully the performance counters are allocated on distinct + // cache lines to avoid false sharing on MP systems ... + if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc(); + TEVENT(Inflate: overwrite neutral); + if (TraceMonitorInflation) { + if (object->is_instance()) { + ResourceMark rm; + tty->print_cr("Inflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", + (void *) object, (intptr_t) object->mark(), + object->klass()->external_name()); + } + } + return m; } } @@ -1376,8 +1376,8 @@ ObjectMonitor * NOINLINE ObjectSynchronizer::inflate (Thread * Self, oop object) // enum ManifestConstants { - ClearResponsibleAtSTW = 0, - MaximumRecheckInterval = 1000 + ClearResponsibleAtSTW = 0, + MaximumRecheckInterval = 1000 }; // Deflate a single monitor if not in use @@ -1391,36 +1391,36 @@ bool ObjectSynchronizer::deflate_monitor(ObjectMonitor* mid, oop obj, guarantee(mid->header()->is_neutral(), "invariant"); if (mid->is_busy()) { - if (ClearResponsibleAtSTW) mid->_Responsible = NULL; - deflated = false; + if (ClearResponsibleAtSTW) mid->_Responsible = NULL; + deflated = false; } else { - // Deflate the monitor if it is no longer being used - // It's idle - scavenge and return to the global free list - // plain old deflation ... - TEVENT(deflate_idle_monitors - scavenge1); - if (TraceMonitorInflation) { - if (obj->is_instance()) { - ResourceMark rm; - tty->print_cr("Deflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", - (void *) obj, (intptr_t) obj->mark(), obj->klass()->external_name()); - } - } - - // Restore the header back to obj - obj->release_set_mark(mid->header()); - mid->clear(); - - assert(mid->object() == NULL, "invariant"); - - // Move the object to the working free list defined by FreeHead,FreeTail. - if (*freeHeadp == NULL) *freeHeadp = mid; - if (*freeTailp != NULL) { - ObjectMonitor * prevtail = *freeTailp; - assert(prevtail->FreeNext == NULL, "cleaned up deflated?"); // TODO KK - prevtail->FreeNext = mid; + // Deflate the monitor if it is no longer being used + // It's idle - scavenge and return to the global free list + // plain old deflation ... + TEVENT(deflate_idle_monitors - scavenge1); + if (TraceMonitorInflation) { + if (obj->is_instance()) { + ResourceMark rm; + tty->print_cr("Deflating object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s", + (void *) obj, (intptr_t) obj->mark(), obj->klass()->external_name()); } - *freeTailp = mid; - deflated = true; + } + + // Restore the header back to obj + obj->release_set_mark(mid->header()); + mid->clear(); + + assert(mid->object() == NULL, "invariant"); + + // Move the object to the working free list defined by FreeHead,FreeTail. + if (*freeHeadp == NULL) *freeHeadp = mid; + if (*freeTailp != NULL) { + ObjectMonitor * prevtail = *freeTailp; + assert(prevtail->FreeNext == NULL, "cleaned up deflated?"); // TODO KK + prevtail->FreeNext = mid; + } + *freeTailp = mid; + deflated = true; } return deflated; } @@ -1434,25 +1434,25 @@ int ObjectSynchronizer::walk_monitor_list(ObjectMonitor** listheadp, int deflatedcount = 0; for (mid = *listheadp; mid != NULL;) { - oop obj = (oop) mid->object(); - bool deflated = false; - if (obj != NULL) { - deflated = deflate_monitor(mid, obj, freeHeadp, freeTailp); - } - if (deflated) { - // extract from per-thread in-use-list - if (mid == *listheadp) { - *listheadp = mid->FreeNext; - } else if (curmidinuse != NULL) { - curmidinuse->FreeNext = mid->FreeNext; // maintain the current thread inuselist - } - next = mid->FreeNext; - mid->FreeNext = NULL; // This mid is current tail in the FreeHead list - mid = next; - deflatedcount++; - } else { - curmidinuse = mid; - mid = mid->FreeNext; + oop obj = (oop) mid->object(); + bool deflated = false; + if (obj != NULL) { + deflated = deflate_monitor(mid, obj, freeHeadp, freeTailp); + } + if (deflated) { + // extract from per-thread in-use-list + if (mid == *listheadp) { + *listheadp = mid->FreeNext; + } else if (curmidinuse != NULL) { + curmidinuse->FreeNext = mid->FreeNext; // maintain the current thread inuselist + } + next = mid->FreeNext; + mid->FreeNext = NULL; // This mid is current tail in the FreeHead list + mid = next; + deflatedcount++; + } else { + curmidinuse = mid; + mid = mid->FreeNext; } } return deflatedcount; @@ -1485,19 +1485,19 @@ void ObjectSynchronizer::deflate_idle_monitors() { } nScavenged += deflatedcount; nInuse += cur->omInUseCount; - } + } - // For moribund threads, scan gOmInUseList - if (gOmInUseList) { - nInCirculation += gOmInUseCount; - int deflatedcount = walk_monitor_list((ObjectMonitor **)&gOmInUseList, &FreeHead, &FreeTail); - gOmInUseCount-= deflatedcount; - nScavenged += deflatedcount; - nInuse += gOmInUseCount; + // For moribund threads, scan gOmInUseList + if (gOmInUseList) { + nInCirculation += gOmInUseCount; + int deflatedcount = walk_monitor_list((ObjectMonitor **)&gOmInUseList, &FreeHead, &FreeTail); + gOmInUseCount-= deflatedcount; + nScavenged += deflatedcount; + nInuse += gOmInUseCount; } } else for (ObjectMonitor* block = gBlockList; block != NULL; block = next(block)) { - // Iterate over all extant monitors - Scavenge all idle monitors. + // Iterate over all extant monitors - Scavenge all idle monitors. assert(block->object() == CHAINMARKER, "must be a block header"); nInCirculation += _BLOCKSIZE; for (int i = 1; i < _BLOCKSIZE; i++) { @@ -1529,8 +1529,8 @@ void ObjectSynchronizer::deflate_idle_monitors() { if (ObjectMonitor::Knob_Verbose) { ::printf("Deflate: InCirc=%d InUse=%d Scavenged=%d ForceMonitorScavenge=%d : pop=%d free=%d\n", - nInCirculation, nInuse, nScavenged, ForceMonitorScavenge, - MonitorPopulation, MonitorFreeCount); + nInCirculation, nInuse, nScavenged, ForceMonitorScavenge, + MonitorPopulation, MonitorFreeCount); ::fflush(stdout); } @@ -1538,11 +1538,11 @@ void ObjectSynchronizer::deflate_idle_monitors() { // Move the scavenged monitors back to the global free list. if (FreeHead != NULL) { - guarantee(FreeTail != NULL && nScavenged > 0, "invariant"); - assert(FreeTail->FreeNext == NULL, "invariant"); - // constant-time list splice - prepend scavenged segment to gFreeList - FreeTail->FreeNext = gFreeList; - gFreeList = FreeHead; + guarantee(FreeTail != NULL && nScavenged > 0, "invariant"); + assert(FreeTail->FreeNext == NULL, "invariant"); + // constant-time list splice - prepend scavenged segment to gFreeList + FreeTail->FreeNext = gFreeList; + gFreeList = FreeHead; } Thread::muxRelease(&ListLock); @@ -1561,10 +1561,10 @@ void ObjectSynchronizer::deflate_idle_monitors() { // Gives up on a particular monitor if an exception occurs, but continues // the overall iteration, swallowing the exception. class ReleaseJavaMonitorsClosure: public MonitorClosure { -private: + private: TRAPS; -public: + public: ReleaseJavaMonitorsClosure(Thread* thread) : THREAD(thread) {} void do_monitor(ObjectMonitor* mid) { if (mid->owner() == THREAD) { diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 9956ed28846..0bea771f4b7 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -148,7 +148,7 @@ void* Thread::allocate(size_t size, bool throw_excpt, MEMFLAGS flags) { size_t aligned_size = size + (alignment - sizeof(intptr_t)); void* real_malloc_addr = throw_excpt? AllocateHeap(aligned_size, flags, CURRENT_PC) : AllocateHeap(aligned_size, flags, CURRENT_PC, - AllocFailStrategy::RETURN_NULL); + AllocFailStrategy::RETURN_NULL); void* aligned_addr = (void*) align_size_up((intptr_t) real_malloc_addr, alignment); assert(((uintptr_t) aligned_addr + (uintptr_t) size) <= ((uintptr_t) real_malloc_addr + (uintptr_t) aligned_size), @@ -365,7 +365,7 @@ void Thread::run() { #ifdef ASSERT // Private method to check for dangling thread pointer void check_for_dangling_thread_pointer(Thread *thread) { - assert(!thread->is_Java_thread() || Thread::current() == thread || Threads_lock->owned_by_self(), + assert(!thread->is_Java_thread() || Thread::current() == thread || Threads_lock->owned_by_self(), "possibility of dangling Thread pointer"); } #endif @@ -517,8 +517,8 @@ class TraceSuspendDebugBits : public StackObj { ResourceMark rm; tty->print_cr( - "Failed wait_for_ext_suspend_completion(thread=%s, debug_bits=%x)", - jt->get_thread_name(), *bits); + "Failed wait_for_ext_suspend_completion(thread=%s, debug_bits=%x)", + jt->get_thread_name(), *bits); guarantee(!AssertOnSuspendWaitFailure, "external suspend wait failed"); } @@ -654,7 +654,7 @@ bool JavaThread::is_ext_suspend_completed(bool called_by_wait, int delay, uint32 // Returns true if the thread is externally suspended and false otherwise. // bool JavaThread::wait_for_ext_suspend_completion(int retries, int delay, - uint32_t *bits) { + uint32_t *bits) { TraceSuspendDebugBits tsdb(this, true /* is_wait */, false /* !called_by_wait */, bits); @@ -759,8 +759,8 @@ bool JavaThread::profile_last_Java_frame(frame* _fr) { bool gotframe = false; // self suspension saves needed state. if (has_last_Java_frame() && _anchor.walkable()) { - *_fr = pd_last_frame(); - gotframe = true; + *_fr = pd_last_frame(); + gotframe = true; } return gotframe; } @@ -790,7 +790,7 @@ bool Thread::claim_oops_do_par_case(int strong_roots_parity) { } else { guarantee(res == strong_roots_parity, "Or else what?"); assert(SharedHeap::heap()->workers()->active_workers() > 0, - "Should only fail when parallel."); + "Should only fail when parallel."); return false; } } @@ -882,38 +882,38 @@ bool Thread::owns_locks_but_compiled_lock() const { // invoke the vm-thread (i.e., and oop allocation). In that case, we also have to make sure that // no threads which allow_vm_block's are held void Thread::check_for_valid_safepoint_state(bool potential_vm_operation) { - // Check if current thread is allowed to block at a safepoint - if (!(_allow_safepoint_count == 0)) - fatal("Possible safepoint reached by thread that does not allow it"); - if (is_Java_thread() && ((JavaThread*)this)->thread_state() != _thread_in_vm) { - fatal("LEAF method calling lock?"); - } + // Check if current thread is allowed to block at a safepoint + if (!(_allow_safepoint_count == 0)) + fatal("Possible safepoint reached by thread that does not allow it"); + if (is_Java_thread() && ((JavaThread*)this)->thread_state() != _thread_in_vm) { + fatal("LEAF method calling lock?"); + } #ifdef ASSERT - if (potential_vm_operation && is_Java_thread() - && !Universe::is_bootstrapping()) { - // Make sure we do not hold any locks that the VM thread also uses. - // This could potentially lead to deadlocks - for (Monitor *cur = _owned_locks; cur; cur = cur->next()) { - // Threads_lock is special, since the safepoint synchronization will not start before this is - // acquired. Hence, a JavaThread cannot be holding it at a safepoint. So is VMOperationRequest_lock, - // since it is used to transfer control between JavaThreads and the VMThread - // Do not *exclude* any locks unless you are absolutely sure it is correct. Ask someone else first! - if ((cur->allow_vm_block() && - cur != Threads_lock && - cur != Compile_lock && // Temporary: should not be necessary when we get separate compilation - cur != VMOperationRequest_lock && - cur != VMOperationQueue_lock) || - cur->rank() == Mutex::special) { - fatal(err_msg("Thread holding lock at safepoint that vm can block on: %s", cur->name())); - } + if (potential_vm_operation && is_Java_thread() + && !Universe::is_bootstrapping()) { + // Make sure we do not hold any locks that the VM thread also uses. + // This could potentially lead to deadlocks + for (Monitor *cur = _owned_locks; cur; cur = cur->next()) { + // Threads_lock is special, since the safepoint synchronization will not start before this is + // acquired. Hence, a JavaThread cannot be holding it at a safepoint. So is VMOperationRequest_lock, + // since it is used to transfer control between JavaThreads and the VMThread + // Do not *exclude* any locks unless you are absolutely sure it is correct. Ask someone else first! + if ((cur->allow_vm_block() && + cur != Threads_lock && + cur != Compile_lock && // Temporary: should not be necessary when we get separate compilation + cur != VMOperationRequest_lock && + cur != VMOperationQueue_lock) || + cur->rank() == Mutex::special) { + fatal(err_msg("Thread holding lock at safepoint that vm can block on: %s", cur->name())); } } + } - if (GCALotAtAllSafepoints) { - // We could enter a safepoint here and thus have a gc - InterfaceSupport::check_gc_alot(); - } + if (GCALotAtAllSafepoints) { + // We could enter a safepoint here and thus have a gc + InterfaceSupport::check_gc_alot(); + } #endif } #endif @@ -947,7 +947,7 @@ bool Thread::is_lock_owned(address adr) const { } bool Thread::set_as_starting_thread() { - // NOTE: this must be called inside the main thread. + // NOTE: this must be called inside the main thread. return os::create_main_thread((JavaThread*)this); } @@ -1004,12 +1004,12 @@ static oop create_initial_thread(Handle thread_group, JavaThread* thread, TRAPS) JavaValue result(T_VOID); JavaCalls::call_special(&result, thread_oop, - klass, - vmSymbols::object_initializer_name(), - vmSymbols::threadgroup_string_void_signature(), - thread_group, - string, - CHECK_NULL); + klass, + vmSymbols::object_initializer_name(), + vmSymbols::threadgroup_string_void_signature(), + thread_group, + string, + CHECK_NULL); return thread_oop(); } @@ -1019,7 +1019,7 @@ static void call_initializeSystemClass(TRAPS) { JavaValue result(T_VOID); JavaCalls::call_static(&result, klass, vmSymbols::initializeSystemClass_name(), - vmSymbols::void_method_signature(), CHECK); + vmSymbols::void_method_signature(), CHECK); } char java_runtime_name[128] = ""; @@ -1028,7 +1028,7 @@ char java_runtime_version[128] = ""; // extract the JRE name from sun.misc.Version.java_runtime_name static const char* get_java_runtime_name(TRAPS) { Klass* k = SystemDictionary::find(vmSymbols::sun_misc_Version(), - Handle(), Handle(), CHECK_AND_CLEAR_NULL); + Handle(), Handle(), CHECK_AND_CLEAR_NULL); fieldDescriptor fd; bool found = k != NULL && InstanceKlass::cast(k)->find_local_field(vmSymbols::java_runtime_name_name(), @@ -1049,7 +1049,7 @@ static const char* get_java_runtime_name(TRAPS) { // extract the JRE version from sun.misc.Version.java_runtime_version static const char* get_java_runtime_version(TRAPS) { Klass* k = SystemDictionary::find(vmSymbols::sun_misc_Version(), - Handle(), Handle(), CHECK_AND_CLEAR_NULL); + Handle(), Handle(), CHECK_AND_CLEAR_NULL); fieldDescriptor fd; bool found = k != NULL && InstanceKlass::cast(k)->find_local_field(vmSymbols::java_runtime_version_name(), @@ -1075,8 +1075,8 @@ static void call_postVMInitHook(TRAPS) { if (klass.not_null()) { JavaValue result(T_VOID); JavaCalls::call_static(&result, klass, vmSymbols::run_method_name(), - vmSymbols::void_method_signature(), - CHECK); + vmSymbols::void_method_signature(), + CHECK); } } @@ -1146,7 +1146,7 @@ void JavaThread::allocate_threadObj(Handle thread_group, char* thread_name, bool if (daemon) { - java_lang_Thread::set_daemon(thread_oop()); + java_lang_Thread::set_daemon(thread_oop()); } if (HAS_PENDING_EXCEPTION) { @@ -1157,12 +1157,12 @@ void JavaThread::allocate_threadObj(Handle thread_group, char* thread_name, bool Handle threadObj(this, this->threadObj()); JavaCalls::call_special(&result, - thread_group, - group, - vmSymbols::add_method_name(), - vmSymbols::thread_void_signature(), - threadObj, // Arg 1 - THREAD); + thread_group, + group, + vmSymbols::add_method_name(), + vmSymbols::thread_void_signature(), + threadObj, // Arg 1 + THREAD); } @@ -1246,25 +1246,25 @@ int WatcherThread::sleep() const { jlong now = os::javaTimeNanos(); if (remaining == 0) { - // if we didn't have any tasks we could have waited for a long time - // consider the time_slept zero and reset time_before_loop - time_slept = 0; - time_before_loop = now; + // if we didn't have any tasks we could have waited for a long time + // consider the time_slept zero and reset time_before_loop + time_slept = 0; + time_before_loop = now; } else { - // need to recalculate since we might have new tasks in _tasks - time_slept = (int) ((now - time_before_loop) / 1000000); + // need to recalculate since we might have new tasks in _tasks + time_slept = (int) ((now - time_before_loop) / 1000000); } // Change to task list or spurious wakeup of some kind if (timedout || _should_terminate) { - break; + break; } remaining = PeriodicTask::time_to_wait(); if (remaining == 0) { - // Last task was just disenrolled so loop around and wait until - // another task gets enrolled - continue; + // Last task was just disenrolled so loop around and wait until + // another task gets enrolled + continue; } remaining -= time_slept; @@ -1302,13 +1302,13 @@ void WatcherThread::run() { for (;;) { if (!ShowMessageBoxOnError - && (OnError == NULL || OnError[0] == '\0') - && Arguments::abort_hook() == NULL) { - os::sleep(this, 2 * 60 * 1000, false); - fdStream err(defaultStream::output_fd()); - err.print_raw_cr("# [ timer expired, abort... ]"); - // skip atexit/vm_exit/vm_abort hooks - os::die(); + && (OnError == NULL || OnError[0] == '\0') + && Arguments::abort_hook() == NULL) { + os::sleep(this, 2 * 60 * 1000, false); + fdStream err(defaultStream::output_fd()); + err.print_raw_cr("# [ timer expired, abort... ]"); + // skip atexit/vm_exit/vm_abort hooks + os::die(); } // Wake up 5 seconds later, the fatal handler may reset OnError or @@ -1486,10 +1486,10 @@ DirtyCardQueueSet JavaThread::_dirty_card_queue_set; #endif // INCLUDE_ALL_GCS JavaThread::JavaThread(bool is_attaching_via_jni) : - Thread() + Thread() #if INCLUDE_ALL_GCS - , _satb_mark_queue(&_satb_mark_queue_set), - _dirty_card_queue(&_dirty_card_queue_set) + , _satb_mark_queue(&_satb_mark_queue_set), + _dirty_card_queue(&_dirty_card_queue_set) #endif // INCLUDE_ALL_GCS { initialize(); @@ -1543,10 +1543,10 @@ void JavaThread::block_if_vm_exited() { static void compiler_thread_entry(JavaThread* thread, TRAPS); JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) : - Thread() + Thread() #if INCLUDE_ALL_GCS - , _satb_mark_queue(&_satb_mark_queue_set), - _dirty_card_queue(&_dirty_card_queue_set) + , _satb_mark_queue(&_satb_mark_queue_set), + _dirty_card_queue(&_dirty_card_queue_set) #endif // INCLUDE_ALL_GCS { if (TraceThreadEvents) { @@ -1575,7 +1575,7 @@ JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) : JavaThread::~JavaThread() { if (TraceThreadEvents) { - tty->print_cr("terminate thread %p", this); + tty->print_cr("terminate thread %p", this); } // JSR166 -- return the parker to the free list @@ -1649,8 +1649,8 @@ void JavaThread::run() { EventThreadStart event; if (event.should_commit()) { - event.set_javalangthread(java_lang_Thread::thread_id(this->threadObj())); - event.commit(); + event.set_javalangthread(java_lang_Thread::thread_id(this->threadObj())); + event.commit(); } // We call another function to do the rest so we are sure that the stack addresses used @@ -1742,10 +1742,10 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) { if (HAS_PENDING_EXCEPTION) { ResourceMark rm(this); jio_fprintf(defaultStream::error_stream(), - "\nException: %s thrown from the UncaughtExceptionHandler" - " in thread \"%s\"\n", - pending_exception()->klass()->external_name(), - get_thread_name()); + "\nException: %s thrown from the UncaughtExceptionHandler" + " in thread \"%s\"\n", + pending_exception()->klass()->external_name(), + get_thread_name()); CLEAR_PENDING_EXCEPTION; } } @@ -1754,8 +1754,8 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) { // from java_lang_Thread object EventThreadEnd event; if (event.should_commit()) { - event.set_javalangthread(java_lang_Thread::thread_id(this->threadObj())); - event.commit(); + event.set_javalangthread(java_lang_Thread::thread_id(this->threadObj())); + event.commit(); } // Call after last event on thread @@ -1771,10 +1771,10 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) { JavaValue result(T_VOID); KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass()); JavaCalls::call_virtual(&result, - threadObj, thread_klass, - vmSymbols::exit_method_name(), - vmSymbols::void_method_signature(), - THREAD); + threadObj, thread_klass, + vmSymbols::exit_method_name(), + vmSymbols::void_method_signature(), + THREAD); CLEAR_PENDING_EXCEPTION; } } @@ -2062,22 +2062,22 @@ void JavaThread::check_and_handle_async_exceptions(bool check_unsafe_error) { condition = _no_async_condition; // done switch (thread_state()) { case _thread_in_vm: - { - JavaThread* THREAD = this; - THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in an unsafe memory access operation"); - } + { + JavaThread* THREAD = this; + THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in an unsafe memory access operation"); + } case _thread_in_native: - { - ThreadInVMfromNative tiv(this); - JavaThread* THREAD = this; - THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in an unsafe memory access operation"); - } + { + ThreadInVMfromNative tiv(this); + JavaThread* THREAD = this; + THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in an unsafe memory access operation"); + } case _thread_in_Java: - { - ThreadInVMfromJava tiv(this); - JavaThread* THREAD = this; - THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in a recent unsafe memory access operation in compiled Java code"); - } + { + ThreadInVMfromJava tiv(this); + JavaThread* THREAD = this; + THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in a recent unsafe memory access operation in compiled Java code"); + } default: ShouldNotReachHere(); } @@ -2170,8 +2170,8 @@ void JavaThread::send_thread_stop(oop java_throwable) { set_pending_async_exception(java_throwable); if (TraceExceptions) { - ResourceMark rm; - tty->print_cr("Pending Async. exception installed of type: %s", InstanceKlass::cast(_pending_async_exception->klass())->external_name()); + ResourceMark rm; + tty->print_cr("Pending Async. exception installed of type: %s", InstanceKlass::cast(_pending_async_exception->klass())->external_name()); } // for AbortVMOnException flag NOT_PRODUCT(Exceptions::debug_check_abort(InstanceKlass::cast(_pending_async_exception->klass())->external_name())); @@ -2198,7 +2198,7 @@ void JavaThread::send_thread_stop(oop java_throwable) { void JavaThread::java_suspend() { { MutexLocker mu(Threads_lock); if (!Threads::includes(this) || is_exiting() || this->threadObj() == NULL) { - return; + return; } } @@ -2241,18 +2241,18 @@ int JavaThread::java_suspend_self() { // we are in the process of exiting so don't suspend if (is_exiting()) { - clear_external_suspend(); - return ret; + clear_external_suspend(); + return ret; } assert(_anchor.walkable() || - (is_Java_thread() && !((JavaThread*)this)->has_last_Java_frame()), - "must have walkable stack"); + (is_Java_thread() && !((JavaThread*)this)->has_last_Java_frame()), + "must have walkable stack"); MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag); assert(!this->is_ext_suspended(), - "a thread trying to self-suspend should not already be suspended"); + "a thread trying to self-suspend should not already be suspended"); if (this->is_suspend_equivalent()) { // If we are self-suspending as a result of the lifting of a @@ -2289,12 +2289,12 @@ int JavaThread::java_suspend_self() { // hence doesn't need protection from concurrent access at this stage void JavaThread::verify_not_published() { if (!Threads_lock->owned_by_self()) { - MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag); - assert(!Threads::includes(this), + MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag); + assert(!Threads::includes(this), "java thread shouldn't have been published yet!"); } else { - assert(!Threads::includes(this), + assert(!Threads::includes(this), "java thread shouldn't have been published yet!"); } } @@ -2474,7 +2474,7 @@ void JavaThread::remove_stack_guard_pages() { if (os::unguard_memory((char *) low_addr, len)) { _stack_guard_state = stack_guard_unused; } else { - warning("Attempt to unprotect stack guard pages failed."); + warning("Attempt to unprotect stack guard pages failed."); } } } @@ -2640,7 +2640,7 @@ void JavaThread::deoptimized_wrt_marked_nmethods() { // the given JavaThread in its _processed_thread field. class RememberProcessedThread: public StackObj { NamedThread* _cur_thr; -public: + public: RememberProcessedThread(JavaThread* jthr) { Thread* thread = Thread::current(); if (thread->is_Named_thread()) { @@ -2669,7 +2669,7 @@ void JavaThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) Thread::oops_do(f, cld_f, cf); assert((!has_last_Java_frame() && java_call_counter() == 0) || - (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!"); + (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!"); if (has_last_Java_frame()) { // Record JavaThread to GC thread @@ -2729,7 +2729,7 @@ void JavaThread::nmethods_do(CodeBlobClosure* cf) { Thread::nmethods_do(cf); // (super method is a no-op) assert((!has_last_Java_frame() && java_call_counter() == 0) || - (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!"); + (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!"); if (has_last_Java_frame()) { // Traverse the execution stack @@ -2809,7 +2809,7 @@ void JavaThread::print_on_error(outputStream* st, char *buf, int buflen) const { st->print("JavaThread \"%s\"", get_thread_name_string(buf, buflen)); oop thread_obj = threadObj(); if (thread_obj != NULL) { - if (java_lang_Thread::is_daemon(thread_obj)) st->print(" daemon"); + if (java_lang_Thread::is_daemon(thread_obj)) st->print(" daemon"); } st->print(" ["); st->print("%s", _get_thread_state_name(_thread_state)); @@ -2853,7 +2853,7 @@ const char* JavaThread::get_thread_name() const { } } #endif // ASSERT - return get_thread_name_string(); + return get_thread_name_string(); } // Returns a non-NULL representation of this thread's name, or a suitable @@ -2950,7 +2950,7 @@ void JavaThread::prepare(jobject jni_thread, ThreadPriority prio) { Handle thread_oop(Thread::current(), JNIHandles::resolve_non_null(jni_thread)); assert(InstanceKlass::cast(thread_oop->klass())->is_linked(), - "must be initialized"); + "must be initialized"); set_threadObj(thread_oop()); java_lang_Thread::set_thread(thread_oop(), this); @@ -3383,7 +3383,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { if (!main_thread->set_as_starting_thread()) { vm_shutdown_during_initialization( - "Failed necessary internal allocation. Out of swap space"); + "Failed necessary internal allocation. Out of swap space"); delete main_thread; *canTryAgain = false; // don't let caller call JNI_CreateJavaVM again return JNI_ENOMEM; @@ -3583,17 +3583,17 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { } { - MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag); - // Make sure the watcher thread can be started by WatcherThread::start() - // or by dynamic enrollment. - WatcherThread::make_startable(); - // Start up the WatcherThread if there are any periodic tasks - // NOTE: All PeriodicTasks should be registered by now. If they - // aren't, late joiners might appear to start slowly (we might - // take a while to process their first tick). - if (PeriodicTask::num_tasks() > 0) { - WatcherThread::start(); - } + MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag); + // Make sure the watcher thread can be started by WatcherThread::start() + // or by dynamic enrollment. + WatcherThread::make_startable(); + // Start up the WatcherThread if there are any periodic tasks + // NOTE: All PeriodicTasks should be registered by now. If they + // aren't, late joiners might appear to start slowly (we might + // take a while to process their first tick). + if (PeriodicTask::num_tasks() > 0) { + WatcherThread::start(); + } } // Give os specific code one last chance to start @@ -3749,10 +3749,10 @@ void Threads::shutdown_vm_agents() { // Find the Agent_OnUnload function. Agent_OnUnload_t unload_entry = CAST_TO_FN_PTR(Agent_OnUnload_t, - os::find_agent_function(agent, - false, - on_unload_symbols, - num_symbol_entries)); + os::find_agent_function(agent, + false, + on_unload_symbols, + num_symbol_entries)); // Invoke the Agent_OnUnload function if (unload_entry != NULL) { @@ -4060,7 +4060,7 @@ void Threads::possibly_parallel_oops_do(OopClosure* f, CLDClosure* cld_f, CodeBl bool is_par = sh->n_par_threads() > 0; assert(!is_par || (SharedHeap::heap()->n_par_threads() == - SharedHeap::heap()->workers()->active_workers()), "Mismatch"); + SharedHeap::heap()->workers()->active_workers()), "Mismatch"); int cp = SharedHeap::heap()->strong_roots_parity(); ALL_JAVA_THREADS(p) { if (p->claim_oops_do(is_par, cp)) { @@ -4113,9 +4113,9 @@ void Threads::deoptimized_wrt_marked_nmethods() { // Get count Java threads that are waiting to enter the specified monitor. GrowableArray* Threads::get_pending_threads(int count, - address monitor, bool doLock) { + address monitor, bool doLock) { assert(doLock || SafepointSynchronize::is_at_safepoint(), - "must grab Threads_lock or be at safepoint"); + "must grab Threads_lock or be at safepoint"); GrowableArray* result = new GrowableArray(count); int i = 0; @@ -4181,10 +4181,10 @@ void Threads::print_on(outputStream* st, bool print_stacks, bool internal_format st->print_cr("%s", os::local_time_string(buf, sizeof(buf))); st->print_cr("Full thread dump %s (%s %s):", - Abstract_VM_Version::vm_name(), - Abstract_VM_Version::vm_release(), - Abstract_VM_Version::vm_info_string() - ); + Abstract_VM_Version::vm_name(), + Abstract_VM_Version::vm_release(), + Abstract_VM_Version::vm_info_string() + ); st->cr(); #if INCLUDE_ALL_GCS @@ -4303,7 +4303,7 @@ typedef volatile int SpinLockT; void Thread::SpinAcquire (volatile int * adr, const char * LockName) { if (Atomic::cmpxchg (1, adr, 0) == 0) { - return; // normal fast-path return + return; // normal fast-path return } // Slow-path : We've encountered contention -- Spin/Yield/Block strategy. @@ -4311,20 +4311,20 @@ void Thread::SpinAcquire (volatile int * adr, const char * LockName) { int ctr = 0; int Yields = 0; for (;;) { - while (*adr != 0) { - ++ctr; - if ((ctr & 0xFFF) == 0 || !os::is_MP()) { - if (Yields > 5) { - os::naked_short_sleep(1); - } else { - os::naked_yield(); - ++Yields; - } + while (*adr != 0) { + ++ctr; + if ((ctr & 0xFFF) == 0 || !os::is_MP()) { + if (Yields > 5) { + os::naked_short_sleep(1); } else { - SpinPause(); + os::naked_yield(); + ++Yields; } - } - if (Atomic::cmpxchg(1, adr, 0) == 0) return; + } else { + SpinPause(); + } + } + if (Atomic::cmpxchg(1, adr, 0) == 0) return; } } @@ -4401,45 +4401,45 @@ void Thread::muxAcquire (volatile intptr_t * Lock, const char * LockName) { intptr_t w = Atomic::cmpxchg_ptr(LOCKBIT, Lock, 0); if (w == 0) return; if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) { - return; + return; } TEVENT(muxAcquire - Contention); ParkEvent * const Self = Thread::current()->_MuxEvent; assert((intptr_t(Self) & LOCKBIT) == 0, "invariant"); for (;;) { - int its = (os::is_MP() ? 100 : 0) + 1; + int its = (os::is_MP() ? 100 : 0) + 1; - // Optional spin phase: spin-then-park strategy - while (--its >= 0) { - w = *Lock; - if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) { + // Optional spin phase: spin-then-park strategy + while (--its >= 0) { + w = *Lock; + if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) { + return; + } + } + + Self->reset(); + Self->OnList = intptr_t(Lock); + // The following fence() isn't _strictly necessary as the subsequent + // CAS() both serializes execution and ratifies the fetched *Lock value. + OrderAccess::fence(); + for (;;) { + w = *Lock; + if ((w & LOCKBIT) == 0) { + if (Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) { + Self->OnList = 0; // hygiene - allows stronger asserts return; - } - } - - Self->reset(); - Self->OnList = intptr_t(Lock); - // The following fence() isn't _strictly necessary as the subsequent - // CAS() both serializes execution and ratifies the fetched *Lock value. - OrderAccess::fence(); - for (;;) { - w = *Lock; - if ((w & LOCKBIT) == 0) { - if (Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) { - Self->OnList = 0; // hygiene - allows stronger asserts - return; - } - continue; // Interference -- *Lock changed -- Just retry } - assert(w & LOCKBIT, "invariant"); - Self->ListNext = (ParkEvent *) (w & ~LOCKBIT); - if (Atomic::cmpxchg_ptr(intptr_t(Self)|LOCKBIT, Lock, w) == w) break; - } + continue; // Interference -- *Lock changed -- Just retry + } + assert(w & LOCKBIT, "invariant"); + Self->ListNext = (ParkEvent *) (w & ~LOCKBIT); + if (Atomic::cmpxchg_ptr(intptr_t(Self)|LOCKBIT, Lock, w) == w) break; + } - while (Self->OnList != 0) { - Self->park(); - } + while (Self->OnList != 0) { + Self->park(); + } } } diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp index 332fd8666f8..410d440f23f 100644 --- a/hotspot/src/share/vm/runtime/thread.hpp +++ b/hotspot/src/share/vm/runtime/thread.hpp @@ -115,7 +115,7 @@ class Thread: public ThreadShadow { void operator delete(void* p); protected: - static void* allocate(size_t size, bool throw_excpt, MEMFLAGS flags = mtThread); + static void* allocate(size_t size, bool throw_excpt, MEMFLAGS flags = mtThread); private: // *************************************************************** @@ -225,10 +225,10 @@ class Thread: public ThreadShadow { // claimed as a task. jint _oops_do_parity; - public: - void set_last_handle_mark(HandleMark* mark) { _last_handle_mark = mark; } - HandleMark* last_handle_mark() const { return _last_handle_mark; } - private: + public: + void set_last_handle_mark(HandleMark* mark) { _last_handle_mark = mark; } + HandleMark* last_handle_mark() const { return _last_handle_mark; } + private: // debug support for checking if code does allow safepoints or not // GC points in the VM can happen because of allocation, invoking a VM operation, or blocking on @@ -445,9 +445,9 @@ class Thread: public ThreadShadow { virtual void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf); // Handles the parallel case for the method below. -private: + private: bool claim_oops_do_par_case(int collection_parity); -public: + public: // Requires that "collection_parity" is that of the current roots // iteration. If "is_par" is false, sets the parity of "this" to // "collection_parity", and returns "true". If "is_par" is true, @@ -664,9 +664,9 @@ class NamedThread: public Thread { // Worker threads are named and have an id of an assigned work. class WorkerThread: public NamedThread { -private: + private: uint _id; -public: + public: WorkerThread() : _id(0) { } virtual bool is_Worker_thread() const { return true; } @@ -844,7 +844,7 @@ class JavaThread: public Thread { // handlers thread is in volatile bool _doing_unsafe_access; // Thread may fault due to unsafe access bool _do_not_unlock_if_synchronized; // Do not unlock the receiver of a synchronized method (since it was - // never locked) when throwing an exception. Used by interpreter only. + // never locked) when throwing an exception. Used by interpreter only. // JNI attach states: enum JNIAttachStates { @@ -898,11 +898,11 @@ class JavaThread: public Thread { #ifndef PRODUCT int _jmp_ring_index; struct { - // We use intptr_t instead of address so debugger doesn't try and display strings - intptr_t _target; - intptr_t _instruction; - const char* _file; - int _line; + // We use intptr_t instead of address so debugger doesn't try and display strings + intptr_t _target; + intptr_t _instruction; + const char* _file; + int _line; } _jmp_ring[jump_ring_buffer_size]; #endif /* PRODUCT */ @@ -1113,7 +1113,7 @@ class JavaThread: public Thread { // when a suspend equivalent condition lifts. bool handle_special_suspend_equivalent_condition() { assert(is_suspend_equivalent(), - "should only be called in a suspend equivalence condition"); + "should only be called in a suspend equivalence condition"); MutexLockerEx ml(SR_lock(), Mutex::_no_safepoint_check_flag); bool ret = is_external_suspend(); if (!ret) { @@ -1339,10 +1339,10 @@ class JavaThread: public Thread { // Only return NULL if thread is off the thread list; starting to // exit should not return NULL. if (thread_from_jni_env->is_terminated()) { - thread_from_jni_env->block_if_vm_exited(); - return NULL; + thread_from_jni_env->block_if_vm_exited(); + return NULL; } else { - return thread_from_jni_env; + return thread_from_jni_env; } } @@ -1352,12 +1352,12 @@ class JavaThread: public Thread { void enter_critical() { assert(Thread::current() == this || Thread::current()->is_VM_thread() && SafepointSynchronize::is_synchronizing(), "this must be current thread or synchronizing"); - _jni_active_critical++; } + _jni_active_critical++; } void exit_critical() { assert(Thread::current() == this, "this must be current thread"); - _jni_active_critical--; - assert(_jni_active_critical >= 0, - "JNI critical nesting problem?"); } + _jni_active_critical--; + assert(_jni_active_critical >= 0, + "JNI critical nesting problem?"); } // Checked JNI, is the programmer required to check for exceptions, specify which function name bool is_pending_jni_exception_check() const { return _pending_jni_exception_check_fn != NULL; } @@ -1411,10 +1411,10 @@ class JavaThread: public Thread { void print_on_error(outputStream* st, char* buf, int buflen) const; void verify(); const char* get_thread_name() const; -private: + private: // factor out low-level mechanics for use in both normal and error cases const char* get_thread_name_string(char* buf = NULL, int buflen = 0) const; -public: + public: const char* get_threadgroup_name() const; const char* get_parent_name() const; @@ -1456,20 +1456,20 @@ public: // Profiling operation (see fprofile.cpp) public: - bool profile_last_Java_frame(frame* fr); + bool profile_last_Java_frame(frame* fr); private: - ThreadProfiler* _thread_profiler; + ThreadProfiler* _thread_profiler; private: - friend class FlatProfiler; // uses both [gs]et_thread_profiler. - friend class FlatProfilerTask; // uses get_thread_profiler. - friend class ThreadProfilerMark; // uses get_thread_profiler. - ThreadProfiler* get_thread_profiler() { return _thread_profiler; } - ThreadProfiler* set_thread_profiler(ThreadProfiler* tp) { - ThreadProfiler* result = _thread_profiler; - _thread_profiler = tp; - return result; - } + friend class FlatProfiler; // uses both [gs]et_thread_profiler. + friend class FlatProfilerTask; // uses get_thread_profiler. + friend class ThreadProfilerMark; // uses get_thread_profiler. + ThreadProfiler* get_thread_profiler() { return _thread_profiler; } + ThreadProfiler* set_thread_profiler(ThreadProfiler* tp) { + ThreadProfiler* result = _thread_profiler; + _thread_profiler = tp; + return result; + } public: // Returns the running thread as a JavaThread @@ -1692,15 +1692,15 @@ public: // JSR166 per-thread parker -private: + private: Parker* _parker; -public: + public: Parker* parker() { return _parker; } // Biased locking support -private: + private: GrowableArray* _cached_monitor_info; -public: + public: GrowableArray* cached_monitor_info() { return _cached_monitor_info; } void set_cached_monitor_info(GrowableArray* info) { _cached_monitor_info = info; } @@ -1708,12 +1708,12 @@ public: bool is_attaching_via_jni() const { return _jni_attach_state == _attaching_via_jni; } bool has_attached_via_jni() const { return is_attaching_via_jni() || _jni_attach_state == _attached_via_jni; } inline void set_done_attaching_via_jni(); -private: + private: // This field is used to determine if a thread has claimed // a par_id: it is UINT_MAX if the thread has not claimed a par_id; // otherwise its value is the par_id that has been claimed. uint _claimed_par_id; -public: + public: uint get_claimed_par_id() { return _claimed_par_id; } void set_claimed_par_id(uint id) { _claimed_par_id = id; } }; @@ -1782,9 +1782,9 @@ class CompilerThread : public JavaThread { void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf); #ifndef PRODUCT -private: + private: IdealGraphPrinter *_ideal_graph_printer; -public: + public: IdealGraphPrinter *ideal_graph_printer() { return _ideal_graph_printer; } void set_ideal_graph_printer(IdealGraphPrinter *n) { _ideal_graph_printer = n; } #endif @@ -1885,13 +1885,13 @@ class Threads: AllStatic { // is true, then Threads_lock is grabbed as needed. Otherwise, the // VM needs to be at a safepoint. static GrowableArray* get_pending_threads(int count, - address monitor, bool doLock); + address monitor, bool doLock); // Get owning Java thread from the monitor's owner field. If doLock // is true, then Threads_lock is grabbed as needed. Otherwise, the // VM needs to be at a safepoint. static JavaThread *owning_thread_from_monitor_owner(address owner, - bool doLock); + bool doLock); // Number of threads on the active threads list static int number_of_threads() { return _number_of_threads; } @@ -1911,9 +1911,9 @@ class ThreadClosure: public StackObj { }; class SignalHandlerMark: public StackObj { -private: + private: Thread* _thread; -public: + public: SignalHandlerMark(Thread* t) { _thread = t; if (_thread) _thread->enter_signal_handler(); From 5e63b8cfc48ac338a8a36cc3ca8b0c556b6b0c03 Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Wed, 10 Sep 2014 11:52:16 -0600 Subject: [PATCH 16/81] 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket Reviewed-by: fparain, sspitsyn, coleenp --- hotspot/src/os/bsd/vm/os_bsd.cpp | 387 ++++----- hotspot/src/os/bsd/vm/os_bsd.hpp | 12 +- hotspot/src/os/linux/vm/os_linux.cpp | 568 ++++++------- hotspot/src/os/linux/vm/os_linux.hpp | 14 +- hotspot/src/os/solaris/vm/os_solaris.cpp | 513 ++++++------ hotspot/src/os/solaris/vm/os_solaris.hpp | 20 +- hotspot/src/os/windows/vm/os_windows.cpp | 773 +++++++++--------- hotspot/src/share/vm/runtime/atomic.hpp | 39 +- hotspot/src/share/vm/runtime/mutex.cpp | 63 +- .../src/share/vm/runtime/objectMonitor.cpp | 201 +++-- .../src/share/vm/runtime/objectMonitor.hpp | 62 +- .../src/share/vm/runtime/sharedRuntime.hpp | 60 +- hotspot/src/share/vm/runtime/synchronizer.cpp | 71 +- hotspot/src/share/vm/runtime/synchronizer.hpp | 39 +- hotspot/src/share/vm/runtime/thread.cpp | 170 ++-- hotspot/src/share/vm/runtime/thread.hpp | 83 +- 16 files changed, 1594 insertions(+), 1481 deletions(-) diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp index 40c12c3e938..9be43c4a5f3 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.cpp +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp @@ -106,18 +106,18 @@ # include #if defined(__FreeBSD__) || defined(__NetBSD__) -# include + #include #endif #ifdef __APPLE__ -# include // semaphore_* API -# include -# include -# include + #include // semaphore_* API + #include + #include + #include #endif #ifndef MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON + #define MAP_ANONYMOUS MAP_ANON #endif #define MAX_PATH (2 * K) @@ -152,9 +152,9 @@ static bool check_signals = true; static pid_t _initial_pid = 0; -/* Signal number used to suspend/resume a thread */ +// Signal number used to suspend/resume a thread -/* do not use any signal number less than SIGSEGV, see 4355769 */ +// do not use any signal number less than SIGSEGV, see 4355769 static int SR_signum = SIGUSR2; sigset_t SR_sigset; @@ -232,20 +232,20 @@ static char cpu_arch[] = "arm"; #elif defined(PPC32) static char cpu_arch[] = "ppc"; #elif defined(SPARC) -# ifdef _LP64 + #ifdef _LP64 static char cpu_arch[] = "sparcv9"; -# else + #else static char cpu_arch[] = "sparc"; -# endif + #endif #else -#error Add appropriate cpu_arch setting + #error Add appropriate cpu_arch setting #endif // Compiler variant #ifdef COMPILER2 -#define COMPILER_VARIANT "server" + #define COMPILER_VARIANT "server" #else -#define COMPILER_VARIANT "client" + #define COMPILER_VARIANT "client" #endif @@ -255,21 +255,19 @@ void os::Bsd::initialize_system_info() { int cpu_val; julong mem_val; - /* get processors count via hw.ncpus sysctl */ + // get processors count via hw.ncpus sysctl mib[0] = CTL_HW; mib[1] = HW_NCPU; len = sizeof(cpu_val); if (sysctl(mib, 2, &cpu_val, &len, NULL, 0) != -1 && cpu_val >= 1) { assert(len == sizeof(cpu_val), "unexpected data size"); set_processor_count(cpu_val); - } - else { + } else { set_processor_count(1); // fallback } - /* get physical memory via hw.memsize sysctl (hw.memsize is used - * since it returns a 64 bit value) - */ + // get physical memory via hw.memsize sysctl (hw.memsize is used + // since it returns a 64 bit value) mib[0] = CTL_HW; #if defined (HW_MEMSIZE) // Apple @@ -287,7 +285,7 @@ void os::Bsd::initialize_system_info() { assert(len == sizeof(mem_val), "unexpected data size"); _physical_memory = mem_val; } else { - _physical_memory = 256*1024*1024; // fallback (XXXBSD?) + _physical_memory = 256 * 1024 * 1024; // fallback (XXXBSD?) } #ifdef __OpenBSD__ @@ -342,14 +340,14 @@ void os::init_system_properties_values() { // Important note: if the location of libjvm.so changes this // code needs to be changed accordingly. -// See ld(1): -// The linker uses the following search paths to locate required -// shared libraries: -// 1: ... -// ... -// 7: The default directories, normally /lib and /usr/lib. + // See ld(1): + // The linker uses the following search paths to locate required + // shared libraries: + // 1: ... + // ... + // 7: The default directories, normally /lib and /usr/lib. #ifndef DEFAULT_LIBPATH -#define DEFAULT_LIBPATH "/lib:/usr/lib" + #define DEFAULT_LIBPATH "/lib:/usr/lib" #endif // Base path of extensions installed on the system. @@ -435,8 +433,8 @@ void os::init_system_properties_values() { #else // __APPLE__ -#define SYS_EXTENSIONS_DIR "/Library/Java/Extensions" -#define SYS_EXTENSIONS_DIRS SYS_EXTENSIONS_DIR ":/Network" SYS_EXTENSIONS_DIR ":/System" SYS_EXTENSIONS_DIR ":/usr/lib/java" + #define SYS_EXTENSIONS_DIR "/Library/Java/Extensions" + #define SYS_EXTENSIONS_DIRS SYS_EXTENSIONS_DIR ":/Network" SYS_EXTENSIONS_DIR ":/System" SYS_EXTENSIONS_DIR ":/usr/lib/java" const char *user_home_dir = get_home(); // The null in SYS_EXTENSIONS_DIRS counts for the size of the colon after user_home_dir. @@ -565,10 +563,11 @@ bool os::Bsd::is_sig_ignored(int sig) { sigaction(sig, (struct sigaction*)NULL, &oact); void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction) : CAST_FROM_FN_PTR(void*, oact.sa_handler); - if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) + if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) { return true; - else + } else { return false; + } } void os::Bsd::signal_sets_init() { @@ -611,8 +610,9 @@ void os::Bsd::signal_sets_init() { } // Fill in signals that are blocked by all but the VM thread. sigemptyset(&vm_sigs); - if (!ReduceSignalUsage) + if (!ReduceSignalUsage) { sigaddset(&vm_sigs, BREAK_SIGNAL); + } debug_only(signal_sets_initialized = true); } @@ -671,8 +671,8 @@ static bool _thread_safety_check(Thread* thread) { #ifdef __APPLE__ // library handle for calling objc_registerThreadWithCollector() // without static linking to the libobjc library -#define OBJC_LIB "/usr/lib/libobjc.dylib" -#define OBJC_GCREGISTER "objc_registerThreadWithCollector" + #define OBJC_LIB "/usr/lib/libobjc.dylib" + #define OBJC_GCREGISTER "objc_registerThreadWithCollector" typedef void (*objc_registerThreadWithCollector_t)(); extern "C" objc_registerThreadWithCollector_t objc_registerThreadWithCollectorFunction; objc_registerThreadWithCollector_t objc_registerThreadWithCollectorFunction = NULL; @@ -997,9 +997,9 @@ jlong os::javaTimeMillis() { } #ifndef __APPLE__ -#ifndef CLOCK_MONOTONIC -#define CLOCK_MONOTONIC (1) -#endif + #ifndef CLOCK_MONOTONIC + #define CLOCK_MONOTONIC (1) + #endif #endif #ifdef __APPLE__ @@ -1176,7 +1176,6 @@ void os::die() { // from src/solaris/hpi/src/system_md.c size_t os::lasterror(char *buf, size_t len) { - if (errno == 0) return 0; const char *s = ::strerror(errno); @@ -1246,9 +1245,9 @@ int os::current_process_id() { #define JNI_LIB_PREFIX "lib" #ifdef __APPLE__ -#define JNI_LIB_SUFFIX ".dylib" + #define JNI_LIB_SUFFIX ".dylib" #else -#define JNI_LIB_SUFFIX ".so" + #define JNI_LIB_SUFFIX ".so" #endif const char* os::dll_file_extension() { return JNI_LIB_SUFFIX; } @@ -1269,9 +1268,9 @@ const char* os::get_temp_directory() { } return temp_path; } -#else /* __APPLE__ */ +#else // __APPLE__ const char* os::get_temp_directory() { return "/tmp"; } -#endif /* __APPLE__ */ +#endif // __APPLE__ static bool file_exists(const char* filename) { struct stat statbuf; @@ -1378,8 +1377,7 @@ bool os::dll_address_to_function_name(address addr, char *buf, // Handle non-dynamic manually: if (dlinfo.dli_fbase != NULL && - Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, - dlinfo.dli_fbase)) { + Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, dlinfo.dli_fbase)) { if (!Decoder::demangle(localbuf, buf, buflen)) { jio_snprintf(buf, buflen, "%s", localbuf); } @@ -1433,8 +1431,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) { return NULL; } #else -void * os::dll_load(const char *filename, char *ebuf, int ebuflen) -{ +void * os::dll_load(const char *filename, char *ebuf, int ebuflen) { void * result= ::dlopen(filename, RTLD_LAZY); if (result != NULL) { // Successful loading @@ -1482,27 +1479,27 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) } arch_t; #ifndef EM_486 - #define EM_486 6 /* Intel 80486 */ + #define EM_486 6 /* Intel 80486 */ #endif #ifndef EM_MIPS_RS3_LE - #define EM_MIPS_RS3_LE 10 /* MIPS */ + #define EM_MIPS_RS3_LE 10 /* MIPS */ #endif #ifndef EM_PPC64 - #define EM_PPC64 21 /* PowerPC64 */ + #define EM_PPC64 21 /* PowerPC64 */ #endif #ifndef EM_S390 - #define EM_S390 22 /* IBM System/390 */ + #define EM_S390 22 /* IBM System/390 */ #endif #ifndef EM_IA_64 - #define EM_IA_64 50 /* HP/Intel IA-64 */ + #define EM_IA_64 50 /* HP/Intel IA-64 */ #endif #ifndef EM_X86_64 - #define EM_X86_64 62 /* AMD x86-64 */ + #define EM_X86_64 62 /* AMD x86-64 */ #endif static const arch_t arch_array[]={ @@ -1608,7 +1605,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) return NULL; } -#endif /* !__APPLE__ */ +#endif // !__APPLE__ void* os::get_default_process_handle() { #ifdef __APPLE__ @@ -1792,8 +1789,9 @@ void os::jvm_path(char *buf, jint buflen) { if (ret && dli_fname[0] != '\0') { rp = realpath(dli_fname, buf); } - if (rp == NULL) + if (rp == NULL) { return; + } if (Arguments::sun_java_launcher_is_altjvm()) { // Support for the java launcher's '-XXaltjvm=' option. Typical @@ -1822,8 +1820,9 @@ void os::jvm_path(char *buf, jint buflen) { assert(strstr(p, "/libjvm") == p, "invalid library name"); rp = realpath(java_home_var, buf); - if (rp == NULL) + if (rp == NULL) { return; + } // determine if this is a legacy image or modules image // modules image doesn't have "jre" subdirectory @@ -1855,8 +1854,9 @@ void os::jvm_path(char *buf, jint buflen) { } else { // Fall back to path of current library rp = realpath(dli_fname, buf); - if (rp == NULL) + if (rp == NULL) { return; + } } } } @@ -1878,13 +1878,13 @@ void os::print_jni_name_suffix_on(outputStream* st, int args_size) { static volatile jint sigint_count = 0; -static void -UserHandler(int sig, void *siginfo, void *context) { +static void UserHandler(int sig, void *siginfo, void *context) { // 4511530 - sem_post is serialized and handled by the manager thread. When // the program is interrupted by Ctrl-C, SIGINT is sent to every thread. We // don't want to flood the manager thread with sem_post requests. - if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1) + if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1) { return; + } // Ctrl-C is pressed during error reporting, likely because the error // handler fails to abort. Let VM die immediately. @@ -1923,10 +1923,8 @@ void os::signal_raise(int signal_number) { ::raise(signal_number); } -/* - * The following code is moved from os.cpp for making this - * code platform specific, which it is by its very nature. - */ +// The following code is moved from os.cpp for making this +// code platform specific, which it is by its very nature. // Will be modified when max signal is changed to be dynamic int os::sigexitnum_pd() { @@ -1939,16 +1937,18 @@ static volatile jint pending_signals[NSIG+1] = { 0 }; // Bsd(POSIX) specific hand shaking semaphore. #ifdef __APPLE__ typedef semaphore_t os_semaphore_t; -#define SEM_INIT(sem, value) semaphore_create(mach_task_self(), &sem, SYNC_POLICY_FIFO, value) -#define SEM_WAIT(sem) semaphore_wait(sem) -#define SEM_POST(sem) semaphore_signal(sem) -#define SEM_DESTROY(sem) semaphore_destroy(mach_task_self(), sem) + + #define SEM_INIT(sem, value) semaphore_create(mach_task_self(), &sem, SYNC_POLICY_FIFO, value) + #define SEM_WAIT(sem) semaphore_wait(sem) + #define SEM_POST(sem) semaphore_signal(sem) + #define SEM_DESTROY(sem) semaphore_destroy(mach_task_self(), sem) #else typedef sem_t os_semaphore_t; -#define SEM_INIT(sem, value) sem_init(&sem, 0, value) -#define SEM_WAIT(sem) sem_wait(&sem) -#define SEM_POST(sem) sem_post(&sem) -#define SEM_DESTROY(sem) sem_destroy(&sem) + + #define SEM_INIT(sem, value) sem_init(&sem, 0, value) + #define SEM_WAIT(sem) sem_wait(&sem) + #define SEM_POST(sem) sem_post(&sem) + #define SEM_DESTROY(sem) sem_destroy(&sem) #endif class Semaphore : public StackObj { @@ -2087,12 +2087,10 @@ static int check_pending_signals(bool wait) { // were we externally suspended while we were waiting? threadIsSuspended = thread->handle_special_suspend_equivalent_condition(); if (threadIsSuspended) { - // // The semaphore has been incremented, but while we were waiting // another thread suspended us. We don't want to continue running // while suspended because that would surprise the thread that // suspended us. - // ::SEM_POST(sig_sem); thread->java_suspend_self(); @@ -2393,9 +2391,8 @@ char* os::reserve_memory_special(size_t bytes, size_t alignment, char* req_addr, char *addr; bool warn_on_failure = UseLargePages && - (!FLAG_IS_DEFAULT(UseLargePages) || - !FLAG_IS_DEFAULT(LargePageSizeInBytes) - ); + (!FLAG_IS_DEFAULT(UseLargePages) || + !FLAG_IS_DEFAULT(LargePageSizeInBytes)); // Create a large shared memory region to attach to based on size. // Currently, size is the total size of the heap @@ -2573,8 +2570,7 @@ void os::naked_short_sleep(jlong ms) { req.tv_sec = 0; if (ms > 0) { req.tv_nsec = (ms % 1000) * 1000000; - } - else { + } else { req.tv_nsec = 1; } @@ -2637,7 +2633,7 @@ int os::java_to_os_priority[CriticalPriority + 1] = { 31 // 11 CriticalPriority }; #else -/* Using Mach high-level priority assignments */ +// Using Mach high-level priority assignments int os::java_to_os_priority[CriticalPriority + 1] = { 0, // 0 Entry should never be used (MINPRI_USER) @@ -2690,12 +2686,14 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) { int policy; pthread_t self = pthread_self(); - if (pthread_getschedparam(self, &policy, &sp) != 0) + if (pthread_getschedparam(self, &policy, &sp) != 0) { return OS_ERR; + } sp.sched_priority = newpri; - if (pthread_setschedparam(self, policy, &sp) != 0) + if (pthread_setschedparam(self, policy, &sp) != 0) { return OS_ERR; + } return OS_OK; #else @@ -2751,7 +2749,6 @@ void os::hint_no_preempt() {} // - sends signal to end the sigsuspend loop in the SR_handler // // Note that the SR_lock plays no role in this suspend/resume protocol. -// static void resume_clear_context(OSThread *osthread) { osthread->set_ucontext(NULL); @@ -2763,7 +2760,6 @@ static void suspend_save_context(OSThread *osthread, siginfo_t* siginfo, ucontex osthread->set_siginfo(siginfo); } -// // Handler function invoked when a thread's execution is suspended or // resumed. We have to be careful that only async-safe functions are // called here (Note: most pthread functions are not async safe and @@ -2835,7 +2831,7 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) { static int SR_initialize() { struct sigaction act; char *s; - /* Get signal number to use for suspend/resume */ + // Get signal number to use for suspend/resume if ((s = ::getenv("_JAVA_SR_SIGNUM")) != 0) { int sig = ::strtol(s, 0, 10); if (sig > 0 || sig < NSIG) { @@ -2849,7 +2845,7 @@ static int SR_initialize() { sigemptyset(&SR_sigset); sigaddset(&SR_sigset, SR_signum); - /* Set up signal handler for suspend/resume */ + // Set up signal handler for suspend/resume act.sa_flags = SA_RESTART|SA_SIGINFO; act.sa_handler = (void (*)(int)) SR_handler; @@ -2975,9 +2971,9 @@ static void do_resume(OSThread* osthread) { // Note that the VM will print warnings if it detects conflicting signal // handlers, unless invoked with the option "-XX:+AllowUserSignalHandlers". // -extern "C" JNIEXPORT int -JVM_handle_bsd_signal(int signo, siginfo_t* siginfo, - void* ucontext, int abort_if_unrecognized); +extern "C" JNIEXPORT int JVM_handle_bsd_signal(int signo, siginfo_t* siginfo, + void* ucontext, + int abort_if_unrecognized); void signalHandler(int sig, siginfo_t* info, void* uc) { assert(info != NULL && uc != NULL, "it must be old kernel"); @@ -3243,7 +3239,7 @@ void os::Bsd::install_signal_handlers() { // We will never set this flag, and we should // ignore this flag in our diagnostic #ifdef SIGNIFICANT_SIGNAL_MASK -#undef SIGNIFICANT_SIGNAL_MASK + #undef SIGNIFICANT_SIGNAL_MASK #endif #define SIGNIFICANT_SIGNAL_MASK (~0x04000000) @@ -3315,9 +3311,12 @@ static void print_signal_handler(outputStream* st, int sig, } -#define DO_SIGNAL_CHECK(sig) \ - if (!sigismember(&check_signal_done, sig)) \ - os::Bsd::check_signal_handler(sig) +#define DO_SIGNAL_CHECK(sig) \ + do { \ + if (!sigismember(&check_signal_done, sig)) { \ + os::Bsd::check_signal_handler(sig); \ + } \ + } while (0) // This method is a periodic task to check for misbehaving JNI applications // under CheckJNI, we can add any periodic checks here @@ -3432,7 +3431,8 @@ void os::Bsd::check_signal_handler(int sig) { } } -extern void report_error(char* file_name, int line_no, char* title, char* format, ...); +extern void report_error(char* file_name, int line_no, char* title, + char* format, ...); extern bool signal_name(int signo, char* buf, size_t len); @@ -3450,7 +3450,7 @@ const char* os::exception_name(int exception_code, char* buf, size_t size) { // this is called _before_ the most of global arguments have been parsed void os::init(void) { - char dummy; /* used to get a guess on initial stack address */ + char dummy; // used to get a guess on initial stack address // first_hrtime = gethrtime(); // With BsdThreads the JavaMain thread pid (primordial thread) @@ -3503,8 +3503,7 @@ extern "C" { } // this is called _after_ the global arguments have been parsed -jint os::init_2(void) -{ +jint os::init_2(void) { // Allocate a single page and mark it as readable for safepoint polling address polling_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page"); @@ -3512,8 +3511,10 @@ jint os::init_2(void) os::set_polling_page(polling_page); #ifndef PRODUCT - if (Verbose && PrintMiscellaneous) - tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page); + if (Verbose && PrintMiscellaneous) { + tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", + (intptr_t)polling_page); + } #endif if (!UseMembar) { @@ -3522,8 +3523,10 @@ jint os::init_2(void) os::set_memory_serialize_page(mem_serialize_page); #ifndef PRODUCT - if (Verbose && PrintMiscellaneous) - tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page); + if (Verbose && PrintMiscellaneous) { + tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", + (intptr_t)mem_serialize_page); + } #endif } @@ -3565,8 +3568,9 @@ jint os::init_2(void) struct rlimit nbr_files; int status = getrlimit(RLIMIT_NOFILE, &nbr_files); if (status != 0) { - if (PrintMiscellaneous && (Verbose || WizardMode)) + if (PrintMiscellaneous && (Verbose || WizardMode)) { perror("os::init_2 getrlimit failed"); + } } else { nbr_files.rlim_cur = nbr_files.rlim_max; @@ -3579,8 +3583,9 @@ jint os::init_2(void) status = setrlimit(RLIMIT_NOFILE, &nbr_files); if (status != 0) { - if (PrintMiscellaneous && (Verbose || WizardMode)) + if (PrintMiscellaneous && (Verbose || WizardMode)) { perror("os::init_2 setrlimit failed"); + } } } } @@ -3623,16 +3628,17 @@ void os::init_3(void) { } // Mark the polling page as unreadable void os::make_polling_page_unreadable(void) { - if (!guard_memory((char*)_polling_page, Bsd::page_size())) + if (!guard_memory((char*)_polling_page, Bsd::page_size())) { fatal("Could not disable polling page"); -}; + } +} // Mark the polling page as readable void os::make_polling_page_readable(void) { if (!bsd_mprotect((char *)_polling_page, Bsd::page_size(), PROT_READ)) { fatal("Could not enable polling page"); } -}; +} int os::active_processor_count() { return _processor_count; @@ -3707,8 +3713,9 @@ ExtendedPC os::get_thread_pc(Thread* thread) { return fetcher.result(); } -int os::Bsd::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime) -{ +int os::Bsd::safe_cond_timedwait(pthread_cond_t *_cond, + pthread_mutex_t *_mutex, + const struct timespec *_abstime) { return pthread_cond_timedwait(_cond, _mutex, _abstime); } @@ -3745,8 +3752,9 @@ bool os::find(address addr, outputStream* st) { if (begin < lowest) begin = lowest; Dl_info dlinfo2; if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr - && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) + && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) { end = (address) dlinfo2.dli_saddr; + } Disassembler::decode(begin, end, st); } return true; @@ -3760,9 +3768,9 @@ bool os::find(address addr, outputStream* st) { // This does not do anything on Bsd. This is basically a hook for being // able to use structured exception handling (thread-local exception filters) // on, e.g., Win32. -void -os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, - JavaCallArguments* args, Thread* thread) { +void os::os_exception_wrapper(java_call_t f, JavaValue* value, + methodHandle* method, JavaCallArguments* args, + Thread* thread) { f(value, method, args, thread); } @@ -3803,7 +3811,8 @@ bool os::check_heap(bool force) { } ATTRIBUTE_PRINTF(3, 0) -int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) { +int local_vsnprintf(char* buf, size_t count, const char* format, + va_list args) { return ::vsnprintf(buf, count, format, args); } @@ -3815,7 +3824,7 @@ bool os::dir_is_empty(const char* path) { dir = opendir(path); if (dir == NULL) return true; - /* Scan the directory */ + // Scan the directory bool result = true; char buf[sizeof(struct dirent) + MAX_PATH]; while (result && (ptr = ::readdir(dir)) != NULL) { @@ -3831,7 +3840,7 @@ bool os::dir_is_empty(const char* path) { // from src/solaris/hpi/src/system_md.c #ifndef O_DELETE -#define O_DELETE 0x10000 + #define O_DELETE 0x10000 #endif // Open a file. Unlink the file immediately after open returns @@ -3839,7 +3848,6 @@ bool os::dir_is_empty(const char* path) { // O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c int os::open(const char *path, int oflag, int mode) { - if (strlen(path) > MAX_PATH - 1) { errno = ENAMETOOLONG; return -1; @@ -3851,7 +3859,7 @@ int os::open(const char *path, int oflag, int mode) { fd = ::open(path, oflag, mode); if (fd == -1) return -1; - //If the open succeeded, the file might still be a directory + // If the open succeeded, the file might still be a directory { struct stat buf; int ret = ::fstat(fd, &buf); @@ -3869,33 +3877,33 @@ int os::open(const char *path, int oflag, int mode) { } } - /* - * All file descriptors that are opened in the JVM and not - * specifically destined for a subprocess should have the - * close-on-exec flag set. If we don't set it, then careless 3rd - * party native code might fork and exec without closing all - * appropriate file descriptors (e.g. as we do in closeDescriptors in - * UNIXProcess.c), and this in turn might: - * - * - cause end-of-file to fail to be detected on some file - * descriptors, resulting in mysterious hangs, or - * - * - might cause an fopen in the subprocess to fail on a system - * suffering from bug 1085341. - * - * (Yes, the default setting of the close-on-exec flag is a Unix - * design flaw) - * - * See: - * 1085341: 32-bit stdio routines should support file descriptors >255 - * 4843136: (process) pipe file descriptor from Runtime.exec not being closed - * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9 - */ + // All file descriptors that are opened in the JVM and not + // specifically destined for a subprocess should have the + // close-on-exec flag set. If we don't set it, then careless 3rd + // party native code might fork and exec without closing all + // appropriate file descriptors (e.g. as we do in closeDescriptors in + // UNIXProcess.c), and this in turn might: + // + // - cause end-of-file to fail to be detected on some file + // descriptors, resulting in mysterious hangs, or + // + // - might cause an fopen in the subprocess to fail on a system + // suffering from bug 1085341. + // + // (Yes, the default setting of the close-on-exec flag is a Unix + // design flaw) + // + // See: + // 1085341: 32-bit stdio routines should support file descriptors >255 + // 4843136: (process) pipe file descriptor from Runtime.exec not being closed + // 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9 + // #ifdef FD_CLOEXEC { int flags = ::fcntl(fd, F_GETFD); - if (flags != -1) + if (flags != -1) { ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC); + } } #endif @@ -3936,11 +3944,9 @@ int os::available(int fd, jlong *bytes) { if (::fstat(fd, &buf) >= 0) { mode = buf.st_mode; if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) { - /* - * XXX: is the following call interruptible? If so, this might - * need to go through the INTERRUPT_IO() wrapper as for other - * blocking, interruptible calls in this file. - */ + // XXX: is the following call interruptible? If so, this might + // need to go through the INTERRUPT_IO() wrapper as for other + // blocking, interruptible calls in this file. int n; if (::ioctl(fd, FIONREAD, &n) >= 0) { *bytes = n; @@ -3960,8 +3966,9 @@ int os::available(int fd, jlong *bytes) { } int os::socket_available(int fd, jint *pbytes) { - if (fd < 0) + if (fd < 0) { return OS_OK; + } int ret; @@ -4063,8 +4070,9 @@ jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { mach_thread = thread->osthread()->thread_id(); kr = thread_info(mach_thread, THREAD_BASIC_INFO, (thread_info_t)&tinfo, &tcount); - if (kr != KERN_SUCCESS) + if (kr != KERN_SUCCESS) { return -1; + } if (user_sys_cpu_time) { jlong nanos; @@ -4195,7 +4203,8 @@ void os::pause() { // abstime will be the absolute timeout time // TODO: replace compute_abstime() with unpackTime() -static struct timespec* compute_abstime(struct timespec* abstime, jlong millis) { +static struct timespec* compute_abstime(struct timespec* abstime, + jlong millis) { if (millis < 0) millis = 0; struct timeval now; int status = gettimeofday(&now, NULL); @@ -4358,36 +4367,33 @@ void os::PlatformEvent::unpark() { // JSR166 // ------------------------------------------------------- -/* - * The solaris and bsd implementations of park/unpark are fairly - * conservative for now, but can be improved. They currently use a - * mutex/condvar pair, plus a a count. - * Park decrements count if > 0, else does a condvar wait. Unpark - * sets count to 1 and signals condvar. Only one thread ever waits - * on the condvar. Contention seen when trying to park implies that someone - * is unparking you, so don't wait. And spurious returns are fine, so there - * is no need to track notifications. - */ +// The solaris and bsd implementations of park/unpark are fairly +// conservative for now, but can be improved. They currently use a +// mutex/condvar pair, plus a a count. +// Park decrements count if > 0, else does a condvar wait. Unpark +// sets count to 1 and signals condvar. Only one thread ever waits +// on the condvar. Contention seen when trying to park implies that someone +// is unparking you, so don't wait. And spurious returns are fine, so there +// is no need to track notifications. #define MAX_SECS 100000000 -/* - * This code is common to bsd and solaris and will be moved to a - * common place in dolphin. - * - * The passed in time value is either a relative time in nanoseconds - * or an absolute time in milliseconds. Either way it has to be unpacked - * into suitable seconds and nanoseconds components and stored in the - * given timespec structure. - * Given time is a 64-bit value and the time_t used in the timespec is only - * a signed-32-bit value (except on 64-bit Bsd) we have to watch for - * overflow if times way in the future are given. Further on Solaris versions - * prior to 10 there is a restriction (see cond_timedwait) that the specified - * number of seconds, in abstime, is less than current_time + 100,000,000. - * As it will be 28 years before "now + 100000000" will overflow we can - * ignore overflow and just impose a hard-limit on seconds using the value - * of "now + 100,000,000". This places a limit on the timeout of about 3.17 - * years from "now". - */ + +// This code is common to bsd and solaris and will be moved to a +// common place in dolphin. +// +// The passed in time value is either a relative time in nanoseconds +// or an absolute time in milliseconds. Either way it has to be unpacked +// into suitable seconds and nanoseconds components and stored in the +// given timespec structure. +// Given time is a 64-bit value and the time_t used in the timespec is only +// a signed-32-bit value (except on 64-bit Bsd) we have to watch for +// overflow if times way in the future are given. Further on Solaris versions +// prior to 10 there is a restriction (see cond_timedwait) that the specified +// number of seconds, in abstime, is less than current_time + 100,000,000. +// As it will be 28 years before "now + 100000000" will overflow we can +// ignore overflow and just impose a hard-limit on seconds using the value +// of "now + 100,000,000". This places a limit on the timeout of about 3.17 +// years from "now". static void unpackTime(struct timespec* absTime, bool isAbsolute, jlong time) { assert(time > 0, "convertTime"); @@ -4402,19 +4408,16 @@ static void unpackTime(struct timespec* absTime, bool isAbsolute, jlong time) { jlong secs = time / 1000; if (secs > max_secs) { absTime->tv_sec = max_secs; - } - else { + } else { absTime->tv_sec = secs; } absTime->tv_nsec = (time % 1000) * NANOSECS_PER_MILLISEC; - } - else { + } else { jlong secs = time / NANOSECS_PER_SEC; if (secs >= MAX_SECS) { absTime->tv_sec = max_secs; absTime->tv_nsec = 0; - } - else { + } else { absTime->tv_sec = now.tv_sec + secs; absTime->tv_nsec = (time % NANOSECS_PER_SEC) + now.tv_usec*1000; if (absTime->tv_nsec >= NANOSECS_PER_SEC) { @@ -4550,10 +4553,10 @@ void Parker::unpark() { } -/* Darwin has no "environ" in a dynamic library. */ +// Darwin has no "environ" in a dynamic library. #ifdef __APPLE__ -#include -#define environ (*_NSGetEnviron()) + #include + #define environ (*_NSGetEnviron()) #else extern char** environ; #endif @@ -4649,13 +4652,19 @@ bool os::is_headless_jre() { // Get rid of libjvm.so p = strrchr(buf, '/'); - if (p == NULL) return false; - else *p = '\0'; + if (p == NULL) { + return false; + } else { + *p = '\0'; + } // Get rid of client or server p = strrchr(buf, '/'); - if (p == NULL) return false; - else *p = '\0'; + if (p == NULL) { + return false; + } else { + *p = '\0'; + } // check xawt/libmawt.so strcpy(libmawtpath, buf); diff --git a/hotspot/src/os/bsd/vm/os_bsd.hpp b/hotspot/src/os/bsd/vm/os_bsd.hpp index ed31695cd4a..f01b21fab26 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.hpp +++ b/hotspot/src/os/bsd/vm/os_bsd.hpp @@ -30,8 +30,8 @@ // Information about the protection of the page at address '0' on this os. static bool zero_page_read_protected() { return true; } -/* pthread_getattr_np comes with BsdThreads-0.9-7 on RedHat 7.1 */ -typedef int (*pthread_getattr_func_type) (pthread_t, pthread_attr_t *); +// pthread_getattr_np comes with BsdThreads-0.9-7 on RedHat 7.1 +typedef int (*pthread_getattr_func_type)(pthread_t, pthread_attr_t *); #ifdef __APPLE__ // Mac OS X doesn't support clock_gettime. Stub out the type, it is @@ -205,9 +205,9 @@ class PlatformEvent : public CHeapObj { public: PlatformEvent() { int status; - status = pthread_cond_init (_cond, NULL); + status = pthread_cond_init(_cond, NULL); assert_status(status == 0, status, "cond_init"); - status = pthread_mutex_init (_mutex, NULL); + status = pthread_mutex_init(_mutex, NULL); assert_status(status == 0, status, "mutex_init"); _Event = 0; _nParked = 0; @@ -234,9 +234,9 @@ class PlatformParker : public CHeapObj { public: PlatformParker() { int status; - status = pthread_cond_init (_cond, NULL); + status = pthread_cond_init(_cond, NULL); assert_status(status == 0, status, "cond_init"); - status = pthread_mutex_init (_mutex, NULL); + status = pthread_mutex_init(_mutex, NULL); assert_status(status == 0, status, "mutex_init"); } }; diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index fb06bf0f87c..7244961b506 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -109,7 +109,7 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling // getrusage() is prepared to handle the associated failure. #ifndef RUSAGE_THREAD -#define RUSAGE_THREAD (1) /* only the calling thread */ + #define RUSAGE_THREAD (1) /* only the calling thread */ #endif #define MAX_PATH (2 * K) @@ -150,13 +150,13 @@ static bool check_signals = true; static pid_t _initial_pid = 0; -/* Signal number used to suspend/resume a thread */ +// Signal number used to suspend/resume a thread -/* do not use any signal number less than SIGSEGV, see 4355769 */ +// do not use any signal number less than SIGSEGV, see 4355769 static int SR_signum = SIGUSR2; sigset_t SR_sigset; -/* Used to protect dlsym() calls */ +// Used to protect dlsym() calls static pthread_mutex_t dl_mutex; // Declarations @@ -240,17 +240,17 @@ bool os::have_special_privileges() { #ifndef SYS_gettid // i386: 224, ia64: 1105, amd64: 186, sparc 143 -#ifdef __ia64__ -#define SYS_gettid 1105 -#elif __i386__ -#define SYS_gettid 224 -#elif __amd64__ -#define SYS_gettid 186 -#elif __sparc__ -#define SYS_gettid 143 -#else -#error define gettid for the arch -#endif + #ifdef __ia64__ + #define SYS_gettid 1105 + #elif __i386__ + #define SYS_gettid 224 + #elif __amd64__ + #define SYS_gettid 186 + #elif __sparc__ + #define SYS_gettid 143 + #else + #error define gettid for the arch + #endif #endif // Cpu architecture string @@ -269,13 +269,13 @@ static char cpu_arch[] = "ppc"; #elif defined(PPC64) static char cpu_arch[] = "ppc64"; #elif defined(SPARC) -# ifdef _LP64 + #ifdef _LP64 static char cpu_arch[] = "sparcv9"; -# else + #else static char cpu_arch[] = "sparc"; -# endif + #endif #else -#error Add appropriate cpu_arch setting + #error Add appropriate cpu_arch setting #endif @@ -350,16 +350,16 @@ void os::init_system_properties_values() { // Important note: if the location of libjvm.so changes this // code needs to be changed accordingly. -// See ld(1): -// The linker uses the following search paths to locate required -// shared libraries: -// 1: ... -// ... -// 7: The default directories, normally /lib and /usr/lib. + // See ld(1): + // The linker uses the following search paths to locate required + // shared libraries: + // 1: ... + // ... + // 7: The default directories, normally /lib and /usr/lib. #if defined(AMD64) || defined(_LP64) && (defined(SPARC) || defined(PPC) || defined(S390)) -#define DEFAULT_LIBPATH "/usr/lib64:/lib64:/lib:/usr/lib" + #define DEFAULT_LIBPATH "/usr/lib64:/lib64:/lib:/usr/lib" #else -#define DEFAULT_LIBPATH "/lib:/usr/lib" + #define DEFAULT_LIBPATH "/lib:/usr/lib" #endif // Base path of extensions installed on the system. @@ -469,10 +469,11 @@ bool os::Linux::is_sig_ignored(int sig) { sigaction(sig, (struct sigaction*)NULL, &oact); void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction) : CAST_FROM_FN_PTR(void*, oact.sa_handler); - if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) + if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) { return true; - else + } else { return false; + } } void os::Linux::signal_sets_init() { @@ -518,8 +519,9 @@ void os::Linux::signal_sets_init() { } // Fill in signals that are blocked by all but the VM thread. sigemptyset(&vm_sigs); - if (!ReduceSignalUsage) + if (!ReduceSignalUsage) { sigaddset(&vm_sigs, BREAK_SIGNAL); + } debug_only(signal_sets_initialized = true); } @@ -574,12 +576,12 @@ void os::Linux::libpthread_init() { // and _CS_GNU_LIBPTHREAD_VERSION are supported in glibc >= 2.3.2. Use a // generic name for earlier versions. // Define macros here so we can build HotSpot on old systems. -# ifndef _CS_GNU_LIBC_VERSION -# define _CS_GNU_LIBC_VERSION 2 -# endif -# ifndef _CS_GNU_LIBPTHREAD_VERSION -# define _CS_GNU_LIBPTHREAD_VERSION 3 -# endif +#ifndef _CS_GNU_LIBC_VERSION + #define _CS_GNU_LIBC_VERSION 2 +#endif +#ifndef _CS_GNU_LIBPTHREAD_VERSION + #define _CS_GNU_LIBPTHREAD_VERSION 3 +#endif size_t n = confstr(_CS_GNU_LIBC_VERSION, NULL, 0); if (n > 0) { @@ -683,9 +685,9 @@ void os::Linux::libpthread_init() { // should always be true if the function is not inlined. #if __GNUC__ < 3 // gcc 2.x does not support noinline attribute -#define NOINLINE + #define NOINLINE #else -#define NOINLINE __attribute__ ((noinline)) + #define NOINLINE __attribute__ ((noinline)) #endif static void _expand_stack_to(address bottom) NOINLINE; @@ -832,7 +834,8 @@ static void *java_start(Thread *thread) { return 0; } -bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { +bool os::create_thread(Thread* thread, ThreadType thr_type, + size_t stack_size) { assert(thread->osthread() == NULL, "caller responsible"); // Allocate the OSThread object @@ -1084,9 +1087,11 @@ bool os::Linux::is_initial_thread(void) { initial_thread_stack_size() != 0, "os::init did not locate initial thread's stack region"); if ((address)&dummy >= initial_thread_stack_bottom() && - (address)&dummy < initial_thread_stack_bottom() + initial_thread_stack_size()) + (address)&dummy < initial_thread_stack_bottom() + initial_thread_stack_size()) { return true; - else return false; + } else { + return false; + } } // Find the virtual memory area that contains addr @@ -1136,8 +1141,9 @@ void os::Linux::capture_initial_stack(size_t max_size) { // in case other parts in glibc still assumes 2M max stack size. // FIXME: alt signal stack is gone, maybe we can relax this constraint? // Problem still exists RH7.2 (IA64 anyway) but 2MB is a little small - if (stack_size > 2 * K * K IA64_ONLY(*2)) + if (stack_size > 2 * K * K IA64_ONLY(*2)) { stack_size = 2 * K * K IA64_ONLY(*2); + } // Try to figure out where the stack base (top) is. This is harder. // // When an application is started, glibc saves the initial stack pointer in @@ -1221,35 +1227,35 @@ void os::Linux::capture_initial_stack(size_t max_size) { #define _UFM UINTX_FORMAT #define _DFM INTX_FORMAT - /* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 */ - /* 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 */ + // 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 + // 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld " _UFM _UFM _DFM _UFM _UFM _UFM _UFM, - &state, /* 3 %c */ - &ppid, /* 4 %d */ - &pgrp, /* 5 %d */ - &session, /* 6 %d */ - &nr, /* 7 %d */ - &tpgrp, /* 8 %d */ - &flags, /* 9 %lu */ - &minflt, /* 10 %lu */ - &cminflt, /* 11 %lu */ - &majflt, /* 12 %lu */ - &cmajflt, /* 13 %lu */ - &utime, /* 14 %lu */ - &stime, /* 15 %lu */ - &cutime, /* 16 %ld */ - &cstime, /* 17 %ld */ - &prio, /* 18 %ld */ - &nice, /* 19 %ld */ - &junk, /* 20 %ld */ - &it_real, /* 21 %ld */ - &start, /* 22 UINTX_FORMAT */ - &vsize, /* 23 UINTX_FORMAT */ - &rss, /* 24 INTX_FORMAT */ - &rsslim, /* 25 UINTX_FORMAT */ - &scodes, /* 26 UINTX_FORMAT */ - &ecode, /* 27 UINTX_FORMAT */ - &stack_start); /* 28 UINTX_FORMAT */ + &state, // 3 %c + &ppid, // 4 %d + &pgrp, // 5 %d + &session, // 6 %d + &nr, // 7 %d + &tpgrp, // 8 %d + &flags, // 9 %lu + &minflt, // 10 %lu + &cminflt, // 11 %lu + &majflt, // 12 %lu + &cmajflt, // 13 %lu + &utime, // 14 %lu + &stime, // 15 %lu + &cutime, // 16 %ld + &cstime, // 17 %ld + &prio, // 18 %ld + &nice, // 19 %ld + &junk, // 20 %ld + &it_real, // 21 %ld + &start, // 22 UINTX_FORMAT + &vsize, // 23 UINTX_FORMAT + &rss, // 24 INTX_FORMAT + &rsslim, // 25 UINTX_FORMAT + &scodes, // 26 UINTX_FORMAT + &ecode, // 27 UINTX_FORMAT + &stack_start); // 28 UINTX_FORMAT } #undef _UFM @@ -1348,7 +1354,7 @@ jlong os::javaTimeMillis() { } #ifndef CLOCK_MONOTONIC -#define CLOCK_MONOTONIC (1) + #define CLOCK_MONOTONIC (1) #endif void os::Linux::clock_init() { @@ -1391,17 +1397,15 @@ void os::Linux::clock_init() { } #ifndef SYS_clock_getres - -#if defined(IA32) || defined(AMD64) -#define SYS_clock_getres IA32_ONLY(266) AMD64_ONLY(229) -#define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y) + #if defined(IA32) || defined(AMD64) + #define SYS_clock_getres IA32_ONLY(266) AMD64_ONLY(229) + #define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y) + #else + #warning "SYS_clock_getres not defined for this platform, disabling fast_thread_cpu_time" + #define sys_clock_getres(x,y) -1 + #endif #else -#warning "SYS_clock_getres not defined for this platform, disabling fast_thread_cpu_time" -#define sys_clock_getres(x,y) -1 -#endif - -#else -#define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y) + #define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y) #endif void os::Linux::fast_thread_clock_init() { @@ -1425,7 +1429,6 @@ void os::Linux::fast_thread_clock_init() { if (pthread_getcpuclockid_func && pthread_getcpuclockid_func(_main_thread, &clockid) == 0 && sys_clock_getres(clockid, &tp) == 0 && tp.tv_sec == 0) { - _supports_fast_thread_cpu_time = true; _pthread_getcpuclockid = pthread_getcpuclockid_func; } @@ -1558,7 +1561,6 @@ void os::die() { // from src/solaris/hpi/src/system_md.c size_t os::lasterror(char *buf, size_t len) { - if (errno == 0) return 0; const char *s = ::strerror(errno); @@ -1818,8 +1820,7 @@ class VM_LinuxDllLoad: public VM_Operation { void* loaded_library() { return _lib; } }; -void * os::dll_load(const char *filename, char *ebuf, int ebuflen) -{ +void * os::dll_load(const char *filename, char *ebuf, int ebuflen) { void * result = NULL; bool load_attempted = false; @@ -1921,9 +1922,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) char* name; // String representation } arch_t; - #ifndef EM_486 +#ifndef EM_486 #define EM_486 6 /* Intel 80486 */ - #endif +#endif static const arch_t arch_array[]={ {EM_386, EM_386, ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"}, @@ -1948,38 +1949,38 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {EM_68K, EM_68K, ELFCLASS32, ELFDATA2MSB, (char*)"M68k"} }; - #if (defined IA32) +#if (defined IA32) static Elf32_Half running_arch_code=EM_386; - #elif (defined AMD64) +#elif (defined AMD64) static Elf32_Half running_arch_code=EM_X86_64; - #elif (defined IA64) +#elif (defined IA64) static Elf32_Half running_arch_code=EM_IA_64; - #elif (defined __sparc) && (defined _LP64) +#elif (defined __sparc) && (defined _LP64) static Elf32_Half running_arch_code=EM_SPARCV9; - #elif (defined __sparc) && (!defined _LP64) +#elif (defined __sparc) && (!defined _LP64) static Elf32_Half running_arch_code=EM_SPARC; - #elif (defined __powerpc64__) +#elif (defined __powerpc64__) static Elf32_Half running_arch_code=EM_PPC64; - #elif (defined __powerpc__) +#elif (defined __powerpc__) static Elf32_Half running_arch_code=EM_PPC; - #elif (defined ARM) +#elif (defined ARM) static Elf32_Half running_arch_code=EM_ARM; - #elif (defined S390) +#elif (defined S390) static Elf32_Half running_arch_code=EM_S390; - #elif (defined ALPHA) +#elif (defined ALPHA) static Elf32_Half running_arch_code=EM_ALPHA; - #elif (defined MIPSEL) +#elif (defined MIPSEL) static Elf32_Half running_arch_code=EM_MIPS_RS3_LE; - #elif (defined PARISC) +#elif (defined PARISC) static Elf32_Half running_arch_code=EM_PARISC; - #elif (defined MIPS) +#elif (defined MIPS) static Elf32_Half running_arch_code=EM_MIPS; - #elif (defined M68K) +#elif (defined M68K) static Elf32_Half running_arch_code=EM_68K; - #else +#else #error Method os::dll_load requires that one of following is defined:\ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K - #endif +#endif // Identify compatability class for VM's architecture and library's architecture // Obtain string descriptions for architectures @@ -2033,7 +2034,8 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) return NULL; } -void * os::Linux::dlopen_helper(const char *filename, char *ebuf, int ebuflen) { +void * os::Linux::dlopen_helper(const char *filename, char *ebuf, + int ebuflen) { void * result = ::dlopen(filename, RTLD_LAZY); if (result == NULL) { ::strncpy(ebuf, ::dlerror(), ebuflen - 1); @@ -2042,7 +2044,8 @@ void * os::Linux::dlopen_helper(const char *filename, char *ebuf, int ebuflen) { return result; } -void * os::Linux::dll_load_in_vmthread(const char *filename, char *ebuf, int ebuflen) { +void * os::Linux::dll_load_in_vmthread(const char *filename, char *ebuf, + int ebuflen) { void * result = NULL; if (LoadExecStackDllInVMThread) { result = dlopen_helper(filename, ebuf, ebuflen); @@ -2074,11 +2077,10 @@ void * os::Linux::dll_load_in_vmthread(const char *filename, char *ebuf, int ebu return result; } -/* - * glibc-2.0 libdl is not MT safe. If you are building with any glibc, - * chances are you might want to run the generated bits against glibc-2.0 - * libdl.so, so always use locking for any version of glibc. - */ +// glibc-2.0 libdl is not MT safe. If you are building with any glibc, +// chances are you might want to run the generated bits against glibc-2.0 +// libdl.so, so always use locking for any version of glibc. +// void* os::dll_lookup(void* handle, const char* name) { pthread_mutex_lock(&dl_mutex); void* res = dlsym(handle, name); @@ -2308,8 +2310,9 @@ void os::jvm_path(char *buf, jint buflen) { if (ret && dli_fname[0] != '\0') { rp = realpath(dli_fname, buf); } - if (rp == NULL) + if (rp == NULL) { return; + } if (Arguments::sun_java_launcher_is_altjvm()) { // Support for the java launcher's '-XXaltjvm=' option. Typical @@ -2337,8 +2340,9 @@ void os::jvm_path(char *buf, jint buflen) { assert(strstr(p, "/libjvm") == p, "invalid library name"); rp = realpath(java_home_var, buf); - if (rp == NULL) + if (rp == NULL) { return; + } // determine if this is a legacy image or modules image // modules image doesn't have "jre" subdirectory @@ -2357,8 +2361,9 @@ void os::jvm_path(char *buf, jint buflen) { } else { // Go back to path of .so rp = realpath(dli_fname, buf); - if (rp == NULL) + if (rp == NULL) { return; + } } } } @@ -2380,13 +2385,13 @@ void os::print_jni_name_suffix_on(outputStream* st, int args_size) { static volatile jint sigint_count = 0; -static void -UserHandler(int sig, void *siginfo, void *context) { +static void UserHandler(int sig, void *siginfo, void *context) { // 4511530 - sem_post is serialized and handled by the manager thread. When // the program is interrupted by Ctrl-C, SIGINT is sent to every thread. We // don't want to flood the manager thread with sem_post requests. - if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1) + if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1) { return; + } // Ctrl-C is pressed during error reporting, likely because the error // handler fails to abort. Let VM die immediately. @@ -2489,10 +2494,8 @@ void os::signal_raise(int signal_number) { ::raise(signal_number); } -/* - * The following code is moved from os.cpp for making this - * code platform specific, which it is by its very nature. - */ +// The following code is moved from os.cpp for making this +// code platform specific, which it is by its very nature. // Will be modified when max signal is changed to be dynamic int os::sigexitnum_pd() { @@ -2543,12 +2546,10 @@ static int check_pending_signals(bool wait) { // were we externally suspended while we were waiting? threadIsSuspended = thread->handle_special_suspend_equivalent_condition(); if (threadIsSuspended) { - // // The semaphore has been incremented, but while we were waiting // another thread suspended us. We don't want to continue running // while suspended because that would surprise the thread that // suspended us. - // ::sem_post(&sig_sem); thread->java_suspend_self(); @@ -2696,12 +2697,12 @@ void os::pd_commit_memory_or_exit(char* addr, size_t size, bool exec, // Define MAP_HUGETLB here so we can build HotSpot on old systems. #ifndef MAP_HUGETLB -#define MAP_HUGETLB 0x40000 + #define MAP_HUGETLB 0x40000 #endif // Define MADV_HUGEPAGE here so we can build HotSpot on old systems. #ifndef MADV_HUGEPAGE -#define MADV_HUGEPAGE 14 + #define MADV_HUGEPAGE 14 #endif int os::Linux::commit_memory_impl(char* addr, size_t size, @@ -2769,7 +2770,7 @@ void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { Linux::numa_tonode_memory(addr, bytes, lgrp_hint); } -bool os::numa_topology_changed() { return false; } +bool os::numa_topology_changed() { return false; } size_t os::numa_get_groups_num() { int max_node = Linux::numa_max_node(); @@ -2798,7 +2799,8 @@ bool os::get_page_info(char *start, page_info* info) { return false; } -char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) { +char *os::scan_pages(char *start, char* end, page_info* page_expected, + page_info* page_found) { return end; } @@ -2808,17 +2810,17 @@ int os::Linux::sched_getcpu_syscall(void) { int retval = -1; #if defined(IA32) -# ifndef SYS_getcpu -# define SYS_getcpu 318 -# endif + #ifndef SYS_getcpu + #define SYS_getcpu 318 + #endif retval = syscall(SYS_getcpu, &cpu, NULL, NULL); #elif defined(AMD64) // Unfortunately we have to bring all these macros here from vsyscall.h // to be able to compile on old linuxes. -# define __NR_vgetcpu 2 -# define VSYSCALL_START (-10UL << 20) -# define VSYSCALL_SIZE 1024 -# define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr)) + #define __NR_vgetcpu 2 + #define VSYSCALL_START (-10UL << 20) + #define VSYSCALL_SIZE 1024 + #define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr)) typedef long (*vgetcpu_t)(unsigned int *cpu, unsigned int *node, unsigned long *tcache); vgetcpu_t vgetcpu = (vgetcpu_t)VSYSCALL_ADDR(__NR_vgetcpu); retval = vgetcpu(&cpu, NULL, NULL); @@ -2851,8 +2853,10 @@ bool os::Linux::libnuma_init() { dlsym(RTLD_DEFAULT, "sched_getcpu"))); // If it's not, try a direct syscall. - if (sched_getcpu() == -1) - set_sched_getcpu(CAST_TO_FN_PTR(sched_getcpu_func_t, (void*)&sched_getcpu_syscall)); + if (sched_getcpu() == -1) { + set_sched_getcpu(CAST_TO_FN_PTR(sched_getcpu_func_t, + (void*)&sched_getcpu_syscall)); + } if (sched_getcpu() != -1) { // Does it work? void *handle = dlopen("libnuma.so.1", RTLD_LAZY); @@ -2944,8 +2948,7 @@ bool os::pd_uncommit_memory(char* addr, size_t size) { return res != (uintptr_t) MAP_FAILED; } -static -address get_stack_commited_bottom(address bottom, size_t size) { +static address get_stack_commited_bottom(address bottom, size_t size) { address nbot = bottom; address ntop = bottom + size; @@ -3019,7 +3022,6 @@ address get_stack_commited_bottom(address bottom, size_t size) { // mapping. This only affects the main/initial thread bool os::pd_create_stack_guard_pages(char* addr, size_t size) { - if (os::Linux::is_initial_thread()) { // As we manually grow stack up to bottom inside create_attached_thread(), // it's likely that os::Linux::initial_thread_stack_bottom is mapped and @@ -3156,7 +3158,8 @@ bool os::unguard_memory(char* addr, size_t size) { return linux_mprotect(addr, size, PROT_READ|PROT_WRITE); } -bool os::Linux::transparent_huge_pages_sanity_check(bool warn, size_t page_size) { +bool os::Linux::transparent_huge_pages_sanity_check(bool warn, + size_t page_size) { bool result = false; void *p = mmap(NULL, page_size * 2, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, @@ -3211,20 +3214,19 @@ bool os::Linux::hugetlbfs_sanity_check(bool warn, size_t page_size) { return result; } -/* -* Set the coredump_filter bits to include largepages in core dump (bit 6) -* -* From the coredump_filter documentation: -* -* - (bit 0) anonymous private memory -* - (bit 1) anonymous shared memory -* - (bit 2) file-backed private memory -* - (bit 3) file-backed shared memory -* - (bit 4) ELF header pages in file-backed private memory areas (it is -* effective only if the bit 2 is cleared) -* - (bit 5) hugetlb private memory -* - (bit 6) hugetlb shared memory -*/ +// Set the coredump_filter bits to include largepages in core dump (bit 6) +// +// From the coredump_filter documentation: +// +// - (bit 0) anonymous private memory +// - (bit 1) anonymous shared memory +// - (bit 2) file-backed private memory +// - (bit 3) file-backed shared memory +// - (bit 4) ELF header pages in file-backed private memory areas (it is +// effective only if the bit 2 is cleared) +// - (bit 5) hugetlb private memory +// - (bit 6) hugetlb shared memory +// static void set_coredump_filter(void) { FILE *f; long cdm; @@ -3377,10 +3379,11 @@ void os::large_page_init() { } #ifndef SHM_HUGETLB -#define SHM_HUGETLB 04000 + #define SHM_HUGETLB 04000 #endif -char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, char* req_addr, bool exec) { +char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, + char* req_addr, bool exec) { // "exec" is passed in but not used. Creating the shared image for // the code cache doesn't have an SHM_X executable permission to check. assert(UseLargePages && UseSHM, "only for SHM large pages"); @@ -3396,8 +3399,7 @@ char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, char bool warn_on_failure = UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) || !FLAG_IS_DEFAULT(UseSHM) || - !FLAG_IS_DEFAULT(LargePageSizeInBytes) - ); + !FLAG_IS_DEFAULT(LargePageSizeInBytes)); char msg[128]; // Create a large shared memory region to attach to based on size. @@ -3446,7 +3448,8 @@ char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, char return addr; } -static void warn_on_large_pages_failure(char* req_addr, size_t bytes, int error) { +static void warn_on_large_pages_failure(char* req_addr, size_t bytes, + int error) { assert(error == ENOMEM, "Only expect to fail if no memory is available"); bool warn_on_failure = UseLargePages && @@ -3462,7 +3465,9 @@ static void warn_on_large_pages_failure(char* req_addr, size_t bytes, int error) } } -char* os::Linux::reserve_memory_special_huge_tlbfs_only(size_t bytes, char* req_addr, bool exec) { +char* os::Linux::reserve_memory_special_huge_tlbfs_only(size_t bytes, + char* req_addr, + bool exec) { assert(UseLargePages && UseHugeTLBFS, "only for Huge TLBFS large pages"); assert(is_size_aligned(bytes, os::large_page_size()), "Unaligned size"); assert(is_ptr_aligned(req_addr, os::large_page_size()), "Unaligned address"); @@ -3482,7 +3487,10 @@ char* os::Linux::reserve_memory_special_huge_tlbfs_only(size_t bytes, char* req_ return addr; } -char* os::Linux::reserve_memory_special_huge_tlbfs_mixed(size_t bytes, size_t alignment, char* req_addr, bool exec) { +char* os::Linux::reserve_memory_special_huge_tlbfs_mixed(size_t bytes, + size_t alignment, + char* req_addr, + bool exec) { size_t large_page_size = os::large_page_size(); assert(bytes >= large_page_size, "Shouldn't allocate large pages for small sizes"); @@ -3574,7 +3582,10 @@ char* os::Linux::reserve_memory_special_huge_tlbfs_mixed(size_t bytes, size_t al return start; } -char* os::Linux::reserve_memory_special_huge_tlbfs(size_t bytes, size_t alignment, char* req_addr, bool exec) { +char* os::Linux::reserve_memory_special_huge_tlbfs(size_t bytes, + size_t alignment, + char* req_addr, + bool exec) { assert(UseLargePages && UseHugeTLBFS, "only for Huge TLBFS large pages"); assert(is_ptr_aligned(req_addr, alignment), "Must be"); assert(is_power_of_2(alignment), "Must be"); @@ -3588,7 +3599,8 @@ char* os::Linux::reserve_memory_special_huge_tlbfs(size_t bytes, size_t alignmen } } -char* os::reserve_memory_special(size_t bytes, size_t alignment, char* req_addr, bool exec) { +char* os::reserve_memory_special(size_t bytes, size_t alignment, + char* req_addr, bool exec) { assert(UseLargePages, "only for large pages"); char* addr; @@ -3758,7 +3770,6 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) { return ::read(fd, buf, nBytes); } -// // Short sleep, direct OS call. // // Note: certain versions of Linux CFS scheduler (since 2.6.23) do not guarantee @@ -3777,8 +3788,7 @@ void os::naked_short_sleep(jlong ms) { req.tv_sec = 0; if (ms > 0) { req.tv_nsec = (ms % 1000) * 1000000; - } - else { + } else { req.tv_nsec = 1; } @@ -3865,7 +3875,8 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) { return (ret == 0) ? OS_OK : OS_ERR; } -OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) { +OSReturn os::get_native_priority(const Thread* const thread, + int *priority_ptr) { if (!UseThreadPriorities || ThreadPriorityPolicy == 0) { *priority_ptr = java_to_os_priority[NormPriority]; return OS_OK; @@ -3902,19 +3913,18 @@ void os::hint_no_preempt() {} // - sends signal to end the sigsuspend loop in the SR_handler // // Note that the SR_lock plays no role in this suspend/resume protocol. -// static void resume_clear_context(OSThread *osthread) { osthread->set_ucontext(NULL); osthread->set_siginfo(NULL); } -static void suspend_save_context(OSThread *osthread, siginfo_t* siginfo, ucontext_t* context) { +static void suspend_save_context(OSThread *osthread, siginfo_t* siginfo, + ucontext_t* context) { osthread->set_ucontext(context); osthread->set_siginfo(siginfo); } -// // Handler function invoked when a thread's execution is suspended or // resumed. We have to be careful that only async-safe functions are // called here (Note: most pthread functions are not async safe and @@ -3984,7 +3994,7 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) { static int SR_initialize() { struct sigaction act; char *s; - /* Get signal number to use for suspend/resume */ + // Get signal number to use for suspend/resume if ((s = ::getenv("_JAVA_SR_SIGNUM")) != 0) { int sig = ::strtol(s, 0, 10); if (sig > 0 || sig < _NSIG) { @@ -3998,7 +4008,7 @@ static int SR_initialize() { sigemptyset(&SR_sigset); sigaddset(&SR_sigset, SR_signum); - /* Set up signal handler for suspend/resume */ + // Set up signal handler for suspend/resume act.sa_flags = SA_RESTART|SA_SIGINFO; act.sa_handler = (void (*)(int)) SR_handler; @@ -4124,9 +4134,10 @@ static void do_resume(OSThread* osthread) { // Note that the VM will print warnings if it detects conflicting signal // handlers, unless invoked with the option "-XX:+AllowUserSignalHandlers". // -extern "C" JNIEXPORT int -JVM_handle_linux_signal(int signo, siginfo_t* siginfo, - void* ucontext, int abort_if_unrecognized); +extern "C" JNIEXPORT int JVM_handle_linux_signal(int signo, + siginfo_t* siginfo, + void* ucontext, + int abort_if_unrecognized); void signalHandler(int sig, siginfo_t* info, void* uc) { assert(info != NULL && uc != NULL, "it must be old kernel"); @@ -4375,7 +4386,7 @@ jlong os::Linux::fast_thread_cpu_time(clockid_t clockid) { // We will never set this flag, and we should // ignore this flag in our diagnostic #ifdef SIGNIFICANT_SIGNAL_MASK -#undef SIGNIFICANT_SIGNAL_MASK + #undef SIGNIFICANT_SIGNAL_MASK #endif #define SIGNIFICANT_SIGNAL_MASK (~0x04000000) @@ -4447,15 +4458,17 @@ static void print_signal_handler(outputStream* st, int sig, } -#define DO_SIGNAL_CHECK(sig) \ - if (!sigismember(&check_signal_done, sig)) \ - os::Linux::check_signal_handler(sig) +#define DO_SIGNAL_CHECK(sig) \ + do { \ + if (!sigismember(&check_signal_done, sig)) { \ + os::Linux::check_signal_handler(sig); \ + } \ + } while (0) // This method is a periodic task to check for misbehaving JNI applications // under CheckJNI, we can add any periodic checks here void os::run_periodic_checks() { - if (check_signals == false) return; // SEGV and BUS if overridden could potentially prevent @@ -4566,7 +4579,8 @@ void os::Linux::check_signal_handler(int sig) { } } -extern void report_error(char* file_name, int line_no, char* title, char* format, ...); +extern void report_error(char* file_name, int line_no, char* title, + char* format, ...); extern bool signal_name(int signo, char* buf, size_t len); @@ -4584,7 +4598,7 @@ const char* os::exception_name(int exception_code, char* buf, size_t size) { // this is called _before_ the most of global arguments have been parsed void os::init(void) { - char dummy; /* used to get a guess on initial stack address */ + char dummy; // used to get a guess on initial stack address // first_hrtime = gethrtime(); // With LinuxThreads the JavaMain thread pid (primordial thread) @@ -4657,8 +4671,7 @@ extern "C" { } // this is called _after_ the global arguments have been parsed -jint os::init_2(void) -{ +jint os::init_2(void) { Linux::fast_thread_clock_init(); // Allocate a single page and mark it as readable for safepoint polling @@ -4668,8 +4681,10 @@ jint os::init_2(void) os::set_polling_page(polling_page); #ifndef PRODUCT - if (Verbose && PrintMiscellaneous) - tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page); + if (Verbose && PrintMiscellaneous) { + tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", + (intptr_t)polling_page); + } #endif if (!UseMembar) { @@ -4678,8 +4693,10 @@ jint os::init_2(void) os::set_memory_serialize_page(mem_serialize_page); #ifndef PRODUCT - if (Verbose && PrintMiscellaneous) - tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page); + if (Verbose && PrintMiscellaneous) { + tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", + (intptr_t)mem_serialize_page); + } #endif } @@ -4767,14 +4784,16 @@ jint os::init_2(void) struct rlimit nbr_files; int status = getrlimit(RLIMIT_NOFILE, &nbr_files); if (status != 0) { - if (PrintMiscellaneous && (Verbose || WizardMode)) + if (PrintMiscellaneous && (Verbose || WizardMode)) { perror("os::init_2 getrlimit failed"); + } } else { nbr_files.rlim_cur = nbr_files.rlim_max; status = setrlimit(RLIMIT_NOFILE, &nbr_files); if (status != 0) { - if (PrintMiscellaneous && (Verbose || WizardMode)) + if (PrintMiscellaneous && (Verbose || WizardMode)) { perror("os::init_2 setrlimit failed"); + } } } } @@ -4820,16 +4839,17 @@ void os::init_3(void) { // Mark the polling page as unreadable void os::make_polling_page_unreadable(void) { - if (!guard_memory((char*)_polling_page, Linux::page_size())) + if (!guard_memory((char*)_polling_page, Linux::page_size())) { fatal("Could not disable polling page"); -}; + } +} // Mark the polling page as readable void os::make_polling_page_readable(void) { if (!linux_mprotect((char *)_polling_page, Linux::page_size(), PROT_READ)) { fatal("Could not enable polling page"); } -}; +} int os::active_processor_count() { // Linux doesn't yet have a (official) notion of processor sets, @@ -4902,8 +4922,9 @@ ExtendedPC os::get_thread_pc(Thread* thread) { return fetcher.result(); } -int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime) -{ +int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond, + pthread_mutex_t *_mutex, + const struct timespec *_abstime) { if (is_NPTL()) { return pthread_cond_timedwait(_cond, _mutex, _abstime); } else { @@ -4950,8 +4971,9 @@ bool os::find(address addr, outputStream* st) { if (begin < lowest) begin = lowest; Dl_info dlinfo2; if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr - && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) + && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) { end = (address) dlinfo2.dli_saddr; + } Disassembler::decode(begin, end, st); } return true; @@ -5007,7 +5029,8 @@ bool os::check_heap(bool force) { return true; } -int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) { +int local_vsnprintf(char* buf, size_t count, const char* format, + va_list args) { return ::vsnprintf(buf, count, format, args); } @@ -5019,7 +5042,7 @@ bool os::dir_is_empty(const char* path) { dir = opendir(path); if (dir == NULL) return true; - /* Scan the directory */ + // Scan the directory bool result = true; char buf[sizeof(struct dirent) + MAX_PATH]; while (result && (ptr = ::readdir(dir)) != NULL) { @@ -5035,7 +5058,7 @@ bool os::dir_is_empty(const char* path) { // from src/solaris/hpi/src/system_md.c #ifndef O_DELETE -#define O_DELETE 0x10000 + #define O_DELETE 0x10000 #endif // Open a file. Unlink the file immediately after open returns @@ -5043,7 +5066,6 @@ bool os::dir_is_empty(const char* path) { // O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c int os::open(const char *path, int oflag, int mode) { - if (strlen(path) > MAX_PATH - 1) { errno = ENAMETOOLONG; return -1; @@ -5073,33 +5095,33 @@ int os::open(const char *path, int oflag, int mode) { } } - /* - * All file descriptors that are opened in the JVM and not - * specifically destined for a subprocess should have the - * close-on-exec flag set. If we don't set it, then careless 3rd - * party native code might fork and exec without closing all - * appropriate file descriptors (e.g. as we do in closeDescriptors in - * UNIXProcess.c), and this in turn might: - * - * - cause end-of-file to fail to be detected on some file - * descriptors, resulting in mysterious hangs, or - * - * - might cause an fopen in the subprocess to fail on a system - * suffering from bug 1085341. - * - * (Yes, the default setting of the close-on-exec flag is a Unix - * design flaw) - * - * See: - * 1085341: 32-bit stdio routines should support file descriptors >255 - * 4843136: (process) pipe file descriptor from Runtime.exec not being closed - * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9 - */ + // All file descriptors that are opened in the JVM and not + // specifically destined for a subprocess should have the + // close-on-exec flag set. If we don't set it, then careless 3rd + // party native code might fork and exec without closing all + // appropriate file descriptors (e.g. as we do in closeDescriptors in + // UNIXProcess.c), and this in turn might: + // + // - cause end-of-file to fail to be detected on some file + // descriptors, resulting in mysterious hangs, or + // + // - might cause an fopen in the subprocess to fail on a system + // suffering from bug 1085341. + // + // (Yes, the default setting of the close-on-exec flag is a Unix + // design flaw) + // + // See: + // 1085341: 32-bit stdio routines should support file descriptors >255 + // 4843136: (process) pipe file descriptor from Runtime.exec not being closed + // 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9 + // #ifdef FD_CLOEXEC { int flags = ::fcntl(fd, F_GETFD); - if (flags != -1) + if (flags != -1) { ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC); + } } #endif @@ -5140,11 +5162,9 @@ int os::available(int fd, jlong *bytes) { if (::fstat64(fd, &buf64) >= 0) { mode = buf64.st_mode; if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) { - /* - * XXX: is the following call interruptible? If so, this might - * need to go through the INTERRUPT_IO() wrapper as for other - * blocking, interruptible calls in this file. - */ + // XXX: is the following call interruptible? If so, this might + // need to go through the INTERRUPT_IO() wrapper as for other + // blocking, interruptible calls in this file. int n; if (::ioctl(fd, FIONREAD, &n) >= 0) { *bytes = n; @@ -5270,10 +5290,7 @@ jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { } } -// // -1 on error. -// - static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { pid_t tid = thread->osthread()->thread_id(); char *s; @@ -5606,35 +5623,31 @@ void os::PlatformEvent::unpark() { // JSR166 // ------------------------------------------------------- -/* - * The solaris and linux implementations of park/unpark are fairly - * conservative for now, but can be improved. They currently use a - * mutex/condvar pair, plus a a count. - * Park decrements count if > 0, else does a condvar wait. Unpark - * sets count to 1 and signals condvar. Only one thread ever waits - * on the condvar. Contention seen when trying to park implies that someone - * is unparking you, so don't wait. And spurious returns are fine, so there - * is no need to track notifications. - */ +// The solaris and linux implementations of park/unpark are fairly +// conservative for now, but can be improved. They currently use a +// mutex/condvar pair, plus a a count. +// Park decrements count if > 0, else does a condvar wait. Unpark +// sets count to 1 and signals condvar. Only one thread ever waits +// on the condvar. Contention seen when trying to park implies that someone +// is unparking you, so don't wait. And spurious returns are fine, so there +// is no need to track notifications. -/* - * This code is common to linux and solaris and will be moved to a - * common place in dolphin. - * - * The passed in time value is either a relative time in nanoseconds - * or an absolute time in milliseconds. Either way it has to be unpacked - * into suitable seconds and nanoseconds components and stored in the - * given timespec structure. - * Given time is a 64-bit value and the time_t used in the timespec is only - * a signed-32-bit value (except on 64-bit Linux) we have to watch for - * overflow if times way in the future are given. Further on Solaris versions - * prior to 10 there is a restriction (see cond_timedwait) that the specified - * number of seconds, in abstime, is less than current_time + 100,000,000. - * As it will be 28 years before "now + 100000000" will overflow we can - * ignore overflow and just impose a hard-limit on seconds using the value - * of "now + 100,000,000". This places a limit on the timeout of about 3.17 - * years from "now". - */ +// This code is common to linux and solaris and will be moved to a +// common place in dolphin. +// +// The passed in time value is either a relative time in nanoseconds +// or an absolute time in milliseconds. Either way it has to be unpacked +// into suitable seconds and nanoseconds components and stored in the +// given timespec structure. +// Given time is a 64-bit value and the time_t used in the timespec is only +// a signed-32-bit value (except on 64-bit Linux) we have to watch for +// overflow if times way in the future are given. Further on Solaris versions +// prior to 10 there is a restriction (see cond_timedwait) that the specified +// number of seconds, in abstime, is less than current_time + 100,000,000. +// As it will be 28 years before "now + 100000000" will overflow we can +// ignore overflow and just impose a hard-limit on seconds using the value +// of "now + 100,000,000". This places a limit on the timeout of about 3.17 +// years from "now". static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) { assert(time > 0, "convertTime"); @@ -5805,14 +5818,14 @@ void Parker::unpark() { if (_cur_index != -1) { // thread is definitely parked if (WorkAroundNPTLTimedWaitHang) { - status = pthread_cond_signal (&_cond[_cur_index]); + status = pthread_cond_signal(&_cond[_cur_index]); assert(status == 0, "invariant"); status = pthread_mutex_unlock(_mutex); assert(status == 0, "invariant"); } else { status = pthread_mutex_unlock(_mutex); assert(status == 0, "invariant"); - status = pthread_cond_signal (&_cond[_cur_index]); + status = pthread_cond_signal(&_cond[_cur_index]); assert(status == 0, "invariant"); } } else { @@ -5829,11 +5842,11 @@ void Parker::unpark() { extern char** environ; #ifndef __NR_fork -#define __NR_fork IA32_ONLY(2) IA64_ONLY(not defined) AMD64_ONLY(57) + #define __NR_fork IA32_ONLY(2) IA64_ONLY(not defined) AMD64_ONLY(57) #endif #ifndef __NR_execve -#define __NR_execve IA32_ONLY(11) IA64_ONLY(1033) AMD64_ONLY(59) + #define __NR_execve IA32_ONLY(11) IA64_ONLY(1033) AMD64_ONLY(59) #endif // Run the specified command in a separate process. Return its exit value, @@ -5925,13 +5938,19 @@ bool os::is_headless_jre() { // Get rid of libjvm.so p = strrchr(buf, '/'); - if (p == NULL) return false; - else *p = '\0'; + if (p == NULL) { + return false; + } else { + *p = '\0'; + } // Get rid of client or server p = strrchr(buf, '/'); - if (p == NULL) return false; - else *p = '\0'; + if (p == NULL) { + return false; + } else { + *p = '\0'; + } // check xawt/libmawt.so strcpy(libmawtpath, buf); @@ -6018,12 +6037,11 @@ void MemNotifyThread::run() { } } -// // See if the /dev/mem_notify device exists, and if so, start a thread to monitor it. // void MemNotifyThread::start() { - int fd; - fd = open ("/dev/mem_notify", O_RDONLY, 0); + int fd; + fd = open("/dev/mem_notify", O_RDONLY, 0); if (fd < 0) { return; } @@ -6040,12 +6058,12 @@ void MemNotifyThread::start() { #ifndef PRODUCT -#define test_log(...) \ - do {\ - if (VerboseInternalVMTests) { \ - tty->print_cr(__VA_ARGS__); \ - tty->flush(); \ - }\ +#define test_log(...) \ + do { \ + if (VerboseInternalVMTests) { \ + tty->print_cr(__VA_ARGS__); \ + tty->flush(); \ + } \ } while (false) class TestReserveMemorySpecial : AllStatic { diff --git a/hotspot/src/os/linux/vm/os_linux.hpp b/hotspot/src/os/linux/vm/os_linux.hpp index f972ae461cc..cab540456be 100644 --- a/hotspot/src/os/linux/vm/os_linux.hpp +++ b/hotspot/src/os/linux/vm/os_linux.hpp @@ -27,8 +27,8 @@ // Linux_OS defines the interface to Linux operating systems -/* pthread_getattr_np comes with LinuxThreads-0.9-7 on RedHat 7.1 */ -typedef int (*pthread_getattr_func_type) (pthread_t, pthread_attr_t *); +// pthread_getattr_np comes with LinuxThreads-0.9-7 on RedHat 7.1 +typedef int (*pthread_getattr_func_type)(pthread_t, pthread_attr_t *); // Information about the protection of the page at address '0' on this os. static bool zero_page_read_protected() { return true; } @@ -302,9 +302,9 @@ class PlatformEvent : public CHeapObj { public: PlatformEvent() { int status; - status = pthread_cond_init (_cond, os::Linux::condAttr()); + status = pthread_cond_init(_cond, os::Linux::condAttr()); assert_status(status == 0, status, "cond_init"); - status = pthread_mutex_init (_mutex, NULL); + status = pthread_mutex_init(_mutex, NULL); assert_status(status == 0, status, "mutex_init"); _Event = 0; _nParked = 0; @@ -336,11 +336,11 @@ class PlatformParker : public CHeapObj { public: PlatformParker() { int status; - status = pthread_cond_init (&_cond[REL_INDEX], os::Linux::condAttr()); + status = pthread_cond_init(&_cond[REL_INDEX], os::Linux::condAttr()); assert_status(status == 0, status, "cond_init rel"); - status = pthread_cond_init (&_cond[ABS_INDEX], NULL); + status = pthread_cond_init(&_cond[ABS_INDEX], NULL); assert_status(status == 0, status, "cond_init abs"); - status = pthread_mutex_init (_mutex, NULL); + status = pthread_mutex_init(_mutex, NULL); assert_status(status == 0, status, "mutex_init"); _cur_index = -1; // mark as unused } diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 379fff39073..72b9f8b0ce4 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -124,17 +124,17 @@ // compile on older systems without this header file. #ifndef MADV_ACCESS_LWP -# define MADV_ACCESS_LWP 7 /* next LWP to access heavily */ + #define MADV_ACCESS_LWP 7 /* next LWP to access heavily */ #endif #ifndef MADV_ACCESS_MANY -# define MADV_ACCESS_MANY 8 /* many processes to access heavily */ + #define MADV_ACCESS_MANY 8 /* many processes to access heavily */ #endif #ifndef LGRP_RSRC_CPU -# define LGRP_RSRC_CPU 0 /* CPU resources */ + #define LGRP_RSRC_CPU 0 /* CPU resources */ #endif #ifndef LGRP_RSRC_MEM -# define LGRP_RSRC_MEM 1 /* memory resources */ + #define LGRP_RSRC_MEM 1 /* memory resources */ #endif // see thr_setprio(3T) for the basis of these numbers @@ -190,7 +190,7 @@ static void unpackTime(timespec* absTime, bool isAbsolute, jlong time); Thread* ThreadLocalStorage::_get_thread_cache[ThreadLocalStorage::_pd_cache_size] = {NULL}; #ifndef PRODUCT -#define _PCT(n,d) ((100.0*(double)(n))/(double)(d)) + #define _PCT(n,d) ((100.0*(double)(n))/(double)(d)) int ThreadLocalStorage::_tcacheHit = 0; int ThreadLocalStorage::_tcacheMiss = 0; @@ -200,7 +200,7 @@ void ThreadLocalStorage::print_statistics() { tty->print_cr("Thread cache hits %d misses %d total %d percent %f\n", _tcacheHit, _tcacheMiss, total, _PCT(_tcacheHit, total)); } -#undef _PCT + #undef _PCT #endif // PRODUCT Thread* ThreadLocalStorage::get_thread_via_cache_slowly(uintptr_t raw_id, @@ -356,8 +356,9 @@ static volatile hrtime_t max_hrtime = 0; void os::Solaris::initialize_system_info() { set_processor_count(sysconf(_SC_NPROCESSORS_CONF)); - _processors_online = sysconf (_SC_NPROCESSORS_ONLN); - _physical_memory = (julong)sysconf(_SC_PHYS_PAGES) * (julong)sysconf(_SC_PAGESIZE); + _processors_online = sysconf(_SC_NPROCESSORS_ONLN); + _physical_memory = (julong)sysconf(_SC_PHYS_PAGES) * + (julong)sysconf(_SC_PAGESIZE); } int os::active_processor_count() { @@ -556,9 +557,8 @@ bool os::bind_to_processor(uint processor_id) { bool os::getenv(const char* name, char* buffer, int len) { char* val = ::getenv(name); - if (val == NULL - || strlen(val) + 1 > len ) { - if (len > 0) buffer[0] = 0; // return a null string + if (val == NULL || strlen(val) + 1 > len) { + if (len > 0) buffer[0] = 0; // return a null string return false; } strcpy(buffer, val); @@ -780,8 +780,7 @@ void os::breakpoint() { BREAKPOINT; } -bool os::obsolete_option(const JavaVMOption *option) -{ +bool os::obsolete_option(const JavaVMOption *option) { if (!strncmp(option->optionString, "-Xt", 3)) { return true; } else if (!strncmp(option->optionString, "-Xtm", 4)) { @@ -906,7 +905,6 @@ static OSThread* create_os_thread(Thread* thread, thread_t thread_id) { } void os::Solaris::hotspot_sigmask(Thread* thread) { - //Save caller's signal mask sigset_t sigmask; thr_sigsetmask(SIG_SETMASK, NULL, &sigmask); @@ -970,7 +968,8 @@ bool os::create_main_thread(JavaThread* thread) { } -bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { +bool os::create_thread(Thread* thread, ThreadType thr_type, + size_t stack_size) { // Allocate the OSThread object OSThread* osthread = new OSThread(NULL, NULL); if (osthread == NULL) { @@ -1088,14 +1087,14 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { return true; } -/* defined for >= Solaris 10. This allows builds on earlier versions - * of Solaris to take advantage of the newly reserved Solaris JVM signals - * With SIGJVM1, SIGJVM2, INTERRUPT_SIGNAL is SIGJVM1, ASYNC_SIGNAL is SIGJVM2 - * and -XX:+UseAltSigs does nothing since these should have no conflict - */ +// defined for >= Solaris 10. This allows builds on earlier versions +// of Solaris to take advantage of the newly reserved Solaris JVM signals +// With SIGJVM1, SIGJVM2, INTERRUPT_SIGNAL is SIGJVM1, ASYNC_SIGNAL is SIGJVM2 +// and -XX:+UseAltSigs does nothing since these should have no conflict +// #if !defined(SIGJVM1) -#define SIGJVM1 39 -#define SIGJVM2 40 + #define SIGJVM1 39 + #define SIGJVM2 40 #endif debug_only(static bool signal_sets_initialized = false); @@ -1108,10 +1107,11 @@ bool os::Solaris::is_sig_ignored(int sig) { sigaction(sig, (struct sigaction*)NULL, &oact); void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction) : CAST_FROM_FN_PTR(void*, oact.sa_handler); - if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) + if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) { return true; - else + } else { return false; + } } // Note: SIGRTMIN is a macro that calls sysconf() so it will @@ -1173,8 +1173,9 @@ void os::Solaris::signal_sets_init() { } // Fill in signals that are blocked by all but the VM thread. sigemptyset(&vm_sigs); - if (!ReduceSignalUsage) + if (!ReduceSignalUsage) { sigaddset(&vm_sigs, BREAK_SIGNAL); + } debug_only(signal_sets_initialized = true); // For diagnostics only used in run_periodic_checks @@ -1244,14 +1245,13 @@ void os::initialize_thread(Thread* thr) { assert(stack_size > 0, "Stack size calculation problem"); if (stack_size > jt->stack_size()) { - NOT_PRODUCT( - struct rlimit limits; - getrlimit(RLIMIT_STACK, &limits); - size_t size = adjust_stack_size(base, (size_t)limits.rlim_cur); - assert(size >= jt->stack_size(), "Stack size problem in main thread"); - ) - tty->print_cr( - "Stack size of %d Kb exceeds current limit of %d Kb.\n" +#ifndef PRODUCT + struct rlimit limits; + getrlimit(RLIMIT_STACK, &limits); + size_t size = adjust_stack_size(base, (size_t)limits.rlim_cur); + assert(size >= jt->stack_size(), "Stack size problem in main thread"); +#endif + tty->print_cr("Stack size of %d Kb exceeds current limit of %d Kb.\n" "(Stack sizes are rounded up to a multiple of the system page size.)\n" "See limit(1) to increase the stack size limit.", stack_size / K, jt->stack_size() / K); @@ -1325,20 +1325,23 @@ int os::allocate_thread_local_storage() { // JavaThread in Java code, and have stubs simply // treat %g2 as a caller-save register, preserving it in a %lN. thread_key_t tk; - if (thr_keycreate( &tk, NULL)) + if (thr_keycreate(&tk, NULL)) { fatal(err_msg("os::allocate_thread_local_storage: thr_keycreate failed " "(%s)", strerror(errno))); + } return int(tk); } void os::free_thread_local_storage(int index) { // %%% don't think we need anything here - // if ( pthread_key_delete((pthread_key_t) tk) ) + // if (pthread_key_delete((pthread_key_t) tk)) { // fatal("os::free_thread_local_storage: pthread_key_delete failed"); + // } } -#define SMALLINT 32 // libthread allocate for tsd_common is a version specific +// libthread allocate for tsd_common is a version specific // small number - point is NO swap space available +#define SMALLINT 32 void os::thread_local_storage_at_put(int index, void* value) { // %%% this is used only in threadLocalStorage.cpp if (thr_setspecific((thread_key_t)index, value)) { @@ -1431,29 +1434,31 @@ bool os::supports_vtime() { return true; } bool os::enable_vtime() { int fd = ::open("/proc/self/ctl", O_WRONLY); - if (fd == -1) + if (fd == -1) { return false; + } long cmd[] = { PCSET, PR_MSACCT }; int res = ::write(fd, cmd, sizeof(long) * 2); ::close(fd); - if (res != sizeof(long) * 2) + if (res != sizeof(long) * 2) { return false; - + } return true; } bool os::vtime_enabled() { int fd = ::open("/proc/self/status", O_RDONLY); - if (fd == -1) + if (fd == -1) { return false; + } pstatus_t status; int res = os::read(fd, (void*) &status, sizeof(pstatus_t)); ::close(fd); - if (res != sizeof(pstatus_t)) + if (res != sizeof(pstatus_t)) { return false; - + } return status.pr_flags & PR_MSACCT; } @@ -1471,8 +1476,9 @@ jlong getTimeMillis() { // Must return millis since Jan 1 1970 for JVM_CurrentTimeMillis jlong os::javaTimeMillis() { timeval t; - if (gettimeofday( &t, NULL) == -1) + if (gettimeofday(&t, NULL) == -1) { fatal(err_msg("os::javaTimeMillis: gettimeofday (%s)", strerror(errno))); + } return jlong(t.tv_sec) * 1000 + jlong(t.tv_usec) / 1000; } @@ -1625,7 +1631,7 @@ bool os::address_is_in_vm(address addr) { return false; } -typedef int (*dladdr1_func_type) (void *, Dl_info *, void **, int); +typedef int (*dladdr1_func_type)(void *, Dl_info *, void **, int); static dladdr1_func_type dladdr1_func = NULL; bool os::dll_address_to_function_name(address addr, char *buf, @@ -1643,9 +1649,9 @@ bool os::dll_address_to_function_name(address addr, char *buf, // available even if the vm is built on a machine that does // not have dladdr1 support. Make sure there is a value for // RTLD_DL_SYMENT. - #ifndef RTLD_DL_SYMENT - #define RTLD_DL_SYMENT 1 - #endif +#ifndef RTLD_DL_SYMENT + #define RTLD_DL_SYMENT 1 +#endif #ifdef _LP64 Elf64_Sym * info; #else @@ -1763,8 +1769,7 @@ void os::print_dll_info(outputStream * st) { // in case of error it checks if .dll/.so was built for the // same architecture as Hotspot is running on -void * os::dll_load(const char *filename, char *ebuf, int ebuflen) -{ +void * os::dll_load(const char *filename, char *ebuf, int ebuflen) { void * result= ::dlopen(filename, RTLD_LAZY); if (result != NULL) { // Successful loading @@ -1824,26 +1829,26 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {EM_ARM, EM_ARM, ELFCLASS32, ELFDATA2LSB, (char*)"ARM 32"} }; - #if (defined IA32) +#if (defined IA32) static Elf32_Half running_arch_code=EM_386; - #elif (defined AMD64) +#elif (defined AMD64) static Elf32_Half running_arch_code=EM_X86_64; - #elif (defined IA64) +#elif (defined IA64) static Elf32_Half running_arch_code=EM_IA_64; - #elif (defined __sparc) && (defined _LP64) +#elif (defined __sparc) && (defined _LP64) static Elf32_Half running_arch_code=EM_SPARCV9; - #elif (defined __sparc) && (!defined _LP64) +#elif (defined __sparc) && (!defined _LP64) static Elf32_Half running_arch_code=EM_SPARC; - #elif (defined __powerpc64__) +#elif (defined __powerpc64__) static Elf32_Half running_arch_code=EM_PPC64; - #elif (defined __powerpc__) +#elif (defined __powerpc__) static Elf32_Half running_arch_code=EM_PPC; - #elif (defined ARM) +#elif (defined ARM) static Elf32_Half running_arch_code=EM_ARM; - #else - #error Method os::dll_load requires that one of following is defined:\ - IA32, AMD64, IA64, __sparc, __powerpc__, ARM, ARM - #endif +#else + #error Method os::dll_load requires that one of following is defined:\ + IA32, AMD64, IA64, __sparc, __powerpc__, ARM, ARM +#endif // Identify compatability class for VM's architecture and library's architecture // Obtain string descriptions for architectures @@ -2219,7 +2224,6 @@ void os::print_jni_name_suffix_on(outputStream* st, int args_size) { // from src/solaris/hpi/src/system_md.c size_t os::lasterror(char *buf, size_t len) { - if (errno == 0) return 0; const char *s = ::strerror(errno); @@ -2314,9 +2318,10 @@ void* os::signal(int signal_number, void* handler) { sigAct.sa_flags = SA_RESTART & ~SA_RESETHAND; sigAct.sa_handler = CAST_TO_FN_PTR(sa_handler_t, handler); - if (sigaction(signal_number, &sigAct, &oldSigAct)) + if (sigaction(signal_number, &sigAct, &oldSigAct)) { // -1 means registration failed return (void *)-1; + } return CAST_FROM_FN_PTR(void*, oldSigAct.sa_handler); } @@ -2325,10 +2330,8 @@ void os::signal_raise(int signal_number) { raise(signal_number); } -/* - * The following code is moved from os.cpp for making this - * code platform specific, which it is by its very nature. - */ +// The following code is moved from os.cpp for making this +// code platform specific, which it is by its very nature. // a counter for each possible signal value static int Sigexit = 0; @@ -2366,7 +2369,7 @@ void os::Solaris::init_signal_mem() { preinstalled_sigs = (int *)os::malloc(sizeof(int) * (Maxsignum + 1), mtInternal); memset(preinstalled_sigs, 0, (sizeof(int) * (Maxsignum + 1))); } - ourSigFlags = (int*)malloc(sizeof(int) * (Maxsignum + 1 ), mtInternal); + ourSigFlags = (int*)malloc(sizeof(int) * (Maxsignum + 1), mtInternal); memset(ourSigFlags, 0, sizeof(int) * (Maxsignum + 1)); } @@ -2411,12 +2414,10 @@ static int check_pending_signals(bool wait_for_signal) { // were we externally suspended while we were waiting? threadIsSuspended = thread->handle_special_suspend_equivalent_condition(); if (threadIsSuspended) { - // // The semaphore has been incremented, but while we were waiting // another thread suspended us. We don't want to continue running // while suspended because that would surprise the thread that // suspended us. - // ret = ::sema_post(&sig_sem); assert(ret == 0, "sema_post() failed"); @@ -2714,7 +2715,8 @@ bool os::get_page_info(char *start, page_info* info) { // Scan the pages from start to end until a page different than // the one described in the info parameter is encountered. -char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) { +char *os::scan_pages(char *start, char* end, page_info* page_expected, + page_info* page_found) { const uint_t info_types[] = { MEMINFO_VLGRP, MEMINFO_VPAGESIZE }; const size_t types = sizeof(info_types) / sizeof(info_types[0]); uint64_t addrs[MAX_MEMINFO_CNT], outdata[types * MAX_MEMINFO_CNT + 1]; @@ -2741,8 +2743,7 @@ char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info if (outdata[types * i + 1] != page_expected->size) { break; } - } else - if (page_expected->size != 0) { + } else if (page_expected->size != 0) { break; } @@ -2795,11 +2796,13 @@ char* os::Solaris::mmap_chunk(char *addr, size_t size, int flags, int prot) { return b; } -char* os::Solaris::anon_mmap(char* requested_addr, size_t bytes, size_t alignment_hint, bool fixed) { +char* os::Solaris::anon_mmap(char* requested_addr, size_t bytes, + size_t alignment_hint, bool fixed) { char* addr = requested_addr; int flags = MAP_PRIVATE | MAP_NORESERVE; - assert(!(fixed && (alignment_hint > 0)), "alignment hint meaningless with fixed mmap"); + assert(!(fixed && (alignment_hint > 0)), + "alignment hint meaningless with fixed mmap"); if (fixed) { flags |= MAP_FIXED; @@ -2814,8 +2817,10 @@ char* os::Solaris::anon_mmap(char* requested_addr, size_t bytes, size_t alignmen return mmap_chunk(addr, bytes, flags, PROT_NONE); } -char* os::pd_reserve_memory(size_t bytes, char* requested_addr, size_t alignment_hint) { - char* addr = Solaris::anon_mmap(requested_addr, bytes, alignment_hint, (requested_addr != NULL)); +char* os::pd_reserve_memory(size_t bytes, char* requested_addr, + size_t alignment_hint) { + char* addr = Solaris::anon_mmap(requested_addr, bytes, alignment_hint, + (requested_addr != NULL)); guarantee(requested_addr == NULL || requested_addr == addr, "OS failed to return requested mmap address."); @@ -3080,7 +3085,8 @@ void os::large_page_init() { } } -bool os::Solaris::setup_large_pages(caddr_t start, size_t bytes, size_t align) { +bool os::Solaris::setup_large_pages(caddr_t start, size_t bytes, + size_t align) { // Signal to OS that we want large pages for addresses // from addr, addr + bytes struct memcntl_mha mpss_struct; @@ -3095,7 +3101,8 @@ bool os::Solaris::setup_large_pages(caddr_t start, size_t bytes, size_t align) { return true; } -char* os::reserve_memory_special(size_t size, size_t alignment, char* addr, bool exec) { +char* os::reserve_memory_special(size_t size, size_t alignment, char* addr, + bool exec) { fatal("os::reserve_memory_special should not be called on Solaris."); return NULL; } @@ -3160,14 +3167,14 @@ bool os::dont_yield() { static hrtime_t last_time = 0; hrtime_t diff = getTimeNanos() - last_time; - if (diff < DontYieldALotInterval * 1000000) + if (diff < DontYieldALotInterval * 1000000) { return true; + } last_time += diff; return false; - } - else { + } else { return false; } } @@ -3362,8 +3369,10 @@ static int lwp_priocntl_init() { myMax = MIN2(myMax, (int)fxInfo->fx_uprilim); // clamp - restrict } else { // No clue - punt - if (ThreadPriorityVerbose) - tty->print_cr("Unknown scheduling class: %s ... \n", ClassInfo.pc_clname); + if (ThreadPriorityVerbose) { + tty->print_cr("Unknown scheduling class: %s ... \n", + ClassInfo.pc_clname); + } return EINVAL; // no clue, punt } @@ -3386,9 +3395,7 @@ static int lwp_priocntl_init() { // Convert from the libthread "thr_setprio" scale to our current // lwp scheduling class scale. // -static -int scale_to_lwp_priority (int rMin, int rMax, int x) -{ +static int scale_to_lwp_priority(int rMin, int rMax, int x) { int v; if (x == 127) return rMax; // avoid round-down @@ -3415,8 +3422,9 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid, // If something went wrong on init, don't change priorities. if (!priocntl_enable) { - if (ThreadPriorityVerbose) + if (ThreadPriorityVerbose) { tty->print_cr("Trying to set priority but init failed, ignoring"); + } return EINVAL; } @@ -3578,7 +3586,6 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid, // Maximum priority an so on. This will cause VM threads // to get unfair treatment against other Solaris processes // which do not explicitly alter their thread priorities. -// int os::java_to_os_priority[CriticalPriority + 1] = { -99999, // 0 Entry should never be used @@ -3641,7 +3648,8 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) { } -OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) { +OSReturn os::get_native_priority(const Thread* const thread, + int *priority_ptr) { int p; if (!UseThreadPriorities) { *priority_ptr = NormalPriority; @@ -3870,7 +3878,9 @@ ExtendedPC os::get_thread_pc(Thread* thread) { // This does not do anything on Solaris. This is basically a hook for being // able to use structured exception handling (thread-local exception filters) on, e.g., Win32. -void os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread) { +void os::os_exception_wrapper(java_call_t f, JavaValue* value, + methodHandle* method, JavaCallArguments* args, + Thread* thread) { f(value, method, args, thread); } @@ -3901,9 +3911,10 @@ void os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* met // Note that the VM will print warnings if it detects conflicting signal // handlers, unless invoked with the option "-XX:+AllowUserSignalHandlers". // -extern "C" JNIEXPORT int -JVM_handle_solaris_signal(int signo, siginfo_t* siginfo, void* ucontext, - int abort_if_unrecognized); +extern "C" JNIEXPORT int JVM_handle_solaris_signal(int signo, + siginfo_t* siginfo, + void* ucontext, + int abort_if_unrecognized); void signalHandler(int sig, siginfo_t* info, void* ucVoid) { @@ -3912,11 +3923,11 @@ void signalHandler(int sig, siginfo_t* info, void* ucVoid) { errno = orig_errno; } -/* Do not delete - if guarantee is ever removed, a signal handler (even empty) - is needed to provoke threads blocked on IO to return an EINTR - Note: this explicitly does NOT call JVM_handle_solaris_signal and - does NOT participate in signal chaining due to requirement for - NOT setting SA_RESTART to make EINTR work. */ +// Do not delete - if guarantee is ever removed, a signal handler (even empty) +// is needed to provoke threads blocked on IO to return an EINTR +// Note: this explicitly does NOT call JVM_handle_solaris_signal and +// does NOT participate in signal chaining due to requirement for +// NOT setting SA_RESTART to make EINTR work. extern "C" void sigINTRHandler(int sig, siginfo_t* info, void* ucVoid) { if (UseSignalChaining) { struct sigaction *actp = os::Solaris::get_chained_signal_action(sig); @@ -4008,27 +4019,31 @@ bool os::Solaris::chained_handler(int sig, siginfo_t* siginfo, void* context) { } struct sigaction* os::Solaris::get_preinstalled_handler(int sig) { - assert((chainedsigactions != (struct sigaction *)NULL) && (preinstalled_sigs != (int *)NULL) , "signals not yet initialized"); + assert((chainedsigactions != (struct sigaction *)NULL) && + (preinstalled_sigs != (int *)NULL), "signals not yet initialized"); if (preinstalled_sigs[sig] != 0) { return &chainedsigactions[sig]; } return NULL; } -void os::Solaris::save_preinstalled_handler(int sig, struct sigaction& oldAct) { - +void os::Solaris::save_preinstalled_handler(int sig, + struct sigaction& oldAct) { assert(sig > 0 && sig <= Maxsignum, "vm signal out of expected range"); - assert((chainedsigactions != (struct sigaction *)NULL) && (preinstalled_sigs != (int *)NULL) , "signals not yet initialized"); + assert((chainedsigactions != (struct sigaction *)NULL) && + (preinstalled_sigs != (int *)NULL), "signals not yet initialized"); chainedsigactions[sig] = oldAct; preinstalled_sigs[sig] = 1; } -void os::Solaris::set_signal_handler(int sig, bool set_installed, bool oktochain) { +void os::Solaris::set_signal_handler(int sig, bool set_installed, + bool oktochain) { // Check for overwrite. struct sigaction oldAct; sigaction(sig, (struct sigaction*)NULL, &oldAct); - void* oldhand = oldAct.sa_sigaction ? CAST_FROM_FN_PTR(void*, oldAct.sa_sigaction) - : CAST_FROM_FN_PTR(void*, oldAct.sa_handler); + void* oldhand = + oldAct.sa_sigaction ? CAST_FROM_FN_PTR(void*, oldAct.sa_sigaction) + : CAST_FROM_FN_PTR(void*, oldAct.sa_handler); if (oldhand != CAST_FROM_FN_PTR(void*, SIG_DFL) && oldhand != CAST_FROM_FN_PTR(void*, SIG_IGN) && oldhand != CAST_FROM_FN_PTR(void*, signalHandler)) { @@ -4059,9 +4074,9 @@ void os::Solaris::set_signal_handler(int sig, bool set_installed, bool oktochain // not using stack banging if (!UseStackBanging && sig == SIGSEGV) { sigAct.sa_flags = SA_SIGINFO | SA_RESTART | SA_ONSTACK; + } else if (sig == os::Solaris::SIGinterrupt()) { // Interruptible i/o requires SA_RESTART cleared so EINTR // is returned instead of restarting system calls - } else if (sig == os::Solaris::SIGinterrupt()) { sigemptyset(&sigAct.sa_mask); sigAct.sa_handler = NULL; sigAct.sa_flags = SA_SIGINFO; @@ -4079,9 +4094,12 @@ void os::Solaris::set_signal_handler(int sig, bool set_installed, bool oktochain } -#define DO_SIGNAL_CHECK(sig) \ - if (!sigismember(&check_signal_done, sig)) \ - os::Solaris::check_signal_handler(sig) +#define DO_SIGNAL_CHECK(sig) \ + do { \ + if (!sigismember(&check_signal_done, sig)) { \ + os::Solaris::check_signal_handler(sig); \ + } \ + } while (0) // This method is a periodic task to check for misbehaving JNI applications // under CheckJNI, we can add any periodic checks here @@ -4275,7 +4293,8 @@ void os::Solaris::install_signal_handlers() { } -void report_error(const char* file_name, int line_no, const char* title, const char* format, ...); +void report_error(const char* file_name, int line_no, const char* title, + const char* format, ...); const char * signames[] = { "SIG0", @@ -4389,8 +4408,7 @@ void os::Solaris::synchronization_init() { os::Solaris::set_cond_init(lwp_cond_init); os::Solaris::set_cond_destroy(lwp_cond_destroy); os::Solaris::set_cond_scope(USYNC_THREAD); - } - else { + } else { os::Solaris::set_mutex_scope(USYNC_THREAD); os::Solaris::set_cond_scope(USYNC_THREAD); @@ -4407,8 +4425,7 @@ void os::Solaris::synchronization_init() { os::Solaris::set_cond_broadcast(CAST_TO_FN_PTR(int_fnP_cond_tP, resolve_symbol("pthread_cond_broadcast"))); os::Solaris::set_cond_init(pthread_cond_default_init); os::Solaris::set_cond_destroy(CAST_TO_FN_PTR(int_fnP_cond_tP, resolve_symbol("pthread_cond_destroy"))); - } - else { + } else { os::Solaris::set_mutex_lock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("mutex_lock"))); os::Solaris::set_mutex_trylock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("mutex_trylock"))); os::Solaris::set_mutex_unlock(CAST_TO_FN_PTR(int_fnP_mutex_tP, resolve_symbol("mutex_unlock"))); @@ -4489,9 +4506,10 @@ void os::init(void) { init_random(1234567); page_size = sysconf(_SC_PAGESIZE); - if (page_size == -1) + if (page_size == -1) { fatal(err_msg("os_solaris.cpp: os::init: sysconf failed (%s)", strerror(errno))); + } init_page_sizes((size_t) page_size); Solaris::initialize_system_info(); @@ -4517,8 +4535,9 @@ void os::init(void) { // and is available on linker patches for 5.7 and 5.8. // libdl.so must have been loaded, this call is just an entry lookup void * hdl = dlopen("libdl.so", RTLD_NOW); - if (hdl) + if (hdl) { dladdr1_func = CAST_TO_FN_PTR(dladdr1_func_type, dlsym(hdl, "dladdr1")); + } // (Solaris only) this switches to calls that actually do locking. ThreadCritical::initialize(); @@ -4566,8 +4585,10 @@ jint os::init_2(void) { os::set_polling_page(polling_page); #ifndef PRODUCT - if (Verbose && PrintMiscellaneous) - tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page); + if (Verbose && PrintMiscellaneous) { + tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", + (intptr_t)polling_page); + } #endif if (!UseMembar) { @@ -4576,8 +4597,10 @@ jint os::init_2(void) { os::set_memory_serialize_page(mem_serialize_page); #ifndef PRODUCT - if (Verbose && PrintMiscellaneous) - tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page); + if (Verbose && PrintMiscellaneous) { + tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", + (intptr_t)mem_serialize_page); + } #endif } @@ -4656,14 +4679,16 @@ jint os::init_2(void) { struct rlimit nbr_files; int status = getrlimit(RLIMIT_NOFILE, &nbr_files); if (status != 0) { - if (PrintMiscellaneous && (Verbose || WizardMode)) + if (PrintMiscellaneous && (Verbose || WizardMode)) { perror("os::init_2 getrlimit failed"); + } } else { nbr_files.rlim_cur = nbr_files.rlim_max; status = setrlimit(RLIMIT_NOFILE, &nbr_files); if (status != 0) { - if (PrintMiscellaneous && (Verbose || WizardMode)) + if (PrintMiscellaneous && (Verbose || WizardMode)) { perror("os::init_2 setrlimit failed"); + } } } } @@ -4715,15 +4740,17 @@ void os::init_3(void) { // Mark the polling page as unreadable void os::make_polling_page_unreadable(void) { - if (mprotect((char *)_polling_page, page_size, PROT_NONE) != 0) + if (mprotect((char *)_polling_page, page_size, PROT_NONE) != 0) { fatal("Could not disable polling page"); -}; + } +} // Mark the polling page as readable void os::make_polling_page_readable(void) { - if (mprotect((char *)_polling_page, page_size, PROT_READ) != 0) + if (mprotect((char *)_polling_page, page_size, PROT_READ) != 0) { fatal("Could not enable polling page"); -}; + } +} // OS interface. @@ -4736,13 +4763,15 @@ int local_vsnprintf(char* buf, size_t count, const char* fmt, va_list argptr) { if (!sol_vsnprintf) { //search for the named symbol in the objects that were loaded after libjvm void* where = RTLD_NEXT; - if ((sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "__vsnprintf"))) == NULL) + if ((sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "__vsnprintf"))) == NULL) { sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "vsnprintf")); + } if (!sol_vsnprintf){ //search for the named symbol in the objects that were loaded before libjvm where = RTLD_DEFAULT; - if ((sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "__vsnprintf"))) == NULL) + if ((sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "__vsnprintf"))) == NULL) { sol_vsnprintf = CAST_TO_FN_PTR(vsnprintf_t, dlsym(where, "vsnprintf")); + } assert(sol_vsnprintf != NULL, "vsnprintf not found"); } } @@ -4758,7 +4787,7 @@ bool os::dir_is_empty(const char* path) { dir = opendir(path); if (dir == NULL) return true; - /* Scan the directory */ + // Scan the directory bool result = true; char buf[sizeof(struct dirent) + MAX_PATH]; struct dirent *dbuf = (struct dirent *) buf; @@ -4775,7 +4804,7 @@ bool os::dir_is_empty(const char* path) { // from src/solaris/hpi/src/system_md.c #ifndef O_DELETE -#define O_DELETE 0x10000 + #define O_DELETE 0x10000 #endif // Open a file. Unlink the file immediately after open returns @@ -4794,7 +4823,7 @@ int os::open(const char *path, int oflag, int mode) { fd = ::open64(path, oflag, mode); if (fd == -1) return -1; - //If the open succeeded, the file might still be a directory + // If the open succeeded, the file might still be a directory { struct stat64 buf64; int ret = ::fstat64(fd, &buf64); @@ -4811,40 +4840,40 @@ int os::open(const char *path, int oflag, int mode) { return -1; } } - /* - * 32-bit Solaris systems suffer from: - * - * - an historical default soft limit of 256 per-process file - * descriptors that is too low for many Java programs. - * - * - a design flaw where file descriptors created using stdio - * fopen must be less than 256, _even_ when the first limit above - * has been raised. This can cause calls to fopen (but not calls to - * open, for example) to fail mysteriously, perhaps in 3rd party - * native code (although the JDK itself uses fopen). One can hardly - * criticize them for using this most standard of all functions. - * - * We attempt to make everything work anyways by: - * - * - raising the soft limit on per-process file descriptors beyond - * 256 - * - * - As of Solaris 10u4, we can request that Solaris raise the 256 - * stdio fopen limit by calling function enable_extended_FILE_stdio. - * This is done in init_2 and recorded in enabled_extended_FILE_stdio - * - * - If we are stuck on an old (pre 10u4) Solaris system, we can - * workaround the bug by remapping non-stdio file descriptors below - * 256 to ones beyond 256, which is done below. - * - * See: - * 1085341: 32-bit stdio routines should support file descriptors >255 - * 6533291: Work around 32-bit Solaris stdio limit of 256 open files - * 6431278: Netbeans crash on 32 bit Solaris: need to call - * enable_extended_FILE_stdio() in VM initialisation - * Giri Mandalika's blog - * http://technopark02.blogspot.com/2005_05_01_archive.html - */ + + // 32-bit Solaris systems suffer from: + // + // - an historical default soft limit of 256 per-process file + // descriptors that is too low for many Java programs. + // + // - a design flaw where file descriptors created using stdio + // fopen must be less than 256, _even_ when the first limit above + // has been raised. This can cause calls to fopen (but not calls to + // open, for example) to fail mysteriously, perhaps in 3rd party + // native code (although the JDK itself uses fopen). One can hardly + // criticize them for using this most standard of all functions. + // + // We attempt to make everything work anyways by: + // + // - raising the soft limit on per-process file descriptors beyond + // 256 + // + // - As of Solaris 10u4, we can request that Solaris raise the 256 + // stdio fopen limit by calling function enable_extended_FILE_stdio. + // This is done in init_2 and recorded in enabled_extended_FILE_stdio + // + // - If we are stuck on an old (pre 10u4) Solaris system, we can + // workaround the bug by remapping non-stdio file descriptors below + // 256 to ones beyond 256, which is done below. + // + // See: + // 1085341: 32-bit stdio routines should support file descriptors >255 + // 6533291: Work around 32-bit Solaris stdio limit of 256 open files + // 6431278: Netbeans crash on 32 bit Solaris: need to call + // enable_extended_FILE_stdio() in VM initialisation + // Giri Mandalika's blog + // http://technopark02.blogspot.com/2005_05_01_archive.html + // #ifndef _LP64 if ((!enabled_extended_FILE_stdio) && fd < 256) { int newfd = ::fcntl(fd, F_DUPFD, 256); @@ -4854,33 +4883,34 @@ int os::open(const char *path, int oflag, int mode) { } } #endif // 32-bit Solaris - /* - * All file descriptors that are opened in the JVM and not - * specifically destined for a subprocess should have the - * close-on-exec flag set. If we don't set it, then careless 3rd - * party native code might fork and exec without closing all - * appropriate file descriptors (e.g. as we do in closeDescriptors in - * UNIXProcess.c), and this in turn might: - * - * - cause end-of-file to fail to be detected on some file - * descriptors, resulting in mysterious hangs, or - * - * - might cause an fopen in the subprocess to fail on a system - * suffering from bug 1085341. - * - * (Yes, the default setting of the close-on-exec flag is a Unix - * design flaw) - * - * See: - * 1085341: 32-bit stdio routines should support file descriptors >255 - * 4843136: (process) pipe file descriptor from Runtime.exec not being closed - * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9 - */ + + // All file descriptors that are opened in the JVM and not + // specifically destined for a subprocess should have the + // close-on-exec flag set. If we don't set it, then careless 3rd + // party native code might fork and exec without closing all + // appropriate file descriptors (e.g. as we do in closeDescriptors in + // UNIXProcess.c), and this in turn might: + // + // - cause end-of-file to fail to be detected on some file + // descriptors, resulting in mysterious hangs, or + // + // - might cause an fopen in the subprocess to fail on a system + // suffering from bug 1085341. + // + // (Yes, the default setting of the close-on-exec flag is a Unix + // design flaw) + // + // See: + // 1085341: 32-bit stdio routines should support file descriptors >255 + // 4843136: (process) pipe file descriptor from Runtime.exec not being closed + // 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9 + // #ifdef FD_CLOEXEC { int flags = ::fcntl(fd, F_GETFD); - if (flags != -1) + if (flags != -1) { ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC); + } } #endif @@ -5035,9 +5065,8 @@ void record_synch(char* name, bool returning); // defined below class RecordSynch { char* _name; public: - RecordSynch(char* name) :_name(name) - { record_synch(_name, false); } - ~RecordSynch() { record_synch(_name, true); } + RecordSynch(char* name) :_name(name) { record_synch(_name, false); } + ~RecordSynch() { record_synch(_name, true); } }; #define CHECK_SYNCH_OP(ret, name, params, args, inner) \ @@ -5067,7 +5096,7 @@ extern "C" ret name params { \ if (!CHECK_POINTER_OK(p)) fatal(false, "Pointer must be in C heap only."); #define CHECK_MUTEX(mutex_op) \ -CHECK_SYNCH_OP(int, mutex_op, (mutex_t *mu), (mu), CHECK_MU); + CHECK_SYNCH_OP(int, mutex_op, (mutex_t *mu), (mu), CHECK_MU); CHECK_MUTEX( mutex_lock) CHECK_MUTEX( _mutex_lock) @@ -5077,14 +5106,14 @@ CHECK_MUTEX( mutex_trylock) CHECK_MUTEX(_mutex_trylock) #define CHECK_COND(cond_op) \ -CHECK_SYNCH_OP(int, cond_op, (cond_t *cv, mutex_t *mu), (cv, mu), CHECK_MU;CHECK_CV); + CHECK_SYNCH_OP(int, cond_op, (cond_t *cv, mutex_t *mu), (cv, mu), CHECK_MU; CHECK_CV); CHECK_COND( cond_wait); CHECK_COND(_cond_wait); CHECK_COND(_cond_wait_cancel); #define CHECK_COND2(cond_op) \ -CHECK_SYNCH_OP(int, cond_op, (cond_t *cv, mutex_t *mu, timestruc_t* ts), (cv, mu, ts), CHECK_MU;CHECK_CV); + CHECK_SYNCH_OP(int, cond_op, (cond_t *cv, mutex_t *mu, timestruc_t* ts), (cv, mu, ts), CHECK_MU; CHECK_CV); CHECK_COND2( cond_timedwait); CHECK_COND2(_cond_timedwait); @@ -5275,10 +5304,11 @@ bool os::find(address addr, outputStream* st) { st->print(PTR_FORMAT ": ", addr); if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { st->print("%s+%#lx", dlinfo.dli_sname, addr-(intptr_t)dlinfo.dli_saddr); - } else if (dlinfo.dli_fbase != NULL) + } else if (dlinfo.dli_fbase != NULL) { st->print("", addr-(intptr_t)dlinfo.dli_fbase); - else + } else { st->print(""); + } if (dlinfo.dli_fname != NULL) { st->print(" in %s", dlinfo.dli_fname); } @@ -5296,8 +5326,9 @@ bool os::find(address addr, outputStream* st) { if (begin < lowest) begin = lowest; Dl_info dlinfo2; if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr - && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) + && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) { end = (address) dlinfo2.dli_saddr; + } Disassembler::decode(begin, end, st); } return true; @@ -5554,36 +5585,34 @@ void os::PlatformEvent::unpark() { // JSR166 // ------------------------------------------------------- -/* - * The solaris and linux implementations of park/unpark are fairly - * conservative for now, but can be improved. They currently use a - * mutex/condvar pair, plus _counter. - * Park decrements _counter if > 0, else does a condvar wait. Unpark - * sets count to 1 and signals condvar. Only one thread ever waits - * on the condvar. Contention seen when trying to park implies that someone - * is unparking you, so don't wait. And spurious returns are fine, so there - * is no need to track notifications. - */ +// The solaris and linux implementations of park/unpark are fairly +// conservative for now, but can be improved. They currently use a +// mutex/condvar pair, plus _counter. +// Park decrements _counter if > 0, else does a condvar wait. Unpark +// sets count to 1 and signals condvar. Only one thread ever waits +// on the condvar. Contention seen when trying to park implies that someone +// is unparking you, so don't wait. And spurious returns are fine, so there +// is no need to track notifications. #define MAX_SECS 100000000 -/* - * This code is common to linux and solaris and will be moved to a - * common place in dolphin. - * - * The passed in time value is either a relative time in nanoseconds - * or an absolute time in milliseconds. Either way it has to be unpacked - * into suitable seconds and nanoseconds components and stored in the - * given timespec structure. - * Given time is a 64-bit value and the time_t used in the timespec is only - * a signed-32-bit value (except on 64-bit Linux) we have to watch for - * overflow if times way in the future are given. Further on Solaris versions - * prior to 10 there is a restriction (see cond_timedwait) that the specified - * number of seconds, in abstime, is less than current_time + 100,000,000. - * As it will be 28 years before "now + 100000000" will overflow we can - * ignore overflow and just impose a hard-limit on seconds using the value - * of "now + 100,000,000". This places a limit on the timeout of about 3.17 - * years from "now". - */ + +// This code is common to linux and solaris and will be moved to a +// common place in dolphin. +// +// The passed in time value is either a relative time in nanoseconds +// or an absolute time in milliseconds. Either way it has to be unpacked +// into suitable seconds and nanoseconds components and stored in the +// given timespec structure. +// Given time is a 64-bit value and the time_t used in the timespec is only +// a signed-32-bit value (except on 64-bit Linux) we have to watch for +// overflow if times way in the future are given. Further on Solaris versions +// prior to 10 there is a restriction (see cond_timedwait) that the specified +// number of seconds, in abstime, is less than current_time + 100,000,000. +// As it will be 28 years before "now + 100000000" will overflow we can +// ignore overflow and just impose a hard-limit on seconds using the value +// of "now + 100,000,000". This places a limit on the timeout of about 3.17 +// years from "now". +// static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) { assert(time > 0, "convertTime"); @@ -5597,19 +5626,16 @@ static void unpackTime(timespec* absTime, bool isAbsolute, jlong time) { jlong secs = time / 1000; if (secs > max_secs) { absTime->tv_sec = max_secs; - } - else { + } else { absTime->tv_sec = secs; } absTime->tv_nsec = (time % 1000) * NANOSECS_PER_MILLISEC; - } - else { + } else { jlong secs = time / NANOSECS_PER_SEC; if (secs >= MAX_SECS) { absTime->tv_sec = max_secs; absTime->tv_nsec = 0; - } - else { + } else { absTime->tv_sec = now.tv_sec + secs; absTime->tv_nsec = (time % NANOSECS_PER_SEC) + now.tv_usec*1000; if (absTime->tv_nsec >= NANOSECS_PER_SEC) { @@ -5831,13 +5857,19 @@ bool os::is_headless_jre() { // Get rid of libjvm.so p = strrchr(buf, '/'); - if (p == NULL) return false; - else *p = '\0'; + if (p == NULL) { + return false; + } else { + *p = '\0'; + } // Get rid of client or server p = strrchr(buf, '/'); - if (p == NULL) return false; - else *p = '\0'; + if (p == NULL) { + return false; + } else { + *p = '\0'; + } // check xawt/libmawt.so strcpy(libmawtpath, buf); @@ -5911,8 +5943,9 @@ int os::timeout(int fd, long timeout) { gettimeofday(&t, &aNull); newtime = ((julong)t.tv_sec * 1000) + t.tv_usec /1000; timeout -= newtime - prevtime; - if (timeout <= 0) + if (timeout <= 0) { return OS_OK; + } prevtime = newtime; } } else return res; @@ -5943,12 +5976,12 @@ int os::connect(int fd, struct sockaddr *him, socklen_t len) { // // EISCONN The socket is already connected. if (_result == OS_ERR && errno == EINTR) { - /* restarting a connect() changes its errno semantics */ + // restarting a connect() changes its errno semantics RESTARTABLE(::connect(fd, him, len), _result); - /* undo these changes */ + // undo these changes if (_result == OS_ERR) { if (errno == EALREADY) { - errno = EINPROGRESS; /* fall through */ + errno = EINPROGRESS; // fall through } else if (errno == EISCONN) { errno = 0; return OS_OK; diff --git a/hotspot/src/os/solaris/vm/os_solaris.hpp b/hotspot/src/os/solaris/vm/os_solaris.hpp index 264ffe7c25b..b708bf2f6e6 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.hpp +++ b/hotspot/src/os/solaris/vm/os_solaris.hpp @@ -36,10 +36,10 @@ class Solaris { private: // Support for "new" libthread APIs for getting & setting thread context (2.8) - #define TRS_VALID 0 - #define TRS_NONVOLATILE 1 - #define TRS_LWPID 2 - #define TRS_INVALID 3 +#define TRS_VALID 0 +#define TRS_NONVOLATILE 1 +#define TRS_LWPID 2 +#define TRS_INVALID 3 // initialized to libthread or lwp synchronization primitives depending on UseLWPSychronization static int_fnP_mutex_tP _mutex_lock; @@ -61,8 +61,8 @@ class Solaris { typedef id_t lgrp_id_t; typedef int lgrp_rsrc_t; typedef enum lgrp_view { - LGRP_VIEW_CALLER, /* what's available to the caller */ - LGRP_VIEW_OS /* what's available to operating system */ + LGRP_VIEW_CALLER, // what's available to the caller + LGRP_VIEW_OS // what's available to operating system } lgrp_view_t; typedef uint_t (*getisax_func_t)(uint32_t* array, uint_t n); @@ -216,8 +216,7 @@ class Solaris { static void set_mutex_destroy(int_fnP_mutex_tP func) { _mutex_destroy = func; } static void set_mutex_scope(int scope) { _mutex_scope = scope; } - static int cond_timedwait(cond_t *cv, mutex_t *mx, timestruc_t *abst) - { return _cond_timedwait(cv, mx, abst); } + static int cond_timedwait(cond_t *cv, mutex_t *mx, timestruc_t *abst) { return _cond_timedwait(cv, mx, abst); } static int cond_wait(cond_t *cv, mutex_t *mx) { return _cond_wait(cv, mx); } static int cond_signal(cond_t *cv) { return _cond_signal(cv); } static int cond_broadcast(cond_t *cv) { return _cond_broadcast(cv); } @@ -225,8 +224,7 @@ class Solaris { static int cond_destroy(cond_t *cv) { return _cond_destroy(cv); } static int cond_scope() { return _cond_scope; } - static void set_cond_timedwait(int_fnP_cond_tP_mutex_tP_timestruc_tP func) - { _cond_timedwait = func; } + static void set_cond_timedwait(int_fnP_cond_tP_mutex_tP_timestruc_tP func) { _cond_timedwait = func; } static void set_cond_wait(int_fnP_cond_tP_mutex_tP func) { _cond_wait = func; } static void set_cond_signal(int_fnP_cond_tP func) { _cond_signal = func; } static void set_cond_broadcast(int_fnP_cond_tP func) { _cond_broadcast = func; } @@ -247,7 +245,7 @@ class Solaris { static id_t lgrp_home(idtype_t type, id_t id) { return _lgrp_home != NULL ? _lgrp_home(type, id) : -1; } static lgrp_cookie_t lgrp_init(lgrp_view_t view) { return _lgrp_init != NULL ? _lgrp_init(view) : 0; } static int lgrp_fini(lgrp_cookie_t cookie) { return _lgrp_fini != NULL ? _lgrp_fini(cookie) : -1; } - static lgrp_id_t lgrp_root(lgrp_cookie_t cookie) { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; }; + static lgrp_id_t lgrp_root(lgrp_cookie_t cookie) { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; } static int lgrp_children(lgrp_cookie_t cookie, lgrp_id_t parent, lgrp_id_t *lgrp_array, uint_t lgrp_array_size) { return _lgrp_children != NULL ? _lgrp_children(cookie, parent, lgrp_array, lgrp_array_size) : -1; diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index 37b343f25b8..c87dd4838be 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -92,7 +92,7 @@ #include #include // For _beginthreadex(), _endthreadex() #include // For os::dll_address_to_function_name -/* for enumerating dll libraries */ +// for enumerating dll libraries #include // for timer info max values which include all bits @@ -113,11 +113,11 @@ static FILETIME process_user_time; static FILETIME process_kernel_time; #ifdef _M_IA64 -#define __CPU__ ia64 + #define __CPU__ ia64 #elif _M_AMD64 -#define __CPU__ amd64 + #define __CPU__ amd64 #else -#define __CPU__ i486 + #define __CPU__ i486 #endif // save DLL module handle, used by GetModuleFileName @@ -128,13 +128,14 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) { switch (reason) { case DLL_PROCESS_ATTACH: vm_lib_handle = hinst; - if (ForceTimeHighResolution) + if (ForceTimeHighResolution) { timeBeginPeriod(1L); + } break; case DLL_PROCESS_DETACH: - if (ForceTimeHighResolution) + if (ForceTimeHighResolution) { timeEndPeriod(1L); - + } break; default: break; @@ -179,8 +180,9 @@ void os::run_periodic_checks() { static LPTOP_LEVEL_EXCEPTION_FILTER prev_uef_handler = NULL; LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo); + void os::init_system_properties_values() { - /* sysclasspath, java_home, dll_dir */ + // sysclasspath, java_home, dll_dir { char *home_path; char *dll_path; @@ -192,47 +194,51 @@ void os::init_system_properties_values() { os::jvm_path(home_dir, sizeof(home_dir)); // Found the full path to jvm.dll. // Now cut the path to /jre if we can. - *(strrchr(home_dir, '\\')) = '\0'; /* get rid of \jvm.dll */ + *(strrchr(home_dir, '\\')) = '\0'; // get rid of \jvm.dll pslash = strrchr(home_dir, '\\'); if (pslash != NULL) { - *pslash = '\0'; /* get rid of \{client|server} */ + *pslash = '\0'; // get rid of \{client|server} pslash = strrchr(home_dir, '\\'); - if (pslash != NULL) - *pslash = '\0'; /* get rid of \bin */ + if (pslash != NULL) { + *pslash = '\0'; // get rid of \bin + } } } home_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + 1, mtInternal); - if (home_path == NULL) + if (home_path == NULL) { return; + } strcpy(home_path, home_dir); Arguments::set_java_home(home_path); - dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1, mtInternal); - if (dll_path == NULL) + dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1, + mtInternal); + if (dll_path == NULL) { return; + } strcpy(dll_path, home_dir); strcat(dll_path, bin); Arguments::set_dll_dir(dll_path); - if (!set_boot_path('\\', ';')) + if (!set_boot_path('\\', ';')) { return; + } } - /* library_path */ - #define EXT_DIR "\\lib\\ext" - #define BIN_DIR "\\bin" - #define PACKAGE_DIR "\\Sun\\Java" +// library_path +#define EXT_DIR "\\lib\\ext" +#define BIN_DIR "\\bin" +#define PACKAGE_DIR "\\Sun\\Java" { - /* Win32 library search order (See the documentation for LoadLibrary): - * - * 1. The directory from which application is loaded. - * 2. The system wide Java Extensions directory (Java only) - * 3. System directory (GetSystemDirectory) - * 4. Windows directory (GetWindowsDirectory) - * 5. The PATH environment variable - * 6. The current directory - */ + // Win32 library search order (See the documentation for LoadLibrary): + // + // 1. The directory from which application is loaded. + // 2. The system wide Java Extensions directory (Java only) + // 3. System directory (GetSystemDirectory) + // 4. Windows directory (GetWindowsDirectory) + // 5. The PATH environment variable + // 6. The current directory char *library_path; char tmp[MAX_PATH]; @@ -271,7 +277,7 @@ void os::init_system_properties_values() { FREE_C_HEAP_ARRAY(char, library_path, mtInternal); } - /* Default extensions directory */ + // Default extensions directory { char path[MAX_PATH]; char buf[2 * MAX_PATH + 2 * sizeof(EXT_DIR) + sizeof(PACKAGE_DIR) + 1]; @@ -284,14 +290,14 @@ void os::init_system_properties_values() { #undef BIN_DIR #undef PACKAGE_DIR - /* Default endorsed standards directory. */ + // Default endorsed standards directory. { - #define ENDORSED_DIR "\\lib\\endorsed" +#define ENDORSED_DIR "\\lib\\endorsed" size_t len = strlen(Arguments::get_java_home()) + sizeof(ENDORSED_DIR); char * buf = NEW_C_HEAP_ARRAY(char, len, mtInternal); sprintf(buf, "%s%s", Arguments::get_java_home(), ENDORSED_DIR); Arguments::set_endorsed_dirs(buf); - #undef ENDORSED_DIR +#undef ENDORSED_DIR } #ifndef _WIN64 @@ -312,14 +318,13 @@ extern "C" void breakpoint() { os::breakpoint(); } -/* - * RtlCaptureStackBackTrace Windows API may not exist prior to Windows XP. - * So far, this method is only used by Native Memory Tracking, which is - * only supported on Windows XP or later. - */ +// RtlCaptureStackBackTrace Windows API may not exist prior to Windows XP. +// So far, this method is only used by Native Memory Tracking, which is +// only supported on Windows XP or later. +// int os::get_native_stack(address* stack, int frames, int toSkip) { #ifdef _NMT_NOINLINE_ - toSkip ++; + toSkip++; #endif int captured = Kernel32Dll::RtlCaptureStackBackTrace(toSkip + 1, frames, (PVOID*)stack, NULL); @@ -347,13 +352,13 @@ address os::current_stack_base() { // Add up the sizes of all the regions with the same // AllocationBase. - while (1) - { + while (1) { VirtualQuery(stack_bottom+stack_size, &minfo, sizeof(minfo)); - if (stack_bottom == (address)minfo.AllocationBase) + if (stack_bottom == (address)minfo.AllocationBase) { stack_size += minfo.RegionSize; - else + } else { break; + } } #ifdef _M_IA64 @@ -466,7 +471,8 @@ static unsigned __stdcall java_start(Thread* thread) { return 0; } -static OSThread* create_os_thread(Thread* thread, HANDLE thread_handle, int thread_id) { +static OSThread* create_os_thread(Thread* thread, HANDLE thread_handle, + int thread_id) { // Allocate the OSThread object OSThread* osthread = new OSThread(NULL, NULL); if (osthread == NULL) return NULL; @@ -538,7 +544,8 @@ bool os::create_main_thread(JavaThread* thread) { } // Allocate and initialize a new OSThread -bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { +bool os::create_thread(Thread* thread, ThreadType thr_type, + size_t stack_size) { unsigned thread_id; // Allocate the OSThread object @@ -562,8 +569,9 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { switch (thr_type) { case os::java_thread: // Java threads use ThreadStackSize which default value can be changed with the flag -Xss - if (JavaThread::stack_size_at_create() > 0) + if (JavaThread::stack_size_at_create() > 0) { stack_size = JavaThread::stack_size_at_create(); + } break; case os::compiler_thread: if (CompilerThreadStackSize > 0) { @@ -602,7 +610,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { // flag appears to work with _beginthredex() as well. #ifndef STACK_SIZE_PARAM_IS_A_RESERVATION -#define STACK_SIZE_PARAM_IS_A_RESERVATION (0x10000) + #define STACK_SIZE_PARAM_IS_A_RESERVATION (0x10000) #endif HANDLE thread_handle = @@ -941,7 +949,6 @@ bool os::getTimesSecs(double* process_real_time, } void os::shutdown() { - // allow PerfMemory to attempt cleanup of any persistent resources perfMemory_exit(); @@ -956,8 +963,10 @@ void os::shutdown() { } -static BOOL (WINAPI *_MiniDumpWriteDump) ( HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, - PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION); +static BOOL (WINAPI *_MiniDumpWriteDump)(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, + PMINIDUMP_EXCEPTION_INFORMATION, + PMINIDUMP_USER_STREAM_INFORMATION, + PMINIDUMP_CALLBACK_INFORMATION); void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) { HINSTANCE dbghelp; @@ -996,10 +1005,13 @@ void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* return; } - _MiniDumpWriteDump = CAST_TO_FN_PTR( - BOOL(WINAPI *)( HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, - PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION), - GetProcAddress(dbghelp, "MiniDumpWriteDump")); + _MiniDumpWriteDump = + CAST_TO_FN_PTR(BOOL(WINAPI *)(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, + PMINIDUMP_EXCEPTION_INFORMATION, + PMINIDUMP_USER_STREAM_INFORMATION, + PMINIDUMP_CALLBACK_INFORMATION), + GetProcAddress(dbghelp, + "MiniDumpWriteDump")); if (_MiniDumpWriteDump == NULL) { VMError::report_coredump_status("Failed to find MiniDumpWriteDump() in module dbghelp.dll", false); @@ -1063,8 +1075,7 @@ void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* -void os::abort(bool dump_core) -{ +void os::abort(bool dump_core) { os::shutdown(); // no core dump on Windows ::exit(1); @@ -1080,12 +1091,10 @@ void os::die() { // // The declarations for DIR and struct dirent are in jvm_win32.h. -/* Caller must have already run dirname through JVM_NativePath, which removes - duplicate slashes and converts all instances of '/' into '\\'. */ +// Caller must have already run dirname through JVM_NativePath, which removes +// duplicate slashes and converts all instances of '/' into '\\'. -DIR * -os::opendir(const char *dirname) -{ +DIR * os::opendir(const char *dirname) { assert(dirname != NULL, "just checking"); // hotspot change DIR *dirp = (DIR *)malloc(sizeof(DIR), mtInternal); DWORD fattr; // hotspot change @@ -1096,11 +1105,10 @@ os::opendir(const char *dirname) return 0; } - /* - * Win32 accepts "\" in its POSIX stat(), but refuses to treat it - * as a directory in FindFirstFile(). We detect this case here and - * prepend the current drive name. - */ + // Win32 accepts "\" in its POSIX stat(), but refuses to treat it + // as a directory in FindFirstFile(). We detect this case here and + // prepend the current drive name. + // if (dirname[1] == '\0' && dirname[0] == '\\') { alt_dirname[0] = _getdrive() + 'A' - 1; alt_dirname[1] = ':'; @@ -1130,11 +1138,11 @@ os::opendir(const char *dirname) return 0; } - /* Append "*.*", or possibly "\\*.*", to path */ - if (dirp->path[1] == ':' - && (dirp->path[2] == '\0' - || (dirp->path[2] == '\\' && dirp->path[3] == '\0'))) { - /* No '\\' needed for cases like "Z:" or "Z:\" */ + // Append "*.*", or possibly "\\*.*", to path + if (dirp->path[1] == ':' && + (dirp->path[2] == '\0' || + (dirp->path[2] == '\\' && dirp->path[3] == '\0'))) { + // No '\\' needed for cases like "Z:" or "Z:\" strcat(dirp->path, "*.*"); } else { strcat(dirp->path, "\\*.*"); @@ -1152,11 +1160,8 @@ os::opendir(const char *dirname) return dirp; } -/* parameter dbuf unused on Windows */ - -struct dirent * -os::readdir(DIR *dirp, dirent *dbuf) -{ +// parameter dbuf unused on Windows +struct dirent * os::readdir(DIR *dirp, dirent *dbuf) { assert(dirp != NULL, "just checking"); // hotspot change if (dirp->handle == INVALID_HANDLE_VALUE) { return 0; @@ -1176,9 +1181,7 @@ os::readdir(DIR *dirp, dirent *dbuf) return &dirp->dirent; } -int -os::closedir(DIR *dirp) -{ +int os::closedir(DIR *dirp) { assert(dirp != NULL, "just checking"); // hotspot change if (dirp->handle != INVALID_HANDLE_VALUE) { if (!FindClose(dirp->handle)) { @@ -1196,10 +1199,10 @@ os::closedir(DIR *dirp) // directory not the java application's temp directory, ala java.io.tmpdir. const char* os::get_temp_directory() { static char path_buf[MAX_PATH]; - if (GetTempPath(MAX_PATH, path_buf)>0) + if (GetTempPath(MAX_PATH, path_buf) > 0) { return path_buf; - else{ - path_buf[0]='\0'; + } else { + path_buf[0] = '\0'; return path_buf; } } @@ -1282,22 +1285,23 @@ const char* os::get_current_directory(char *buf, size_t buflen) { // Helper routine which returns true if address in // within the NTDLL address space. // -static bool _addr_in_ntdll( address addr ) -{ +static bool _addr_in_ntdll(address addr) { HMODULE hmod; MODULEINFO minfo; hmod = GetModuleHandle("NTDLL.DLL"); if (hmod == NULL) return false; - if (!os::PSApiDll::GetModuleInformation( GetCurrentProcess(), hmod, - &minfo, sizeof(MODULEINFO)) ) + if (!os::PSApiDll::GetModuleInformation(GetCurrentProcess(), hmod, + &minfo, sizeof(MODULEINFO))) { return false; + } if ((addr >= minfo.lpBaseOfDll) && - (addr < (address)((uintptr_t)minfo.lpBaseOfDll + (uintptr_t)minfo.SizeOfImage))) + (addr < (address)((uintptr_t)minfo.lpBaseOfDll + (uintptr_t)minfo.SizeOfImage))) { return true; - else + } else { return false; + } } #endif @@ -1319,11 +1323,11 @@ static bool _addr_in_ntdll( address addr ) typedef int (*EnumModulesCallbackFunc)(int, char *, address, unsigned, void *); // enumerate_modules for Windows NT, using PSAPI -static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void * param) -{ +static int _enumerate_modules_winnt(int pid, EnumModulesCallbackFunc func, + void * param) { HANDLE hProcess; -# define MAX_NUM_MODULES 128 +#define MAX_NUM_MODULES 128 HMODULE modules[MAX_NUM_MODULES]; static char filename[MAX_PATH]; int result = 0; @@ -1372,8 +1376,8 @@ static int _enumerate_modules_winnt( int pid, EnumModulesCallbackFunc func, void // enumerate_modules for Windows 95/98/ME, using TOOLHELP -static int _enumerate_modules_windows( int pid, EnumModulesCallbackFunc func, void *param) -{ +static int _enumerate_modules_windows(int pid, EnumModulesCallbackFunc func, + void *param) { HANDLE hSnapShot; static MODULEENTRY32 modentry; int result = 0; @@ -1390,7 +1394,7 @@ static int _enumerate_modules_windows( int pid, EnumModulesCallbackFunc func, vo // iterate through all modules modentry.dwSize = sizeof(MODULEENTRY32); - bool not_done = os::Kernel32Dll::Module32First( hSnapShot, &modentry ) != 0; + bool not_done = os::Kernel32Dll::Module32First(hSnapShot, &modentry) != 0; while (not_done) { // invoke the callback @@ -1399,20 +1403,22 @@ static int _enumerate_modules_windows( int pid, EnumModulesCallbackFunc func, vo if (result) break; modentry.dwSize = sizeof(MODULEENTRY32); - not_done = os::Kernel32Dll::Module32Next( hSnapShot, &modentry ) != 0; + not_done = os::Kernel32Dll::Module32Next(hSnapShot, &modentry) != 0; } CloseHandle(hSnapShot); return result; } -int enumerate_modules( int pid, EnumModulesCallbackFunc func, void * param ) -{ +int enumerate_modules(int pid, EnumModulesCallbackFunc func, void * param) { // Get current process ID if caller doesn't provide it. if (!pid) pid = os::current_process_id(); - if (os::win32::is_nt()) return _enumerate_modules_winnt (pid, func, param); - else return _enumerate_modules_windows(pid, func, param); + if (os::win32::is_nt()) { + return _enumerate_modules_winnt (pid, func, param); + } else { + return _enumerate_modules_windows(pid, func, param); + } } struct _modinfo { @@ -1522,18 +1528,16 @@ static int _print_module(int pid, char* fname, address base, // Loads .dll/.so and // in case of error it checks if .dll/.so was built for the // same architecture as Hotspot is running on -void * os::dll_load(const char *name, char *ebuf, int ebuflen) -{ +void * os::dll_load(const char *name, char *ebuf, int ebuflen) { void * result = LoadLibrary(name); - if (result != NULL) - { + if (result != NULL) { return result; } DWORD errcode = GetLastError(); if (errcode == ERROR_MOD_NOT_FOUND) { - strncpy(ebuf, "Can't find dependent libraries", ebuflen-1); - ebuf[ebuflen-1]='\0'; + strncpy(ebuf, "Can't find dependent libraries", ebuflen - 1); + ebuf[ebuflen - 1] = '\0'; return NULL; } @@ -1546,99 +1550,91 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen) // Read system error message into ebuf // It may or may not be overwritten below (in the for loop and just above) lasterror(ebuf, (size_t) ebuflen); - ebuf[ebuflen-1]='\0'; - int file_descriptor=::open(name, O_RDONLY | O_BINARY, 0); - if (file_descriptor<0) - { + ebuf[ebuflen - 1] = '\0'; + int fd = ::open(name, O_RDONLY | O_BINARY, 0); + if (fd < 0) { return NULL; } uint32_t signature_offset; - uint16_t lib_arch=0; - bool failed_to_get_lib_arch= - ( - //Go to position 3c in the dll - (os::seek_to_file_offset(file_descriptor,IMAGE_FILE_PTR_TO_SIGNATURE)<0) + uint16_t lib_arch = 0; + bool failed_to_get_lib_arch = + ( // Go to position 3c in the dll + (os::seek_to_file_offset(fd, IMAGE_FILE_PTR_TO_SIGNATURE) < 0) || - // Read loacation of signature - (sizeof(signature_offset)!= - (os::read(file_descriptor, (void*)&signature_offset,sizeof(signature_offset)))) + // Read location of signature + (sizeof(signature_offset) != + (os::read(fd, (void*)&signature_offset, sizeof(signature_offset)))) || - //Go to COFF File Header in dll - //that is located after"signature" (4 bytes long) - (os::seek_to_file_offset(file_descriptor, - signature_offset+IMAGE_FILE_SIGNATURE_LENGTH)<0) + // Go to COFF File Header in dll + // that is located after "signature" (4 bytes long) + (os::seek_to_file_offset(fd, + signature_offset + IMAGE_FILE_SIGNATURE_LENGTH) < 0) || - //Read field that contains code of architecture - // that dll was build for - (sizeof(lib_arch)!= - (os::read(file_descriptor, (void*)&lib_arch,sizeof(lib_arch)))) + // Read field that contains code of architecture + // that dll was built for + (sizeof(lib_arch) != (os::read(fd, (void*)&lib_arch, sizeof(lib_arch)))) ); - ::close(file_descriptor); - if (failed_to_get_lib_arch) - { + ::close(fd); + if (failed_to_get_lib_arch) { // file i/o error - report os::lasterror(...) msg return NULL; } - typedef struct - { + typedef struct { uint16_t arch_code; char* arch_name; } arch_t; - static const arch_t arch_array[]={ + static const arch_t arch_array[] = { {IMAGE_FILE_MACHINE_I386, (char*)"IA 32"}, {IMAGE_FILE_MACHINE_AMD64, (char*)"AMD 64"}, {IMAGE_FILE_MACHINE_IA64, (char*)"IA 64"} }; - #if (defined _M_IA64) - static const uint16_t running_arch=IMAGE_FILE_MACHINE_IA64; - #elif (defined _M_AMD64) - static const uint16_t running_arch=IMAGE_FILE_MACHINE_AMD64; - #elif (defined _M_IX86) - static const uint16_t running_arch=IMAGE_FILE_MACHINE_I386; - #else - #error Method os::dll_load requires that one of following \ - is defined :_M_IA64,_M_AMD64 or _M_IX86 - #endif +#if (defined _M_IA64) + static const uint16_t running_arch = IMAGE_FILE_MACHINE_IA64; +#elif (defined _M_AMD64) + static const uint16_t running_arch = IMAGE_FILE_MACHINE_AMD64; +#elif (defined _M_IX86) + static const uint16_t running_arch = IMAGE_FILE_MACHINE_I386; +#else + #error Method os::dll_load requires that one of following \ + is defined :_M_IA64,_M_AMD64 or _M_IX86 +#endif // Obtain a string for printf operation // lib_arch_str shall contain string what platform this .dll was built for // running_arch_str shall string contain what platform Hotspot was built for - char *running_arch_str=NULL,*lib_arch_str=NULL; - for (unsigned int i=0;ihandle_special_suspend_equivalent_condition(); if (threadIsSuspended) { - // // The semaphore has been incremented, but while we were waiting // another thread suspended us. We don't want to continue running // while suspended because that would surprise the thread that // suspended us. - // ret = ::ReleaseSemaphore(sig_sem, 1, NULL); assert(ret != 0, "ReleaseSemaphore() failed"); @@ -2105,7 +2097,8 @@ int os::signal_wait() { // Implicit OS exception handling -LONG Handle_Exception(struct _EXCEPTION_POINTERS* exceptionInfo, address handler) { +LONG Handle_Exception(struct _EXCEPTION_POINTERS* exceptionInfo, + address handler) { JavaThread* thread = JavaThread::current(); // Save pc in thread #ifdef _M_IA64 @@ -2163,7 +2156,7 @@ extern "C" void events(); // Handle NAT Bit consumption on IA64. #ifdef _M_IA64 -#define EXCEPTION_REG_NAT_CONSUMPTION STATUS_REG_NAT_CONSUMPTION + #define EXCEPTION_REG_NAT_CONSUMPTION STATUS_REG_NAT_CONSUMPTION #endif // Windows Vista/2008 heap corruption check @@ -2292,10 +2285,9 @@ LONG WINAPI Handle_FLT_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) { return (prev_uef_handler)(exceptionInfo); } #else // !_WIN64 -/* - On Windows, the mxcsr control bits are non-volatile across calls - See also CR 6192333 - */ + // On Windows, the mxcsr control bits are non-volatile across calls + // See also CR 6192333 + // jint MxCsr = INITIAL_MXCSR; // we can't use StubRoutines::addr_mxcsr_std() // because in Win64 mxcsr is not saved there @@ -2497,9 +2489,9 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { // update the enabled status, even if the zone contains only one page. thread->disable_stack_yellow_zone(); // If not in java code, return and hope for the best. - return in_java ? Handle_Exception(exceptionInfo, - SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)) - : EXCEPTION_CONTINUE_EXECUTION; + return in_java + ? Handle_Exception(exceptionInfo, SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)) + : EXCEPTION_CONTINUE_EXECUTION; } else { // Fatal red zone violation. thread->disable_stack_red_zone(); @@ -2532,11 +2524,9 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { return Handle_Exception(exceptionInfo, SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW)); } - // // Check for safepoint polling and implicit null // We only expect null pointers in the stubs (vtable) // the rest are checked explicitly now. - // CodeBlob* cb = CodeCache::find_blob(pc); if (cb != NULL) { if (os::is_poll_address(addr)) { @@ -2546,7 +2536,6 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { } { #ifdef _WIN64 - // // If it's a legal stack address map the entire region in // PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord; @@ -2557,8 +2546,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { os::commit_memory((char *)addr, thread->stack_base() - addr, !ExecMem); return EXCEPTION_CONTINUE_EXECUTION; - } - else + } else #endif { // Null pointer exception. @@ -2652,8 +2640,7 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { } if (((thread->thread_state() == _thread_in_Java) || (thread->thread_state() == _thread_in_native)) && - exception_code != EXCEPTION_UNCAUGHT_CXX_EXCEPTION) - { + exception_code != EXCEPTION_UNCAUGHT_CXX_EXCEPTION) { LONG result=Handle_FLT_Exception(exceptionInfo); if (result==EXCEPTION_CONTINUE_EXECUTION) return result; } @@ -2684,14 +2671,19 @@ LONG WINAPI fastJNIAccessorExceptionFilter(struct _EXCEPTION_POINTERS* exception return EXCEPTION_CONTINUE_SEARCH; } -#define DEFINE_FAST_GETFIELD(Return,Fieldname,Result) \ -Return JNICALL jni_fast_Get##Result##Field_wrapper(JNIEnv *env, jobject obj, jfieldID fieldID) { \ - __try { \ - return (*JNI_FastGetField::jni_fast_Get##Result##Field_fp)(env, obj, fieldID); \ - } __except(fastJNIAccessorExceptionFilter((_EXCEPTION_POINTERS*)_exception_info())) { \ - } \ - return 0; \ -} +#define DEFINE_FAST_GETFIELD(Return, Fieldname, Result) \ + Return JNICALL jni_fast_Get##Result##Field_wrapper(JNIEnv *env, \ + jobject obj, \ + jfieldID fieldID) { \ + __try { \ + return (*JNI_FastGetField::jni_fast_Get##Result##Field_fp)(env, \ + obj, \ + fieldID); \ + } __except(fastJNIAccessorExceptionFilter((_EXCEPTION_POINTERS*) \ + _exception_info())) { \ + } \ + return 0; \ + } DEFINE_FAST_GETFIELD(jboolean, bool, Boolean) DEFINE_FAST_GETFIELD(jbyte, byte, Byte) @@ -2755,7 +2747,7 @@ int os::vm_allocation_granularity() { // in the future, if so the code below needs to be revisited. #ifndef MEM_LARGE_PAGES -#define MEM_LARGE_PAGES 0x20000000 + #define MEM_LARGE_PAGES 0x20000000 #endif static HANDLE _hProcess; @@ -2857,7 +2849,7 @@ static bool numa_interleaving_init() { // print a warning if UseNUMAInterleaving flag is specified on command line bool warn_on_failure = use_numa_interleaving_specified; -# define WARN(msg) if (warn_on_failure) { warning(msg); } +#define WARN(msg) if (warn_on_failure) { warning(msg); } // NUMAInterleaveGranularity cannot be less than vm_allocation_granularity (or _large_page_size if using large pages) size_t min_interleave_granularity = UseLargePages ? _large_page_size : os::vm_allocation_granularity(); @@ -2891,8 +2883,9 @@ static bool numa_interleaving_init() { // Reasons for doing this: // * UseLargePagesIndividualAllocation was set (normally only needed on WS2003 but possible to be set otherwise) // * UseNUMAInterleaving requires a separate node for each piece -static char* allocate_pages_individually(size_t bytes, char* addr, DWORD flags, DWORD prot, - bool should_inject_error=false) { +static char* allocate_pages_individually(size_t bytes, char* addr, DWORD flags, + DWORD prot, + bool should_inject_error = false) { char * p_buf; // note: at setup time we guaranteed that NUMAInterleaveGranularity was aligned up to a page size size_t page_size = UseLargePages ? _large_page_size : os::vm_allocation_granularity(); @@ -3020,7 +3013,7 @@ void os::large_page_init() { !FLAG_IS_DEFAULT(LargePageSizeInBytes); bool success = false; -# define WARN(msg) if (warn_on_failure) { warning(msg); } +#define WARN(msg) if (warn_on_failure) { warning(msg); } if (resolve_functions_for_large_page_init()) { if (request_lock_memory_privilege()) { size_t s = os::Kernel32Dll::GetLargePageMinimum(); @@ -3161,7 +3154,8 @@ bool os::can_execute_large_page_memory() { return true; } -char* os::reserve_memory_special(size_t bytes, size_t alignment, char* addr, bool exec) { +char* os::reserve_memory_special(size_t bytes, size_t alignment, char* addr, + bool exec) { assert(UseLargePages, "only for large pages"); if (!is_size_aligned(bytes, os::large_page_size()) || alignment > os::large_page_size()) { @@ -3397,7 +3391,8 @@ bool os::get_page_info(char *start, page_info* info) { return false; } -char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) { +char *os::scan_pages(char *start, char* end, page_info* page_expected, + page_info* page_found) { return end; } @@ -3458,8 +3453,9 @@ int os::sleep(Thread* thread, jlong ms, bool interruptable) { while (ms > limit) { int res; - if ((res = sleep(thread, limit, interruptable)) != OS_TIMEOUT) + if ((res = sleep(thread, limit, interruptable)) != OS_TIMEOUT) { return res; + } ms -= limit; } @@ -3479,8 +3475,9 @@ int os::sleep(Thread* thread, jlong ms, bool interruptable) { HANDLE events[1]; events[0] = osthread->interrupt_event(); HighResolutionInterval *phri=NULL; - if (!ForceTimeHighResolution) + if (!ForceTimeHighResolution) { phri = new HighResolutionInterval(ms); + } if (WaitForMultipleObjects(1, events, FALSE, (DWORD)ms) == WAIT_TIMEOUT) { result = OS_TIMEOUT; } else { @@ -3500,7 +3497,6 @@ int os::sleep(Thread* thread, jlong ms, bool interruptable) { return result; } -// // Short sleep, direct OS call. // // ms = 0, means allow others (if any) to run. @@ -3583,7 +3579,8 @@ OSReturn os::set_native_priority(Thread* thread, int priority) { return ret ? OS_OK : OS_ERR; } -OSReturn os::get_native_priority(const Thread* const thread, int* priority_ptr) { +OSReturn os::get_native_priority(const Thread* const thread, + int* priority_ptr) { if (!UseThreadPriorities) { *priority_ptr = java_to_os_priority[NormPriority]; return OS_OK; @@ -3603,7 +3600,8 @@ OSReturn os::get_native_priority(const Thread* const thread, int* priority_ptr) void os::hint_no_preempt() {} void os::interrupt(Thread* thread) { - assert(!thread->is_Java_thread() || Thread::current() == thread || Threads_lock->owned_by_self(), + assert(!thread->is_Java_thread() || Thread::current() == thread || + Threads_lock->owned_by_self(), "possibility of dangling Thread pointer"); OSThread* osthread = thread->osthread(); @@ -3615,12 +3613,12 @@ void os::interrupt(Thread* thread) { OrderAccess::release(); SetEvent(osthread->interrupt_event()); // For JSR166: unpark after setting status - if (thread->is_Java_thread()) + if (thread->is_Java_thread()) { ((JavaThread*)thread)->parker()->unpark(); + } ParkEvent * ev = thread->_ParkEvent; if (ev != NULL) ev->unpark(); - } @@ -3667,31 +3665,30 @@ ExtendedPC os::get_thread_pc(Thread* thread) { } // GetCurrentThreadId() returns DWORD -intx os::current_thread_id() { return GetCurrentThreadId(); } +intx os::current_thread_id() { return GetCurrentThreadId(); } static int _initial_pid = 0; -int os::current_process_id() -{ +int os::current_process_id() { return (_initial_pid ? _initial_pid : _getpid()); } -int os::win32::_vm_page_size = 0; +int os::win32::_vm_page_size = 0; int os::win32::_vm_allocation_granularity = 0; -int os::win32::_processor_type = 0; +int os::win32::_processor_type = 0; // Processor level is not available on non-NT systems, use vm_version instead -int os::win32::_processor_level = 0; -julong os::win32::_physical_memory = 0; -size_t os::win32::_default_stack_size = 0; +int os::win32::_processor_level = 0; +julong os::win32::_physical_memory = 0; +size_t os::win32::_default_stack_size = 0; -intx os::win32::_os_thread_limit = 0; +intx os::win32::_os_thread_limit = 0; volatile intx os::win32::_os_thread_count = 0; -bool os::win32::_is_nt = false; -bool os::win32::_is_windows_2003 = false; -bool os::win32::_is_windows_server = false; +bool os::win32::_is_nt = false; +bool os::win32::_is_windows_2003 = false; +bool os::win32::_is_windows_server = false; -bool os::win32::_has_performance_count = 0; +bool os::win32::_has_performance_count = 0; void os::win32::initialize_system_info() { SYSTEM_INFO si; @@ -3749,7 +3746,8 @@ void os::win32::initialize_system_info() { } -HINSTANCE os::win32::load_Windows_dll(const char* name, char *ebuf, int ebuflen) { +HINSTANCE os::win32::load_Windows_dll(const char* name, char *ebuf, + int ebuflen) { char path[MAX_PATH]; DWORD size; DWORD pathLen = (DWORD)sizeof(path); @@ -3904,8 +3902,10 @@ jint os::init_2(void) { os::set_polling_page(polling_page); #ifndef PRODUCT - if (Verbose && PrintMiscellaneous) - tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", (intptr_t)polling_page); + if (Verbose && PrintMiscellaneous) { + tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n", + (intptr_t)polling_page); + } #endif if (!UseMembar) { @@ -3918,8 +3918,10 @@ jint os::init_2(void) { os::set_memory_serialize_page(mem_serialize_page); #ifndef PRODUCT - if (Verbose && PrintMiscellaneous) - tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", (intptr_t)mem_serialize_page); + if (Verbose && PrintMiscellaneous) { + tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n", + (intptr_t)mem_serialize_page); + } #endif } @@ -4034,16 +4036,20 @@ void os::init_3(void) { // Mark the polling page as unreadable void os::make_polling_page_unreadable(void) { DWORD old_status; - if (!VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_NOACCESS, &old_status)) + if (!VirtualProtect((char *)_polling_page, os::vm_page_size(), + PAGE_NOACCESS, &old_status)) { fatal("Could not disable polling page"); -}; + } +} // Mark the polling page as readable void os::make_polling_page_readable(void) { DWORD old_status; - if (!VirtualProtect((char *)_polling_page, os::vm_page_size(), PAGE_READONLY, &old_status)) + if (!VirtualProtect((char *)_polling_page, os::vm_page_size(), + PAGE_READONLY, &old_status)) { fatal("Could not enable polling page"); -}; + } +} int os::stat(const char *path, struct stat *sbuf) { @@ -4119,12 +4125,11 @@ jlong os::thread_cpu_time(Thread* thread, bool user_sys_cpu_time) { FILETIME KernelTime; FILETIME UserTime; - if (GetThreadTimes(thread->osthread()->thread_handle(), - &CreationTime, &ExitTime, &KernelTime, &UserTime) == 0) + if (GetThreadTimes(thread->osthread()->thread_handle(), &CreationTime, + &ExitTime, &KernelTime, &UserTime) == 0) { return -1; - else - if (user_sys_cpu_time) { - return (FT2INT64(UserTime) + FT2INT64(KernelTime)) * 100; + } else if (user_sys_cpu_time) { + return (FT2INT64(UserTime) + FT2INT64(KernelTime)) * 100; } else { return FT2INT64(UserTime) * 100; } @@ -4155,11 +4160,12 @@ bool os::is_thread_cpu_time_supported() { FILETIME KernelTime; FILETIME UserTime; - if (GetThreadTimes(GetCurrentThread(), - &CreationTime, &ExitTime, &KernelTime, &UserTime) == 0) + if (GetThreadTimes(GetCurrentThread(), &CreationTime, &ExitTime, + &KernelTime, &UserTime) == 0) { return false; - else + } else { return true; + } } else { return false; } @@ -4252,39 +4258,36 @@ jlong os::lseek(int fd, jlong offset, int whence) { // This method is a slightly reworked copy of JDK's sysNativePath // from src/windows/hpi/src/path_md.c -/* Convert a pathname to native format. On win32, this involves forcing all - separators to be '\\' rather than '/' (both are legal inputs, but Win95 - sometimes rejects '/') and removing redundant separators. The input path is - assumed to have been converted into the character encoding used by the local - system. Because this might be a double-byte encoding, care is taken to - treat double-byte lead characters correctly. - - This procedure modifies the given path in place, as the result is never - longer than the original. There is no error return; this operation always - succeeds. */ +// Convert a pathname to native format. On win32, this involves forcing all +// separators to be '\\' rather than '/' (both are legal inputs, but Win95 +// sometimes rejects '/') and removing redundant separators. The input path is +// assumed to have been converted into the character encoding used by the local +// system. Because this might be a double-byte encoding, care is taken to +// treat double-byte lead characters correctly. +// +// This procedure modifies the given path in place, as the result is never +// longer than the original. There is no error return; this operation always +// succeeds. char * os::native_path(char *path) { char *src = path, *dst = path, *end = path; - char *colon = NULL; /* If a drive specifier is found, this will - point to the colon following the drive - letter */ + char *colon = NULL; // If a drive specifier is found, this will + // point to the colon following the drive letter - /* Assumption: '/', '\\', ':', and drive letters are never lead bytes */ - assert(((!::IsDBCSLeadByte('/')) - && (!::IsDBCSLeadByte('\\')) - && (!::IsDBCSLeadByte(':'))), - "Illegal lead byte"); + // Assumption: '/', '\\', ':', and drive letters are never lead bytes + assert(((!::IsDBCSLeadByte('/')) && (!::IsDBCSLeadByte('\\')) + && (!::IsDBCSLeadByte(':'))), "Illegal lead byte"); - /* Check for leading separators */ + // Check for leading separators #define isfilesep(c) ((c) == '/' || (c) == '\\') while (isfilesep(*src)) { src++; } if (::isalpha(*src) && !::IsDBCSLeadByte(*src) && src[1] == ':') { - /* Remove leading separators if followed by drive specifier. This - hack is necessary to support file URLs containing drive - specifiers (e.g., "file://c:/path"). As a side effect, - "/c:/path" can be used as an alternative to "c:/path". */ + // Remove leading separators if followed by drive specifier. This + // hack is necessary to support file URLs containing drive + // specifiers (e.g., "file://c:/path"). As a side effect, + // "/c:/path" can be used as an alternative to "c:/path". *dst++ = *src++; colon = dst; *dst++ = ':'; @@ -4292,55 +4295,55 @@ char * os::native_path(char *path) { } else { src = path; if (isfilesep(src[0]) && isfilesep(src[1])) { - /* UNC pathname: Retain first separator; leave src pointed at - second separator so that further separators will be collapsed - into the second separator. The result will be a pathname - beginning with "\\\\" followed (most likely) by a host name. */ + // UNC pathname: Retain first separator; leave src pointed at + // second separator so that further separators will be collapsed + // into the second separator. The result will be a pathname + // beginning with "\\\\" followed (most likely) by a host name. src = dst = path + 1; - path[0] = '\\'; /* Force first separator to '\\' */ + path[0] = '\\'; // Force first separator to '\\' } } end = dst; - /* Remove redundant separators from remainder of path, forcing all - separators to be '\\' rather than '/'. Also, single byte space - characters are removed from the end of the path because those - are not legal ending characters on this operating system. - */ + // Remove redundant separators from remainder of path, forcing all + // separators to be '\\' rather than '/'. Also, single byte space + // characters are removed from the end of the path because those + // are not legal ending characters on this operating system. + // while (*src != '\0') { if (isfilesep(*src)) { *dst++ = '\\'; src++; while (isfilesep(*src)) src++; if (*src == '\0') { - /* Check for trailing separator */ + // Check for trailing separator end = dst; - if (colon == dst - 2) break; /* "z:\\" */ - if (dst == path + 1) break; /* "\\" */ + if (colon == dst - 2) break; // "z:\\" + if (dst == path + 1) break; // "\\" if (dst == path + 2 && isfilesep(path[0])) { - /* "\\\\" is not collapsed to "\\" because "\\\\" marks the - beginning of a UNC pathname. Even though it is not, by - itself, a valid UNC pathname, we leave it as is in order - to be consistent with the path canonicalizer as well - as the win32 APIs, which treat this case as an invalid - UNC pathname rather than as an alias for the root - directory of the current drive. */ + // "\\\\" is not collapsed to "\\" because "\\\\" marks the + // beginning of a UNC pathname. Even though it is not, by + // itself, a valid UNC pathname, we leave it as is in order + // to be consistent with the path canonicalizer as well + // as the win32 APIs, which treat this case as an invalid + // UNC pathname rather than as an alias for the root + // directory of the current drive. break; } - end = --dst; /* Path does not denote a root directory, so - remove trailing separator */ + end = --dst; // Path does not denote a root directory, so + // remove trailing separator break; } end = dst; } else { - if (::IsDBCSLeadByte(*src)) { /* Copy a double-byte character */ + if (::IsDBCSLeadByte(*src)) { // Copy a double-byte character *dst++ = *src++; if (*src) *dst++ = *src++; end = dst; - } else { /* Copy a single-byte character */ + } else { // Copy a single-byte character char c = *src++; *dst++ = c; - /* Space is not a legal ending character */ + // Space is not a legal ending character if (c != ' ') end = dst; } } @@ -4348,7 +4351,7 @@ char * os::native_path(char *path) { *end = '\0'; - /* For "z:", add "." to work around a bug in the C runtime library */ + // For "z:", add "." to work around a bug in the C runtime library if (colon == dst - 1) { path[2] = '.'; path[3] = '\0'; @@ -4390,8 +4393,8 @@ int os::fsync(int fd) { HANDLE handle = (HANDLE)::_get_osfhandle(fd); if ((!::FlushFileBuffers(handle)) && - (GetLastError() != ERROR_ACCESS_DENIED) ) { - /* from winerror.h */ + (GetLastError() != ERROR_ACCESS_DENIED)) { + // from winerror.h return -1; } return 0; @@ -4441,12 +4444,10 @@ int os::available(int fd, jlong *bytes) { // from src/windows/hpi/src/sys_api_md.c static int nonSeekAvailable(int fd, long *pbytes) { - /* This is used for available on non-seekable devices - * (like both named and anonymous pipes, such as pipes - * connected to an exec'd process). - * Standard Input is a special case. - * - */ + // This is used for available on non-seekable devices + // (like both named and anonymous pipes, such as pipes + // connected to an exec'd process). + // Standard Input is a special case. HANDLE han; if ((han = (HANDLE) ::_get_osfhandle(fd)) == (HANDLE)(-1)) { @@ -4454,12 +4455,12 @@ static int nonSeekAvailable(int fd, long *pbytes) { } if (! ::PeekNamedPipe(han, NULL, 0, NULL, (LPDWORD)pbytes, NULL)) { - /* PeekNamedPipe fails when at EOF. In that case we - * simply make *pbytes = 0 which is consistent with the - * behavior we get on Solaris when an fd is at EOF. - * The only alternative is to raise an Exception, - * which isn't really warranted. - */ + // PeekNamedPipe fails when at EOF. In that case we + // simply make *pbytes = 0 which is consistent with the + // behavior we get on Solaris when an fd is at EOF. + // The only alternative is to raise an Exception, + // which isn't really warranted. + // if (::GetLastError() != ERROR_BROKEN_PIPE) { return FALSE; } @@ -4475,25 +4476,25 @@ static int nonSeekAvailable(int fd, long *pbytes) { static int stdinAvailable(int fd, long *pbytes) { HANDLE han; - DWORD numEventsRead = 0; /* Number of events read from buffer */ - DWORD numEvents = 0; /* Number of events in buffer */ - DWORD i = 0; /* Loop index */ - DWORD curLength = 0; /* Position marker */ - DWORD actualLength = 0; /* Number of bytes readable */ - BOOL error = FALSE; /* Error holder */ - INPUT_RECORD *lpBuffer; /* Pointer to records of input events */ + DWORD numEventsRead = 0; // Number of events read from buffer + DWORD numEvents = 0; // Number of events in buffer + DWORD i = 0; // Loop index + DWORD curLength = 0; // Position marker + DWORD actualLength = 0; // Number of bytes readable + BOOL error = FALSE; // Error holder + INPUT_RECORD *lpBuffer; // Pointer to records of input events if ((han = ::GetStdHandle(STD_INPUT_HANDLE)) == INVALID_HANDLE_VALUE) { return FALSE; } - /* Construct an array of input records in the console buffer */ + // Construct an array of input records in the console buffer error = ::GetNumberOfConsoleInputEvents(han, &numEvents); if (error == 0) { return nonSeekAvailable(fd, pbytes); } - /* lpBuffer must fit into 64K or else PeekConsoleInput fails */ + // lpBuffer must fit into 64K or else PeekConsoleInput fails if (numEvents > MAX_INPUT_EVENTS) { numEvents = MAX_INPUT_EVENTS; } @@ -4509,7 +4510,7 @@ static int stdinAvailable(int fd, long *pbytes) { return FALSE; } - /* Examine input records for the number of bytes available */ + // Examine input records for the number of bytes available for (i=0; iis_Watcher_thread(), "Must be WatcherThread"); } -/* - * See the caveats for this class in os_windows.hpp - * Protects the callback call so that raised OS EXCEPTIONS causes a jump back - * into this method and returns false. If no OS EXCEPTION was raised, returns - * true. - * The callback is supposed to provide the method that should be protected. - */ +// See the caveats for this class in os_windows.hpp +// Protects the callback call so that raised OS EXCEPTIONS causes a jump back +// into this method and returns false. If no OS EXCEPTION was raised, returns +// true. +// The callback is supposed to provide the method that should be protected. +// bool os::WatcherThreadCrashProtection::call(os::CrashProtectionCallback& cb) { assert(Thread::current()->is_Watcher_thread(), "Only for WatcherThread"); assert(!WatcherThread::watcher_thread()->has_crash_protection(), @@ -4787,7 +4787,7 @@ bool os::WatcherThreadCrashProtection::call(os::CrashProtectionCallback& cb) { // Another possible encoding of _Event would be // with explicit "PARKED" and "SIGNALED" bits. -int os::PlatformEvent::park (jlong Millis) { +int os::PlatformEvent::park(jlong Millis) { guarantee(_ParkHandle != NULL , "Invariant"); guarantee(Millis > 0 , "Invariant"); int v; @@ -4895,32 +4895,28 @@ void os::PlatformEvent::unpark() { // JSR166 // ------------------------------------------------------- -/* - * The Windows implementation of Park is very straightforward: Basic - * operations on Win32 Events turn out to have the right semantics to - * use them directly. We opportunistically resuse the event inherited - * from Monitor. - */ - +// The Windows implementation of Park is very straightforward: Basic +// operations on Win32 Events turn out to have the right semantics to +// use them directly. We opportunistically resuse the event inherited +// from Monitor. void Parker::park(bool isAbsolute, jlong time) { guarantee(_ParkEvent != NULL, "invariant"); // First, demultiplex/decode time arguments if (time < 0) { // don't wait return; - } - else if (time == 0 && !isAbsolute) { + } else if (time == 0 && !isAbsolute) { time = INFINITE; - } - else if (isAbsolute) { + } else if (isAbsolute) { time -= os::javaTimeMillis(); // convert to relative time - if (time <= 0) // already elapsed + if (time <= 0) { // already elapsed return; - } - else { // relative - time /= 1000000; // Must coarsen from nanos to millis - if (time == 0) // Wait for the minimal time unit if zero + } + } else { // relative + time /= 1000000; // Must coarsen from nanos to millis + if (time == 0) { // Wait for the minimal time unit if zero time = 1; + } } JavaThread* thread = (JavaThread*)(Thread::current()); @@ -4932,8 +4928,7 @@ void Parker::park(bool isAbsolute, jlong time) { WaitForSingleObject(_ParkEvent, 0) == WAIT_OBJECT_0) { ResetEvent(_ParkEvent); return; - } - else { + } else { ThreadBlockInVM tbivm(jt); OSThreadWaitState osts(thread->osthread(), false /* not Object.wait() */); jt->set_suspend_equivalent(); @@ -5042,8 +5037,9 @@ LONG WINAPI os::win32::serialize_fault_filter(struct _EXCEPTION_POINTERS* e) { PEXCEPTION_RECORD exceptionRecord = e->ExceptionRecord; address addr = (address) exceptionRecord->ExceptionInformation[1]; - if (os::is_memory_serialize_page(thread, addr)) + if (os::is_memory_serialize_page(thread, addr)) { return EXCEPTION_CONTINUE_EXECUTION; + } } return EXCEPTION_CONTINUE_SEARCH; @@ -5163,9 +5159,9 @@ int os::set_sock_opt(int fd, int level, int optname, // WINDOWS CONTEXT Flags for THREAD_SAMPLING #if defined(IA32) -# define sampling_context_flags (CONTEXT_FULL | CONTEXT_FLOATING_POINT | CONTEXT_EXTENDED_REGISTERS) + #define sampling_context_flags (CONTEXT_FULL | CONTEXT_FLOATING_POINT | CONTEXT_EXTENDED_REGISTERS) #elif defined (AMD64) -# define sampling_context_flags (CONTEXT_FULL | CONTEXT_FLOATING_POINT) + #define sampling_context_flags (CONTEXT_FULL | CONTEXT_FLOATING_POINT) #endif // returns true if thread could be suspended, @@ -5189,13 +5185,13 @@ static void do_resume(HANDLE* h) { // retrieve a suspend/resume context capable handle // from the tid. Caller validates handle return value. -void get_thread_handle_for_extended_context(HANDLE* h, OSThread::thread_id_t tid) { +void get_thread_handle_for_extended_context(HANDLE* h, + OSThread::thread_id_t tid) { if (h != NULL) { *h = OpenThread(THREAD_SUSPEND_RESUME | THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION, FALSE, tid); } } -// // Thread sampling implementation // void os::SuspendedThreadTask::internal_do_task() { @@ -5229,9 +5225,9 @@ void os::SuspendedThreadTask::internal_do_task() { // Kernel32 API typedef SIZE_T (WINAPI* GetLargePageMinimum_Fn)(void); -typedef LPVOID (WINAPI *VirtualAllocExNuma_Fn) (HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD); -typedef BOOL (WINAPI *GetNumaHighestNodeNumber_Fn) (PULONG); -typedef BOOL (WINAPI *GetNumaNodeProcessorMask_Fn) (UCHAR, PULONGLONG); +typedef LPVOID (WINAPI *VirtualAllocExNuma_Fn)(HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD); +typedef BOOL (WINAPI *GetNumaHighestNodeNumber_Fn)(PULONG); +typedef BOOL (WINAPI *GetNumaNodeProcessorMask_Fn)(UCHAR, PULONGLONG); typedef USHORT (WINAPI* RtlCaptureStackBackTrace_Fn)(ULONG, ULONG, PVOID*, PULONG); GetLargePageMinimum_Fn os::Kernel32Dll::_GetLargePageMinimum = NULL; @@ -5262,7 +5258,9 @@ BOOL os::Kernel32Dll::NumaCallsAvailable() { return _VirtualAllocExNuma != NULL; } -LPVOID os::Kernel32Dll::VirtualAllocExNuma(HANDLE hProc, LPVOID addr, SIZE_T bytes, DWORD flags, DWORD prot, DWORD node) { +LPVOID os::Kernel32Dll::VirtualAllocExNuma(HANDLE hProc, LPVOID addr, + SIZE_T bytes, DWORD flags, + DWORD prot, DWORD node) { assert(initialized && _VirtualAllocExNuma != NULL, "NUMACallsAvailable() not yet called"); @@ -5276,7 +5274,8 @@ BOOL os::Kernel32Dll::GetNumaHighestNodeNumber(PULONG ptr_highest_node_number) { return _GetNumaHighestNodeNumber(ptr_highest_node_number); } -BOOL os::Kernel32Dll::GetNumaNodeProcessorMask(UCHAR node, PULONGLONG proc_mask) { +BOOL os::Kernel32Dll::GetNumaNodeProcessorMask(UCHAR node, + PULONGLONG proc_mask) { assert(initialized && _GetNumaNodeProcessorMask != NULL, "NUMACallsAvailable() not yet called"); @@ -5284,7 +5283,9 @@ BOOL os::Kernel32Dll::GetNumaNodeProcessorMask(UCHAR node, PULONGLONG proc_mask) } USHORT os::Kernel32Dll::RtlCaptureStackBackTrace(ULONG FrameToSkip, - ULONG FrameToCapture, PVOID* BackTrace, PULONG BackTraceHash) { + ULONG FrameToCapture, + PVOID* BackTrace, + PULONG BackTraceHash) { if (!initialized) { initialize(); } @@ -5333,15 +5334,18 @@ inline BOOL os::Kernel32Dll::HelpToolsAvailable() { return true; } -inline HANDLE os::Kernel32Dll::CreateToolhelp32Snapshot(DWORD dwFlags,DWORD th32ProcessId) { +inline HANDLE os::Kernel32Dll::CreateToolhelp32Snapshot(DWORD dwFlags, + DWORD th32ProcessId) { return ::CreateToolhelp32Snapshot(dwFlags, th32ProcessId); } -inline BOOL os::Kernel32Dll::Module32First(HANDLE hSnapshot,LPMODULEENTRY32 lpme) { +inline BOOL os::Kernel32Dll::Module32First(HANDLE hSnapshot, + LPMODULEENTRY32 lpme) { return ::Module32First(hSnapshot, lpme); } -inline BOOL os::Kernel32Dll::Module32Next(HANDLE hSnapshot,LPMODULEENTRY32 lpme) { +inline BOOL os::Kernel32Dll::Module32Next(HANDLE hSnapshot, + LPMODULEENTRY32 lpme) { return ::Module32Next(hSnapshot, lpme); } @@ -5355,15 +5359,23 @@ inline void os::Kernel32Dll::GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo) { } // PSAPI API -inline BOOL os::PSApiDll::EnumProcessModules(HANDLE hProcess, HMODULE *lpModule, DWORD cb, LPDWORD lpcbNeeded) { +inline BOOL os::PSApiDll::EnumProcessModules(HANDLE hProcess, + HMODULE *lpModule, DWORD cb, + LPDWORD lpcbNeeded) { return ::EnumProcessModules(hProcess, lpModule, cb, lpcbNeeded); } -inline DWORD os::PSApiDll::GetModuleFileNameEx(HANDLE hProcess, HMODULE hModule, LPTSTR lpFilename, DWORD nSize) { +inline DWORD os::PSApiDll::GetModuleFileNameEx(HANDLE hProcess, + HMODULE hModule, + LPTSTR lpFilename, + DWORD nSize) { return ::GetModuleFileNameEx(hProcess, hModule, lpFilename, nSize); } -inline BOOL os::PSApiDll::GetModuleInformation(HANDLE hProcess, HMODULE hModule, LPMODULEINFO lpmodinfo, DWORD cb) { +inline BOOL os::PSApiDll::GetModuleInformation(HANDLE hProcess, + HMODULE hModule, + LPMODULEINFO lpmodinfo, + DWORD cb) { return ::GetModuleInformation(hProcess, hModule, lpmodinfo, cb); } @@ -5373,7 +5385,8 @@ inline BOOL os::PSApiDll::PSApiAvailable() { // WinSock2 API -inline BOOL os::WinSock2Dll::WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData) { +inline BOOL os::WinSock2Dll::WSAStartup(WORD wVersionRequested, + LPWSADATA lpWSAData) { return ::WSAStartup(wVersionRequested, lpWSAData); } @@ -5387,18 +5400,24 @@ inline BOOL os::WinSock2Dll::WinSock2Available() { // Advapi API inline BOOL os::Advapi32Dll::AdjustTokenPrivileges(HANDLE TokenHandle, - BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, - PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength) { + BOOL DisableAllPrivileges, + PTOKEN_PRIVILEGES NewState, + DWORD BufferLength, + PTOKEN_PRIVILEGES PreviousState, + PDWORD ReturnLength) { return ::AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength); } -inline BOOL os::Advapi32Dll::OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, +inline BOOL os::Advapi32Dll::OpenProcessToken(HANDLE ProcessHandle, + DWORD DesiredAccess, PHANDLE TokenHandle) { return ::OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle); } -inline BOOL os::Advapi32Dll::LookupPrivilegeValue(LPCTSTR lpSystemName, LPCTSTR lpName, PLUID lpLuid) { +inline BOOL os::Advapi32Dll::LookupPrivilegeValue(LPCTSTR lpSystemName, + LPCTSTR lpName, + PLUID lpLuid) { return ::LookupPrivilegeValue(lpSystemName, lpName, lpLuid); } @@ -5478,9 +5497,9 @@ char* os::build_agent_function_name(const char *sym_name, const char *lib_name, #else // Kernel32 API typedef BOOL (WINAPI* SwitchToThread_Fn)(void); -typedef HANDLE (WINAPI* CreateToolhelp32Snapshot_Fn)(DWORD,DWORD); -typedef BOOL (WINAPI* Module32First_Fn)(HANDLE,LPMODULEENTRY32); -typedef BOOL (WINAPI* Module32Next_Fn)(HANDLE,LPMODULEENTRY32); +typedef HANDLE (WINAPI* CreateToolhelp32Snapshot_Fn)(DWORD, DWORD); +typedef BOOL (WINAPI* Module32First_Fn)(HANDLE, LPMODULEENTRY32); +typedef BOOL (WINAPI* Module32Next_Fn)(HANDLE, LPMODULEENTRY32); typedef void (WINAPI* GetNativeSystemInfo_Fn)(LPSYSTEM_INFO); SwitchToThread_Fn os::Kernel32Dll::_SwitchToThread = NULL; @@ -5530,7 +5549,8 @@ BOOL os::Kernel32Dll::HelpToolsAvailable() { _Module32Next != NULL; } -HANDLE os::Kernel32Dll::CreateToolhelp32Snapshot(DWORD dwFlags,DWORD th32ProcessId) { +HANDLE os::Kernel32Dll::CreateToolhelp32Snapshot(DWORD dwFlags, + DWORD th32ProcessId) { assert(initialized && _CreateToolhelp32Snapshot != NULL, "HelpToolsAvailable() not yet called"); @@ -5544,7 +5564,8 @@ BOOL os::Kernel32Dll::Module32First(HANDLE hSnapshot,LPMODULEENTRY32 lpme) { return _Module32First(hSnapshot, lpme); } -inline BOOL os::Kernel32Dll::Module32Next(HANDLE hSnapshot,LPMODULEENTRY32 lpme) { +inline BOOL os::Kernel32Dll::Module32Next(HANDLE hSnapshot, + LPMODULEENTRY32 lpme) { assert(initialized && _Module32Next != NULL, "HelpToolsAvailable() not yet called"); @@ -5570,7 +5591,7 @@ void os::Kernel32Dll::GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo) { typedef BOOL (WINAPI *EnumProcessModules_Fn)(HANDLE, HMODULE *, DWORD, LPDWORD); -typedef BOOL (WINAPI *GetModuleFileNameEx_Fn)(HANDLE, HMODULE, LPTSTR, DWORD);; +typedef BOOL (WINAPI *GetModuleFileNameEx_Fn)(HANDLE, HMODULE, LPTSTR, DWORD); typedef BOOL (WINAPI *GetModuleInformation_Fn)(HANDLE, HMODULE, LPMODULEINFO, DWORD); EnumProcessModules_Fn os::PSApiDll::_EnumProcessModules = NULL; @@ -5595,19 +5616,22 @@ void os::PSApiDll::initialize() { -BOOL os::PSApiDll::EnumProcessModules(HANDLE hProcess, HMODULE *lpModule, DWORD cb, LPDWORD lpcbNeeded) { +BOOL os::PSApiDll::EnumProcessModules(HANDLE hProcess, HMODULE *lpModule, + DWORD cb, LPDWORD lpcbNeeded) { assert(initialized && _EnumProcessModules != NULL, "PSApiAvailable() not yet called"); return _EnumProcessModules(hProcess, lpModule, cb, lpcbNeeded); } -DWORD os::PSApiDll::GetModuleFileNameEx(HANDLE hProcess, HMODULE hModule, LPTSTR lpFilename, DWORD nSize) { +DWORD os::PSApiDll::GetModuleFileNameEx(HANDLE hProcess, HMODULE hModule, + LPTSTR lpFilename, DWORD nSize) { assert(initialized && _GetModuleFileNameEx != NULL, "PSApiAvailable() not yet called"); return _GetModuleFileNameEx(hProcess, hModule, lpFilename, nSize); } -BOOL os::PSApiDll::GetModuleInformation(HANDLE hProcess, HMODULE hModule, LPMODULEINFO lpmodinfo, DWORD cb) { +BOOL os::PSApiDll::GetModuleInformation(HANDLE hProcess, HMODULE hModule, + LPMODULEINFO lpmodinfo, DWORD cb) { assert(initialized && _GetModuleInformation != NULL, "PSApiAvailable() not yet called"); return _GetModuleInformation(hProcess, hModule, lpmodinfo, cb); @@ -5688,22 +5712,27 @@ void os::Advapi32Dll::initialize() { } BOOL os::Advapi32Dll::AdjustTokenPrivileges(HANDLE TokenHandle, - BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, - PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength) { + BOOL DisableAllPrivileges, + PTOKEN_PRIVILEGES NewState, + DWORD BufferLength, + PTOKEN_PRIVILEGES PreviousState, + PDWORD ReturnLength) { assert(initialized && _AdjustTokenPrivileges != NULL, "AdvapiAvailable() not yet called"); return _AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength); } -BOOL os::Advapi32Dll::OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, +BOOL os::Advapi32Dll::OpenProcessToken(HANDLE ProcessHandle, + DWORD DesiredAccess, PHANDLE TokenHandle) { assert(initialized && _OpenProcessToken != NULL, "AdvapiAvailable() not yet called"); return _OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle); } -BOOL os::Advapi32Dll::LookupPrivilegeValue(LPCTSTR lpSystemName, LPCTSTR lpName, PLUID lpLuid) { +BOOL os::Advapi32Dll::LookupPrivilegeValue(LPCTSTR lpSystemName, + LPCTSTR lpName, PLUID lpLuid) { assert(initialized && _LookupPrivilegeValue != NULL, "AdvapiAvailable() not yet called"); return _LookupPrivilegeValue(lpSystemName, lpName, lpLuid); diff --git a/hotspot/src/share/vm/runtime/atomic.hpp b/hotspot/src/share/vm/runtime/atomic.hpp index 7cc5a00843b..4729adefc5f 100644 --- a/hotspot/src/share/vm/runtime/atomic.hpp +++ b/hotspot/src/share/vm/runtime/atomic.hpp @@ -74,12 +74,12 @@ class Atomic : AllStatic { inline static intptr_t add_ptr(intptr_t add_value, volatile intptr_t* dest); inline static void* add_ptr(intptr_t add_value, volatile void* dest); // See comment above about using jlong atomics on 32-bit platforms - static jlong add (jlong add_value, volatile jlong* dest); + static jlong add (jlong add_value, volatile jlong* dest); // Atomically increment location. inc*() provide: // increment-dest inline static void inc (volatile jint* dest); - static void inc (volatile jshort* dest); + static void inc (volatile jshort* dest); inline static void inc (volatile size_t* dest); inline static void inc_ptr(volatile intptr_t* dest); inline static void inc_ptr(volatile void* dest); @@ -87,7 +87,7 @@ class Atomic : AllStatic { // Atomically decrement a location. dec*() provide: // decrement-dest inline static void dec (volatile jint* dest); - static void dec (volatile jshort* dest); + static void dec (volatile jshort* dest); inline static void dec (volatile size_t* dest); inline static void dec_ptr(volatile intptr_t* dest); inline static void dec_ptr(volatile void* dest); @@ -95,27 +95,22 @@ class Atomic : AllStatic { // Performs atomic exchange of *dest with exchange_value. Returns old // prior value of *dest. xchg*() provide: // exchange-value-with-dest - inline static jint xchg(jint exchange_value, volatile jint* dest); - static unsigned int xchg(unsigned int exchange_value, volatile unsigned int* dest); - - inline static intptr_t xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest); - inline static void* xchg_ptr(void* exchange_value, volatile void* dest); + inline static jint xchg (jint exchange_value, volatile jint* dest); + static unsigned int xchg (unsigned int exchange_value, volatile unsigned int* dest); + inline static intptr_t xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest); + inline static void* xchg_ptr(void* exchange_value, volatile void* dest); // Performs atomic compare of *dest and compare_value, and exchanges // *dest with exchange_value if the comparison succeeded. Returns prior // value of *dest. cmpxchg*() provide: // compare-and-exchange - static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value); - inline static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value); + static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value); + inline static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value); // See comment above about using jlong atomics on 32-bit platforms - inline static jlong cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value); - - static unsigned int cmpxchg(unsigned int exchange_value, - volatile unsigned int* dest, - unsigned int compare_value); - - inline static intptr_t cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value); - inline static void* cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value); + inline static jlong cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value); + static unsigned int cmpxchg (unsigned int exchange_value, volatile unsigned int* dest, unsigned int compare_value); + inline static intptr_t cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value); + inline static void* cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value); }; // To use Atomic::inc(jshort* dest) and Atomic::dec(jshort* dest), the address must be specially @@ -129,12 +124,12 @@ class Atomic : AllStatic { // ); #ifdef VM_LITTLE_ENDIAN -#define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl) \ - non_atomic_decl; \ + #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl) \ + non_atomic_decl; \ atomic_decl #else -#define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl) \ - atomic_decl; \ + #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl) \ + atomic_decl; \ non_atomic_decl #endif diff --git a/hotspot/src/share/vm/runtime/mutex.cpp b/hotspot/src/share/vm/runtime/mutex.cpp index a2db8cb949d..a414ab815e0 100644 --- a/hotspot/src/share/vm/runtime/mutex.cpp +++ b/hotspot/src/share/vm/runtime/mutex.cpp @@ -267,15 +267,24 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // CASPTR() uses the canonical argument order that dominates in the literature. // Our internal cmpxchg_ptr() uses a bastardized ordering to accommodate Sun .il templates. -#define CASPTR(a,c,s) intptr_t(Atomic::cmpxchg_ptr ((void *)(s),(void *)(a),(void *)(c))) +#define CASPTR(a, c, s) \ + intptr_t(Atomic::cmpxchg_ptr((void *)(s), (void *)(a), (void *)(c))) #define UNS(x) (uintptr_t(x)) -#define TRACE(m) { static volatile int ctr = 0; int x = ++ctr; if ((x & (x-1))==0) { ::printf ("%d:%s\n", x, #m); ::fflush(stdout); }} +#define TRACE(m) \ + { \ + static volatile int ctr = 0; \ + int x = ++ctr; \ + if ((x & (x - 1)) == 0) { \ + ::printf("%d:%s\n", x, #m); \ + ::fflush(stdout); \ + } \ + } // Simplistic low-quality Marsaglia SHIFT-XOR RNG. // Bijective except for the trailing mask operation. // Useful for spin loops as the compiler can't optimize it away. -static inline jint MarsagliaXORV (jint x) { +static inline jint MarsagliaXORV(jint x) { if (x == 0) x = 1|os::random(); x ^= x << 6; x ^= ((unsigned)x) >> 21; @@ -283,7 +292,7 @@ static inline jint MarsagliaXORV (jint x) { return x & 0x7FFFFFFF; } -static int Stall (int its) { +static int Stall(int its) { static volatile jint rv = 1; volatile int OnFrame = 0; jint v = rv ^ UNS(OnFrame); @@ -341,7 +350,7 @@ int Monitor::ILocked() { // Clamp spinning at approximately 1/2 of a context-switch round-trip. // See synchronizer.cpp for details and rationale. -int Monitor::TrySpin (Thread * const Self) { +int Monitor::TrySpin(Thread * const Self) { if (TryLock()) return 1; if (!os::is_MP()) return 0; @@ -403,7 +412,7 @@ int Monitor::TrySpin (Thread * const Self) { } } -static int ParkCommon (ParkEvent * ev, jlong timo) { +static int ParkCommon(ParkEvent * ev, jlong timo) { // Diagnostic support - periodically unwedge blocked threads intx nmt = NativeMonitorTimeout; if (nmt > 0 && (nmt < timo || timo <= 0)) { @@ -418,7 +427,7 @@ static int ParkCommon (ParkEvent * ev, jlong timo) { return err; } -inline int Monitor::AcquireOrPush (ParkEvent * ESelf) { +inline int Monitor::AcquireOrPush(ParkEvent * ESelf) { intptr_t v = _LockWord.FullWord; for (;;) { if ((v & _LBIT) == 0) { @@ -443,7 +452,7 @@ inline int Monitor::AcquireOrPush (ParkEvent * ESelf) { // Note that ILock and IWait do *not* access _owner. // _owner is a higher-level logical concept. -void Monitor::ILock (Thread * Self) { +void Monitor::ILock(Thread * Self) { assert(_OnDeck != Self->_MutexEvent, "invariant"); if (TryFast()) { @@ -514,7 +523,7 @@ void Monitor::ILock (Thread * Self) { goto Exeunt; } -void Monitor::IUnlock (bool RelaxAssert) { +void Monitor::IUnlock(bool RelaxAssert) { assert(ILocked(), "invariant"); // Conceptually we need a MEMBAR #storestore|#loadstore barrier or fence immediately // before the store that releases the lock. Crucially, all the stores and loads in the @@ -589,8 +598,8 @@ void Monitor::IUnlock (bool RelaxAssert) { _EntryList = w->ListNext; // as a diagnostic measure consider setting w->_ListNext = BAD assert(UNS(_OnDeck) == _LBIT, "invariant"); - _OnDeck = w; // pass OnDeck to w. - // w will clear OnDeck once it acquires the outer lock + _OnDeck = w; // pass OnDeck to w. + // w will clear OnDeck once it acquires the outer lock // Another optional optimization ... // For heavily contended locks it's not uncommon that some other @@ -724,7 +733,7 @@ bool Monitor::notify_all() { return true; } -int Monitor::IWait (Thread * Self, jlong timo) { +int Monitor::IWait(Thread * Self, jlong timo) { assert(ILocked(), "invariant"); // Phases: @@ -885,7 +894,7 @@ int Monitor::IWait (Thread * Self, jlong timo) { // sneaking or dependence on any any clever invariants or subtle implementation properties // of Mutex-Monitor and instead directly address the underlying design flaw. -void Monitor::lock (Thread * Self) { +void Monitor::lock(Thread * Self) { #ifdef CHECK_UNHANDLED_OOPS // Clear unhandled oops so we get a crash right away. Only clear for non-vm // or GC threads. @@ -895,7 +904,7 @@ void Monitor::lock (Thread * Self) { #endif // CHECK_UNHANDLED_OOPS debug_only(check_prelock_state(Self)); - assert(_owner != Self , "invariant"); + assert(_owner != Self, "invariant"); assert(_OnDeck != Self->_MutexEvent, "invariant"); if (TryFast()) { @@ -943,7 +952,7 @@ void Monitor::lock() { // that is guaranteed not to block while running inside the VM. If this is called with // thread state set to be in VM, the safepoint synchronization code will deadlock! -void Monitor::lock_without_safepoint_check (Thread * Self) { +void Monitor::lock_without_safepoint_check(Thread * Self) { assert(_owner != Self, "invariant"); ILock(Self); assert(_owner == NULL, "invariant"); @@ -983,8 +992,8 @@ bool Monitor::try_lock() { } void Monitor::unlock() { - assert(_owner == Thread::current(), "invariant"); - assert(_OnDeck != Thread::current()->_MutexEvent , "invariant"); + assert(_owner == Thread::current(), "invariant"); + assert(_OnDeck != Thread::current()->_MutexEvent, "invariant"); set_owner(NULL); if (_snuck) { assert(SafepointSynchronize::is_at_safepoint() && Thread::current()->is_VM_thread(), "sneak"); @@ -1071,7 +1080,8 @@ void Monitor::jvm_raw_unlock() { IUnlock(false); } -bool Monitor::wait(bool no_safepoint_check, long timeout, bool as_suspend_equivalent) { +bool Monitor::wait(bool no_safepoint_check, long timeout, + bool as_suspend_equivalent) { Thread * const Self = Thread::current(); assert(_owner == Self, "invariant"); assert(ILocked(), "invariant"); @@ -1140,7 +1150,7 @@ Monitor::~Monitor() { assert((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, ""); } -void Monitor::ClearMonitor (Monitor * m, const char *name) { +void Monitor::ClearMonitor(Monitor * m, const char *name) { m->_owner = NULL; m->_snuck = false; if (name == NULL) { @@ -1158,7 +1168,7 @@ void Monitor::ClearMonitor (Monitor * m, const char *name) { Monitor::Monitor() { ClearMonitor(this); } -Monitor::Monitor (int Rank, const char * name, bool allow_vm_block) { +Monitor::Monitor(int Rank, const char * name, bool allow_vm_block) { ClearMonitor(this, name); #ifdef ASSERT _allow_vm_block = allow_vm_block; @@ -1170,7 +1180,7 @@ Mutex::~Mutex() { assert((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, ""); } -Mutex::Mutex (int Rank, const char * name, bool allow_vm_block) { +Mutex::Mutex(int Rank, const char * name, bool allow_vm_block) { ClearMonitor((Monitor *) this, name); #ifdef ASSERT _allow_vm_block = allow_vm_block; @@ -1247,8 +1257,9 @@ Monitor* Monitor::get_least_ranked_lock_besides_this(Monitor* locks) { bool Monitor::contains(Monitor* locks, Monitor * lock) { for (; locks != NULL; locks = locks->next()) { - if (locks == lock) + if (locks == lock) { return true; + } } return false; } @@ -1279,7 +1290,7 @@ void Monitor::set_owner_implementation(Thread *new_owner) { // link "this" into the owned locks list - #ifdef ASSERT // Thread::_owned_locks is under the same ifdef +#ifdef ASSERT // Thread::_owned_locks is under the same ifdef Monitor* locks = get_least_ranked_lock(new_owner->owned_locks()); // Mutex::set_owner_implementation is a friend of Thread @@ -1312,7 +1323,7 @@ void Monitor::set_owner_implementation(Thread *new_owner) { this->_next = new_owner->_owned_locks; new_owner->_owned_locks = this; - #endif +#endif } else { // the thread is releasing this lock @@ -1325,7 +1336,7 @@ void Monitor::set_owner_implementation(Thread *new_owner) { _owner = NULL; // set the owner - #ifdef ASSERT +#ifdef ASSERT Monitor *locks = old_owner->owned_locks(); // remove "this" from the owned locks list @@ -1345,7 +1356,7 @@ void Monitor::set_owner_implementation(Thread *new_owner) { prev->_next = _next; } _next = NULL; - #endif +#endif } } diff --git a/hotspot/src/share/vm/runtime/objectMonitor.cpp b/hotspot/src/share/vm/runtime/objectMonitor.cpp index 414ce666c1e..6d5ee117ed3 100644 --- a/hotspot/src/share/vm/runtime/objectMonitor.cpp +++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp @@ -70,10 +70,10 @@ #define DTRACE_MONITOR_WAIT_PROBE(monitor, obj, thread, millis) \ { \ - if (DTraceMonitorProbes) { \ + if (DTraceMonitorProbes) { \ DTRACE_MONITOR_PROBE_COMMON(obj, thread); \ HOTSPOT_MONITOR_WAIT(jtid, \ - (monitor), bytes, len, (millis)); \ + (monitor), bytes, len, (millis)); \ } \ } @@ -85,10 +85,10 @@ #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread) \ { \ - if (DTraceMonitorProbes) { \ + if (DTraceMonitorProbes) { \ DTRACE_MONITOR_PROBE_COMMON(obj, thread); \ - HOTSPOT_MONITOR_##probe(jtid, \ - (uintptr_t)(monitor), bytes, len); \ + HOTSPOT_MONITOR_##probe(jtid, \ + (uintptr_t)(monitor), bytes, len); \ } \ } @@ -278,8 +278,8 @@ void NOINLINE ObjectMonitor::enter(TRAPS) { void * cur = Atomic::cmpxchg_ptr (Self, &_owner, NULL); if (cur == NULL) { // Either ASSERT _recursions == 0 or explicitly set _recursions = 0. - assert(_recursions == 0 , "invariant"); - assert(_owner == Self, "invariant"); + assert(_recursions == 0, "invariant"); + assert(_owner == Self, "invariant"); // CONSIDER: set or assert OwnerIsThread == 1 return; } @@ -310,20 +310,20 @@ void NOINLINE ObjectMonitor::enter(TRAPS) { // Note that if we acquire the monitor from an initial spin // we forgo posting JVMTI events and firing DTRACE probes. if (Knob_SpinEarly && TrySpin (Self) > 0) { - assert(_owner == Self , "invariant"); - assert(_recursions == 0 , "invariant"); + assert(_owner == Self, "invariant"); + assert(_recursions == 0, "invariant"); assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant"); Self->_Stalled = 0; return; } - assert(_owner != Self , "invariant"); - assert(_succ != Self , "invariant"); - assert(Self->is_Java_thread() , "invariant"); + assert(_owner != Self, "invariant"); + assert(_succ != Self, "invariant"); + assert(Self->is_Java_thread(), "invariant"); JavaThread * jt = (JavaThread *) Self; assert(!SafepointSynchronize::is_at_safepoint(), "invariant"); - assert(jt->thread_state() != _thread_blocked , "invariant"); - assert(this->object() != NULL , "invariant"); + assert(jt->thread_state() != _thread_blocked, "invariant"); + assert(this->object() != NULL, "invariant"); assert(_count >= 0, "invariant"); // Prevent deflation at STW-time. See deflate_idle_monitors() and is_busy(). @@ -361,7 +361,6 @@ void NOINLINE ObjectMonitor::enter(TRAPS) { if (!ExitSuspendEquivalent(jt)) break; - // // We have acquired the contended monitor, but while we were // waiting another thread suspended us. We don't want to enter // the monitor while suspended because that would surprise the @@ -390,9 +389,9 @@ void NOINLINE ObjectMonitor::enter(TRAPS) { Self->_Stalled = 0; // Must either set _recursions = 0 or ASSERT _recursions == 0. - assert(_recursions == 0 , "invariant"); - assert(_owner == Self , "invariant"); - assert(_succ != Self , "invariant"); + assert(_recursions == 0, "invariant"); + assert(_owner == Self, "invariant"); + assert(_succ != Self, "invariant"); assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant"); // The thread -- now the owner -- is back in vm mode. @@ -434,7 +433,7 @@ void NOINLINE ObjectMonitor::enter(TRAPS) { // Caveat: TryLock() is not necessarily serializing if it returns failure. // Callers must compensate as needed. -int ObjectMonitor::TryLock (Thread * Self) { +int ObjectMonitor::TryLock(Thread * Self) { void * own = _owner; if (own != NULL) return 0; if (Atomic::cmpxchg_ptr (Self, &_owner, NULL) == NULL) { @@ -451,16 +450,16 @@ int ObjectMonitor::TryLock (Thread * Self) { return -1; } -void NOINLINE ObjectMonitor::EnterI (TRAPS) { +void NOINLINE ObjectMonitor::EnterI(TRAPS) { Thread * const Self = THREAD; assert(Self->is_Java_thread(), "invariant"); - assert(((JavaThread *) Self)->thread_state() == _thread_blocked , "invariant"); + assert(((JavaThread *) Self)->thread_state() == _thread_blocked, "invariant"); // Try the lock - TATAS if (TryLock (Self) > 0) { - assert(_succ != Self , "invariant"); - assert(_owner == Self , "invariant"); - assert(_Responsible != Self , "invariant"); + assert(_succ != Self, "invariant"); + assert(_owner == Self, "invariant"); + assert(_Responsible != Self, "invariant"); return; } @@ -474,16 +473,16 @@ void NOINLINE ObjectMonitor::EnterI (TRAPS) { // effects. if (TrySpin (Self) > 0) { - assert(_owner == Self , "invariant"); - assert(_succ != Self , "invariant"); - assert(_Responsible != Self , "invariant"); + assert(_owner == Self, "invariant"); + assert(_succ != Self, "invariant"); + assert(_Responsible != Self, "invariant"); return; } // The Spin failed -- Enqueue and park the thread ... - assert(_succ != Self , "invariant"); - assert(_owner != Self , "invariant"); - assert(_Responsible != Self , "invariant"); + assert(_succ != Self, "invariant"); + assert(_owner != Self, "invariant"); + assert(_Responsible != Self, "invariant"); // Enqueue "Self" on ObjectMonitor's _cxq. // @@ -493,7 +492,6 @@ void NOINLINE ObjectMonitor::EnterI (TRAPS) { // Java objects. This would avoid awkward lifecycle and liveness issues, // as well as eliminate a subset of ABA issues. // TODO: eliminate ObjectWaiter and enqueue either Threads or Events. - // ObjectWaiter node(Self); Self->_ParkEvent->reset(); @@ -512,9 +510,9 @@ void NOINLINE ObjectMonitor::EnterI (TRAPS) { // Interference - the CAS failed because _cxq changed. Just retry. // As an optional optimization we retry the lock. if (TryLock (Self) > 0) { - assert(_succ != Self , "invariant"); - assert(_owner == Self , "invariant"); - assert(_Responsible != Self , "invariant"); + assert(_succ != Self, "invariant"); + assert(_owner == Self, "invariant"); + assert(_Responsible != Self, "invariant"); return; } } @@ -629,8 +627,8 @@ void NOINLINE ObjectMonitor::EnterI (TRAPS) { // The head of cxq is volatile but the interior is stable. // In addition, Self.TState is stable. - assert(_owner == Self , "invariant"); - assert(object() != NULL , "invariant"); + assert(_owner == Self, "invariant"); + assert(object() != NULL, "invariant"); // I'd like to write: // guarantee (((oop)(object()))->mark() == markOopDesc::encode(this), "invariant") ; // but as we're at a safepoint that's not safe. @@ -700,12 +698,12 @@ void NOINLINE ObjectMonitor::EnterI (TRAPS) { // Knob_Reset and Knob_SpinAfterFutile support and restructuring the // loop accordingly. -void NOINLINE ObjectMonitor::ReenterI (Thread * Self, ObjectWaiter * SelfNode) { - assert(Self != NULL , "invariant"); - assert(SelfNode != NULL , "invariant"); - assert(SelfNode->_thread == Self , "invariant"); - assert(_waiters > 0 , "invariant"); - assert(((oop)(object()))->mark() == markOopDesc::encode(this) , "invariant"); +void NOINLINE ObjectMonitor::ReenterI(Thread * Self, ObjectWaiter * SelfNode) { + assert(Self != NULL, "invariant"); + assert(SelfNode != NULL, "invariant"); + assert(SelfNode->_thread == Self, "invariant"); + assert(_waiters > 0, "invariant"); + assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant"); assert(((JavaThread *)Self)->thread_state() != _thread_blocked, "invariant"); JavaThread * jt = (JavaThread *) Self; @@ -792,8 +790,7 @@ void NOINLINE ObjectMonitor::ReenterI (Thread * Self, ObjectWaiter * SelfNode) { // after the thread acquires the lock in ::enter(). Equally, we could defer // unlinking the thread until ::exit()-time. -void ObjectMonitor::UnlinkAfterAcquire (Thread * Self, ObjectWaiter * SelfNode) -{ +void ObjectMonitor::UnlinkAfterAcquire(Thread *Self, ObjectWaiter *SelfNode) { assert(_owner == Self, "invariant"); assert(SelfNode->_thread == Self, "invariant"); @@ -980,7 +977,7 @@ void NOINLINE ObjectMonitor::exit(bool not_suspended, TRAPS) { // Instead, I use release_store(), which is implemented as just a simple // ST on x64, x86 and SPARC. OrderAccess::release_store_ptr(&_owner, NULL); // drop the lock - OrderAccess::storeload(); // See if we need to wake a successor + OrderAccess::storeload(); // See if we need to wake a successor if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) { TEVENT(Inflated exit - simple egress); return; @@ -1017,7 +1014,6 @@ void NOINLINE ObjectMonitor::exit(bool not_suspended, TRAPS) { // The dropped lock needs to become visible to the spinner, and then // the acquisition of the lock by the spinner must become visible to // the exiting thread). - // // It appears that an heir-presumptive (successor) must be made ready. // Only the current lock owner can manipulate the EntryList or @@ -1081,7 +1077,7 @@ void NOINLINE ObjectMonitor::exit(bool not_suspended, TRAPS) { // This policy ensure that recently-run threads live at the head of EntryList. // Drain _cxq into EntryList - bulk transfer. // First, detach _cxq. - // The following loop is tantamount to: w = swap (&cxq, NULL) + // The following loop is tantamount to: w = swap(&cxq, NULL) w = _cxq; for (;;) { assert(w != NULL, "Invariant"); @@ -1089,7 +1085,7 @@ void NOINLINE ObjectMonitor::exit(bool not_suspended, TRAPS) { if (u == w) break; w = u; } - assert(w != NULL , "invariant"); + assert(w != NULL, "invariant"); ObjectWaiter * q = NULL; ObjectWaiter * p; @@ -1103,7 +1099,9 @@ void NOINLINE ObjectMonitor::exit(bool not_suspended, TRAPS) { // Append the RATs to the EntryList // TODO: organize EntryList as a CDLL so we can locate the tail in constant-time. ObjectWaiter * Tail; - for (Tail = _EntryList; Tail != NULL && Tail->_next != NULL; Tail = Tail->_next); + for (Tail = _EntryList; Tail != NULL && Tail->_next != NULL; + Tail = Tail->_next) + /* empty */; if (Tail == NULL) { _EntryList = w; } else { @@ -1120,7 +1118,7 @@ void NOINLINE ObjectMonitor::exit(bool not_suspended, TRAPS) { // Drain _cxq into EntryList - bulk transfer. // First, detach _cxq. - // The following loop is tantamount to: w = swap (&cxq, NULL) + // The following loop is tantamount to: w = swap(&cxq, NULL) w = _cxq; for (;;) { assert(w != NULL, "Invariant"); @@ -1128,7 +1126,7 @@ void NOINLINE ObjectMonitor::exit(bool not_suspended, TRAPS) { if (u == w) break; w = u; } - assert(w != NULL , "invariant"); + assert(w != NULL, "invariant"); ObjectWaiter * q = NULL; ObjectWaiter * p; @@ -1174,7 +1172,7 @@ void NOINLINE ObjectMonitor::exit(bool not_suspended, TRAPS) { // Drain _cxq into EntryList - bulk transfer. // First, detach _cxq. - // The following loop is tantamount to: w = swap (&cxq, NULL) + // The following loop is tantamount to: w = swap(&cxq, NULL) for (;;) { assert(w != NULL, "Invariant"); ObjectWaiter * u = (ObjectWaiter *) Atomic::cmpxchg_ptr(NULL, &_cxq, w); @@ -1183,8 +1181,8 @@ void NOINLINE ObjectMonitor::exit(bool not_suspended, TRAPS) { } TEVENT(Inflated exit - drain cxq into EntryList); - assert(w != NULL , "invariant"); - assert(_EntryList == NULL , "invariant"); + assert(w != NULL, "invariant"); + assert(_EntryList == NULL, "invariant"); // Convert the LIFO SLL anchored by _cxq into a DLL. // The list reorganization step operates in O(LENGTH(w)) time. @@ -1277,7 +1275,7 @@ void NOINLINE ObjectMonitor::exit(bool not_suspended, TRAPS) { // decreased. - Dave -bool ObjectMonitor::ExitSuspendEquivalent (JavaThread * jSelf) { +bool ObjectMonitor::ExitSuspendEquivalent(JavaThread * jSelf) { const int Mode = Knob_FastHSSEC; if (Mode && !jSelf->is_external_suspend()) { assert(jSelf->is_suspend_equivalent(), "invariant"); @@ -1292,7 +1290,7 @@ bool ObjectMonitor::ExitSuspendEquivalent (JavaThread * jSelf) { } -void ObjectMonitor::ExitEpilog (Thread * Self, ObjectWaiter * Wakee) { +void ObjectMonitor::ExitEpilog(Thread * Self, ObjectWaiter * Wakee) { assert(_owner == Self, "invariant"); // Exit protocol: @@ -1346,7 +1344,7 @@ intptr_t ObjectMonitor::complete_exit(TRAPS) { if (THREAD != _owner) { if (THREAD->is_lock_owned ((address)_owner)) { assert(_recursions == 0, "internal state error"); - _owner = THREAD; /* Convert from basiclock addr to Thread addr */ + _owner = THREAD; // Convert from basiclock addr to Thread addr _recursions = 0; OwnerIsThread = 1; } @@ -1381,18 +1379,18 @@ void ObjectMonitor::reenter(intptr_t recursions, TRAPS) { // which use this (which is why we don't put this into check_slow and // call it with a CHECK argument). -#define CHECK_OWNER() \ - do { \ - if (THREAD != _owner) { \ - if (THREAD->is_lock_owned((address) _owner)) { \ - _owner = THREAD; /* Convert from basiclock addr to Thread addr */ \ - _recursions = 0; \ - OwnerIsThread = 1; \ - } else { \ - TEVENT(Throw IMSX); \ - THROW(vmSymbols::java_lang_IllegalMonitorStateException()); \ - } \ - } \ +#define CHECK_OWNER() \ + do { \ + if (THREAD != _owner) { \ + if (THREAD->is_lock_owned((address) _owner)) { \ + _owner = THREAD; /* Convert from basiclock addr to Thread addr */ \ + _recursions = 0; \ + OwnerIsThread = 1; \ + } else { \ + TEVENT(Throw IMSX); \ + THROW(vmSymbols::java_lang_IllegalMonitorStateException()); \ + } \ + } \ } while (false) // check_slow() is a misnomer. It's called to simply to throw an IMSX exception. @@ -1404,9 +1402,9 @@ void ObjectMonitor::check_slow(TRAPS) { THROW_MSG(vmSymbols::java_lang_IllegalMonitorStateException(), "current thread not owner"); } -static int Adjust (volatile int * adr, int dx) { +static int Adjust(volatile int * adr, int dx) { int v; - for (v = *adr; Atomic::cmpxchg(v + dx, adr, v) != v; v = *adr); + for (v = *adr; Atomic::cmpxchg(v + dx, adr, v) != v; v = *adr) /* empty */; return v; } @@ -1517,8 +1515,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) { if (interruptible && (Thread::is_interrupted(THREAD, false) || HAS_PENDING_EXCEPTION)) { // Intentionally empty - } else - if (node._notified == 0) { + } else if (node._notified == 0) { if (millis <= 0) { Self->_ParkEvent->park(); } else { @@ -1534,7 +1531,6 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) { } // Exit thread safepoint: transition _thread_blocked -> _thread_in_vm - // Node may be on the WaitSet, the EntryList (or cxq), or in transition // from the WaitSet to the EntryList. // See if we need to remove Node from the WaitSet. @@ -1625,7 +1621,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) { // want residual elements associated with this thread left on any lists. guarantee(node.TState == ObjectWaiter::TS_RUN, "invariant"); assert(_owner == Self, "invariant"); - assert(_succ != Self , "invariant"); + assert(_succ != Self, "invariant"); } // OSThreadWaitState() jt->set_current_waiting_monitor(NULL); @@ -1635,8 +1631,8 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) { _waiters--; // decrement the number of waiters // Verify a few postconditions - assert(_owner == Self , "invariant"); - assert(_succ != Self , "invariant"); + assert(_owner == Self, "invariant"); + assert(_succ != Self, "invariant"); assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant"); if (SyncFlags & 32) { @@ -1703,8 +1699,7 @@ void ObjectMonitor::notify(TRAPS) { iterator->_prev = NULL; _EntryList = iterator; } - } else - if (Policy == 1) { // append to EntryList + } else if (Policy == 1) { // append to EntryList if (List == NULL) { iterator->_next = iterator->_prev = NULL; _EntryList = iterator; @@ -1713,14 +1708,13 @@ void ObjectMonitor::notify(TRAPS) { // the EntryList. We can make tail access constant-time by converting to // a CDLL instead of using our current DLL. ObjectWaiter * Tail; - for (Tail = List; Tail->_next != NULL; Tail = Tail->_next); + for (Tail = List; Tail->_next != NULL; Tail = Tail->_next) /* empty */; assert(Tail != NULL && Tail->_next == NULL, "invariant"); Tail->_next = iterator; iterator->_prev = Tail; iterator->_next = NULL; } - } else - if (Policy == 2) { // prepend to cxq + } else if (Policy == 2) { // prepend to cxq // prepend to cxq if (List == NULL) { iterator->_next = iterator->_prev = NULL; @@ -1735,8 +1729,7 @@ void ObjectMonitor::notify(TRAPS) { } } } - } else - if (Policy == 3) { // append to cxq + } else if (Policy == 3) { // append to cxq iterator->TState = ObjectWaiter::TS_CXQ; for (;;) { ObjectWaiter * Tail; @@ -1832,8 +1825,7 @@ void ObjectMonitor::notifyAll(TRAPS) { iterator->_prev = NULL; _EntryList = iterator; } - } else - if (Policy == 1) { // append to EntryList + } else if (Policy == 1) { // append to EntryList if (List == NULL) { iterator->_next = iterator->_prev = NULL; _EntryList = iterator; @@ -1842,14 +1834,13 @@ void ObjectMonitor::notifyAll(TRAPS) { // the EntryList. We can make tail access constant-time by converting to // a CDLL instead of using our current DLL. ObjectWaiter * Tail; - for (Tail = List; Tail->_next != NULL; Tail = Tail->_next); + for (Tail = List; Tail->_next != NULL; Tail = Tail->_next) /* empty */; assert(Tail != NULL && Tail->_next == NULL, "invariant"); Tail->_next = iterator; iterator->_prev = Tail; iterator->_next = NULL; } - } else - if (Policy == 2) { // prepend to cxq + } else if (Policy == 2) { // prepend to cxq // prepend to cxq iterator->TState = ObjectWaiter::TS_CXQ; for (;;) { @@ -1859,8 +1850,7 @@ void ObjectMonitor::notifyAll(TRAPS) { break; } } - } else - if (Policy == 3) { // append to cxq + } else if (Policy == 3) { // append to cxq iterator->TState = ObjectWaiter::TS_CXQ; for (;;) { ObjectWaiter * Tail; @@ -1969,7 +1959,6 @@ void ObjectMonitor::notifyAll(TRAPS) { // situation is not dire. The state is benign -- there's no need to add // hysteresis control to damp the transition rate between spinning and // not spinning. -// intptr_t ObjectMonitor::SpinCallbackArgument = 0; int (*ObjectMonitor::SpinCallbackFunction)(intptr_t, int) = NULL; @@ -1977,8 +1966,7 @@ int (*ObjectMonitor::SpinCallbackFunction)(intptr_t, int) = NULL; // Spinning: Fixed frequency (100%), vary duration -int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) { - +int ObjectMonitor::TrySpin_VaryDuration(Thread * Self) { // Dumb, brutal spin. Good for comparative measurements against adaptive spinning. int ctr = Knob_FixedSpin; if (ctr != 0) { @@ -2241,7 +2229,7 @@ int ObjectMonitor::TrySpin_VaryDuration (Thread * Self) { // Spinning, in general, is probabilistic anyway. -int ObjectMonitor::NotRunnable (Thread * Self, Thread * ox) { +int ObjectMonitor::NotRunnable(Thread * Self, Thread * ox) { // Check either OwnerIsThread or ox->TypeTag == 2BAD. if (!OwnerIsThread) return 0; @@ -2378,8 +2366,16 @@ void ObjectMonitor::Initialize() { InitializationCompleted = 1; if (UsePerfData) { EXCEPTION_MARK; - #define NEWPERFCOUNTER(n) {n = PerfDataManager::create_counter(SUN_RT, #n, PerfData::U_Events,CHECK); } - #define NEWPERFVARIABLE(n) {n = PerfDataManager::create_variable(SUN_RT, #n, PerfData::U_Events,CHECK); } +#define NEWPERFCOUNTER(n) \ + { \ + n = PerfDataManager::create_counter(SUN_RT, #n, PerfData::U_Events, \ + CHECK); \ + } +#define NEWPERFVARIABLE(n) \ + { \ + n = PerfDataManager::create_variable(SUN_RT, #n, PerfData::U_Events, \ + CHECK); \ + } NEWPERFCOUNTER(_sync_Inflations); NEWPERFCOUNTER(_sync_Deflations); NEWPERFCOUNTER(_sync_ContendedLockAttempts); @@ -2398,7 +2394,8 @@ void ObjectMonitor::Initialize() { NEWPERFCOUNTER(_sync_MonInCirculation); NEWPERFCOUNTER(_sync_MonScavenged); NEWPERFVARIABLE(_sync_MonExtant); - #undef NEWPERFCOUNTER +#undef NEWPERFCOUNTER +#undef NEWPERFVARIABLE } } @@ -2416,7 +2413,7 @@ void ObjectMonitor::ctAsserts() { } -static char * kvGet (char * kvList, const char * Key) { +static char * kvGet(char * kvList, const char * Key) { if (kvList == NULL) return NULL; size_t n = strlen(Key); char * Search; @@ -2429,7 +2426,7 @@ static char * kvGet (char * kvList, const char * Key) { return NULL; } -static int kvGetInt (char * kvList, const char * Key, int Default) { +static int kvGetInt(char * kvList, const char * Key, int Default) { char * v = kvGet(kvList, Key); int rslt = v ? ::strtol(v, NULL, 0) : Default; if (Knob_ReportSettings && v != NULL) { @@ -2442,7 +2439,7 @@ static int kvGetInt (char * kvList, const char * Key, int Default) { void ObjectMonitor::DeferredInitialize() { if (InitDone > 0) return; if (Atomic::cmpxchg (-1, &InitDone, 0) != 0) { - while (InitDone != 1); + while (InitDone != 1) /* empty */; return; } @@ -2466,7 +2463,7 @@ void ObjectMonitor::DeferredInitialize() { if (*p == ':') *p = 0; } - #define SETKNOB(x) { Knob_##x = kvGetInt (knobs, #x, Knob_##x); } + #define SETKNOB(x) { Knob_##x = kvGetInt(knobs, #x, Knob_##x); } SETKNOB(ReportSettings); SETKNOB(Verbose); SETKNOB(VerifyInUse); diff --git a/hotspot/src/share/vm/runtime/objectMonitor.hpp b/hotspot/src/share/vm/runtime/objectMonitor.hpp index 914aeebc999..9f8091d189f 100644 --- a/hotspot/src/share/vm/runtime/objectMonitor.hpp +++ b/hotspot/src/share/vm/runtime/objectMonitor.hpp @@ -87,18 +87,18 @@ class ObjectMonitor { public: // TODO-FIXME: the "offset" routines should return a type of off_t instead of int ... // ByteSize would also be an appropriate type. - static int header_offset_in_bytes() { return offset_of(ObjectMonitor, _header); } - static int object_offset_in_bytes() { return offset_of(ObjectMonitor, _object); } - static int owner_offset_in_bytes() { return offset_of(ObjectMonitor, _owner); } - static int count_offset_in_bytes() { return offset_of(ObjectMonitor, _count); } + static int header_offset_in_bytes() { return offset_of(ObjectMonitor, _header); } + static int object_offset_in_bytes() { return offset_of(ObjectMonitor, _object); } + static int owner_offset_in_bytes() { return offset_of(ObjectMonitor, _owner); } + static int count_offset_in_bytes() { return offset_of(ObjectMonitor, _count); } static int recursions_offset_in_bytes() { return offset_of(ObjectMonitor, _recursions); } - static int cxq_offset_in_bytes() { return offset_of(ObjectMonitor, _cxq); } - static int succ_offset_in_bytes() { return offset_of(ObjectMonitor, _succ); } - static int EntryList_offset_in_bytes() { return offset_of(ObjectMonitor, _EntryList); } - static int FreeNext_offset_in_bytes() { return offset_of(ObjectMonitor, FreeNext); } - static int WaitSet_offset_in_bytes() { return offset_of(ObjectMonitor, _WaitSet); } + static int cxq_offset_in_bytes() { return offset_of(ObjectMonitor, _cxq); } + static int succ_offset_in_bytes() { return offset_of(ObjectMonitor, _succ); } + static int EntryList_offset_in_bytes() { return offset_of(ObjectMonitor, _EntryList); } + static int FreeNext_offset_in_bytes() { return offset_of(ObjectMonitor, FreeNext); } + static int WaitSet_offset_in_bytes() { return offset_of(ObjectMonitor, _WaitSet); } static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible); } - static int Spinner_offset_in_bytes() { return offset_of(ObjectMonitor, _Spinner); } + static int Spinner_offset_in_bytes() { return offset_of(ObjectMonitor, _Spinner); } public: // Eventually we'll make provisions for multiple callbacks, but @@ -140,8 +140,8 @@ class ObjectMonitor { ObjectMonitor() { _header = NULL; _count = 0; - _waiters = 0, - _recursions = 0; + _waiters = 0; + _recursions = 0; _object = NULL; _owner = NULL; _WaitSet = NULL; @@ -240,7 +240,7 @@ class ObjectMonitor { volatile markOop _header; // displaced object header word - mark void* volatile _object; // backward object pointer - strong root - double SharingPad[1]; // temp to reduce false sharing + double SharingPad[1]; // temp to reduce false sharing // All the following fields must be machine word aligned // The VM assumes write ordering wrt these fields, which can be @@ -248,25 +248,25 @@ class ObjectMonitor { protected: // protected for jvmtiRawMonitor void * volatile _owner; // pointer to owning thread OR BasicLock - volatile jlong _previous_owner_tid; // thread id of the previous owner of the monitor + volatile jlong _previous_owner_tid; // thread id of the previous owner of the monitor volatile intptr_t _recursions; // recursion count, 0 for first entry private: - int OwnerIsThread; // _owner is (Thread *) vs SP/BasicLock - ObjectWaiter * volatile _cxq; // LL of recently-arrived threads blocked on entry. - // The list is actually composed of WaitNodes, acting - // as proxies for Threads. + int OwnerIsThread; // _owner is (Thread *) vs SP/BasicLock + ObjectWaiter * volatile _cxq; // LL of recently-arrived threads blocked on entry. + // The list is actually composed of WaitNodes, acting + // as proxies for Threads. protected: - ObjectWaiter * volatile _EntryList; // Threads blocked on entry or reentry. + ObjectWaiter * volatile _EntryList; // Threads blocked on entry or reentry. private: Thread * volatile _succ; // Heir presumptive thread - used for futile wakeup throttling Thread * volatile _Responsible; - int _PromptDrain; // rqst to drain cxq into EntryList ASAP + int _PromptDrain; // rqst to drain cxq into EntryList ASAP - volatile int _Spinner; // for exit->spinner handoff optimization - volatile int _SpinFreq; // Spin 1-out-of-N attempts: success rate + volatile int _Spinner; // for exit->spinner handoff optimization + volatile int _SpinFreq; // Spin 1-out-of-N attempts: success rate volatile int _SpinClock; volatile int _SpinDuration; - volatile intptr_t _SpinState; // MCS/CLH list of spinners + volatile intptr_t _SpinState; // MCS/CLH list of spinners // TODO-FIXME: _count, _waiters and _recursions should be of // type int, or int32_t but not intptr_t. There's no reason @@ -284,8 +284,8 @@ class ObjectMonitor { volatile int _WaitSetLock; // protects Wait Queue - simple spinlock public: - int _QMix; // Mixed prepend queue discipline - ObjectMonitor * FreeNext; // Free list linkage + int _QMix; // Mixed prepend queue discipline + ObjectMonitor * FreeNext; // Free list linkage intptr_t StatA, StatsB; public: @@ -328,9 +328,17 @@ class ObjectMonitor { }; #undef TEVENT -#define TEVENT(nom) {if (SyncVerbose) FEVENT(nom); } +#define TEVENT(nom) { if (SyncVerbose) FEVENT(nom); } -#define FEVENT(nom) { static volatile int ctr = 0; int v = ++ctr; if ((v & (v-1)) == 0) { ::printf (#nom " : %d \n", v); ::fflush(stdout); }} +#define FEVENT(nom) \ + { \ + static volatile int ctr = 0; \ + int v = ++ctr; \ + if ((v & (v - 1)) == 0) { \ + ::printf(#nom " : %d\n", v); \ + ::fflush(stdout); \ + } \ + } #undef TEVENT #define TEVENT(nom) {;} diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.hpp b/hotspot/src/share/vm/runtime/sharedRuntime.hpp index ebbee25453c..0d3335413cb 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp @@ -271,35 +271,33 @@ class SharedRuntime: AllStatic { // used by native wrappers to reenable yellow if overflow happened in native code static void reguard_yellow_pages(); - /** - * Fill in the "X cannot be cast to a Y" message for ClassCastException - * - * @param thr the current thread - * @param name the name of the class of the object attempted to be cast - * @return the dynamically allocated exception message (must be freed - * by the caller using a resource mark) - * - * BCP must refer to the current 'checkcast' opcode for the frame - * on top of the stack. - * The caller (or one of it's callers) must use a ResourceMark - * in order to correctly free the result. - */ + // Fill in the "X cannot be cast to a Y" message for ClassCastException + // + // @param thr the current thread + // @param name the name of the class of the object attempted to be cast + // @return the dynamically allocated exception message (must be freed + // by the caller using a resource mark) + // + // BCP must refer to the current 'checkcast' opcode for the frame + // on top of the stack. + // The caller (or one of it's callers) must use a ResourceMark + // in order to correctly free the result. + // static char* generate_class_cast_message(JavaThread* thr, const char* name); - /** - * Fill in the "X cannot be cast to a Y" message for ClassCastException - * - * @param name the name of the class of the object attempted to be cast - * @param klass the name of the target klass attempt - * @param gripe the specific kind of problem being reported - * @return the dynamically allocated exception message (must be freed - * by the caller using a resource mark) - * - * This version does not require access the frame, so it can be called - * from interpreted code - * The caller (or one of it's callers) must use a ResourceMark - * in order to correctly free the result. - */ + // Fill in the "X cannot be cast to a Y" message for ClassCastException + // + // @param name the name of the class of the object attempted to be cast + // @param klass the name of the target klass attempt + // @param gripe the specific kind of problem being reported + // @return the dynamically allocated exception message (must be freed + // by the caller using a resource mark) + // + // This version does not require access the frame, so it can be called + // from interpreted code + // The caller (or one of it's callers) must use a ResourceMark + // in order to correctly free the result. + // static char* generate_class_cast_message(const char* name, const char* klass, const char* gripe = " cannot be cast to "); @@ -422,17 +420,17 @@ class SharedRuntime: AllStatic { // pointer to the C heap storage. This pointer is the return value from // OSR_migration_begin. - static intptr_t* OSR_migration_begin( JavaThread *thread); + static intptr_t* OSR_migration_begin(JavaThread *thread); // OSR_migration_end is a trivial routine. It is called after the compiled // method has extracted the jvm state from the C heap that OSR_migration_begin // created. It's entire job is to simply free this storage. - static void OSR_migration_end ( intptr_t* buf); + static void OSR_migration_end(intptr_t* buf); // Convert a sig into a calling convention register layout // and find interesting things about it. static VMRegPair* find_callee_arguments(Symbol* sig, bool has_receiver, bool has_appendix, int *arg_size); - static VMReg name_for_receiver(); + static VMReg name_for_receiver(); // "Top of Stack" slots that may be unused by the calling convention but must // otherwise be preserved. @@ -691,7 +689,7 @@ class AdapterHandlerLibrary: public AllStatic { static bool contains(CodeBlob* b); #ifndef PRODUCT static void print_statistics(); -#endif /* PRODUCT */ +#endif // PRODUCT }; diff --git a/hotspot/src/share/vm/runtime/synchronizer.cpp b/hotspot/src/share/vm/runtime/synchronizer.cpp index 83565a90a3c..830ef5d2ba4 100644 --- a/hotspot/src/share/vm/runtime/synchronizer.cpp +++ b/hotspot/src/share/vm/runtime/synchronizer.cpp @@ -57,7 +57,6 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // for instance. If you make changes here, make sure to modify the // interpreter, and both C1 and C2 fast-path inline locking code emission. // -// // ----------------------------------------------------------------------------- #ifdef DTRACE_ENABLED @@ -77,10 +76,10 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC #define DTRACE_MONITOR_WAIT_PROBE(monitor, obj, thread, millis) \ { \ - if (DTraceMonitorProbes) { \ + if (DTraceMonitorProbes) { \ DTRACE_MONITOR_PROBE_COMMON(obj, thread); \ HOTSPOT_MONITOR_WAIT(jtid, \ - (uintptr_t)(monitor), bytes, len, (millis)); \ + (uintptr_t)(monitor), bytes, len, (millis)); \ } \ } @@ -88,10 +87,10 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread) \ { \ - if (DTraceMonitorProbes) { \ + if (DTraceMonitorProbes) { \ DTRACE_MONITOR_PROBE_COMMON(obj, thread); \ HOTSPOT_MONITOR_PROBE_##probe(jtid, /* probe = waited */ \ - (uintptr_t)(monitor), bytes, len); \ + (uintptr_t)(monitor), bytes, len); \ } \ } @@ -116,8 +115,8 @@ ObjectMonitor * volatile ObjectSynchronizer::gFreeList = NULL; ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList = NULL; int ObjectSynchronizer::gOmInUseCount = 0; static volatile intptr_t ListLock = 0; // protects global monitor free-list cache -static volatile int MonitorFreeCount = 0; // # on gFreeList -static volatile int MonitorPopulation = 0; // # Extant -- in circulation +static volatile int MonitorFreeCount = 0; // # on gFreeList +static volatile int MonitorPopulation = 0; // # Extant -- in circulation #define CHAINMARKER (cast_to_oop(-1)) // ----------------------------------------------------------------------------- @@ -127,7 +126,8 @@ static volatile int MonitorPopulation = 0; // # Extant -- in circulation // if the following function is changed. The implementation is // extremely sensitive to race condition. Be careful. -void ObjectSynchronizer::fast_enter(Handle obj, BasicLock* lock, bool attempt_rebias, TRAPS) { +void ObjectSynchronizer::fast_enter(Handle obj, BasicLock* lock, + bool attempt_rebias, TRAPS) { if (UseBiasedLocking) { if (!SafepointSynchronize::is_at_safepoint()) { BiasedLocking::Condition cond = BiasedLocking::revoke_and_rebias(obj, attempt_rebias, THREAD); @@ -198,8 +198,8 @@ void ObjectSynchronizer::slow_enter(Handle obj, BasicLock* lock, TRAPS) { return; } // Fall through to inflate() ... - } else - if (mark->has_locker() && THREAD->is_lock_owned((address)mark->locker())) { + } else if (mark->has_locker() && + THREAD->is_lock_owned((address)mark->locker())) { assert(lock != mark->locker(), "must not re-lock the same lock"); assert(lock != (BasicLock*)obj->mark(), "don't relock with same BasicLock"); lock->set_displaced_header(NULL); @@ -261,7 +261,7 @@ void ObjectSynchronizer::reenter(Handle obj, intptr_t recursion, TRAPS) { // ----------------------------------------------------------------------------- // JNI locks on java objects // NOTE: must use heavy weight monitor to handle jni monitor enter -void ObjectSynchronizer::jni_enter(Handle obj, TRAPS) { // possible entry from jni enter +void ObjectSynchronizer::jni_enter(Handle obj, TRAPS) { // the current locking is from JNI instead of Java code TEVENT(jni_enter); if (UseBiasedLocking) { @@ -349,7 +349,7 @@ int ObjectSynchronizer::wait(Handle obj, jlong millis, TRAPS) { return dtrace_waited_probe(monitor, obj, THREAD); } -void ObjectSynchronizer::waitUninterruptibly (Handle obj, jlong millis, TRAPS) { +void ObjectSynchronizer::waitUninterruptibly(Handle obj, jlong millis, TRAPS) { if (UseBiasedLocking) { BiasedLocking::revoke_and_rebias(obj, false, THREAD); assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); @@ -426,7 +426,7 @@ static SharedGlobals GVars; static int MonitorScavengeThreshold = 1000000; static volatile int ForceMonitorScavenge = 0; // Scavenge required and pending -static markOop ReadStableMark (oop obj) { +static markOop ReadStableMark(oop obj) { markOop mark = obj->mark(); if (!mark->is_being_inflated()) { return mark; // normal fast-path return @@ -510,7 +510,6 @@ static markOop ReadStableMark (oop obj) { // result in hashtable collisions and reduced hashtable efficiency. // There are simple ways to "diffuse" the middle address bits over the // generated hashCode values: -// static inline intptr_t get_next_hash(Thread * Self, oop obj) { intptr_t value = 0; @@ -520,21 +519,17 @@ static inline intptr_t get_next_hash(Thread * Self, oop obj) { // On MP system we'll have lots of RW access to a global, so the // mechanism induces lots of coherency traffic. value = os::random(); - } else - if (hashCode == 1) { + } else if (hashCode == 1) { // This variation has the property of being stable (idempotent) // between STW operations. This can be useful in some of the 1-0 // synchronization schemes. intptr_t addrBits = cast_from_oop(obj) >> 3; value = addrBits ^ (addrBits >> 5) ^ GVars.stwRandom; - } else - if (hashCode == 2) { + } else if (hashCode == 2) { value = 1; // for sensitivity testing - } else - if (hashCode == 3) { + } else if (hashCode == 3) { value = ++GVars.hcSequence; - } else - if (hashCode == 4) { + } else if (hashCode == 4) { value = cast_from_oop(obj); } else { // Marsaglia's xor-shift scheme with thread-specific state @@ -557,8 +552,8 @@ static inline intptr_t get_next_hash(Thread * Self, oop obj) { TEVENT(hashCode: GENERATE); return value; } -// -intptr_t ObjectSynchronizer::FastHashCode (Thread * Self, oop obj) { + +intptr_t ObjectSynchronizer::FastHashCode(Thread * Self, oop obj) { if (UseBiasedLocking) { // NOTE: many places throughout the JVM do not expect a safepoint // to be taken here, in particular most operations on perm gen @@ -592,7 +587,7 @@ intptr_t ObjectSynchronizer::FastHashCode (Thread * Self, oop obj) { ObjectMonitor* monitor = NULL; markOop temp, test; intptr_t hash; - markOop mark = ReadStableMark (obj); + markOop mark = ReadStableMark(obj); // object should remain ineligible for biased locking assert(!mark->has_bias_pattern(), "invariant"); @@ -706,7 +701,7 @@ ObjectSynchronizer::LockOwnership ObjectSynchronizer::query_lock_ownership // The caller must beware this method can revoke bias, and // revocation can result in a safepoint. assert(!SafepointSynchronize::is_at_safepoint(), "invariant"); - assert(self->thread_state() != _thread_blocked , "invariant"); + assert(self->thread_state() != _thread_blocked, "invariant"); // Possible mark states: neutral, biased, stack-locked, inflated @@ -841,7 +836,6 @@ void ObjectSynchronizer::oops_do(OopClosure* f) { // -- unassigned and on a thread's private omFreeList // -- assigned to an object. The object is inflated and the mark refers // to the objectmonitor. -// // Constraining monitor pool growth via MonitorBound ... @@ -859,9 +853,8 @@ void ObjectSynchronizer::oops_do(OopClosure* f) { // See also: GuaranteedSafepointInterval // // The current implementation uses asynchronous VM operations. -// -static void InduceScavenge (Thread * Self, const char * Whence) { +static void InduceScavenge(Thread * Self, const char * Whence) { // Induce STW safepoint to trim monitors // Ultimately, this results in a call to deflate_idle_monitors() in the near future. // More precisely, trigger an asynchronous STW safepoint as the number @@ -886,7 +879,7 @@ static void InduceScavenge (Thread * Self, const char * Whence) { } } -void ObjectSynchronizer::verifyInUse (Thread *Self) { +void ObjectSynchronizer::verifyInUse(Thread *Self) { ObjectMonitor* mid; int inusetally = 0; for (mid = Self->omInUseList; mid != NULL; mid = mid->FreeNext) { @@ -901,7 +894,7 @@ void ObjectSynchronizer::verifyInUse (Thread *Self) { assert(freetally == Self->omFreeCount, "free count off"); } -ObjectMonitor * NOINLINE ObjectSynchronizer::omAlloc (Thread * Self) { +ObjectMonitor * NOINLINE ObjectSynchronizer::omAlloc(Thread * Self) { // A large MAXPRIVATE value reduces both list lock contention // and list coherency traffic, but also tends to increase the // number of objectMonitors in circulation as well as the STW @@ -1032,9 +1025,9 @@ ObjectMonitor * NOINLINE ObjectSynchronizer::omAlloc (Thread * Self) { // omRelease is to return a monitor to the free list after a CAS // attempt failed. This doesn't allow unbounded #s of monitors to // accumulate on a thread's free list. -// -void ObjectSynchronizer::omRelease (Thread * Self, ObjectMonitor * m, bool fromPerThreadAlloc) { +void ObjectSynchronizer::omRelease(Thread * Self, ObjectMonitor * m, + bool fromPerThreadAlloc) { guarantee(m->object() == NULL, "invariant"); // Remove from omInUseList @@ -1086,7 +1079,7 @@ void ObjectSynchronizer::omRelease (Thread * Self, ObjectMonitor * m, bool fromP // be not inopportune interleavings between omFlush() and the scavenge // operator. -void ObjectSynchronizer::omFlush (Thread * Self) { +void ObjectSynchronizer::omFlush(Thread * Self) { ObjectMonitor * List = Self->omFreeList; // Null-terminated SLL Self->omFreeList = NULL; ObjectMonitor * Tail = NULL; @@ -1152,7 +1145,8 @@ ObjectMonitor* ObjectSynchronizer::inflate_helper(oop obj) { // multiple locks occupy the same $ line. Padding might be appropriate. -ObjectMonitor * NOINLINE ObjectSynchronizer::inflate (Thread * Self, oop object) { +ObjectMonitor * NOINLINE ObjectSynchronizer::inflate(Thread * Self, + oop object) { // Inflate mutates the heap ... // Relaxing assertion for bug 6320749. assert(Universe::verify_in_progress() || @@ -1373,7 +1367,6 @@ ObjectMonitor * NOINLINE ObjectSynchronizer::inflate (Thread * Self, oop object) // typically drives the scavenge rate. Large heaps can mean infrequent GC, // which in turn can mean large(r) numbers of objectmonitors in circulation. // This is an unfortunate aspect of this design. -// enum ManifestConstants { ClearResponsibleAtSTW = 0, @@ -1383,7 +1376,8 @@ enum ManifestConstants { // Deflate a single monitor if not in use // Return true if deflated, false if in use bool ObjectSynchronizer::deflate_monitor(ObjectMonitor* mid, oop obj, - ObjectMonitor** freeHeadp, ObjectMonitor** freeTailp) { + ObjectMonitor** freeHeadp, + ObjectMonitor** freeTailp) { bool deflated; // Normal case ... The monitor is associated with obj. guarantee(obj->mark() == markOopDesc::encode(mid), "invariant"); @@ -1427,7 +1421,8 @@ bool ObjectSynchronizer::deflate_monitor(ObjectMonitor* mid, oop obj, // Caller acquires ListLock int ObjectSynchronizer::walk_monitor_list(ObjectMonitor** listheadp, - ObjectMonitor** freeHeadp, ObjectMonitor** freeTailp) { + ObjectMonitor** freeHeadp, + ObjectMonitor** freeTailp) { ObjectMonitor* mid; ObjectMonitor* next; ObjectMonitor* curmidinuse = NULL; diff --git a/hotspot/src/share/vm/runtime/synchronizer.hpp b/hotspot/src/share/vm/runtime/synchronizer.hpp index ceb4a725ae6..e66f1b511b5 100644 --- a/hotspot/src/share/vm/runtime/synchronizer.hpp +++ b/hotspot/src/share/vm/runtime/synchronizer.hpp @@ -52,25 +52,26 @@ class ObjectSynchronizer : AllStatic { // assembly copies of these routines. Please keep them synchronized. // // attempt_rebias flag is used by UseBiasedLocking implementation - static void fast_enter (Handle obj, BasicLock* lock, bool attempt_rebias, TRAPS); - static void fast_exit (oop obj, BasicLock* lock, Thread* THREAD); + static void fast_enter(Handle obj, BasicLock* lock, bool attempt_rebias, + TRAPS); + static void fast_exit(oop obj, BasicLock* lock, Thread* THREAD); // WARNING: They are ONLY used to handle the slow cases. They should // only be used when the fast cases failed. Use of these functions // without previous fast case check may cause fatal error. - static void slow_enter (Handle obj, BasicLock* lock, TRAPS); - static void slow_exit (oop obj, BasicLock* lock, Thread* THREAD); + static void slow_enter(Handle obj, BasicLock* lock, TRAPS); + static void slow_exit(oop obj, BasicLock* lock, Thread* THREAD); // Used only to handle jni locks or other unmatched monitor enter/exit // Internally they will use heavy weight monitor. - static void jni_enter (Handle obj, TRAPS); + static void jni_enter(Handle obj, TRAPS); static bool jni_try_enter(Handle obj, Thread* THREAD); // Implements Unsafe.tryMonitorEnter - static void jni_exit (oop obj, Thread* THREAD); + static void jni_exit(oop obj, Thread* THREAD); // Handle all interpreter, compiler and jni cases - static int wait (Handle obj, jlong millis, TRAPS); - static void notify (Handle obj, TRAPS); - static void notifyall (Handle obj, TRAPS); + static int wait(Handle obj, jlong millis, TRAPS); + static void notify(Handle obj, TRAPS); + static void notifyall(Handle obj, TRAPS); // Special internal-use-only method for use by JVM infrastructure // that needs to wait() on a java-level object but that can't risk @@ -80,13 +81,14 @@ class ObjectSynchronizer : AllStatic { // used by classloading to free classloader object lock, // wait on an internal lock, and reclaim original lock // with original recursion count - static intptr_t complete_exit (Handle obj, TRAPS); - static void reenter (Handle obj, intptr_t recursion, TRAPS); + static intptr_t complete_exit(Handle obj, TRAPS); + static void reenter (Handle obj, intptr_t recursion, TRAPS); // thread-specific and global objectMonitor free list accessors static void verifyInUse(Thread * Self); static ObjectMonitor * omAlloc(Thread * Self); - static void omRelease(Thread * Self, ObjectMonitor * m, bool FromPerThreadAlloc); + static void omRelease(Thread * Self, ObjectMonitor * m, + bool FromPerThreadAlloc); static void omFlush(Thread * Self); // Inflate light weight monitor to heavy weight monitor @@ -116,7 +118,8 @@ class ObjectSynchronizer : AllStatic { static int walk_monitor_list(ObjectMonitor** listheadp, ObjectMonitor** freeHeadp, ObjectMonitor** freeTailp); - static bool deflate_monitor(ObjectMonitor* mid, oop obj, ObjectMonitor** freeHeadp, + static bool deflate_monitor(ObjectMonitor* mid, oop obj, + ObjectMonitor** freeHeadp, ObjectMonitor** freeTailp); static void oops_do(OopClosure* f); @@ -159,13 +162,13 @@ class ObjectLocker : public StackObj { ~ObjectLocker(); // Monitor behavior - void wait (TRAPS) { ObjectSynchronizer::wait (_obj, 0, CHECK); } // wait forever - void notify_all(TRAPS) { ObjectSynchronizer::notifyall(_obj, CHECK); } - void waitUninterruptibly (TRAPS) { ObjectSynchronizer::waitUninterruptibly (_obj, 0, CHECK); } + void wait(TRAPS) { ObjectSynchronizer::wait(_obj, 0, CHECK); } // wait forever + void notify_all(TRAPS) { ObjectSynchronizer::notifyall(_obj, CHECK); } + void waitUninterruptibly(TRAPS) { ObjectSynchronizer::waitUninterruptibly(_obj, 0, CHECK); } // complete_exit gives up lock completely, returning recursion count // reenter reclaims lock with original recursion count - intptr_t complete_exit(TRAPS) { return ObjectSynchronizer::complete_exit(_obj, CHECK_0); } - void reenter(intptr_t recursion, TRAPS) { ObjectSynchronizer::reenter(_obj, recursion, CHECK); } + intptr_t complete_exit(TRAPS) { return ObjectSynchronizer::complete_exit(_obj, CHECK_0); } + void reenter(intptr_t recursion, TRAPS) { ObjectSynchronizer::reenter(_obj, recursion, CHECK); } }; #endif // SHARE_VM_RUNTIME_SYNCHRONIZER_HPP diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 0bea771f4b7..56cea3dea37 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -109,25 +109,25 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // Only bother with this argument setup if dtrace is available -#define HOTSPOT_THREAD_PROBE_start HOTSPOT_THREAD_START -#define HOTSPOT_THREAD_PROBE_stop HOTSPOT_THREAD_STOP + #define HOTSPOT_THREAD_PROBE_start HOTSPOT_THREAD_START + #define HOTSPOT_THREAD_PROBE_stop HOTSPOT_THREAD_STOP -#define DTRACE_THREAD_PROBE(probe, javathread) \ - { \ - ResourceMark rm(this); \ - int len = 0; \ - const char* name = (javathread)->get_thread_name(); \ - len = strlen(name); \ - HOTSPOT_THREAD_PROBE_##probe( /* probe = start, stop */ \ - (char *) name, len, \ - java_lang_Thread::thread_id((javathread)->threadObj()), \ - (uintptr_t) (javathread)->osthread()->thread_id(), \ - java_lang_Thread::is_daemon((javathread)->threadObj())); \ - } + #define DTRACE_THREAD_PROBE(probe, javathread) \ + { \ + ResourceMark rm(this); \ + int len = 0; \ + const char* name = (javathread)->get_thread_name(); \ + len = strlen(name); \ + HOTSPOT_THREAD_PROBE_##probe(/* probe = start, stop */ \ + (char *) name, len, \ + java_lang_Thread::thread_id((javathread)->threadObj()), \ + (uintptr_t) (javathread)->osthread()->thread_id(), \ + java_lang_Thread::is_daemon((javathread)->threadObj())); \ + } #else // ndef DTRACE_ENABLED -#define DTRACE_THREAD_PROBE(probe, javathread) + #define DTRACE_THREAD_PROBE(probe, javathread) #endif // ndef DTRACE_ENABLED @@ -154,9 +154,10 @@ void* Thread::allocate(size_t size, bool throw_excpt, MEMFLAGS flags) { ((uintptr_t) real_malloc_addr + (uintptr_t) aligned_size), "JavaThread alignment code overflowed allocated storage"); if (TraceBiasedLocking) { - if (aligned_addr != real_malloc_addr) + if (aligned_addr != real_malloc_addr) { tty->print_cr("Aligned thread " INTPTR_FORMAT " to " INTPTR_FORMAT, real_malloc_addr, aligned_addr); + } } ((Thread*) aligned_addr)->_real_malloc_address = real_malloc_addr; return aligned_addr; @@ -264,7 +265,7 @@ Thread::Thread() { this == (void*) align_size_up((intptr_t) _real_malloc_address, markOopDesc::biased_lock_alignment), "bug in forced alignment of thread objects"); } -#endif /* ASSERT */ +#endif // ASSERT } void Thread::initialize_thread_local_storage() { @@ -445,7 +446,6 @@ void Thread::send_async_exception(oop java_thread, oop java_throwable) { } -// // Check if an external suspend request has completed (or has been // cancelled). Returns true if the thread is externally suspended and // false otherwise. @@ -470,7 +470,6 @@ void Thread::send_async_exception(oop java_thread, oop java_throwable) { // 0x00080000 - suspend request cancelled in loop (return false) // 0x00100000 - thread suspended in loop (return true) // 0x00200000 - suspend not completed during retry loop (return false) -// // Helper class for tracing suspend wait debug bits. // @@ -528,7 +527,8 @@ class TraceSuspendDebugBits : public StackObj { #undef DEBUG_FALSE_BITS -bool JavaThread::is_ext_suspend_completed(bool called_by_wait, int delay, uint32_t *bits) { +bool JavaThread::is_ext_suspend_completed(bool called_by_wait, int delay, + uint32_t *bits) { TraceSuspendDebugBits tsdb(this, false /* !is_wait */, called_by_wait, bits); bool did_trans_retry = false; // only do thread_in_native_trans retry once @@ -649,7 +649,6 @@ bool JavaThread::is_ext_suspend_completed(bool called_by_wait, int delay, uint32 return false; } -// // Wait for an external suspend request to complete (or be cancelled). // Returns true if the thread is externally suspended and false otherwise. // @@ -737,20 +736,21 @@ bool JavaThread::wait_for_ext_suspend_completion(int retries, int delay, } #ifndef PRODUCT -void JavaThread::record_jump(address target, address instr, const char* file, int line) { +void JavaThread::record_jump(address target, address instr, const char* file, + int line) { // This should not need to be atomic as the only way for simultaneous // updates is via interrupts. Even then this should be rare or non-existent // and we don't care that much anyway. int index = _jmp_ring_index; - _jmp_ring_index = (index + 1 ) & (jump_ring_buffer_size - 1); + _jmp_ring_index = (index + 1) & (jump_ring_buffer_size - 1); _jmp_ring[index]._target = (intptr_t) target; _jmp_ring[index]._instruction = (intptr_t) instr; _jmp_ring[index]._file = file; _jmp_ring[index]._line = line; } -#endif /* PRODUCT */ +#endif // PRODUCT // Called by flat profiler // Callers have already called wait_for_ext_suspend_completion @@ -834,13 +834,13 @@ void Thread::print_on(outputStream* st) const { // Thread::print_on_error() is called by fatal error handler. Don't use // any lock or allocate memory. void Thread::print_on_error(outputStream* st, char* buf, int buflen) const { - if (is_VM_thread()) st->print("VMThread"); - else if (is_Compiler_thread()) st->print("CompilerThread"); - else if (is_Java_thread()) st->print("JavaThread"); - else if (is_GC_task_thread()) st->print("GCTaskThread"); - else if (is_Watcher_thread()) st->print("WatcherThread"); - else if (is_ConcurrentGC_thread()) st->print("ConcurrentGCThread"); - else st->print("Thread"); + if (is_VM_thread()) st->print("VMThread"); + else if (is_Compiler_thread()) st->print("CompilerThread"); + else if (is_Java_thread()) st->print("JavaThread"); + else if (is_GC_task_thread()) st->print("GCTaskThread"); + else if (is_Watcher_thread()) st->print("WatcherThread"); + else if (is_ConcurrentGC_thread()) st->print("ConcurrentGCThread"); + else st->print("Thread"); st->print(" [stack: " PTR_FORMAT "," PTR_FORMAT "]", _stack_base - _stack_size, _stack_base); @@ -883,8 +883,9 @@ bool Thread::owns_locks_but_compiled_lock() const { // no threads which allow_vm_block's are held void Thread::check_for_valid_safepoint_state(bool potential_vm_operation) { // Check if current thread is allowed to block at a safepoint - if (!(_allow_safepoint_count == 0)) + if (!(_allow_safepoint_count == 0)) { fatal("Possible safepoint reached by thread that does not allow it"); + } if (is_Java_thread() && ((JavaThread*)this)->thread_state() != _thread_in_vm) { fatal("LEAF method calling lock?"); } @@ -991,7 +992,8 @@ static Handle create_initial_thread_group(TRAPS) { } // Creates the initial Thread -static oop create_initial_thread(Handle thread_group, JavaThread* thread, TRAPS) { +static oop create_initial_thread(Handle thread_group, JavaThread* thread, + TRAPS) { Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK_NULL); instanceKlassHandle klass (THREAD, k); instanceHandle thread_oop = klass->allocate_instance_handle(CHECK_NULL); @@ -1035,8 +1037,9 @@ static const char* get_java_runtime_name(TRAPS) { vmSymbols::string_signature(), &fd); if (found) { oop name_oop = k->java_mirror()->obj_field(fd.offset()); - if (name_oop == NULL) + if (name_oop == NULL) { return NULL; + } const char* name = java_lang_String::as_utf8_string(name_oop, java_runtime_name, sizeof(java_runtime_name)); @@ -1056,8 +1059,9 @@ static const char* get_java_runtime_version(TRAPS) { vmSymbols::string_signature(), &fd); if (found) { oop name_oop = k->java_mirror()->obj_field(fd.offset()); - if (name_oop == NULL) + if (name_oop == NULL) { return NULL; + } const char* name = java_lang_String::as_utf8_string(name_oop, java_runtime_version, sizeof(java_runtime_version)); @@ -1107,7 +1111,8 @@ static void reset_vm_info_property(TRAPS) { } -void JavaThread::allocate_threadObj(Handle thread_group, char* thread_name, bool daemon, TRAPS) { +void JavaThread::allocate_threadObj(Handle thread_group, char* thread_name, + bool daemon, TRAPS) { assert(thread_group.not_null(), "thread group should be specified"); assert(threadObj() == NULL, "should only create Java thread object once"); @@ -1268,8 +1273,9 @@ int WatcherThread::sleep() const { } remaining -= time_slept; - if (remaining <= 0) + if (remaining <= 0) { break; + } } return time_slept; @@ -1387,7 +1393,9 @@ void WatcherThread::stop() { } void WatcherThread::unpark() { - MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? NULL : PeriodicTask_lock, Mutex::_no_safepoint_check_flag); + MutexLockerEx ml(PeriodicTask_lock->owned_by_self() + ? NULL + : PeriodicTask_lock, Mutex::_no_safepoint_check_flag); PeriodicTask_lock->notify(); } @@ -1455,7 +1463,7 @@ void JavaThread::initialize() { for (int ji = 0; ji < jump_ring_buffer_size; ji++) { record_jump(NULL, NULL, NULL, 0); } -#endif /* PRODUCT */ +#endif // PRODUCT set_thread_profiler(NULL); if (FlatProfiler::is_active()) { @@ -2061,19 +2069,16 @@ void JavaThread::check_and_handle_async_exceptions(bool check_unsafe_error) { condition == _async_unsafe_access_error && !has_pending_exception()) { condition = _no_async_condition; // done switch (thread_state()) { - case _thread_in_vm: - { + case _thread_in_vm: { JavaThread* THREAD = this; THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in an unsafe memory access operation"); } - case _thread_in_native: - { + case _thread_in_native: { ThreadInVMfromNative tiv(this); JavaThread* THREAD = this; THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in an unsafe memory access operation"); } - case _thread_in_Java: - { + case _thread_in_Java: { ThreadInVMfromJava tiv(this); JavaThread* THREAD = this; THROW_MSG(vmSymbols::java_lang_InternalError(), "a fault occurred in a recent unsafe memory access operation in compiled Java code"); @@ -2214,7 +2219,7 @@ void JavaThread::java_suspend() { // SR_lock to allow the thread to reach a stable thread state if // it is currently in a transient thread state. if (is_ext_suspend_completed(false /* !called_by_wait */, - SuspendRetryDelay, &debug_bits) ) { + SuspendRetryDelay, &debug_bits)) { return; } } @@ -2292,8 +2297,7 @@ void JavaThread::verify_not_published() { MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag); assert(!Threads::includes(this), "java thread shouldn't have been published yet!"); - } - else { + } else { assert(!Threads::includes(this), "java thread shouldn't have been published yet!"); } @@ -2570,7 +2574,7 @@ void JavaThread::deoptimize() { // search for the current bci in that string. address pc = fst.current()->pc(); nmethod* nm = (nmethod*) fst.current()->cb(); - ScopeDesc* sd = nm->scope_desc_at( pc); + ScopeDesc* sd = nm->scope_desc_at(pc); char buffer[8]; jio_snprintf(buffer, sizeof(buffer), "%d", sd->bci()); size_t len = strlen(buffer); @@ -2779,7 +2783,7 @@ void JavaThread::print_thread_state_on(outputStream *st) const { }; void JavaThread::print_thread_state() const { print_thread_state_on(tty); -}; +} #endif // PRODUCT // Called by Threads::print() for VM_PrintThreads operation @@ -2865,20 +2869,18 @@ const char* JavaThread::get_thread_name_string(char* buf, int buflen) const { typeArrayOop name = java_lang_Thread::name(thread_obj); if (name != NULL) { if (buf == NULL) { - name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length()); + name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), + name->length()); + } else { + name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), + name->length(), buf, buflen); } - else { - name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length(), buf, buflen); - } - } - else if (is_attaching_via_jni()) { // workaround for 6412693 - see 6404306 + } else if (is_attaching_via_jni()) { // workaround for 6412693 - see 6404306 name_str = ""; - } - else { + } else { name_str = Thread::name(); } - } - else { + } else { name_str = Thread::name(); } assert(name_str != NULL, "unexpected NULL thread name"); @@ -3165,8 +3167,9 @@ static void compiler_thread_entry(JavaThread* thread, TRAPS) { } // Create a CompilerThread -CompilerThread::CompilerThread(CompileQueue* queue, CompilerCounters* counters) -: JavaThread(&compiler_thread_entry) { +CompilerThread::CompilerThread(CompileQueue* queue, + CompilerCounters* counters) + : JavaThread(&compiler_thread_entry) { _env = NULL; _log = NULL; _task = NULL; @@ -3231,8 +3234,9 @@ void Threads::threads_do(ThreadClosure* tc) { // way to prevent termination of WatcherThread would be to acquire // Terminator_lock, but we can't do that without violating the lock rank // checking in some cases. - if (wt != NULL) + if (wt != NULL) { tc->do_thread(wt); + } // If CompilerThreads ever become non-JavaThreads, add them here } @@ -3290,7 +3294,6 @@ void Threads::initialize_jsr292_core_classes(TRAPS) { } jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { - extern void JDK_Version_init(); // Check version @@ -3422,8 +3425,10 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { VMThread::create(); Thread* vmthread = VMThread::vm_thread(); - if (!os::create_thread(vmthread, os::vm_thread)) - vm_exit_during_initialization("Cannot create VM thread. Out of system resources."); + if (!os::create_thread(vmthread, os::vm_thread)) { + vm_exit_during_initialization("Cannot create VM thread. " + "Out of system resources."); + } // Wait for the VM thread to become ready, and VMThread::run to initialize // Monitors can have spurious returns, must always check another state flag @@ -3613,7 +3618,9 @@ extern "C" { // Find a command line agent library and return its entry point for // -agentlib: -agentpath: -Xrun // num_symbol_entries must be passed-in since only the caller knows the number of symbols in the array. -static OnLoadEntry_t lookup_on_load(AgentLibrary* agent, const char *on_load_symbols[], size_t num_symbol_entries) { +static OnLoadEntry_t lookup_on_load(AgentLibrary* agent, + const char *on_load_symbols[], + size_t num_symbol_entries) { OnLoadEntry_t on_load_entry = NULL; void *library = NULL; @@ -4006,8 +4013,9 @@ void Threads::remove(JavaThread* p) { // Only one thread left, do a notify on the Threads_lock so a thread waiting // on destroy_vm will wake up. - if (number_of_non_daemon_threads() == 1) + if (number_of_non_daemon_threads() == 1) { Threads_lock->notify_all(); + } } ThreadService::remove_thread(p, daemon); @@ -4113,7 +4121,8 @@ void Threads::deoptimized_wrt_marked_nmethods() { // Get count Java threads that are waiting to enter the specified monitor. GrowableArray* Threads::get_pending_threads(int count, - address monitor, bool doLock) { + address monitor, + bool doLock) { assert(doLock || SafepointSynchronize::is_at_safepoint(), "must grab Threads_lock or be at safepoint"); GrowableArray* result = new GrowableArray(count); @@ -4135,7 +4144,8 @@ GrowableArray* Threads::get_pending_threads(int count, } -JavaThread *Threads::owning_thread_from_monitor_owner(address owner, bool doLock) { +JavaThread *Threads::owning_thread_from_monitor_owner(address owner, + bool doLock) { assert(doLock || Threads_lock->owned_by_self() || SafepointSynchronize::is_at_safepoint(), @@ -4156,7 +4166,6 @@ JavaThread *Threads::owning_thread_from_monitor_owner(address owner, bool doLock // like deadlock detection. if (UseHeavyMonitors) return NULL; - // // If we didn't find a matching Java thread and we didn't force use of // heavyweight monitors, then the owner is the stack address of the // Lock Word in the owning Java thread's stack. @@ -4176,15 +4185,15 @@ JavaThread *Threads::owning_thread_from_monitor_owner(address owner, bool doLock } // Threads::print_on() is called at safepoint by VM_PrintThreads operation. -void Threads::print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks) { +void Threads::print_on(outputStream* st, bool print_stacks, + bool internal_format, bool print_concurrent_locks) { char buf[32]; st->print_cr("%s", os::local_time_string(buf, sizeof(buf))); st->print_cr("Full thread dump %s (%s %s):", Abstract_VM_Version::vm_name(), Abstract_VM_Version::vm_release(), - Abstract_VM_Version::vm_info_string() - ); + Abstract_VM_Version::vm_info_string()); st->cr(); #if INCLUDE_ALL_GCS @@ -4229,7 +4238,8 @@ void Threads::print_on(outputStream* st, bool print_stacks, bool internal_format // that VM is not at safepoint and/or current thread is inside signal handler. // Don't print stack trace, as the stack may not be walkable. Don't allocate // memory (even in resource area), it might deadlock the error handler. -void Threads::print_on_error(outputStream* st, Thread* current, char* buf, int buflen) { +void Threads::print_on_error(outputStream* st, Thread* current, char* buf, + int buflen) { bool found_current = false; st->print_cr("Java Threads: ( => current thread )"); ALL_JAVA_THREADS(thread) { @@ -4301,7 +4311,7 @@ void Threads::print_on_error(outputStream* st, Thread* current, char* buf, int b typedef volatile int SpinLockT; -void Thread::SpinAcquire (volatile int * adr, const char * LockName) { +void Thread::SpinAcquire(volatile int * adr, const char * LockName) { if (Atomic::cmpxchg (1, adr, 0) == 0) { return; // normal fast-path return } @@ -4328,7 +4338,7 @@ void Thread::SpinAcquire (volatile int * adr, const char * LockName) { } } -void Thread::SpinRelease (volatile int * adr) { +void Thread::SpinRelease(volatile int * adr) { assert(*adr != 0, "invariant"); OrderAccess::fence(); // guarantee at least release consistency. // Roach-motel semantics. @@ -4397,7 +4407,7 @@ void Thread::SpinRelease (volatile int * adr) { typedef volatile intptr_t MutexT; // Mux Lock-word enum MuxBits { LOCKBIT = 1 }; -void Thread::muxAcquire (volatile intptr_t * Lock, const char * LockName) { +void Thread::muxAcquire(volatile intptr_t * Lock, const char * LockName) { intptr_t w = Atomic::cmpxchg_ptr(LOCKBIT, Lock, 0); if (w == 0) return; if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) { @@ -4443,7 +4453,7 @@ void Thread::muxAcquire (volatile intptr_t * Lock, const char * LockName) { } } -void Thread::muxAcquireW (volatile intptr_t * Lock, ParkEvent * ev) { +void Thread::muxAcquireW(volatile intptr_t * Lock, ParkEvent * ev) { intptr_t w = Atomic::cmpxchg_ptr(LOCKBIT, Lock, 0); if (w == 0) return; if ((w & LOCKBIT) == 0 && Atomic::cmpxchg_ptr (w|LOCKBIT, Lock, w) == w) { @@ -4528,7 +4538,7 @@ void Thread::muxAcquireW (volatile intptr_t * Lock, ParkEvent * ev) { // bidirectional fence/MEMBAR semantics, ensuring that all prior memory operations // executed within the critical section are complete and globally visible before the // store (CAS) to the lock-word that releases the lock becomes globally visible. -void Thread::muxRelease (volatile intptr_t * Lock) { +void Thread::muxRelease(volatile intptr_t * Lock) { for (;;) { const intptr_t w = Atomic::cmpxchg_ptr(0, Lock, LOCKBIT); assert(w & LOCKBIT, "invariant"); diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp index 410d440f23f..d474d6a5b1e 100644 --- a/hotspot/src/share/vm/runtime/thread.hpp +++ b/hotspot/src/share/vm/runtime/thread.hpp @@ -178,7 +178,6 @@ class Thread: public ThreadShadow { // 2. It would be more natural if set_external_suspend() is private and // part of java_suspend(), but that probably would affect the suspend/query // performance. Need more investigation on this. - // // suspend/resume lock: used for self-suspend Monitor* _SR_lock; @@ -514,7 +513,7 @@ class Thread: public ThreadShadow { void record_stack_base_and_size(); bool on_local_stack(address adr) const { - /* QQQ this has knowledge of direction, ought to be a stack method */ + // QQQ this has knowledge of direction, ought to be a stack method return (_stack_base >= adr && adr >= (_stack_base - _stack_size)); } @@ -624,8 +623,8 @@ class Thread: public ThreadShadow { inline Thread* Thread::current() { #ifdef ASSERT -// This function is very high traffic. Define PARANOID to enable expensive -// asserts. + // This function is very high traffic. Define PARANOID to enable expensive + // asserts. #ifdef PARANOID // Signal handler should call ThreadLocalStorage::get_thread_slow() Thread* t = ThreadLocalStorage::get_thread_slow(); @@ -843,8 +842,8 @@ class JavaThread: public Thread { jint _in_deopt_handler; // count of deoptimization // handlers thread is in volatile bool _doing_unsafe_access; // Thread may fault due to unsafe access - bool _do_not_unlock_if_synchronized; // Do not unlock the receiver of a synchronized method (since it was - // never locked) when throwing an exception. Used by interpreter only. + bool _do_not_unlock_if_synchronized; // Do not unlock the receiver of a synchronized method (since it was + // never locked) when throwing an exception. Used by interpreter only. // JNI attach states: enum JNIAttachStates { @@ -904,7 +903,7 @@ class JavaThread: public Thread { const char* _file; int _line; } _jmp_ring[jump_ring_buffer_size]; -#endif /* PRODUCT */ +#endif // PRODUCT #if INCLUDE_ALL_GCS // Support for G1 barriers @@ -1071,7 +1070,7 @@ class JavaThread: public Thread { // Warning: is_ext_suspend_completed() may temporarily drop the // SR_lock to allow the thread to reach a stable thread state if // it is currently in a transient thread state. - return is_ext_suspend_completed(false /*!called_by_wait */, + return is_ext_suspend_completed(false /* !called_by_wait */, SuspendRetryDelay, bits); } @@ -1096,7 +1095,7 @@ class JavaThread: public Thread { // Whenever a thread transitions from native to vm/java it must suspend // if external|deopt suspend is present. bool is_suspend_after_native() const { - return (_suspend_flags & (_external_suspend | _deopt_suspend) ) != 0; + return (_suspend_flags & (_external_suspend | _deopt_suspend)) != 0; } // external suspend request is completed @@ -1137,8 +1136,8 @@ class JavaThread: public Thread { bool is_suspend_equivalent() const { return _suspend_equivalent; } - void set_suspend_equivalent() { _suspend_equivalent = true; }; - void clear_suspend_equivalent() { _suspend_equivalent = false; }; + void set_suspend_equivalent() { _suspend_equivalent = true; } + void clear_suspend_equivalent() { _suspend_equivalent = false; } // Thread.stop support void send_thread_stop(oop throwable); @@ -1238,18 +1237,25 @@ class JavaThread: public Thread { // Stack overflow support inline size_t stack_available(address cur_sp); - address stack_yellow_zone_base() - { return (address)(stack_base() - (stack_size() - (stack_red_zone_size() + stack_yellow_zone_size()))); } - size_t stack_yellow_zone_size() - { return StackYellowPages * os::vm_page_size(); } - address stack_red_zone_base() - { return (address)(stack_base() - (stack_size() - stack_red_zone_size())); } - size_t stack_red_zone_size() - { return StackRedPages * os::vm_page_size(); } - bool in_stack_yellow_zone(address a) - { return (a <= stack_yellow_zone_base()) && (a >= stack_red_zone_base()); } - bool in_stack_red_zone(address a) - { return (a <= stack_red_zone_base()) && (a >= (address)((intptr_t)stack_base() - stack_size())); } + address stack_yellow_zone_base() { + return (address)(stack_base() - + (stack_size() - + (stack_red_zone_size() + stack_yellow_zone_size()))); + } + size_t stack_yellow_zone_size() { + return StackYellowPages * os::vm_page_size(); + } + address stack_red_zone_base() { + return (address)(stack_base() - (stack_size() - stack_red_zone_size())); + } + size_t stack_red_zone_size() { return StackRedPages * os::vm_page_size(); } + bool in_stack_yellow_zone(address a) { + return (a <= stack_yellow_zone_base()) && (a >= stack_red_zone_base()); + } + bool in_stack_red_zone(address a) { + return (a <= stack_red_zone_base()) && + (a >= (address)((intptr_t)stack_base() - stack_size())); + } void create_stack_guard_pages(); void remove_stack_guard_pages(); @@ -1289,14 +1295,14 @@ class JavaThread: public Thread { #ifndef PRODUCT void record_jump(address target, address instr, const char* file, int line); -#endif /* PRODUCT */ +#endif // PRODUCT // For assembly stub generation static ByteSize threadObj_offset() { return byte_offset_of(JavaThread, _threadObj); } #ifndef PRODUCT static ByteSize jmp_ring_index_offset() { return byte_offset_of(JavaThread, _jmp_ring_index); } static ByteSize jmp_ring_offset() { return byte_offset_of(JavaThread, _jmp_ring); } -#endif /* PRODUCT */ +#endif // PRODUCT static ByteSize jni_environment_offset() { return byte_offset_of(JavaThread, _jni_environment); } static ByteSize last_Java_sp_offset() { return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_sp_offset(); @@ -1349,15 +1355,18 @@ class JavaThread: public Thread { // JNI critical regions. These can nest. bool in_critical() { return _jni_active_critical > 0; } bool in_last_critical() { return _jni_active_critical == 1; } - void enter_critical() { assert(Thread::current() == this || - Thread::current()->is_VM_thread() && SafepointSynchronize::is_synchronizing(), - "this must be current thread or synchronizing"); - _jni_active_critical++; } - void exit_critical() { assert(Thread::current() == this, - "this must be current thread"); - _jni_active_critical--; - assert(_jni_active_critical >= 0, - "JNI critical nesting problem?"); } + void enter_critical() { + assert(Thread::current() == this || + (Thread::current()->is_VM_thread() && + SafepointSynchronize::is_synchronizing()), + "this must be current thread or synchronizing"); + _jni_active_critical++; + } + void exit_critical() { + assert(Thread::current() == this, "this must be current thread"); + _jni_active_critical--; + assert(_jni_active_critical >= 0, "JNI critical nesting problem?"); + } // Checked JNI, is the programmer required to check for exceptions, specify which function name bool is_pending_jni_exception_check() const { return _pending_jni_exception_check_fn != NULL; } @@ -1406,8 +1415,8 @@ class JavaThread: public Thread { char* name() const { return (char*)get_thread_name(); } void print_on(outputStream* st) const; void print_value(); - void print_thread_state_on(outputStream* ) const PRODUCT_RETURN; - void print_thread_state() const PRODUCT_RETURN; + void print_thread_state_on(outputStream*) const PRODUCT_RETURN; + void print_thread_state() const PRODUCT_RETURN; void print_on_error(outputStream* st, char* buf, int buflen) const; void verify(); const char* get_thread_name() const; @@ -1766,7 +1775,7 @@ class CompilerThread : public JavaThread { void set_env(ciEnv* env) { _env = env; } BufferBlob* get_buffer_blob() const { return _buffer_blob; } - void set_buffer_blob(BufferBlob* b) { _buffer_blob = b; }; + void set_buffer_blob(BufferBlob* b) { _buffer_blob = b; } // Get/set the thread's logging information CompileLog* log() { return _log; } From 98b5d14523b9f77b48f6bd9b91422565822354c3 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Thu, 11 Sep 2014 03:13:29 -0700 Subject: [PATCH 17/81] 8054174: minor buglet in computation of end of pc descs in libjvm_db.c Fixed scopes_pcs_end calculation Reviewed-by: sspitsyn, sla --- hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp | 1 + hotspot/src/os/bsd/dtrace/libjvm_db.c | 2 +- hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp | 1 + hotspot/src/os/solaris/dtrace/libjvm_db.c | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp b/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp index 4912e8e36a5..82425d1afee 100644 --- a/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp +++ b/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp @@ -255,6 +255,7 @@ int generateJvmOffsets(GEN_variant gen_variant) { printf("\n"); GEN_OFFS(nmethod, _method); + GEN_OFFS(nmethod, _dependencies_offset); GEN_OFFS(nmethod, _oops_offset); GEN_OFFS(nmethod, _scopes_data_offset); GEN_OFFS(nmethod, _scopes_pcs_offset); diff --git a/hotspot/src/os/bsd/dtrace/libjvm_db.c b/hotspot/src/os/bsd/dtrace/libjvm_db.c index cf133b4589a..128354d9252 100644 --- a/hotspot/src/os/bsd/dtrace/libjvm_db.c +++ b/hotspot/src/os/bsd/dtrace/libjvm_db.c @@ -595,7 +595,7 @@ static int nmethod_info(Nmethod_t *N) /* scopes_pcs */ err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_pcs_offset, &N->scopes_pcs_beg, SZ32); CHECK_FAIL(err); - err = ps_pread(J->P, nm + OFFSET_nmethod_handler_table_offset, &N->scopes_pcs_end, SZ32); + err = ps_pread(J->P, nm + OFFSET_nmethod_dependencies_offset, &N->scopes_pcs_end, SZ32); CHECK_FAIL(err); /* scopes_data */ diff --git a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp index c5e8b3461e8..39d2a007487 100644 --- a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp +++ b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp @@ -250,6 +250,7 @@ int generateJvmOffsets(GEN_variant gen_variant) { printf("\n"); GEN_OFFS(nmethod, _method); + GEN_OFFS(nmethod, _dependencies_offset); GEN_OFFS(nmethod, _metadata_offset); GEN_OFFS(nmethod, _scopes_data_offset); GEN_OFFS(nmethod, _scopes_pcs_offset); diff --git a/hotspot/src/os/solaris/dtrace/libjvm_db.c b/hotspot/src/os/solaris/dtrace/libjvm_db.c index 40dada151eb..420b23c30cb 100644 --- a/hotspot/src/os/solaris/dtrace/libjvm_db.c +++ b/hotspot/src/os/solaris/dtrace/libjvm_db.c @@ -595,7 +595,7 @@ static int nmethod_info(Nmethod_t *N) /* scopes_pcs */ err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_pcs_offset, &N->scopes_pcs_beg, SZ32); CHECK_FAIL(err); - err = ps_pread(J->P, nm + OFFSET_nmethod_handler_table_offset, &N->scopes_pcs_end, SZ32); + err = ps_pread(J->P, nm + OFFSET_nmethod_dependencies_offset, &N->scopes_pcs_end, SZ32); CHECK_FAIL(err); /* scopes_data */ From 310192415e12c2c82594dd9643aa92e213057579 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Thu, 11 Sep 2014 10:46:32 -0400 Subject: [PATCH 18/81] 8055145: [TESTBUG] runtime/7158988/FieldMonitor.java fails with VMDisconnectedException Exclude this test on JPRT and make it trivially pass if it gets a disconnected exception (which seems rare) Reviewed-by: gtriantafill, sspitsyn, ctornqvi --- hotspot/test/TEST.groups | 3 +- .../test/runtime/7158988/FieldMonitor.java | 61 ++++++++++--------- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups index ddcd8bb7d43..c2a1d47b0b8 100644 --- a/hotspot/test/TEST.groups +++ b/hotspot/test/TEST.groups @@ -342,7 +342,8 @@ hotspot_runtime = \ -runtime/Unsafe/RangeCheck.java \ -runtime/SharedArchiveFile/CdsSameObjectAlignment.java \ -runtime/SharedArchiveFile/DefaultUseWithClient.java \ - -runtime/Thread/CancellableThreadTest.java + -runtime/Thread/CancellableThreadTest.java \ + -runtime/runtime/7158988/FieldMonitor.java hotspot_runtime_closed = \ sanity/ExecuteInternalVMTests.java diff --git a/hotspot/test/runtime/7158988/FieldMonitor.java b/hotspot/test/runtime/7158988/FieldMonitor.java index 07c40053d34..231884ece03 100644 --- a/hotspot/test/runtime/7158988/FieldMonitor.java +++ b/hotspot/test/runtime/7158988/FieldMonitor.java @@ -26,7 +26,6 @@ * @bug 7158988 * @key regression * @summary verify jvm does not crash while debugging - * @ignore 8055145 * @run compile TestPostFieldModification.java * @run main/othervm FieldMonitor * @author axel.siebenborn@sap.com @@ -91,35 +90,41 @@ public class FieldMonitor { boolean connected = true; int watched = 0; while (connected) { - EventSet eventSet = eventQueue.remove(); - for (Event event : eventSet) { - System.out.println("FieldMonitor-main receives: "+event); - if (event instanceof VMStartEvent) { - addClassWatch(vm); - } else if (event instanceof VMDeathEvent - || event instanceof VMDisconnectEvent) { - // exit - connected = false; - } else if (event instanceof ClassPrepareEvent) { - // watch field on loaded class - System.out.println("ClassPrepareEvent"); - ClassPrepareEvent classPrepEvent = (ClassPrepareEvent) event; - ReferenceType refType = classPrepEvent - .referenceType(); - addFieldWatch(vm, refType); - } else if (event instanceof ModificationWatchpointEvent) { - watched++; - System.out.println("sleep for 500 ms"); - Thread.sleep(500); + try { + EventSet eventSet = eventQueue.remove(); + for (Event event : eventSet) { + System.out.println("FieldMonitor-main receives: "+event); + if (event instanceof VMStartEvent) { + addClassWatch(vm); + } else if (event instanceof VMDeathEvent + || event instanceof VMDisconnectEvent) { + // exit + connected = false; + } else if (event instanceof ClassPrepareEvent) { + // watch field on loaded class + System.out.println("ClassPrepareEvent"); + ClassPrepareEvent classPrepEvent = (ClassPrepareEvent) event; + ReferenceType refType = classPrepEvent + .referenceType(); + addFieldWatch(vm, refType); + } else if (event instanceof ModificationWatchpointEvent) { + watched++; + System.out.println("sleep for 500 ms"); + Thread.sleep(500); - ModificationWatchpointEvent modEvent = (ModificationWatchpointEvent) event; - System.out.println("old=" - + modEvent.valueCurrent()); - System.out.println("new=" + modEvent.valueToBe()); + ModificationWatchpointEvent modEvent = (ModificationWatchpointEvent) event; + System.out.println("old=" + + modEvent.valueCurrent()); + System.out.println("new=" + modEvent.valueToBe()); + } + } + System.out.println("resume..."); + eventSet.resume(); + } catch (com.sun.jdi.VMDisconnectedException exc) { + // Guess this means it's not connected anymore, + // sometimes this happens and everything else hangs, just return. + return; } - } - System.out.println("resume..."); - eventSet.resume(); } // Shutdown begins when event thread terminates try { From f4ba168d773fd6933c09c0b2175aa14847aaed53 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Thu, 11 Sep 2014 13:07:37 -0700 Subject: [PATCH 19/81] 8056213: Clean up unix/native/common/sun/awt Reviewed-by: erikj, ihse --- jdk/make/lib/Awt2dLibraries.gmk | 4 +--- .../unix/native/{common => libawt}/sun/awt/initIDs.c | 0 2 files changed, 1 insertion(+), 3 deletions(-) rename jdk/src/java.desktop/unix/native/{common => libawt}/sun/awt/initIDs.c (100%) diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk index fa74e6e3694..46d7f2a73d1 100644 --- a/jdk/make/lib/Awt2dLibraries.gmk +++ b/jdk/make/lib/Awt2dLibraries.gmk @@ -746,7 +746,6 @@ ifeq ($(BUILD_HEADLESS), true) -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libsunwjdga/ \ $(LIBJAVA_HEADER_FLAGS) \ # - LIBAWT_HEADLESS_EXFILES := initIDs.c LIBAWT_HEADLESS_REORDER := ifeq ($(OPENJDK_TARGET_OS), solaris) @@ -759,7 +758,6 @@ ifeq ($(BUILD_HEADLESS), true) LIBRARY := awt_headless, \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ SRC := $(LIBAWT_HEADLESS_DIRS), \ - EXCLUDE_FILES := $(LIBAWT_HEADLESS_EXFILES), \ EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \ LANG := C, \ OPTIMIZATION := LOW, \ @@ -930,7 +928,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) $(LIBJAVA_HEADER_FLAGS) \ # - LIBAWT_LWAWT_EXFILES := fontpath.c awt_Font.c X11Color.c initIDs.c + LIBAWT_LWAWT_EXFILES := fontpath.c awt_Font.c X11Color.c LIBAWT_LWAWT_EXCLUDES := $(JDK_TOPDIR)/src/java.desktop/unix/native/common/sun/awt/medialib $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_LWAWT, \ diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/initIDs.c b/jdk/src/java.desktop/unix/native/libawt/sun/awt/initIDs.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/initIDs.c rename to jdk/src/java.desktop/unix/native/libawt/sun/awt/initIDs.c From 9e6d4325628144067441f33a3466d5c2761137b5 Mon Sep 17 00:00:00 2001 From: Christian Tornqvist Date: Thu, 11 Sep 2014 17:54:22 -0700 Subject: [PATCH 20/81] 8022865: [TESTBUG] Compressed Oops testing needs to be revised Rewrote compressed oops tests Reviewed-by: kvn, coleenp, mseledtsov --- hotspot/src/share/vm/memory/universe.cpp | 49 +++--- hotspot/src/share/vm/memory/universe.hpp | 2 + .../CompressedClassSpaceSize.java | 105 +++++++++++++ .../CompressedOops/ObjectAlignment.java | 75 ++++++++++ .../CompressedOops/UseCompressedOops.java | 139 ++++++++++++++++++ .../java/testlibrary/OutputAnalyzer.java | 39 +++-- 6 files changed, 372 insertions(+), 37 deletions(-) create mode 100644 hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java create mode 100644 hotspot/test/runtime/CompressedOops/ObjectAlignment.java create mode 100644 hotspot/test/runtime/CompressedOops/UseCompressedOops.java diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp index a85ec509dff..bcd25222325 100644 --- a/hotspot/src/share/vm/memory/universe.cpp +++ b/hotspot/src/share/vm/memory/universe.cpp @@ -838,12 +838,6 @@ jint Universe::initialize_heap() { // See needs_explicit_null_check. // Only set the heap base for compressed oops because it indicates // compressed oops for pstack code. - bool verbose = PrintCompressedOopsMode || (PrintMiscellaneous && Verbose); - if (verbose) { - tty->cr(); - tty->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB", - Universe::heap()->base(), Universe::heap()->reserved_region().byte_size()/M); - } if (((uint64_t)Universe::heap()->reserved_region().end() > OopEncodingHeapMax)) { // Can't reserve heap below 32Gb. // keep the Universe::narrow_oop_base() set in Universe::reserve_heap() @@ -853,16 +847,8 @@ jint Universe::initialize_heap() { // are decoded so that NULL is preserved, so this page will not be accessed. Universe::set_narrow_oop_use_implicit_null_checks(false); #endif - if (verbose) { - tty->print(", %s: "PTR_FORMAT, - narrow_oop_mode_to_string(HeapBasedNarrowOop), - Universe::narrow_oop_base()); - } } else { Universe::set_narrow_oop_base(0); - if (verbose) { - tty->print(", %s", narrow_oop_mode_to_string(ZeroBasedNarrowOop)); - } #ifdef _WIN64 if (!Universe::narrow_oop_use_implicit_null_checks()) { // Don't need guard page for implicit checks in indexed addressing @@ -875,17 +861,14 @@ jint Universe::initialize_heap() { Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes); } else { Universe::set_narrow_oop_shift(0); - if (verbose) { - tty->print(", %s", narrow_oop_mode_to_string(UnscaledNarrowOop)); - } } } - if (verbose) { - tty->cr(); - tty->cr(); - } Universe::set_narrow_ptrs_base(Universe::narrow_oop_base()); + + if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) { + Universe::print_compressed_oops_mode(); + } } // Universe::narrow_oop_base() is one page below the heap. assert((intptr_t)Universe::narrow_oop_base() <= (intptr_t)(Universe::heap()->base() - @@ -906,6 +889,24 @@ jint Universe::initialize_heap() { return JNI_OK; } +void Universe::print_compressed_oops_mode() { + tty->cr(); + tty->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB", + Universe::heap()->base(), Universe::heap()->reserved_region().byte_size()/M); + + tty->print(", Compressed Oops mode: %s", narrow_oop_mode_to_string(narrow_oop_mode())); + + if (Universe::narrow_oop_base() != 0) { + tty->print(":" PTR_FORMAT, Universe::narrow_oop_base()); + } + + if (Universe::narrow_oop_shift() != 0) { + tty->print(", Oop shift amount: %d", Universe::narrow_oop_shift()); + } + + tty->cr(); + tty->cr(); +} // Reserve the Java heap, which is now the same for all GCs. ReservedSpace Universe::reserve_heap(size_t heap_size, size_t alignment) { @@ -975,11 +976,11 @@ void Universe::update_heap_info_at_gc() { const char* Universe::narrow_oop_mode_to_string(Universe::NARROW_OOP_MODE mode) { switch (mode) { case UnscaledNarrowOop: - return "32-bits Oops"; + return "32-bit"; case ZeroBasedNarrowOop: - return "zero based Compressed Oops"; + return "Zero based"; case HeapBasedNarrowOop: - return "Compressed Oops with base"; + return "Non-zero based"; } ShouldNotReachHere(); diff --git a/hotspot/src/share/vm/memory/universe.hpp b/hotspot/src/share/vm/memory/universe.hpp index ec3b59f803a..452ceade435 100644 --- a/hotspot/src/share/vm/memory/universe.hpp +++ b/hotspot/src/share/vm/memory/universe.hpp @@ -368,6 +368,8 @@ class Universe: AllStatic { static void set_narrow_ptrs_base(address a) { _narrow_ptrs_base = a; } static address narrow_ptrs_base() { return _narrow_ptrs_base; } + static void print_compressed_oops_mode(); + // this is set in vm_version on sparc (and then reset in universe afaict) static void set_narrow_oop_shift(int shift) { _narrow_oop._shift = shift; diff --git a/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java b/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java new file mode 100644 index 00000000000..0a0a553cbae --- /dev/null +++ b/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2014, 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 8022865 + * @summary Tests for the -XX:CompressedClassSpaceSize command line option + * @library /testlibrary + * @run main CompressedClassSpaceSize + */ +import com.oracle.java.testlibrary.*; + +public class CompressedClassSpaceSize { + + public static void main(String[] args) throws Exception { + ProcessBuilder pb; + OutputAnalyzer output; + if (Platform.is64bit()) { + // Minimum size is 1MB + pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=0", + "-version"); + output = new OutputAnalyzer(pb.start()); + output.shouldContain("CompressedClassSpaceSize of 0 is invalid") + .shouldHaveExitValue(1); + + // Invalid size of -1 should be handled correctly + pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=-1", + "-version"); + output = new OutputAnalyzer(pb.start()); + output.shouldContain("Improperly specified VM option 'CompressedClassSpaceSize=-1'") + .shouldHaveExitValue(1); + + + // Maximum size is 3GB + pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=4g", + "-version"); + output = new OutputAnalyzer(pb.start()); + output.shouldContain("CompressedClassSpaceSize of 4294967296 is invalid") + .shouldHaveExitValue(1); + + + // Make sure the minimum size is set correctly and printed + pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", + "-XX:CompressedClassSpaceSize=1m", + "-XX:+PrintCompressedOopsMode", + "-version"); + output = new OutputAnalyzer(pb.start()); + output.shouldContain("Compressed class space size: 1048576") + .shouldHaveExitValue(0); + + + // Make sure the maximum size is set correctly and printed + pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", + "-XX:CompressedClassSpaceSize=3g", + "-XX:+PrintCompressedOopsMode", + "-version"); + output = new OutputAnalyzer(pb.start()); + output.shouldContain("Compressed class space size: 3221225472") + .shouldHaveExitValue(0); + + + pb = ProcessTools.createJavaProcessBuilder("-XX:-UseCompressedOops", + "-XX:CompressedClassSpaceSize=1m", + "-version"); + output = new OutputAnalyzer(pb.start()); + output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used") + .shouldHaveExitValue(0); + + + pb = ProcessTools.createJavaProcessBuilder("-XX:-UseCompressedClassPointers", + "-XX:CompressedClassSpaceSize=1m", + "-version"); + output = new OutputAnalyzer(pb.start()); + output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used") + .shouldHaveExitValue(0); + } else { + // 32bit platforms doesn't have compressed oops + pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=1m", + "-version"); + output = new OutputAnalyzer(pb.start()); + output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used") + .shouldHaveExitValue(0); + } + } +} diff --git a/hotspot/test/runtime/CompressedOops/ObjectAlignment.java b/hotspot/test/runtime/CompressedOops/ObjectAlignment.java new file mode 100644 index 00000000000..63d267ae953 --- /dev/null +++ b/hotspot/test/runtime/CompressedOops/ObjectAlignment.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2014, 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 8022865 + * @summary Tests for the -XX:ObjectAlignmentInBytes command line option + * @library /testlibrary + * @run main ObjectAlignment + */ +import com.oracle.java.testlibrary.*; + +public class ObjectAlignment { + + public static void main(String[] args) throws Exception { + + if (Platform.is64bit()) { + // Minimum alignment should be 8 + testObjectAlignment(4) + .shouldContain("error: ObjectAlignmentInBytes=4 must be greater or equal 8") + .shouldHaveExitValue(1); + + // Alignment has to be a power of 2 + testObjectAlignment(9) + .shouldContain("error: ObjectAlignmentInBytes=9 must be power of 2") + .shouldHaveExitValue(1); + + testObjectAlignment(-1) + .shouldContain("error: ObjectAlignmentInBytes=-1 must be power of 2") + .shouldHaveExitValue(1); + + // Maximum alignment allowed is 256 + testObjectAlignment(512) + .shouldContain("error: ObjectAlignmentInBytes=512 must not be greater than 256") + .shouldHaveExitValue(1); + + // Valid alignments should work + testObjectAlignment(8).shouldHaveExitValue(0); + testObjectAlignment(16).shouldHaveExitValue(0); + testObjectAlignment(256).shouldHaveExitValue(0); + + } else { + // For a 32bit JVM the option isn't there, make sure it's not silently ignored + testObjectAlignment(8) + .shouldContain("Unrecognized VM option 'ObjectAlignmentInBytes=8'") + .shouldHaveExitValue(1); + } + } + + private static OutputAnalyzer testObjectAlignment(int alignment) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:ObjectAlignmentInBytes=" + alignment, + "-version"); + return new OutputAnalyzer(pb.start()); + } +} diff --git a/hotspot/test/runtime/CompressedOops/UseCompressedOops.java b/hotspot/test/runtime/CompressedOops/UseCompressedOops.java new file mode 100644 index 00000000000..3d31fe6d9d0 --- /dev/null +++ b/hotspot/test/runtime/CompressedOops/UseCompressedOops.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2014, 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 8022865 + * @summary Tests for different combination of UseCompressedOops options + * @library /testlibrary + * @run main UseCompressedOops + */ +import java.util.ArrayList; +import java.util.Collections; +import com.oracle.java.testlibrary.*; + +public class UseCompressedOops { + + public static void main(String[] args) throws Exception { + + if (Platform.is64bit()) { + // Explicitly turn of compressed oops + testCompressedOops("-XX:-UseCompressedOops", "-Xmx32m") + .shouldNotContain("Compressed Oops") + .shouldHaveExitValue(0); + + // Compressed oops should be on by default + testCompressedOops("-Xmx32m") + .shouldContain("Compressed Oops mode") + .shouldHaveExitValue(0); + + // Explicly enabling compressed oops + testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m") + .shouldContain("Compressed Oops mode") + .shouldHaveExitValue(0); + + // Larger than 4gb heap should result in zero based with shift 3 + testCompressedOops("-XX:+UseCompressedOops", "-Xmx5g") + .shouldContain("Zero based") + .shouldContain("Oop shift amount: 3") + .shouldHaveExitValue(0); + + // Skip the following three test cases if we're on OSX or Solaris Sparc. + // + // OSX doesn't seem to care about HeapBaseMinAddress and Solaris Sparc + // puts the heap way up, forcing different behaviour. + + if (!Platform.isOSX() && !(Platform.isSolaris() && Platform.isSparc())) { + // Small heap above 4gb should result in zero based with shift 3 + testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m", "-XX:HeapBaseMinAddress=4g") + .shouldContain("Zero based") + .shouldContain("Oop shift amount: 3") + .shouldHaveExitValue(0); + + // Small heap above 32gb should result in non-zero based with shift 3 + testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m", "-XX:HeapBaseMinAddress=32g") + .shouldContain("Non-zero based") + .shouldContain("Oop shift amount: 3") + .shouldHaveExitValue(0); + + // 32gb heap with heap base above 64gb and object alignment set to 16 bytes should result + // in non-zero based with shift 4 + testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=16", + "-XX:HeapBaseMinAddress=64g") + .shouldContain("Non-zero based") + .shouldContain("Oop shift amount: 4") + .shouldHaveExitValue(0); + } + + // Explicitly enabling compressed oops with 32gb heap should result a warning + testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g") + .shouldContain("Max heap size too large for Compressed Oops") + .shouldHaveExitValue(0); + + // 32gb heap should not result a warning + testCompressedOops("-Xmx32g") + .shouldNotContain("Max heap size too large for Compressed Oops") + .shouldHaveExitValue(0); + + // Explicitly enabling compressed oops with 32gb heap and object + // alignment set to 8 byte should result a warning + testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=8") + .shouldContain("Max heap size too large for Compressed Oops") + .shouldHaveExitValue(0); + + // 64gb heap and object alignment set to 16 bytes should result in a warning + testCompressedOops("-XX:+UseCompressedOops", "-Xmx64g", "-XX:ObjectAlignmentInBytes=16") + .shouldContain("Max heap size too large for Compressed Oops") + .shouldHaveExitValue(0); + + // 32gb heap with object alignment set to 16 bytes should result in zero based with shift 4 + testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=16") + .shouldContain("Zero based") + .shouldContain("Oop shift amount: 4") + .shouldHaveExitValue(0); + + } else { + // Compressed oops should only apply to 64bit platforms + testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m") + .shouldContain("Unrecognized VM option 'UseCompressedOops'") + .shouldHaveExitValue(1); + } + } + + private static OutputAnalyzer testCompressedOops(String... flags) throws Exception { + ArrayList args = new ArrayList<>(); + + // Always run with these three: + args.add("-XX:+UnlockDiagnosticVMOptions"); + args.add("-XX:+PrintCompressedOopsMode"); + args.add("-Xms32m"); + + // Add the extra flags + Collections.addAll(args, flags); + + args.add("-version"); + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args.toArray(new String[0])); + return new OutputAnalyzer(pb.start()); + } +} diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java index 73b65165e91..b81f21a0184 100644 --- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java +++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java @@ -74,11 +74,12 @@ public final class OutputAnalyzer { * @param expectedString String that buffer should contain * @throws RuntimeException If the string was not found */ - public void shouldContain(String expectedString) { + public OutputAnalyzer shouldContain(String expectedString) { if (!stdout.contains(expectedString) && !stderr.contains(expectedString)) { reportDiagnosticSummary(); throw new RuntimeException("'" + expectedString + "' missing from stdout/stderr \n"); } + return this; } /** @@ -87,11 +88,12 @@ public final class OutputAnalyzer { * @param expectedString String that buffer should contain * @throws RuntimeException If the string was not found */ - public void stdoutShouldContain(String expectedString) { + public OutputAnalyzer stdoutShouldContain(String expectedString) { if (!stdout.contains(expectedString)) { reportDiagnosticSummary(); throw new RuntimeException("'" + expectedString + "' missing from stdout \n"); } + return this; } /** @@ -100,11 +102,12 @@ public final class OutputAnalyzer { * @param expectedString String that buffer should contain * @throws RuntimeException If the string was not found */ - public void stderrShouldContain(String expectedString) { + public OutputAnalyzer stderrShouldContain(String expectedString) { if (!stderr.contains(expectedString)) { reportDiagnosticSummary(); throw new RuntimeException("'" + expectedString + "' missing from stderr \n"); } + return this; } /** @@ -113,7 +116,7 @@ public final class OutputAnalyzer { * @param expectedString String that the buffer should not contain * @throws RuntimeException If the string was found */ - public void shouldNotContain(String notExpectedString) { + public OutputAnalyzer shouldNotContain(String notExpectedString) { if (stdout.contains(notExpectedString)) { reportDiagnosticSummary(); throw new RuntimeException("'" + notExpectedString + "' found in stdout \n"); @@ -122,6 +125,7 @@ public final class OutputAnalyzer { reportDiagnosticSummary(); throw new RuntimeException("'" + notExpectedString + "' found in stderr \n"); } + return this; } /** @@ -130,11 +134,12 @@ public final class OutputAnalyzer { * @param expectedString String that the buffer should not contain * @throws RuntimeException If the string was found */ - public void stdoutShouldNotContain(String notExpectedString) { + public OutputAnalyzer stdoutShouldNotContain(String notExpectedString) { if (stdout.contains(notExpectedString)) { reportDiagnosticSummary(); throw new RuntimeException("'" + notExpectedString + "' found in stdout \n"); } + return this; } /** @@ -143,11 +148,12 @@ public final class OutputAnalyzer { * @param expectedString String that the buffer should not contain * @throws RuntimeException If the string was found */ - public void stderrShouldNotContain(String notExpectedString) { + public OutputAnalyzer stderrShouldNotContain(String notExpectedString) { if (stderr.contains(notExpectedString)) { reportDiagnosticSummary(); throw new RuntimeException("'" + notExpectedString + "' found in stderr \n"); } + return this; } /** @@ -157,7 +163,7 @@ public final class OutputAnalyzer { * @param pattern * @throws RuntimeException If the pattern was not found */ - public void shouldMatch(String pattern) { + public OutputAnalyzer shouldMatch(String pattern) { Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); if (!stdoutMatcher.find() && !stderrMatcher.find()) { @@ -165,6 +171,7 @@ public final class OutputAnalyzer { throw new RuntimeException("'" + pattern + "' missing from stdout/stderr \n"); } + return this; } /** @@ -174,13 +181,14 @@ public final class OutputAnalyzer { * @param pattern * @throws RuntimeException If the pattern was not found */ - public void stdoutShouldMatch(String pattern) { + public OutputAnalyzer stdoutShouldMatch(String pattern) { Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); if (!matcher.find()) { reportDiagnosticSummary(); throw new RuntimeException("'" + pattern + "' missing from stdout \n"); } + return this; } /** @@ -190,13 +198,14 @@ public final class OutputAnalyzer { * @param pattern * @throws RuntimeException If the pattern was not found */ - public void stderrShouldMatch(String pattern) { + public OutputAnalyzer stderrShouldMatch(String pattern) { Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); if (!matcher.find()) { reportDiagnosticSummary(); throw new RuntimeException("'" + pattern + "' missing from stderr \n"); } + return this; } /** @@ -206,7 +215,7 @@ public final class OutputAnalyzer { * @param pattern * @throws RuntimeException If the pattern was found */ - public void shouldNotMatch(String pattern) { + public OutputAnalyzer shouldNotMatch(String pattern) { Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); if (matcher.find()) { reportDiagnosticSummary(); @@ -219,6 +228,7 @@ public final class OutputAnalyzer { throw new RuntimeException("'" + pattern + "' found in stderr: '" + matcher.group() + "' \n"); } + return this; } /** @@ -228,13 +238,14 @@ public final class OutputAnalyzer { * @param pattern * @throws RuntimeException If the pattern was found */ - public void stdoutShouldNotMatch(String pattern) { + public OutputAnalyzer stdoutShouldNotMatch(String pattern) { Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); if (matcher.find()) { reportDiagnosticSummary(); throw new RuntimeException("'" + pattern + "' found in stdout \n"); } + return this; } /** @@ -244,13 +255,14 @@ public final class OutputAnalyzer { * @param pattern * @throws RuntimeException If the pattern was found */ - public void stderrShouldNotMatch(String pattern) { + public OutputAnalyzer stderrShouldNotMatch(String pattern) { Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); if (matcher.find()) { reportDiagnosticSummary(); throw new RuntimeException("'" + pattern + "' found in stderr \n"); } + return this; } /** @@ -290,12 +302,13 @@ public final class OutputAnalyzer { * @param expectedExitValue Expected exit value from process * @throws RuntimeException If the exit value from the process did not match the expected value */ - public void shouldHaveExitValue(int expectedExitValue) { + public OutputAnalyzer shouldHaveExitValue(int expectedExitValue) { if (getExitValue() != expectedExitValue) { reportDiagnosticSummary(); throw new RuntimeException("Expected to get exit value of [" + expectedExitValue + "]\n"); } + return this; } From ece4386179e9b9adc97ee1d040b70f42825ac72e Mon Sep 17 00:00:00 2001 From: Dmitry Markov Date: Fri, 12 Sep 2014 10:40:07 +0400 Subject: [PATCH 21/81] 8048110: Using tables in JTextPane leads to infinite loop in FlowLayout.layoutRow Reviewed-by: alexp, alexsch --- .../classes/javax/swing/text/FlowView.java | 24 ++-- .../classes/javax/swing/text/GlyphView.java | 8 ++ .../share/classes/javax/swing/text/View.java | 7 + .../swing/text/View/8048110/bug8048110.java | 121 ++++++++++++++++++ 4 files changed, 152 insertions(+), 8 deletions(-) create mode 100644 jdk/test/javax/swing/text/View/8048110/bug8048110.java diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/FlowView.java b/jdk/src/java.desktop/share/classes/javax/swing/text/FlowView.java index 53e63e2cf02..9c5cf03f792 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/FlowView.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/FlowView.java @@ -800,14 +800,22 @@ public abstract class FlowView extends BoxView { @Override protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a, ViewFactory f) { - calculateUpdateIndexes(e); - // Send update event to all views followed by the changed place. - lastUpdateIndex = Math.max((getViewCount() - 1), 0); - for (int i = firstUpdateIndex; i <= lastUpdateIndex; i++) { - View v = getView(i); - if (v != null) { - Shape childAlloc = getChildAllocation(i, a); - forwardUpdateToView(v, e, childAlloc, f); + // Update the view responsible for the changed element by invocation of + // super method. + super.forwardUpdate(ec, e, a, f); + // Re-calculate the update indexes and update the views followed by + // the changed place. Note: we update the views only when insertion or + // removal takes place. + DocumentEvent.EventType type = e.getType(); + if (type == DocumentEvent.EventType.INSERT || + type == DocumentEvent.EventType.REMOVE) { + firstUpdateIndex = Math.min((lastUpdateIndex + 1), (getViewCount() - 1)); + lastUpdateIndex = Math.max((getViewCount() - 1), 0); + for (int i = firstUpdateIndex; i <= lastUpdateIndex; i++) { + View v = getView(i); + if (v != null) { + v.updateAfterChange(); + } } } } diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java b/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java index 829dc5bbd86..7e697d7d3de 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java @@ -970,6 +970,14 @@ public class GlyphView extends View implements TabableView, Cloneable { } } + /** {@inheritDoc} */ + @Override + void updateAfterChange() { + // Drop the break spots. They will be re-calculated during + // layout. It is necessary for proper line break calculation. + breakSpots = null; + } + /** * Class to hold data needed to justify this GlyphView in a PargraphView.Row */ diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/View.java b/jdk/src/java.desktop/share/classes/javax/swing/text/View.java index cb8306ac12e..cd31266b56f 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/View.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/View.java @@ -1197,6 +1197,13 @@ public abstract class View implements SwingConstants { firstUpdateIndex = Math.max(firstUpdateIndex, 0); } + /** + * Updates the view to reflect the changes. + */ + void updateAfterChange() { + // Do nothing by default. Should be overridden in subclasses, if any. + } + /** * Forwards the DocumentEvent to the give child view. This * simply messages the view with a call to insertUpdate, diff --git a/jdk/test/javax/swing/text/View/8048110/bug8048110.java b/jdk/test/javax/swing/text/View/8048110/bug8048110.java new file mode 100644 index 00000000000..2151e3fb502 --- /dev/null +++ b/jdk/test/javax/swing/text/View/8048110/bug8048110.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2014, 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 8048110 + * @summary Using tables in JTextPane leads to infinite loop in FlowLayout.layoutRow + * @author Dmitry Markov + * @run main bug8048110 + */ + +import sun.awt.SunToolkit; + +import javax.swing.*; +import javax.swing.text.Element; +import javax.swing.text.html.HTMLDocument; +import javax.swing.text.html.HTMLEditorKit; +import java.awt.*; + +public class bug8048110 { + private static SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); + private static Object lock = new Object(); + private static boolean isRealSyncPerformed = false; + private static final String htmlText = "" + + "" + + "
DevicesState
PCOk
"; + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + createAndShowGUI(); + } + }); + + Thread thread = new Thread() { + @Override + public void run() { + toolkit.realSync(); + synchronized (lock) { + isRealSyncPerformed = true; + lock.notifyAll(); + } + } + }; + thread.start(); + + synchronized (lock) { + if (!isRealSyncPerformed) { + lock.wait(5000); + } + } + + if (!isRealSyncPerformed) { + throw new RuntimeException("Test Failed!"); + } + } + + private static void createAndShowGUI() { + try { + UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + HTMLEditorKit editorKit = new HTMLEditorKit(); + JTextPane textPane = new JTextPane(); + textPane.setContentType("text/html"); + textPane.setEditorKit(editorKit); + textPane.setText("Initial text without table"); + + JFrame frame = new JFrame("bug8048110"); + frame.getContentPane().add(textPane, BorderLayout.CENTER); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + frame.setSize(500, 200); + frame.setVisible(true); + + textPane.setDocument(textPane.getEditorKit().createDefaultDocument()); + HTMLDocument htmlDocument = (HTMLDocument) textPane.getDocument(); + Element firstParagraph = findFirstElement(textPane.getDocument().getDefaultRootElement(), "p"); + + try { + htmlDocument.setInnerHTML(firstParagraph, htmlText); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + private static Element findFirstElement(Element e, String name) { + String elementName = e.getName(); + if (elementName != null && elementName.equalsIgnoreCase(name)) { + return e; + } + for (int i = 0; i < e.getElementCount(); i++) { + Element result = findFirstElement(e.getElement(i), name); + if (result != null) { + return result; + } + } + return null; + } +} + From bce59468e0b49355f50ef71dc4310896c786466b Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Fri, 12 Sep 2014 13:04:18 +0100 Subject: [PATCH 22/81] 8041465: BMPImageReader read error using ImageReadParam with set sourceRectangle Reviewed-by: serb, prr --- .../imageio/plugins/bmp/BMPImageReader.java | 5 + jdk/test/javax/imageio/MultiReadTest.java | 129 ++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 jdk/test/javax/imageio/MultiReadTest.java diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java index 7b525a0fb4c..ccfc4187a83 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java +++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java @@ -108,6 +108,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants { // BMP variables private long bitmapFileSize; private long bitmapOffset; + private long bitmapStart; private long compression; private long imageSize; private byte palette[]; @@ -677,6 +678,8 @@ public class BMPImageReader extends ImageReader implements BMPConstants { //start of image data iis.reset(); iis.skipBytes(bitmapOffset); + bitmapStart = iis.getStreamPosition(); + gotHeader = true; } @@ -813,6 +816,8 @@ public class BMPImageReader extends ImageReader implements BMPConstants { idata = ((DataBufferInt)raster.getDataBuffer()).getData(); } + iis.seek(bitmapStart); + // There should only be one tile. switch(imageType) { diff --git a/jdk/test/javax/imageio/MultiReadTest.java b/jdk/test/javax/imageio/MultiReadTest.java new file mode 100644 index 00000000000..daea61610be --- /dev/null +++ b/jdk/test/javax/imageio/MultiReadTest.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2014, 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 8041465 + * @summary Test verifies that standard ImageIO plugins handle + * multiple reads correctly. + * + * @run main MultiReadTest + */ + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; +import javax.imageio.ImageReadParam; +import javax.imageio.ImageReader; +import javax.imageio.stream.ImageInputStream; + +public class MultiReadTest { + + private static final File pwd = new File("."); + + private static final Color srcColor = Color.red; + private static final int width = 200; + private static final int height = 200; + + private static final int max = 5; + + public static void main(String[] args) throws IOException { + final String[] formats = { "bmp", "png", "gif", "jpg" }; + + for (String f : formats) { + test(f); + } + } + + private static void test(String format) throws IOException { + System.out.println("Format: " + format); + + BufferedImage src = createSrc(); + + ImageInputStream iis = prepareInput(src, format); + + ImageReader reader = ImageIO.getImageReaders(iis).next(); + + reader.setInput(iis); + + ImageReadParam p = reader.getDefaultReadParam(); + int cnt = 0; + do { + System.out.println("cnt: " + cnt); + p.setSourceRegion(new Rectangle(width / 4, height / 4, + width / 2, height / 2)); + + BufferedImage dst = reader.read(0, p); + + final Color c = new Color(dst.getRGB(10, 10), true); + + if (!sameColor(c, srcColor)) { + throw new RuntimeException( + String.format("Test failed: read color 0x%X\n", + c.getRGB())); + } + } while (++cnt < max); + } + + private static boolean sameColor(Color c1, Color c2) { + final float delta = 0.1f; + + float[] rgb1 = new float[4]; + float[] rgb2 = new float[4]; + + rgb1 = c1.getRGBComponents(rgb1); + rgb2 = c2.getRGBComponents(rgb2); + + for (int i = 0; i < rgb1.length; i++) { + if (Math.abs(rgb1[i] - rgb2[i]) > delta) { + return false; + } + } + return true; + } + + private static BufferedImage createSrc() { + BufferedImage img = new BufferedImage(width, height, + BufferedImage.TYPE_INT_RGB); + + Graphics2D g = img.createGraphics(); + g.setColor(srcColor); + g.fillRect(0, 0, width, height); + g.dispose(); + + return img; + } + + private static ImageInputStream prepareInput(BufferedImage src, String format) throws IOException { + File f = File.createTempFile("src_", "." + format, pwd); + + if (ImageIO.write(src, format, f)) { + return ImageIO.createImageInputStream(f); + } + return null; + } +} From dd6285d984c38fab027ece1bd19737e0869937c4 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Mon, 15 Sep 2014 08:08:22 +0200 Subject: [PATCH 23/81] 8048721: -XX:+PrintCompilation prints negative bci for non entrant OSR methods Removed 'InvalidOSREntryBci' and checking nmethod::_state instead to determine if an osr method is non-entrant. Reviewed-by: kvn, vlivanov, drchase --- .../classes/sun/jvm/hotspot/runtime/VM.java | 7 ------- hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp | 6 +++--- hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp | 6 +++--- hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp | 4 ++-- hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp | 4 ++-- hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp | 8 +++----- hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp | 5 ++--- hotspot/src/share/vm/code/nmethod.cpp | 2 -- hotspot/src/share/vm/code/nmethod.hpp | 16 ++++++++-------- .../share/vm/interpreter/bytecodeInterpreter.cpp | 2 +- hotspot/src/share/vm/runtime/vmStructs.cpp | 1 - .../src/share/vm/utilities/globalDefinitions.hpp | 3 +-- 12 files changed, 25 insertions(+), 39 deletions(-) diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java index 29bf9efea7d..caf06eadf76 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java @@ -107,7 +107,6 @@ public class VM { private Runtime1 runtime1; /** These constants come from globalDefinitions.hpp */ private int invocationEntryBCI; - private int invalidOSREntryBCI; private ReversePtrs revPtrs; private VMRegImpl vmregImpl; private int reserveForAllocationPrefetch; @@ -295,7 +294,6 @@ public class VM { stackBias = db.lookupIntConstant("STACK_BIAS").intValue(); invocationEntryBCI = db.lookupIntConstant("InvocationEntryBci").intValue(); - invalidOSREntryBCI = db.lookupIntConstant("InvalidOSREntryBci").intValue(); // We infer the presence of C1 or C2 from a couple of fields we // already have present in the type database @@ -733,11 +731,6 @@ public class VM { return invocationEntryBCI; } - /** FIXME: figure out where to stick this */ - public int getInvalidOSREntryBCI() { - return invalidOSREntryBCI; - } - // FIXME: figure out where to stick this public boolean wizardMode() { return true; diff --git a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp index a47f9f56593..91decd076e7 100644 --- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp +++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp @@ -1166,9 +1166,9 @@ void InterpreterMacroAssembler::test_backedge_count_for_osr(Register backedge_co beq(CCR0, overflow_with_error); // Has the nmethod been invalidated already? - lwz(Rtmp, nmethod::entry_bci_offset(), R3_RET); - cmpwi(CCR0, Rtmp, InvalidOSREntryBci); - beq(CCR0, overflow_with_error); + lbz(Rtmp, nmethod::state_offset(), R3_RET); + cmpwi(CCR0, Rtmp, nmethod::in_use); + bne(CCR0, overflow_with_error); // Migrate the interpreter frame off of the stack. // We can use all registers because we will not return to interpreter from this point. diff --git a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp index 6a34053a496..663c5744095 100644 --- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp +++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp @@ -1674,9 +1674,9 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { __ beq(CCR0, Lforward); // Has the nmethod been invalidated already? - __ lwz(R0, nmethod::entry_bci_offset(), R3_RET); - __ cmpwi(CCR0, R0, InvalidOSREntryBci); - __ beq(CCR0, Lforward); + __ lbz(R0, nmethod::state_offset(), R3_RET); + __ cmpwi(CCR0, R0, nmethod::in_use); + __ bne(CCR0, Lforward); // Migrate the interpreter frame off of the stack. // We can use all registers because we will not return to interpreter from this point. diff --git a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp index 6f2e16c3c66..51f237ba626 100644 --- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp @@ -2407,8 +2407,8 @@ void InterpreterMacroAssembler::test_backedge_count_for_osr( Register backedge_c br_null_short(O0, Assembler::pn, overflow_with_error); // Has the nmethod been invalidated already? - ld(O0, nmethod::entry_bci_offset(), O2); - cmp_and_br_short(O2, InvalidOSREntryBci, Assembler::equal, Assembler::pn, overflow_with_error); + ldub(O0, nmethod::state_offset(), O2); + cmp_and_br_short(O2, nmethod::in_use, Assembler::notEqual, Assembler::pn, overflow_with_error); // migrate the interpreter frame off of the stack diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp index f85864df878..cd40653a2fb 100644 --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -1636,8 +1636,8 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { __ br_null_short(O0, Assembler::pn, Lforward); // Has the nmethod been invalidated already? - __ ld(O0, nmethod::entry_bci_offset(), O2); - __ cmp_and_br_short(O2, InvalidOSREntryBci, Assembler::equal, Assembler::pn, Lforward); + __ ldub(O0, nmethod::state_offset(), O2); + __ cmp_and_br_short(O2, nmethod::in_use, Assembler::notEqual, Assembler::pn, Lforward); // migrate the interpreter frame off of the stack diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp index da56c1449cd..958613081f3 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp @@ -1724,9 +1724,8 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { __ testptr(rax, rax); // test result __ jcc(Assembler::zero, dispatch); // no osr if null // nmethod may have been invalidated (VM may block upon call_VM return) - __ movl(rcx, Address(rax, nmethod::entry_bci_offset())); - __ cmpl(rcx, InvalidOSREntryBci); - __ jcc(Assembler::equal, dispatch); + __ cmpb(Address(rax, nmethod::state_offset()), nmethod::in_use); + __ jcc(Assembler::notEqual, dispatch); // We have the address of an on stack replacement routine in rax, // We need to prepare to execute the OSR method. First we must @@ -1734,8 +1733,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { __ mov(rbx, rax); // save the nmethod - const Register thread = rcx; - __ get_thread(thread); + __ get_thread(rcx); call_VM(noreg, CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_begin)); // rax, is OSR buffer, move it to expected parameter location __ mov(rcx, rax); diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp index 00d2d58cdfb..cd7ee3b65b0 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp @@ -1751,9 +1751,8 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { __ testptr(rax, rax); // test result __ jcc(Assembler::zero, dispatch); // no osr if null // nmethod may have been invalidated (VM may block upon call_VM return) - __ movl(rcx, Address(rax, nmethod::entry_bci_offset())); - __ cmpl(rcx, InvalidOSREntryBci); - __ jcc(Assembler::equal, dispatch); + __ cmpb(Address(rax, nmethod::state_offset()), nmethod::in_use); + __ jcc(Assembler::notEqual, dispatch); // We have the address of an on stack replacement routine in eax // We need to prepare to execute the OSR method. First we must diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp index 3e52e42d411..ce875397f20 100644 --- a/hotspot/src/share/vm/code/nmethod.cpp +++ b/hotspot/src/share/vm/code/nmethod.cpp @@ -1364,8 +1364,6 @@ void nmethod::invalidate_osr_method() { // Remove from list of active nmethods if (method() != NULL) method()->method_holder()->remove_osr_nmethod(this); - // Set entry as invalid - _entry_bci = InvalidOSREntryBci; } void nmethod::log_state_change() const { diff --git a/hotspot/src/share/vm/code/nmethod.hpp b/hotspot/src/share/vm/code/nmethod.hpp index d3ed6ae2143..1791bbfbb6a 100644 --- a/hotspot/src/share/vm/code/nmethod.hpp +++ b/hotspot/src/share/vm/code/nmethod.hpp @@ -202,13 +202,6 @@ class nmethod : public CodeBlob { bool _oops_are_stale; // indicates that it's no longer safe to access oops section #endif - enum { in_use = 0, // executable nmethod - not_entrant = 1, // marked for deoptimization but activations may still exist, - // will be transformed to zombie when all activations are gone - zombie = 2, // no activations exist, nmethod is ready for purge - unloaded = 3 }; // there should be no activations, should not be called, - // will be transformed to zombie immediately - jbyte _scavenge_root_state; #if INCLUDE_RTM_OPT @@ -431,6 +424,13 @@ class nmethod : public CodeBlob { address entry_point() const { return _entry_point; } // normal entry point address verified_entry_point() const { return _verified_entry_point; } // if klass is correct + enum { in_use = 0, // executable nmethod + not_entrant = 1, // marked for deoptimization but activations may still exist, + // will be transformed to zombie when all activations are gone + zombie = 2, // no activations exist, nmethod is ready for purge + unloaded = 3 }; // there should be no activations, should not be called, + // will be transformed to zombie immediately + // flag accessing and manipulation bool is_in_use() const { return _state == in_use; } bool is_alive() const { return _state == in_use || _state == not_entrant; } @@ -759,7 +759,7 @@ public: // support for code generation static int verified_entry_point_offset() { return offset_of(nmethod, _verified_entry_point); } static int osr_entry_point_offset() { return offset_of(nmethod, _osr_entry_point); } - static int entry_bci_offset() { return offset_of(nmethod, _entry_bci); } + static int state_offset() { return offset_of(nmethod, _state); } // RedefineClasses support. Mark metadata in nmethods as on_stack so that // redefine classes doesn't purge it. diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp index dc2a782ea05..2bf9a20f27d 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp @@ -330,7 +330,7 @@ if (do_OSR) { \ nmethod* osr_nmethod; \ OSR_REQUEST(osr_nmethod, branch_pc); \ - if (osr_nmethod != NULL && osr_nmethod->osr_entry_bci() != InvalidOSREntryBci) { \ + if (osr_nmethod != NULL && osr_nmethod->is_in_use()) { \ intptr_t* buf; \ /* Call OSR migration with last java frame only, no checks. */ \ CALL_VM_NAKED_LJF(buf=SharedRuntime::OSR_migration_begin(THREAD)); \ diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index d3ad9bd9b88..c221cd96bf7 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -2518,7 +2518,6 @@ typedef TwoOopHashtable SymbolTwoOopHashtable; /*********************************************/ \ \ declare_constant(InvocationEntryBci) \ - declare_constant(InvalidOSREntryBci) \ \ /***************/ \ /* OopMapValue */ \ diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 269853ee674..2bcdbbcb551 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -882,8 +882,7 @@ enum JavaThreadState { // Handy constants for deciding which compiler mode to use. enum MethodCompilation { - InvocationEntryBci = -1, // i.e., not a on-stack replacement compilation - InvalidOSREntryBci = -2 + InvocationEntryBci = -1 // i.e., not a on-stack replacement compilation }; // Enumeration to distinguish tiers of compilation From f00468aa4018ae04ab62b960a672ca96d8f68446 Mon Sep 17 00:00:00 2001 From: Yuri Nesterenko Date: Mon, 15 Sep 2014 17:27:15 +0400 Subject: [PATCH 24/81] 8056991: Provide OSInfo functionality to regression tests Reviewed-by: alexsch --- jdk/test/javax/swing/UITest/UITest.java | 9 +- .../testlibrary/jdk/testlibrary/OSInfo.java | 191 ++++++++++++++++++ 2 files changed, 197 insertions(+), 3 deletions(-) create mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/OSInfo.java diff --git a/jdk/test/javax/swing/UITest/UITest.java b/jdk/test/javax/swing/UITest/UITest.java index 413bd1f3ee6..70ec9d2954f 100644 --- a/jdk/test/javax/swing/UITest/UITest.java +++ b/jdk/test/javax/swing/UITest/UITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -28,11 +28,14 @@ * GTK is not on Windows and Mac. * added as tabs * @author Scott Violet + * @library ../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo + * @run main UITest */ import javax.swing.*; import javax.swing.UIManager.LookAndFeelInfo; -import sun.awt.OSInfo; -import sun.awt.OSInfo.OSType; +import jdk.testlibrary.OSInfo; +import jdk.testlibrary.OSInfo.OSType; public class UITest { diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/OSInfo.java b/jdk/test/lib/testlibrary/jdk/testlibrary/OSInfo.java new file mode 100644 index 00000000000..f95fdeefc1b --- /dev/null +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/OSInfo.java @@ -0,0 +1,191 @@ +/* + * Copyright (c) 1997, 2014, 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. + */ + +package jdk.testlibrary; + +import java.security.PrivilegedAction; +import java.util.HashMap; +import java.util.Map; + +import static jdk.testlibrary.OSInfo.OSType.*; + +/** + * @author Pavel Porvatov + * copied to testlibrary by yan + */ +public class OSInfo { + public static enum OSType { + WINDOWS, + LINUX, + SOLARIS, + MACOSX, + UNKNOWN + } + + /* + The map windowsVersionMap must contain all windows version constants except WINDOWS_UNKNOWN, + and so the method getWindowsVersion() will return the constant for known OS. + It allows compare objects by "==" instead of "equals". + */ + public static final WindowsVersion WINDOWS_UNKNOWN = new WindowsVersion(-1, -1); + public static final WindowsVersion WINDOWS_95 = new WindowsVersion(4, 0); + public static final WindowsVersion WINDOWS_98 = new WindowsVersion(4, 10); + public static final WindowsVersion WINDOWS_ME = new WindowsVersion(4, 90); + public static final WindowsVersion WINDOWS_2000 = new WindowsVersion(5, 0); + public static final WindowsVersion WINDOWS_XP = new WindowsVersion(5, 1); + public static final WindowsVersion WINDOWS_2003 = new WindowsVersion(5, 2); + public static final WindowsVersion WINDOWS_VISTA = new WindowsVersion(6, 0); + + private static final String OS_NAME = "os.name"; + private static final String OS_VERSION = "os.version"; + + private final static Map windowsVersionMap = new HashMap(); + + static { + windowsVersionMap.put(WINDOWS_95.toString(), WINDOWS_95); + windowsVersionMap.put(WINDOWS_98.toString(), WINDOWS_98); + windowsVersionMap.put(WINDOWS_ME.toString(), WINDOWS_ME); + windowsVersionMap.put(WINDOWS_2000.toString(), WINDOWS_2000); + windowsVersionMap.put(WINDOWS_XP.toString(), WINDOWS_XP); + windowsVersionMap.put(WINDOWS_2003.toString(), WINDOWS_2003); + windowsVersionMap.put(WINDOWS_VISTA.toString(), WINDOWS_VISTA); + } + + private static final PrivilegedAction osTypeAction = new PrivilegedAction() { + public OSType run() { + return getOSType(); + } + }; + + private OSInfo() { + // Don't allow to create instances + } + + /** + * Returns type of operating system. + */ + public static OSType getOSType() throws SecurityException { + String osName = System.getProperty(OS_NAME); + + if (osName != null) { + if (osName.contains("Windows")) { + return WINDOWS; + } + + if (osName.contains("Linux")) { + return LINUX; + } + + if (osName.contains("Solaris") || osName.contains("SunOS")) { + return SOLARIS; + } + + if (osName.contains("OS X")) { + return MACOSX; + } + + // determine another OS here + } + + return UNKNOWN; + } + + public static PrivilegedAction getOSTypeAction() { + return osTypeAction; + } + + public static WindowsVersion getWindowsVersion() throws SecurityException { + String osVersion = System.getProperty(OS_VERSION); + + if (osVersion == null) { + return WINDOWS_UNKNOWN; + } + + synchronized (windowsVersionMap) { + WindowsVersion result = windowsVersionMap.get(osVersion); + + if (result == null) { + // Try parse version and put object into windowsVersionMap + String[] arr = osVersion.split("\\."); + + if (arr.length == 2) { + try { + result = new WindowsVersion(Integer.parseInt(arr[0]), Integer.parseInt(arr[1])); + } catch (NumberFormatException e) { + return WINDOWS_UNKNOWN; + } + } else { + return WINDOWS_UNKNOWN; + } + + windowsVersionMap.put(osVersion, result); + } + + return result; + } + } + + public static class WindowsVersion implements Comparable { + private final int major; + + private final int minor; + + private WindowsVersion(int major, int minor) { + this.major = major; + this.minor = minor; + } + + public int getMajor() { + return major; + } + + public int getMinor() { + return minor; + } + + public int compareTo(WindowsVersion o) { + int result = major - o.getMajor(); + + if (result == 0) { + result = minor - o.getMinor(); + } + + return result; + } + + public boolean equals(Object obj) { + return obj instanceof WindowsVersion && compareTo((WindowsVersion) obj) == 0; + } + + public int hashCode() { + return 31 * major + minor; + } + + public String toString() { + return major + "." + minor; + } + } +} + From ca1f5068b308c605cb896e1cecbca54c0d36d8f7 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 15 Sep 2014 17:29:43 +0400 Subject: [PATCH 25/81] 8058136: Test api/java_awt/SplashScreen/index.html\#ClosedSplashScreenTests fails because of java.lang.IllegalStateException was not thrown Reviewed-by: azvegint, anthony --- jdk/src/java.desktop/share/classes/java/awt/SplashScreen.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.desktop/share/classes/java/awt/SplashScreen.java b/jdk/src/java.desktop/share/classes/java/awt/SplashScreen.java index 9ec56251a35..05a38e7e113 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/SplashScreen.java +++ b/jdk/src/java.desktop/share/classes/java/awt/SplashScreen.java @@ -293,6 +293,7 @@ public final class SplashScreen { */ public Graphics2D createGraphics() throws IllegalStateException { synchronized (SplashScreen.class) { + checkVisible(); if (image==null) { // get unscaled splash image size Dimension dim = _getBounds(splashPtr).getSize(); @@ -419,4 +420,4 @@ public final class SplashScreen { private native static boolean _setImageData(long SplashPtr, byte[] data); private native static float _getScaleFactor(long SplashPtr); -}; +} From d7f661e576ec3f91bfd13214815f9f6824ab2002 Mon Sep 17 00:00:00 2001 From: George Triantafillou Date: Mon, 15 Sep 2014 14:28:15 -0700 Subject: [PATCH 26/81] 8058504: [TESTBUG] Temporarily disable failing test runtime/NMT/MallocTrackingVerify.java Reviewed-by: ctornqvi, hseigel --- hotspot/test/runtime/NMT/MallocTrackingVerify.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/test/runtime/NMT/MallocTrackingVerify.java b/hotspot/test/runtime/NMT/MallocTrackingVerify.java index 2403a70ab9d..3ed900fc0a4 100644 --- a/hotspot/test/runtime/NMT/MallocTrackingVerify.java +++ b/hotspot/test/runtime/NMT/MallocTrackingVerify.java @@ -27,6 +27,7 @@ * @summary Test to verify correctness of malloc tracking * @key nmt jcmd * @library /testlibrary /testlibrary/whitebox + * @ignore 8058251 * @build MallocTrackingVerify * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocTrackingVerify From f1cc7f5119d5f0c331d9bf71bd4749a973ef3dc6 Mon Sep 17 00:00:00 2001 From: Martin Buchholz Date: Mon, 15 Sep 2014 18:38:16 -0700 Subject: [PATCH 27/81] 8058520: jar xf does not work on zip files with leading garbage Fall back to ZipFile if ZipInputStream finds no entries Reviewed-by: sherman --- .../share/classes/sun/tools/jar/Main.java | 30 +++- jdk/test/tools/jar/LeadingGarbage.java | 139 ++++++++++++++++++ 2 files changed, 164 insertions(+), 5 deletions(-) create mode 100644 jdk/test/tools/jar/LeadingGarbage.java diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/Main.java b/jdk/src/jdk.dev/share/classes/sun/tools/jar/Main.java index 607304df3f5..a39e7de22f4 100644 --- a/jdk/src/jdk.dev/share/classes/sun/tools/jar/Main.java +++ b/jdk/src/jdk.dev/share/classes/sun/tools/jar/Main.java @@ -214,7 +214,7 @@ class Main { in.close(); } out.close(); - if(nflag) { + if (nflag) { JarFile jarFile = null; File packFile = null; JarOutputStream jos = null; @@ -287,11 +287,14 @@ class Main { } } else if (tflag) { replaceFSC(files); + // For the "list table contents" action, access using the + // ZipFile class is always most efficient since only a + // "one-finger" scan through the central directory is required. if (fname != null) { list(fname, files); } else { InputStream in = new FileInputStream(FileDescriptor.in); - try{ + try { list(new BufferedInputStream(in), files); } finally { in.close(); @@ -299,6 +302,15 @@ class Main { } } else if (xflag) { replaceFSC(files); + // For the extract action, when extracting all the entries, + // access using the ZipInputStream class is most efficient, + // since only a single sequential scan through the zip file is + // required. When using the ZipFile class, a "two-finger" scan + // is required, but this is likely to be more efficient when a + // partial extract is requested. In case the zip file has + // "leading garbage", we fall back from the ZipInputStream + // implementation to the ZipFile implementation, since only the + // latter can handle it. if (fname != null && files != null) { extract(fname, files); } else { @@ -306,7 +318,9 @@ class Main { ? new FileInputStream(FileDescriptor.in) : new FileInputStream(fname); try { - extract(new BufferedInputStream(in), files); + if (!extract(new BufferedInputStream(in), files) && fname != null) { + extract(fname, files); + } } finally { in.close(); } @@ -921,14 +935,19 @@ class Main { /** * Extracts specified entries from JAR file. + * + * @return whether entries were found and successfully extracted + * (indicating this was a zip file without "leading garbage") */ - void extract(InputStream in, String files[]) throws IOException { + boolean extract(InputStream in, String files[]) throws IOException { ZipInputStream zis = new ZipInputStream(in); ZipEntry e; // Set of all directory entries specified in archive. Disallows // null entries. Disallows all entries if using pre-6.0 behavior. + boolean entriesFound = false; Set dirs = newDirSet(); while ((e = zis.getNextEntry()) != null) { + entriesFound = true; if (files == null) { dirs.add(extractFile(zis, e)); } else { @@ -947,6 +966,8 @@ class Main { // instead of during, because creating a file in a directory changes // that directory's timestamp. updateLastModifiedTime(dirs); + + return entriesFound; } /** @@ -958,7 +979,6 @@ class Main { Enumeration zes = zf.entries(); while (zes.hasMoreElements()) { ZipEntry e = zes.nextElement(); - InputStream is; if (files == null) { dirs.add(extractFile(zf.getInputStream(e), e)); } else { diff --git a/jdk/test/tools/jar/LeadingGarbage.java b/jdk/test/tools/jar/LeadingGarbage.java new file mode 100644 index 00000000000..045ebb051c9 --- /dev/null +++ b/jdk/test/tools/jar/LeadingGarbage.java @@ -0,0 +1,139 @@ +/* + * Copyright 2014 Google Inc. 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 static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; +import sun.tools.jar.Main; + +import jdk.testlibrary.OutputAnalyzer; +import jdk.testlibrary.ProcessTools; + +import org.testng.annotations.Test; + +/** + * @test + * @bug 8058520 + * @summary jar tf and jar xf should work on zip files with leading garbage + * @library /lib/testlibrary + * @run testng LeadingGarbage + */ +@Test +public class LeadingGarbage { + final String jar = + Paths.get(new File(System.getProperty("java.home")).getParent(), + "bin", "jar").toString(); + final File[] files = { new File("a"), new File("b") }; + final File normalZip = new File("normal.zip"); + final File leadingGarbageZip = new File("leadingGarbage.zip"); + + void createFile(File f) throws IOException { + OutputStream fos = new FileOutputStream(f); + fos.write(f.getName().getBytes("UTF-8")); + fos.close(); + } + + void createFiles() throws IOException { + for (File file : files) + createFile(file); + } + + void deleteFiles() throws IOException { + for (File file : files) + assertTrue(file.delete()); + } + + void assertFilesExist() throws IOException { + for (File file : files) + assertTrue(file.exists()); + } + + void createNormalZip() throws Throwable { + createFiles(); + String[] cmd = { jar, "c0Mf", "normal.zip", "a", "b" }; + ProcessBuilder pb = new ProcessBuilder(cmd); + OutputAnalyzer a = ProcessTools.executeProcess(pb); + a.shouldHaveExitValue(0); + a.stdoutShouldMatch("\\A\\Z"); + a.stderrShouldMatch("\\A\\Z"); + deleteFiles(); + } + + void createZipWithLeadingGarbage() throws Throwable { + createNormalZip(); + createFile(leadingGarbageZip); + OutputStream fos = new FileOutputStream(leadingGarbageZip, true); + Files.copy(normalZip.toPath(), fos); + assertTrue(normalZip.length() < leadingGarbageZip.length()); + assertTrue(normalZip.delete()); + } + + public void test_canList() throws Throwable { + createNormalZip(); + assertCanList("normal.zip"); + } + + public void test_canListWithLeadingGarbage() throws Throwable { + createZipWithLeadingGarbage(); + assertCanList("leadingGarbage.zip"); + } + + void assertCanList(String zipFileName) throws Throwable { + String[] cmd = { jar, "tf", zipFileName }; + ProcessBuilder pb = new ProcessBuilder(cmd); + OutputAnalyzer a = ProcessTools.executeProcess(pb); + a.shouldHaveExitValue(0); + StringBuilder expected = new StringBuilder(); + for (File file : files) + expected.append(file.getName()).append('\n'); + a.stdoutShouldMatch(expected.toString()); + a.stderrShouldMatch("\\A\\Z"); + } + + public void test_canExtract() throws Throwable { + createNormalZip(); + assertCanExtract("normal.zip"); + } + + public void test_canExtractWithLeadingGarbage() throws Throwable { + createZipWithLeadingGarbage(); + assertCanExtract("leadingGarbage.zip"); + } + + void assertCanExtract(String zipFileName) throws Throwable { + String[] cmd = { jar, "xf", zipFileName }; + ProcessBuilder pb = new ProcessBuilder(cmd); + OutputAnalyzer a = ProcessTools.executeProcess(pb); + a.shouldHaveExitValue(0); + a.stdoutShouldMatch("\\A\\Z"); + a.stderrShouldMatch("\\A\\Z"); + assertFilesExist(); + } + +} From cdc16edaa5d3d0678107651b615cebb055c7a826 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 16 Sep 2014 10:13:45 +0200 Subject: [PATCH 28/81] 8058475: TestCMSClassUnloadingEnabledHWM.java fails with '.*CMS Initial Mark.*' missing from stdout/stderr Reviewed-by: mgerdin, tschatzl, brutisso --- .../AllocateBeyondMetaspaceSize.java | 59 ------------------- .../TestCMSClassUnloadingEnabledHWM.java | 47 +++++++++++++-- .../TestG1ClassUnloadingHWM.java | 37 +++++++++++- 3 files changed, 76 insertions(+), 67 deletions(-) delete mode 100644 hotspot/test/gc/class_unloading/AllocateBeyondMetaspaceSize.java diff --git a/hotspot/test/gc/class_unloading/AllocateBeyondMetaspaceSize.java b/hotspot/test/gc/class_unloading/AllocateBeyondMetaspaceSize.java deleted file mode 100644 index 4998fa8e562..00000000000 --- a/hotspot/test/gc/class_unloading/AllocateBeyondMetaspaceSize.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2014, 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 sun.hotspot.WhiteBox; - -class AllocateBeyondMetaspaceSize { - public static Object dummy; - - public static void main(String [] args) { - if (args.length != 2) { - throw new IllegalArgumentException("Usage: "); - } - - long metaspaceSize = Long.parseLong(args[0]); - long youngGenSize = Long.parseLong(args[1]); - - run(metaspaceSize, youngGenSize); - } - - private static void run(long metaspaceSize, long youngGenSize) { - WhiteBox wb = WhiteBox.getWhiteBox(); - - long allocationBeyondMetaspaceSize = metaspaceSize * 2; - long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize); - - triggerYoungGC(youngGenSize); - - wb.freeMetaspace(null, metaspace, metaspace); - } - - private static void triggerYoungGC(long youngGenSize) { - long approxAllocSize = 32 * 1024; - long numAllocations = 2 * youngGenSize / approxAllocSize; - - for (long i = 0; i < numAllocations; i++) { - dummy = new byte[(int)approxAllocSize]; - } - } -} diff --git a/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java b/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java index 38c1e16cea1..0e33bcf967d 100644 --- a/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java +++ b/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java @@ -26,7 +26,7 @@ * @key gc * @bug 8049831 * @library /testlibrary /testlibrary/whitebox - * @build TestCMSClassUnloadingEnabledHWM AllocateBeyondMetaspaceSize + * @build TestCMSClassUnloadingEnabledHWM * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver TestCMSClassUnloadingEnabledHWM @@ -35,9 +35,11 @@ import com.oracle.java.testlibrary.OutputAnalyzer; import com.oracle.java.testlibrary.ProcessTools; - +import java.lang.management.GarbageCollectorMXBean; +import java.lang.management.ManagementFactory; import java.util.ArrayList; import java.util.Arrays; +import sun.hotspot.WhiteBox; public class TestCMSClassUnloadingEnabledHWM { private static long MetaspaceSize = 32 * 1024 * 1024; @@ -48,15 +50,18 @@ public class TestCMSClassUnloadingEnabledHWM { "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", + "-Xmx128m", + "-XX:CMSMaxAbortablePrecleanTime=1", + "-XX:CMSWaitDuration=50", "-XX:MetaspaceSize=" + MetaspaceSize, "-Xmn" + YoungGenSize, "-XX:+UseConcMarkSweepGC", "-XX:" + (enableUnloading ? "+" : "-") + "CMSClassUnloadingEnabled", "-XX:+PrintHeapAtGC", "-XX:+PrintGCDetails", - "AllocateBeyondMetaspaceSize", - "" + MetaspaceSize, - "" + YoungGenSize); + "-XX:+PrintGCTimeStamps", + TestCMSClassUnloadingEnabledHWM.AllocateBeyondMetaspaceSize.class.getName(), + "" + MetaspaceSize); return new OutputAnalyzer(pb.start()); } @@ -88,5 +93,37 @@ public class TestCMSClassUnloadingEnabledHWM { testWithCMSClassUnloading(); testWithoutCMSClassUnloading(); } + + public static class AllocateBeyondMetaspaceSize { + public static void main(String [] args) throws Exception { + if (args.length != 1) { + throw new IllegalArgumentException("Usage: "); + } + + WhiteBox wb = WhiteBox.getWhiteBox(); + + // Allocate past the MetaspaceSize limit. + long metaspaceSize = Long.parseLong(args[0]); + long allocationBeyondMetaspaceSize = metaspaceSize * 2; + long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize); + + // Wait for at least one GC to occur. The caller will parse the log files produced. + GarbageCollectorMXBean cmsGCBean = getCMSGCBean(); + while (cmsGCBean.getCollectionCount() == 0) { + Thread.sleep(100); + } + + wb.freeMetaspace(null, metaspace, metaspace); + } + + private static GarbageCollectorMXBean getCMSGCBean() { + for (GarbageCollectorMXBean gcBean : ManagementFactory.getGarbageCollectorMXBeans()) { + if (gcBean.getObjectName().toString().equals("java.lang:type=GarbageCollector,name=ConcurrentMarkSweep")) { + return gcBean; + } + } + return null; + } + } } diff --git a/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java b/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java index c2c17145762..7a2ebc18b42 100644 --- a/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java +++ b/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java @@ -26,7 +26,7 @@ * @key gc * @bug 8049831 * @library /testlibrary /testlibrary/whitebox - * @build TestG1ClassUnloadingHWM AllocateBeyondMetaspaceSize + * @build TestG1ClassUnloadingHWM * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver TestG1ClassUnloadingHWM @@ -35,9 +35,9 @@ import com.oracle.java.testlibrary.OutputAnalyzer; import com.oracle.java.testlibrary.ProcessTools; - import java.util.ArrayList; import java.util.Arrays; +import sun.hotspot.WhiteBox; public class TestG1ClassUnloadingHWM { private static long MetaspaceSize = 32 * 1024 * 1024; @@ -54,7 +54,7 @@ public class TestG1ClassUnloadingHWM { "-XX:" + (enableUnloading ? "+" : "-") + "ClassUnloadingWithConcurrentMark", "-XX:+PrintHeapAtGC", "-XX:+PrintGCDetails", - "AllocateBeyondMetaspaceSize", + TestG1ClassUnloadingHWM.AllocateBeyondMetaspaceSize.class.getName(), "" + MetaspaceSize, "" + YoungGenSize); return new OutputAnalyzer(pb.start()); @@ -88,5 +88,36 @@ public class TestG1ClassUnloadingHWM { testWithG1ClassUnloading(); testWithoutG1ClassUnloading(); } + + public static class AllocateBeyondMetaspaceSize { + public static Object dummy; + + public static void main(String [] args) throws Exception { + if (args.length != 2) { + throw new IllegalArgumentException("Usage: "); + } + + WhiteBox wb = WhiteBox.getWhiteBox(); + + // Allocate past the MetaspaceSize limit + long metaspaceSize = Long.parseLong(args[0]); + long allocationBeyondMetaspaceSize = metaspaceSize * 2; + long metaspace = wb.allocateMetaspace(null, allocationBeyondMetaspaceSize); + + long youngGenSize = Long.parseLong(args[1]); + triggerYoungGCs(youngGenSize); + + wb.freeMetaspace(null, metaspace, metaspace); + } + + public static void triggerYoungGCs(long youngGenSize) { + long approxAllocSize = 32 * 1024; + long numAllocations = 2 * youngGenSize / approxAllocSize; + + for (long i = 0; i < numAllocations; i++) { + dummy = new byte[(int)approxAllocSize]; + } + } + } } From adf66602a0a96382d722743eca19fb78ec6e701d Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 16 Sep 2014 10:28:15 +0200 Subject: [PATCH 29/81] 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set Remove -XX:-G1DeferredRSUpdate functionality as it is racy. During evacuation failure handling, threads where evacuation failure handling occurred may try to add remembered sets to regions which remembered sets are currently being scanned. The iterator to handle the remembered set scan does not support addition of entries during scan and so may skip valid references. Reviewed-by: iveresov, brutisso, mgerdin --- .../gc_implementation/g1/g1CollectedHeap.cpp | 25 ++--- .../vm/gc_implementation/g1/g1EvacFailure.hpp | 25 ++--- .../gc_implementation/g1/g1GCPhaseTimes.cpp | 16 ++-- .../g1/g1ParScanThreadState.hpp | 27 +++--- .../g1/g1ParScanThreadState.inline.hpp | 14 --- .../vm/gc_implementation/g1/g1RemSet.cpp | 92 ++----------------- .../vm/gc_implementation/g1/g1RemSet.hpp | 14 --- .../gc_implementation/g1/g1RemSet.inline.hpp | 9 -- .../vm/gc_implementation/g1/g1_globals.hpp | 3 - hotspot/test/gc/g1/TestDeferredRSUpdate.java | 79 ---------------- 10 files changed, 41 insertions(+), 263 deletions(-) delete mode 100644 hotspot/test/gc/g1/TestDeferredRSUpdate.java diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 021dbe406e0..fda7d94a9df 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1481,9 +1481,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc, // Discard all rset updates JavaThread::dirty_card_queue_set().abandon_logs(); - assert(!G1DeferredRSUpdate - || (G1DeferredRSUpdate && - (dirty_card_queue_set().completed_buffers_num() == 0)), "Should not be any"); + assert(dirty_card_queue_set().completed_buffers_num() == 0, "DCQS should be empty"); _young_list->reset_sampled_info(); // At this point there should be no regions in the @@ -2094,15 +2092,13 @@ jint G1CollectedHeap::initialize() { concurrent_g1_refine()->red_zone(), Shared_DirtyCardQ_lock); - if (G1DeferredRSUpdate) { - dirty_card_queue_set().initialize(NULL, // Should never be called by the Java code - DirtyCardQ_CBL_mon, - DirtyCardQ_FL_lock, - -1, // never trigger processing - -1, // no limit on length - Shared_DirtyCardQ_lock, - &JavaThread::dirty_card_queue_set()); - } + dirty_card_queue_set().initialize(NULL, // Should never be called by the Java code + DirtyCardQ_CBL_mon, + DirtyCardQ_FL_lock, + -1, // never trigger processing + -1, // no limit on length + Shared_DirtyCardQ_lock, + &JavaThread::dirty_card_queue_set()); // Initialize the card queue set used to hold cards containing // references into the collection set. @@ -5389,7 +5385,6 @@ class G1RedirtyLoggedCardsTask : public AbstractGangTask { }; void G1CollectedHeap::redirty_logged_cards() { - guarantee(G1DeferredRSUpdate, "Must only be called when using deferred RS updates."); double redirty_logged_cards_start = os::elapsedTime(); uint n_workers = (G1CollectedHeap::use_parallel_gc_threads() ? @@ -6049,9 +6044,7 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) { // RSets. enqueue_discovered_references(n_workers); - if (G1DeferredRSUpdate) { - redirty_logged_cards(); - } + redirty_logged_cards(); COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp index 72d1ca179f8..e628340105f 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp @@ -176,15 +176,17 @@ public: class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure { G1CollectedHeap* _g1h; ConcurrentMark* _cm; - OopsInHeapRegionClosure *_update_rset_cl; uint _worker_id; + DirtyCardQueue _dcq; + UpdateRSetDeferred _update_rset_cl; + public: RemoveSelfForwardPtrHRClosure(G1CollectedHeap* g1h, - OopsInHeapRegionClosure* update_rset_cl, uint worker_id) : - _g1h(g1h), _update_rset_cl(update_rset_cl), - _worker_id(worker_id), _cm(_g1h->concurrent_mark()) { } + _g1h(g1h), _dcq(&g1h->dirty_card_queue_set()), _update_rset_cl(g1h, &_dcq), + _worker_id(worker_id), _cm(_g1h->concurrent_mark()) { + } bool doHeapRegion(HeapRegion *hr) { bool during_initial_mark = _g1h->g1_policy()->during_initial_mark_pause(); @@ -195,7 +197,7 @@ public: if (hr->claimHeapRegion(HeapRegion::ParEvacFailureClaimValue)) { if (hr->evacuation_failed()) { - RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, _update_rset_cl, + RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, &_update_rset_cl, during_initial_mark, during_conc_mark, _worker_id); @@ -214,7 +216,7 @@ public: // whenever this might be required in the future. hr->rem_set()->reset_for_par_iteration(); hr->reset_bot(); - _update_rset_cl->set_region(hr); + _update_rset_cl.set_region(hr); hr->object_iterate(&rspc); hr->rem_set()->clean_strong_code_roots(hr); @@ -238,16 +240,7 @@ public: _g1h(g1h) { } void work(uint worker_id) { - UpdateRSetImmediate immediate_update(_g1h->g1_rem_set()); - DirtyCardQueue dcq(&_g1h->dirty_card_queue_set()); - UpdateRSetDeferred deferred_update(_g1h, &dcq); - - OopsInHeapRegionClosure *update_rset_cl = &deferred_update; - if (!G1DeferredRSUpdate) { - update_rset_cl = &immediate_update; - } - - RemoveSelfForwardPtrHRClosure rsfp_cl(_g1h, update_rset_cl, worker_id); + RemoveSelfForwardPtrHRClosure rsfp_cl(_g1h, worker_id); HeapRegion* hr = _g1h->start_cset_region_for_worker(worker_id); _g1h->collection_set_iterate_from(hr, &rsfp_cl); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp index bf7e3533b71..13d1c9de7d7 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp @@ -237,10 +237,8 @@ void G1GCPhaseTimes::note_gc_end() { _last_gc_worker_times_ms.verify(); _last_gc_worker_other_times_ms.verify(); - if (G1DeferredRSUpdate) { - _last_redirty_logged_cards_time_ms.verify(); - _last_redirty_logged_cards_processed_cards.verify(); - } + _last_redirty_logged_cards_time_ms.verify(); + _last_redirty_logged_cards_processed_cards.verify(); } void G1GCPhaseTimes::note_string_dedup_fixup_start() { @@ -352,12 +350,10 @@ void G1GCPhaseTimes::print(double pause_time_sec) { _recorded_non_young_cset_choice_time_ms)); print_stats(2, "Ref Proc", _cur_ref_proc_time_ms); print_stats(2, "Ref Enq", _cur_ref_enq_time_ms); - if (G1DeferredRSUpdate) { - print_stats(2, "Redirty Cards", _recorded_redirty_logged_cards_time_ms); - if (G1Log::finest()) { - _last_redirty_logged_cards_time_ms.print(3, "Parallel Redirty"); - _last_redirty_logged_cards_processed_cards.print(3, "Redirtied Cards"); - } + print_stats(2, "Redirty Cards", _recorded_redirty_logged_cards_time_ms); + if (G1Log::finest()) { + _last_redirty_logged_cards_time_ms.print(3, "Parallel Redirty"); + _last_redirty_logged_cards_processed_cards.print(3, "Redirtied Cards"); } if (G1ReclaimDeadHumongousObjectsAtYoungGC) { print_stats(2, "Humongous Reclaim", _cur_fast_reclaim_humongous_time_ms); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp index e590a9ee86d..2878e09448c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp @@ -84,20 +84,6 @@ class G1ParScanThreadState : public StackObj { DirtyCardQueue& dirty_card_queue() { return _dcq; } G1SATBCardTableModRefBS* ctbs() { return _ct_bs; } - template inline void immediate_rs_update(HeapRegion* from, T* p, int tid); - - template void deferred_rs_update(HeapRegion* from, T* p, int tid) { - // If the new value of the field points to the same region or - // is the to-space, we don't need to include it in the Rset updates. - if (!from->is_in_reserved(oopDesc::load_decode_heap_oop(p)) && !from->is_survivor()) { - size_t card_index = ctbs()->index_for(p); - // If the card hasn't been added to the buffer, do it. - if (ctbs()->mark_card_deferred(card_index)) { - dirty_card_queue().enqueue((jbyte*)ctbs()->byte_for_index(card_index)); - } - } - } - public: G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp); ~G1ParScanThreadState(); @@ -124,8 +110,17 @@ class G1ParScanThreadState : public StackObj { _refs->push(ref); } - template inline void update_rs(HeapRegion* from, T* p, int tid); - + template void update_rs(HeapRegion* from, T* p, int tid) { + // If the new value of the field points to the same region or + // is the to-space, we don't need to include it in the Rset updates. + if (!from->is_in_reserved(oopDesc::load_decode_heap_oop(p)) && !from->is_survivor()) { + size_t card_index = ctbs()->index_for(p); + // If the card hasn't been added to the buffer, do it. + if (ctbs()->mark_card_deferred(card_index)) { + dirty_card_queue().enqueue((jbyte*)ctbs()->byte_for_index(card_index)); + } + } + } private: inline HeapWord* allocate(GCAllocPurpose purpose, size_t word_sz); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp index 75517fb3f9d..3fb1829f20d 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp @@ -29,20 +29,6 @@ #include "gc_implementation/g1/g1RemSet.inline.hpp" #include "oops/oop.inline.hpp" -template inline void G1ParScanThreadState::immediate_rs_update(HeapRegion* from, T* p, int tid) { - if (!from->is_survivor()) { - _g1_rem->par_write_ref(from, p, tid); - } -} - -template void G1ParScanThreadState::update_rs(HeapRegion* from, T* p, int tid) { - if (G1DeferredRSUpdate) { - deferred_rs_update(from, p, tid); - } else { - immediate_rs_update(from, p, tid); - } -} - template void G1ParScanThreadState::do_oop_evac(T* p, HeapRegion* from) { assert(!oopDesc::is_null(oopDesc::load_decode_heap_oop(p)), "Reference should not be NULL here as such are never pushed to the task queue."); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp index f1628f63968..94d77b4043f 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp @@ -339,12 +339,8 @@ void G1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc, // are just discarded (there's no need to update the RSets of regions // that were in the collection set - after the pause these regions // are wholly 'free' of live objects. In the event of an evacuation - // failure the cards/buffers in this queue set are: - // * passed to the DirtyCardQueueSet that is used to manage deferred - // RSet updates, or - // * scanned for references that point into the collection set - // and the RSet of the corresponding region in the collection set - // is updated immediately. + // failure the cards/buffers in this queue set are passed to the + // DirtyCardQueueSet that is used to manage RSet updates DirtyCardQueue into_cset_dcq(&_g1->into_cset_dirty_card_queue_set()); assert((ParallelGCThreads > 0) || worker_i == 0, "invariant"); @@ -358,7 +354,6 @@ void G1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc, void G1RemSet::prepare_for_oops_into_collection_set_do() { cleanupHRRS(); - ConcurrentG1Refine* cg1r = _g1->concurrent_g1_refine(); _g1->set_refine_cte_cl_concurrency(false); DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); dcqs.concatenate_logs(); @@ -371,66 +366,6 @@ void G1RemSet::prepare_for_oops_into_collection_set_do() { _total_cards_scanned = 0; } - -// This closure, applied to a DirtyCardQueueSet, is used to immediately -// update the RSets for the regions in the CSet. For each card it iterates -// through the oops which coincide with that card. It scans the reference -// fields in each oop; when it finds an oop that points into the collection -// set, the RSet for the region containing the referenced object is updated. -class UpdateRSetCardTableEntryIntoCSetClosure: public CardTableEntryClosure { - G1CollectedHeap* _g1; - CardTableModRefBS* _ct_bs; -public: - UpdateRSetCardTableEntryIntoCSetClosure(G1CollectedHeap* g1, - CardTableModRefBS* bs): - _g1(g1), _ct_bs(bs) - { } - - bool do_card_ptr(jbyte* card_ptr, uint worker_i) { - // Construct the region representing the card. - HeapWord* start = _ct_bs->addr_for(card_ptr); - // And find the region containing it. - HeapRegion* r = _g1->heap_region_containing(start); - - // Scan oops in the card looking for references into the collection set - // Don't use addr_for(card_ptr + 1) which can ask for - // a card beyond the heap. This is not safe without a perm - // gen. - HeapWord* end = start + CardTableModRefBS::card_size_in_words; - MemRegion scanRegion(start, end); - - UpdateRSetImmediate update_rs_cl(_g1->g1_rem_set()); - FilterIntoCSClosure update_rs_cset_oop_cl(NULL, _g1, &update_rs_cl); - FilterOutOfRegionClosure filter_then_update_rs_cset_oop_cl(r, &update_rs_cset_oop_cl); - - // We can pass false as the "filter_young" parameter here as: - // * we should be in a STW pause, - // * the DCQS to which this closure is applied is used to hold - // references that point into the collection set from the prior - // RSet updating, - // * the post-write barrier shouldn't be logging updates to young - // regions (but there is a situation where this can happen - see - // the comment in G1RemSet::refine_card() below - - // that should not be applicable here), and - // * during actual RSet updating, the filtering of cards in young - // regions in HeapRegion::oops_on_card_seq_iterate_careful is - // employed. - // As a result, when this closure is applied to "refs into cset" - // DCQS, we shouldn't see any cards in young regions. - update_rs_cl.set_region(r); - HeapWord* stop_point = - r->oops_on_card_seq_iterate_careful(scanRegion, - &filter_then_update_rs_cset_oop_cl, - false /* filter_young */, - NULL /* card_ptr */); - - // Since this is performed in the event of an evacuation failure, we - // we shouldn't see a non-null stop point - assert(stop_point == NULL, "saw an unallocated region"); - return true; - } -}; - void G1RemSet::cleanup_after_oops_into_collection_set_do() { guarantee( _cards_scanned != NULL, "invariant" ); _total_cards_scanned = 0; @@ -451,25 +386,10 @@ void G1RemSet::cleanup_after_oops_into_collection_set_do() { double restore_remembered_set_start = os::elapsedTime(); // Restore remembered sets for the regions pointing into the collection set. - if (G1DeferredRSUpdate) { - // If deferred RS updates are enabled then we just need to transfer - // the completed buffers from (a) the DirtyCardQueueSet used to hold - // cards that contain references that point into the collection set - // to (b) the DCQS used to hold the deferred RS updates - _g1->dirty_card_queue_set().merge_bufferlists(&into_cset_dcqs); - } else { - - CardTableModRefBS* bs = (CardTableModRefBS*)_g1->barrier_set(); - UpdateRSetCardTableEntryIntoCSetClosure update_rs_cset_immediate(_g1, bs); - - int n_completed_buffers = 0; - while (into_cset_dcqs.apply_closure_to_completed_buffer(&update_rs_cset_immediate, - 0, 0, true)) { - n_completed_buffers++; - } - assert(n_completed_buffers == into_cset_n_buffers, "missed some buffers"); - } - + // We just need to transfer the completed buffers from the DirtyCardQueueSet + // used to hold cards that contain references that point into the collection set + // to the DCQS used to hold the deferred RS updates. + _g1->dirty_card_queue_set().merge_bufferlists(&into_cset_dcqs); _g1->g1_policy()->phase_times()->record_evac_fail_restore_remsets((os::elapsedTime() - restore_remembered_set_start) * 1000.0); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp index 35279a52e20..5a629fad2d0 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp @@ -193,18 +193,4 @@ public: bool apply_to_weak_ref_discovered_field() { return true; } }; -class UpdateRSetImmediate: public OopsInHeapRegionClosure { -private: - G1RemSet* _g1_rem_set; - - template void do_oop_work(T* p); -public: - UpdateRSetImmediate(G1RemSet* rs) : - _g1_rem_set(rs) {} - - virtual void do_oop(narrowOop* p) { do_oop_work(p); } - virtual void do_oop( oop* p) { do_oop_work(p); } -}; - - #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSET_HPP diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp index 949614b28fc..1afef2fb501 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp @@ -79,13 +79,4 @@ inline void UpdateRSOopClosure::do_oop_work(T* p) { _rs->par_write_ref(_from, p, _worker_i); } -template -inline void UpdateRSetImmediate::do_oop_work(T* p) { - assert(_from->is_in_reserved(p), "paranoia"); - T heap_oop = oopDesc::load_heap_oop(p); - if (!oopDesc::is_null(heap_oop) && !_from->is_survivor()) { - _g1_rem_set->par_write_ref(_from, p, 0); - } -} - #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSET_INLINE_HPP diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp index 1913327309c..8a3b7386f85 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp @@ -108,9 +108,6 @@ develop(bool, G1RSBarrierRegionFilter, true, \ "If true, generate region filtering code in RS barrier") \ \ - develop(bool, G1DeferredRSUpdate, true, \ - "If true, use deferred RS updates") \ - \ develop(bool, G1RSLogCheckCardTable, false, \ "If true, verify that no dirty cards remain after RS log " \ "processing.") \ diff --git a/hotspot/test/gc/g1/TestDeferredRSUpdate.java b/hotspot/test/gc/g1/TestDeferredRSUpdate.java deleted file mode 100644 index f00967d1df4..00000000000 --- a/hotspot/test/gc/g1/TestDeferredRSUpdate.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2014, 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 TestDeferredRSUpdate - * @bug 8040977 8052170 - * @summary Ensure that running with -XX:-G1DeferredRSUpdate does not crash the VM - * @key gc - * @library /testlibrary - */ - -import com.oracle.java.testlibrary.ProcessTools; -import com.oracle.java.testlibrary.OutputAnalyzer; - -public class TestDeferredRSUpdate { - public static void main(String[] args) throws Exception { - GCTest.main(args); - - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx10M", - "-XX:+PrintGCDetails", - // G1DeferredRSUpdate is a develop option, but we cannot limit execution of this test to only debug VMs. - "-XX:+IgnoreUnrecognizedVMOptions", - "-XX:-G1DeferredRSUpdate", - GCTest.class.getName()); - - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldHaveExitValue(0); - } - - static class GCTest { - private static Object[] garbage = new Object[32]; - - public static void main(String [] args) { - System.out.println("Creating garbage"); - // Create 128MB of garbage. This should result in at least one minor GC, with - // some objects copied to old gen. As references from old to young are installed, - // the crash due to the use before initialize occurs. - Object prev = null; - Object prevPrev = null; - for (int i = 0; i < 1024; i++) { - Object[] next = new Object[32 * 1024]; - next[0] = prev; - next[1] = prevPrev; - - Object[] cur = (Object[]) garbage[i % garbage.length]; - if (cur != null) { - cur[0] = null; - cur[1] = null; - } - garbage[i % garbage.length] = next; - - prevPrev = prev; - prev = next; - } - System.out.println("Done"); - } - } -} From 2678b42e96837305ceb233196d213189524b414f Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 16 Sep 2014 12:13:13 +0200 Subject: [PATCH 30/81] 8056999: Make hotspot builds less verbose on default log level Reviewed-by: dholmes, erikj --- hotspot/make/aix/makefiles/adlc.make | 8 ++--- hotspot/make/aix/makefiles/buildtree.make | 18 +++++------ hotspot/make/aix/makefiles/defs.make | 28 ++++++++--------- hotspot/make/aix/makefiles/jsig.make | 2 +- hotspot/make/aix/makefiles/jvmti.make | 15 +++++---- hotspot/make/aix/makefiles/rules.make | 10 +++--- hotspot/make/aix/makefiles/sa.make | 2 +- hotspot/make/aix/makefiles/saproc.make | 2 +- hotspot/make/aix/makefiles/trace.make | 4 +-- hotspot/make/aix/makefiles/vm.make | 4 +-- hotspot/make/bsd/makefiles/adlc.make | 8 ++--- hotspot/make/bsd/makefiles/buildtree.make | 20 ++++++------ hotspot/make/bsd/makefiles/defs.make | 31 +++++++++---------- hotspot/make/bsd/makefiles/dtrace.make | 16 +++++----- hotspot/make/bsd/makefiles/jsig.make | 2 +- hotspot/make/bsd/makefiles/jvmti.make | 15 +++++---- hotspot/make/bsd/makefiles/rules.make | 10 +++--- hotspot/make/bsd/makefiles/sa.make | 10 ++++-- hotspot/make/bsd/makefiles/saproc.make | 2 +- hotspot/make/bsd/makefiles/trace.make | 3 +- hotspot/make/bsd/makefiles/vm.make | 4 +-- hotspot/make/defs.make | 6 ++++ hotspot/make/linux/makefiles/adlc.make | 8 ++--- hotspot/make/linux/makefiles/buildtree.make | 20 ++++++------ hotspot/make/linux/makefiles/defs.make | 26 ++++++++-------- hotspot/make/linux/makefiles/dtrace.make | 4 +-- hotspot/make/linux/makefiles/jsig.make | 2 +- hotspot/make/linux/makefiles/jvmti.make | 14 ++++----- hotspot/make/linux/makefiles/rules.make | 10 +++--- hotspot/make/linux/makefiles/sa.make | 2 +- hotspot/make/linux/makefiles/saproc.make | 2 +- hotspot/make/linux/makefiles/trace.make | 2 +- hotspot/make/linux/makefiles/vm.make | 4 +-- hotspot/make/solaris/makefiles/adlc.make | 8 ++--- hotspot/make/solaris/makefiles/buildtree.make | 20 ++++++------ hotspot/make/solaris/makefiles/defs.make | 26 ++++++++-------- hotspot/make/solaris/makefiles/dtrace.make | 20 ++++++------ hotspot/make/solaris/makefiles/jsig.make | 2 +- hotspot/make/solaris/makefiles/jvmti.make | 15 +++++---- hotspot/make/solaris/makefiles/rules.make | 10 +++--- hotspot/make/solaris/makefiles/sa.make | 2 +- hotspot/make/solaris/makefiles/saproc.make | 2 +- hotspot/make/solaris/makefiles/trace.make | 4 +-- hotspot/make/solaris/makefiles/vm.make | 2 +- 44 files changed, 213 insertions(+), 212 deletions(-) diff --git a/hotspot/make/aix/makefiles/adlc.make b/hotspot/make/aix/makefiles/adlc.make index 4355d73b7b9..abdee74f878 100644 --- a/hotspot/make/aix/makefiles/adlc.make +++ b/hotspot/make/aix/makefiles/adlc.make @@ -106,7 +106,7 @@ GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%) all: $(EXEC) $(EXEC) : $(OBJECTS) - @echo Making adlc + @echo $(LOG_INFO) Making adlc $(QUIETLY) $(HOST.LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS) # Random dependencies: @@ -189,7 +189,7 @@ refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER) $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \ - || echo "Rescanned $(SOURCE.AD) but encountered no changes." + || echo $(LOG_INFO) "Rescanned $(SOURCE.AD) but encountered no changes." $(QUIETLY) rm -rf $(TEMPDIR) @@ -207,14 +207,14 @@ PROCESS_AD_FILES = awk '{ \ print }' $(OUTDIR)/%.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE) # Some object files are given a prefix, to disambiguate # them from objects of the same name built for the VM. $(OUTDIR)/adlc-%.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE) diff --git a/hotspot/make/aix/makefiles/buildtree.make b/hotspot/make/aix/makefiles/buildtree.make index 10bacd125f8..aac5e3f2a8d 100644 --- a/hotspot/make/aix/makefiles/buildtree.make +++ b/hotspot/make/aix/makefiles/buildtree.make @@ -195,7 +195,7 @@ DATA_MODE/ppc64 = 64 DATA_MODE = $(DATA_MODE/$(BUILDARCH)) flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -282,7 +282,7 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst ) > $@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -290,7 +290,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst ) > $@ ../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm - @echo Creating directory list $@ + @echo $(LOG_INFO) Creating directory list $@ $(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \ find $(HS_ALT_SRC)/share/vm/* -prune \ -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ @@ -301,7 +301,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@ Makefile: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -311,7 +311,7 @@ Makefile: $(BUILDTREE_MAKE) ) > $@ vm.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -322,7 +322,7 @@ vm.make: $(BUILDTREE_MAKE) ) > $@ adlc.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -332,7 +332,7 @@ adlc.make: $(BUILDTREE_MAKE) ) > $@ jvmti.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -342,7 +342,7 @@ jvmti.make: $(BUILDTREE_MAKE) ) > $@ trace.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -352,7 +352,7 @@ trace.make: $(BUILDTREE_MAKE) ) > $@ sa.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ diff --git a/hotspot/make/aix/makefiles/defs.make b/hotspot/make/aix/makefiles/defs.make index 64746ab67d5..9bf5793e773 100644 --- a/hotspot/make/aix/makefiles/defs.make +++ b/hotspot/make/aix/makefiles/defs.make @@ -29,6 +29,12 @@ SLASH_JAVA ?= /java +define print_info + ifneq ($$(LOG_LEVEL), warn) + $$(shell echo >&2 "INFO: $1") + endif +endef + # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name #ARCH:=$(shell uname -m) PATH_SEP = : @@ -122,8 +128,7 @@ ifeq ($(JDK6_OR_EARLIER),0) # debug variants always get Full Debug Symbols (if available) ENABLE_FULL_DEBUG_SYMBOLS = 1 endif - _JUNK_ := $(shell \ - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") + $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) @@ -138,19 +143,16 @@ ifeq ($(JDK6_OR_EARLIER),0) endif OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) ifneq ($(ALT_OBJCOPY),) - _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") + $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)")) OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) endif ifeq ($(OBJCOPY),) - _JUNK_ := $(shell \ - echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.") + $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.")) ENABLE_FULL_DEBUG_SYMBOLS=0 - _JUNK_ := $(shell \ - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") + $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) else - _JUNK_ := $(shell \ - echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.") + $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files.")) # Library stripping policies for .debuginfo configs: # all_strip - strips everything from the library @@ -164,13 +166,11 @@ ifeq ($(JDK6_OR_EARLIER),0) # STRIP_POLICY ?= min_strip - _JUNK_ := $(shell \ - echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") + $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)")) ZIP_DEBUGINFO_FILES ?= 1 - _JUNK_ := $(shell \ - echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") + $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")) endif endif # ENABLE_FULL_DEBUG_SYMBOLS=1 endif # BUILD_FLAVOR @@ -227,5 +227,3 @@ ADD_SA_BINARIES/ppc64 = ADD_SA_BINARIES/zero = EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH)) - - diff --git a/hotspot/make/aix/makefiles/jsig.make b/hotspot/make/aix/makefiles/jsig.make index 08657fc6db2..1d8a62184bd 100644 --- a/hotspot/make/aix/makefiles/jsig.make +++ b/hotspot/make/aix/makefiles/jsig.make @@ -55,7 +55,7 @@ ifeq ($(DEBUG_BINARIES), true) endif $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) - @echo Making signal interposition lib... + @echo $(LOG_INFO) Making signal interposition lib... $(QUIETLY) $(CXX) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $< -ldl diff --git a/hotspot/make/aix/makefiles/jvmti.make b/hotspot/make/aix/makefiles/jvmti.make index 6baf4d31c66..105fd8e109d 100644 --- a/hotspot/make/aix/makefiles/jvmti.make +++ b/hotspot/make/aix/makefiles/jvmti.make @@ -76,34 +76,34 @@ $(JvmtiEnvFillClass): $(JvmtiEnvFillSource) $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource) $(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp $(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace $(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass) - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp $(QUIETLY) $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp $(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp $(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h jvmtidocs: $(JvmtiOutDir)/jvmti.html $(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html # ######################################################################### @@ -115,4 +115,3 @@ cleanall : rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles) # ######################################################################### - diff --git a/hotspot/make/aix/makefiles/rules.make b/hotspot/make/aix/makefiles/rules.make index c6f32c21806..894c169e39d 100644 --- a/hotspot/make/aix/makefiles/rules.make +++ b/hotspot/make/aix/makefiles/rules.make @@ -146,12 +146,12 @@ include $(GAMMADIR)/make/altsrc.make # The non-PIC object files are only generated for 32 bit platforms. ifdef LP64 %.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) else %.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \ $(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \ @@ -159,18 +159,18 @@ else endif %.o: %.s - @echo Assembling $< + @echo $(LOG_INFO) Assembling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) %.s: %.cpp - @echo Generating assembly for $< + @echo $(LOG_INFO) Generating assembly for $< $(QUIETLY) $(GENASM.CXX) -o $@ $< $(QUIETLY) $(DEMANGLE) $(COMPILE_DONE) # Intermediate files (for debugging macros) %.i: %.cpp - @echo Preprocessing $< to $@ + @echo $(LOG_INFO) Preprocessing $< to $@ $(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE) # Override gnumake built-in rules which do sccs get operations badly. diff --git a/hotspot/make/aix/makefiles/sa.make b/hotspot/make/aix/makefiles/sa.make index 02ce87c6c68..f709bc39480 100644 --- a/hotspot/make/aix/makefiles/sa.make +++ b/hotspot/make/aix/makefiles/sa.make @@ -66,7 +66,7 @@ all: fi $(GENERATED)/sa-jdi.jar: $(AGENT_FILES) - $(QUIETLY) echo "Making $@" + $(QUIETLY) echo $(LOG_INFO) "Making $@" $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ diff --git a/hotspot/make/aix/makefiles/saproc.make b/hotspot/make/aix/makefiles/saproc.make index cd8019c22e8..509d8f621e4 100644 --- a/hotspot/make/aix/makefiles/saproc.make +++ b/hotspot/make/aix/makefiles/saproc.make @@ -73,7 +73,7 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ fi - @echo Making SA debugger back-end... + @echo $(LOG_INFO) Making SA debugger back-end... $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \ -D_FILE_OFFSET_BITS=64 \ $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ diff --git a/hotspot/make/aix/makefiles/trace.make b/hotspot/make/aix/makefiles/trace.make index f173e0ad3ab..11a92c8ff46 100644 --- a/hotspot/make/aix/makefiles/trace.make +++ b/hotspot/make/aix/makefiles/trace.make @@ -81,7 +81,7 @@ endif all: $(TraceGeneratedFiles) GENERATE_CODE= \ - $(QUIETLY) echo Generating $@; \ + $(QUIETLY) echo $(LOG_INFO) Generating $@; \ $(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@; \ test -f $@ @@ -116,5 +116,3 @@ endif clean cleanall: rm $(TraceGeneratedFiles) - - diff --git a/hotspot/make/aix/makefiles/vm.make b/hotspot/make/aix/makefiles/vm.make index 4177591e2bb..4d879365f64 100644 --- a/hotspot/make/aix/makefiles/vm.make +++ b/hotspot/make/aix/makefiles/vm.make @@ -269,7 +269,7 @@ LFLAGS_VM += -bloadmap:libjvm.loadmap # rule for building precompiled header $(PRECOMPILED_HEADER): - $(QUIETLY) echo Generating precompiled header $@ + $(QUIETLY) echo $(LOG_INFO) Generating precompiled header $@ $(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR) $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE) @@ -300,7 +300,7 @@ endif # details in bug 6538311. $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT) $(QUIETLY) { \ - echo Linking vm...; \ + echo $(LOG_INFO) Linking vm...; \ $(LINK_LIB.CXX/PRE_HOOK) \ $(LINK_VM) $(LD_SCRIPT_FLAG) \ $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \ diff --git a/hotspot/make/bsd/makefiles/adlc.make b/hotspot/make/bsd/makefiles/adlc.make index e37e60ca97b..dd3346efc66 100644 --- a/hotspot/make/bsd/makefiles/adlc.make +++ b/hotspot/make/bsd/makefiles/adlc.make @@ -108,7 +108,7 @@ GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%) all: $(EXEC) $(EXEC) : $(OBJECTS) - @echo Making adlc + @echo $(LOG_INFO) Making adlc $(QUIETLY) $(HOST.LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS) # Random dependencies: @@ -191,7 +191,7 @@ refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER) $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \ - || echo "Rescanned $(SOURCE.AD) but encountered no changes." + || echo $(LOG_INFO) "Rescanned $(SOURCE.AD) but encountered no changes." $(QUIETLY) rm -rf $(TEMPDIR) @@ -209,14 +209,14 @@ PROCESS_AD_FILES = awk '{ \ print }' $(OUTDIR)/%.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE) # Some object files are given a prefix, to disambiguate # them from objects of the same name built for the VM. $(OUTDIR)/adlc-%.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE) diff --git a/hotspot/make/bsd/makefiles/buildtree.make b/hotspot/make/bsd/makefiles/buildtree.make index dd116a565ae..b1f9e02f3c3 100644 --- a/hotspot/make/bsd/makefiles/buildtree.make +++ b/hotspot/make/bsd/makefiles/buildtree.make @@ -201,7 +201,7 @@ DATA_MODE/amd64 = 64 DATA_MODE = $(DATA_MODE/$(BUILDARCH)) flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -286,7 +286,7 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst ) > $@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -294,7 +294,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst ) > $@ ../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm - @echo Creating directory list $@ + @echo $(LOG_INFO) Creating directory list $@ $(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \ find $(HS_ALT_SRC)/share/vm/* -prune \ -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ @@ -305,7 +305,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@ Makefile: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -315,7 +315,7 @@ Makefile: $(BUILDTREE_MAKE) ) > $@ vm.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -326,7 +326,7 @@ vm.make: $(BUILDTREE_MAKE) ) > $@ adlc.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -336,7 +336,7 @@ adlc.make: $(BUILDTREE_MAKE) ) > $@ jvmti.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -346,7 +346,7 @@ jvmti.make: $(BUILDTREE_MAKE) ) > $@ trace.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -356,7 +356,7 @@ trace.make: $(BUILDTREE_MAKE) ) > $@ sa.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -366,7 +366,7 @@ sa.make: $(BUILDTREE_MAKE) ) > $@ dtrace.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ diff --git a/hotspot/make/bsd/makefiles/defs.make b/hotspot/make/bsd/makefiles/defs.make index 7cd21cc1753..6e427e8bd5a 100644 --- a/hotspot/make/bsd/makefiles/defs.make +++ b/hotspot/make/bsd/makefiles/defs.make @@ -28,6 +28,12 @@ SLASH_JAVA ?= /java +define print_info + ifneq ($$(LOG_LEVEL), warn) + $$(shell echo >&2 "INFO: $1") + endif +endef + # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name ARCH:=$(shell uname -m) PATH_SEP = : @@ -187,8 +193,7 @@ ifeq ($(JDK6_OR_EARLIER),0) # debug variants always get Full Debug Symbols (if available) ENABLE_FULL_DEBUG_SYMBOLS = 1 endif - _JUNK_ := $(shell \ - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") + $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) @@ -209,22 +214,18 @@ ifeq ($(JDK6_OR_EARLIER),0) endif OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) ifneq ($(ALT_OBJCOPY),) - _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") + $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)")) OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) endif ifeq ($(OBJCOPY),) - _JUNK_ := $(shell \ - echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo" \ - "files. You may need to set ALT_OBJCOPY.") + $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo" \ + "files. You may need to set ALT_OBJCOPY.")) ENABLE_FULL_DEBUG_SYMBOLS=0 - _JUNK_ := $(shell \ - echo >&2 "INFO:" \ - "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") + $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) else - _JUNK_ := $(shell \ - echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo" \ - "files.") + $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo" \ + "files.")) # Library stripping policies for .debuginfo configs: # all_strip - strips everything from the library @@ -241,14 +242,12 @@ ifeq ($(JDK6_OR_EARLIER),0) # STRIP_POLICY ?= min_strip - _JUNK_ := $(shell \ - echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") + $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)")) ZIP_DEBUGINFO_FILES ?= 1 endif - _JUNK_ := $(shell \ - echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") + $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")) endif endif # ENABLE_FULL_DEBUG_SYMBOLS=1 endif # BUILD_FLAVOR diff --git a/hotspot/make/bsd/makefiles/dtrace.make b/hotspot/make/bsd/makefiles/dtrace.make index c13672aed16..dbb41163e39 100644 --- a/hotspot/make/bsd/makefiles/dtrace.make +++ b/hotspot/make/bsd/makefiles/dtrace.make @@ -92,7 +92,7 @@ XLIBJVM_DTRACE_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO) XLIBJVM_DTRACE_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ) $(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) - @echo Making $@ + @echo $(LOG_INFO) Making $@ $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ $(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c #-lc @@ -128,7 +128,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) endif $(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) - @echo Making $@ + @echo $(LOG_INFO) Making $@ $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ $(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor @@ -202,7 +202,7 @@ $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp $(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp $(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) - @echo Making $@ + @echo $(LOG_INFO) Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -Wall # -lc ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) @@ -231,7 +231,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) endif $(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) - @echo Making $@ + @echo $(LOG_INFO) Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) @@ -296,13 +296,13 @@ CFLAGS += -DDTRACE_ENABLED #$(DTRACE_INCL) dtraceCheck: dtrace_stuff: dtrace_gen_headers - $(QUIETLY) echo "dtrace headers generated" + $(QUIETLY) echo $(LOG_INFO) "dtrace headers generated" else # manually disabled dtraceCheck: - $(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable" + $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled via environment variable" dtrace_stuff: @@ -311,7 +311,7 @@ endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") else # No dtrace program found dtraceCheck: - $(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system" + $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled: not supported by system" dtrace_stuff: @@ -323,6 +323,6 @@ endif # ifeq ($(OS_VENDOR), Darwin) else # CORE build dtraceCheck: - $(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds" + $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled for CORE builds" endif # ifneq ("${TYPE}", "CORE") diff --git a/hotspot/make/bsd/makefiles/jsig.make b/hotspot/make/bsd/makefiles/jsig.make index df03f9c75ea..8c0c1b8a5e5 100644 --- a/hotspot/make/bsd/makefiles/jsig.make +++ b/hotspot/make/bsd/makefiles/jsig.make @@ -60,7 +60,7 @@ ifeq ($(DEBUG_BINARIES), true) endif $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) - @echo Making signal interposition lib... + @echo $(LOG_INFO) Making signal interposition lib... $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $< ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) diff --git a/hotspot/make/bsd/makefiles/jvmti.make b/hotspot/make/bsd/makefiles/jvmti.make index ee3cc1e229c..cb22c2b0f4d 100644 --- a/hotspot/make/bsd/makefiles/jvmti.make +++ b/hotspot/make/bsd/makefiles/jvmti.make @@ -75,34 +75,34 @@ $(JvmtiEnvFillClass): $(JvmtiEnvFillSource) $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource) $(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp $(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace $(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass) - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp $(QUIETLY) $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp $(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp $(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h jvmtidocs: $(JvmtiOutDir)/jvmti.html $(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html # ######################################################################### @@ -114,4 +114,3 @@ cleanall : rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles) # ######################################################################### - diff --git a/hotspot/make/bsd/makefiles/rules.make b/hotspot/make/bsd/makefiles/rules.make index c6f32c21806..894c169e39d 100644 --- a/hotspot/make/bsd/makefiles/rules.make +++ b/hotspot/make/bsd/makefiles/rules.make @@ -146,12 +146,12 @@ include $(GAMMADIR)/make/altsrc.make # The non-PIC object files are only generated for 32 bit platforms. ifdef LP64 %.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) else %.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \ $(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \ @@ -159,18 +159,18 @@ else endif %.o: %.s - @echo Assembling $< + @echo $(LOG_INFO) Assembling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) %.s: %.cpp - @echo Generating assembly for $< + @echo $(LOG_INFO) Generating assembly for $< $(QUIETLY) $(GENASM.CXX) -o $@ $< $(QUIETLY) $(DEMANGLE) $(COMPILE_DONE) # Intermediate files (for debugging macros) %.i: %.cpp - @echo Preprocessing $< to $@ + @echo $(LOG_INFO) Preprocessing $< to $@ $(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE) # Override gnumake built-in rules which do sccs get operations badly. diff --git a/hotspot/make/bsd/makefiles/sa.make b/hotspot/make/bsd/makefiles/sa.make index 417a748f2ea..11503127bbb 100644 --- a/hotspot/make/bsd/makefiles/sa.make +++ b/hotspot/make/bsd/makefiles/sa.make @@ -25,6 +25,12 @@ # This makefile (sa.make) is included from the sa.make in the # build directories. +define print_info + ifneq ($$(LOG_LEVEL), warn) + $$(shell echo >&2 "INFO: $1") + endif +endef + # This makefile is used to build Serviceability Agent java code # and generate JNI header file for native methods. @@ -53,7 +59,7 @@ ifeq ($(ALT_SA_CLASSPATH),) endif endif else - _JUNK_ := $(shell echo >&2 "INFO: ALT_SA_CLASSPATH=$(ALT_SA_CLASSPATH)") + $(eval $(call print_info, "ALT_SA_CLASSPATH=$(ALT_SA_CLASSPATH)")) SA_CLASSPATH=$(shell test -f $(ALT_SA_CLASSPATH) && echo $(ALT_SA_CLASSPATH)) endif @@ -80,7 +86,7 @@ all: fi $(GENERATED)/sa-jdi.jar: $(AGENT_FILES) - $(QUIETLY) echo "Making $@" + $(QUIETLY) echo $(LOG_INFO) "Making $@" $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ diff --git a/hotspot/make/bsd/makefiles/saproc.make b/hotspot/make/bsd/makefiles/saproc.make index 80993afbece..8c7545a5ee7 100644 --- a/hotspot/make/bsd/makefiles/saproc.make +++ b/hotspot/make/bsd/makefiles/saproc.make @@ -122,7 +122,7 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ fi - @echo Making SA debugger back-end... + @echo $(LOG_INFO) Making SA debugger back-end... $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \ $(SA_SYSROOT_FLAGS) \ $(SYMFLAG) $(SAARCH) $(SHARED_FLAG) $(PICFLAG) \ diff --git a/hotspot/make/bsd/makefiles/trace.make b/hotspot/make/bsd/makefiles/trace.make index ceb40c87846..ed2eb159aee 100644 --- a/hotspot/make/bsd/makefiles/trace.make +++ b/hotspot/make/bsd/makefiles/trace.make @@ -82,7 +82,7 @@ endif all: $(TraceGeneratedFiles) GENERATE_CODE= \ - $(QUIETLY) echo Generating $@; \ + $(QUIETLY) echo $(LOG_INFO) Generating $@; \ $(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@; \ test -f $@ @@ -118,4 +118,3 @@ endif clean cleanall: rm $(TraceGeneratedFiles) - diff --git a/hotspot/make/bsd/makefiles/vm.make b/hotspot/make/bsd/makefiles/vm.make index 8c5d281ffc0..fbe94b53ec5 100644 --- a/hotspot/make/bsd/makefiles/vm.make +++ b/hotspot/make/bsd/makefiles/vm.make @@ -291,7 +291,7 @@ endif # rule for building precompiled header $(PRECOMPILED_HEADER): - $(QUIETLY) echo Generating precompiled header $@ + $(QUIETLY) echo $(LOG_INFO) Generating precompiled header $@ $(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR) $(QUIETLY) rm -f $@ $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE) @@ -318,7 +318,7 @@ endif $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT) $(QUIETLY) { \ - echo Linking vm...; \ + echo $(LOG_INFO) Linking vm...; \ $(LINK_LIB.CXX/PRE_HOOK) \ $(LINK_VM) $(LD_SCRIPT_FLAG) \ $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \ diff --git a/hotspot/make/defs.make b/hotspot/make/defs.make index 70e050eb2e1..d9899089c11 100644 --- a/hotspot/make/defs.make +++ b/hotspot/make/defs.make @@ -29,6 +29,12 @@ ifneq ($(SPEC),) include $(SPEC) endif +ifeq ($(LOG_LEVEL),warn) + LOG_INFO := > /dev/null +else + LOG_INFO := +endif + # Directory paths and user name # Unless GAMMADIR is set on the command line, search upward from # the current directory for a parent directory containing "src/share/vm". diff --git a/hotspot/make/linux/makefiles/adlc.make b/hotspot/make/linux/makefiles/adlc.make index 8a866917b80..287923151d2 100644 --- a/hotspot/make/linux/makefiles/adlc.make +++ b/hotspot/make/linux/makefiles/adlc.make @@ -106,7 +106,7 @@ GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%) all: $(EXEC) $(EXEC) : $(OBJECTS) - @echo Making adlc + @echo $(LOG_INFO) Making adlc $(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.LINK_NOPROF.CXX)) -o $(EXEC) $(OBJECTS) # Random dependencies: @@ -191,7 +191,7 @@ refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER) $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \ - || echo "Rescanned $(SOURCE.AD) but encountered no changes." + || echo $(LOG_INFO) "Rescanned $(SOURCE.AD) but encountered no changes." $(QUIETLY) rm -rf $(TEMPDIR) @@ -209,14 +209,14 @@ PROCESS_AD_FILES = awk '{ \ print }' $(OUTDIR)/%.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.COMPILE.CXX)) -o $@ $< $(COMPILE_DONE) # Some object files are given a prefix, to disambiguate # them from objects of the same name built for the VM. $(OUTDIR)/adlc-%.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.COMPILE.CXX)) -o $@ $< $(COMPILE_DONE) diff --git a/hotspot/make/linux/makefiles/buildtree.make b/hotspot/make/linux/makefiles/buildtree.make index ca66bd0097e..c0e7a460eb6 100644 --- a/hotspot/make/linux/makefiles/buildtree.make +++ b/hotspot/make/linux/makefiles/buildtree.make @@ -198,7 +198,7 @@ DATA_MODE/ppc64 = 64 DATA_MODE = $(DATA_MODE/$(BUILDARCH)) flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -285,7 +285,7 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst ) > $@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -293,7 +293,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst ) > $@ ../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm - @echo Creating directory list $@ + @echo $(LOG_INFO) Creating directory list $@ $(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \ find $(HS_ALT_SRC)/share/vm/* -prune \ -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ @@ -304,7 +304,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@ Makefile: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -314,7 +314,7 @@ Makefile: $(BUILDTREE_MAKE) ) > $@ vm.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -325,7 +325,7 @@ vm.make: $(BUILDTREE_MAKE) ) > $@ adlc.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -335,7 +335,7 @@ adlc.make: $(BUILDTREE_MAKE) ) > $@ jvmti.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -345,7 +345,7 @@ jvmti.make: $(BUILDTREE_MAKE) ) > $@ trace.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -355,7 +355,7 @@ trace.make: $(BUILDTREE_MAKE) ) > $@ sa.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -365,7 +365,7 @@ sa.make: $(BUILDTREE_MAKE) ) > $@ dtrace.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ diff --git a/hotspot/make/linux/makefiles/defs.make b/hotspot/make/linux/makefiles/defs.make index 373ad7cf95a..626506a5541 100644 --- a/hotspot/make/linux/makefiles/defs.make +++ b/hotspot/make/linux/makefiles/defs.make @@ -28,6 +28,12 @@ SLASH_JAVA ?= /java +define print_info + ifneq ($$(LOG_LEVEL), warn) + $$(shell echo >&2 "INFO: $1") + endif +endef + # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name # ARCH can be set explicitly in spec.gmk @@ -185,8 +191,7 @@ ifeq ($(JDK6_OR_EARLIER),0) # debug variants always get Full Debug Symbols (if available) ENABLE_FULL_DEBUG_SYMBOLS = 1 endif - _JUNK_ := $(shell \ - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") + $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) @@ -201,19 +206,16 @@ ifeq ($(JDK6_OR_EARLIER),0) endif OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) ifneq ($(ALT_OBJCOPY),) - _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") + $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)")) OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) endif ifeq ($(OBJCOPY),) - _JUNK_ := $(shell \ - echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.") + $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.")) ENABLE_FULL_DEBUG_SYMBOLS=0 - _JUNK_ := $(shell \ - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") + $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) else - _JUNK_ := $(shell \ - echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.") + $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files.")) # Library stripping policies for .debuginfo configs: # all_strip - strips everything from the library @@ -227,13 +229,11 @@ ifeq ($(JDK6_OR_EARLIER),0) # STRIP_POLICY ?= min_strip - _JUNK_ := $(shell \ - echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") + $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)")) ZIP_DEBUGINFO_FILES ?= 1 - _JUNK_ := $(shell \ - echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") + $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")) endif endif # ENABLE_FULL_DEBUG_SYMBOLS=1 endif # BUILD_FLAVOR diff --git a/hotspot/make/linux/makefiles/dtrace.make b/hotspot/make/linux/makefiles/dtrace.make index 7585eae9429..4dbe4cbf21d 100644 --- a/hotspot/make/linux/makefiles/dtrace.make +++ b/hotspot/make/linux/makefiles/dtrace.make @@ -78,13 +78,13 @@ CFLAGS += -DDTRACE_ENABLED dtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(DtraceOutDir)/hs_private.h else dtrace_gen_headers: - $(QUIETLY) echo "**NOTICE** Dtrace support disabled: $(REASON)" + $(QUIETLY) $(LOG_INFO) echo "**NOTICE** Dtrace support disabled: $(REASON)" endif # Phony target used in vm.make build target to check whether enabled. ifeq ($(DTRACE_ENABLED),) dtraceCheck: - $(QUIETLY) echo "**NOTICE** Dtrace support disabled: $(REASON)" + $(QUIETLY) $(LOG_INFO) echo "**NOTICE** Dtrace support disabled: $(REASON)" else dtraceCheck: endif diff --git a/hotspot/make/linux/makefiles/jsig.make b/hotspot/make/linux/makefiles/jsig.make index 208a5e58cd8..58c84930824 100644 --- a/hotspot/make/linux/makefiles/jsig.make +++ b/hotspot/make/linux/makefiles/jsig.make @@ -52,7 +52,7 @@ ifeq ($(DEBUG_BINARIES), true) endif $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) - @echo Making signal interposition lib... + @echo $(LOG_INFO) Making signal interposition lib... $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) $(EXTRA_CFLAGS) -o $@ $< -ldl ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) diff --git a/hotspot/make/linux/makefiles/jvmti.make b/hotspot/make/linux/makefiles/jvmti.make index 43cdb9d8789..14220e9909f 100644 --- a/hotspot/make/linux/makefiles/jvmti.make +++ b/hotspot/make/linux/makefiles/jvmti.make @@ -75,34 +75,34 @@ $(JvmtiEnvFillClass): $(JvmtiEnvFillSource) $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource) $(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp $(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace $(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass) - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp $(QUIETLY) $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp $(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp $(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h jvmtidocs: $(JvmtiOutDir)/jvmti.html $(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html # ######################################################################### diff --git a/hotspot/make/linux/makefiles/rules.make b/hotspot/make/linux/makefiles/rules.make index c6f32c21806..894c169e39d 100644 --- a/hotspot/make/linux/makefiles/rules.make +++ b/hotspot/make/linux/makefiles/rules.make @@ -146,12 +146,12 @@ include $(GAMMADIR)/make/altsrc.make # The non-PIC object files are only generated for 32 bit platforms. ifdef LP64 %.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) else %.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \ $(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \ @@ -159,18 +159,18 @@ else endif %.o: %.s - @echo Assembling $< + @echo $(LOG_INFO) Assembling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) %.s: %.cpp - @echo Generating assembly for $< + @echo $(LOG_INFO) Generating assembly for $< $(QUIETLY) $(GENASM.CXX) -o $@ $< $(QUIETLY) $(DEMANGLE) $(COMPILE_DONE) # Intermediate files (for debugging macros) %.i: %.cpp - @echo Preprocessing $< to $@ + @echo $(LOG_INFO) Preprocessing $< to $@ $(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE) # Override gnumake built-in rules which do sccs get operations badly. diff --git a/hotspot/make/linux/makefiles/sa.make b/hotspot/make/linux/makefiles/sa.make index 0dab937874d..178c5555425 100644 --- a/hotspot/make/linux/makefiles/sa.make +++ b/hotspot/make/linux/makefiles/sa.make @@ -67,7 +67,7 @@ all: fi $(GENERATED)/sa-jdi.jar:: $(AGENT_FILES) - $(QUIETLY) echo "Making $@" + $(QUIETLY) echo $(LOG_INFO) "Making $@" $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ diff --git a/hotspot/make/linux/makefiles/saproc.make b/hotspot/make/linux/makefiles/saproc.make index caa16e3e738..6c31c7bb4a2 100644 --- a/hotspot/make/linux/makefiles/saproc.make +++ b/hotspot/make/linux/makefiles/saproc.make @@ -80,7 +80,7 @@ $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ fi - @echo Making SA debugger back-end... + @echo $(LOG_INFO) Making SA debugger back-end... $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \ -D_FILE_OFFSET_BITS=64 \ $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ diff --git a/hotspot/make/linux/makefiles/trace.make b/hotspot/make/linux/makefiles/trace.make index f173e0ad3ab..5cdec9adcb3 100644 --- a/hotspot/make/linux/makefiles/trace.make +++ b/hotspot/make/linux/makefiles/trace.make @@ -81,7 +81,7 @@ endif all: $(TraceGeneratedFiles) GENERATE_CODE= \ - $(QUIETLY) echo Generating $@; \ + $(QUIETLY) echo $(LOG_INFO) Generating $@; \ $(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@; \ test -f $@ diff --git a/hotspot/make/linux/makefiles/vm.make b/hotspot/make/linux/makefiles/vm.make index fd299ceba53..2c9e904657e 100644 --- a/hotspot/make/linux/makefiles/vm.make +++ b/hotspot/make/linux/makefiles/vm.make @@ -286,7 +286,7 @@ LINK_VM = $(LINK_LIB.CC) # rule for building precompiled header $(PRECOMPILED_HEADER): - $(QUIETLY) echo Generating precompiled header $@ + $(QUIETLY) echo $(LOG_INFO) Generating precompiled header $@ $(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR) $(QUIETLY) rm -f $@ $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE) @@ -318,7 +318,7 @@ endif # details in bug 6538311. $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT) $(QUIETLY) { \ - echo Linking vm...; \ + echo $(LOG_INFO) Linking vm...; \ $(LINK_LIB.CXX/PRE_HOOK) \ $(LINK_VM) $(LD_SCRIPT_FLAG) \ $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \ diff --git a/hotspot/make/solaris/makefiles/adlc.make b/hotspot/make/solaris/makefiles/adlc.make index 88d9d2bc476..0c1b2f37e05 100644 --- a/hotspot/make/solaris/makefiles/adlc.make +++ b/hotspot/make/solaris/makefiles/adlc.make @@ -127,7 +127,7 @@ GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%) all: $(EXEC) $(EXEC) : $(OBJECTS) - @echo Making adlc + @echo $(LOG_INFO) Making adlc $(QUIETLY) $(LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS) # Random dependencies: @@ -206,7 +206,7 @@ refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER) $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \ - || echo "Rescanned $(SOURCE.AD) but encountered no changes." + || echo $(LOG_INFO) "Rescanned $(SOURCE.AD) but encountered no changes." $(QUIETLY) rm -rf $(TEMPDIR) @@ -224,14 +224,14 @@ PROCESS_AD_FILES = awk '{ \ print }' $(OUTDIR)/%.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(COMPILE.CXX) -o $@ $< $(COMPILE_DONE) # Some object files are given a prefix, to disambiguate # them from objects of the same name built for the VM. $(OUTDIR)/adlc-%.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(COMPILE.CXX) -o $@ $< $(COMPILE_DONE) diff --git a/hotspot/make/solaris/makefiles/buildtree.make b/hotspot/make/solaris/makefiles/buildtree.make index 40b7519be91..dde88bce6de 100644 --- a/hotspot/make/solaris/makefiles/buildtree.make +++ b/hotspot/make/solaris/makefiles/buildtree.make @@ -190,7 +190,7 @@ DATA_MODE/amd64 = 64 DATA_MODE = $(DATA_MODE/$(BUILDARCH)) flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -272,7 +272,7 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst ) > $@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -280,7 +280,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst ) > $@ ../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm - @echo Creating directory list $@ + @echo $(LOG_INFO) Creating directory list $@ $(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \ find $(HS_ALT_SRC)/share/vm/* -prune \ -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ @@ -291,7 +291,7 @@ flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@ Makefile: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -301,7 +301,7 @@ Makefile: $(BUILDTREE_MAKE) ) > $@ vm.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -312,7 +312,7 @@ vm.make: $(BUILDTREE_MAKE) ) > $@ adlc.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -322,7 +322,7 @@ adlc.make: $(BUILDTREE_MAKE) ) > $@ jvmti.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -332,7 +332,7 @@ jvmti.make: $(BUILDTREE_MAKE) ) > $@ trace.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -342,7 +342,7 @@ trace.make: $(BUILDTREE_MAKE) ) > $@ sa.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ @@ -352,7 +352,7 @@ sa.make: $(BUILDTREE_MAKE) ) > $@ dtrace.make: $(BUILDTREE_MAKE) - @echo Creating $@ ... + @echo $(LOG_INFO) Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ echo; \ diff --git a/hotspot/make/solaris/makefiles/defs.make b/hotspot/make/solaris/makefiles/defs.make index 74ca7f70e2a..522d3288f96 100644 --- a/hotspot/make/solaris/makefiles/defs.make +++ b/hotspot/make/solaris/makefiles/defs.make @@ -26,6 +26,12 @@ # Include the top level defs.make under make directory instead of this one. # This file is included into make/defs.make. +define print_info + ifneq ($$(LOG_LEVEL), warn) + $$(shell echo >&2 "INFO: $1") + endif +endef + # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name SLASH_JAVA ?= /java ARCH:=$(shell uname -p) @@ -120,8 +126,7 @@ ifeq ($(JDK6_OR_EARLIER),0) # debug variants always get Full Debug Symbols (if available) ENABLE_FULL_DEBUG_SYMBOLS = 1 endif - _JUNK_ := $(shell \ - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") + $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) @@ -129,19 +134,16 @@ ifeq ($(JDK6_OR_EARLIER),0) DEF_OBJCOPY=/usr/sfw/bin/gobjcopy OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) ifneq ($(ALT_OBJCOPY),) - _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)") + $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)")) OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) endif ifeq ($(OBJCOPY),) - _JUNK_ := $(shell \ - echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.") + $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files.")) ENABLE_FULL_DEBUG_SYMBOLS=0 - _JUNK_ := $(shell \ - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") + $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) else - _JUNK_ := $(shell \ - echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.") + $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files.")) # Library stripping policies for .debuginfo configs: # all_strip - strips everything from the library @@ -155,13 +157,11 @@ ifeq ($(JDK6_OR_EARLIER),0) # STRIP_POLICY ?= min_strip - _JUNK_ := $(shell \ - echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") + $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)")) ZIP_DEBUGINFO_FILES ?= 1 - _JUNK_ := $(shell \ - echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") + $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")) endif endif # ENABLE_FULL_DEBUG_SYMBOLS=1 endif # BUILD_FLAVOR diff --git a/hotspot/make/solaris/makefiles/dtrace.make b/hotspot/make/solaris/makefiles/dtrace.make index ad2275ce5fb..b76ff3cdb15 100644 --- a/hotspot/make/solaris/makefiles/dtrace.make +++ b/hotspot/make/solaris/makefiles/dtrace.make @@ -32,7 +32,7 @@ ifneq ("${TYPE}", "CORE") ifdef USE_GCC dtraceCheck: - $(QUIETLY) echo "**NOTICE** Dtrace support disabled for gcc builds" + $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled for gcc builds" else @@ -102,7 +102,7 @@ XLIBJVM_DTRACE_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO) XLIBJVM_DTRACE_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ) $(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) - @echo Making $@ + @echo $(LOG_INFO) Making $@ $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc @@ -137,7 +137,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) endif $(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) - @echo Making $@ + @echo $(LOG_INFO) Making $@ $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor @@ -207,7 +207,7 @@ $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp $(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp $(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) - @echo Making $@ + @echo $(LOG_INFO) Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) @@ -232,7 +232,7 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) endif $(LIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) - @echo Making $@ + @echo $(LOG_INFO) Making $@ $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) @@ -286,7 +286,7 @@ DTraced_Files = ciEnv.o \ # Dtrace is available, so we build $(DTRACE.o) $(DTRACE.o): $(DTRACE).d $(DTraced_Files) - @echo Compiling $(DTRACE).d + @echo $(LOG_INFO) Compiling $(DTRACE).d $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \ $(DTraced_Files) ||\ @@ -352,7 +352,7 @@ dtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(Dt # The jhelper.d and hotspot probes are separated into two different SUNW_dof sections. # Now the jhelper.d is built without the -Xlazyload flag. $(DTRACE_JHELPER.o) : $(DTRACE_JHELPER).d $(JVMOFFS).h $(JVMOFFS)Index.h - @echo Compiling $(DTRACE_JHELPER).d + @echo $(LOG_INFO) Compiling $(DTRACE_JHELPER).d $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -o $@ -s $(DTRACE_JHELPER).d .PHONY: dtraceCheck @@ -391,14 +391,14 @@ dtraceCheck: else # manually disabled dtraceCheck: - $(QUIETLY) echo "**NOTICE** Dtrace support disabled via environment variable" + $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled via environment variable" endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") else # No dtrace program found dtraceCheck: - $(QUIETLY) echo "**NOTICE** Dtrace support disabled: not supported by system" + $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled: not supported by system" endif # ifneq ("${dtraceFound}", "") @@ -407,6 +407,6 @@ endif # ifdef USE_GCC else # CORE build dtraceCheck: - $(QUIETLY) echo "**NOTICE** Dtrace support disabled for CORE builds" + $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled for CORE builds" endif # ifneq ("${TYPE}", "CORE") diff --git a/hotspot/make/solaris/makefiles/jsig.make b/hotspot/make/solaris/makefiles/jsig.make index 5afc405e7e0..bb8d9b2e823 100644 --- a/hotspot/make/solaris/makefiles/jsig.make +++ b/hotspot/make/solaris/makefiles/jsig.make @@ -48,7 +48,7 @@ LFLAGS_JSIG += -mt -xnolib endif $(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) - @echo Making signal interposition lib... + @echo $(LOG_INFO) Making signal interposition lib... $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ $(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) diff --git a/hotspot/make/solaris/makefiles/jvmti.make b/hotspot/make/solaris/makefiles/jvmti.make index be07e0546bc..93b9f6ed885 100644 --- a/hotspot/make/solaris/makefiles/jvmti.make +++ b/hotspot/make/solaris/makefiles/jvmti.make @@ -74,34 +74,34 @@ $(JvmtiEnvFillClass): $(JvmtiEnvFillSource) $(QUIETLY) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource) $(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp $(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace $(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass) - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp $(QUIETLY) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp $(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp $(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h jvmtidocs: $(JvmtiOutDir)/jvmti.html $(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl - @echo Generating $@ + @echo $(LOG_INFO) Generating $@ $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html # ######################################################################### @@ -113,4 +113,3 @@ cleanall : rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles) # ######################################################################### - diff --git a/hotspot/make/solaris/makefiles/rules.make b/hotspot/make/solaris/makefiles/rules.make index 159143a6391..d7435502107 100644 --- a/hotspot/make/solaris/makefiles/rules.make +++ b/hotspot/make/solaris/makefiles/rules.make @@ -138,12 +138,12 @@ include $(GAMMADIR)/make/altsrc.make # Sun compiler for 64 bit Solaris does not support building non-PIC object files. ifdef LP64 %.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) else %.o: %.cpp - @echo Compiling $< + @echo $(LOG_INFO) Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \ $(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \ @@ -151,18 +151,18 @@ else endif %.o: %.s - @echo Assembling $< + @echo $(LOG_INFO) Assembling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(AS.S) -o $@ $< $(COMPILE_DONE) %.s: %.cpp - @echo Generating assembly for $< + @echo $(LOG_INFO) Generating assembly for $< $(QUIETLY) $(GENASM.CXX) -o $@ $< $(QUIETLY) $(DEMANGLE) $(COMPILE_DONE) # Intermediate files (for debugging macros) %.i: %.cpp - @echo Preprocessing $< to $@ + @echo $(LOG_INFO) Preprocessing $< to $@ $(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE) # Override gnumake built-in rules which do sccs get operations badly. diff --git a/hotspot/make/solaris/makefiles/sa.make b/hotspot/make/solaris/makefiles/sa.make index ab5385dd914..7fb6afa49aa 100644 --- a/hotspot/make/solaris/makefiles/sa.make +++ b/hotspot/make/solaris/makefiles/sa.make @@ -58,7 +58,7 @@ all: fi $(GENERATED)/sa-jdi.jar: $(AGENT_FILES) - $(QUIETLY) echo "Making $@"; + $(QUIETLY) echo $(LOG_INFO) "Making $@"; $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ diff --git a/hotspot/make/solaris/makefiles/saproc.make b/hotspot/make/solaris/makefiles/saproc.make index bfa38c5d854..e6adbf69997 100644 --- a/hotspot/make/solaris/makefiles/saproc.make +++ b/hotspot/make/solaris/makefiles/saproc.make @@ -95,7 +95,7 @@ $(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SA echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ fi - @echo Making SA debugger back-end... + @echo $(LOG_INFO) Making SA debugger back-end... $(QUIETLY) $(CXX) \ $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ -I$(SASRCDIR) \ diff --git a/hotspot/make/solaris/makefiles/trace.make b/hotspot/make/solaris/makefiles/trace.make index 16c82cd780b..ef4beda149c 100644 --- a/hotspot/make/solaris/makefiles/trace.make +++ b/hotspot/make/solaris/makefiles/trace.make @@ -77,7 +77,7 @@ endif all: $(TraceGeneratedFiles) GENERATE_CODE= \ - $(QUIETLY) echo Generating $@; \ + $(QUIETLY) echo $(LOG_INFO) Generating $@; \ $(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@; \ test -f $@ @@ -112,5 +112,3 @@ endif clean cleanall: rm $(TraceGeneratedFiles) - - diff --git a/hotspot/make/solaris/makefiles/vm.make b/hotspot/make/solaris/makefiles/vm.make index 0448026ab9e..af35ca4c33e 100644 --- a/hotspot/make/solaris/makefiles/vm.make +++ b/hotspot/make/solaris/makefiles/vm.make @@ -295,7 +295,7 @@ endif # making the library: $(LIBJVM): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(LIBJVM.o) $(LIBJVM_MAPFILE) ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) - @echo Linking vm... + @echo $(LOG_INFO) Linking vm... $(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK) $(QUIETLY) $(LINK_VM) $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM) $(QUIETLY) $(LINK_LIB.CXX/POST_HOOK) From b2620f89c3c3c979e7fed558294a21b5d4524378 Mon Sep 17 00:00:00 2001 From: Albert Noll Date: Tue, 16 Sep 2014 14:39:11 +0200 Subject: [PATCH 31/81] 8058452: ciInstanceKlass::non_static_fields() can be removed CiInstanceKlass::non_static_fields() and all associated data structures can be removed since they are unused. Reviewed-by: kvn, thartmann --- hotspot/src/share/vm/ci/ciField.hpp | 1 - hotspot/src/share/vm/ci/ciInstanceKlass.cpp | 33 +-------------------- hotspot/src/share/vm/ci/ciInstanceKlass.hpp | 4 --- 3 files changed, 1 insertion(+), 37 deletions(-) diff --git a/hotspot/src/share/vm/ci/ciField.hpp b/hotspot/src/share/vm/ci/ciField.hpp index cdd5cf40c55..9711960d92f 100644 --- a/hotspot/src/share/vm/ci/ciField.hpp +++ b/hotspot/src/share/vm/ci/ciField.hpp @@ -39,7 +39,6 @@ class ciField : public ResourceObj { CI_PACKAGE_ACCESS friend class ciEnv; friend class ciInstanceKlass; - friend class NonStaticFieldFiller; private: ciFlags _flags; diff --git a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp index f8b39ed79c9..7a8bad33c6a 100644 --- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp +++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp @@ -44,7 +44,7 @@ // // Loaded instance klass. ciInstanceKlass::ciInstanceKlass(KlassHandle h_k) : - ciKlass(h_k), _non_static_fields(NULL) + ciKlass(h_k) { assert(get_Klass()->oop_is_instance(), "wrong type"); assert(get_instanceKlass()->is_loaded(), "must be at least loaded"); @@ -407,37 +407,6 @@ ciField* ciInstanceKlass::get_field_by_name(ciSymbol* name, ciSymbol* signature, return field; } -// ------------------------------------------------------------------ -// ciInstanceKlass::non_static_fields. - -class NonStaticFieldFiller: public FieldClosure { - GrowableArray* _arr; - ciEnv* _curEnv; -public: - NonStaticFieldFiller(ciEnv* curEnv, GrowableArray* arr) : - _curEnv(curEnv), _arr(arr) - {} - void do_field(fieldDescriptor* fd) { - ciField* field = new (_curEnv->arena()) ciField(fd); - _arr->append(field); - } -}; - -GrowableArray* ciInstanceKlass::non_static_fields() { - if (_non_static_fields == NULL) { - VM_ENTRY_MARK; - ciEnv* curEnv = ciEnv::current(); - InstanceKlass* ik = get_instanceKlass(); - int max_n_fields = ik->java_fields_count(); - - Arena* arena = curEnv->arena(); - _non_static_fields = - new (arena) GrowableArray(arena, max_n_fields, 0, NULL); - NonStaticFieldFiller filler(curEnv, _non_static_fields); - ik->do_nonstatic_fields(&filler); - } - return _non_static_fields; -} static int sort_field_by_offset(ciField** a, ciField** b) { return (*a)->offset_in_bytes() - (*b)->offset_in_bytes(); diff --git a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp index 41c42935a6a..ce39664b711 100644 --- a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp +++ b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp @@ -71,8 +71,6 @@ private: // Itsef: more than one implementors. ciInstanceKlass* _implementor; - GrowableArray* _non_static_fields; - protected: ciInstanceKlass(KlassHandle h_k); ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain); @@ -181,8 +179,6 @@ public: ciField* get_field_by_offset(int field_offset, bool is_static); ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static); - GrowableArray* non_static_fields(); - // total number of nonstatic fields (including inherited): int nof_nonstatic_fields() { if (_nonstatic_fields == NULL) From 50b39c9bc65a45f45ff5d20ed98b9b4a5eefb139 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Tue, 16 Sep 2014 09:26:06 -0700 Subject: [PATCH 32/81] 8058248: LittleCMS: Missing checks for NULL returns from memory allocation Reviewed-by: bae, jchen, mschoene --- .../share/native/liblcms/cmscgats.c | 1 + .../share/native/liblcms/cmsio0.c | 34 +++---------------- .../share/native/liblcms/cmsopt.c | 16 ++++++++- .../share/native/liblcms/cmstypes.c | 3 ++ 4 files changed, 23 insertions(+), 31 deletions(-) diff --git a/jdk/src/java.desktop/share/native/liblcms/cmscgats.c b/jdk/src/java.desktop/share/native/liblcms/cmscgats.c index e3079d10983..423fa04398f 100644 --- a/jdk/src/java.desktop/share/native/liblcms/cmscgats.c +++ b/jdk/src/java.desktop/share/native/liblcms/cmscgats.c @@ -2334,6 +2334,7 @@ cmsHANDLE CMSEXPORT cmsIT8LoadFromMem(cmsContext ContextID, void *Ptr, cmsUInt3 it8 = (cmsIT8*) hIT8; it8 ->MemoryBlock = (char*) _cmsMalloc(ContextID, len + 1); + if (it8 ->MemoryBlock == NULL) return NULL; strncpy(it8 ->MemoryBlock, (const char*) Ptr, len); it8 ->MemoryBlock[len] = 0; diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsio0.c b/jdk/src/java.desktop/share/native/liblcms/cmsio0.c index d4dc1b0d876..303d21c392a 100644 --- a/jdk/src/java.desktop/share/native/liblcms/cmsio0.c +++ b/jdk/src/java.desktop/share/native/liblcms/cmsio0.c @@ -1167,34 +1167,6 @@ cmsHPROFILE CMSEXPORT cmsOpenProfileFromMem(const void* MemPtr, cmsUInt32Number return cmsOpenProfileFromMemTHR(NULL, MemPtr, dwSize); } -static -cmsBool SanityCheck(_cmsICCPROFILE* profile) -{ - cmsIOHANDLER* io; - - if (!profile) { - return FALSE; - } - - io = profile->IOhandler; - if (!io) { - return FALSE; - } - - if (!io->Seek || - !(io->Seek==NULLSeek || io->Seek==MemorySeek || io->Seek==FileSeek)) - { - return FALSE; - } - if (!io->Read || - !(io->Read==NULLRead || io->Read==MemoryRead || io->Read==FileRead)) - { - return FALSE; - } - - return TRUE; -} - // Dump tag contents. If the profile is being modified, untouched tags are copied from FileOrig static cmsBool SaveTags(_cmsICCPROFILE* Icc, _cmsICCPROFILE* FileOrig) @@ -1225,7 +1197,7 @@ cmsBool SaveTags(_cmsICCPROFILE* Icc, _cmsICCPROFILE* FileOrig) // Reach here if we are copying a tag from a disk-based ICC profile which has not been modified by user. // In this case a blind copy of the block data is performed - if (SanityCheck(FileOrig) && Icc -> TagOffsets[i]) { + if (FileOrig != NULL && FileOrig->IOhandler != NULL && Icc -> TagOffsets[i]) { cmsUInt32Number TagSize = FileOrig -> TagSizes[i]; cmsUInt32Number TagOffset = FileOrig -> TagOffsets[i]; @@ -1880,6 +1852,7 @@ cmsBool CMSEXPORT cmsWriteRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, cons { _cmsICCPROFILE* Icc = (_cmsICCPROFILE*) hProfile; int i; + cmsBool ret = TRUE; if (!_cmsLockMutex(Icc->ContextID, Icc ->UsrMutex)) return 0; @@ -1895,10 +1868,11 @@ cmsBool CMSEXPORT cmsWriteRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, cons // Keep a copy of the block Icc ->TagPtrs[i] = _cmsDupMem(Icc ->ContextID, data, Size); + if (!Icc ->TagPtrs[i]) ret = FALSE; Icc ->TagSizes[i] = Size; _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex); - return TRUE; + return ret; } // Using this function you can collapse several tag entries to the same block in the profile diff --git a/jdk/src/java.desktop/share/native/liblcms/cmsopt.c b/jdk/src/java.desktop/share/native/liblcms/cmsopt.c index b9d69512cdd..4a09375351d 100644 --- a/jdk/src/java.desktop/share/native/liblcms/cmsopt.c +++ b/jdk/src/java.desktop/share/native/liblcms/cmsopt.c @@ -1181,14 +1181,28 @@ static void* CurvesDup(cmsContext ContextID, const void* ptr) { Curves16Data* Data = _cmsDupMem(ContextID, ptr, sizeof(Curves16Data)); - int i; + int i, j; if (Data == NULL) return NULL; Data ->Curves = _cmsDupMem(ContextID, Data ->Curves, Data ->nCurves * sizeof(cmsUInt16Number*)); + if (Data -> Curves == NULL) { + _cmsFree(ContextID, Data); + return NULL; + } for (i=0; i < Data -> nCurves; i++) { Data ->Curves[i] = _cmsDupMem(ContextID, Data ->Curves[i], Data -> nElements * sizeof(cmsUInt16Number)); + if (Data->Curves[i] == NULL) { + + for (j=0; j < i; j++) { + _cmsFree(ContextID, Data->Curves[j]); + } + _cmsFree(ContextID, Data->Curves); + _cmsFree(ContextID, Data); + return NULL; + } + } return (void*) Data; diff --git a/jdk/src/java.desktop/share/native/liblcms/cmstypes.c b/jdk/src/java.desktop/share/native/liblcms/cmstypes.c index 08cad5ea619..b2812a46cf0 100644 --- a/jdk/src/java.desktop/share/native/liblcms/cmstypes.c +++ b/jdk/src/java.desktop/share/native/liblcms/cmstypes.c @@ -3548,6 +3548,7 @@ void *Type_UcrBg_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cm if (n ->Desc == NULL) return NULL; ASCIIString = (char*) _cmsMalloc(self ->ContextID, SizeOfTag + 1); + if (ASCIIString == NULL) return NULL; if (io ->Read(io, ASCIIString, sizeof(char), SizeOfTag) != SizeOfTag) return NULL; ASCIIString[SizeOfTag] = 0; cmsMLUsetASCII(n ->Desc, cmsNoLanguage, cmsNoCountry, ASCIIString); @@ -3575,6 +3576,7 @@ cmsBool Type_UcrBg_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io // Now comes the text. The length is specified by the tag size TextSize = cmsMLUgetASCII(Value ->Desc, cmsNoLanguage, cmsNoCountry, NULL, 0); Text = (char*) _cmsMalloc(self ->ContextID, TextSize); + if (Text == NULL) return FALSE; if (cmsMLUgetASCII(Value ->Desc, cmsNoLanguage, cmsNoCountry, Text, TextSize) != TextSize) return FALSE; if (!io ->Write(io, TextSize, Text)) return FALSE; @@ -3672,6 +3674,7 @@ cmsBool WriteCountAndSting(struct _cms_typehandler_struct* self, cmsIOHANDLER* TextSize = cmsMLUgetASCII(mlu, "PS", Section, NULL, 0); Text = (char*) _cmsMalloc(self ->ContextID, TextSize); + if (Text == NULL) return FALSE; if (!_cmsWriteUInt32Number(io, TextSize)) return FALSE; From 652c27e15d87e77c20927459efb6c02bd1713d77 Mon Sep 17 00:00:00 2001 From: Boris Molodenkov Date: Tue, 16 Sep 2014 21:29:30 +0400 Subject: [PATCH 33/81] 8057165: [TESTBUG] Need a test to cover JDK-8054883 Reviewed-by: kvn, iveresov, iignatyev --- hotspot/test/compiler/osr/TestRangeCheck.java | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 hotspot/test/compiler/osr/TestRangeCheck.java diff --git a/hotspot/test/compiler/osr/TestRangeCheck.java b/hotspot/test/compiler/osr/TestRangeCheck.java new file mode 100644 index 00000000000..6079cb9ba4f --- /dev/null +++ b/hotspot/test/compiler/osr/TestRangeCheck.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014, 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 TestRangeCheck + * @bug 8054883 + * @summary Tests that range check is not skipped + */ + +public class TestRangeCheck { + public static void main(String args[]) { + try { + test(); + throw new AssertionError("Expected ArrayIndexOutOfBoundsException was not thrown"); + } catch (ArrayIndexOutOfBoundsException e) { + System.out.println("Expected ArrayIndexOutOfBoundsException was thrown"); + } + } + + private static void test() { + int arr[] = new int[1]; + int result = 1; + + // provoke OSR compilation + for (int i = 0; i < Integer.MAX_VALUE; i++) { + } + + if (result > 0 && arr[~result] > 0) { + arr[~result] = 0; + } + } +} From b61f8cc4ecde859580269971ca0bb06c9b9e608c Mon Sep 17 00:00:00 2001 From: Peter Brunet Date: Tue, 16 Sep 2014 14:58:27 -0500 Subject: [PATCH 34/81] 8058579: Copy-java.base.gmk no longer needs to differentiate win32 and win64 java.policy Replace java.policy-win32/64 with just java.policy Reviewed-by: mchung, erikj --- jdk/make/copy/Copy-java.base.gmk | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/jdk/make/copy/Copy-java.base.gmk b/jdk/make/copy/Copy-java.base.gmk index 97fc8193ef7..a7578f42b87 100644 --- a/jdk/make/copy/Copy-java.base.gmk +++ b/jdk/make/copy/Copy-java.base.gmk @@ -172,14 +172,8 @@ ifeq ($(OPENJDK_TARGET_OS), windows) POLICY_SRC_LIST += $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy endif ifndef OPENJDK - ifeq ($(OPENJDK_TARGET_OS), windows) - ifeq ($(OPENJDK_TARGET_CPU_BITS), 32) - POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy-win32 - else - POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy-win64 - endif - endif - ifeq ($(OPENJDK_TARGET_OS), solaris) + # if $(OPENJDK_TARGET_OS) is windows or solaris + ifneq ($(findstring $(OPENJDK_TARGET_OS), windows solaris), ) POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy endif endif From 865fe204056d20034c2bca60bd84c3ac3b6d2741 Mon Sep 17 00:00:00 2001 From: Martin Buchholz Date: Thu, 18 Sep 2014 16:25:50 -0700 Subject: [PATCH 35/81] 8058550: Clarify that TimerTasks are not reusable Reviewed-by: alanb, chegar --- jdk/src/java.base/share/classes/java/util/TimerTask.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/TimerTask.java b/jdk/src/java.base/share/classes/java/util/TimerTask.java index 5750486d16d..fe89656a9e4 100644 --- a/jdk/src/java.base/share/classes/java/util/TimerTask.java +++ b/jdk/src/java.base/share/classes/java/util/TimerTask.java @@ -26,10 +26,14 @@ package java.util; /** - * A task that can be scheduled for one-time or repeated execution by a Timer. + * A task that can be scheduled for one-time or repeated execution by a + * {@link Timer}. + * + *

A timer task is not reusable. Once a task has been scheduled + * for execution on a {@code Timer} or cancelled, subsequent attempts to + * schedule it for execution will throw {@code IllegalStateException}. * * @author Josh Bloch - * @see Timer * @since 1.3 */ From 1f56f49cd03beebe95dec18de6365d73b48ee9e0 Mon Sep 17 00:00:00 2001 From: Jason Uh Date: Tue, 16 Sep 2014 13:20:51 -0700 Subject: [PATCH 36/81] 8047223: Add algorithm parameter to EncodedKeySpec class and its two subclasses Reviewed-by: mullan --- .../java/security/spec/EncodedKeySpec.java | 49 +++++++++++- .../security/spec/PKCS8EncodedKeySpec.java | 30 ++++++- .../security/spec/X509EncodedKeySpec.java | 30 ++++++- .../javax/crypto/EncryptedPrivateKeyInfo.java | 17 ++-- .../spec/PKCS8EncodedKeySpec/Algorithm.java | 79 +++++++++++++++++++ 5 files changed, 187 insertions(+), 18 deletions(-) create mode 100644 jdk/test/java/security/spec/PKCS8EncodedKeySpec/Algorithm.java diff --git a/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java b/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java index cc3b81e6ab3..b43887b4cb0 100644 --- a/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java +++ b/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -43,19 +43,62 @@ package java.security.spec; public abstract class EncodedKeySpec implements KeySpec { private byte[] encodedKey; + private String algorithmName; /** - * Creates a new EncodedKeySpec with the given encoded key. + * Creates a new {@code EncodedKeySpec} with the given encoded key. * * @param encodedKey the encoded key. The contents of the * array are copied to protect against subsequent modification. - * @exception NullPointerException if {@code encodedKey} + * @throws NullPointerException if {@code encodedKey} * is null. */ public EncodedKeySpec(byte[] encodedKey) { this.encodedKey = encodedKey.clone(); } + /** + * Creates a new {@code EncodedKeySpec} with the given encoded key. + * This constructor is useful when subsequent callers of the + * {@code EncodedKeySpec} object might not know the algorithm + * of the key. + * + * @param encodedKey the encoded key. The contents of the + * array are copied to protect against subsequent modification. + * @param algorithm the algorithm name of the encoded key + * See the KeyFactory section in the + * Java Cryptography Architecture Standard Algorithm Name Documentation + * for information about standard algorithm names. + * @throws NullPointerException if {@code encodedKey} + * or {@code algorithm} is null. + * @throws IllegalArgumentException if {@code algorithm} is + * the empty string {@code ""} + * @since 1.9 + */ + protected EncodedKeySpec(byte[] encodedKey, String algorithm) { + if (algorithm == null) { + throw new NullPointerException("algorithm name may not be null"); + } + if (algorithm.isEmpty()) { + throw new IllegalArgumentException("algorithm name " + + "may not be empty"); + } + this.encodedKey = encodedKey.clone(); + this.algorithmName = algorithm; + + } + + /** + * Returns the name of the algorithm of the encoded key. + * + * @return the name of the algorithm, or null if not specified + * @since 1.9 + */ + public String getAlgorithm() { + return algorithmName; + } + /** * Returns the encoded key. * diff --git a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java index 060f266fcb1..90a94ed3436 100644 --- a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java +++ b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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,18 +62,42 @@ package java.security.spec; public class PKCS8EncodedKeySpec extends EncodedKeySpec { /** - * Creates a new PKCS8EncodedKeySpec with the given encoded key. + * Creates a new {@code PKCS8EncodedKeySpec} with the given encoded key. * * @param encodedKey the key, which is assumed to be * encoded according to the PKCS #8 standard. The contents of * the array are copied to protect against subsequent modification. - * @exception NullPointerException if {@code encodedKey} + * @throws NullPointerException if {@code encodedKey} * is null. */ public PKCS8EncodedKeySpec(byte[] encodedKey) { super(encodedKey); } + /** + * Creates a new {@code PKCS8EncodedKeySpec} with the given encoded key and + * algorithm. This constructor is useful when subsequent callers of + * the {@code PKCS8EncodedKeySpec} object might not know the + * algorithm of the private key. + * + * @param encodedKey the key, which is assumed to be + * encoded according to the PKCS #8 standard. The contents of + * the array are copied to protect against subsequent modification. + * @param algorithm the algorithm name of the encoded private key + * See the KeyFactory section in the + * Java Cryptography Architecture Standard Algorithm Name Documentation + * for information about standard algorithm names. + * @throws NullPointerException if {@code encodedKey} + * or {@algorithm} is null. + * @throws IllegalArgumentException if {@code algorithm} is + * the empty string {@code ""} + * @since 1.9 + */ + public PKCS8EncodedKeySpec(byte[] encodedKey, String algorithm) { + super(encodedKey, algorithm); + } + /** * Returns the key bytes, encoded according to the PKCS #8 standard. * diff --git a/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java b/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java index b9984de87e3..0ddb97f3ac4 100644 --- a/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java +++ b/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -52,18 +52,42 @@ package java.security.spec; public class X509EncodedKeySpec extends EncodedKeySpec { /** - * Creates a new X509EncodedKeySpec with the given encoded key. + * Creates a new {@code X509EncodedKeySpec} with the given encoded key. * * @param encodedKey the key, which is assumed to be * encoded according to the X.509 standard. The contents of the * array are copied to protect against subsequent modification. - * @exception NullPointerException if {@code encodedKey} + * @throws NullPointerException if {@code encodedKey} * is null. */ public X509EncodedKeySpec(byte[] encodedKey) { super(encodedKey); } + /** + * Creates a new {@code X509EncodedKeySpec} with the given encoded key. + * This constructor is useful when subsequent callers of the + * {@code X509EncodedKeySpec} object might not know the algorithm + * of the key. + * + * @param encodedKey the key, which is assumed to be + * encoded according to the X.509 standard. The contents of the + * array are copied to protect against subsequent modification. + * @param algorithm the algorithm name of the encoded public key + * See the KeyFactory section in the + * Java Cryptography Architecture Standard Algorithm Name Documentation + * for information about standard algorithm names. + * @throws NullPointerException if {@code encodedKey} + * or {@code algorithm} is null. + * @throws IllegalArgumentException if {@code algorithm} is + * the empty string {@code ""} + * @since 1.9 + */ + public X509EncodedKeySpec(byte[] encodedKey, String algorithm) { + super(encodedKey, algorithm); + } + /** * Returns the key bytes, encoded according to the X.509 standard. * diff --git a/jdk/src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java b/jdk/src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java index 5eeb481dd65..959ed982a55 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java +++ b/jdk/src/java.base/share/classes/javax/crypto/EncryptedPrivateKeyInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -60,6 +60,9 @@ public class EncryptedPrivateKeyInfo { // the "encryptionAlgorithm" field private AlgorithmId algid; + // the algorithm name of the encrypted private key + private String keyAlg; + // the "encryptedData" field private byte[] encryptedData; @@ -255,7 +258,7 @@ public class EncryptedPrivateKeyInfo { throw new InvalidKeySpecException( "Cannot retrieve the PKCS8EncodedKeySpec", ex); } - return new PKCS8EncodedKeySpec(encoded); + return new PKCS8EncodedKeySpec(encoded, keyAlg); } private PKCS8EncodedKeySpec getKeySpecImpl(Key decryptKey, @@ -280,7 +283,7 @@ public class EncryptedPrivateKeyInfo { throw new InvalidKeyException( "Cannot retrieve the PKCS8EncodedKeySpec", ex); } - return new PKCS8EncodedKeySpec(encoded); + return new PKCS8EncodedKeySpec(encoded, keyAlg); } /** @@ -405,7 +408,7 @@ public class EncryptedPrivateKeyInfo { } @SuppressWarnings("fallthrough") - private static void checkPKCS8Encoding(byte[] encodedKey) + private void checkPKCS8Encoding(byte[] encodedKey) throws IOException { DerInputStream in = new DerInputStream(encodedKey); DerValue[] values = in.getSequence(3); @@ -416,11 +419,7 @@ public class EncryptedPrivateKeyInfo { /* fall through */ case 3: checkTag(values[0], DerValue.tag_Integer, "version"); - DerInputStream algid = values[1].toDerInputStream(); - algid.getOID(); - if (algid.available() != 0) { - algid.getDerValue(); - } + keyAlg = AlgorithmId.parse(values[1]).getName(); checkTag(values[2], DerValue.tag_OctetString, "privateKey"); break; default: diff --git a/jdk/test/java/security/spec/PKCS8EncodedKeySpec/Algorithm.java b/jdk/test/java/security/spec/PKCS8EncodedKeySpec/Algorithm.java new file mode 100644 index 00000000000..e7499916b14 --- /dev/null +++ b/jdk/test/java/security/spec/PKCS8EncodedKeySpec/Algorithm.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2014, 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 8047223 + * @summary Add algorithm parameter to PKCS8EncodedKeySpec class + */ +import java.security.spec.PKCS8EncodedKeySpec; +import java.util.Base64; +import javax.crypto.EncryptedPrivateKeyInfo; +import javax.crypto.SecretKey; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.PBEKeySpec; + +public class Algorithm { + + private static String PKCS8PrivateKey = + "MIICoTAbBgkqhkiG9w0BBQMwDgQIqQMPwbNEhOgCAggABIICgCwRkeLXVGdO7S1h\n" + + "FAFUiwj1HCzqYFF2x9+FzjlXNwEWecZsor5eoKQlTtJ9dsPajQ/wFgY76lkXDQXE\n" + + "hdm8ndWFgCwqFBshmAp4TOvO9GlaAloDTnLMUg715D5FujiElcV7vqIY2V/7uB21\n" + + "YRanKUa21sZAFJGj6Hom1+5+k0Q7Xi4kHgt+ZIPNLwrNFPWVovbTJdScZuJaDp6m\n" + + "Q1DJUIQOzthV11VI+MU/v5SSKhj/uCaxizazEi5lgdmR7rRGgMz2YipOIjXIsKgu\n" + + "jKX5LYFAZ8nYq1hy8Q1JPR5VPuWMFqeyofO/teXJb8gI/4TC1ZoED8hXj07jpJqG\n" + + "2NVO1Dwqab31qSAjfjBkSYHKun63BvZPq2mT+frJF1YzvQhCDnWN1zbMKFNTZJfd\n" + + "cUaecH/fgNKwKpeKGgX7UlWxo26/lS8pBiJ5ihtbyFfMUBtlwEN5uOHqVFOeZp1Z\n" + + "DwCc0o1JA7yOcazA2TtNT9pc58tFZ8pEeyLj7ZchOgv06N0hZJsI6AiwII4ljd+K\n" + + "4WKvs/xiSZU3tcHaWzqlf+6/M5kC3Pihm9GhZbKBmvrZYiKyTlJEeVI3pFRNSqbE\n" + + "nZUJgkmgzNT/ZfM2WsUJm03Rq0eNCU/FDscIZnCWSA6Bf/DJDQWmhMhg2QmTGzQM\n" + + "hw/vy77q7jxV67s36HGxxR1oe8uoZ2zugBBxHWEdqyQyrVwZXJukdjrc2S7pvMln\n" + + "/VSleEf91MEcDhztyhPSqlX+H95vMnVmh5oY2gwY+P0oD5Eki6/9K+BHfuqgtS4S\n" + + "LIna1iSyLr17pRO1lmNtvuCMwmUjeI8w3JhLmxxx//bl/WCAekqj3nMplrJHZ7xd\n" + + "6k0Stxo="; + + private static String keyAlg = "RSA"; + private static String password = "password"; + + /* + * This test checks that a PKCS8EncodedKeySpec is properly constructed + * from an encrypted private key and that the key algorithm name can be + * retrieved as expected. + */ + public static void main(String[] argv) throws Exception { + EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo( + Base64.getMimeDecoder().decode(PKCS8PrivateKey)); + PBEKeySpec pks = new PBEKeySpec(password.toCharArray()); + SecretKeyFactory skf = SecretKeyFactory.getInstance(epki.getAlgName()); + SecretKey sk = skf.generateSecret(pks); + PKCS8EncodedKeySpec keySpec = epki.getKeySpec(sk); + + // Get the key algorithm and make sure it's what we expect + String alg = keySpec.getAlgorithm(); + if (!alg.equals(keyAlg)) { + throw new Exception("Expected: " + keyAlg + ", Got: " + alg); + } + + System.out.println("Test passed"); + } +} From 8be77eed11057040fca5031fe357df284e07d4a3 Mon Sep 17 00:00:00 2001 From: Pavel Rappo Date: Wed, 17 Sep 2014 16:14:12 +0400 Subject: [PATCH 37/81] 8055326: Fix typos in client-related packages Reviewed-by: prr, azvegint, alexsch --- .../classes/com/sun/awt/AWTUtilities.java | 2 +- .../classes/com/sun/awt/SecurityWarning.java | 2 +- .../share/classes/java/awt/AWTEvent.java | 2 +- .../classes/java/awt/AWTEventMulticaster.java | 4 +-- .../share/classes/java/awt/AWTKeyStroke.java | 4 +-- .../classes/java/awt/AlphaComposite.java | 2 +- .../share/classes/java/awt/BorderLayout.java | 4 +-- .../share/classes/java/awt/CardLayout.java | 2 +- .../share/classes/java/awt/Component.java | 36 +++++++++---------- .../java/awt/ComponentOrientation.java | 2 +- .../share/classes/java/awt/Container.java | 14 ++++---- .../ContainerOrderFocusTraversalPolicy.java | 6 ++-- .../java/awt/DefaultKeyboardFocusManager.java | 12 +++---- .../share/classes/java/awt/Desktop.java | 2 +- .../share/classes/java/awt/Dialog.java | 16 ++++----- .../classes/java/awt/EventDispatchThread.java | 2 +- .../share/classes/java/awt/EventFilter.java | 2 +- .../share/classes/java/awt/EventQueue.java | 2 +- .../share/classes/java/awt/FlowLayout.java | 4 +-- .../share/classes/java/awt/Font.java | 8 ++--- .../share/classes/java/awt/Frame.java | 2 +- .../classes/java/awt/GraphicsEnvironment.java | 9 ++--- .../classes/java/awt/GridBagConstraints.java | 2 +- .../share/classes/java/awt/GridBagLayout.java | 6 ++-- .../share/classes/java/awt/JobAttributes.java | 10 +++--- .../java/awt/KeyboardFocusManager.java | 8 ++--- .../share/classes/java/awt/List.java | 6 ++-- .../share/classes/java/awt/MenuShortcut.java | 2 +- .../share/classes/java/awt/Polygon.java | 6 ++-- .../java/awt/RadialGradientPaintContext.java | 4 +-- .../share/classes/java/awt/Rectangle.java | 22 ++++++------ .../classes/java/awt/RenderingHints.java | 4 +-- .../java/awt/ScrollPaneAdjustable.java | 2 +- .../share/classes/java/awt/Scrollbar.java | 4 +-- .../share/classes/java/awt/TextComponent.java | 2 +- .../share/classes/java/awt/Window.java | 6 ++-- .../classes/java/awt/color/ICC_Profile.java | 6 ++-- .../java/awt/datatransfer/MimeType.java | 2 +- .../datatransfer/MimeTypeParameterList.java | 4 +-- .../awt/datatransfer/SystemFlavorMap.java | 4 +-- .../classes/java/awt/dnd/DragSource.java | 4 +-- .../classes/java/awt/dnd/DropTarget.java | 2 +- .../java/awt/dnd/DropTargetListener.java | 2 +- .../java/awt/dnd/peer/DropTargetPeer.java | 2 +- .../classes/java/awt/event/InputEvent.java | 4 +-- .../classes/java/awt/event/KeyEvent.java | 4 +-- .../classes/java/awt/event/WindowEvent.java | 2 +- .../java/awt/event/WindowFocusListener.java | 2 +- .../classes/java/awt/font/GlyphVector.java | 2 +- .../java/awt/font/ImageGraphicAttribute.java | 2 +- .../classes/java/awt/font/NumericShaper.java | 8 ++--- .../java/awt/font/StyledParagraph.java | 4 +-- .../classes/java/awt/font/TextAttribute.java | 6 ++-- .../classes/java/awt/font/TextLayout.java | 8 ++--- .../classes/java/awt/im/spi/InputMethod.java | 2 +- .../classes/java/awt/image/BufferedImage.java | 2 +- .../classes/java/awt/image/ColorModel.java | 8 ++--- .../java/awt/image/FilteredImageSource.java | 2 +- .../share/classes/java/awt/image/Raster.java | 2 +- .../java/awt/image/WritableRenderedImage.java | 2 +- .../ContextualRenderedImageFactory.java | 2 +- .../awt/image/renderable/RenderableImage.java | 2 +- .../classes/java/awt/peer/ComponentPeer.java | 2 +- .../classes/java/awt/print/PageFormat.java | 2 +- .../share/classes/java/awt/print/Paper.java | 2 +- .../classes/java/awt/print/PrinterJob.java | 2 +- .../classes/javax/swing/text/html/CSS.java | 2 +- 67 files changed, 162 insertions(+), 161 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/com/sun/awt/AWTUtilities.java b/jdk/src/java.desktop/share/classes/com/sun/awt/AWTUtilities.java index e6ba7605046..1957fba5b8e 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/awt/AWTUtilities.java +++ b/jdk/src/java.desktop/share/classes/com/sun/awt/AWTUtilities.java @@ -55,7 +55,7 @@ import sun.awt.SunToolkit; * windows using a translucency-capable graphics configuration. * The {@code isTranslucencyCapable()} method must * be used to verify whether any given GraphicsConfiguration supports - * the trasnlcency effects. + * the translucency effects. *

* WARNING: This class is an implementation detail and only meant * for limited use outside of the core platform. This API may change diff --git a/jdk/src/java.desktop/share/classes/com/sun/awt/SecurityWarning.java b/jdk/src/java.desktop/share/classes/com/sun/awt/SecurityWarning.java index dd87ec18243..a33a8b3493f 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/awt/SecurityWarning.java +++ b/jdk/src/java.desktop/share/classes/com/sun/awt/SecurityWarning.java @@ -106,7 +106,7 @@ public final class SecurityWarning { * the window. The "absolute" in this case means that the position of the * security warning is not effected by resizing of the window. *

- * Note that the security warning managment code guarantees that: + * Note that the security warning management code guarantees that: *

    *
  • The security warning cannot be located farther than two pixels from * the rectangular bounds of the window (see {@link Window#getBounds}), and diff --git a/jdk/src/java.desktop/share/classes/java/awt/AWTEvent.java b/jdk/src/java.desktop/share/classes/java/awt/AWTEvent.java index 4a935f39848..abad30da22b 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/AWTEvent.java +++ b/jdk/src/java.desktop/share/classes/java/awt/AWTEvent.java @@ -38,7 +38,7 @@ import java.security.AccessController; /** * The root event class for all AWT events. - * This class and its subclasses supercede the original + * This class and its subclasses supersede the original * java.awt.Event class. * Subclasses of this root AWTEvent class defined outside of the * java.awt.event package should define event ID values greater than diff --git a/jdk/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java b/jdk/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java index 112dbb62ace..01e42428a73 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java +++ b/jdk/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java @@ -379,7 +379,7 @@ public class AWTEventMulticaster implements } /** - * Handles the windowDeiconfied event by invoking the + * Handles the windowDeiconified event by invoking the * windowDeiconified methods on listener-a and listener-b. * @param e the window event */ @@ -1053,7 +1053,7 @@ public class AWTEventMulticaster implements } /* - * Recusive method which populates EventListener array a with EventListeners + * Recursive method which populates EventListener array a with EventListeners * from l. l is usually an AWTEventMulticaster. Bug 4513402 revealed that * if l differed in type from the element type of a, an ArrayStoreException * would occur. Now l is only inserted into a if it's of the appropriate diff --git a/jdk/src/java.desktop/share/classes/java/awt/AWTKeyStroke.java b/jdk/src/java.desktop/share/classes/java/awt/AWTKeyStroke.java index 681113a07db..67eff6256fb 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/AWTKeyStroke.java +++ b/jdk/src/java.desktop/share/classes/java/awt/AWTKeyStroke.java @@ -83,7 +83,7 @@ public class AWTKeyStroke implements Serializable { /* * Reads keystroke class from AppContext and if null, puts there the * AWTKeyStroke class. - * Must be called under locked AWTKeyStro + * Must be called under locked AWTKeyStroke */ private static Class getAWTKeyStrokeClass() { @SuppressWarnings("unchecked") @@ -225,7 +225,7 @@ public class AWTKeyStroke implements Serializable { } } - /* returns noarg Constructor for class with accessible flag. No security + /* returns no-arg Constructor for class with accessible flag. No security threat as accessible flag is set only for this Constructor object, not for Class constructor. */ diff --git a/jdk/src/java.desktop/share/classes/java/awt/AlphaComposite.java b/jdk/src/java.desktop/share/classes/java/awt/AlphaComposite.java index 542d2884a01..1c5b7426986 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/AlphaComposite.java +++ b/jdk/src/java.desktop/share/classes/java/awt/AlphaComposite.java @@ -304,7 +304,7 @@ import sun.java2d.SunCompositeContext; *

    * Alternately, an implementation that uses floating point math * might produce more accurate results and end up returning to the - * original pixel value with little, if any, roundoff error. + * original pixel value with little, if any, round-off error. * Or, an implementation using integer math might decide that since * the equations boil down to a virtual NOP on the color values * if performed in a floating point space, it can transfer the diff --git a/jdk/src/java.desktop/share/classes/java/awt/BorderLayout.java b/jdk/src/java.desktop/share/classes/java/awt/BorderLayout.java index fd891bc371b..4720e895892 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/BorderLayout.java +++ b/jdk/src/java.desktop/share/classes/java/awt/BorderLayout.java @@ -74,7 +74,7 @@ import java.util.Hashtable; * For example, if you add components using both the NORTH * and PAGE_START constants in a container whose * orientation is LEFT_TO_RIGHT, only the - * PAGE_START will be layed out. + * PAGE_START will be laid out. *

    * NOTE: Currently (in the Java 2 platform v1.2), * BorderLayout does not support vertical @@ -211,7 +211,7 @@ public class BorderLayout implements LayoutManager2, * For example, if you add components using both the NORTH * and BEFORE_FIRST_LINE constants in a container whose * orientation is LEFT_TO_RIGHT, only the - * BEFORE_FIRST_LINE will be layed out. + * BEFORE_FIRST_LINE will be laid out. * This will be the same for lastLine, firstItem, lastItem. * @serial */ diff --git a/jdk/src/java.desktop/share/classes/java/awt/CardLayout.java b/jdk/src/java.desktop/share/classes/java/awt/CardLayout.java index 12e446272ea..9f14d622a15 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/CardLayout.java +++ b/jdk/src/java.desktop/share/classes/java/awt/CardLayout.java @@ -109,7 +109,7 @@ public class CardLayout implements LayoutManager2, /** * @serialField tab Hashtable - * deprectated, for forward compatibility only + * deprecated, for forward compatibility only * @serialField hgap int * @serialField vgap int * @serialField vector Vector diff --git a/jdk/src/java.desktop/share/classes/java/awt/Component.java b/jdk/src/java.desktop/share/classes/java/awt/Component.java index 76fb5b7d314..cfc6d24e157 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Component.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java @@ -167,7 +167,7 @@ import sun.util.logging.PlatformLogger; * } * *

    - * Note: For more information on the paint mechanisms utilitized + * Note: For more information on the paint mechanisms utilized * by AWT and Swing, including information on how to write the most * efficient painting code, see * Painting in AWT and Swing. @@ -355,7 +355,7 @@ public abstract class Component implements ImageObserver, MenuContainer, /** * True when the object is valid. An invalid object needs to - * be layed out. This flag is set to false when the object + * be laid out. This flag is set to false when the object * size is changed. * * @serial @@ -418,7 +418,7 @@ public abstract class Component implements ImageObserver, MenuContainer, private static final int FOCUS_TRAVERSABLE_SET = 2; /** - * Tracks whether this Component is relying on default focus travesability. + * Tracks whether this Component is relying on default focus traversability. * * @serial * @since 1.4 @@ -661,7 +661,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * can lead to a deadlock if client code also uses synchronization * by a component object. For every such situation revealed we should * consider possibility of replacing "this" with the package private - * objectLock object introduced below. So far there're 3 issues known: + * objectLock object introduced below. So far there are 3 issues known: * - CR 6708322 (the getName/setName methods); * - CR 6608764 (the PropertyChangeListener machinery); * - CR 7108598 (the Container.paint/KeyboardFocusManager.clearMostRecentFocusOwner methods). @@ -783,7 +783,7 @@ public abstract class Component implements ImageObserver, MenuContainer, } /* - * The shape set with the applyCompoundShape() method. It uncludes the result + * The shape set with the applyCompoundShape() method. It includes the result * of the HW/LW mixing related shape computation. It may also include * the user-specified shape of the component. * The 'null' value means the component has normal shape (or has no shape at all) @@ -808,7 +808,7 @@ public abstract class Component implements ImageObserver, MenuContainer, /** * Should only be used in subclass getBounds to check that part of bounds - * is actualy changing + * is actually changing */ int getBoundsOp() { assert Thread.holdsLock(getTreeLock()); @@ -1691,7 +1691,7 @@ public abstract class Component implements ImageObserver, MenuContainer, } /* - * Delete references from LightweithDispatcher of a heavyweight parent + * Delete references from LightweightDispatcher of a heavyweight parent */ void clearLightweightDispatcherOnRemove(Component removedComponent) { if (parent != null) { @@ -2337,10 +2337,10 @@ public abstract class Component implements ImageObserver, MenuContainer, boolean needNotify = true; mixOnReshaping(); if (peer != null) { - // LightwightPeer is an empty stub so can skip peer.reshape + // LightweightPeer is an empty stub so can skip peer.reshape if (!(peer instanceof LightweightPeer)) { reshapeNativePeer(x, y, width, height, getBoundsOp()); - // Check peer actualy changed coordinates + // Check peer actually changed coordinates resized = (oldWidth != this.width) || (oldHeight != this.height); moved = (oldX != this.x) || (oldY != this.y); // fix for 5025858: do not send ComponentEvents for toplevel @@ -5106,7 +5106,7 @@ public abstract class Component implements ImageObserver, MenuContainer, // ancestor, there is no need trying to find descendant // lightweights to dispatch event to. // If we dispatch the event to toplevel ancestor, - // this could encolse the loop: 6480024. + // this could enclose the loop: 6480024. anc.dispatchEventToSelf(newMWE); if (newMWE.isConsumed()) { e.consume(); @@ -6203,7 +6203,7 @@ public abstract class Component implements ImageObserver, MenuContainer, * Indicates whether this class overrides coalesceEvents. * It is assumed that all classes that are loaded from the bootstrap * do not. - * The boostrap class loader is assumed to be represented by null. + * The bootstrap class loader is assumed to be represented by null. * We do not check that the method really overrides * (it might be static, private or package private). */ @@ -6251,7 +6251,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Class superclass = clazz.getSuperclass(); if (superclass == null) { // Only occurs on implementations that - // do not use null to represent the bootsrap class loader. + // do not use null to represent the bootstrap class loader. return false; } if (superclass.getClassLoader() != null) { @@ -7761,7 +7761,7 @@ public abstract class Component implements ImageObserver, MenuContainer, while ( (window != null) && !(window instanceof Window)) { if (!window.isVisible()) { if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { - focusLog.finest("component is recurively invisible"); + focusLog.finest("component is recursively invisible"); } return false; } @@ -7865,7 +7865,7 @@ public abstract class Component implements ImageObserver, MenuContainer, // in activation. We do request focus on component which // has got temporary focus lost and then on component which is // most recent focus owner. But most recent focus owner can be - // changed by requestFocsuXXX() call only, so this transfer has + // changed by requestFocusXXX() call only, so this transfer has // been already approved. if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest("cause is activation"); @@ -8692,7 +8692,7 @@ public abstract class Component implements ImageObserver, MenuContainer, Package swingPackage = Package.getPackage("javax.swing"); // For Swing serialization to correctly work Swing needs to // be notified before Component does it's serialization. This - // hack accomodates this. + // hack accommodates this. // // Swing classes MUST be loaded by the bootstrap class loader, // otherwise we don't consider them. @@ -9040,7 +9040,7 @@ public abstract class Component implements ImageObserver, MenuContainer, } /** - * Checks that this component meets the prerequesites to be focus owner: + * Checks that this component meets the prerequisites to be focus owner: * - it is enabled, visible, focusable * - it's parents are all enabled and showing * - top-level window is focusable @@ -9649,7 +9649,7 @@ public abstract class Component implements ImageObserver, MenuContainer, /** * Returns the size of this object in the form of a * Dimension object. The height field of the - * Dimension object contains this objects's + * Dimension object contains this object's * height, and the width field of the Dimension * object contains this object's width. * @@ -9833,7 +9833,7 @@ public abstract class Component implements ImageObserver, MenuContainer, /** * Check whether we can trust the current bounds of the component. * The return value of false indicates that the container of the - * component is invalid, and therefore needs to be layed out, which would + * component is invalid, and therefore needs to be laid out, which would * probably mean changing the bounds of its children. * Null-layout of the container or absence of the container mean * the bounds of the component are final and can be trusted. diff --git a/jdk/src/java.desktop/share/classes/java/awt/ComponentOrientation.java b/jdk/src/java.desktop/share/classes/java/awt/ComponentOrientation.java index 226b004a273..8b67ea0cdde 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/ComponentOrientation.java +++ b/jdk/src/java.desktop/share/classes/java/awt/ComponentOrientation.java @@ -154,7 +154,7 @@ public final class ComponentOrientation implements java.io.Serializable public static ComponentOrientation getOrientation(Locale locale) { // A more flexible implementation would consult a ResourceBundle // to find the appropriate orientation. Until pluggable locales - // are introduced however, the flexiblity isn't really needed. + // are introduced however, the flexibility isn't really needed. // So we choose efficiency instead. String lang = locale.getLanguage(); if( "iw".equals(lang) || "ar".equals(lang) diff --git a/jdk/src/java.desktop/share/classes/java/awt/Container.java b/jdk/src/java.desktop/share/classes/java/awt/Container.java index dfed253a1a6..752763e8554 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Container.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Container.java @@ -547,8 +547,8 @@ public class Container extends Component { } /** - * Removes component comp from this container without making unneccessary changes - * and generating unneccessary events. This function intended to perform optimized + * Removes component comp from this container without making unnecessary changes + * and generating unnecessary events. This function intended to perform optimized * remove, for example, if newParent and current parent are the same it just changes * index without calling removeNotify. * Note: Should be called while holding treeLock @@ -1407,11 +1407,11 @@ public class Container extends Component { return; descendantsCount += num; - adjustDecendantsOnParent(num); + adjustDescendantsOnParent(num); } // Should only be called while holding tree lock - void adjustDecendantsOnParent(int num) { + void adjustDescendantsOnParent(int num) { if (parent != null) { parent.adjustDescendants(num); } @@ -2338,7 +2338,7 @@ public class Container extends Component { } /** - * Fetchs the top-most (deepest) lightweight component that is interested + * Fetches the top-most (deepest) lightweight component that is interested * in receiving mouse events. */ Component getMouseEventTarget(int x, int y, boolean includeSelf) { @@ -2887,7 +2887,7 @@ public class Container extends Component { modalAppContext = AppContext.getAppContext(); // keep the KeyEvents from being dispatched - // until the focus has been transfered + // until the focus has been transferred long time = Toolkit.getEventQueue().getMostRecentKeyEventTime(); Component predictedFocusOwner = (Component.isInstanceOf(this, "javax.swing.JInternalFrame")) ? ((javax.swing.JInternalFrame)(this)).getMostRecentFocusOwner() : null; if (predictedFocusOwner != null) { @@ -3673,7 +3673,7 @@ public class Container extends Component { *

      *
    • Writes default serializable fields to the stream.
    • *
    • Writes a list of serializable ContainerListener(s) as optional - * data. The non-serializable ContainerListner(s) are detected and + * data. The non-serializable ContainerListener(s) are detected and * no attempt is made to serialize them.
    • *
    • Write this Container's FocusTraversalPolicy if and only if it * is Serializable; otherwise, null is written.
    • diff --git a/jdk/src/java.desktop/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java b/jdk/src/java.desktop/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java index a450fec266e..0e499a8972d 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java +++ b/jdk/src/java.desktop/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java @@ -166,7 +166,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy retComp = cont.getFocusTraversalPolicy().getDefaultComponent(cont); if (retComp != null && log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("### Transfered focus down-cycle to " + retComp + + log.fine("### Transferred focus down-cycle to " + retComp + " in the focus cycle root " + cont); } } else { @@ -178,7 +178,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy cont.getFocusTraversalPolicy().getLastComponent(cont)); if (retComp != null && log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("### Transfered focus to " + retComp + " in the FTP provider " + cont); + log.fine("### Transferred focus to " + retComp + " in the FTP provider " + cont); } } } @@ -228,7 +228,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy return null; } - // Before all the ckecks below we first see if it's an FTP provider or a focus cycle root. + // Before all the checks below we first see if it's an FTP provider or a focus cycle root. // If it's the case just go down cycle (if it's set to "implicit"). Component comp = getComponentDownCycle(aComponent, FORWARD_TRAVERSAL); if (comp != null) { diff --git a/jdk/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java b/jdk/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java index 7e65cf5f32f..c37a360114d 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java +++ b/jdk/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java @@ -230,7 +230,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { * If the Component is in a different AppContext, then the event is * posted to the other AppContext's EventQueue, and this method blocks * until the event is handled or target AppContext is disposed. - * Returns true if successfuly dispatched event, false if failed + * Returns true if successfully dispatched event, false if failed * to dispatch. */ static boolean sendMessage(Component target, AWTEvent e) { @@ -349,7 +349,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { new WindowEvent(oldFocusedWindow, WindowEvent.WINDOW_LOST_FOCUS, newFocusedWindow)); - // Failed to dispatch, clear by ourselfves + // Failed to dispatch, clear by ourselves if (!isEventDispatched) { setGlobalFocusOwner(null); setGlobalFocusedWindow(null); @@ -466,7 +466,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { new WindowEvent(oldActiveWindow, WindowEvent.WINDOW_DEACTIVATED, newActiveWindow)); - // Failed to dispatch, clear by ourselfves + // Failed to dispatch, clear by ourselves if (!isEventDispatched) { setGlobalActiveWindow(null); } @@ -513,7 +513,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { FocusEvent.FOCUS_LOST, fe.isTemporary(), newFocusOwner, cause)); - // Failed to dispatch, clear by ourselfves + // Failed to dispatch, clear by ourselves if (!isEventDispatched) { setGlobalFocusOwner(null); if (!fe.isTemporary()) { @@ -749,7 +749,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { typeAheadAssertions(currentFocusedWindow, we); if (oppositeWindow == null) { - // Then we need to deactive the active Window as well. + // Then we need to deactivate the active Window as well. // No need to synthesize in other cases, because // WINDOW_ACTIVATED will handle it if necessary. sendMessage(activeWindow, @@ -954,7 +954,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { // the Component which just gained focus. Then remove // that marker, any markers which immediately follow // and are tied to the same component, and all markers - // that preceed it. This handles the case where + // that precede it. This handles the case where // multiple focus requests were made for the same // Component in a row and when we lost some of the // earlier requests. Since FOCUS_GAINED events will diff --git a/jdk/src/java.desktop/share/classes/java/awt/Desktop.java b/jdk/src/java.desktop/share/classes/java/awt/Desktop.java index a9b947dfa25..b4a2b6f09bf 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Desktop.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Desktop.java @@ -387,7 +387,7 @@ public class Desktop { return; } - // Calling thread doesn't have necessary priviledges. + // Calling thread doesn't have necessary privileges. // Delegate to DesktopBrowse so that it can work in // applet/webstart. URL url = null; diff --git a/jdk/src/java.desktop/share/classes/java/awt/Dialog.java b/jdk/src/java.desktop/share/classes/java/awt/Dialog.java index d09c04ccb0e..239e79f52b9 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Dialog.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Dialog.java @@ -260,7 +260,7 @@ public class Dialog extends Window { * The "toolkitModality" AWTPermission must be granted * for this exclusion. If an exclusion property is being changed to * TOOLKIT_EXCLUDE and this permission is not granted, a - * SecurityEcxeption will be thrown, and the exclusion + * SecurityException will be thrown, and the exclusion * property will be left unchanged. */ TOOLKIT_EXCLUDE @@ -554,7 +554,7 @@ public class Dialog extends Window { * * @param owner the owner of the dialog. The owner must be an instance of * {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any - * of their descendents or null + * of their descendants or null * * @exception java.lang.IllegalArgumentException if the owner * is not an instance of {@link java.awt.Dialog Dialog} or {@link @@ -578,7 +578,7 @@ public class Dialog extends Window { * * @param owner the owner of the dialog. The owner must be an instance of * {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any - * of their descendents or null + * of their descendants or null * @param title the title of the dialog or null if this dialog * has no title * @@ -604,7 +604,7 @@ public class Dialog extends Window { * * @param owner the owner of the dialog. The owner must be an instance of * {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any - * of their descendents or null + * of their descendants or null * @param modalityType specifies whether dialog blocks input to other * windows when shown. null value and unsupported modality * types are equivalent to MODELESS @@ -637,7 +637,7 @@ public class Dialog extends Window { * * @param owner the owner of the dialog. The owner must be an instance of * {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any - * of their descendents or null + * of their descendants or null * @param title the title of the dialog or null if this dialog * has no title * @param modalityType specifies whether dialog blocks input to other @@ -685,7 +685,7 @@ public class Dialog extends Window { * * @param owner the owner of the dialog. The owner must be an instance of * {@link java.awt.Dialog Dialog}, {@link java.awt.Frame Frame}, any - * of their descendents or null + * of their descendants or null * @param title the title of the dialog or null if this dialog * has no title * @param modalityType specifies whether dialog blocks input to other @@ -796,7 +796,7 @@ public class Dialog extends Window { * @param modal specifies whether dialog blocks input to other windows * when shown; calling to setModal(true) is equivalent to * setModalityType(Dialog.DEFAULT_MODALITY_TYPE), and - * calling to setModal(false) is equvivalent to + * calling to setModal(false) is equivalent to * setModalityType(Dialog.ModalityType.MODELESS) * * @see java.awt.Dialog#DEFAULT_MODALITY_TYPE @@ -926,7 +926,7 @@ public class Dialog extends Window { if (toFocus != null && time != null && isFocusable() && isEnabled() && !isModalBlocked()) { // keep the KeyEvents from being dispatched - // until the focus has been transfered + // until the focus has been transferred time.set(Toolkit.getEventQueue().getMostRecentKeyEventTime()); KeyboardFocusManager.getCurrentKeyboardFocusManager(). enqueueKeyEvents(time.get(), toFocus); diff --git a/jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java b/jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java index 962039c8374..5bf91e6ab8c 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java +++ b/jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java @@ -43,7 +43,7 @@ import sun.awt.dnd.SunDragSourceContextPeer; * pumpEvents(Conditional) in its run() method. Event handlers can choose to * block this event pump at any time, but should start a new pump (not * a new EventDispatchThread) by again calling pumpEvents(Conditional). This - * secondary event pump will exit automatically as soon as the Condtional + * secondary event pump will exit automatically as soon as the Conditional * evaluate()s to false and an additional Event is pumped and dispatched. * * @author Tom Ball diff --git a/jdk/src/java.desktop/share/classes/java/awt/EventFilter.java b/jdk/src/java.desktop/share/classes/java/awt/EventFilter.java index cad166b1694..0ee077ad466 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/EventFilter.java +++ b/jdk/src/java.desktop/share/classes/java/awt/EventFilter.java @@ -32,7 +32,7 @@ interface EventFilter { */ static enum FilterAction { /** - * ACCEPT means that this filter do not filter the event and allowes other + * ACCEPT means that this filter do not filter the event and allows other * active filters to proceed it. If all the active filters accept the event, it * is dispatched by the EventDispatchThread * @see EventDispatchThread#pumpEventsForFilter diff --git a/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java b/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java index a89311352ab..58e31332298 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java +++ b/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java @@ -418,7 +418,7 @@ public class EventQueue { /* * Should avoid of calling this method by any means * as it's working time is dependant on EQ length. - * In the wors case this method alone can slow down the entire application + * In the worst case this method alone can slow down the entire application * 10 times by stalling the Event processing. * Only here by backward compatibility reasons. */ diff --git a/jdk/src/java.desktop/share/classes/java/awt/FlowLayout.java b/jdk/src/java.desktop/share/classes/java/awt/FlowLayout.java index e63bb868422..14142cafc39 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/FlowLayout.java +++ b/jdk/src/java.desktop/share/classes/java/awt/FlowLayout.java @@ -161,7 +161,7 @@ public class FlowLayout implements LayoutManager, java.io.Serializable { int newAlign; // This is the one we actually use /** - * The flow layout manager allows a seperation of + * The flow layout manager allows a separation of * components with gaps. The horizontal gap will * specify the space between components and between * the components and the borders of the @@ -174,7 +174,7 @@ public class FlowLayout implements LayoutManager, java.io.Serializable { int hgap; /** - * The flow layout manager allows a seperation of + * The flow layout manager allows a separation of * components with gaps. The vertical gap will * specify the space between rows and between the * the rows and the borders of the Container. diff --git a/jdk/src/java.desktop/share/classes/java/awt/Font.java b/jdk/src/java.desktop/share/classes/java/awt/Font.java index d9faf3d3e80..3a251709bd5 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Font.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Font.java @@ -335,7 +335,7 @@ public class Font implements java.io.Serializable public static final int CENTER_BASELINE = 1; /** - * The baseline used in Devanigiri and similar scripts when laying + * The baseline used in Devanagari and similar scripts when laying * out text. */ public static final int HANGING_BASELINE = 2; @@ -852,7 +852,7 @@ public class Font implements java.io.Serializable *

      * To make the Font available to Font constructors the * returned Font must be registered in the - * GraphicsEnviroment by calling + * GraphicsEnvironment by calling * {@link GraphicsEnvironment#registerFont(Font) registerFont(Font)}. * @param fontFormat the type of the Font, which is * {@link #TRUETYPE_FONT TRUETYPE_FONT} if a TrueType resource is specified. @@ -1018,7 +1018,7 @@ public class Font implements java.io.Serializable *

      * To make the Font available to Font constructors the * returned Font must be registered in the - * GraphicsEnviroment by calling + * GraphicsEnvironment by calling * {@link GraphicsEnvironment#registerFont(Font) registerFont(Font)}. * @param fontFile a File object representing the * input data for the font. @@ -1685,7 +1685,7 @@ public class Font implements java.io.Serializable /** Serialization support. A readObject - * method is neccessary because the constructor creates + * method is necessary because the constructor creates * the font's peer, and we can't serialize the peer. * Similarly the computed font "family" may be different * at readObject time than at diff --git a/jdk/src/java.desktop/share/classes/java/awt/Frame.java b/jdk/src/java.desktop/share/classes/java/awt/Frame.java index c6ce4814078..139c5770b76 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Frame.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Frame.java @@ -348,7 +348,7 @@ public class Frame extends Window implements MenuContainer { /* * The Windows owned by the Frame. - * Note: in 1.2 this has been superceded by Window.ownedWindowList + * Note: in 1.2 this has been superseded by Window.ownedWindowList * * @serial * @see java.awt.Window#ownedWindowList diff --git a/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java b/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java index 2d6436cc00d..77e053a27f2 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java +++ b/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java @@ -97,12 +97,13 @@ public abstract class GraphicsEnvironment { // long t0 = System.currentTimeMillis(); Class geCls; try { - // First we try if the bootclassloader finds the requested - // class. This way we can avoid to run in a privileged block. + // First we try if the bootstrap class loader finds the + // requested class. This way we can avoid to run in a privileged + // block. geCls = Class.forName(nm); } catch (ClassNotFoundException ex) { - // If the bootclassloader fails, we try again with the - // application classloader. + // If the bootstrap class loader fails, we try again with the + // application class loader. ClassLoader cl = ClassLoader.getSystemClassLoader(); geCls = Class.forName(nm, true, cl); } diff --git a/jdk/src/java.desktop/share/classes/java/awt/GridBagConstraints.java b/jdk/src/java.desktop/share/classes/java/awt/GridBagConstraints.java index 7b7dd2cd09e..e676e4c74ad 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/GridBagConstraints.java +++ b/jdk/src/java.desktop/share/classes/java/awt/GridBagConstraints.java @@ -556,7 +556,7 @@ public class GridBagConstraints implements Cloneable, java.io.Serializable { transient int ascent; transient int descent; transient Component.BaselineResizeBehavior baselineResizeBehavior; - // The folllowing two fields are used if the baseline type is + // The following two fields are used if the baseline type is // CENTER_OFFSET. // centerPadding is either 0 or 1 and indicates if // the height needs to be padded by one when calculating where the diff --git a/jdk/src/java.desktop/share/classes/java/awt/GridBagLayout.java b/jdk/src/java.desktop/share/classes/java/awt/GridBagLayout.java index 981c993751a..1624700353f 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/GridBagLayout.java +++ b/jdk/src/java.desktop/share/classes/java/awt/GridBagLayout.java @@ -1096,7 +1096,7 @@ java.io.Serializable { } /* Adjust the grid width and height - * fix for 5005945: unneccessary loops removed + * fix for 5005945: unnecessary loops removed */ px = curX + curWidth; if (layoutWidth < px) { @@ -1358,7 +1358,7 @@ java.io.Serializable { /* * Pass #3 * - * Distribute the minimun widths and weights: + * Distribute the minimum widths and weights: */ nextSize = Integer.MAX_VALUE; @@ -1578,7 +1578,7 @@ java.io.Serializable { // Component has a baseline resize behavior of // CENTER_OFFSET, calculate centerPadding and // centerOffset (see the description of - // CENTER_OFFSET in the enum for detais on this + // CENTER_OFFSET in the enum for details on this // algorithm). int nextBaseline = c.getBaseline(w, h + 1); constraints.centerOffset = baseline - h / 2; diff --git a/jdk/src/java.desktop/share/classes/java/awt/JobAttributes.java b/jdk/src/java.desktop/share/classes/java/awt/JobAttributes.java index 51580df1b09..bbb94e3bb5c 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/JobAttributes.java +++ b/jdk/src/java.desktop/share/classes/java/awt/JobAttributes.java @@ -298,8 +298,8 @@ public final class JobAttributes implements Cloneable { * @param defaultSelection DefaultSelectionType.ALL, * DefaultSelectionType.RANGE, or * DefaultSelectionType.SELECTION - * @param destination DesintationType.FILE or - * DesintationType.PRINTER + * @param destination DestinationType.FILE or + * DestinationType.PRINTER * @param dialog DialogType.COMMON, * DialogType.NATIVE, or * DialogType.NONE @@ -462,7 +462,7 @@ public final class JobAttributes implements Cloneable { * these attributes. This attribute is updated to the value chosen by the * user. * - * @return DesintationType.FILE or DesintationType.PRINTER + * @return DestinationType.FILE or DestinationType.PRINTER */ public DestinationType getDestination() { return destination; @@ -471,9 +471,9 @@ public final class JobAttributes implements Cloneable { /** * Specifies whether output will be to a printer or a file for jobs using * these attributes. Not specifying this attribute is equivalent to - * specifying DesintationType.PRINTER. + * specifying DestinationType.PRINTER. * - * @param destination DesintationType.FILE or DesintationType.PRINTER. + * @param destination DestinationType.FILE or DestinationType.PRINTER. * @throws IllegalArgumentException if destination is null. */ public void setDestination(DestinationType destination) { diff --git a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java index 57a8f733ce7..531d7ba4744 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java @@ -2244,7 +2244,7 @@ public abstract class KeyboardFocusManager } public String toString() { boolean first = true; - String str = "HeavyweightFocusRequest[heavweight=" + heavyweight + + String str = "HeavyweightFocusRequest[heavyweight=" + heavyweight + ",lightweightRequests="; if (lightweightRequests == null) { str += null; @@ -2666,7 +2666,7 @@ public abstract class KeyboardFocusManager * We allow to trigger restoreFocus() in the dispatching process * only if we have the last request to dispatch. If the last request * fails, focus will be restored to either the component of the last - * previously succedded request, or to to the focus owner that was + * previously succeeded request, or to to the focus owner that was * before this clearing process. */ if (!iter.hasNext()) { @@ -2765,7 +2765,7 @@ public abstract class KeyboardFocusManager if (source == hwFocusRequest.getFirstLightweightRequest().component) { source = hwFocusRequest.heavyweight; - nativeSource = source; // source is heavuweight itself + nativeSource = source; // source is heavyweight itself } } if (hwFocusRequest != null && @@ -2783,7 +2783,7 @@ public abstract class KeyboardFocusManager if (currentFocusOwner != null) { /* * Since we receive FOCUS_GAINED when current focus - * owner is not null, correcponding FOCUS_LOST is supposed + * owner is not null, corresponding FOCUS_LOST is supposed * to be lost. And so, we keep new focus owner * to determine synthetic FOCUS_LOST event which will be * generated by KeyboardFocusManager for this FOCUS_GAINED. diff --git a/jdk/src/java.desktop/share/classes/java/awt/List.java b/jdk/src/java.desktop/share/classes/java/awt/List.java index ede6f643157..bf9287b3372 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/List.java +++ b/jdk/src/java.desktop/share/classes/java/awt/List.java @@ -1652,7 +1652,7 @@ public class List extends Component implements ItemSelectable, Accessible { // - // AccessibleComponent delegatation to parent List + // AccessibleComponent delegation to parent List // /** @@ -1859,7 +1859,7 @@ public class List extends Component implements ItemSelectable, Accessible { * screen's coordinate space. * * @return An instance of Point representing the top-left corner of - * the objects's bounds in the coordinate space of the screen; null + * the object's bounds in the coordinate space of the screen; null * if this object or its parent are not on the screen * @see #getBounds * @see #getLocationOnScreen @@ -1907,7 +1907,7 @@ public class List extends Component implements ItemSelectable, Accessible { /** * Returns the size of this object in the form of a Dimension * object. The height field of the Dimension object contains this - * objects's height, and the width field of the Dimension object + * object's height, and the width field of the Dimension object * contains this object's width. * * @return A Dimension object that indicates the size of this diff --git a/jdk/src/java.desktop/share/classes/java/awt/MenuShortcut.java b/jdk/src/java.desktop/share/classes/java/awt/MenuShortcut.java index f7ffdcb3ec9..cba251bbf4b 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/MenuShortcut.java +++ b/jdk/src/java.desktop/share/classes/java/awt/MenuShortcut.java @@ -76,7 +76,7 @@ public class MenuShortcut implements java.io.Serializable int key; /** - * Indicates whether the shft key was pressed. + * Indicates whether the shift key was pressed. * If true, the shift key was pressed. * If false, the shift key was not pressed * diff --git a/jdk/src/java.desktop/share/classes/java/awt/Polygon.java b/jdk/src/java.desktop/share/classes/java/awt/Polygon.java index 0d89e6045be..7a30a958f45 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Polygon.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Polygon.java @@ -145,8 +145,8 @@ public class Polygon implements Shape, java.io.Serializable { * @since 1.0 */ public Polygon(int xpoints[], int ypoints[], int npoints) { - // Fix 4489009: should throw IndexOutofBoundsException instead - // of OutofMemoryException if npoints is huge and > {x,y}points.length + // Fix 4489009: should throw IndexOutOfBoundsException instead + // of OutOfMemoryError if npoints is huge and > {x,y}points.length if (npoints > xpoints.length || npoints > ypoints.length) { throw new IndexOutOfBoundsException("npoints > xpoints.length || "+ "npoints > ypoints.length"); @@ -559,7 +559,7 @@ public class Polygon implements Shape, java.io.Serializable { * coordinates as they are returned in the iteration, or * null if untransformed coordinates are desired * @param flatness the maximum amount that the control points - * for a given curve can vary from colinear before a subdivided + * for a given curve can vary from collinear before a subdivided * curve is replaced by a straight line connecting the * endpoints. Since polygons are already flat the * flatness parameter is ignored. diff --git a/jdk/src/java.desktop/share/classes/java/awt/RadialGradientPaintContext.java b/jdk/src/java.desktop/share/classes/java/awt/RadialGradientPaintContext.java index 55237460e41..cae1571fbc0 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/RadialGradientPaintContext.java +++ b/jdk/src/java.desktop/share/classes/java/awt/RadialGradientPaintContext.java @@ -33,7 +33,7 @@ import java.awt.image.ColorModel; /** * Provides the actual implementation for the RadialGradientPaint. - * This is where the pixel processing is done. A RadialGradienPaint + * This is where the pixel processing is done. A RadialGradientPaint * only supports circular gradients, but it should be possible to scale * the circle to look approximately elliptical, by means of a * gradient transform passed into the RadialGradientPaint constructor. @@ -133,7 +133,7 @@ final class RadialGradientPaintContext extends MultipleGradientPaintContext { this.isSimpleFocus = (focusX == centerX) && (focusY == centerY); this.isNonCyclic = (cycleMethod == CycleMethod.NO_CYCLE); - // for use in the quadractic equation + // for use in the quadratic equation radiusSq = radius * radius; float dX = focusX - centerX; diff --git a/jdk/src/java.desktop/share/classes/java/awt/Rectangle.java b/jdk/src/java.desktop/share/classes/java/awt/Rectangle.java index 727fe8e7ba8..04bfc026499 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Rectangle.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Rectangle.java @@ -49,10 +49,10 @@ import java.beans.Transient; * will include the location of the {@code Rectangle} on that axis in the * result as if the {@link #add(Point)} method were being called. *

      - * + * * A {@code Rectangle} whose width or height is negative has neither * location nor dimension along those axes with negative dimensions. - * Such a {@code Rectangle} is treated as non-existant along those axes. + * Such a {@code Rectangle} is treated as non-existent along those axes. * Such a {@code Rectangle} is also empty with respect to containment * calculations and methods which test if it contains or intersects a * point or rectangle will always return false. @@ -106,7 +106,7 @@ import java.beans.Transient; * moved to store it into its pair of 32-bit fields then the dimensions * will be adjusted relative to the "best representation" of the location. * If the true result had a negative dimension and was therefore - * non-existant along one or both axes, the stored dimensions will be + * non-existent along one or both axes, the stored dimensions will be * negative numbers in those axes. * If the true result had a location that could be represented within * the range of 32-bit integers, but zero dimension along one or both @@ -381,7 +381,7 @@ public class Rectangle extends Rectangle2D // We cannot even reach the left side of the specified // rectangle even with both x & width set to MAX_VALUE. // The intersection with the "maximal integer rectangle" - // is non-existant so we should use a width < 0. + // is non-existent so we should use a width < 0. // REMIND: Should we try to determine a more "meaningful" // adjusted value for neww than just "-1"? newx = Integer.MAX_VALUE; @@ -845,7 +845,7 @@ public class Rectangle extends Rectangle2D * represents the union of the two rectangles. *

      * If either {@code Rectangle} has any dimension less than zero - * the rules for non-existant rectangles + * the rules for non-existent rectangles * apply. * If only one has a dimension less than zero, then the result * will be a copy of the other {@code Rectangle}. @@ -867,8 +867,8 @@ public class Rectangle extends Rectangle2D if ((tx2 | ty2) < 0) { // This rectangle has negative dimensions... // If r has non-negative dimensions then it is the answer. - // If r is non-existant (has a negative dimension), then both - // are non-existant and we can return any non-existant rectangle + // If r is non-existent (has a negative dimension), then both + // are non-existent and we can return any non-existent rectangle // as an answer. Thus, returning r meets that criterion. // Either way, r is our answer. return new Rectangle(r); @@ -905,7 +905,7 @@ public class Rectangle extends Rectangle2D * to the bounds of this {@code Rectangle}. *

      * If this {@code Rectangle} has any dimension less than zero, - * the rules for non-existant + * the rules for non-existent * rectangles apply. * In that case, the new bounds of this {@code Rectangle} will * have a location equal to the specified coordinates and @@ -956,7 +956,7 @@ public class Rectangle extends Rectangle2D * {@code Rectangle}. *

      * If this {@code Rectangle} has any dimension less than zero, - * the rules for non-existant + * the rules for non-existent * rectangles apply. * In that case, the new bounds of this {@code Rectangle} will * have a location equal to the coordinates of the specified @@ -1075,7 +1075,7 @@ public class Rectangle extends Rectangle2D y1 += v; if (x1 < x0) { - // Non-existant in X direction + // Non-existent in X direction // Final width must remain negative so subtract x0 before // it is clipped so that we avoid the risk that the clipping // of x0 will reverse the ordering of x0 and x1. @@ -1098,7 +1098,7 @@ public class Rectangle extends Rectangle2D } if (y1 < y0) { - // Non-existant in Y direction + // Non-existent in Y direction y1 -= y0; if (y1 < Integer.MIN_VALUE) y1 = Integer.MIN_VALUE; if (y0 < Integer.MIN_VALUE) y0 = Integer.MIN_VALUE; diff --git a/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java b/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java index 2cc161a121b..6a1fa915b05 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java +++ b/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java @@ -670,7 +670,7 @@ public class RenderingHints * When images are rendered upright with no scaling onto a * destination, the choice of which image pixels map to which * device pixels is obvious and the samples at the integer - * coordinate locations in the image are transfered to the + * coordinate locations in the image are transferred to the * pixels at the corresponding integer locations on the device * pixel grid one for one. * When images are rendered in a scaled, rotated, or otherwise @@ -1167,7 +1167,7 @@ public class RenderingHints /** * Returns a Collection view of the values - * contained in this RenderinHints. + * contained in this RenderingHints. * The Collection is backed by the * RenderingHints, so changes to * the RenderingHints are reflected in diff --git a/jdk/src/java.desktop/share/classes/java/awt/ScrollPaneAdjustable.java b/jdk/src/java.desktop/share/classes/java/awt/ScrollPaneAdjustable.java index 7ee26f5e100..6d3a6d01bf9 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/ScrollPaneAdjustable.java +++ b/jdk/src/java.desktop/share/classes/java/awt/ScrollPaneAdjustable.java @@ -333,7 +333,7 @@ public class ScrollPaneAdjustable implements Adjustable, Serializable { * If the value supplied is less than the current minimum or * greater than the current maximum, then one of those values is * substituted, as appropriate. Also, creates and dispatches - * the AdjustementEvent with specified type and value. + * the AdjustmentEvent with specified type and value. * * @param v the new value of the scrollbar * @param type the type of the scrolling operation occurred diff --git a/jdk/src/java.desktop/share/classes/java/awt/Scrollbar.java b/jdk/src/java.desktop/share/classes/java/awt/Scrollbar.java index 28c84efb923..3c9f32662c1 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Scrollbar.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Scrollbar.java @@ -716,7 +716,7 @@ public class Scrollbar extends Component implements Adjustable, Accessible { * scroll bar, generally through a mouse or keyboard gesture * that the scroll bar receives as an adjustment event. * The unit increment must be greater than zero. - * Attepts to set the unit increment to a value lower than 1 + * Attempts to set the unit increment to a value lower than 1 * will result in a value of 1 being set. *

      * In some operating systems, this property @@ -794,7 +794,7 @@ public class Scrollbar extends Component implements Adjustable, Accessible { * scroll bar, generally through a mouse or keyboard gesture * that the scroll bar receives as an adjustment event. * The block increment must be greater than zero. - * Attepts to set the block increment to a value lower than 1 + * Attempts to set the block increment to a value lower than 1 * will result in a value of 1 being set. * * @param v the amount by which to increment or decrement diff --git a/jdk/src/java.desktop/share/classes/java/awt/TextComponent.java b/jdk/src/java.desktop/share/classes/java/awt/TextComponent.java index 639438a2a1d..ed28e1b0470 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/TextComponent.java +++ b/jdk/src/java.desktop/share/classes/java/awt/TextComponent.java @@ -952,7 +952,7 @@ public class TextComponent extends Component implements Accessible { } /** - * Returns the number of characters (valid indicies) + * Returns the number of characters (valid indices) * * @return the number of characters >= 0 */ diff --git a/jdk/src/java.desktop/share/classes/java/awt/Window.java b/jdk/src/java.desktop/share/classes/java/awt/Window.java index 629f1df75a4..4417314634c 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Window.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Window.java @@ -684,7 +684,7 @@ public class Window extends Container implements Accessible { * appropriate dimensions from the beginning. If the list contains * several images of the same size, the first will be used. *

      - * Ownerless windows with no icon specified use platfrom-default icon. + * Ownerless windows with no icon specified use platform-default icon. * The icon of an owned window may be inherited from the owner * unless explicitly overridden. * Setting the icon to {@code null} or empty list restores @@ -1239,9 +1239,9 @@ public class Window extends Container implements Accessible { } // Should only be called while holding tree lock - void adjustDecendantsOnParent(int num) { + void adjustDescendantsOnParent(int num) { // do nothing since parent == owner and we shouldn't - // ajust counter on owner + // adjust counter on owner } /** diff --git a/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java b/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java index e916dace8a3..7e8626f8d0d 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java +++ b/jdk/src/java.desktop/share/classes/java/awt/color/ICC_Profile.java @@ -700,7 +700,7 @@ public class ICC_Profile implements Serializable { /** - * ICC Profile Constant: tag type signaturE. + * ICC Profile Constant: tag type signature. */ public static final int icTagType = 0; /* tag type signature */ @@ -1874,7 +1874,7 @@ public class ICC_Profile implements Serializable { return canonicalFileName.startsWith(canonicalDirName); } catch (IOException e) { /* we do not expect the IOException here, because invocation - * of this function is always preceeded by isFile() call. + * of this function is always preceded by isFile() call. */ return false; } @@ -1903,7 +1903,7 @@ public class ICC_Profile implements Serializable { * resolve the bogus deserialized profile object with one obtained * with getInstance as well. * - * There're two primary factory methods for construction of ICC + * There are two primary factory methods for construction of ICC * profiles: getInstance(int cspace) and getInstance(byte[] data). * This implementation of ICC_Profile uses the former to return a * cached singleton profile object, other implementations will diff --git a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeType.java b/jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeType.java index cee6bba9840..c8b7f6a5273 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeType.java +++ b/jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeType.java @@ -233,7 +233,7 @@ MimeTypeParameterList(rawdata.substring(semIndex)); /** * Remove any value associated with the given name. * - * @throw IllegalArgumentExcpetion if parameter may not be deleted + * @throw IllegalArgumentException if parameter may not be deleted */ public void removeParameter(String name) { parameters.remove(name); diff --git a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeTypeParameterList.java b/jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeTypeParameterList.java index 3a79886c2b4..9c1b888ec1f 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeTypeParameterList.java +++ b/jdk/src/java.desktop/share/classes/java/awt/datatransfer/MimeTypeParameterList.java @@ -163,7 +163,7 @@ class MimeTypeParameterList implements Cloneable { lastIndex = currentIndex; if(currentIndex < length) { - // find the next unescqped quote + // find the next unescaped quote foundit = false; while((currentIndex < length) && !foundit) { currentChar = rawdata.charAt(currentIndex); @@ -171,7 +171,7 @@ class MimeTypeParameterList implements Cloneable { // found an escape sequence so pass this and the next character currentIndex += 2; } else if(currentChar == '"') { - // foundit! + // found it! foundit = true; } else { ++currentIndex; diff --git a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/SystemFlavorMap.java b/jdk/src/java.desktop/share/classes/java/awt/datatransfer/SystemFlavorMap.java index 8bd47fe5f45..6b5c831a950 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/datatransfer/SystemFlavorMap.java +++ b/jdk/src/java.desktop/share/classes/java/awt/datatransfer/SystemFlavorMap.java @@ -714,7 +714,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { return returnValue; } - private static final String [] htmlDocumntTypes = + private static final String [] htmlDocumentTypes = new String [] {"all", "selection", "fragment"}; private static LinkedHashSet handleHtmlMimeTypes(String baseType, @@ -723,7 +723,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { LinkedHashSet returnValues = new LinkedHashSet<>(); if (HTML_TEXT_BASE_TYPE.equals(baseType)) { - for (String documentType : htmlDocumntTypes) { + for (String documentType : htmlDocumentTypes) { returnValues.add(mimeType + ";document=" + documentType); } } else { diff --git a/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSource.java b/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSource.java index 3236ca241f5..48ef30de4c8 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSource.java +++ b/jdk/src/java.desktop/share/classes/java/awt/dnd/DragSource.java @@ -547,7 +547,7 @@ public class DragSource implements Serializable { /** * Adds the specified DragSourceListener to this * DragSource to receive drag source events during drag - * operations intiated with this DragSource. + * operations initiated with this DragSource. * If a null listener is specified, no action is taken and no * exception is thrown. * @@ -607,7 +607,7 @@ public class DragSource implements Serializable { /** * Adds the specified DragSourceMotionListener to this * DragSource to receive drag motion events during drag - * operations intiated with this DragSource. + * operations initiated with this DragSource. * If a null listener is specified, no action is taken and no * exception is thrown. * diff --git a/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java b/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java index a6939b924a7..9c77fd76027 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java +++ b/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTarget.java @@ -453,7 +453,7 @@ public class DropTarget implements DropTargetListener, Serializable { if (dtListener != null && active) dtListener.drop(dtde); - else { // we should'nt get here ... + else { // we shouldn't get here ... dtde.rejectDrop(); } } diff --git a/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTargetListener.java b/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTargetListener.java index 60676f99b0d..ec04be74e32 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTargetListener.java +++ b/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTargetListener.java @@ -117,7 +117,7 @@ public interface DropTargetListener extends EventListener { * gesture. The DropTargetDropEvent * provides a means to obtain a Transferable * object that represents the data object(s) to - * be transfered.

      + * be transferred.

      * From this method, the DropTargetListener * shall accept or reject the drop via the * acceptDrop(int dropAction) or rejectDrop() methods of the diff --git a/jdk/src/java.desktop/share/classes/java/awt/dnd/peer/DropTargetPeer.java b/jdk/src/java.desktop/share/classes/java/awt/dnd/peer/DropTargetPeer.java index 2e75a14569b..fc14c93f052 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/dnd/peer/DropTargetPeer.java +++ b/jdk/src/java.desktop/share/classes/java/awt/dnd/peer/DropTargetPeer.java @@ -32,7 +32,7 @@ import java.awt.dnd.DropTarget; * The DropTargetPeer class is the interface to the platform dependent * DnD facilities. Since the DnD system is based on the native platform's * facilities, a DropTargetPeer will be associated with a ComponentPeer - * of the nearsest enclosing native Container (in the case of lightweights) + * of the nearest enclosing native Container (in the case of lightweights) *

      * * @since 1.2 diff --git a/jdk/src/java.desktop/share/classes/java/awt/event/InputEvent.java b/jdk/src/java.desktop/share/classes/java/awt/event/InputEvent.java index d49530174c5..ecf993530d3 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/event/InputEvent.java +++ b/jdk/src/java.desktop/share/classes/java/awt/event/InputEvent.java @@ -167,7 +167,7 @@ public abstract class InputEvent extends ComponentEvent { private static final int [] BUTTON_DOWN_MASK = new int [] { BUTTON1_DOWN_MASK, BUTTON2_DOWN_MASK, BUTTON3_DOWN_MASK, - 1<<14, //4th phisical button (this is not a wheel!) + 1<<14, //4th physical button (this is not a wheel!) 1<<15, //(this is not a wheel!) 1<<16, 1<<17, @@ -245,7 +245,7 @@ public abstract class InputEvent extends ComponentEvent { */ public static int getMaskForButton(int button) { if (button <= 0 || button > BUTTON_DOWN_MASK.length) { - throw new IllegalArgumentException("button doesn\'t exist " + button); + throw new IllegalArgumentException("button doesn't exist " + button); } return BUTTON_DOWN_MASK[button - 1]; } diff --git a/jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java b/jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java index 06cee44c408..a29ba86c291 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java +++ b/jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java @@ -1814,7 +1814,7 @@ public class KeyEvent extends InputEvent { /** * Sets new modifiers by the old ones. The key modifiers - * override overlaping mouse modifiers. + * override overlapping mouse modifiers. */ private void setNewModifiers() { if ((modifiers & SHIFT_MASK) != 0) { @@ -1863,7 +1863,7 @@ public class KeyEvent extends InputEvent { /** * Sets new modifiers by the old ones. The key modifiers - * override overlaping mouse modifiers. + * override overlapping mouse modifiers. * @serial */ private void readObject(ObjectInputStream s) diff --git a/jdk/src/java.desktop/share/classes/java/awt/event/WindowEvent.java b/jdk/src/java.desktop/share/classes/java/awt/event/WindowEvent.java index 92e28af85a2..99b9277b307 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/event/WindowEvent.java +++ b/jdk/src/java.desktop/share/classes/java/awt/event/WindowEvent.java @@ -34,7 +34,7 @@ import sun.awt.SunToolkit; * A low-level event that indicates that a window has changed its status. This * low-level event is generated by a Window object when it is opened, closed, * activated, deactivated, iconified, or deiconified, or when focus is - * transfered into or out of the Window. + * transferred into or out of the Window. *

      * The event is passed to every WindowListener * or WindowAdapter object which registered to receive such diff --git a/jdk/src/java.desktop/share/classes/java/awt/event/WindowFocusListener.java b/jdk/src/java.desktop/share/classes/java/awt/event/WindowFocusListener.java index ff9ddd45788..d56100a7c79 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/event/WindowFocusListener.java +++ b/jdk/src/java.desktop/share/classes/java/awt/event/WindowFocusListener.java @@ -39,7 +39,7 @@ import java.util.EventListener; * using the Window's addWindowFocusListener method. * When the Window's * status changes by virtue of it being opened, closed, activated, deactivated, - * iconified, or deiconified, or by focus being transfered into or out of the + * iconified, or deiconified, or by focus being transferred into or out of the * Window, the relevant method in the listener object is invoked, * and the WindowEvent is passed to it. * diff --git a/jdk/src/java.desktop/share/classes/java/awt/font/GlyphVector.java b/jdk/src/java.desktop/share/classes/java/awt/font/GlyphVector.java index a16f3be6a4f..dd77e4d9ae2 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/font/GlyphVector.java +++ b/jdk/src/java.desktop/share/classes/java/awt/font/GlyphVector.java @@ -62,7 +62,7 @@ import java.awt.font.GlyphJustificationInfo; * A GlyphVector is associated with exactly one * Font, and can provide data useful only in relation to * this Font. In addition, metrics obtained from a - * GlyphVector are not generally geometrically scaleable + * GlyphVector are not generally geometrically scalable * since the pixelization and spacing are dependent on grid-fitting * algorithms within a Font. To facilitate accurate * measurement of a GlyphVector and its component diff --git a/jdk/src/java.desktop/share/classes/java/awt/font/ImageGraphicAttribute.java b/jdk/src/java.desktop/share/classes/java/awt/font/ImageGraphicAttribute.java index c979e321539..84f12061cb6 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/font/ImageGraphicAttribute.java +++ b/jdk/src/java.desktop/share/classes/java/awt/font/ImageGraphicAttribute.java @@ -58,7 +58,7 @@ public final class ImageGraphicAttribute extends GraphicAttribute { private float fOriginX, fOriginY; /** - * Constucts an ImageGraphicAttribute from the specified + * Constructs an ImageGraphicAttribute from the specified * {@link Image}. The origin is at (0, 0). * @param image the Image rendered by this * ImageGraphicAttribute. diff --git a/jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java b/jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java index c02d959e0bd..04c4487bd7f 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java +++ b/jdk/src/java.desktop/share/classes/java/awt/font/NumericShaper.java @@ -89,7 +89,7 @@ import sun.misc.SharedSecrets; * or creating a {@code Set} with the {@link NumericShaper.Range} * constants, such as: *

      - * EnumSet.of(NumericShaper.Scirpt.ARABIC, NumericShaper.Range.TAMIL)
      + * EnumSet.of(NumericShaper.Range.ARABIC, NumericShaper.Range.TAMIL)
        * 
      * The enum-based ranges are a super set of the bit mask-based ones. * @@ -475,7 +475,7 @@ public final class NumericShaper implements java.io.Serializable { /** Identifies all ranges, for full contextual shaping. * *

      This constant specifies all of the bit mask-based - * ranges. Use {@code EmunSet.allOf(NumericShaper.Range.class)} to + * ranges. Use {@code EnumSet.allOf(NumericShaper.Range.class)} to * specify all of the enum-based ranges. */ public static final int ALL_RANGES = 0x0007ffff; @@ -1068,14 +1068,14 @@ public final class NumericShaper implements java.io.Serializable { shapingRange = defaultContext; rangeSet = EnumSet.copyOf(ranges); // throws NPE if ranges is null. - // Give precedance to EASTERN_ARABIC if both ARABIC and + // Give precedence to EASTERN_ARABIC if both ARABIC and // EASTERN_ARABIC are specified. if (rangeSet.contains(Range.EASTERN_ARABIC) && rangeSet.contains(Range.ARABIC)) { rangeSet.remove(Range.ARABIC); } - // As well as the above case, give precedance to TAI_THAM_THAM if both + // As well as the above case, give precedence to TAI_THAM_THAM if both // TAI_THAM_HORA and TAI_THAM_THAM are specified. if (rangeSet.contains(Range.TAI_THAM_THAM) && rangeSet.contains(Range.TAI_THAM_HORA)) { diff --git a/jdk/src/java.desktop/share/classes/java/awt/font/StyledParagraph.java b/jdk/src/java.desktop/share/classes/java/awt/font/StyledParagraph.java index 380fa36e918..7ddaa058cfe 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/font/StyledParagraph.java +++ b/jdk/src/java.desktop/share/classes/java/awt/font/StyledParagraph.java @@ -47,7 +47,7 @@ import sun.font.FontResolver; * on a paragraph of styled text. *

      * Currently, this class is optimized for a small number of intervals - * (preferrably 1). + * (preferably 1). */ final class StyledParagraph { @@ -262,7 +262,7 @@ final class StyledParagraph { /** * Return the index at which there is a different Font, GraphicAttribute, or - * Dcoration than at the given index. + * Decoration than at the given index. * @param index a valid index in the paragraph * @return the first index where there is a change in attributes from * those at index diff --git a/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java b/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java index 280e1934693..fdaa2da1c7e 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java +++ b/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java @@ -644,7 +644,7 @@ public final class TextAttribute extends Attribute { * be no other attributes in the Map except the * FONT attribute. With Map-based APIs * the common case is to specify all attributes individually, so - * FONT is not needed or desireable. + * FONT is not needed or desirable. * *

      However, if both FONT and other attributes are * present in the Map, the rendering system will @@ -686,7 +686,7 @@ public final class TextAttribute extends Attribute { /** * Attribute key for a user-defined glyph to display in lieu * of the font's standard glyph for a character. Values are - * intances of GraphicAttribute. The default value is null, + * instances of GraphicAttribute. The default value is null, * indicating that the standard glyphs provided by the font * should be used. * @@ -1098,7 +1098,7 @@ public final class TextAttribute extends Attribute { * tracking values will inhibit formation of optional ligatures. * Tracking values are typically between -0.1 and * 0.3; values outside this range are generally not - * desireable. + * desirable. * * @since 1.6 */ diff --git a/jdk/src/java.desktop/share/classes/java/awt/font/TextLayout.java b/jdk/src/java.desktop/share/classes/java/awt/font/TextLayout.java index f86779c161b..f6bfc17fb58 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/font/TextLayout.java +++ b/jdk/src/java.desktop/share/classes/java/awt/font/TextLayout.java @@ -195,7 +195,7 @@ import sun.font.LayoutPathImpl; * Color selectionColor = ...; * Shape selection = layout.getLogicalHighlightShape(selStart, selLimit); * // selection may consist of disjoint areas - * // graphics is assumed to be tranlated to origin of layout + * // graphics is assumed to be translated to origin of layout * g.setColor(selectionColor); * g.fill(selection); * @@ -292,7 +292,7 @@ public final class TextLayout implements Cloneable { private Rectangle2D boundsRect = null; /* - * flag to supress/allow carets inside of ligatures when hit testing or + * flag to suppress/allow carets inside of ligatures when hit testing or * arrow-keying */ private boolean caretsInLigaturesAreAllowed = false; @@ -767,7 +767,7 @@ public final class TextLayout implements Cloneable { } /* - * Utility to throw an expection if an invalid TextHitInfo is passed + * Utility to throw an exception if an invalid TextHitInfo is passed * as a parameter. Avoids code duplication. */ private void checkTextHit(TextHitInfo hit) { @@ -833,7 +833,7 @@ public final class TextLayout implements Cloneable { * punctuation and trailing whitespace to overhang the justification width. * Once justified, the layout may not be rejustified. *

      - * Some code may rely on immutablity of layouts. Subclassers should not + * Some code may rely on immutability of layouts. Subclassers should not * call this directly, but instead should call getJustifiedLayout, which * will call this method on a clone of this layout, preserving * the original. diff --git a/jdk/src/java.desktop/share/classes/java/awt/im/spi/InputMethod.java b/jdk/src/java.desktop/share/classes/java/awt/im/spi/InputMethod.java index 0a724f6db6e..5a2d7449d76 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/im/spi/InputMethod.java +++ b/jdk/src/java.desktop/share/classes/java/awt/im/spi/InputMethod.java @@ -196,7 +196,7 @@ public interface InputMethod { /** * Dispatches the event to the input method. If input method support is - * enabled for the focussed component, incoming events of certain types + * enabled for the focused component, incoming events of certain types * are dispatched to the current input method for this component before * they are dispatched to the component's methods or event listeners. * The input method decides whether it needs to handle the event. If it diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/BufferedImage.java b/jdk/src/java.desktop/share/classes/java/awt/image/BufferedImage.java index 0c819349135..c73477b5b37 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/BufferedImage.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/BufferedImage.java @@ -856,7 +856,7 @@ public class BufferedImage extends java.awt.Image /** * Returns the {@link WritableRaster}. - * @return the WriteableRaster of this + * @return the WritableRaster of this * BufferedImage. */ public WritableRaster getRaster() { diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java b/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java index 66b8c333975..10439c7f835 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/ColorModel.java @@ -631,7 +631,7 @@ public abstract class ColorModel implements Transparency{ * inData is not large enough to hold a pixel value * for this ColorModel * @throws UnsupportedOperationException if this - * tranferType is not supported by this + * transferType is not supported by this * ColorModel */ public int getRed(Object inData) { @@ -698,7 +698,7 @@ public abstract class ColorModel implements Transparency{ * inData is not large enough to hold a pixel value * for this ColorModel * @throws UnsupportedOperationException if this - * tranferType is not supported by this + * transferType is not supported by this * ColorModel */ public int getGreen(Object inData) { @@ -765,7 +765,7 @@ public abstract class ColorModel implements Transparency{ * inData is not large enough to hold a pixel value * for this ColorModel * @throws UnsupportedOperationException if this - * tranferType is not supported by this + * transferType is not supported by this * ColorModel */ public int getBlue(Object inData) { @@ -1722,7 +1722,7 @@ public abstract class ColorModel implements Transparency{ // is from the IEC 61966-2-1 International Standard, // Colour Management - Default RGB colour space - sRGB, // First Edition, 1999-10, - // avaiable for order at http://www.iec.ch + // available for order at http://www.iec.ch for (int i = 0; i <= 255; i++) { input = ((float) i) / 255.0f; if (input <= 0.0031308f) { diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/FilteredImageSource.java b/jdk/src/java.desktop/share/classes/java/awt/image/FilteredImageSource.java index a7013159008..ce48c65b9f0 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/image/FilteredImageSource.java +++ b/jdk/src/java.desktop/share/classes/java/awt/image/FilteredImageSource.java @@ -37,7 +37,7 @@ import java.awt.image.ColorModel; * takes an existing image and a filter object and uses them to produce * image data for a new filtered version of the original image. * Here is an example which filters an image by swapping the red and - * blue compents: + * blue components: *

        *
        *      Image src = getImage("doc:///demo/images/duke/T1.gif");
      diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/Raster.java b/jdk/src/java.desktop/share/classes/java/awt/image/Raster.java
      index 5374cd8c880..2b0592168fa 100644
      --- a/jdk/src/java.desktop/share/classes/java/awt/image/Raster.java
      +++ b/jdk/src/java.desktop/share/classes/java/awt/image/Raster.java
      @@ -393,7 +393,7 @@ public class Raster {
               }
               int banks = maxBank + 1;
               int size = maxBandOff +
      -            scanlineStride * (h - 1) + // fisrt (h - 1) scans
      +            scanlineStride * (h - 1) + // first (h - 1) scans
                   w; // last scan
       
               switch(dataType) {
      diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/WritableRenderedImage.java b/jdk/src/java.desktop/share/classes/java/awt/image/WritableRenderedImage.java
      index 3f6c0b430b8..0f33e58ec01 100644
      --- a/jdk/src/java.desktop/share/classes/java/awt/image/WritableRenderedImage.java
      +++ b/jdk/src/java.desktop/share/classes/java/awt/image/WritableRenderedImage.java
      @@ -37,7 +37,7 @@ package java.awt.image;
       import java.awt.Point;
       
       /**
      - * WriteableRenderedImage is a common interface for objects which
      + * WritableRenderedImage is a common interface for objects which
        * contain or can produce image data in the form of Rasters and
        * which can be modified and/or written over.  The image
        * data may be stored/produced as a single tile or a regular array
      diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/renderable/ContextualRenderedImageFactory.java b/jdk/src/java.desktop/share/classes/java/awt/image/renderable/ContextualRenderedImageFactory.java
      index c327ed3c6b0..fd93b562a05 100644
      --- a/jdk/src/java.desktop/share/classes/java/awt/image/renderable/ContextualRenderedImageFactory.java
      +++ b/jdk/src/java.desktop/share/classes/java/awt/image/renderable/ContextualRenderedImageFactory.java
      @@ -61,7 +61,7 @@ public interface ContextualRenderedImageFactory extends RenderedImageFactory {
            * alterations in the RenderContext, such as an affine mapping, or
            * operations that wish to obtain lower quality renderings of
            * their sources in order to save processing effort or
      -     * transmission bandwith.  Some operations, such as blur, can also
      +     * transmission bandwidth.  Some operations, such as blur, can also
            * use this mechanism to avoid obtaining sources of higher quality
            * than necessary.
            *
      diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/renderable/RenderableImage.java b/jdk/src/java.desktop/share/classes/java/awt/image/renderable/RenderableImage.java
      index d6e7ad44080..19f9fe4d014 100644
      --- a/jdk/src/java.desktop/share/classes/java/awt/image/renderable/RenderableImage.java
      +++ b/jdk/src/java.desktop/share/classes/java/awt/image/renderable/RenderableImage.java
      @@ -168,7 +168,7 @@ public interface RenderableImage {
           RenderedImage createScaledRendering(int w, int h, RenderingHints hints);
       
           /**
      -     * Returnd a RenderedImage instance of this image with a default
      +     * Returns a RenderedImage instance of this image with a default
            * width and height in pixels.  The RenderContext is built
            * automatically with an appropriate usr2dev transform and an area
            * of interest of the full image.  The rendering hints are
      diff --git a/jdk/src/java.desktop/share/classes/java/awt/peer/ComponentPeer.java b/jdk/src/java.desktop/share/classes/java/awt/peer/ComponentPeer.java
      index 5fcc90f8d75..2ac37efb7d1 100644
      --- a/jdk/src/java.desktop/share/classes/java/awt/peer/ComponentPeer.java
      +++ b/jdk/src/java.desktop/share/classes/java/awt/peer/ComponentPeer.java
      @@ -415,7 +415,7 @@ public interface ComponentPeer {
           boolean prepareImage(Image img, int w, int h, ImageObserver o);
       
           /**
      -     * Determines the status of the construction of the screen representaion
      +     * Determines the status of the construction of the screen representation
            * of the specified image.
            *
            * @param img the image to check
      diff --git a/jdk/src/java.desktop/share/classes/java/awt/print/PageFormat.java b/jdk/src/java.desktop/share/classes/java/awt/print/PageFormat.java
      index fc6e023d567..e847efef918 100644
      --- a/jdk/src/java.desktop/share/classes/java/awt/print/PageFormat.java
      +++ b/jdk/src/java.desktop/share/classes/java/awt/print/PageFormat.java
      @@ -71,7 +71,7 @@ public class PageFormat implements Cloneable
       
           /**
            * The orientation of the current page. This will be
      -     * one of the constants: PORTRIAT, LANDSCAPE, or
      +     * one of the constants: PORTRAIT, LANDSCAPE, or
            * REVERSE_LANDSCAPE,
            */
           private int mOrientation = PORTRAIT;
      diff --git a/jdk/src/java.desktop/share/classes/java/awt/print/Paper.java b/jdk/src/java.desktop/share/classes/java/awt/print/Paper.java
      index 67b19043323..2fe976ab5ad 100644
      --- a/jdk/src/java.desktop/share/classes/java/awt/print/Paper.java
      +++ b/jdk/src/java.desktop/share/classes/java/awt/print/Paper.java
      @@ -68,7 +68,7 @@ public class Paper implements Cloneable {
       
           /**
            * The area of the page on which drawing will
      -     * be visable. The area outside of this
      +     * be visible. The area outside of this
            * rectangle but on the Page generally
            * reflects the printer's hardware margins.
            * The origin of the physical page is
      diff --git a/jdk/src/java.desktop/share/classes/java/awt/print/PrinterJob.java b/jdk/src/java.desktop/share/classes/java/awt/print/PrinterJob.java
      index 41d39ce10ec..13903959b56 100644
      --- a/jdk/src/java.desktop/share/classes/java/awt/print/PrinterJob.java
      +++ b/jdk/src/java.desktop/share/classes/java/awt/print/PrinterJob.java
      @@ -524,7 +524,7 @@ public abstract class PrinterJob {
            * 

      * Note that some attributes may be set directly on the PrinterJob * by equivalent method calls, (for example), copies: - * setcopies(int), job name: setJobName(String) + * setCopies(int), job name: setJobName(String) * and specifying media size and orientation though the * PageFormat object. *

      diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java b/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java index d4d44d6c1bc..cdd28963be1 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java @@ -876,7 +876,7 @@ public class CSS implements Serializable { int size = getFontSize(a, defaultSize, ss); /* - * If the vertical alignment is set to either superscirpt or + * If the vertical alignment is set to either superscript or * subscript we reduce the font size by 2 points. */ StringValue vAlignV = (StringValue)a.getAttribute From 579e48fd608c6ffc2ed7a9b6c65061320bc7bc55 Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Fri, 19 Sep 2014 16:34:59 +0200 Subject: [PATCH 38/81] 8055032: Improve numerical parsing in java.net and sun.net Reviewed-by: alanb --- jdk/src/java.base/share/classes/java/net/CookieManager.java | 2 +- jdk/src/java.base/share/classes/java/net/URI.java | 4 ++-- jdk/src/java.base/share/classes/java/net/URLDecoder.java | 2 +- .../java.base/share/classes/java/net/URLStreamHandler.java | 6 ++++-- .../share/classes/sun/net/TransferProtocolClient.java | 2 +- .../java.base/share/classes/sun/net/ftp/impl/FtpClient.java | 6 +++--- jdk/src/java.base/share/classes/sun/net/www/ParseUtil.java | 2 +- .../share/classes/sun/net/www/http/ChunkedInputStream.java | 2 +- .../share/classes/sun/net/www/http/HttpClient.java | 2 +- jdk/src/java.base/unix/classes/sun/net/sdp/SdpProvider.java | 3 ++- 10 files changed, 17 insertions(+), 14 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/net/CookieManager.java b/jdk/src/java.base/share/classes/java/net/CookieManager.java index 15d4cc33e08..4dbc9aa2dfa 100644 --- a/jdk/src/java.base/share/classes/java/net/CookieManager.java +++ b/jdk/src/java.base/share/classes/java/net/CookieManager.java @@ -368,7 +368,7 @@ public class CookieManager extends CookieHandler int val = -1; while (i > 0) { try { - val = Integer.parseInt(lst.substring(0, i)); + val = Integer.parseInt(lst, 0, i, 10); if (val == port) { return true; } diff --git a/jdk/src/java.base/share/classes/java/net/URI.java b/jdk/src/java.base/share/classes/java/net/URI.java index 62dea657c04..c656ac71c11 100644 --- a/jdk/src/java.base/share/classes/java/net/URI.java +++ b/jdk/src/java.base/share/classes/java/net/URI.java @@ -3250,7 +3250,7 @@ public final class URI if (q > p) { checkChars(p, q, L_DIGIT, H_DIGIT, "port number"); try { - port = Integer.parseInt(substring(p, q)); + port = Integer.parseInt(input, p, q, 10); } catch (NumberFormatException x) { fail("Malformed port number", p); } @@ -3271,7 +3271,7 @@ public final class URI int p = start; int q = scan(p, n, L_DIGIT, H_DIGIT); if (q <= p) return q; - if (Integer.parseInt(substring(p, q)) > 255) return p; + if (Integer.parseInt(input, p, q, 10) > 255) return p; return q; } diff --git a/jdk/src/java.base/share/classes/java/net/URLDecoder.java b/jdk/src/java.base/share/classes/java/net/URLDecoder.java index 2c65c95fefc..9aa5ddc2039 100644 --- a/jdk/src/java.base/share/classes/java/net/URLDecoder.java +++ b/jdk/src/java.base/share/classes/java/net/URLDecoder.java @@ -171,7 +171,7 @@ public class URLDecoder { while ( ((i+2) < numChars) && (c=='%')) { - int v = Integer.parseInt(s.substring(i+1,i+3),16); + int v = Integer.parseInt(s, i + 1, i + 3, 16); if (v < 0) throw new IllegalArgumentException("URLDecoder: Illegal hex characters in escape (%) pattern - negative value"); bytes[pos++] = (byte) v; diff --git a/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java b/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java index 9ea65260f3d..56506ba33bb 100644 --- a/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java +++ b/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java @@ -196,7 +196,8 @@ public abstract class URLStreamHandler { ++ind ; // port can be null according to RFC2396 if (nhost.length() > (ind + 1)) { - port = Integer.parseInt(nhost.substring(ind+1)); + port = Integer.parseInt(nhost, ind + 1, + nhost.length(), 10); } } else { throw new IllegalArgumentException( @@ -213,7 +214,8 @@ public abstract class URLStreamHandler { if (ind >= 0) { // port can be null according to RFC2396 if (host.length() > (ind + 1)) { - port = Integer.parseInt(host.substring(ind + 1)); + port = Integer.parseInt(host, ind + 1, + host.length(), 10); } host = host.substring(0, ind); } diff --git a/jdk/src/java.base/share/classes/sun/net/TransferProtocolClient.java b/jdk/src/java.base/share/classes/sun/net/TransferProtocolClient.java index 2c3ae2e1f6e..b3a9fd556e6 100644 --- a/jdk/src/java.base/share/classes/sun/net/TransferProtocolClient.java +++ b/jdk/src/java.base/share/classes/sun/net/TransferProtocolClient.java @@ -80,7 +80,7 @@ public class TransferProtocolClient extends NetworkClient { code = -1; } else { try { - code = Integer.parseInt(response.substring(0, 3)); + code = Integer.parseInt(response, 0, 3, 10); } catch (NumberFormatException e) { code = -1; } catch (StringIndexOutOfBoundsException e) { diff --git a/jdk/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java b/jdk/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java index 5f8c8586072..61ab2fbb9d3 100644 --- a/jdk/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java +++ b/jdk/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java @@ -260,8 +260,8 @@ public class FtpClient extends sun.net.ftp.FtpClient { if (d != null && time != null) { int c = time.indexOf(':'); now.setTime(d); - now.set(Calendar.HOUR, Integer.parseInt(time.substring(0, c))); - now.set(Calendar.MINUTE, Integer.parseInt(time.substring(c + 1))); + now.set(Calendar.HOUR, Integer.parseInt(time, 0, c, 10)); + now.set(Calendar.MINUTE, Integer.parseInt(time, c + 1, time.length(), 10)); d = now.getTime(); } // see if it's a symbolic link, i.e. the name if followed @@ -437,7 +437,7 @@ public class FtpClient extends sun.net.ftp.FtpClient { code = -1; } else { try { - code = Integer.parseInt(response.substring(0, 3)); + code = Integer.parseInt(response, 0, 3, 10); } catch (NumberFormatException e) { code = -1; } catch (StringIndexOutOfBoundsException e) { diff --git a/jdk/src/java.base/share/classes/sun/net/www/ParseUtil.java b/jdk/src/java.base/share/classes/sun/net/www/ParseUtil.java index cb8311996b1..1c9abf9d1f4 100644 --- a/jdk/src/java.base/share/classes/sun/net/www/ParseUtil.java +++ b/jdk/src/java.base/share/classes/sun/net/www/ParseUtil.java @@ -161,7 +161,7 @@ public class ParseUtil { * Un-escape and return the character at position i in string s. */ private static byte unescape(String s, int i) { - return (byte) Integer.parseInt(s.substring(i+1,i+3),16); + return (byte) Integer.parseInt(s, i + 1, i + 3, 16); } diff --git a/jdk/src/java.base/share/classes/sun/net/www/http/ChunkedInputStream.java b/jdk/src/java.base/share/classes/sun/net/www/http/ChunkedInputStream.java index 222ddc0ba1c..3f36aa11653 100644 --- a/jdk/src/java.base/share/classes/sun/net/www/http/ChunkedInputStream.java +++ b/jdk/src/java.base/share/classes/sun/net/www/http/ChunkedInputStream.java @@ -313,7 +313,7 @@ class ChunkedInputStream extends InputStream implements Hurryable { break; } try { - chunkSize = Integer.parseInt(header.substring(0, i), 16); + chunkSize = Integer.parseInt(header, 0, i, 16); } catch (NumberFormatException e) { error = true; throw new IOException("Bogus chunk size"); diff --git a/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java b/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java index e899ac9b607..0e07d3ab65c 100644 --- a/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java +++ b/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java @@ -808,7 +808,7 @@ public class HttpClient extends NetworkClient { ind = resp.indexOf(' '); while(resp.charAt(ind) == ' ') ind++; - code = Integer.parseInt(resp.substring(ind, ind + 3)); + code = Integer.parseInt(resp, ind, ind + 3, 10); } catch (Exception e) {} if (code == HTTP_CONTINUE && ignoreContinue) { diff --git a/jdk/src/java.base/unix/classes/sun/net/sdp/SdpProvider.java b/jdk/src/java.base/unix/classes/sun/net/sdp/SdpProvider.java index 74bcfeae34e..ec974744419 100644 --- a/jdk/src/java.base/unix/classes/sun/net/sdp/SdpProvider.java +++ b/jdk/src/java.base/unix/classes/sun/net/sdp/SdpProvider.java @@ -257,7 +257,8 @@ public class SdpProvider extends NetHooks.Provider { .getByName(s[1].substring(0, pos)); int prefix = -1; try { - prefix = Integer.parseInt(s[1].substring(pos+1)); + prefix = Integer.parseInt(s[1], pos + 1, + s[1].length(), 10); if (address instanceof Inet4Address) { // must be 1-31 if (prefix < 0 || prefix > 32) prefix = -1; From 8a75d987d3919a0915d150385d115f2553ea6d7e Mon Sep 17 00:00:00 2001 From: Sergey Gabdurakhmanov Date: Mon, 22 Sep 2014 10:47:27 +0200 Subject: [PATCH 39/81] 8057564: JVM hangs at getAgentProperties after attaching to VM with lower Create custom Security Descriptor for Named Pipe. Reviewed-by: mgronlun, dsamersoff, uta --- .../native/libattach/VirtualMachineImpl.c | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/jdk/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c b/jdk/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c index 2fc0438f82a..f92101f8924 100644 --- a/jdk/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c +++ b/jdk/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c @@ -23,6 +23,7 @@ * questions. */ #include +#include #include #include "jni.h" @@ -258,6 +259,25 @@ JNIEXPORT jlong JNICALL Java_sun_tools_attach_VirtualMachineImpl_createPipe HANDLE hPipe; char name[MAX_PIPE_NAME_LENGTH]; + SECURITY_ATTRIBUTES sa; + LPSECURITY_ATTRIBUTES lpSA = NULL; + // Custom Security Descriptor is required here to "get" Medium Integrity Level. + // In order to allow Medium Integrity Level clients to open + // and use a NamedPipe created by an High Integrity Level process. + TCHAR *szSD = TEXT("D:") // Discretionary ACL + TEXT("(A;OICI;GRGW;;;WD)") // Allow read/write to Everybody + TEXT("(A;OICI;GA;;;SY)") // Allow full control to System + TEXT("(A;OICI;GA;;;BA)"); // Allow full control to Administrators + + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.bInheritHandle = FALSE; + sa.lpSecurityDescriptor = NULL; + + if (ConvertStringSecurityDescriptorToSecurityDescriptor + (szSD, SDDL_REVISION_1, &(sa.lpSecurityDescriptor), NULL)) { + lpSA = &sa; + } + jstring_to_cstring(env, pipename, name, MAX_PIPE_NAME_LENGTH); hPipe = CreateNamedPipe( @@ -270,7 +290,9 @@ JNIEXPORT jlong JNICALL Java_sun_tools_attach_VirtualMachineImpl_createPipe 128, // output buffer size 8192, // input buffer size NMPWAIT_USE_DEFAULT_WAIT, // client time-out - NULL); // default security attribute + lpSA); // security attributes + + LocalFree(sa.lpSecurityDescriptor); if (hPipe == INVALID_HANDLE_VALUE) { char msg[256]; From 24028df23720a3e618c300afe846da6ff99d94be Mon Sep 17 00:00:00 2001 From: Sandipan Razzaque Date: Mon, 22 Sep 2014 10:41:45 -0700 Subject: [PATCH 40/81] 8043740: Doubles with large exponents overflow to Infinity incorrectly Modify test of exponent overflow to account for subsequent decrement. Reviewed-by: darcy --- .../classes/sun/misc/FloatingDecimal.java | 41 ++++++++++++------- jdk/test/java/lang/Double/ParseDouble.java | 15 +++++++ 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/jdk/src/java.base/share/classes/sun/misc/FloatingDecimal.java b/jdk/src/java.base/share/classes/sun/misc/FloatingDecimal.java index ddd8790bc14..eef4caf9905 100644 --- a/jdk/src/java.base/share/classes/sun/misc/FloatingDecimal.java +++ b/jdk/src/java.base/share/classes/sun/misc/FloatingDecimal.java @@ -1992,21 +1992,32 @@ public class FloatingDecimal{ break expLoop; // stop parsing exponent. } } - int expLimit = BIG_DECIMAL_EXPONENT+nDigits+nTrailZero; - if ( expOverflow || ( expVal > expLimit ) ){ - // - // The intent here is to end up with - // infinity or zero, as appropriate. - // The reason for yielding such a small decExponent, - // rather than something intuitive such as - // expSign*Integer.MAX_VALUE, is that this value - // is subject to further manipulation in - // doubleValue() and floatValue(), and I don't want - // it to be able to cause overflow there! - // (The only way we can get into trouble here is for - // really outrageous nDigits+nTrailZero, such as 2 billion. ) - // - decExp = expSign*expLimit; + int expLimit = BIG_DECIMAL_EXPONENT + nDigits + nTrailZero; + if (expOverflow || (expVal > expLimit)) { + // There is still a chance that the exponent will be safe to + // use: if it would eventually decrease due to a negative + // decExp, and that number is below the limit. We check for + // that here. + if (!expOverflow && (expSign == 1 && decExp < 0) + && (expVal + decExp) < expLimit) { + // Cannot overflow: adding a positive and negative number. + decExp += expVal; + } else { + // + // The intent here is to end up with + // infinity or zero, as appropriate. + // The reason for yielding such a small decExponent, + // rather than something intuitive such as + // expSign*Integer.MAX_VALUE, is that this value + // is subject to further manipulation in + // doubleValue() and floatValue(), and I don't want + // it to be able to cause overflow there! + // (The only way we can get into trouble here is for + // really outrageous nDigits+nTrailZero, such as 2 + // billion.) + // + decExp = expSign * expLimit; + } } else { // this should not overflow, since we tested // for expVal > (MAX+N), where N >= abs(decExp) diff --git a/jdk/test/java/lang/Double/ParseDouble.java b/jdk/test/java/lang/Double/ParseDouble.java index 381ddf1922c..ff4a3b80af3 100644 --- a/jdk/test/java/lang/Double/ParseDouble.java +++ b/jdk/test/java/lang/Double/ParseDouble.java @@ -512,6 +512,21 @@ public class ParseDouble { "2.2250738585072014e-308", // Double.MIN_NORMAL "2.2250738585072012e-308", // near Double.MIN_NORMAL + + "1.7976931348623158e+308", // near MAX_VALUE + ulp(MAX_VALUE)/2 + "1.7976931348623159e+308", // near MAX_VALUE + ulp(MAX_VALUE) + + "2.4703282292062329e-324", // above MIN_VALUE/2 + "2.4703282292062327e-324", // MIN_VALUE/2 + "2.4703282292062325e-324", // below MIN_VALUE/2 + + // 1e308 with leading zeros + + "0.0000000000001e321", + "00.000000000000000001e326", + "00000.000000000000000001e326", + "000.0000000000000000001e327", + "0.00000000000000000001e328", }; static String paddedBadStrings[]; From 7d629c8335b613e6e6deffe30265eafd526f7a04 Mon Sep 17 00:00:00 2001 From: Mikael Auno Date: Thu, 18 Sep 2014 11:34:14 +0200 Subject: [PATCH 41/81] 8058647: sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java should be quarantined Reviewed-by: jbachorik --- jdk/test/ProblemList.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 7aed17601cd..44dc7102452 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -298,4 +298,7 @@ sun/tools/jstatd/TestJstatdExternalRegistry.java generic-all # 6456333 sun/tools/jps/TestJpsJarRelative.java generic-all +# 8057732 +sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java generic-all + ############################################################################ From ebe3ab9dd234fc1aa404b9973110cfef500ce4a4 Mon Sep 17 00:00:00 2001 From: Mikael Auno Date: Thu, 18 Sep 2014 11:34:14 +0200 Subject: [PATCH 42/81] 8058649: java/lang/management/ThreadMXBean/FindDeadlocks.java should be quarantined Reviewed-by: jbachorik --- jdk/test/ProblemList.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 44dc7102452..73135636503 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -130,6 +130,9 @@ com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java # 8056143 java/lang/management/MemoryMXBean/LowMemoryTest.java generic-all +# 8058492 +java/lang/management/ThreadMXBean/FindDeadlocks.java generic-all + ############################################################################ # jdk_jmx From f2677eae506b56b034476a69d98c3e5430d6ea2e Mon Sep 17 00:00:00 2001 From: Mikael Auno Date: Thu, 18 Sep 2014 11:34:14 +0200 Subject: [PATCH 43/81] 8058651: com/sun/jdi/RedefinePop.sh should be quarantined Reviewed-by: jbachorik --- jdk/test/ProblemList.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 73135636503..3137ff0ac95 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -271,6 +271,9 @@ com/sun/jdi/RepStep.java generic-all # 8044419 com/sun/jdi/JdbReadTwiceTest.sh generic-all +# 8058616 +com/sun/jdi/RedefinePop.sh generic-all + ############################################################################ # jdk_util From 42e13628a3772cb293cc8e575fc881d76c5898a0 Mon Sep 17 00:00:00 2001 From: Mikael Auno Date: Thu, 18 Sep 2014 11:34:14 +0200 Subject: [PATCH 44/81] 8058652: java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java should be quarantined Reviewed-by: jbachorik --- jdk/test/ProblemList.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 3137ff0ac95..b664710bf43 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -133,6 +133,9 @@ java/lang/management/MemoryMXBean/LowMemoryTest.java # 8058492 java/lang/management/ThreadMXBean/FindDeadlocks.java generic-all +# 8058506 +java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java generic-all + ############################################################################ # jdk_jmx From 13c109280fd084553a24945db1ee4f7c2b74c8c3 Mon Sep 17 00:00:00 2001 From: Yuri Nesterenko Date: Thu, 18 Sep 2014 17:34:44 +0400 Subject: [PATCH 45/81] 8058726: Update regtests using sun.awt.OSInfo, part 1 Reviewed-by: alexsch --- .../MultiResolutionCursorTest.java | 6 ++++-- .../FileDialogForDirectories.html | 2 ++ .../FileDialogForDirectories.java | 2 +- .../FileDialogForPackages/FileDialogForPackages.html | 2 ++ .../FileDialogForPackages/FileDialogForPackages.java | 2 +- .../TypeAhead/SubMenuShowTest/SubMenuShowTest.html | 2 ++ .../TypeAhead/SubMenuShowTest/SubMenuShowTest.java | 2 +- .../awt/List/FirstItemRemoveTest/FirstItemRemoveTest.html | 2 ++ .../awt/List/FirstItemRemoveTest/FirstItemRemoveTest.java | 2 +- .../MouseModifiersUnitTest_Extra.java | 6 ++++-- .../MultiScreenInsetsTest/MultiScreenInsetsTest.java | 4 +++- .../java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java | 6 ++++-- .../DblClickActionEventTest/DblClickActionEventTest.html | 2 ++ .../DblClickActionEventTest/DblClickActionEventTest.java | 2 +- .../DisposeInActionEventTest.html | 2 ++ .../DisposeInActionEventTest.java | 2 +- .../datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java | 4 +++- .../MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html | 2 ++ .../MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java | 2 +- jdk/test/javax/swing/JCheckBox/4449413/bug4449413.java | 4 +++- .../swing/JCheckBox/8032667/bug8032667_image_diff.java | 4 +++- jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html | 4 +++- jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java | 4 ++-- jdk/test/javax/swing/JFileChooser/6840086/bug6840086.java | 4 +++- jdk/test/javax/swing/JFileChooser/8046391/bug8046391.java | 6 ++++-- jdk/test/javax/swing/JFrame/8016356/bug8016356.java | 8 +++++--- .../ShortcutNotDiplayed/ShortcutNotDisplayedTest.java | 6 ++++-- jdk/test/javax/swing/JOptionPane/8024926/bug8024926.java | 4 +++- jdk/test/javax/swing/JSlider/6579827/bug6579827.java | 4 +++- jdk/test/javax/swing/JTabbedPane/6416920/bug6416920.java | 6 ++++-- jdk/test/javax/swing/JTextArea/6940863/bug6940863.java | 6 ++++-- 31 files changed, 80 insertions(+), 34 deletions(-) diff --git a/jdk/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java b/jdk/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java index 9507bb40948..977c5fa67c0 100644 --- a/jdk/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java +++ b/jdk/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java @@ -36,7 +36,7 @@ import java.awt.image.BufferedImage; import java.util.LinkedList; import java.util.List; import javax.swing.JApplet; -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; import sun.awt.image.MultiResolutionImage; /** @@ -44,6 +44,8 @@ import sun.awt.image.MultiResolutionImage; * @bug 8028212 * @summary [macosx] Custom Cursor HiDPI support * @author Alexander Scherbatiy + * @library ../../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo * @run applet/manual=yesno MultiResolutionCursorTest.html */ public class MultiResolutionCursorTest extends JApplet { @@ -263,4 +265,4 @@ class TestDialog extends Dialog { messageText.append(messageIn + "\n"); System.out.println(messageIn); } -}// Te \ No newline at end of file +}// Te diff --git a/jdk/test/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.html b/jdk/test/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.html index f2179443031..8242f96c1ac 100644 --- a/jdk/test/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.html +++ b/jdk/test/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.html @@ -28,7 +28,9 @@ @summary We should support "apple.awt.fileDialogForDirectories" property. @author Sergey Bylokhov area=awt.filedialog @library ../../regtesthelpers + @library ../../../../lib/testlibrary @build Sysout + @build jdk.testlibrary.OSInfo @run applet/manual=yesno FileDialogForDirectories.html --> diff --git a/jdk/test/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.java b/jdk/test/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.java index 71dcaea0c79..d310eae0064 100644 --- a/jdk/test/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.java +++ b/jdk/test/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.java @@ -22,7 +22,7 @@ */ -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; import test.java.awt.regtesthelpers.Sysout; import java.applet.Applet; diff --git a/jdk/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html b/jdk/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html index e1900dcc8e6..6037eb51975 100644 --- a/jdk/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html +++ b/jdk/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html @@ -28,7 +28,9 @@ @summary Support apple.awt.use-file-dialog-packages property. @author Petr Pchelko area=awt.filedialog @library ../../regtesthelpers + @library ../../../../lib/testlibrary @build Sysout + @build jdk.testlibrary.OSInfo @run applet/manual=yesno FileDialogForPackages.html --> diff --git a/jdk/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java b/jdk/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java index 6a23a1dc3eb..13619ce9d4f 100644 --- a/jdk/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java +++ b/jdk/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java @@ -22,7 +22,7 @@ */ -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; import test.java.awt.regtesthelpers.Sysout; import java.applet.Applet; diff --git a/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.html b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.html index 7445a6c5128..b07fd876f26 100644 --- a/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.html +++ b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.html @@ -28,7 +28,9 @@ @summary Submenu should be shown by mnemonic key press. @author anton.tarasov@...: area=awt.focus @library ../../../regtesthelpers + @library ../../../../../lib/testlibrary @build Util + @build jdk.testlibrary.OSInfo @run applet SubMenuShowTest.html --> diff --git a/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java index 0641eaba260..b30d468f2ac 100644 --- a/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java +++ b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.java @@ -36,7 +36,7 @@ import java.applet.Applet; import java.util.concurrent.atomic.AtomicBoolean; import java.lang.reflect.InvocationTargetException; import test.java.awt.regtesthelpers.Util; -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; public class SubMenuShowTest extends Applet { Robot robot; diff --git a/jdk/test/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.html b/jdk/test/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.html index 4928aeddbbc..65ee7864e9d 100644 --- a/jdk/test/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.html +++ b/jdk/test/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.html @@ -26,6 +26,8 @@ @bug 6299858 @summary PIT. Focused border not shown on List if selected item is removed, XToolkit @author Dmitry.Cherepanov@SUN.COM area=awt.list + @library ../../../../lib/testlibrary + @build jdk.testlibrary.OSInfo @run applet FirstItemRemoveTest.html --> diff --git a/jdk/test/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.java b/jdk/test/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.java index 85c46af6429..c8e591346d5 100644 --- a/jdk/test/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.java +++ b/jdk/test/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.java @@ -65,7 +65,7 @@ public class FirstItemRemoveTest extends Applet private void test(){ - if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.MACOSX) { + if (jdk.testlibrary.OSInfo.getOSType() == jdk.testlibrary.OSInfo.OSType.MACOSX) { System.err.println("Skipped. This test is not for OS X."); return; } diff --git a/jdk/test/java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java b/jdk/test/java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java index 1ad7ec4bf5e..8b15847f864 100644 --- a/jdk/test/java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java +++ b/jdk/test/java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2014, 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 @@ -26,10 +26,12 @@ @bug 6315717 @summary verifies that modifiers are correct for extra buttons @author Andrei Dmitriev : area=awt.mouse + @library ../../../../lib/testlibrary + @build jdk.testlibrary.OSInfo @run main MouseModifiersUnitTest_Extra */ -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; import java.awt.*; import java.awt.event.*; diff --git a/jdk/test/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java b/jdk/test/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java index 8005c03de78..179dfbae263 100644 --- a/jdk/test/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java +++ b/jdk/test/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java @@ -27,6 +27,8 @@ @summary Frame is not created on the specified GraphicsDevice with two monitors @author Oleg Pekhovskiy + @library ../../../../lib/testlibrary + @build jdk.testlibrary.OSInfo @run main MultiScreenInsetsTest */ @@ -37,7 +39,7 @@ import java.awt.GraphicsEnvironment; import java.awt.Insets; import java.awt.Rectangle; import java.awt.Toolkit; -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; public class MultiScreenInsetsTest { private static final int SIZE = 100; diff --git a/jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java b/jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java index 4578798066e..a46b7985c45 100644 --- a/jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java +++ b/jdk/test/java/awt/Toolkit/ToolkitPropertyTest/bug7129133.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014 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 @@ -26,6 +26,8 @@ * @bug 7129133 * @summary [macosx] Accelerators are displayed as Meta instead of the Command symbol * @author leonid.romanov@oracle.com + * @library ../../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo * @run main bug7129133 */ @@ -33,7 +35,7 @@ import java.awt.*; public class bug7129133 { public static void main(String[] args) throws Exception { - if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) { + if (jdk.testlibrary.OSInfo.getOSType() != jdk.testlibrary.OSInfo.OSType.MACOSX) { System.out.println("This test is for MacOS only. Automatically passed on other platforms."); return; } diff --git a/jdk/test/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.html b/jdk/test/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.html index acaf89c4e28..52a2cccb0b3 100644 --- a/jdk/test/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.html +++ b/jdk/test/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.html @@ -28,7 +28,9 @@ @bug 6284070 @summary Tests that ActionEvent is generated when a tray icon is double-clicked @library ../../regtesthelpers + @library ../../../../lib/testlibrary @build Sysout + @build jdk.testlibrary.OSInfo @author artem.ananiev: area=awt.tray @run applet/manual=yesno DblClickActionEventTest.html --> diff --git a/jdk/test/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.java b/jdk/test/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.java index 1be8aa5b847..5ce3de574c7 100644 --- a/jdk/test/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.java +++ b/jdk/test/java/awt/TrayIcon/DblClickActionEventTest/DblClickActionEventTest.java @@ -37,7 +37,7 @@ import java.awt.*; import java.awt.event.*; import java.awt.image.*; -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; import test.java.awt.regtesthelpers.Sysout; public class DblClickActionEventTest extends Applet { diff --git a/jdk/test/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.html b/jdk/test/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.html index 2fe33ad59fa..fdae685c274 100644 --- a/jdk/test/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.html +++ b/jdk/test/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.html @@ -29,7 +29,9 @@ @summary Tests that no NPE is thrown when the tray icon is disposed from the handler of action event caused by clicking on this icon. @library ../../regtesthelpers + @library ../../../../lib/testlibrary @build Sysout + @build jdk.testlibrary.OSInfo @author artem.ananiev: area=awt.tray @run applet/manual=yesno DisposeInActionEventTest.html --> diff --git a/jdk/test/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.java b/jdk/test/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.java index f5eddec8c07..e41072a2fdc 100644 --- a/jdk/test/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.java +++ b/jdk/test/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.java @@ -38,7 +38,7 @@ import java.applet.*; import java.awt.*; import java.awt.image.*; -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; import test.java.awt.regtesthelpers.Sysout; public class DisposeInActionEventTest extends Applet { diff --git a/jdk/test/java/awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java index 1fe616abbc5..7870b96ed61 100644 --- a/jdk/test/java/awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java +++ b/jdk/test/java/awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java @@ -26,8 +26,10 @@ @bug 7075105 @summary WIN: Provide a way to format HTML on drop @author Denis Fokin: area=datatransfer + @library ../../../../lib/testlibrary @build HtmlTransferable PutAllHtmlFlavorsOnClipboard @build PutOnlyAllHtmlFlavorOnClipboard PutSelectionAndFragmentHtmlFlavorsOnClipboard + @build jdk.testlibrary.OSInfo @run main HTMLDataFlavorTest */ @@ -43,7 +45,7 @@ public class HTMLDataFlavorTest { public static void main(String[] args) throws IOException, UnsupportedFlavorException { - if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.WINDOWS) { + if (jdk.testlibrary.OSInfo.getOSType() != jdk.testlibrary.OSInfo.OSType.WINDOWS) { System.err.println("This test is for MS Windows only. Considered passed."); return; } diff --git a/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html index 7f2a48d9a8d..7a9730ed840 100644 --- a/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html +++ b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html @@ -29,8 +29,10 @@ @author mikhail.cherkasov@oracle.com @library ../../regtesthelpers @library ../../regtesthelpers/process + @library ../../../../lib/testlibrary @build Util @build ProcessResults ProcessCommunicator + @build jdk.testlibrary.OSInfo @run applet/othervm MissedHtmlAndRtfBug.html --> diff --git a/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java index 4c303cc9cc9..35138db30f0 100644 --- a/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java +++ b/jdk/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java @@ -31,7 +31,7 @@ import java.util.ArrayList; import test.java.awt.regtesthelpers.process.ProcessCommunicator; import test.java.awt.regtesthelpers.process.ProcessResults; import test.java.awt.regtesthelpers.Util; -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; import static java.lang.Thread.sleep; diff --git a/jdk/test/javax/swing/JCheckBox/4449413/bug4449413.java b/jdk/test/javax/swing/JCheckBox/4449413/bug4449413.java index 4fd8efdb5f4..c55287906bc 100644 --- a/jdk/test/javax/swing/JCheckBox/4449413/bug4449413.java +++ b/jdk/test/javax/swing/JCheckBox/4449413/bug4449413.java @@ -25,6 +25,8 @@ * @bug 4449413 * @summary Tests that checkbox and radiobuttons' check marks are visible when background is black * @author Ilya Boyandin + * @library ../../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo * @run applet/manual=yesno bug4449413.html */ @@ -32,7 +34,7 @@ import javax.swing.*; import javax.swing.plaf.metal.*; import java.awt.event.*; import java.awt.*; -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; public class bug4449413 extends JApplet { diff --git a/jdk/test/javax/swing/JCheckBox/8032667/bug8032667_image_diff.java b/jdk/test/javax/swing/JCheckBox/8032667/bug8032667_image_diff.java index 09e6b623784..bc0b87b4b8b 100644 --- a/jdk/test/javax/swing/JCheckBox/8032667/bug8032667_image_diff.java +++ b/jdk/test/javax/swing/JCheckBox/8032667/bug8032667_image_diff.java @@ -28,11 +28,13 @@ import java.awt.image.BufferedImage; import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.SwingUtilities; -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; /* @test * @bug 8032667 * @summary [macosx] Components cannot be rendered in HiDPI to BufferedImage + * @library ../../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo * @run main bug8032667_image_diff */ public class bug8032667_image_diff { diff --git a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html index 902dda5b6c9..a016cfb956f 100644 --- a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html +++ b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html @@ -1,6 +1,6 @@ diff --git a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java index bc4b1a8ef43..46e20b459a6 100644 --- a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java +++ b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2014, 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 @@ -35,7 +35,7 @@ public class bug4150029 extends JApplet { private boolean res; public void init() { - if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.MACOSX) { + if (jdk.testlibrary.OSInfo.getOSType() == jdk.testlibrary.OSInfo.OSType.MACOSX) { try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (Exception e) { diff --git a/jdk/test/javax/swing/JFileChooser/6840086/bug6840086.java b/jdk/test/javax/swing/JFileChooser/6840086/bug6840086.java index 7a81d2fb8d8..7c5b9d8d06e 100644 --- a/jdk/test/javax/swing/JFileChooser/6840086/bug6840086.java +++ b/jdk/test/javax/swing/JFileChooser/6840086/bug6840086.java @@ -25,10 +25,12 @@ @bug 6840086 @summary JFileChooser lacks icons on top right when running on Windows 7 @author Pavel Porvatov + @library ../../../../lib/testlibrary + @build jdk.testlibrary.OSInfo @run main bug6840086 */ -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; import sun.awt.shell.ShellFolder; import java.awt.*; diff --git a/jdk/test/javax/swing/JFileChooser/8046391/bug8046391.java b/jdk/test/javax/swing/JFileChooser/8046391/bug8046391.java index ff2b48a5246..f900d052725 100644 --- a/jdk/test/javax/swing/JFileChooser/8046391/bug8046391.java +++ b/jdk/test/javax/swing/JFileChooser/8046391/bug8046391.java @@ -26,12 +26,14 @@ * @bug 8046391 * @summary JFileChooser hangs if displayed in Windows L&F * @author Alexey Ivanov + * @library ../../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo * @run main/othervm/timeout=10 bug8046391 */ import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; -import sun.awt.OSInfo; -import sun.awt.OSInfo.OSType; +import jdk.testlibrary.OSInfo; +import jdk.testlibrary.OSInfo.OSType; import javax.swing.JFileChooser; import javax.swing.SwingUtilities; diff --git a/jdk/test/javax/swing/JFrame/8016356/bug8016356.java b/jdk/test/javax/swing/JFrame/8016356/bug8016356.java index b5ee38ef3e0..46dee834097 100644 --- a/jdk/test/javax/swing/JFrame/8016356/bug8016356.java +++ b/jdk/test/javax/swing/JFrame/8016356/bug8016356.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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,8 +24,10 @@ /* @test @bug 8016356 @summary Any swing frame resizes ugly. - @run main bug8016356 @author Oleg Pekhovskiy + @library ../../../../lib/testlibrary + @build jdk.testlibrary.OSInfo + @run main bug8016356 */ import java.awt.AWTException; @@ -42,7 +44,7 @@ import java.awt.event.InputEvent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; public class bug8016356 { private static JFrame frame; diff --git a/jdk/test/javax/swing/JMenuItem/ShortcutNotDiplayed/ShortcutNotDisplayedTest.java b/jdk/test/javax/swing/JMenuItem/ShortcutNotDiplayed/ShortcutNotDisplayedTest.java index 3d8c541b90d..b20f27322fa 100644 --- a/jdk/test/javax/swing/JMenuItem/ShortcutNotDiplayed/ShortcutNotDisplayedTest.java +++ b/jdk/test/javax/swing/JMenuItem/ShortcutNotDiplayed/ShortcutNotDisplayedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -26,6 +26,8 @@ * @bug 7186371 * @summary [macosx] Main menu shortcuts not displayed * @author vera.akulova@oracle.com + * @library ../../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo * @run main/manual ShortcutNotDisplayedTest */ @@ -39,7 +41,7 @@ public class ShortcutNotDisplayedTest { static final String PASS_COMMAND = "pass"; public static void main(String[] args) throws Exception { - if (sun.awt.OSInfo.getOSType() != sun.awt.OSInfo.OSType.MACOSX) { + if (jdk.testlibrary.OSInfo.getOSType() != jdk.testlibrary.OSInfo.OSType.MACOSX) { System.out.println("This test is for MacOS only. Automatically passed on other platforms."); return; } diff --git a/jdk/test/javax/swing/JOptionPane/8024926/bug8024926.java b/jdk/test/javax/swing/JOptionPane/8024926/bug8024926.java index 185537f3b5b..8d8ce605623 100644 --- a/jdk/test/javax/swing/JOptionPane/8024926/bug8024926.java +++ b/jdk/test/javax/swing/JOptionPane/8024926/bug8024926.java @@ -27,13 +27,15 @@ import java.awt.Frame; import java.awt.TextArea; import javax.swing.JApplet; import javax.swing.JOptionPane; -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; /** * @test * @bug 8024926 8040279 * @summary [macosx] AquaIcon HiDPI support * @author Alexander Scherbatiy + * @library ../../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo * @run applet/manual=yesno bug8024926.html */ public class bug8024926 extends JApplet { diff --git a/jdk/test/javax/swing/JSlider/6579827/bug6579827.java b/jdk/test/javax/swing/JSlider/6579827/bug6579827.java index 636e87a1af3..9fa39628107 100644 --- a/jdk/test/javax/swing/JSlider/6579827/bug6579827.java +++ b/jdk/test/javax/swing/JSlider/6579827/bug6579827.java @@ -25,10 +25,12 @@ * @bug 6579827 * @summary vista : JSlider on JColorchooser is not properly render or can't be seen completely * @author Pavel Porvatov + * @library ../../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo @run main bug6579827 */ -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; import javax.swing.*; import java.awt.*; diff --git a/jdk/test/javax/swing/JTabbedPane/6416920/bug6416920.java b/jdk/test/javax/swing/JTabbedPane/6416920/bug6416920.java index c1188ce9929..7ce702a1595 100644 --- a/jdk/test/javax/swing/JTabbedPane/6416920/bug6416920.java +++ b/jdk/test/javax/swing/JTabbedPane/6416920/bug6416920.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, 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 @@ -27,6 +27,8 @@ * @summary Ensures that selected tab is painted properly in the scroll tab layout * under WindowsLookAndFeel in Windows' "Windows XP" theme. * @author Mikhail Lapshin + * @library ../../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo * @run main bug6416920 */ @@ -35,7 +37,7 @@ import javax.swing.JTabbedPane; import javax.swing.SwingConstants; import java.awt.Rectangle; import java.awt.Insets; -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; public class bug6416920 extends BasicTabbedPaneUI { public AccessibleTabbedPaneLayout layout = new AccessibleTabbedPaneLayout(); diff --git a/jdk/test/javax/swing/JTextArea/6940863/bug6940863.java b/jdk/test/javax/swing/JTextArea/6940863/bug6940863.java index b868d41adfc..2a18478009c 100644 --- a/jdk/test/javax/swing/JTextArea/6940863/bug6940863.java +++ b/jdk/test/javax/swing/JTextArea/6940863/bug6940863.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2014, 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,10 +25,12 @@ * @bug 6940863 * @summary Textarea within scrollpane shows vertical scrollbar * @author Pavel Porvatov + * @library ../../../../lib/testlibrary + * @build jdk.testlibrary.OSInfo * @run main bug6940863 */ -import sun.awt.OSInfo; +import jdk.testlibrary.OSInfo; import javax.swing.*; import java.awt.*; From 8926b93e20ad7369e91309dd9c1bdd1718af42af Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Fri, 19 Sep 2014 09:59:36 +0200 Subject: [PATCH 46/81] 8055189: Cleanup gensrc after source code restructure Reviewed-by: ihse, tbell --- jdk/make/gensrc/Gensrc-jdk.attach.gmk | 34 ------------- jdk/make/gensrc/Gensrc-jdk.charsets.gmk | 54 ++++++++++++++++++++- jdk/make/gensrc/Gensrc-jdk.jdi.gmk | 45 ++++++++++++++++- jdk/make/gensrc/GensrcCharsetMapping.gmk | 62 ++++-------------------- jdk/make/gensrc/GensrcJDWP.gmk | 51 ------------------- jdk/make/gensrc/GensrcProviders.gmk | 42 ---------------- 6 files changed, 105 insertions(+), 183 deletions(-) delete mode 100644 jdk/make/gensrc/Gensrc-jdk.attach.gmk delete mode 100644 jdk/make/gensrc/GensrcJDWP.gmk delete mode 100644 jdk/make/gensrc/GensrcProviders.gmk diff --git a/jdk/make/gensrc/Gensrc-jdk.attach.gmk b/jdk/make/gensrc/Gensrc-jdk.attach.gmk deleted file mode 100644 index a3cff05e1aa..00000000000 --- a/jdk/make/gensrc/Gensrc-jdk.attach.gmk +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 2011, 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. -# - -include GensrcCommon.gmk - -include GensrcProviders.gmk - -jdk.attach: $(GENSRC_JDK_ATTACH) - -all: jdk.attach - -.PHONY: all jdk.attach diff --git a/jdk/make/gensrc/Gensrc-jdk.charsets.gmk b/jdk/make/gensrc/Gensrc-jdk.charsets.gmk index 066d4851056..931b969a0dc 100644 --- a/jdk/make/gensrc/Gensrc-jdk.charsets.gmk +++ b/jdk/make/gensrc/Gensrc-jdk.charsets.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2014, 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,10 +25,60 @@ include GensrcCommon.gmk -include GensrcCharsetMapping.gmk +################################################################################ +# +# Generate files using the charsetmapping tool +# +CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping +CHARSET_GENSRC_JAVA_DIR_CS := $(JDK_OUTPUTDIR)/gensrc/jdk.charsets/sun/nio/cs/ext +CHARSET_DONE_CS := $(CHARSET_GENSRC_JAVA_DIR_CS)/_the.charsetmapping +CHARSET_COPYRIGHT_HEADER := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping +CHARSET_TEMPLATES := \ + $(CHARSET_DATA_DIR)/SingleByte-X.java.template \ + $(CHARSET_DATA_DIR)/DoubleByte-X.java.template + +$(CHARSET_DONE_CS)-extsbcs: $(CHARSET_DATA_DIR)/extsbcs \ + $(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK) + $(MKDIR) -p $(@D) + $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) extsbcs + $(TOUCH) '$@' + +$(CHARSET_DONE_CS)-dbcs: $(CHARSET_DATA_DIR)/dbcs \ + $(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK) + $(MKDIR) -p $(@D) + $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) dbcs + $(TOUCH) '$@' + +$(CHARSET_DONE_CS)-hkscs: $(CHARSET_COPYRIGHT_HEADER)/HKSCS.java \ + $(BUILD_TOOLS_JDK) + $(MKDIR) -p $(@D) + $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) hkscs '$<' + $(TOUCH) '$@' + +$(CHARSET_DONE_CS)-euctw: $(CHARSET_COPYRIGHT_HEADER)/EUC_TW.java \ + $(BUILD_TOOLS_JDK) + $(MKDIR) -p $(@D) + $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) euctw '$<' + $(TOUCH) '$@' + +$(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat: $(CHARSET_DATA_DIR)/sjis0213.map \ + $(BUILD_TOOLS_JDK) + $(MKDIR) -p $(@D) + $(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213 + +GENSRC_JDK_CHARSETS += \ + $(CHARSET_DONE_CS)-extsbcs \ + $(CHARSET_DONE_CS)-dbcs \ + $(CHARSET_DONE_CS)-hkscs \ + $(CHARSET_DONE_CS)-euctw \ + $(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat \ + # + +################################################################################ jdk.charsets: $(GENSRC_JDK_CHARSETS) all: jdk.charsets .PHONY: all jdk.charsets + diff --git a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk index 16d61d317eb..0f82955eb5e 100644 --- a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk +++ b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk @@ -25,8 +25,49 @@ include GensrcCommon.gmk -include GensrcJDWP.gmk -include GensrcProviders.gmk +################################################################################ +# Translate the Java debugger wire protocol (jdwp.spec) file into a JDWP.java file +# and a JDWPCommands.h C-header file. + +JDWP_SPEC_FILE := $(JDK_TOPDIR)/make/data/jdwp/jdwp.spec + +$(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h: $(JDWP_SPEC_FILE) + +$(JDK_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java: \ + $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK) + $(MKDIR) -p $(@D) + $(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_jdwp_headers + $(RM) $@ $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h + $(ECHO) $(LOG_INFO) Creating JDWP.java and JDWPCommands.h from jdwp.spec + $(TOOL_JDWPGEN) $< -jdi $@ -include $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h + +$(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html: $(JDWP_SPEC_FILE) \ + $(BUILD_TOOLS_JDK) + $(MKDIR) -p $(@D) + $(RM) $@ + $(ECHO) $(LOG_INFO) Creating $(@F) from jdwp.spec + $(TOOL_JDWPGEN) $< -doc $@ + +GENSRC_JDWP := $(JDK_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java \ + $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h \ + $(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html +GENSRC_JDK_JDI += $(GENSRC_JDWP) + +################################################################################ + +define process-provider + $(MKDIR) -p $(@D) + $(CAT) $^ | $(SED) -e "s/^#\[$(OPENJDK_TARGET_OS)\]//" > $@ +endef + +# Filter com.sun.jdi.connect.Connector +$(JDK_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \ + $(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector + $(process-provider) + +GENSRC_JDK_JDI += $(JDK_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector + +################################################################################ jdk.jdi: $(GENSRC_JDK_JDI) diff --git a/jdk/make/gensrc/GensrcCharsetMapping.gmk b/jdk/make/gensrc/GensrcCharsetMapping.gmk index 51f83c2701b..a44dd887ac9 100644 --- a/jdk/make/gensrc/GensrcCharsetMapping.gmk +++ b/jdk/make/gensrc/GensrcCharsetMapping.gmk @@ -23,71 +23,29 @@ # questions. # -GENSRC_CHARSETMAPPING := - +################################################################################ +# +# Generate files using the charsetmapping tool +# CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping - -### -### Generate files using the charsetmapping tool -### - -CHARSET_GENSRC_JAVA_DIR_CS := $(JDK_OUTPUTDIR)/gensrc/jdk.charsets/sun/nio/cs/ext CHARSET_GENSRC_JAVA_DIR_BASE := $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/cs -CHARSET_DONE_CS := $(CHARSET_GENSRC_JAVA_DIR_CS)/_the.charsetmapping CHARSET_DONE_BASE := $(CHARSET_GENSRC_JAVA_DIR_BASE)/_the.charsetmapping -CHARSET_COPYRIGHT_HEADER_BASE := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping CHARSET_TEMPLATES := \ $(CHARSET_DATA_DIR)/SingleByte-X.java.template \ $(CHARSET_DATA_DIR)/DoubleByte-X.java.template -# This target should be referenced using the order-only operator (|) -$(CHARSET_GENSRC_JAVA_DIR_CS): - $(ECHO) "Generating charset mappings" - $(MKDIR) -p $(CHARSET_GENSRC_JAVA_DIR_CS) - $(MKDIR) -p $(CHARSET_GENSRC_JAVA_DIR_BASE) - $(CHARSET_DONE_BASE)-sbcs: $(CHARSET_DATA_DIR)/sbcs \ - $(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK) | $(CHARSET_GENSRC_JAVA_DIR_CS) + $(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK) + $(MKDIR) -p $(@D) $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) sbcs $(TOUCH) '$@' -$(CHARSET_DONE_CS)-extsbcs: $(CHARSET_DATA_DIR)/extsbcs \ - $(CHARSET_DONE_BASE)-sbcs $(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK) - $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) extsbcs - $(TOUCH) '$@' - -$(CHARSET_DONE_CS)-dbcs: $(CHARSET_DATA_DIR)/dbcs \ - $(CHARSET_DONE_BASE)-sbcs $(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK) - $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) dbcs - $(TOUCH) '$@' - -$(CHARSET_DONE_CS)-hkscs: $(CHARSET_COPYRIGHT_HEADER_BASE)/HKSCS.java \ - $(CHARSET_DONE_BASE)-sbcs $(BUILD_TOOLS_JDK) - $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) hkscs '$<' - $(TOUCH) '$@' - -$(CHARSET_DONE_CS)-euctw: $(CHARSET_COPYRIGHT_HEADER_BASE)/EUC_TW.java \ - $(CHARSET_DONE_BASE)-sbcs $(BUILD_TOOLS_JDK) - $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) euctw '$<' - $(TOUCH) '$@' - -$(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat: $(CHARSET_DATA_DIR)/sjis0213.map \ - $(CHARSET_DONE_BASE)-sbcs $(BUILD_TOOLS_JDK) - $(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213 - GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-sbcs -GENSRC_JDK_CHARSETS += \ - $(CHARSET_DONE_CS)-extsbcs \ - $(CHARSET_DONE_CS)-dbcs \ - $(CHARSET_DONE_CS)-hkscs \ - $(CHARSET_DONE_CS)-euctw \ - $(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat \ - # - -### -### Generate the sun/nio/cs/StandardCharsets.java file -### +################################################################################ +# +# Generate the sun/nio/cs/StandardCharsets.java file +# CHARSET_STANDARD_GENSRC_DIR := $(JDK_OUTPUTDIR)/gensrc/standardcharsets CHARSET_STANDARD_DATA := $(CHARSET_DATA_DIR)/standard-charsets CHARSET_STANDARD_JAVA := sun/nio/cs/StandardCharsets.java diff --git a/jdk/make/gensrc/GensrcJDWP.gmk b/jdk/make/gensrc/GensrcJDWP.gmk deleted file mode 100644 index 6085c62d810..00000000000 --- a/jdk/make/gensrc/GensrcJDWP.gmk +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright (c) 2011, 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. -# - -# Translate the Java debugger wire protocol (jdwp.spec) file into a JDWP.java file -# and a JDWPCommands.h C-header file. - -JDWP_SPEC_FILE := $(JDK_TOPDIR)/make/data/jdwp/jdwp.spec - -$(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h: $(JDWP_SPEC_FILE) - -$(JDK_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java: \ - $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK) - $(MKDIR) -p $(@D) - $(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_jdwp_headers - $(RM) $@ $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h - $(ECHO) $(LOG_INFO) Creating JDWP.java and JDWPCommands.h from jdwp.spec - $(TOOL_JDWPGEN) $< -jdi $@ -include $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h - -$(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html: $(JDWP_SPEC_FILE) \ - $(BUILD_TOOLS_JDK) - $(MKDIR) -p $(@D) - $(RM) $@ - $(ECHO) $(LOG_INFO) Creating $(@F) from jdwp.spec - $(TOOL_JDWPGEN) $< -doc $@ - -GENSRC_JDWP := $(JDK_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java \ - $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h \ - $(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html -GENSRC_JDK_JDI += $(GENSRC_JDWP) diff --git a/jdk/make/gensrc/GensrcProviders.gmk b/jdk/make/gensrc/GensrcProviders.gmk deleted file mode 100644 index dca14083054..00000000000 --- a/jdk/make/gensrc/GensrcProviders.gmk +++ /dev/null @@ -1,42 +0,0 @@ -# -# Copyright (c) 2014, 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. -# - -################################################################################ - -define process-provider - $(MKDIR) -p $(@D) - $(CAT) $^ | $(SED) -e "s/^#\[$(OPENJDK_TARGET_OS)\]//" > $@ -endef - -################################################################################ - -# Filter com.sun.jdi.connect.Connector -$(JDK_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \ - $(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector - $(process-provider) - -GENSRC_JDK_JDI += $(JDK_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector - -################################################################################ From 9dd233271c91810552719f8b075f33d2f59a6c16 Mon Sep 17 00:00:00 2001 From: Pooja Chopra Date: Fri, 19 Sep 2014 13:00:17 +0400 Subject: [PATCH 47/81] 8058635: [TEST_BUG] sun/awt/datatransfer/SuplementaryCharactersTransferTest.java fails with Compilation error Reviewed-by: serb, alexsch --- .../datatransfer/SuplementaryCharactersTransferTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jdk/test/sun/awt/datatransfer/SuplementaryCharactersTransferTest.java b/jdk/test/sun/awt/datatransfer/SuplementaryCharactersTransferTest.java index 0075701960c..6578808d8dd 100644 --- a/jdk/test/sun/awt/datatransfer/SuplementaryCharactersTransferTest.java +++ b/jdk/test/sun/awt/datatransfer/SuplementaryCharactersTransferTest.java @@ -35,6 +35,7 @@ import java.awt.*; import java.awt.datatransfer.*; import sun.awt.datatransfer.*; import sun.awt.datatransfer.DataTransferer.ReencodingInputStream; +import sun.datatransfer.DataFlavorUtil; public class SuplementaryCharactersTransferTest { @@ -46,7 +47,7 @@ public class SuplementaryCharactersTransferTest { dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2"); ByteTransferable transferable = new ByteTransferable(); ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT, - DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable); + DataFlavorUtil.getTextCharset(transferable.getDataFlavor()), transferable); byte[] bytes = transferable.getBytes(); byte[] result = new byte[bytes.length]; @@ -161,4 +162,5 @@ public class SuplementaryCharactersTransferTest { throw new UnsupportedOperationException("Not supported yet."); } } -} \ No newline at end of file +} + From db75425e0a7b7567f868d1a1328795e640873a3b Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Fri, 19 Sep 2014 11:53:01 +0200 Subject: [PATCH 48/81] 8058797: Building with sjavac broken after JDK-8058118 Reviewed-by: ihse --- make/common/JavaCompilation.gmk | 1 + make/common/Modules.gmk | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk index 32753d2e9cf..5c3ea73ca7d 100644 --- a/make/common/JavaCompilation.gmk +++ b/make/common/JavaCompilation.gmk @@ -443,6 +443,7 @@ define SetupJavaCompilation # source roots from SRC. This is sometimes needed when compiling specific subsets of the source. # HEADERS:=path to directory where all generated c-headers are written. # DEPENDS:=Extra dependecy + # DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit. $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) $(call LogSetupMacroEntry,SetupJavaCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk)) diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk index 248f3ab6dbe..99216b55b3c 100644 --- a/make/common/Modules.gmk +++ b/make/common/Modules.gmk @@ -67,7 +67,8 @@ $(eval $(call SetupJavaCompilation,BUILD_GENMODULESLIST, \ SETUP := BOOT_JAVAC, \ SRC := $(JDK_TOPDIR)/make/src/classes, \ INCLUDES := build/tools/module, \ - BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist)) + BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \ + DISABLE_SJAVAC := true)) TOOL_GENMODULESLIST = $(JAVA_SMALL) \ -cp "$(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist" \ From 7cb28afba61a6ba0432a2108761056f64fb3df7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Fri, 19 Sep 2014 13:13:20 +0200 Subject: [PATCH 49/81] 8046202: Make persistent code store more flexible Reviewed-by: lagergren, sundar --- .../nashorn/internal/runtime/CodeStore.java | 320 ++++++++++++------ .../jdk/nashorn/internal/runtime/Context.java | 15 +- .../internal/runtime/FunctionInitializer.java | 11 + .../RecompilableScriptFunctionData.java | 5 +- .../internal/runtime/StoredScript.java | 21 +- 5 files changed, 257 insertions(+), 115 deletions(-) diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java index 8d793203fee..a736cc360f8 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java @@ -34,51 +34,42 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; +import java.security.AccessControlException; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.util.Iterator; import java.util.Map; +import java.util.ServiceLoader; import jdk.nashorn.internal.codegen.types.Type; import jdk.nashorn.internal.runtime.logging.DebugLogger; import jdk.nashorn.internal.runtime.logging.Loggable; import jdk.nashorn.internal.runtime.logging.Logger; +import jdk.nashorn.internal.runtime.options.Options; /** * A code cache for persistent caching of compiled scripts. */ @Logger(name="codestore") -final class CodeStore implements Loggable { +public abstract class CodeStore implements Loggable { - private final File dir; - private final int minSize; - private final DebugLogger log; + /** + * Permission needed to provide a CodeStore instance via ServiceLoader. + */ + public final static String NASHORN_PROVIDE_CODE_STORE = "nashorn.provideCodeStore"; - // Default minimum size for storing a compiled script class - private final static int DEFAULT_MIN_SIZE = 1000; + private DebugLogger log; /** * Constructor - * @throws IOException */ - public CodeStore(final Context context, final String path) throws IOException { - this(context, path, DEFAULT_MIN_SIZE); - } - - /** - * Constructor - * @param path directory to store code in - * @param minSize minimum file size for caching scripts - * @throws IOException - */ - public CodeStore(final Context context, final String path, final int minSize) throws IOException { - this.dir = checkDirectory(path); - this.minSize = minSize; - this.log = initLogger(context); + protected CodeStore() { } @Override public DebugLogger initLogger(final Context context) { - return context.getLogger(getClass()); + log = context.getLogger(getClass()); + return log; } @Override @@ -86,29 +77,101 @@ final class CodeStore implements Loggable { return log; } - private static File checkDirectory(final String path) throws IOException { + /** + * Returns a new code store instance. + * + * @param context the current context + * @return The instance + * @throws IOException If an error occurs + */ + public static CodeStore newCodeStore(final Context context) throws IOException { + final Class baseClass = CodeStore.class; try { - return AccessController.doPrivileged(new PrivilegedExceptionAction() { - @Override - public File run() throws IOException { - final File dir = new File(path).getAbsoluteFile(); - if (!dir.exists() && !dir.mkdirs()) { - throw new IOException("Could not create directory: " + dir.getPath()); - } else if (!dir.isDirectory()) { - throw new IOException("Not a directory: " + dir.getPath()); - } else if (!dir.canRead() || !dir.canWrite()) { - throw new IOException("Directory not readable or writable: " + dir.getPath()); - } - return dir; - } - }); - } catch (final PrivilegedActionException e) { - throw (IOException) e.getException(); + // security check first + final SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new RuntimePermission(NASHORN_PROVIDE_CODE_STORE)); + } + final ServiceLoader services = ServiceLoader.load(baseClass); + final Iterator iterator = services.iterator(); + if (iterator.hasNext()) { + final CodeStore store = iterator.next(); + store.initLogger(context).info("using code store provider ", store.getClass().getCanonicalName()); + return store; + } + } catch (final AccessControlException e) { + context.getLogger(CodeStore.class).warning("failed to load code store provider ", e); } + final CodeStore store = new DirectoryCodeStore(); + store.initLogger(context); + return store; } - private File getCacheFile(final Source source, final String functionKey) { - return new File(dir, source.getDigest() + '-' + functionKey); + + /** + * Store a compiled script in the cache. + * + * @param functionKey the function key + * @param source the source + * @param mainClassName the main class name + * @param classBytes a map of class bytes + * @param initializers the function initializers + * @param constants the constants array + * @param compilationId the compilation id + */ + public StoredScript store(final String functionKey, + final Source source, + final String mainClassName, + final Map classBytes, + final Map initializers, + final Object[] constants, + final int compilationId) { + return store(functionKey, source, storedScriptFor(source, mainClassName, classBytes, initializers, constants, compilationId)); + } + + /** + * Stores a compiled script. + * + * @param functionKey the function key + * @param source the source + * @param script The compiled script + * @return The compiled script or {@code null} if not stored + */ + public abstract StoredScript store(final String functionKey, + final Source source, + final StoredScript script); + + /** + * Return a compiled script from the cache, or null if it isn't found. + * + * @param source the source + * @param functionKey the function key + * @return the stored script or null + */ + public abstract StoredScript load(final Source source, final String functionKey); + + /** + * Returns a new StoredScript instance. + * + * @param mainClassName the main class name + * @param classBytes a map of class bytes + * @param initializers function initializers + * @param constants the constants array + * @param compilationId the compilation id + * @return The compiled script + */ + public StoredScript storedScriptFor(final Source source, final String mainClassName, + final Map classBytes, + final Map initializers, + final Object[] constants, final int compilationId) { + for (final Object constant : constants) { + // Make sure all constant data is serializable + if (!(constant instanceof Serializable)) { + getLogger().warning("cannot store ", source, " non serializable constant ", constant); + return null; + } + } + return new StoredScript(compilationId, mainClassName, classBytes, initializers, constants); } /** @@ -129,77 +192,130 @@ final class CodeStore implements Loggable { } /** - * Return a compiled script from the cache, or null if it isn't found. - * - * @param source the source - * @param functionKey the function key - * @return the stored script or null + * A store using a file system directory. */ - public StoredScript loadScript(final Source source, final String functionKey) { - if (source.getLength() < minSize) { - return null; + public static class DirectoryCodeStore extends CodeStore { + + // Default minimum size for storing a compiled script class + private final static int DEFAULT_MIN_SIZE = 1000; + + private final File dir; + private final boolean readOnly; + private final int minSize; + + /** + * Constructor + * + * @throws IOException + */ + public DirectoryCodeStore() throws IOException { + this(Options.getStringProperty("nashorn.persistent.code.cache", "nashorn_code_cache"), false, DEFAULT_MIN_SIZE); } - final File file = getCacheFile(source, functionKey); + /** + * Constructor + * + * @param path directory to store code in + * @param minSize minimum file size for caching scripts + * @throws IOException + */ + public DirectoryCodeStore(final String path, final boolean readOnly, final int minSize) throws IOException { + this.dir = checkDirectory(path, readOnly); + this.readOnly = readOnly; + this.minSize = minSize; + } - try { - return AccessController.doPrivileged(new PrivilegedExceptionAction() { - @Override - public StoredScript run() throws IOException, ClassNotFoundException { - if (!file.exists()) { - return null; + private static File checkDirectory(final String path, final boolean readOnly) throws IOException { + try { + return AccessController.doPrivileged(new PrivilegedExceptionAction() { + @Override + public File run() throws IOException { + final File dir = new File(path).getAbsoluteFile(); + if (readOnly) { + if (!dir.exists() || !dir.isDirectory()) { + throw new IOException("Not a directory: " + dir.getPath()); + } else if (!dir.canRead()) { + throw new IOException("Directory not readable: " + dir.getPath()); + } + } else if (!dir.exists() && !dir.mkdirs()) { + throw new IOException("Could not create directory: " + dir.getPath()); + } else if (!dir.isDirectory()) { + throw new IOException("Not a directory: " + dir.getPath()); + } else if (!dir.canRead() || !dir.canWrite()) { + throw new IOException("Directory not readable or writable: " + dir.getPath()); + } + return dir; } - try (ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file)))) { - final StoredScript storedScript = (StoredScript) in.readObject(); - getLogger().info("loaded ", source, "-", functionKey); - return storedScript; - } - } - }); - } catch (final PrivilegedActionException e) { - getLogger().warning("failed to load ", source, "-", functionKey, ": ", e.getException()); - return null; - } - } - - /** - * Store a compiled script in the cache. - * - * @param functionKey the function key - * @param source the source - * @param mainClassName the main class name - * @param classBytes a map of class bytes - * @param constants the constants array - */ - public void storeScript(final String functionKey, final Source source, final String mainClassName, final Map classBytes, - final Map initializers, final Object[] constants, final int compilationId) { - if (source.getLength() < minSize) { - return; - } - for (final Object constant : constants) { - // Make sure all constant data is serializable - if (! (constant instanceof Serializable)) { - getLogger().warning("cannot store ", source, " non serializable constant ", constant); - return; + }); + } catch (final PrivilegedActionException e) { + throw (IOException) e.getException(); } } - final File file = getCacheFile(source, functionKey); - final StoredScript script = new StoredScript(compilationId, mainClassName, classBytes, initializers, constants); + @Override + public StoredScript load(final Source source, final String functionKey) { + if (source.getLength() < minSize) { + return null; + } - try { - AccessController.doPrivileged(new PrivilegedExceptionAction() { - @Override - public Void run() throws IOException { - try (ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)))) { - out.writeObject(script); + final File file = getCacheFile(source, functionKey); + + try { + return AccessController.doPrivileged(new PrivilegedExceptionAction() { + @Override + public StoredScript run() throws IOException, ClassNotFoundException { + if (!file.exists()) { + return null; + } + try (ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file)))) { + final StoredScript storedScript = (StoredScript) in.readObject(); + getLogger().info("loaded ", source, "-", functionKey); + return storedScript; + } } - getLogger().info("stored ", source, "-", functionKey); - return null; - } - }); - } catch (final PrivilegedActionException e) { - getLogger().warning("failed to store ", script, "-", functionKey, ": ", e.getException()); + }); + } catch (final PrivilegedActionException e) { + getLogger().warning("failed to load ", source, "-", functionKey, ": ", e.getException()); + return null; + } + } + + @Override + public StoredScript store(final String functionKey, final Source source, final StoredScript script) { + if (readOnly || script == null || belowThreshold(source)) { + return null; + } + + final File file = getCacheFile(source, functionKey); + + try { + return AccessController.doPrivileged(new PrivilegedExceptionAction() { + @Override + public StoredScript run() throws IOException { + try (ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)))) { + out.writeObject(script); + } + getLogger().info("stored ", source, "-", functionKey); + return script; + } + }); + } catch (final PrivilegedActionException e) { + getLogger().warning("failed to store ", script, "-", functionKey, ": ", e.getException()); + return null; + } + } + + + private File getCacheFile(final Source source, final String functionKey) { + return new File(dir, source.getDigest() + '-' + functionKey); + } + + private boolean belowThreshold(final Source source) { + if (source.getLength() < minSize) { + getLogger().info("below size threshold ", source); + return true; + } + return false; } } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java index c144d363427..aa3306a4633 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java @@ -29,6 +29,7 @@ import static jdk.nashorn.internal.codegen.CompilerConstants.CONSTANTS; import static jdk.nashorn.internal.codegen.CompilerConstants.CREATE_PROGRAM_FUNCTION; import static jdk.nashorn.internal.codegen.CompilerConstants.SOURCE; import static jdk.nashorn.internal.codegen.CompilerConstants.STRICT_MODE; +import static jdk.nashorn.internal.runtime.CodeStore.newCodeStore; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; import static jdk.nashorn.internal.runtime.Source.sourceFor; @@ -200,14 +201,14 @@ public final class Context { final Map classBytes, final Map initializers, final Object[] constants, final int compilationId) { if (context.codeStore != null) { - context.codeStore.storeScript(cacheKey, source, mainClassName, classBytes, initializers, constants, compilationId); + context.codeStore.store(cacheKey, source, mainClassName, classBytes, initializers, constants, compilationId); } } @Override public StoredScript loadScript(final Source source, final String functionKey) { if (context.codeStore != null) { - return context.codeStore.loadScript(source, functionKey); + return context.codeStore.load(source, functionKey); } return null; } @@ -463,8 +464,7 @@ public final class Context { if (env._persistent_cache) { try { - final String cacheDir = Options.getStringProperty("nashorn.persistent.code.cache", "nashorn_code_cache"); - codeStore = new CodeStore(this, cacheDir); + codeStore = newCodeStore(this); } catch (final IOException e) { throw new RuntimeException("Error initializing code cache", e); } @@ -1117,7 +1117,7 @@ public final class Context { final String cacheKey = useCodeStore ? CodeStore.getCacheKey(0, null) : null; if (useCodeStore) { - storedScript = codeStore.loadScript(source, cacheKey); + storedScript = codeStore.load(source, cacheKey); } if (storedScript == null) { @@ -1194,15 +1194,16 @@ public final class Context { private static Class install(final StoredScript storedScript, final Source source, final CodeInstaller installer) { final Map> installedClasses = new HashMap<>(); + final Map classBytes = storedScript.getClassBytes(); final Object[] constants = storedScript.getConstants(); final String mainClassName = storedScript.getMainClassName(); - final byte[] mainClassBytes = storedScript.getClassBytes().get(mainClassName); + final byte[] mainClassBytes = classBytes.get(mainClassName); final Class mainClass = installer.install(mainClassName, mainClassBytes); final Map initialzers = storedScript.getInitializers(); installedClasses.put(mainClassName, mainClass); - for (final Map.Entry entry : storedScript.getClassBytes().entrySet()) { + for (final Map.Entry entry : classBytes.entrySet()) { final String className = entry.getKey(); if (className.equals(mainClassName)) { continue; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FunctionInitializer.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FunctionInitializer.java index e2912a25c3b..906024d7ffa 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FunctionInitializer.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FunctionInitializer.java @@ -59,6 +59,17 @@ public final class FunctionInitializer implements Serializable { this(functionNode, null); } + /** + * Copy constructor. + * + * @param init original initializer + */ + FunctionInitializer(final FunctionInitializer init) { + this.className = init.getClassName(); + this.methodType = init.getMethodType(); + this.flags = init.getFlags(); + } + /** * Constructor. * diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java index 5f5229ba3c3..2d5ccc05c6d 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java @@ -491,14 +491,15 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp private FunctionInitializer install(final StoredScript script) { final Map> installedClasses = new HashMap<>(); + final Map classBytes = script.getClassBytes(); final String mainClassName = script.getMainClassName(); - final byte[] mainClassBytes = script.getClassBytes().get(mainClassName); + final byte[] mainClassBytes = classBytes.get(mainClassName); final Class mainClass = installer.install(mainClassName, mainClassBytes); installedClasses.put(mainClassName, mainClass); - for (final Map.Entry entry : script.getClassBytes().entrySet()) { + for (final Map.Entry entry : classBytes.entrySet()) { final String className = entry.getKey(); final byte[] code = entry.getValue(); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java index 7a76b98383b..5b6a77b2926 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java @@ -27,6 +27,7 @@ package jdk.nashorn.internal.runtime; import java.io.Serializable; import java.util.Arrays; +import java.util.LinkedHashMap; import java.util.Map; /** @@ -83,7 +84,11 @@ public final class StoredScript implements Serializable { * @return map of class bytes */ public Map getClassBytes() { - return classBytes; + final Map clonedMap = new LinkedHashMap<>(); + for (final Map.Entry entry : classBytes.entrySet()) { + clonedMap.put(entry.getKey(), entry.getValue().clone()); + } + return clonedMap; } /** @@ -91,11 +96,19 @@ public final class StoredScript implements Serializable { * @return constants array */ public Object[] getConstants() { - return constants; + return constants.clone(); } - Map getInitializers() { - return initializers; + /** + * Returns the function initializers map. + * @return The initializers map. + */ + public Map getInitializers() { + final Map clonedMap = new LinkedHashMap<>(); + for (final Map.Entry entry : initializers.entrySet()) { + clonedMap.put(entry.getKey(), new FunctionInitializer(entry.getValue())); + } + return clonedMap; } @Override From 72e770ad773e6cce2a39a74be153d66385c7c7da Mon Sep 17 00:00:00 2001 From: Konstantin Shefov Date: Fri, 19 Sep 2014 16:49:08 +0400 Subject: [PATCH 50/81] 8058728: TEST_BUG: Make java/lang/invoke/LFCaching/LFGarbageCollectedTest.java skip arrayElementSetter and arrayElementGetter methods Reviewed-by: vlivanov, iignatyev, psandoz --- .../LFCaching/LFGarbageCollectedTest.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java index dfa6f58f567..3b9ed4dea74 100644 --- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java +++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java @@ -31,14 +31,13 @@ * @build TestMethods * @build LambdaFormTestCase * @build LFGarbageCollectedTest - * @run main/othervm/timeout=600 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true -DtestLimit=150 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI LFGarbageCollectedTest + * @run main/othervm/timeout=600 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true -DtestLimit=150 LFGarbageCollectedTest */ import java.lang.invoke.MethodHandle; import java.lang.ref.PhantomReference; import java.lang.ref.ReferenceQueue; import java.lang.reflect.InvocationTargetException; -import java.util.Arrays; import java.util.EnumSet; import java.util.Map; @@ -94,10 +93,16 @@ public final class LFGarbageCollectedTest extends LambdaFormTestCase { * @param args Accepts no arguments. */ public static void main(String[] args) { - // The "identity" and "constant" methods should be removed from this test, - // because their lambda forms are stored in a static filed and are not GC'ed. - // There can be only 5 such LFs for each method, so no memory leak happens. - EnumSet testMethods = EnumSet.complementOf(EnumSet.of(TestMethods.IDENTITY, TestMethods.CONSTANT)); + // The "identity", "constant", "arrayElementGetter" and "arrayElementSetter" + // methods should be removed from this test, + // because their lambda forms are stored in a static field and are not GC'ed. + // There can be only a finite number of such LFs for each method, + // so no memory leak happens. + EnumSet testMethods = EnumSet.complementOf(EnumSet.of( + TestMethods.IDENTITY, + TestMethods.CONSTANT, + TestMethods.ARRAY_ELEMENT_GETTER, + TestMethods.ARRAY_ELEMENT_SETTER)); LambdaFormTestCase.runTests(LFGarbageCollectedTest::new, testMethods); } } From fb0dfe332b87602cb8461b48fe63767d7af8445d Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 19 Sep 2014 09:41:05 -0700 Subject: [PATCH 51/81] 8056216: Remove "sun" directory layer from libawt and common Reviewed-by: erikj, ihse, coffeys --- jdk/make/gensrc/GensrcX11Wrappers.gmk | 6 +- jdk/make/lib/Awt2dLibraries.gmk | 150 +++++++++--------- .../libawt_lwawt/{sun => }/awt/AWTEvent.h | 0 .../libawt_lwawt/{sun => }/awt/AWTEvent.m | 0 .../{sun => }/awt/AWTSurfaceLayers.h | 0 .../{sun => }/awt/AWTSurfaceLayers.m | 0 .../libawt_lwawt/{sun => }/awt/AWTView.h | 0 .../libawt_lwawt/{sun => }/awt/AWTView.m | 0 .../libawt_lwawt/{sun => }/awt/AWTWindow.h | 0 .../libawt_lwawt/{sun => }/awt/AWTWindow.m | 0 .../{sun => }/awt/ApplicationDelegate.h | 0 .../{sun => }/awt/ApplicationDelegate.m | 0 .../libawt_lwawt/{sun => }/awt/CClipboard.m | 0 .../{sun => }/awt/CCursorManager.m | 0 .../{sun => }/awt/CDataTransferer.h | 0 .../{sun => }/awt/CDataTransferer.m | 0 .../libawt_lwawt/{sun => }/awt/CDesktopPeer.m | 0 .../libawt_lwawt/{sun => }/awt/CDragSource.h | 0 .../libawt_lwawt/{sun => }/awt/CDragSource.m | 0 .../{sun => }/awt/CDragSourceContextPeer.m | 0 .../libawt_lwawt/{sun => }/awt/CDropTarget.h | 0 .../libawt_lwawt/{sun => }/awt/CDropTarget.m | 0 .../{sun => }/awt/CDropTargetContextPeer.m | 0 .../{sun => }/awt/CFRetainedResource.m | 0 .../libawt_lwawt/{sun => }/awt/CFileDialog.h | 0 .../libawt_lwawt/{sun => }/awt/CFileDialog.m | 0 .../{sun => }/awt/CGraphicsConfig.m | 0 .../{sun => }/awt/CGraphicsDevice.m | 0 .../libawt_lwawt/{sun => }/awt/CGraphicsEnv.m | 0 .../libawt_lwawt/{sun => }/awt/CImage.m | 0 .../libawt_lwawt/{sun => }/awt/CInputMethod.m | 0 .../native/libawt_lwawt/{sun => }/awt/CMenu.h | 0 .../native/libawt_lwawt/{sun => }/awt/CMenu.m | 0 .../libawt_lwawt/{sun => }/awt/CMenuBar.h | 0 .../libawt_lwawt/{sun => }/awt/CMenuBar.m | 0 .../{sun => }/awt/CMenuComponent.h | 0 .../{sun => }/awt/CMenuComponent.m | 0 .../libawt_lwawt/{sun => }/awt/CMenuItem.h | 0 .../libawt_lwawt/{sun => }/awt/CMenuItem.m | 0 .../libawt_lwawt/{sun => }/awt/CPopupMenu.h | 0 .../libawt_lwawt/{sun => }/awt/CPopupMenu.m | 0 .../libawt_lwawt/{sun => }/awt/CPrinterJob.m | 0 .../libawt_lwawt/{sun => }/awt/CRobot.m | 0 .../{sun => }/awt/CSystemColors.h | 0 .../{sun => }/awt/CSystemColors.m | 0 .../libawt_lwawt/{sun => }/awt/CTextPipe.m | 0 .../libawt_lwawt/{sun => }/awt/CTrayIcon.h | 0 .../libawt_lwawt/{sun => }/awt/CTrayIcon.m | 0 .../libawt_lwawt/{sun => }/awt/CWrapper.m | 0 .../libawt_lwawt/{sun => }/awt/DnDUtilities.h | 0 .../libawt_lwawt/{sun => }/awt/DnDUtilities.m | 0 .../{sun => }/awt/GeomUtilities.h | 0 .../{sun => }/awt/GeomUtilities.m | 0 .../{sun => }/awt/ImageSurfaceData.h | 0 .../{sun => }/awt/ImageSurfaceData.m | 0 .../libawt_lwawt/{sun => }/awt/InitIDs.h | 0 .../libawt_lwawt/{sun => }/awt/InitIDs.m | 0 .../{sun => }/awt/JavaAccessibilityAction.h | 0 .../{sun => }/awt/JavaAccessibilityAction.m | 0 .../awt/JavaAccessibilityUtilities.h | 0 .../awt/JavaAccessibilityUtilities.m | 0 .../awt/JavaComponentAccessibility.h | 0 .../awt/JavaComponentAccessibility.m | 0 .../{sun => }/awt/JavaTextAccessibility.h | 0 .../{sun => }/awt/JavaTextAccessibility.m | 0 .../libawt_lwawt/{sun => }/awt/LWCToolkit.h | 0 .../libawt_lwawt/{sun => }/awt/LWCToolkit.m | 0 .../libawt_lwawt/{sun => }/awt/OSVersion.h | 0 .../libawt_lwawt/{sun => }/awt/OSVersion.m | 0 .../libawt_lwawt/{sun => }/awt/PrintModel.h | 0 .../libawt_lwawt/{sun => }/awt/PrintModel.m | 0 .../{sun => }/awt/PrinterSurfaceData.h | 0 .../{sun => }/awt/PrinterSurfaceData.m | 0 .../libawt_lwawt/{sun => }/awt/PrinterView.h | 0 .../libawt_lwawt/{sun => }/awt/PrinterView.m | 0 .../{sun => }/awt/QuartzRenderer.m | 0 .../{sun => }/awt/QuartzSurfaceData.h | 0 .../{sun => }/awt/QuartzSurfaceData.m | 0 .../{sun => }/awt/awt_DrawingSurface.m | 0 .../libawt_lwawt/{sun => }/font/AWTFont.h | 0 .../libawt_lwawt/{sun => }/font/AWTFont.m | 0 .../libawt_lwawt/{sun => }/font/AWTStrike.h | 0 .../libawt_lwawt/{sun => }/font/AWTStrike.m | 0 .../{sun => }/font/CCharToGlyphMapper.m | 0 .../{sun => }/font/CGGlyphImages.h | 0 .../{sun => }/font/CGGlyphImages.m | 0 .../{sun => }/font/CGGlyphOutlines.h | 0 .../{sun => }/font/CGGlyphOutlines.m | 0 .../{sun => }/font/CoreTextSupport.h | 0 .../{sun => }/font/CoreTextSupport.m | 0 .../java2d/opengl/CGLGraphicsConfig.h | 0 .../java2d/opengl/CGLGraphicsConfig.m | 0 .../{sun => }/java2d/opengl/CGLLayer.h | 0 .../{sun => }/java2d/opengl/CGLLayer.m | 0 .../{sun => }/java2d/opengl/CGLSurfaceData.h | 0 .../{sun => }/java2d/opengl/CGLSurfaceData.m | 0 .../{sun => }/java2d/opengl/J2D_GL/cglext.h | 0 .../{sun => }/java2d/opengl/OGLFuncs_md.h | 0 .../common/{sun => }/awt/debug/debug_assert.c | 0 .../common/{sun => }/awt/debug/debug_assert.h | 0 .../common/{sun => }/awt/debug/debug_mem.c | 0 .../common/{sun => }/awt/debug/debug_mem.h | 0 .../common/{sun => }/awt/debug/debug_trace.c | 0 .../common/{sun => }/awt/debug/debug_trace.h | 0 .../common/{sun => }/awt/debug/debug_util.c | 0 .../common/{sun => }/awt/debug/debug_util.h | 0 .../awt/medialib/mlib_ImageCopy_Bit.c | 0 .../{sun => }/awt/medialib/mlib_ImageCreate.c | 0 .../common/{sun => }/awt/medialib/mlib_sys.c | 0 .../common/{sun => }/awt/utility/rect.c | 0 .../common/{sun => }/font/AccelGlyphCache.c | 0 .../common/{sun => }/font/AccelGlyphCache.h | 0 .../common/{sun => }/font/fontscalerdefs.h | 0 .../native/common/{sun => }/font/sunfontids.h | 0 .../{sun => }/java2d/opengl/J2D_GL/gl.h | 0 .../{sun => }/java2d/opengl/J2D_GL/glext.h | 0 .../{sun => }/java2d/opengl/OGLBlitLoops.c | 0 .../{sun => }/java2d/opengl/OGLBlitLoops.h | 0 .../{sun => }/java2d/opengl/OGLBufImgOps.c | 0 .../{sun => }/java2d/opengl/OGLBufImgOps.h | 0 .../{sun => }/java2d/opengl/OGLContext.c | 0 .../{sun => }/java2d/opengl/OGLContext.h | 0 .../{sun => }/java2d/opengl/OGLFuncMacros.h | 0 .../common/{sun => }/java2d/opengl/OGLFuncs.c | 0 .../common/{sun => }/java2d/opengl/OGLFuncs.h | 0 .../{sun => }/java2d/opengl/OGLMaskBlit.c | 0 .../{sun => }/java2d/opengl/OGLMaskBlit.h | 0 .../{sun => }/java2d/opengl/OGLMaskFill.c | 0 .../{sun => }/java2d/opengl/OGLMaskFill.h | 0 .../{sun => }/java2d/opengl/OGLPaints.c | 0 .../{sun => }/java2d/opengl/OGLPaints.h | 0 .../{sun => }/java2d/opengl/OGLRenderQueue.c | 0 .../{sun => }/java2d/opengl/OGLRenderQueue.h | 0 .../{sun => }/java2d/opengl/OGLRenderer.c | 0 .../{sun => }/java2d/opengl/OGLRenderer.h | 0 .../{sun => }/java2d/opengl/OGLSurfaceData.c | 0 .../{sun => }/java2d/opengl/OGLSurfaceData.h | 0 .../{sun => }/java2d/opengl/OGLTextRenderer.c | 0 .../{sun => }/java2d/opengl/OGLTextRenderer.h | 0 .../{sun => }/java2d/opengl/OGLVertexCache.c | 0 .../{sun => }/java2d/opengl/OGLVertexCache.h | 0 .../{sun => }/awt/image/BufImgSurfaceData.c | 0 .../{sun => }/awt/image/BufImgSurfaceData.h | 0 .../{sun => }/awt/image/DataBufferNative.c | 0 .../libawt/{sun => }/awt/image/awt_ImageRep.c | 0 .../{sun => }/awt/image/awt_parseImage.c | 0 .../{sun => }/awt/image/awt_parseImage.h | 0 .../libawt/{sun => }/awt/image/cvutils/README | 0 .../{sun => }/awt/image/cvutils/img_alpha.h | 0 .../{sun => }/awt/image/cvutils/img_anycm.h | 0 .../{sun => }/awt/image/cvutils/img_colors.c | 0 .../{sun => }/awt/image/cvutils/img_colors.h | 0 .../{sun => }/awt/image/cvutils/img_dcm.h | 0 .../{sun => }/awt/image/cvutils/img_dcm8.h | 0 .../awt/image/cvutils/img_dir8dither.h | 0 .../awt/image/cvutils/img_dirdither.h | 0 .../{sun => }/awt/image/cvutils/img_fscolor.h | 0 .../awt/image/cvutils/img_fsdither.h | 0 .../{sun => }/awt/image/cvutils/img_fsgray.h | 0 .../{sun => }/awt/image/cvutils/img_fsutil.h | 0 .../{sun => }/awt/image/cvutils/img_globals.c | 0 .../{sun => }/awt/image/cvutils/img_globals.h | 0 .../{sun => }/awt/image/cvutils/img_icm.h | 0 .../{sun => }/awt/image/cvutils/img_input32.h | 0 .../{sun => }/awt/image/cvutils/img_input8.h | 0 .../awt/image/cvutils/img_input8_32.h | 0 .../awt/image/cvutils/img_nodither.h | 0 .../{sun => }/awt/image/cvutils/img_noscale.h | 0 .../{sun => }/awt/image/cvutils/img_opaque.h | 0 .../awt/image/cvutils/img_ordclrsgn.h | 0 .../awt/image/cvutils/img_ordclruns.h | 0 .../awt/image/cvutils/img_orddither.h | 0 .../{sun => }/awt/image/cvutils/img_ordgray.h | 0 .../awt/image/cvutils/img_output16.h | 0 .../awt/image/cvutils/img_output16_32.h | 0 .../awt/image/cvutils/img_output24.h | 0 .../awt/image/cvutils/img_output32.h | 0 .../{sun => }/awt/image/cvutils/img_output8.h | 0 .../awt/image/cvutils/img_output8_16_24.h | 0 .../awt/image/cvutils/img_output8_16_32.h | 0 .../awt/image/cvutils/img_output8_32.h | 0 .../awt/image/cvutils/img_replscale.h | 0 .../awt/image/cvutils/img_scaleloop.h | 0 .../{sun => }/awt/image/cvutils/img_util.h | 0 .../libawt/{sun => }/awt/image/dither.c | 0 .../libawt/{sun => }/awt/image/dither.h | 0 .../{sun => }/awt/image/gif/gifdecoder.c | 0 .../libawt/{sun => }/awt/image/imageInitIDs.c | 0 .../libawt/{sun => }/awt/image/imageInitIDs.h | 0 .../{sun => }/awt/medialib/awt_ImagingLib.c | 0 .../{sun => }/awt/medialib/awt_ImagingLib.h | 0 .../native/libawt/{sun => }/java2d/Disposer.c | 0 .../native/libawt/{sun => }/java2d/Disposer.h | 0 .../libawt/{sun => }/java2d/ShaderList.c | 0 .../libawt/{sun => }/java2d/ShaderList.h | 0 .../libawt/{sun => }/java2d/SurfaceData.c | 0 .../libawt/{sun => }/java2d/SurfaceData.h | 0 .../native/libawt/{sun => }/java2d/Trace.c | 0 .../native/libawt/{sun => }/java2d/Trace.h | 0 .../{sun => }/java2d/loops/AlphaMacros.c | 0 .../{sun => }/java2d/loops/AlphaMacros.h | 0 .../libawt/{sun => }/java2d/loops/AlphaMath.c | 0 .../libawt/{sun => }/java2d/loops/AlphaMath.h | 0 .../libawt/{sun => }/java2d/loops/Any3Byte.c | 0 .../libawt/{sun => }/java2d/loops/Any3Byte.h | 0 .../libawt/{sun => }/java2d/loops/Any4Byte.c | 0 .../libawt/{sun => }/java2d/loops/Any4Byte.h | 0 .../libawt/{sun => }/java2d/loops/AnyByte.c | 0 .../libawt/{sun => }/java2d/loops/AnyByte.h | 0 .../{sun => }/java2d/loops/AnyByteBinary.h | 0 .../libawt/{sun => }/java2d/loops/AnyInt.c | 0 .../libawt/{sun => }/java2d/loops/AnyInt.h | 0 .../libawt/{sun => }/java2d/loops/AnyShort.c | 0 .../libawt/{sun => }/java2d/loops/AnyShort.h | 0 .../libawt/{sun => }/java2d/loops/Blit.c | 0 .../libawt/{sun => }/java2d/loops/BlitBg.c | 0 .../{sun => }/java2d/loops/ByteBinary1Bit.c | 0 .../{sun => }/java2d/loops/ByteBinary1Bit.h | 0 .../{sun => }/java2d/loops/ByteBinary2Bit.c | 0 .../{sun => }/java2d/loops/ByteBinary2Bit.h | 0 .../{sun => }/java2d/loops/ByteBinary4Bit.c | 0 .../{sun => }/java2d/loops/ByteBinary4Bit.h | 0 .../libawt/{sun => }/java2d/loops/ByteGray.c | 0 .../libawt/{sun => }/java2d/loops/ByteGray.h | 0 .../{sun => }/java2d/loops/ByteIndexed.c | 0 .../{sun => }/java2d/loops/ByteIndexed.h | 0 .../libawt/{sun => }/java2d/loops/DrawLine.c | 0 .../java2d/loops/DrawParallelogram.c | 0 .../libawt/{sun => }/java2d/loops/DrawPath.c | 0 .../libawt/{sun => }/java2d/loops/DrawPath.h | 0 .../{sun => }/java2d/loops/DrawPolygons.c | 0 .../libawt/{sun => }/java2d/loops/DrawRect.c | 0 .../java2d/loops/FillParallelogram.c | 0 .../libawt/{sun => }/java2d/loops/FillPath.c | 0 .../libawt/{sun => }/java2d/loops/FillRect.c | 0 .../libawt/{sun => }/java2d/loops/FillSpans.c | 0 .../{sun => }/java2d/loops/FourByteAbgr.c | 0 .../{sun => }/java2d/loops/FourByteAbgr.h | 0 .../{sun => }/java2d/loops/FourByteAbgrPre.c | 0 .../{sun => }/java2d/loops/FourByteAbgrPre.h | 0 .../{sun => }/java2d/loops/GlyphImageRef.h | 0 .../java2d/loops/GraphicsPrimitiveMgr.c | 0 .../java2d/loops/GraphicsPrimitiveMgr.h | 0 .../libawt/{sun => }/java2d/loops/ImageData.h | 0 .../{sun => }/java2d/loops/Index12Gray.c | 0 .../{sun => }/java2d/loops/Index12Gray.h | 0 .../{sun => }/java2d/loops/Index8Gray.c | 0 .../{sun => }/java2d/loops/Index8Gray.h | 0 .../libawt/{sun => }/java2d/loops/IntArgb.c | 0 .../libawt/{sun => }/java2d/loops/IntArgb.h | 0 .../libawt/{sun => }/java2d/loops/IntArgbBm.c | 0 .../libawt/{sun => }/java2d/loops/IntArgbBm.h | 0 .../{sun => }/java2d/loops/IntArgbPre.c | 0 .../{sun => }/java2d/loops/IntArgbPre.h | 0 .../libawt/{sun => }/java2d/loops/IntBgr.c | 0 .../libawt/{sun => }/java2d/loops/IntBgr.h | 0 .../libawt/{sun => }/java2d/loops/IntDcm.h | 0 .../libawt/{sun => }/java2d/loops/IntRgb.c | 0 .../libawt/{sun => }/java2d/loops/IntRgb.h | 0 .../libawt/{sun => }/java2d/loops/IntRgbx.c | 0 .../libawt/{sun => }/java2d/loops/IntRgbx.h | 0 .../libawt/{sun => }/java2d/loops/LineUtils.h | 0 .../{sun => }/java2d/loops/LoopMacros.h | 0 .../{sun => }/java2d/loops/MapAccelFunc.c | 0 .../libawt/{sun => }/java2d/loops/MaskBlit.c | 0 .../libawt/{sun => }/java2d/loops/MaskFill.c | 0 .../java2d/loops/ParallelogramUtils.h | 0 .../{sun => }/java2d/loops/ProcessPath.c | 0 .../{sun => }/java2d/loops/ProcessPath.h | 0 .../{sun => }/java2d/loops/ScaledBlit.c | 0 .../{sun => }/java2d/loops/ThreeByteBgr.c | 0 .../{sun => }/java2d/loops/ThreeByteBgr.h | 0 .../{sun => }/java2d/loops/TransformHelper.c | 0 .../{sun => }/java2d/loops/Ushort4444Argb.c | 0 .../{sun => }/java2d/loops/Ushort4444Argb.h | 0 .../{sun => }/java2d/loops/Ushort555Rgb.c | 0 .../{sun => }/java2d/loops/Ushort555Rgb.h | 0 .../{sun => }/java2d/loops/Ushort555Rgbx.c | 0 .../{sun => }/java2d/loops/Ushort555Rgbx.h | 0 .../{sun => }/java2d/loops/Ushort565Rgb.c | 0 .../{sun => }/java2d/loops/Ushort565Rgb.h | 0 .../{sun => }/java2d/loops/UshortGray.c | 0 .../{sun => }/java2d/loops/UshortGray.h | 0 .../{sun => }/java2d/loops/UshortIndexed.c | 0 .../{sun => }/java2d/loops/UshortIndexed.h | 0 .../{sun => }/java2d/pipe/BufferedMaskBlit.c | 0 .../java2d/pipe/BufferedRenderPipe.c | 0 .../{sun => }/java2d/pipe/PathConsumer2D.h | 0 .../libawt/{sun => }/java2d/pipe/Region.c | 0 .../libawt/{sun => }/java2d/pipe/Region.h | 0 .../{sun => }/java2d/pipe/ShapeSpanIterator.c | 0 .../{sun => }/java2d/pipe/SpanClipRenderer.c | 0 .../{sun => }/java2d/pipe/SpanIterator.h | 0 .../native/common/{sun => }/awt/CUPSfuncs.c | 0 .../native/common/{sun => }/awt/X11Color.c | 0 .../unix/native/common/{sun => }/awt/awt.h | 0 .../common/{sun => }/awt/awt_Component.h | 0 .../common/{sun => }/awt/awt_DrawingSurface.h | 0 .../native/common/{sun => }/awt/awt_Font.c | 0 .../native/common/{sun => }/awt/awt_Font.h | 0 .../common/{sun => }/awt/awt_GraphicsEnv.h | 0 .../native/common/{sun => }/awt/awt_Mlib.h | 0 .../unix/native/common/{sun => }/awt/awt_p.h | 0 .../native/common/{sun => }/awt/awt_util.h | 0 .../unix/native/common/{sun => }/awt/color.h | 0 .../native/common/{sun => }/awt/colordata.h | 0 .../native/common/{sun => }/awt/extutil.h | 0 .../native/common/{sun => }/awt/fontconfig.h | 0 .../native/common/{sun => }/awt/fontpath.c | 0 .../native/common/{sun => }/awt/img_util_md.h | 0 .../awt/medialib/mlib_v_ImageCopy_f.c | 0 .../awt/medialib/mlib_v_ImageCopy_f.h | 0 .../common/{sun => }/awt/medialib/vis_proto.h | 0 .../common/{sun => }/awt/utility/rect.h | 0 .../common/{sun => }/font/X11FontScaler.h | 0 .../java2d/opengl/GLXGraphicsConfig.c | 0 .../java2d/opengl/GLXGraphicsConfig.h | 0 .../{sun => }/java2d/opengl/GLXSurfaceData.c | 0 .../{sun => }/java2d/opengl/GLXSurfaceData.h | 0 .../{sun => }/java2d/opengl/J2D_GL/glx.h | 0 .../{sun => }/java2d/opengl/J2D_GL/glxext.h | 0 .../{sun => }/java2d/opengl/OGLFuncs_md.h | 0 .../{sun => }/java2d/x11/X11FontScaler_md.c | 0 .../{sun => }/java2d/x11/X11PMBlitLoops.c | 0 .../common/{sun => }/java2d/x11/X11Renderer.c | 0 .../{sun => }/java2d/x11/X11SurfaceData.c | 0 .../{sun => }/java2d/x11/X11SurfaceData.h | 0 .../{sun => }/java2d/x11/X11TextRenderer_md.c | 0 .../libawt/{sun => }/awt/awt_LoadLibrary.c | 0 .../native/libawt/{sun => }/awt/awt_Mlib.c | 0 .../native/libawt/{sun => }/awt/initIDs.c | 0 .../{sun => }/awt/medialib/mlib_v_ImageCopy.c | 0 .../awt/medialib/mlib_v_ImageCopy_blk.s | 0 .../libawt/{sun => }/awt/medialib/vis_asi.h | 0 .../native/libawt/{sun => }/java2d/j2d_md.h | 0 .../{sun => }/java2d/loops/java2d_Mlib.c | 0 .../{sun => }/java2d/loops/java2d_Mlib.h | 0 .../{sun => }/java2d/loops/mlib_ImageCopy.h | 0 .../java2d/loops/mlib_ImageLogic_proto.h | 0 .../{sun => }/java2d/loops/mlib_ImageZoom.h | 0 .../java2d/loops/mlib_ImageZoom_NN.c | 0 .../java2d/loops/mlib_v_ImageClear.c | 0 .../java2d/loops/mlib_v_ImageClear_f.c | 0 .../java2d/loops/mlib_v_ImageClear_f.h | 0 .../java2d/loops/mlib_v_ImageConstLogic.h | 0 .../java2d/loops/mlib_v_ImageConstXor.c | 0 .../java2d/loops/mlib_v_ImageLogic.h | 0 .../java2d/loops/mlib_v_ImageLogic_proto.h | 0 .../{sun => }/java2d/loops/mlib_v_ImageXor.c | 0 .../java2d/loops/mlib_v_ImageZoom_NN_f.c | 0 .../{sun => }/java2d/loops/vis_AlphaMacros.c | 0 .../{sun => }/java2d/loops/vis_AlphaMacros.h | 0 .../java2d/loops/vis_AlphaMaskBlit.c | 0 .../java2d/loops/vis_AlphaMaskFill.c | 0 .../{sun => }/java2d/loops/vis_ByteGray.c | 0 .../java2d/loops/vis_ByteGray_FromRgb.c | 0 .../java2d/loops/vis_ByteGray_Mask.c | 0 .../{sun => }/java2d/loops/vis_ByteIndexed.c | 0 .../{sun => }/java2d/loops/vis_DrawLine.c | 0 .../{sun => }/java2d/loops/vis_FourByteAbgr.c | 0 .../java2d/loops/vis_FourByteAbgrPre.c | 0 .../{sun => }/java2d/loops/vis_FuncArray.c | 0 .../{sun => }/java2d/loops/vis_GlyphList.c | 0 .../{sun => }/java2d/loops/vis_GlyphListXor.c | 0 .../{sun => }/java2d/loops/vis_IntArgb.c | 0 .../{sun => }/java2d/loops/vis_IntArgbBm.c | 0 .../{sun => }/java2d/loops/vis_IntArgbPre.c | 0 .../java2d/loops/vis_IntArgbPre_Mask.c | 0 .../{sun => }/java2d/loops/vis_IntBgr.c | 0 .../{sun => }/java2d/loops/vis_IntRgb.c | 0 .../{sun => }/java2d/loops/vis_IntRgbx.c | 0 .../{sun => }/java2d/loops/vis_Interp.c | 0 .../{sun => }/java2d/loops/vis_SrcMaskFill.c | 0 .../java2d/loops/vis_SrcOverMaskBlit.c | 0 .../java2d/loops/vis_SrcOverMaskFill.c | 0 .../{sun => }/java2d/loops/vis_ThreeByteBgr.c | 0 .../{sun => }/java2d/loops/vis_UshortGray.c | 0 .../java2d/loops/vis_UshortGray_FromRgb.c | 0 .../{sun => }/java2d/loops/vis_XorBlit.c | 0 .../{sun => }/awt/HeadlessToolkit.c | 0 .../{sun => }/awt/VDrawingArea.c | 0 .../{sun => }/awt/VDrawingArea.h | 0 .../{sun => }/awt/VDrawingAreaP.h | 0 .../libawt_xawt/{sun => }/awt/HPkeysym.h | 0 .../native/libawt_xawt/{sun => }/awt/Xrandr.h | 0 .../libawt_xawt/{sun => }/awt/awt_AWTEvent.c | 0 .../libawt_xawt/{sun => }/awt/awt_AWTEvent.h | 0 .../{sun => }/awt/awt_DrawingSurface.c | 0 .../libawt_xawt/{sun => }/awt/awt_Event.c | 0 .../libawt_xawt/{sun => }/awt/awt_Event.h | 0 .../{sun => }/awt/awt_GraphicsEnv.c | 0 .../{sun => }/awt/awt_InputMethod.c | 0 .../libawt_xawt/{sun => }/awt/awt_Insets.c | 0 .../libawt_xawt/{sun => }/awt/awt_Insets.h | 0 .../{sun => }/awt/awt_MenuComponent.h | 0 .../libawt_xawt/{sun => }/awt/awt_Robot.c | 0 .../{sun => }/awt/awt_UNIXToolkit.c | 0 .../libawt_xawt/{sun => }/awt/awt_util.c | 0 .../native/libawt_xawt/{sun => }/awt/canvas.h | 0 .../{sun => }/awt/gtk2_interface.c | 0 .../{sun => }/awt/gtk2_interface.h | 0 .../native/libawt_xawt/{sun => }/awt/list.c | 0 .../native/libawt_xawt/{sun => }/awt/list.h | 0 .../libawt_xawt/{sun => }/awt/multiVis.c | 0 .../libawt_xawt/{sun => }/awt/multiVis.h | 0 .../libawt_xawt/{sun => }/awt/multi_font.c | 0 .../libawt_xawt/{sun => }/awt/multi_font.h | 0 .../native/libawt_xawt/{sun => }/awt/randr.h | 0 .../libawt_xawt/{sun => }/awt/robot_common.c | 0 .../libawt_xawt/{sun => }/awt/robot_common.h | 0 .../awt/sun_awt_X11_GtkFileDialogPeer.c | 0 .../{sun => }/awt/swing_GTKEngine.c | 0 .../{sun => }/awt/swing_GTKStyle.c | 0 .../libawt_xawt/{sun => }/awt/wsutils.h | 0 .../{sun => }/java2d/x11/XRBackendNative.c | 0 .../{sun => }/java2d/x11/XRSurfaceData.c | 0 .../libawt_xawt/{sun => }/xawt/XToolkit.c | 0 .../libawt_xawt/{sun => }/xawt/XWindow.c | 0 .../libawt_xawt/{sun => }/xawt/XlibWrapper.c | 0 .../libawt_xawt/{sun => }/xawt/awt_Desktop.c | 0 .../{sun => }/xawt/gnome_interface.c | 0 .../{sun => }/xawt/gnome_interface.h | 0 .../common/{sun => }/awt/utility/rect.h | 0 .../{sun => }/java2d/d3d/D3DBadHardware.h | 0 .../{sun => }/java2d/d3d/D3DBlitLoops.cpp | 0 .../{sun => }/java2d/d3d/D3DBlitLoops.h | 0 .../{sun => }/java2d/d3d/D3DBufImgOps.cpp | 0 .../{sun => }/java2d/d3d/D3DBufImgOps.h | 0 .../{sun => }/java2d/d3d/D3DContext.cpp | 0 .../libawt/{sun => }/java2d/d3d/D3DContext.h | 0 .../{sun => }/java2d/d3d/D3DGlyphCache.cpp | 0 .../{sun => }/java2d/d3d/D3DGlyphCache.h | 0 .../java2d/d3d/D3DGraphicsDevice.cpp | 0 .../{sun => }/java2d/d3d/D3DGraphicsDevice.h | 0 .../{sun => }/java2d/d3d/D3DMaskBlit.cpp | 0 .../libawt/{sun => }/java2d/d3d/D3DMaskBlit.h | 0 .../{sun => }/java2d/d3d/D3DMaskCache.cpp | 0 .../{sun => }/java2d/d3d/D3DMaskCache.h | 0 .../{sun => }/java2d/d3d/D3DMaskFill.cpp | 0 .../libawt/{sun => }/java2d/d3d/D3DMaskFill.h | 0 .../libawt/{sun => }/java2d/d3d/D3DPaints.cpp | 0 .../libawt/{sun => }/java2d/d3d/D3DPaints.h | 0 .../libawt/{sun => }/java2d/d3d/D3DPipeline.h | 0 .../java2d/d3d/D3DPipelineManager.cpp | 0 .../{sun => }/java2d/d3d/D3DPipelineManager.h | 0 .../{sun => }/java2d/d3d/D3DRenderQueue.cpp | 0 .../{sun => }/java2d/d3d/D3DRenderQueue.h | 0 .../{sun => }/java2d/d3d/D3DRenderer.cpp | 0 .../libawt/{sun => }/java2d/d3d/D3DRenderer.h | 0 .../java2d/d3d/D3DResourceManager.cpp | 0 .../{sun => }/java2d/d3d/D3DResourceManager.h | 0 .../{sun => }/java2d/d3d/D3DShaderGen.c | 0 .../libawt/{sun => }/java2d/d3d/D3DShaders.h | 0 .../{sun => }/java2d/d3d/D3DSurfaceData.cpp | 0 .../{sun => }/java2d/d3d/D3DSurfaceData.h | 0 .../{sun => }/java2d/d3d/D3DTextRenderer.cpp | 0 .../{sun => }/java2d/d3d/D3DTextRenderer.h | 0 .../{sun => }/java2d/d3d/D3DVertexCacher.cpp | 0 .../{sun => }/java2d/d3d/D3DVertexCacher.h | 0 .../native/libawt/{sun => }/java2d/j2d_md.h | 0 .../{sun => }/java2d/opengl/J2D_GL/wglext.h | 0 .../{sun => }/java2d/opengl/OGLFuncs_md.h | 0 .../java2d/opengl/WGLGraphicsConfig.c | 0 .../java2d/opengl/WGLGraphicsConfig.h | 0 .../{sun => }/java2d/opengl/WGLSurfaceData.c | 0 .../{sun => }/java2d/opengl/WGLSurfaceData.h | 0 .../{sun => }/java2d/windows/GDIBlitLoops.cpp | 0 .../{sun => }/java2d/windows/GDIRenderer.cpp | 0 .../java2d/windows/GDIWindowSurfaceData.cpp | 0 .../java2d/windows/GDIWindowSurfaceData.h | 0 .../{sun => }/java2d/windows/WindowsFlags.cpp | 0 .../{sun => }/java2d/windows/WindowsFlags.h | 0 .../libawt/{sun => }/windows/CmdIDList.cpp | 0 .../libawt/{sun => }/windows/CmdIDList.h | 0 .../libawt/{sun => }/windows/ComCtl32Util.cpp | 0 .../libawt/{sun => }/windows/ComCtl32Util.h | 0 .../libawt/{sun => }/windows/Devices.cpp | 0 .../native/libawt/{sun => }/windows/Devices.h | 0 .../libawt/{sun => }/windows/DllUtil.cpp | 0 .../native/libawt/{sun => }/windows/DllUtil.h | 0 .../libawt/{sun => }/windows/GDIHashtable.cpp | 0 .../libawt/{sun => }/windows/GDIHashtable.h | 0 .../libawt/{sun => }/windows/Hashtable.cpp | 0 .../libawt/{sun => }/windows/Hashtable.h | 0 .../libawt/{sun => }/windows/MouseInfo.cpp | 0 .../libawt/{sun => }/windows/ObjectList.cpp | 0 .../libawt/{sun => }/windows/ObjectList.h | 0 .../libawt/{sun => }/windows/README.JNI | 0 .../libawt/{sun => }/windows/ShellFolder2.cpp | 0 .../libawt/{sun => }/windows/ThemeReader.cpp | 0 .../libawt/{sun => }/windows/WPrinterJob.cpp | 0 .../native/libawt/{sun => }/windows/alloc.h | 0 .../native/libawt/{sun => }/windows/awt.h | 0 .../native/libawt/{sun => }/windows/awt.rc | 0 .../libawt/{sun => }/windows/awt_AWTEvent.cpp | 0 .../libawt/{sun => }/windows/awt_AWTEvent.h | 0 .../{sun => }/windows/awt_BitmapUtil.cpp | 0 .../libawt/{sun => }/windows/awt_BitmapUtil.h | 0 .../libawt/{sun => }/windows/awt_Brush.cpp | 0 .../libawt/{sun => }/windows/awt_Brush.h | 0 .../libawt/{sun => }/windows/awt_Button.cpp | 0 .../libawt/{sun => }/windows/awt_Button.h | 0 .../libawt/{sun => }/windows/awt_Canvas.cpp | 0 .../libawt/{sun => }/windows/awt_Canvas.h | 0 .../libawt/{sun => }/windows/awt_Checkbox.cpp | 0 .../libawt/{sun => }/windows/awt_Checkbox.h | 0 .../libawt/{sun => }/windows/awt_Choice.cpp | 0 .../libawt/{sun => }/windows/awt_Choice.h | 0 .../{sun => }/windows/awt_Clipboard.cpp | 0 .../libawt/{sun => }/windows/awt_Clipboard.h | 0 .../libawt/{sun => }/windows/awt_Color.cpp | 0 .../libawt/{sun => }/windows/awt_Color.h | 0 .../{sun => }/windows/awt_Component.cpp | 0 .../libawt/{sun => }/windows/awt_Component.h | 0 .../{sun => }/windows/awt_Container.cpp | 0 .../libawt/{sun => }/windows/awt_Container.h | 0 .../libawt/{sun => }/windows/awt_Cursor.cpp | 0 .../libawt/{sun => }/windows/awt_Cursor.h | 0 .../{sun => }/windows/awt_CustomPaletteDef.h | 0 .../libawt/{sun => }/windows/awt_DCHolder.cpp | 0 .../libawt/{sun => }/windows/awt_DCHolder.h | 0 .../{sun => }/windows/awt_DataTransferer.cpp | 0 .../{sun => }/windows/awt_DataTransferer.h | 0 .../libawt/{sun => }/windows/awt_Debug.cpp | 0 .../libawt/{sun => }/windows/awt_Debug.h | 0 .../libawt/{sun => }/windows/awt_Desktop.cpp | 0 .../windows/awt_DesktopProperties.cpp | 0 .../{sun => }/windows/awt_DesktopProperties.h | 0 .../libawt/{sun => }/windows/awt_Dialog.cpp | 0 .../libawt/{sun => }/windows/awt_Dialog.h | 0 .../{sun => }/windows/awt_Dimension.cpp | 0 .../libawt/{sun => }/windows/awt_Dimension.h | 0 .../libawt/{sun => }/windows/awt_DnDDS.cpp | 0 .../libawt/{sun => }/windows/awt_DnDDS.h | 0 .../libawt/{sun => }/windows/awt_DnDDT.cpp | 0 .../libawt/{sun => }/windows/awt_DnDDT.h | 0 .../{sun => }/windows/awt_DrawingSurface.cpp | 0 .../{sun => }/windows/awt_DrawingSurface.h | 0 .../libawt/{sun => }/windows/awt_Event.cpp | 0 .../libawt/{sun => }/windows/awt_Event.h | 0 .../{sun => }/windows/awt_FileDialog.cpp | 0 .../libawt/{sun => }/windows/awt_FileDialog.h | 0 .../libawt/{sun => }/windows/awt_Font.cpp | 0 .../libawt/{sun => }/windows/awt_Font.h | 0 .../libawt/{sun => }/windows/awt_Frame.cpp | 0 .../libawt/{sun => }/windows/awt_Frame.h | 0 .../{sun => }/windows/awt_GDIObject.cpp | 0 .../libawt/{sun => }/windows/awt_GDIObject.h | 0 .../{sun => }/windows/awt_IconCursor.cpp | 0 .../libawt/{sun => }/windows/awt_IconCursor.h | 0 .../{sun => }/windows/awt_InputEvent.cpp | 0 .../libawt/{sun => }/windows/awt_InputEvent.h | 0 .../{sun => }/windows/awt_InputMethod.cpp | 0 .../{sun => }/windows/awt_InputTextInfor.cpp | 0 .../{sun => }/windows/awt_InputTextInfor.h | 0 .../libawt/{sun => }/windows/awt_Insets.cpp | 0 .../libawt/{sun => }/windows/awt_Insets.h | 0 .../libawt/{sun => }/windows/awt_KeyEvent.cpp | 0 .../libawt/{sun => }/windows/awt_KeyEvent.h | 0 .../windows/awt_KeyboardFocusManager.cpp | 0 .../libawt/{sun => }/windows/awt_Label.cpp | 0 .../libawt/{sun => }/windows/awt_Label.h | 0 .../libawt/{sun => }/windows/awt_List.cpp | 0 .../libawt/{sun => }/windows/awt_List.h | 0 .../libawt/{sun => }/windows/awt_Menu.cpp | 0 .../libawt/{sun => }/windows/awt_Menu.h | 0 .../libawt/{sun => }/windows/awt_MenuBar.cpp | 0 .../libawt/{sun => }/windows/awt_MenuBar.h | 0 .../libawt/{sun => }/windows/awt_MenuItem.cpp | 0 .../libawt/{sun => }/windows/awt_MenuItem.h | 0 .../libawt/{sun => }/windows/awt_Mlib.cpp | 0 .../libawt/{sun => }/windows/awt_Mlib.h | 0 .../{sun => }/windows/awt_MouseEvent.cpp | 0 .../libawt/{sun => }/windows/awt_MouseEvent.h | 0 .../libawt/{sun => }/windows/awt_Object.cpp | 0 .../libawt/{sun => }/windows/awt_Object.h | 0 .../libawt/{sun => }/windows/awt_Palette.cpp | 0 .../libawt/{sun => }/windows/awt_Palette.h | 0 .../libawt/{sun => }/windows/awt_Panel.cpp | 0 .../libawt/{sun => }/windows/awt_Panel.h | 0 .../libawt/{sun => }/windows/awt_Pen.cpp | 0 .../native/libawt/{sun => }/windows/awt_Pen.h | 0 .../{sun => }/windows/awt_PopupMenu.cpp | 0 .../libawt/{sun => }/windows/awt_PopupMenu.h | 0 .../{sun => }/windows/awt_PrintControl.cpp | 0 .../{sun => }/windows/awt_PrintControl.h | 0 .../{sun => }/windows/awt_PrintDialog.cpp | 0 .../{sun => }/windows/awt_PrintDialog.h | 0 .../libawt/{sun => }/windows/awt_PrintJob.cpp | 0 .../{sun => }/windows/awt_Rectangle.cpp | 0 .../libawt/{sun => }/windows/awt_Rectangle.h | 0 .../libawt/{sun => }/windows/awt_Robot.cpp | 0 .../libawt/{sun => }/windows/awt_Robot.h | 0 .../{sun => }/windows/awt_ScrollPane.cpp | 0 .../libawt/{sun => }/windows/awt_ScrollPane.h | 0 .../{sun => }/windows/awt_Scrollbar.cpp | 0 .../libawt/{sun => }/windows/awt_Scrollbar.h | 0 .../libawt/{sun => }/windows/awt_TextArea.cpp | 0 .../libawt/{sun => }/windows/awt_TextArea.h | 0 .../{sun => }/windows/awt_TextComponent.cpp | 0 .../{sun => }/windows/awt_TextComponent.h | 0 .../{sun => }/windows/awt_TextField.cpp | 0 .../libawt/{sun => }/windows/awt_TextField.h | 0 .../libawt/{sun => }/windows/awt_Toolkit.cpp | 0 .../libawt/{sun => }/windows/awt_Toolkit.h | 0 .../libawt/{sun => }/windows/awt_TrayIcon.cpp | 0 .../libawt/{sun => }/windows/awt_TrayIcon.h | 0 .../windows/awt_Win32GraphicsConfig.cpp | 0 .../windows/awt_Win32GraphicsConfig.h | 0 .../windows/awt_Win32GraphicsDevice.cpp | 0 .../windows/awt_Win32GraphicsDevice.h | 0 .../windows/awt_Win32GraphicsEnv.cpp | 0 .../libawt/{sun => }/windows/awt_Window.cpp | 0 .../libawt/{sun => }/windows/awt_Window.h | 0 .../libawt/{sun => }/windows/awt_new.cpp | 0 .../native/libawt/{sun => }/windows/awt_new.h | 0 .../libawt/{sun => }/windows/awt_ole.cpp | 0 .../native/libawt/{sun => }/windows/awt_ole.h | 0 .../native/libawt/{sun => }/windows/awtmsg.h | 0 .../native/libawt/{sun => }/windows/check.bmp | Bin .../libawt/{sun => }/windows/colordata.h | 0 .../native/libawt/{sun => }/windows/hand.cur | Bin .../libawt/{sun => }/windows/img_util_md.h | 0 .../libawt/{sun => }/windows/initIDs.cpp | 0 .../libawt/{sun => }/windows/mlib_types_md.h | 0 .../{sun => }/windows/security_warning.ico | Bin .../{sun => }/windows/security_warning_bw.ico | Bin .../windows/security_warning_int.ico | Bin .../native/libawt/{sun => }/windows/stdhdrs.h | 0 629 files changed, 78 insertions(+), 78 deletions(-) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/AWTEvent.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/AWTEvent.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/AWTSurfaceLayers.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/AWTSurfaceLayers.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/AWTView.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/AWTView.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/AWTWindow.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/AWTWindow.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/ApplicationDelegate.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/ApplicationDelegate.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CClipboard.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CCursorManager.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CDataTransferer.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CDataTransferer.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CDesktopPeer.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CDragSource.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CDragSource.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CDragSourceContextPeer.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CDropTarget.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CDropTarget.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CDropTargetContextPeer.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CFRetainedResource.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CFileDialog.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CFileDialog.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CGraphicsConfig.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CGraphicsDevice.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CGraphicsEnv.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CImage.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CInputMethod.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CMenu.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CMenu.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CMenuBar.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CMenuBar.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CMenuComponent.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CMenuComponent.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CMenuItem.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CMenuItem.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CPopupMenu.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CPopupMenu.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CPrinterJob.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CRobot.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CSystemColors.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CSystemColors.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CTextPipe.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CTrayIcon.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CTrayIcon.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/CWrapper.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/DnDUtilities.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/DnDUtilities.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/GeomUtilities.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/GeomUtilities.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/ImageSurfaceData.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/ImageSurfaceData.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/InitIDs.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/InitIDs.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/JavaAccessibilityAction.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/JavaAccessibilityAction.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/JavaAccessibilityUtilities.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/JavaAccessibilityUtilities.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/JavaComponentAccessibility.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/JavaComponentAccessibility.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/JavaTextAccessibility.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/JavaTextAccessibility.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/LWCToolkit.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/LWCToolkit.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/OSVersion.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/OSVersion.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/PrintModel.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/PrintModel.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/PrinterSurfaceData.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/PrinterSurfaceData.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/PrinterView.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/PrinterView.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/QuartzRenderer.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/QuartzSurfaceData.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/QuartzSurfaceData.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/awt/awt_DrawingSurface.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/font/AWTFont.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/font/AWTFont.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/font/AWTStrike.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/font/AWTStrike.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/font/CCharToGlyphMapper.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/font/CGGlyphImages.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/font/CGGlyphImages.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/font/CGGlyphOutlines.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/font/CGGlyphOutlines.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/font/CoreTextSupport.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/font/CoreTextSupport.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/java2d/opengl/CGLGraphicsConfig.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/java2d/opengl/CGLGraphicsConfig.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/java2d/opengl/CGLLayer.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/java2d/opengl/CGLLayer.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/java2d/opengl/CGLSurfaceData.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/java2d/opengl/CGLSurfaceData.m (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/java2d/opengl/J2D_GL/cglext.h (100%) rename jdk/src/java.desktop/macosx/native/libawt_lwawt/{sun => }/java2d/opengl/OGLFuncs_md.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/awt/debug/debug_assert.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/awt/debug/debug_assert.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/awt/debug/debug_mem.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/awt/debug/debug_mem.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/awt/debug/debug_trace.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/awt/debug/debug_trace.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/awt/debug/debug_util.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/awt/debug/debug_util.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/awt/medialib/mlib_ImageCopy_Bit.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/awt/medialib/mlib_ImageCreate.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/awt/medialib/mlib_sys.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/awt/utility/rect.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/font/AccelGlyphCache.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/font/AccelGlyphCache.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/font/fontscalerdefs.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/font/sunfontids.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/J2D_GL/gl.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/J2D_GL/glext.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLBlitLoops.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLBlitLoops.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLBufImgOps.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLBufImgOps.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLContext.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLContext.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLFuncMacros.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLFuncs.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLFuncs.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLMaskBlit.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLMaskBlit.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLMaskFill.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLMaskFill.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLPaints.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLPaints.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLRenderQueue.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLRenderQueue.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLRenderer.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLRenderer.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLSurfaceData.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLSurfaceData.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLTextRenderer.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLTextRenderer.h (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLVertexCache.c (100%) rename jdk/src/java.desktop/share/native/common/{sun => }/java2d/opengl/OGLVertexCache.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/BufImgSurfaceData.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/BufImgSurfaceData.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/DataBufferNative.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/awt_ImageRep.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/awt_parseImage.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/awt_parseImage.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/README (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_alpha.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_anycm.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_colors.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_colors.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_dcm.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_dcm8.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_dir8dither.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_dirdither.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_fscolor.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_fsdither.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_fsgray.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_fsutil.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_globals.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_globals.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_icm.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_input32.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_input8.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_input8_32.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_nodither.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_noscale.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_opaque.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_ordclrsgn.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_ordclruns.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_orddither.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_ordgray.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_output16.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_output16_32.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_output24.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_output32.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_output8.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_output8_16_24.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_output8_16_32.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_output8_32.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_replscale.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_scaleloop.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/cvutils/img_util.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/dither.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/dither.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/gif/gifdecoder.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/imageInitIDs.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/image/imageInitIDs.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/medialib/awt_ImagingLib.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/awt/medialib/awt_ImagingLib.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/Disposer.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/Disposer.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/ShaderList.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/ShaderList.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/SurfaceData.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/SurfaceData.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/Trace.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/Trace.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/AlphaMacros.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/AlphaMacros.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/AlphaMath.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/AlphaMath.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Any3Byte.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Any3Byte.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Any4Byte.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Any4Byte.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/AnyByte.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/AnyByte.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/AnyByteBinary.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/AnyInt.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/AnyInt.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/AnyShort.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/AnyShort.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Blit.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/BlitBg.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ByteBinary1Bit.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ByteBinary1Bit.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ByteBinary2Bit.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ByteBinary2Bit.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ByteBinary4Bit.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ByteBinary4Bit.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ByteGray.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ByteGray.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ByteIndexed.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ByteIndexed.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/DrawLine.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/DrawParallelogram.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/DrawPath.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/DrawPath.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/DrawPolygons.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/DrawRect.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/FillParallelogram.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/FillPath.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/FillRect.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/FillSpans.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/FourByteAbgr.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/FourByteAbgr.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/FourByteAbgrPre.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/FourByteAbgrPre.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/GlyphImageRef.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/GraphicsPrimitiveMgr.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/GraphicsPrimitiveMgr.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ImageData.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Index12Gray.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Index12Gray.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Index8Gray.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Index8Gray.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntArgb.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntArgb.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntArgbBm.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntArgbBm.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntArgbPre.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntArgbPre.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntBgr.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntBgr.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntDcm.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntRgb.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntRgb.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntRgbx.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/IntRgbx.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/LineUtils.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/LoopMacros.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/MapAccelFunc.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/MaskBlit.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/MaskFill.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ParallelogramUtils.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ProcessPath.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ProcessPath.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ScaledBlit.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ThreeByteBgr.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/ThreeByteBgr.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/TransformHelper.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Ushort4444Argb.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Ushort4444Argb.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Ushort555Rgb.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Ushort555Rgb.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Ushort555Rgbx.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Ushort555Rgbx.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Ushort565Rgb.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/Ushort565Rgb.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/UshortGray.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/UshortGray.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/UshortIndexed.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/loops/UshortIndexed.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/pipe/BufferedMaskBlit.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/pipe/BufferedRenderPipe.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/pipe/PathConsumer2D.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/pipe/Region.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/pipe/Region.h (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/pipe/ShapeSpanIterator.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/pipe/SpanClipRenderer.c (100%) rename jdk/src/java.desktop/share/native/libawt/{sun => }/java2d/pipe/SpanIterator.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/CUPSfuncs.c (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/X11Color.c (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/awt.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/awt_Component.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/awt_DrawingSurface.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/awt_Font.c (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/awt_Font.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/awt_GraphicsEnv.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/awt_Mlib.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/awt_p.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/awt_util.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/color.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/colordata.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/extutil.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/fontconfig.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/fontpath.c (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/img_util_md.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/medialib/mlib_v_ImageCopy_f.c (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/medialib/mlib_v_ImageCopy_f.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/medialib/vis_proto.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/awt/utility/rect.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/font/X11FontScaler.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/opengl/GLXGraphicsConfig.c (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/opengl/GLXGraphicsConfig.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/opengl/GLXSurfaceData.c (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/opengl/GLXSurfaceData.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/opengl/J2D_GL/glx.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/opengl/J2D_GL/glxext.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/opengl/OGLFuncs_md.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/x11/X11FontScaler_md.c (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/x11/X11PMBlitLoops.c (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/x11/X11Renderer.c (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/x11/X11SurfaceData.c (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/x11/X11SurfaceData.h (100%) rename jdk/src/java.desktop/unix/native/common/{sun => }/java2d/x11/X11TextRenderer_md.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/awt/awt_LoadLibrary.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/awt/awt_Mlib.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/awt/initIDs.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/awt/medialib/mlib_v_ImageCopy.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/awt/medialib/mlib_v_ImageCopy_blk.s (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/awt/medialib/vis_asi.h (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/j2d_md.h (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/java2d_Mlib.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/java2d_Mlib.h (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_ImageCopy.h (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_ImageLogic_proto.h (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_ImageZoom.h (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_ImageZoom_NN.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_v_ImageClear.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_v_ImageClear_f.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_v_ImageClear_f.h (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_v_ImageConstLogic.h (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_v_ImageConstXor.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_v_ImageLogic.h (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_v_ImageLogic_proto.h (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_v_ImageXor.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/mlib_v_ImageZoom_NN_f.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_AlphaMacros.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_AlphaMacros.h (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_AlphaMaskBlit.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_AlphaMaskFill.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_ByteGray.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_ByteGray_FromRgb.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_ByteGray_Mask.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_ByteIndexed.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_DrawLine.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_FourByteAbgr.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_FourByteAbgrPre.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_FuncArray.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_GlyphList.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_GlyphListXor.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_IntArgb.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_IntArgbBm.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_IntArgbPre.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_IntArgbPre_Mask.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_IntBgr.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_IntRgb.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_IntRgbx.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_Interp.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_SrcMaskFill.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_SrcOverMaskBlit.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_SrcOverMaskFill.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_ThreeByteBgr.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_UshortGray.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_UshortGray_FromRgb.c (100%) rename jdk/src/java.desktop/unix/native/libawt/{sun => }/java2d/loops/vis_XorBlit.c (100%) rename jdk/src/java.desktop/unix/native/libawt_headless/{sun => }/awt/HeadlessToolkit.c (100%) rename jdk/src/java.desktop/unix/native/libawt_headless/{sun => }/awt/VDrawingArea.c (100%) rename jdk/src/java.desktop/unix/native/libawt_headless/{sun => }/awt/VDrawingArea.h (100%) rename jdk/src/java.desktop/unix/native/libawt_headless/{sun => }/awt/VDrawingAreaP.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/HPkeysym.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/Xrandr.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_AWTEvent.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_AWTEvent.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_DrawingSurface.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_Event.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_Event.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_GraphicsEnv.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_InputMethod.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_Insets.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_Insets.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_MenuComponent.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_Robot.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_UNIXToolkit.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/awt_util.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/canvas.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/gtk2_interface.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/gtk2_interface.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/list.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/list.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/multiVis.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/multiVis.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/multi_font.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/multi_font.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/randr.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/robot_common.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/robot_common.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/sun_awt_X11_GtkFileDialogPeer.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/swing_GTKEngine.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/swing_GTKStyle.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/awt/wsutils.h (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/java2d/x11/XRBackendNative.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/java2d/x11/XRSurfaceData.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/xawt/XToolkit.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/xawt/XWindow.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/xawt/XlibWrapper.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/xawt/awt_Desktop.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/xawt/gnome_interface.c (100%) rename jdk/src/java.desktop/unix/native/libawt_xawt/{sun => }/xawt/gnome_interface.h (100%) rename jdk/src/java.desktop/windows/native/common/{sun => }/awt/utility/rect.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DBadHardware.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DBlitLoops.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DBlitLoops.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DBufImgOps.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DBufImgOps.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DContext.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DContext.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DGlyphCache.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DGlyphCache.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DGraphicsDevice.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DGraphicsDevice.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DMaskBlit.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DMaskBlit.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DMaskCache.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DMaskCache.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DMaskFill.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DMaskFill.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DPaints.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DPaints.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DPipeline.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DPipelineManager.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DPipelineManager.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DRenderQueue.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DRenderQueue.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DRenderer.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DRenderer.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DResourceManager.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DResourceManager.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DShaderGen.c (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DShaders.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DSurfaceData.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DSurfaceData.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DTextRenderer.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DTextRenderer.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DVertexCacher.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/d3d/D3DVertexCacher.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/j2d_md.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/opengl/J2D_GL/wglext.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/opengl/OGLFuncs_md.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/opengl/WGLGraphicsConfig.c (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/opengl/WGLGraphicsConfig.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/opengl/WGLSurfaceData.c (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/opengl/WGLSurfaceData.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/windows/GDIBlitLoops.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/windows/GDIRenderer.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/windows/GDIWindowSurfaceData.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/windows/GDIWindowSurfaceData.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/windows/WindowsFlags.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/java2d/windows/WindowsFlags.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/CmdIDList.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/CmdIDList.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/ComCtl32Util.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/ComCtl32Util.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/Devices.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/Devices.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/DllUtil.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/DllUtil.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/GDIHashtable.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/GDIHashtable.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/Hashtable.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/Hashtable.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/MouseInfo.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/ObjectList.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/ObjectList.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/README.JNI (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/ShellFolder2.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/ThemeReader.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/WPrinterJob.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/alloc.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt.rc (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_AWTEvent.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_AWTEvent.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_BitmapUtil.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_BitmapUtil.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Brush.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Brush.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Button.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Button.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Canvas.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Canvas.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Checkbox.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Checkbox.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Choice.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Choice.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Clipboard.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Clipboard.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Color.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Color.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Component.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Component.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Container.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Container.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Cursor.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Cursor.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_CustomPaletteDef.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_DCHolder.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_DCHolder.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_DataTransferer.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_DataTransferer.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Debug.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Debug.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Desktop.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_DesktopProperties.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_DesktopProperties.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Dialog.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Dialog.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Dimension.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Dimension.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_DnDDS.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_DnDDS.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_DnDDT.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_DnDDT.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_DrawingSurface.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_DrawingSurface.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Event.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Event.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_FileDialog.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_FileDialog.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Font.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Font.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Frame.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Frame.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_GDIObject.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_GDIObject.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_IconCursor.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_IconCursor.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_InputEvent.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_InputEvent.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_InputMethod.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_InputTextInfor.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_InputTextInfor.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Insets.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Insets.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_KeyEvent.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_KeyEvent.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_KeyboardFocusManager.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Label.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Label.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_List.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_List.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Menu.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Menu.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_MenuBar.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_MenuBar.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_MenuItem.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_MenuItem.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Mlib.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Mlib.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_MouseEvent.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_MouseEvent.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Object.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Object.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Palette.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Palette.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Panel.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Panel.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Pen.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Pen.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_PopupMenu.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_PopupMenu.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_PrintControl.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_PrintControl.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_PrintDialog.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_PrintDialog.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_PrintJob.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Rectangle.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Rectangle.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Robot.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Robot.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_ScrollPane.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_ScrollPane.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Scrollbar.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Scrollbar.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_TextArea.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_TextArea.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_TextComponent.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_TextComponent.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_TextField.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_TextField.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Toolkit.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Toolkit.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_TrayIcon.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_TrayIcon.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Win32GraphicsConfig.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Win32GraphicsConfig.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Win32GraphicsDevice.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Win32GraphicsDevice.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Win32GraphicsEnv.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Window.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_Window.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_new.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_new.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_ole.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awt_ole.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/awtmsg.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/check.bmp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/colordata.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/hand.cur (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/img_util_md.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/initIDs.cpp (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/mlib_types_md.h (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/security_warning.ico (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/security_warning_bw.ico (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/security_warning_int.ico (100%) rename jdk/src/java.desktop/windows/native/libawt/{sun => }/windows/stdhdrs.h (100%) diff --git a/jdk/make/gensrc/GensrcX11Wrappers.gmk b/jdk/make/gensrc/GensrcX11Wrappers.gmk index dd754cd7ac1..b21729654f8 100644 --- a/jdk/make/gensrc/GensrcX11Wrappers.gmk +++ b/jdk/make/gensrc/GensrcX11Wrappers.gmk @@ -96,9 +96,9 @@ ifneq ($(COMPILE_TYPE), cross) -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include \ -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \ -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/sun/awt \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/awt/debug \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/awt/image/cvutils \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ # # Compile the C code into an executable. diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk index 46d7f2a73d1..0d38b332892 100644 --- a/jdk/make/lib/Awt2dLibraries.gmk +++ b/jdk/make/lib/Awt2dLibraries.gmk @@ -28,7 +28,7 @@ WIN_AWT_LIB := $(JDK_OUTPUTDIR)/objs/libawt/awt.lib ################################################################################ BUILD_LIBMLIB_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/libmlib_image \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/awt/medialib + $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/medialib BUILD_LIBMLIB_CFLAGS := -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES \ $(addprefix -I, $(BUILD_LIBMLIB_SRC)) \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libmlib_image @@ -79,8 +79,8 @@ ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc) LIBMLIB_IMAGE_V_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/libmlib_image \ $(JDK_TOPDIR)/src/java.desktop/unix/native/libmlib_image \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/awt/medialib \ - $(JDK_TOPDIR)/src/java.desktop/unix/native/common/sun/awt/medialib \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/medialib \ + $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt/medialib \ # LIBMLIB_IMAGE_V_CFLAGS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libmlib_image/vis_$(OPENJDK_TARGET_CPU_BITS).il \ $(addprefix -I, $(LIBMLIB_IMAGE_V_SRC)) \ @@ -145,8 +145,8 @@ endif LIBAWT_DIRS := $(JDK_TOPDIR)/src/java.desktop/share/native/libawt \ $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/awt/debug \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/sun/awt \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ # ifeq ($(OPENJDK_TARGET_OS), aix) @@ -154,9 +154,9 @@ ifeq ($(OPENJDK_TARGET_OS), aix) endif ifeq ($(OPENJDK_TARGET_OS), windows) - LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/awt/utility + LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/utility else - LIBAWT_EXFILES := sun/java2d/ShaderList.c + LIBAWT_EXFILES := java2d/ShaderList.c endif ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux macosx aix), ) @@ -164,7 +164,7 @@ ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux macosx aix), ) endif ifeq ($(OPENJDK_TARGET_OS), macosx) - LIBAWT_EXFILES += initIDs.c sun/awt/image/cvutils/img_colors.c + LIBAWT_EXFILES += initIDs.c awt/image/cvutils/img_colors.c endif LIBAWT_CFLAGS += -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ @@ -183,8 +183,8 @@ ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc) LIBAWT_CFLAGS += -xarch=sparcvis LIBAWT_CFLAGS += $(JDK_TOPDIR)/src/java.desktop/unix/native/libmlib_image/vis_$(OPENJDK_TARGET_CPU_BITS).il - LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/awt/medialib - LIBAWT_EXFILES += sun/java2d/loops/MapAccelFunc.c + LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/medialib + LIBAWT_EXFILES += java2d/loops/MapAccelFunc.c ifeq ($(OPENJDK_TARGET_CPU), sparcv9) LIBAWT_ASFLAGS = -P -xarch=v9a @@ -193,9 +193,9 @@ ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc) endif else LIBAWT_EXCLUDES += \ - $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt/sun/awt/medialib \ - $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt/sun/java2d/loops \ - $(JDK_TOPDIR)/src/java.desktop/unix/native/common/sun/awt/medialib \ + $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt/awt/medialib \ + $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt/java2d/loops \ + $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt/medialib \ # endif @@ -206,19 +206,19 @@ endif LIBAWT_LANG := C ifeq ($(OPENJDK_TARGET_OS), windows) - LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/font \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/java2d/opengl \ + LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ # Why does libawt need java.base headers? - LIBAWT_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/font \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/java2d/opengl \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/sun/java2d/opengl \ + LIBAWT_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \ -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \ # LIBAWT_EXFILES += \ - sun/java2d/d3d/D3DShaderGen.c \ - sun/awt/image/cvutils/img_colors.c \ + java2d/d3d/D3DShaderGen.c \ + awt/image/cvutils/img_colors.c \ # LIBAWT_LANG := C++ @@ -232,7 +232,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows) else LIBAWT_RC_FLAGS := -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons" endif - LIBAWT_VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/java.desktop/windows/native/libawt/sun/windows/awt.rc + LIBAWT_VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/java.desktop/windows/native/libawt/windows/awt.rc endif ifeq ($(MILESTONE), internal) @@ -300,13 +300,13 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),) LIBAWT_XAWT_DIRS := \ $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt_xawt \ $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjawt \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/awt/debug \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/awt/utility \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/font \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/java2d/opengl \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/sun/java2d/opengl \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/sun/java2d/x11 \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/sun/awt \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/utility \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/x11 \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ # LIBAWT_XAWT_EXCLUDES := medialib @@ -316,14 +316,14 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),) -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/include \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/java2d \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/sun/java2d \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/java2d/loops \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/java2d/pipe \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/awt/image/cvutils \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/awt/image \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libsunwjdga \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/sun/font \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/font \ $(LIBJAVA_HEADER_FLAGS) # @@ -388,8 +388,8 @@ endif LIBLCMS_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/liblcms LIBLCMS_CPPFLAGS += -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/java2d \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/awt/debug \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ $(LIBJAVA_HEADER_FLAGS) \ # @@ -542,7 +542,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows) LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \ X11TextRenderer.c LIBFONTMANAGER_OPTIMIZATION := HIGHEST - LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/sun/windows + LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/windows else ifeq ($(OPENJDK_TARGET_OS), macosx) LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \ X11TextRenderer.c \ @@ -607,11 +607,11 @@ DESKTOP_LIBRARIES += $(BUILD_LIBFONTMANAGER) ifeq ($(OPENJDK_TARGET_OS), windows) LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjawt - LIBJAWT_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/sun/windows \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/awt/debug \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/java2d \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/awt/image/cvutils \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/sun/java2d/windows \ + LIBJAWT_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/windows \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d/windows \ -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ @@ -658,7 +658,7 @@ else # OPENJDK_TARGET_OS not windows LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjawt endif LIBJAWT_CFLAGS := \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/sun/awt \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ @@ -723,26 +723,26 @@ ifeq ($(BUILD_HEADLESS), true) # Mac and Windows only use the native AWT lib, do not build libawt_headless ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),) - LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/sun/awt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/sun/awt \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/sun/java2d/opengl \ - $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/sun/java2d/x11 \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/java2d/opengl \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/font \ + LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \ + $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/x11 \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ # LIBAWT_HEADLESS_EXCLUDES := medialib LIBAWT_HEADLESS_CFLAGS := -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ $(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/java2d \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/java2d/loops \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/awt/image/cvutils \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/java2d/pipe \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/awt/image \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/sun/java2d \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/font \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/awt/debug \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/sun/font \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ + -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/font \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libsunwjdga/ \ $(LIBJAVA_HEADER_FLAGS) \ # @@ -902,9 +902,9 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) LIBAWT_LWAWT_DIRS := \ $(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt \ - $(JDK_TOPDIR)/src/java.desktop/unix/native/common/sun/awt \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/font \ - $(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/java2d/opengl \ + $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \ + $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ # LIBAWT_LWAWT_CFLAGS := \ @@ -912,24 +912,24 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \ -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/include \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \ - -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl \ - -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/sun/awt \ - -I$(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_xawt/sun/awt \ - -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/sun/font \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/awt/image \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/java2d \ - -I$(JDK_TOPDIR)/src/java.desktop/unix/native/libawt/sun/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl \ + -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \ + -I$(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_xawt/awt \ + -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/font \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \ + -I$(JDK_TOPDIR)/src/java.desktop/unix/native/libawt/java2d \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libmlib_image/ \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/awt/image/cvutils \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/java2d/loops \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/sun/java2d/pipe \ - -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/sun/awt/debug \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \ + -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \ -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \ $(LIBJAVA_HEADER_FLAGS) \ # LIBAWT_LWAWT_EXFILES := fontpath.c awt_Font.c X11Color.c - LIBAWT_LWAWT_EXCLUDES := $(JDK_TOPDIR)/src/java.desktop/unix/native/common/sun/awt/medialib + LIBAWT_LWAWT_EXCLUDES := $(JDK_TOPDIR)/src/java.desktop/unix/native/common/awt/medialib $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_LWAWT, \ LIBRARY := awt_lwawt, \ @@ -985,7 +985,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB) \ -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxui \ - -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/sun/awt \ + -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \ -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \ -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \ -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \ diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTEvent.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTEvent.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTEvent.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTEvent.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTSurfaceLayers.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTSurfaceLayers.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTSurfaceLayers.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTSurfaceLayers.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTView.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTView.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTView.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTView.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTWindow.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTWindow.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTWindow.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTWindow.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/ApplicationDelegate.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/ApplicationDelegate.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/ApplicationDelegate.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/ApplicationDelegate.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CClipboard.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CClipboard.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CClipboard.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CClipboard.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CCursorManager.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CCursorManager.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CCursorManager.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CCursorManager.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDataTransferer.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDataTransferer.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDataTransferer.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDataTransferer.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDataTransferer.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDataTransferer.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDataTransferer.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDataTransferer.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDesktopPeer.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDesktopPeer.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDesktopPeer.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDesktopPeer.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDragSource.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDragSource.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDragSource.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDragSource.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDragSourceContextPeer.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSourceContextPeer.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDragSourceContextPeer.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSourceContextPeer.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDropTarget.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDropTarget.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDropTarget.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDropTarget.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDropTargetContextPeer.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTargetContextPeer.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDropTargetContextPeer.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTargetContextPeer.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CFRetainedResource.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFRetainedResource.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CFRetainedResource.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFRetainedResource.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CFileDialog.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFileDialog.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CFileDialog.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFileDialog.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CFileDialog.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFileDialog.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CFileDialog.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFileDialog.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CGraphicsConfig.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsConfig.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CGraphicsConfig.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsConfig.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CGraphicsDevice.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CGraphicsDevice.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CGraphicsEnv.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsEnv.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CGraphicsEnv.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsEnv.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CImage.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CImage.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CImage.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CImage.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CInputMethod.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CInputMethod.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CInputMethod.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CInputMethod.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenu.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenu.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenu.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenu.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuBar.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuBar.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuBar.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuBar.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuBar.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuBar.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuBar.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuBar.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuComponent.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuComponent.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuComponent.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuComponent.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuComponent.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuComponent.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuComponent.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuComponent.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuItem.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuItem.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuItem.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuItem.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CPopupMenu.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPopupMenu.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CPopupMenu.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPopupMenu.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CPopupMenu.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPopupMenu.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CPopupMenu.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPopupMenu.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CPrinterJob.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CPrinterJob.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CRobot.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CRobot.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CSystemColors.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CSystemColors.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CSystemColors.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CSystemColors.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CSystemColors.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CSystemColors.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CSystemColors.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CSystemColors.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CTextPipe.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTextPipe.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CTextPipe.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTextPipe.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CTrayIcon.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CTrayIcon.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CTrayIcon.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CTrayIcon.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CWrapper.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CWrapper.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CWrapper.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CWrapper.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/DnDUtilities.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/DnDUtilities.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/DnDUtilities.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/DnDUtilities.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/DnDUtilities.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/DnDUtilities.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/DnDUtilities.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/DnDUtilities.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/GeomUtilities.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/GeomUtilities.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/GeomUtilities.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/GeomUtilities.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/GeomUtilities.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/GeomUtilities.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/GeomUtilities.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/GeomUtilities.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/ImageSurfaceData.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ImageSurfaceData.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/ImageSurfaceData.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ImageSurfaceData.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/ImageSurfaceData.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ImageSurfaceData.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/ImageSurfaceData.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ImageSurfaceData.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/InitIDs.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/InitIDs.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/InitIDs.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/InitIDs.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/InitIDs.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/InitIDs.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/InitIDs.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/InitIDs.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaAccessibilityAction.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityAction.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaAccessibilityAction.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityAction.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaAccessibilityAction.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityAction.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaAccessibilityAction.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityAction.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaAccessibilityUtilities.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaAccessibilityUtilities.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaAccessibilityUtilities.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaAccessibilityUtilities.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaComponentAccessibility.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaComponentAccessibility.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaComponentAccessibility.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaComponentAccessibility.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaTextAccessibility.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaTextAccessibility.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaTextAccessibility.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaTextAccessibility.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/LWCToolkit.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/LWCToolkit.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/LWCToolkit.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/LWCToolkit.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/OSVersion.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/OSVersion.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/OSVersion.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/OSVersion.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/OSVersion.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/OSVersion.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/OSVersion.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/OSVersion.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrintModel.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrintModel.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrintModel.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrintModel.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrintModel.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrintModel.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrintModel.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrintModel.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrinterSurfaceData.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterSurfaceData.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrinterSurfaceData.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterSurfaceData.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrinterSurfaceData.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterSurfaceData.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrinterSurfaceData.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterSurfaceData.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrinterView.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrinterView.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrinterView.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrinterView.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/QuartzRenderer.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzRenderer.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/QuartzRenderer.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzRenderer.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/QuartzSurfaceData.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/QuartzSurfaceData.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/QuartzSurfaceData.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/QuartzSurfaceData.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/awt_DrawingSurface.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/awt_DrawingSurface.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/awt_DrawingSurface.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/awt_DrawingSurface.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/AWTFont.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/AWTFont.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/AWTFont.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/AWTFont.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/AWTStrike.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/AWTStrike.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/AWTStrike.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/AWTStrike.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTStrike.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CCharToGlyphMapper.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CCharToGlyphMapper.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CCharToGlyphMapper.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CCharToGlyphMapper.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CGGlyphImages.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CGGlyphImages.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CGGlyphImages.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CGGlyphImages.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CGGlyphOutlines.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphOutlines.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CGGlyphOutlines.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphOutlines.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CGGlyphOutlines.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphOutlines.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CGGlyphOutlines.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphOutlines.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CoreTextSupport.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CoreTextSupport.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CoreTextSupport.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CoreTextSupport.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CoreTextSupport.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CoreTextSupport.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font/CoreTextSupport.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/font/CoreTextSupport.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/CGLGraphicsConfig.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/CGLGraphicsConfig.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/CGLGraphicsConfig.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/CGLGraphicsConfig.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/CGLLayer.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLLayer.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/CGLLayer.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLLayer.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/CGLLayer.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLLayer.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/CGLLayer.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLLayer.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/CGLSurfaceData.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/CGLSurfaceData.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/CGLSurfaceData.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/CGLSurfaceData.m rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLSurfaceData.m diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/J2D_GL/cglext.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/J2D_GL/cglext.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/J2D_GL/cglext.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/J2D_GL/cglext.h diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/OGLFuncs_md.h b/jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/OGLFuncs_md.h similarity index 100% rename from jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/OGLFuncs_md.h rename to jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/OGLFuncs_md.h diff --git a/jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_assert.c b/jdk/src/java.desktop/share/native/common/awt/debug/debug_assert.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_assert.c rename to jdk/src/java.desktop/share/native/common/awt/debug/debug_assert.c diff --git a/jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_assert.h b/jdk/src/java.desktop/share/native/common/awt/debug/debug_assert.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_assert.h rename to jdk/src/java.desktop/share/native/common/awt/debug/debug_assert.h diff --git a/jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_mem.c b/jdk/src/java.desktop/share/native/common/awt/debug/debug_mem.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_mem.c rename to jdk/src/java.desktop/share/native/common/awt/debug/debug_mem.c diff --git a/jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_mem.h b/jdk/src/java.desktop/share/native/common/awt/debug/debug_mem.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_mem.h rename to jdk/src/java.desktop/share/native/common/awt/debug/debug_mem.h diff --git a/jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_trace.c b/jdk/src/java.desktop/share/native/common/awt/debug/debug_trace.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_trace.c rename to jdk/src/java.desktop/share/native/common/awt/debug/debug_trace.c diff --git a/jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_trace.h b/jdk/src/java.desktop/share/native/common/awt/debug/debug_trace.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_trace.h rename to jdk/src/java.desktop/share/native/common/awt/debug/debug_trace.h diff --git a/jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_util.c b/jdk/src/java.desktop/share/native/common/awt/debug/debug_util.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_util.c rename to jdk/src/java.desktop/share/native/common/awt/debug/debug_util.c diff --git a/jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_util.h b/jdk/src/java.desktop/share/native/common/awt/debug/debug_util.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/awt/debug/debug_util.h rename to jdk/src/java.desktop/share/native/common/awt/debug/debug_util.h diff --git a/jdk/src/java.desktop/share/native/common/sun/awt/medialib/mlib_ImageCopy_Bit.c b/jdk/src/java.desktop/share/native/common/awt/medialib/mlib_ImageCopy_Bit.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/awt/medialib/mlib_ImageCopy_Bit.c rename to jdk/src/java.desktop/share/native/common/awt/medialib/mlib_ImageCopy_Bit.c diff --git a/jdk/src/java.desktop/share/native/common/sun/awt/medialib/mlib_ImageCreate.c b/jdk/src/java.desktop/share/native/common/awt/medialib/mlib_ImageCreate.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/awt/medialib/mlib_ImageCreate.c rename to jdk/src/java.desktop/share/native/common/awt/medialib/mlib_ImageCreate.c diff --git a/jdk/src/java.desktop/share/native/common/sun/awt/medialib/mlib_sys.c b/jdk/src/java.desktop/share/native/common/awt/medialib/mlib_sys.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/awt/medialib/mlib_sys.c rename to jdk/src/java.desktop/share/native/common/awt/medialib/mlib_sys.c diff --git a/jdk/src/java.desktop/share/native/common/sun/awt/utility/rect.c b/jdk/src/java.desktop/share/native/common/awt/utility/rect.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/awt/utility/rect.c rename to jdk/src/java.desktop/share/native/common/awt/utility/rect.c diff --git a/jdk/src/java.desktop/share/native/common/sun/font/AccelGlyphCache.c b/jdk/src/java.desktop/share/native/common/font/AccelGlyphCache.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/font/AccelGlyphCache.c rename to jdk/src/java.desktop/share/native/common/font/AccelGlyphCache.c diff --git a/jdk/src/java.desktop/share/native/common/sun/font/AccelGlyphCache.h b/jdk/src/java.desktop/share/native/common/font/AccelGlyphCache.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/font/AccelGlyphCache.h rename to jdk/src/java.desktop/share/native/common/font/AccelGlyphCache.h diff --git a/jdk/src/java.desktop/share/native/common/sun/font/fontscalerdefs.h b/jdk/src/java.desktop/share/native/common/font/fontscalerdefs.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/font/fontscalerdefs.h rename to jdk/src/java.desktop/share/native/common/font/fontscalerdefs.h diff --git a/jdk/src/java.desktop/share/native/common/sun/font/sunfontids.h b/jdk/src/java.desktop/share/native/common/font/sunfontids.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/font/sunfontids.h rename to jdk/src/java.desktop/share/native/common/font/sunfontids.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/J2D_GL/gl.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/J2D_GL/gl.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/J2D_GL/gl.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/J2D_GL/gl.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/J2D_GL/glext.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/J2D_GL/glext.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/J2D_GL/glext.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/J2D_GL/glext.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLBlitLoops.c b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLBlitLoops.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLBlitLoops.c rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLBlitLoops.c diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLBlitLoops.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLBlitLoops.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLBlitLoops.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLBlitLoops.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLBufImgOps.c b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLBufImgOps.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLBufImgOps.c rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLBufImgOps.c diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLBufImgOps.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLBufImgOps.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLBufImgOps.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLBufImgOps.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLContext.c b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLContext.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLContext.c rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLContext.c diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLContext.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLContext.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLContext.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLContext.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLFuncMacros.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLFuncMacros.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLFuncMacros.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLFuncMacros.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLFuncs.c b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLFuncs.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLFuncs.c rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLFuncs.c diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLFuncs.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLFuncs.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLFuncs.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLFuncs.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLMaskBlit.c b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLMaskBlit.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLMaskBlit.c rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLMaskBlit.c diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLMaskBlit.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLMaskBlit.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLMaskBlit.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLMaskBlit.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLMaskFill.c b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLMaskFill.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLMaskFill.c rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLMaskFill.c diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLMaskFill.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLMaskFill.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLMaskFill.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLMaskFill.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLPaints.c b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLPaints.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLPaints.c rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLPaints.c diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLPaints.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLPaints.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLPaints.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLPaints.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLRenderQueue.c b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLRenderQueue.c rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.c diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLRenderQueue.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLRenderQueue.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLRenderQueue.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLRenderer.c b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLRenderer.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLRenderer.c rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLRenderer.c diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLRenderer.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLRenderer.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLRenderer.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLRenderer.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLSurfaceData.c b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLSurfaceData.c rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.c diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLSurfaceData.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLSurfaceData.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLTextRenderer.c b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLTextRenderer.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLTextRenderer.c rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLTextRenderer.c diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLTextRenderer.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLTextRenderer.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLTextRenderer.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLTextRenderer.h diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLVertexCache.c b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLVertexCache.c similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLVertexCache.c rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLVertexCache.c diff --git a/jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLVertexCache.h b/jdk/src/java.desktop/share/native/common/java2d/opengl/OGLVertexCache.h similarity index 100% rename from jdk/src/java.desktop/share/native/common/sun/java2d/opengl/OGLVertexCache.h rename to jdk/src/java.desktop/share/native/common/java2d/opengl/OGLVertexCache.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/BufImgSurfaceData.c b/jdk/src/java.desktop/share/native/libawt/awt/image/BufImgSurfaceData.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/BufImgSurfaceData.c rename to jdk/src/java.desktop/share/native/libawt/awt/image/BufImgSurfaceData.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/BufImgSurfaceData.h b/jdk/src/java.desktop/share/native/libawt/awt/image/BufImgSurfaceData.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/BufImgSurfaceData.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/BufImgSurfaceData.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/DataBufferNative.c b/jdk/src/java.desktop/share/native/libawt/awt/image/DataBufferNative.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/DataBufferNative.c rename to jdk/src/java.desktop/share/native/libawt/awt/image/DataBufferNative.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/awt_ImageRep.c b/jdk/src/java.desktop/share/native/libawt/awt/image/awt_ImageRep.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/awt_ImageRep.c rename to jdk/src/java.desktop/share/native/libawt/awt/image/awt_ImageRep.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/awt_parseImage.c b/jdk/src/java.desktop/share/native/libawt/awt/image/awt_parseImage.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/awt_parseImage.c rename to jdk/src/java.desktop/share/native/libawt/awt/image/awt_parseImage.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/awt_parseImage.h b/jdk/src/java.desktop/share/native/libawt/awt/image/awt_parseImage.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/awt_parseImage.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/awt_parseImage.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/README b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/README similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/README rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/README diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_alpha.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_alpha.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_alpha.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_alpha.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_anycm.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_anycm.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_anycm.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_anycm.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_colors.c b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_colors.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_colors.c rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_colors.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_colors.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_colors.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_colors.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_colors.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_dcm.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_dcm.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_dcm.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_dcm.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_dcm8.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_dcm8.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_dcm8.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_dcm8.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_dir8dither.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_dir8dither.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_dir8dither.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_dir8dither.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_dirdither.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_dirdither.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_dirdither.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_dirdither.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_fscolor.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_fscolor.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_fscolor.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_fscolor.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_fsdither.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_fsdither.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_fsdither.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_fsdither.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_fsgray.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_fsgray.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_fsgray.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_fsgray.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_fsutil.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_fsutil.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_fsutil.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_fsutil.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_globals.c b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_globals.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_globals.c rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_globals.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_globals.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_globals.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_globals.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_globals.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_icm.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_icm.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_icm.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_icm.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_input32.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_input32.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_input32.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_input32.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_input8.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_input8.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_input8.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_input8.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_input8_32.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_input8_32.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_input8_32.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_input8_32.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_nodither.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_nodither.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_nodither.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_nodither.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_noscale.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_noscale.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_noscale.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_noscale.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_opaque.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_opaque.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_opaque.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_opaque.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_ordclrsgn.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_ordclrsgn.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_ordclrsgn.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_ordclrsgn.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_ordclruns.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_ordclruns.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_ordclruns.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_ordclruns.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_orddither.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_orddither.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_orddither.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_orddither.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_ordgray.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_ordgray.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_ordgray.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_ordgray.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output16.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output16.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output16.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output16.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output16_32.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output16_32.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output16_32.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output16_32.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output24.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output24.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output24.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output24.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output32.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output32.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output32.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output32.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output8.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output8.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output8.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output8.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output8_16_24.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output8_16_24.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output8_16_24.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output8_16_24.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output8_16_32.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output8_16_32.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output8_16_32.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output8_16_32.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output8_32.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output8_32.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_output8_32.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_output8_32.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_replscale.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_replscale.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_replscale.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_replscale.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_scaleloop.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_scaleloop.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_scaleloop.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_scaleloop.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_util.h b/jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_util.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils/img_util.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/cvutils/img_util.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/dither.c b/jdk/src/java.desktop/share/native/libawt/awt/image/dither.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/dither.c rename to jdk/src/java.desktop/share/native/libawt/awt/image/dither.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/dither.h b/jdk/src/java.desktop/share/native/libawt/awt/image/dither.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/dither.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/dither.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/gif/gifdecoder.c b/jdk/src/java.desktop/share/native/libawt/awt/image/gif/gifdecoder.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/gif/gifdecoder.c rename to jdk/src/java.desktop/share/native/libawt/awt/image/gif/gifdecoder.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/imageInitIDs.c b/jdk/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/imageInitIDs.c rename to jdk/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/image/imageInitIDs.h b/jdk/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/image/imageInitIDs.h rename to jdk/src/java.desktop/share/native/libawt/awt/image/imageInitIDs.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/medialib/awt_ImagingLib.c b/jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/medialib/awt_ImagingLib.c rename to jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/awt/medialib/awt_ImagingLib.h b/jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/awt/medialib/awt_ImagingLib.h rename to jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/Disposer.c b/jdk/src/java.desktop/share/native/libawt/java2d/Disposer.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/Disposer.c rename to jdk/src/java.desktop/share/native/libawt/java2d/Disposer.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/Disposer.h b/jdk/src/java.desktop/share/native/libawt/java2d/Disposer.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/Disposer.h rename to jdk/src/java.desktop/share/native/libawt/java2d/Disposer.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/ShaderList.c b/jdk/src/java.desktop/share/native/libawt/java2d/ShaderList.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/ShaderList.c rename to jdk/src/java.desktop/share/native/libawt/java2d/ShaderList.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/ShaderList.h b/jdk/src/java.desktop/share/native/libawt/java2d/ShaderList.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/ShaderList.h rename to jdk/src/java.desktop/share/native/libawt/java2d/ShaderList.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/SurfaceData.c b/jdk/src/java.desktop/share/native/libawt/java2d/SurfaceData.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/SurfaceData.c rename to jdk/src/java.desktop/share/native/libawt/java2d/SurfaceData.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/SurfaceData.h b/jdk/src/java.desktop/share/native/libawt/java2d/SurfaceData.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/SurfaceData.h rename to jdk/src/java.desktop/share/native/libawt/java2d/SurfaceData.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/Trace.c b/jdk/src/java.desktop/share/native/libawt/java2d/Trace.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/Trace.c rename to jdk/src/java.desktop/share/native/libawt/java2d/Trace.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/Trace.h b/jdk/src/java.desktop/share/native/libawt/java2d/Trace.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/Trace.h rename to jdk/src/java.desktop/share/native/libawt/java2d/Trace.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AlphaMacros.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/AlphaMacros.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AlphaMacros.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/AlphaMacros.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AlphaMacros.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/AlphaMacros.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AlphaMacros.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/AlphaMacros.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AlphaMath.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/AlphaMath.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AlphaMath.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/AlphaMath.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AlphaMath.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/AlphaMath.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AlphaMath.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/AlphaMath.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Any3Byte.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Any3Byte.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Any3Byte.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Any3Byte.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Any3Byte.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Any3Byte.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Any3Byte.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Any3Byte.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Any4Byte.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Any4Byte.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Any4Byte.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Any4Byte.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Any4Byte.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Any4Byte.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Any4Byte.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Any4Byte.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyByte.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyByte.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyByte.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyByte.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyByte.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyByte.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyByte.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyByte.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyByteBinary.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyByteBinary.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyByteBinary.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyByteBinary.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyInt.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyInt.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyInt.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyInt.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyInt.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyInt.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyInt.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyInt.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyShort.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyShort.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyShort.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyShort.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyShort.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyShort.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/AnyShort.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/AnyShort.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Blit.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Blit.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Blit.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Blit.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/BlitBg.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/BlitBg.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/BlitBg.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/BlitBg.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteBinary1Bit.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteBinary1Bit.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteBinary1Bit.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteBinary1Bit.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteBinary1Bit.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteBinary1Bit.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteBinary1Bit.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteBinary1Bit.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteBinary2Bit.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteBinary2Bit.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteBinary2Bit.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteBinary2Bit.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteBinary2Bit.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteBinary2Bit.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteBinary2Bit.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteBinary2Bit.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteBinary4Bit.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteBinary4Bit.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteBinary4Bit.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteBinary4Bit.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteBinary4Bit.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteBinary4Bit.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteBinary4Bit.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteBinary4Bit.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteGray.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteGray.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteGray.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteGray.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteGray.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteGray.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteGray.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteGray.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteIndexed.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteIndexed.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteIndexed.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteIndexed.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteIndexed.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteIndexed.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ByteIndexed.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ByteIndexed.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawLine.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawLine.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawLine.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawLine.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawParallelogram.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawParallelogram.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawParallelogram.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawParallelogram.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawPath.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawPath.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawPath.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawPath.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawPath.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawPath.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawPath.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawPath.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawPolygons.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawPolygons.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawPolygons.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawPolygons.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawRect.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawRect.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawRect.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawRect.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FillParallelogram.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/FillParallelogram.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FillParallelogram.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/FillParallelogram.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FillPath.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/FillPath.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FillPath.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/FillPath.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FillRect.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/FillRect.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FillRect.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/FillRect.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FillSpans.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/FillSpans.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FillSpans.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/FillSpans.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FourByteAbgr.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/FourByteAbgr.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FourByteAbgr.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/FourByteAbgr.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FourByteAbgr.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/FourByteAbgr.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FourByteAbgr.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/FourByteAbgr.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FourByteAbgrPre.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/FourByteAbgrPre.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FourByteAbgrPre.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/FourByteAbgrPre.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FourByteAbgrPre.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/FourByteAbgrPre.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/FourByteAbgrPre.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/FourByteAbgrPre.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/GlyphImageRef.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/GlyphImageRef.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/GlyphImageRef.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/GlyphImageRef.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/GraphicsPrimitiveMgr.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/GraphicsPrimitiveMgr.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/GraphicsPrimitiveMgr.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/GraphicsPrimitiveMgr.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ImageData.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ImageData.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ImageData.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ImageData.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Index12Gray.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Index12Gray.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Index12Gray.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Index12Gray.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Index12Gray.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Index12Gray.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Index12Gray.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Index12Gray.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Index8Gray.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Index8Gray.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Index8Gray.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Index8Gray.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Index8Gray.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Index8Gray.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Index8Gray.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Index8Gray.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntArgb.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntArgb.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntArgb.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntArgb.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntArgb.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntArgb.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntArgb.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntArgb.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntArgbBm.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntArgbBm.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntArgbBm.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntArgbBm.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntArgbBm.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntArgbBm.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntArgbBm.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntArgbBm.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntArgbPre.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntArgbPre.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntArgbPre.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntArgbPre.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntArgbPre.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntArgbPre.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntArgbPre.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntArgbPre.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntBgr.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntBgr.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntBgr.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntBgr.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntBgr.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntBgr.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntBgr.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntBgr.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntDcm.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntDcm.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntDcm.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntDcm.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntRgb.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntRgb.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntRgb.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntRgb.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntRgb.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntRgb.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntRgb.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntRgb.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntRgbx.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntRgbx.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntRgbx.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntRgbx.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntRgbx.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/IntRgbx.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/IntRgbx.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/IntRgbx.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/LineUtils.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/LineUtils.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/LineUtils.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/LineUtils.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/LoopMacros.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/LoopMacros.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/LoopMacros.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/LoopMacros.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/MapAccelFunc.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/MapAccelFunc.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/MapAccelFunc.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/MapAccelFunc.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/MaskBlit.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/MaskBlit.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/MaskBlit.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/MaskBlit.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/MaskFill.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/MaskFill.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/MaskFill.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/MaskFill.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ParallelogramUtils.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ParallelogramUtils.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ParallelogramUtils.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ParallelogramUtils.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ProcessPath.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ProcessPath.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ProcessPath.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ProcessPath.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ProcessPath.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ScaledBlit.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ScaledBlit.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ScaledBlit.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ScaledBlit.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ThreeByteBgr.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ThreeByteBgr.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ThreeByteBgr.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ThreeByteBgr.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ThreeByteBgr.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/ThreeByteBgr.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/ThreeByteBgr.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/ThreeByteBgr.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/TransformHelper.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/TransformHelper.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/TransformHelper.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/TransformHelper.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort4444Argb.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort4444Argb.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort4444Argb.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort4444Argb.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort4444Argb.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort4444Argb.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort4444Argb.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort4444Argb.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort555Rgb.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort555Rgb.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort555Rgb.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort555Rgb.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort555Rgb.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort555Rgb.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort555Rgb.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort555Rgb.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort555Rgbx.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort555Rgbx.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort555Rgbx.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort555Rgbx.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort555Rgbx.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort555Rgbx.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort555Rgbx.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort555Rgbx.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort565Rgb.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort565Rgb.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort565Rgb.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort565Rgb.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort565Rgb.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort565Rgb.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/Ushort565Rgb.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/Ushort565Rgb.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/UshortGray.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/UshortGray.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/UshortGray.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/UshortGray.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/UshortGray.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/UshortGray.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/UshortGray.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/UshortGray.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/UshortIndexed.c b/jdk/src/java.desktop/share/native/libawt/java2d/loops/UshortIndexed.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/UshortIndexed.c rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/UshortIndexed.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/UshortIndexed.h b/jdk/src/java.desktop/share/native/libawt/java2d/loops/UshortIndexed.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/UshortIndexed.h rename to jdk/src/java.desktop/share/native/libawt/java2d/loops/UshortIndexed.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/BufferedMaskBlit.c b/jdk/src/java.desktop/share/native/libawt/java2d/pipe/BufferedMaskBlit.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/BufferedMaskBlit.c rename to jdk/src/java.desktop/share/native/libawt/java2d/pipe/BufferedMaskBlit.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/BufferedRenderPipe.c b/jdk/src/java.desktop/share/native/libawt/java2d/pipe/BufferedRenderPipe.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/BufferedRenderPipe.c rename to jdk/src/java.desktop/share/native/libawt/java2d/pipe/BufferedRenderPipe.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/PathConsumer2D.h b/jdk/src/java.desktop/share/native/libawt/java2d/pipe/PathConsumer2D.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/PathConsumer2D.h rename to jdk/src/java.desktop/share/native/libawt/java2d/pipe/PathConsumer2D.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/Region.c b/jdk/src/java.desktop/share/native/libawt/java2d/pipe/Region.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/Region.c rename to jdk/src/java.desktop/share/native/libawt/java2d/pipe/Region.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/Region.h b/jdk/src/java.desktop/share/native/libawt/java2d/pipe/Region.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/Region.h rename to jdk/src/java.desktop/share/native/libawt/java2d/pipe/Region.h diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/ShapeSpanIterator.c b/jdk/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/ShapeSpanIterator.c rename to jdk/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/SpanClipRenderer.c b/jdk/src/java.desktop/share/native/libawt/java2d/pipe/SpanClipRenderer.c similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/SpanClipRenderer.c rename to jdk/src/java.desktop/share/native/libawt/java2d/pipe/SpanClipRenderer.c diff --git a/jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/SpanIterator.h b/jdk/src/java.desktop/share/native/libawt/java2d/pipe/SpanIterator.h similarity index 100% rename from jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe/SpanIterator.h rename to jdk/src/java.desktop/share/native/libawt/java2d/pipe/SpanIterator.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/CUPSfuncs.c b/jdk/src/java.desktop/unix/native/common/awt/CUPSfuncs.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/CUPSfuncs.c rename to jdk/src/java.desktop/unix/native/common/awt/CUPSfuncs.c diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/X11Color.c b/jdk/src/java.desktop/unix/native/common/awt/X11Color.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/X11Color.c rename to jdk/src/java.desktop/unix/native/common/awt/X11Color.c diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/awt.h b/jdk/src/java.desktop/unix/native/common/awt/awt.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/awt.h rename to jdk/src/java.desktop/unix/native/common/awt/awt.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/awt_Component.h b/jdk/src/java.desktop/unix/native/common/awt/awt_Component.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/awt_Component.h rename to jdk/src/java.desktop/unix/native/common/awt/awt_Component.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/awt_DrawingSurface.h b/jdk/src/java.desktop/unix/native/common/awt/awt_DrawingSurface.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/awt_DrawingSurface.h rename to jdk/src/java.desktop/unix/native/common/awt/awt_DrawingSurface.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/awt_Font.c b/jdk/src/java.desktop/unix/native/common/awt/awt_Font.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/awt_Font.c rename to jdk/src/java.desktop/unix/native/common/awt/awt_Font.c diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/awt_Font.h b/jdk/src/java.desktop/unix/native/common/awt/awt_Font.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/awt_Font.h rename to jdk/src/java.desktop/unix/native/common/awt/awt_Font.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/awt_GraphicsEnv.h b/jdk/src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/awt_GraphicsEnv.h rename to jdk/src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/awt_Mlib.h b/jdk/src/java.desktop/unix/native/common/awt/awt_Mlib.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/awt_Mlib.h rename to jdk/src/java.desktop/unix/native/common/awt/awt_Mlib.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/awt_p.h b/jdk/src/java.desktop/unix/native/common/awt/awt_p.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/awt_p.h rename to jdk/src/java.desktop/unix/native/common/awt/awt_p.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/awt_util.h b/jdk/src/java.desktop/unix/native/common/awt/awt_util.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/awt_util.h rename to jdk/src/java.desktop/unix/native/common/awt/awt_util.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/color.h b/jdk/src/java.desktop/unix/native/common/awt/color.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/color.h rename to jdk/src/java.desktop/unix/native/common/awt/color.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/colordata.h b/jdk/src/java.desktop/unix/native/common/awt/colordata.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/colordata.h rename to jdk/src/java.desktop/unix/native/common/awt/colordata.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/extutil.h b/jdk/src/java.desktop/unix/native/common/awt/extutil.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/extutil.h rename to jdk/src/java.desktop/unix/native/common/awt/extutil.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/fontconfig.h b/jdk/src/java.desktop/unix/native/common/awt/fontconfig.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/fontconfig.h rename to jdk/src/java.desktop/unix/native/common/awt/fontconfig.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/fontpath.c b/jdk/src/java.desktop/unix/native/common/awt/fontpath.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/fontpath.c rename to jdk/src/java.desktop/unix/native/common/awt/fontpath.c diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/img_util_md.h b/jdk/src/java.desktop/unix/native/common/awt/img_util_md.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/img_util_md.h rename to jdk/src/java.desktop/unix/native/common/awt/img_util_md.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/medialib/mlib_v_ImageCopy_f.c b/jdk/src/java.desktop/unix/native/common/awt/medialib/mlib_v_ImageCopy_f.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/medialib/mlib_v_ImageCopy_f.c rename to jdk/src/java.desktop/unix/native/common/awt/medialib/mlib_v_ImageCopy_f.c diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/medialib/mlib_v_ImageCopy_f.h b/jdk/src/java.desktop/unix/native/common/awt/medialib/mlib_v_ImageCopy_f.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/medialib/mlib_v_ImageCopy_f.h rename to jdk/src/java.desktop/unix/native/common/awt/medialib/mlib_v_ImageCopy_f.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/medialib/vis_proto.h b/jdk/src/java.desktop/unix/native/common/awt/medialib/vis_proto.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/medialib/vis_proto.h rename to jdk/src/java.desktop/unix/native/common/awt/medialib/vis_proto.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/awt/utility/rect.h b/jdk/src/java.desktop/unix/native/common/awt/utility/rect.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/awt/utility/rect.h rename to jdk/src/java.desktop/unix/native/common/awt/utility/rect.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/font/X11FontScaler.h b/jdk/src/java.desktop/unix/native/common/font/X11FontScaler.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/font/X11FontScaler.h rename to jdk/src/java.desktop/unix/native/common/font/X11FontScaler.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/GLXGraphicsConfig.c b/jdk/src/java.desktop/unix/native/common/java2d/opengl/GLXGraphicsConfig.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/GLXGraphicsConfig.c rename to jdk/src/java.desktop/unix/native/common/java2d/opengl/GLXGraphicsConfig.c diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/GLXGraphicsConfig.h b/jdk/src/java.desktop/unix/native/common/java2d/opengl/GLXGraphicsConfig.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/GLXGraphicsConfig.h rename to jdk/src/java.desktop/unix/native/common/java2d/opengl/GLXGraphicsConfig.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/GLXSurfaceData.c b/jdk/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/GLXSurfaceData.c rename to jdk/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/GLXSurfaceData.h b/jdk/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/GLXSurfaceData.h rename to jdk/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/J2D_GL/glx.h b/jdk/src/java.desktop/unix/native/common/java2d/opengl/J2D_GL/glx.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/J2D_GL/glx.h rename to jdk/src/java.desktop/unix/native/common/java2d/opengl/J2D_GL/glx.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/J2D_GL/glxext.h b/jdk/src/java.desktop/unix/native/common/java2d/opengl/J2D_GL/glxext.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/J2D_GL/glxext.h rename to jdk/src/java.desktop/unix/native/common/java2d/opengl/J2D_GL/glxext.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/OGLFuncs_md.h b/jdk/src/java.desktop/unix/native/common/java2d/opengl/OGLFuncs_md.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/OGLFuncs_md.h rename to jdk/src/java.desktop/unix/native/common/java2d/opengl/OGLFuncs_md.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11FontScaler_md.c b/jdk/src/java.desktop/unix/native/common/java2d/x11/X11FontScaler_md.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11FontScaler_md.c rename to jdk/src/java.desktop/unix/native/common/java2d/x11/X11FontScaler_md.c diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11PMBlitLoops.c b/jdk/src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11PMBlitLoops.c rename to jdk/src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11Renderer.c b/jdk/src/java.desktop/unix/native/common/java2d/x11/X11Renderer.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11Renderer.c rename to jdk/src/java.desktop/unix/native/common/java2d/x11/X11Renderer.c diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11SurfaceData.c b/jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11SurfaceData.c rename to jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11SurfaceData.h b/jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11SurfaceData.h rename to jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h diff --git a/jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11TextRenderer_md.c b/jdk/src/java.desktop/unix/native/common/java2d/x11/X11TextRenderer_md.c similarity index 100% rename from jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11TextRenderer_md.c rename to jdk/src/java.desktop/unix/native/common/java2d/x11/X11TextRenderer_md.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/awt/awt_LoadLibrary.c b/jdk/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/awt/awt_LoadLibrary.c rename to jdk/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/awt/awt_Mlib.c b/jdk/src/java.desktop/unix/native/libawt/awt/awt_Mlib.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/awt/awt_Mlib.c rename to jdk/src/java.desktop/unix/native/libawt/awt/awt_Mlib.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/awt/initIDs.c b/jdk/src/java.desktop/unix/native/libawt/awt/initIDs.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/awt/initIDs.c rename to jdk/src/java.desktop/unix/native/libawt/awt/initIDs.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/awt/medialib/mlib_v_ImageCopy.c b/jdk/src/java.desktop/unix/native/libawt/awt/medialib/mlib_v_ImageCopy.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/awt/medialib/mlib_v_ImageCopy.c rename to jdk/src/java.desktop/unix/native/libawt/awt/medialib/mlib_v_ImageCopy.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/awt/medialib/mlib_v_ImageCopy_blk.s b/jdk/src/java.desktop/unix/native/libawt/awt/medialib/mlib_v_ImageCopy_blk.s similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/awt/medialib/mlib_v_ImageCopy_blk.s rename to jdk/src/java.desktop/unix/native/libawt/awt/medialib/mlib_v_ImageCopy_blk.s diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/awt/medialib/vis_asi.h b/jdk/src/java.desktop/unix/native/libawt/awt/medialib/vis_asi.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/awt/medialib/vis_asi.h rename to jdk/src/java.desktop/unix/native/libawt/awt/medialib/vis_asi.h diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/j2d_md.h b/jdk/src/java.desktop/unix/native/libawt/java2d/j2d_md.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/j2d_md.h rename to jdk/src/java.desktop/unix/native/libawt/java2d/j2d_md.h diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/java2d_Mlib.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/java2d_Mlib.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/java2d_Mlib.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/java2d_Mlib.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/java2d_Mlib.h b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/java2d_Mlib.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/java2d_Mlib.h rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/java2d_Mlib.h diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_ImageCopy.h b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_ImageCopy.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_ImageCopy.h rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_ImageCopy.h diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_ImageLogic_proto.h b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_ImageLogic_proto.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_ImageLogic_proto.h rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_ImageLogic_proto.h diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_ImageZoom.h b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_ImageZoom.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_ImageZoom.h rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_ImageZoom.h diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_ImageZoom_NN.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_ImageZoom_NN.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_ImageZoom_NN.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_ImageZoom_NN.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageClear.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageClear.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageClear.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageClear.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageClear_f.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageClear_f.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageClear_f.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageClear_f.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageClear_f.h b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageClear_f.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageClear_f.h rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageClear_f.h diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageConstLogic.h b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageConstLogic.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageConstLogic.h rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageConstLogic.h diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageConstXor.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageConstXor.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageConstXor.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageConstXor.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageLogic.h b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageLogic.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageLogic.h rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageLogic.h diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageLogic_proto.h b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageLogic_proto.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageLogic_proto.h rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageLogic_proto.h diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageXor.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageXor.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageXor.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageXor.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageZoom_NN_f.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageZoom_NN_f.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/mlib_v_ImageZoom_NN_f.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/mlib_v_ImageZoom_NN_f.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_AlphaMacros.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_AlphaMacros.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_AlphaMacros.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_AlphaMacros.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_AlphaMacros.h b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_AlphaMacros.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_AlphaMacros.h rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_AlphaMacros.h diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_AlphaMaskBlit.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_AlphaMaskBlit.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_AlphaMaskBlit.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_AlphaMaskBlit.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_AlphaMaskFill.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_AlphaMaskFill.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_AlphaMaskFill.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_AlphaMaskFill.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_ByteGray.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_ByteGray.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_ByteGray.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_ByteGray.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_ByteGray_FromRgb.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_ByteGray_FromRgb.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_ByteGray_FromRgb.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_ByteGray_FromRgb.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_ByteGray_Mask.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_ByteGray_Mask.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_ByteGray_Mask.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_ByteGray_Mask.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_ByteIndexed.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_ByteIndexed.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_ByteIndexed.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_ByteIndexed.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_DrawLine.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_DrawLine.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_DrawLine.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_DrawLine.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_FourByteAbgr.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_FourByteAbgr.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_FourByteAbgr.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_FourByteAbgr.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_FourByteAbgrPre.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_FourByteAbgrPre.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_FourByteAbgrPre.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_FourByteAbgrPre.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_FuncArray.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_FuncArray.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_FuncArray.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_FuncArray.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_GlyphList.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_GlyphList.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_GlyphList.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_GlyphList.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_GlyphListXor.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_GlyphListXor.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_GlyphListXor.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_GlyphListXor.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntArgb.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntArgb.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntArgb.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntArgb.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntArgbBm.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntArgbBm.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntArgbBm.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntArgbBm.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntArgbPre.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntArgbPre.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntArgbPre.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntArgbPre.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntArgbPre_Mask.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntArgbPre_Mask.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntArgbPre_Mask.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntArgbPre_Mask.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntBgr.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntBgr.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntBgr.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntBgr.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntRgb.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntRgb.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntRgb.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntRgb.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntRgbx.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntRgbx.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_IntRgbx.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_IntRgbx.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_Interp.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_Interp.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_Interp.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_Interp.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_SrcMaskFill.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_SrcMaskFill.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_SrcMaskFill.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_SrcMaskFill.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_SrcOverMaskBlit.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_SrcOverMaskBlit.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_SrcOverMaskBlit.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_SrcOverMaskBlit.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_SrcOverMaskFill.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_SrcOverMaskFill.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_SrcOverMaskFill.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_SrcOverMaskFill.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_ThreeByteBgr.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_ThreeByteBgr.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_ThreeByteBgr.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_ThreeByteBgr.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_UshortGray.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_UshortGray.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_UshortGray.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_UshortGray.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_UshortGray_FromRgb.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_UshortGray_FromRgb.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_UshortGray_FromRgb.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_UshortGray_FromRgb.c diff --git a/jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_XorBlit.c b/jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_XorBlit.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops/vis_XorBlit.c rename to jdk/src/java.desktop/unix/native/libawt/java2d/loops/vis_XorBlit.c diff --git a/jdk/src/java.desktop/unix/native/libawt_headless/sun/awt/HeadlessToolkit.c b/jdk/src/java.desktop/unix/native/libawt_headless/awt/HeadlessToolkit.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_headless/sun/awt/HeadlessToolkit.c rename to jdk/src/java.desktop/unix/native/libawt_headless/awt/HeadlessToolkit.c diff --git a/jdk/src/java.desktop/unix/native/libawt_headless/sun/awt/VDrawingArea.c b/jdk/src/java.desktop/unix/native/libawt_headless/awt/VDrawingArea.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_headless/sun/awt/VDrawingArea.c rename to jdk/src/java.desktop/unix/native/libawt_headless/awt/VDrawingArea.c diff --git a/jdk/src/java.desktop/unix/native/libawt_headless/sun/awt/VDrawingArea.h b/jdk/src/java.desktop/unix/native/libawt_headless/awt/VDrawingArea.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_headless/sun/awt/VDrawingArea.h rename to jdk/src/java.desktop/unix/native/libawt_headless/awt/VDrawingArea.h diff --git a/jdk/src/java.desktop/unix/native/libawt_headless/sun/awt/VDrawingAreaP.h b/jdk/src/java.desktop/unix/native/libawt_headless/awt/VDrawingAreaP.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_headless/sun/awt/VDrawingAreaP.h rename to jdk/src/java.desktop/unix/native/libawt_headless/awt/VDrawingAreaP.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/HPkeysym.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/HPkeysym.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/HPkeysym.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/HPkeysym.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/Xrandr.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/Xrandr.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/Xrandr.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/Xrandr.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_AWTEvent.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_AWTEvent.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_AWTEvent.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_AWTEvent.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_AWTEvent.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_AWTEvent.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_AWTEvent.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_AWTEvent.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_DrawingSurface.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_DrawingSurface.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_DrawingSurface.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_DrawingSurface.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Event.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Event.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Event.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Event.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_GraphicsEnv.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_GraphicsEnv.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_InputMethod.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_InputMethod.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Insets.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Insets.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Insets.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Insets.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_MenuComponent.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_MenuComponent.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_MenuComponent.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_MenuComponent.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Robot.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Robot.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_UNIXToolkit.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_UNIXToolkit.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_util.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_util.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_util.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_util.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/canvas.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/canvas.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/canvas.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/canvas.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/gtk2_interface.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/gtk2_interface.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/gtk2_interface.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/gtk2_interface.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/list.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/list.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/list.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/list.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/list.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/list.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/list.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/list.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/multiVis.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/multiVis.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/multiVis.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/multiVis.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/multi_font.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/multi_font.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/multi_font.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/multi_font.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/multi_font.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/multi_font.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/multi_font.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/multi_font.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/randr.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/randr.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/randr.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/randr.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/robot_common.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/robot_common.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/robot_common.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/robot_common.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/robot_common.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/robot_common.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/robot_common.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/robot_common.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/sun_awt_X11_GtkFileDialogPeer.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/sun_awt_X11_GtkFileDialogPeer.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/swing_GTKEngine.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/swing_GTKEngine.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/swing_GTKEngine.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/swing_GTKEngine.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/swing_GTKStyle.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/swing_GTKStyle.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/swing_GTKStyle.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/swing_GTKStyle.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/wsutils.h b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/wsutils.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/wsutils.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/awt/wsutils.h diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/java2d/x11/XRBackendNative.c b/jdk/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/java2d/x11/XRBackendNative.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/java2d/x11/XRSurfaceData.c b/jdk/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRSurfaceData.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/java2d/x11/XRSurfaceData.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRSurfaceData.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt/XToolkit.c b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt/XToolkit.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt/XWindow.c b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt/XWindow.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt/XlibWrapper.c b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt/XlibWrapper.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt/awt_Desktop.c b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/awt_Desktop.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt/awt_Desktop.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/xawt/awt_Desktop.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt/gnome_interface.c b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.c similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt/gnome_interface.c rename to jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.c diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt/gnome_interface.h b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.h similarity index 100% rename from jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt/gnome_interface.h rename to jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.h diff --git a/jdk/src/java.desktop/windows/native/common/sun/awt/utility/rect.h b/jdk/src/java.desktop/windows/native/common/awt/utility/rect.h similarity index 100% rename from jdk/src/java.desktop/windows/native/common/sun/awt/utility/rect.h rename to jdk/src/java.desktop/windows/native/common/awt/utility/rect.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DBadHardware.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBadHardware.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DBadHardware.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBadHardware.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DBlitLoops.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBlitLoops.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DBlitLoops.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBlitLoops.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DBlitLoops.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBlitLoops.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DBlitLoops.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBlitLoops.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DBufImgOps.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBufImgOps.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DBufImgOps.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBufImgOps.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DBufImgOps.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBufImgOps.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DBufImgOps.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBufImgOps.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DContext.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DContext.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DContext.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DContext.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DContext.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DGlyphCache.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGlyphCache.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DGlyphCache.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGlyphCache.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DGlyphCache.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGlyphCache.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DGlyphCache.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGlyphCache.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DGraphicsDevice.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGraphicsDevice.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DGraphicsDevice.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGraphicsDevice.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DGraphicsDevice.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGraphicsDevice.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DGraphicsDevice.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DGraphicsDevice.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DMaskBlit.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskBlit.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DMaskBlit.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskBlit.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DMaskBlit.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskBlit.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DMaskBlit.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskBlit.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DMaskCache.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskCache.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DMaskCache.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskCache.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DMaskCache.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskCache.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DMaskCache.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskCache.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DMaskFill.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskFill.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DMaskFill.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskFill.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DMaskFill.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskFill.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DMaskFill.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DMaskFill.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DPaints.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPaints.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DPaints.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPaints.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DPaints.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPaints.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DPaints.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPaints.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DPipeline.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipeline.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DPipeline.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipeline.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DPipelineManager.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DPipelineManager.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DPipelineManager.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DPipelineManager.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipelineManager.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DRenderQueue.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderQueue.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DRenderQueue.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderQueue.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DRenderQueue.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderQueue.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DRenderQueue.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderQueue.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DRenderer.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderer.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DRenderer.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderer.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DRenderer.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderer.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DRenderer.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DRenderer.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DResourceManager.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DResourceManager.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DResourceManager.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DResourceManager.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DResourceManager.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DResourceManager.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DResourceManager.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DResourceManager.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DShaderGen.c b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DShaderGen.c similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DShaderGen.c rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DShaderGen.c diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DShaders.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DShaders.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DShaders.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DShaders.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DSurfaceData.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DSurfaceData.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DSurfaceData.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DSurfaceData.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DSurfaceData.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DSurfaceData.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DSurfaceData.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DSurfaceData.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DTextRenderer.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DTextRenderer.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DTextRenderer.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DTextRenderer.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DTextRenderer.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DTextRenderer.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DTextRenderer.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DTextRenderer.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DVertexCacher.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DVertexCacher.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DVertexCacher.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DVertexCacher.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DVertexCacher.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DVertexCacher.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d/D3DVertexCacher.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DVertexCacher.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/j2d_md.h b/jdk/src/java.desktop/windows/native/libawt/java2d/j2d_md.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/j2d_md.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/j2d_md.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/opengl/J2D_GL/wglext.h b/jdk/src/java.desktop/windows/native/libawt/java2d/opengl/J2D_GL/wglext.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/opengl/J2D_GL/wglext.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/opengl/J2D_GL/wglext.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/opengl/OGLFuncs_md.h b/jdk/src/java.desktop/windows/native/libawt/java2d/opengl/OGLFuncs_md.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/opengl/OGLFuncs_md.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/opengl/OGLFuncs_md.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/opengl/WGLGraphicsConfig.c b/jdk/src/java.desktop/windows/native/libawt/java2d/opengl/WGLGraphicsConfig.c similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/opengl/WGLGraphicsConfig.c rename to jdk/src/java.desktop/windows/native/libawt/java2d/opengl/WGLGraphicsConfig.c diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/opengl/WGLGraphicsConfig.h b/jdk/src/java.desktop/windows/native/libawt/java2d/opengl/WGLGraphicsConfig.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/opengl/WGLGraphicsConfig.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/opengl/WGLGraphicsConfig.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/opengl/WGLSurfaceData.c b/jdk/src/java.desktop/windows/native/libawt/java2d/opengl/WGLSurfaceData.c similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/opengl/WGLSurfaceData.c rename to jdk/src/java.desktop/windows/native/libawt/java2d/opengl/WGLSurfaceData.c diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/opengl/WGLSurfaceData.h b/jdk/src/java.desktop/windows/native/libawt/java2d/opengl/WGLSurfaceData.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/opengl/WGLSurfaceData.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/opengl/WGLSurfaceData.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/windows/GDIBlitLoops.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/windows/GDIBlitLoops.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/windows/GDIBlitLoops.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/windows/GDIBlitLoops.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/windows/GDIRenderer.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/windows/GDIRenderer.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/windows/GDIRenderer.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/windows/GDIRenderer.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/windows/GDIWindowSurfaceData.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/windows/GDIWindowSurfaceData.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/windows/GDIWindowSurfaceData.h b/jdk/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/windows/GDIWindowSurfaceData.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/windows/WindowsFlags.cpp b/jdk/src/java.desktop/windows/native/libawt/java2d/windows/WindowsFlags.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/windows/WindowsFlags.cpp rename to jdk/src/java.desktop/windows/native/libawt/java2d/windows/WindowsFlags.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/java2d/windows/WindowsFlags.h b/jdk/src/java.desktop/windows/native/libawt/java2d/windows/WindowsFlags.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/java2d/windows/WindowsFlags.h rename to jdk/src/java.desktop/windows/native/libawt/java2d/windows/WindowsFlags.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/CmdIDList.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/CmdIDList.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/CmdIDList.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/CmdIDList.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/CmdIDList.h b/jdk/src/java.desktop/windows/native/libawt/windows/CmdIDList.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/CmdIDList.h rename to jdk/src/java.desktop/windows/native/libawt/windows/CmdIDList.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/ComCtl32Util.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/ComCtl32Util.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/ComCtl32Util.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/ComCtl32Util.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/ComCtl32Util.h b/jdk/src/java.desktop/windows/native/libawt/windows/ComCtl32Util.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/ComCtl32Util.h rename to jdk/src/java.desktop/windows/native/libawt/windows/ComCtl32Util.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/Devices.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/Devices.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/Devices.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/Devices.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/Devices.h b/jdk/src/java.desktop/windows/native/libawt/windows/Devices.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/Devices.h rename to jdk/src/java.desktop/windows/native/libawt/windows/Devices.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/DllUtil.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/DllUtil.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/DllUtil.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/DllUtil.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/DllUtil.h b/jdk/src/java.desktop/windows/native/libawt/windows/DllUtil.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/DllUtil.h rename to jdk/src/java.desktop/windows/native/libawt/windows/DllUtil.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/GDIHashtable.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/GDIHashtable.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/GDIHashtable.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/GDIHashtable.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/GDIHashtable.h b/jdk/src/java.desktop/windows/native/libawt/windows/GDIHashtable.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/GDIHashtable.h rename to jdk/src/java.desktop/windows/native/libawt/windows/GDIHashtable.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/Hashtable.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/Hashtable.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/Hashtable.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/Hashtable.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/Hashtable.h b/jdk/src/java.desktop/windows/native/libawt/windows/Hashtable.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/Hashtable.h rename to jdk/src/java.desktop/windows/native/libawt/windows/Hashtable.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/MouseInfo.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/MouseInfo.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/MouseInfo.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/MouseInfo.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/ObjectList.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/ObjectList.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/ObjectList.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/ObjectList.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/ObjectList.h b/jdk/src/java.desktop/windows/native/libawt/windows/ObjectList.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/ObjectList.h rename to jdk/src/java.desktop/windows/native/libawt/windows/ObjectList.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/README.JNI b/jdk/src/java.desktop/windows/native/libawt/windows/README.JNI similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/README.JNI rename to jdk/src/java.desktop/windows/native/libawt/windows/README.JNI diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/ShellFolder2.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/ShellFolder2.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/ThemeReader.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/ThemeReader.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/ThemeReader.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/ThemeReader.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/WPrinterJob.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/WPrinterJob.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/alloc.h b/jdk/src/java.desktop/windows/native/libawt/windows/alloc.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/alloc.h rename to jdk/src/java.desktop/windows/native/libawt/windows/alloc.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt.rc b/jdk/src/java.desktop/windows/native/libawt/windows/awt.rc similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt.rc rename to jdk/src/java.desktop/windows/native/libawt/windows/awt.rc diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_AWTEvent.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_AWTEvent.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_AWTEvent.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_AWTEvent.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_AWTEvent.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_AWTEvent.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_AWTEvent.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_AWTEvent.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_BitmapUtil.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_BitmapUtil.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_BitmapUtil.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_BitmapUtil.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_BitmapUtil.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_BitmapUtil.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_BitmapUtil.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_BitmapUtil.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Brush.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Brush.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Brush.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Brush.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Brush.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Brush.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Brush.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Brush.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Button.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Button.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Button.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Button.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Button.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Button.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Button.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Button.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Canvas.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Canvas.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Canvas.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Canvas.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Canvas.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Canvas.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Canvas.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Canvas.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Checkbox.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Checkbox.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Checkbox.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Checkbox.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Checkbox.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Checkbox.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Checkbox.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Checkbox.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Choice.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Choice.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Choice.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Choice.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Choice.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Choice.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Clipboard.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Clipboard.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Clipboard.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Clipboard.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Clipboard.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Clipboard.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Clipboard.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Clipboard.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Color.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Color.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Color.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Color.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Color.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Color.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Color.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Color.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Component.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Component.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Component.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Component.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Container.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Container.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Container.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Container.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Container.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Container.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Container.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Container.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Cursor.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Cursor.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Cursor.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Cursor.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Cursor.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Cursor.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Cursor.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Cursor.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_CustomPaletteDef.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_CustomPaletteDef.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_CustomPaletteDef.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_CustomPaletteDef.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DCHolder.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DCHolder.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DCHolder.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_DCHolder.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DCHolder.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DCHolder.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DCHolder.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_DCHolder.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DataTransferer.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DataTransferer.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DataTransferer.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_DataTransferer.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DataTransferer.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DataTransferer.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DataTransferer.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_DataTransferer.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Debug.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Debug.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Debug.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Debug.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Debug.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Debug.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Debug.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Debug.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Desktop.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Desktop.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DesktopProperties.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DesktopProperties.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DesktopProperties.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_DesktopProperties.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DesktopProperties.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DesktopProperties.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DesktopProperties.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_DesktopProperties.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Dialog.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Dialog.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Dialog.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Dialog.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Dialog.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Dialog.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Dialog.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Dialog.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Dimension.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Dimension.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Dimension.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Dimension.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Dimension.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Dimension.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Dimension.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Dimension.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DnDDS.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DnDDS.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DnDDS.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DnDDS.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DnDDT.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DnDDT.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DnDDT.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DnDDT.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DrawingSurface.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DrawingSurface.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DrawingSurface.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DrawingSurface.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Event.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Event.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Event.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Event.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Event.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Event.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Event.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Event.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_FileDialog.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_FileDialog.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_FileDialog.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_FileDialog.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_FileDialog.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_FileDialog.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_FileDialog.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_FileDialog.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Font.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Font.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Font.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Font.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Frame.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Frame.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Frame.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Frame.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_GDIObject.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_GDIObject.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_GDIObject.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_GDIObject.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_GDIObject.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_GDIObject.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_GDIObject.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_GDIObject.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_IconCursor.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_IconCursor.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_IconCursor.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_IconCursor.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_IconCursor.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_IconCursor.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_IconCursor.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_IconCursor.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputEvent.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_InputEvent.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputEvent.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_InputEvent.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputEvent.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_InputEvent.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputEvent.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_InputEvent.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputMethod.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_InputMethod.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputMethod.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_InputMethod.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputTextInfor.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_InputTextInfor.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputTextInfor.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_InputTextInfor.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputTextInfor.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_InputTextInfor.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputTextInfor.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_InputTextInfor.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Insets.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Insets.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Insets.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Insets.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Insets.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Insets.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Insets.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Insets.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_KeyEvent.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_KeyEvent.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_KeyEvent.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_KeyEvent.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_KeyEvent.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_KeyEvent.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_KeyEvent.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_KeyEvent.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_KeyboardFocusManager.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_KeyboardFocusManager.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_KeyboardFocusManager.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_KeyboardFocusManager.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Label.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Label.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Label.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Label.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Label.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Label.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Label.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Label.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_List.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_List.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_List.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_List.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_List.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_List.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_List.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_List.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Menu.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Menu.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Menu.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Menu.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Menu.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Menu.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Menu.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Menu.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MenuBar.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MenuBar.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MenuBar.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MenuBar.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MenuItem.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MenuItem.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MenuItem.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MenuItem.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Mlib.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Mlib.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Mlib.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Mlib.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Mlib.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Mlib.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Mlib.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Mlib.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MouseEvent.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_MouseEvent.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MouseEvent.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_MouseEvent.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MouseEvent.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_MouseEvent.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MouseEvent.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_MouseEvent.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Object.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Object.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Object.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Object.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Object.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Object.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Object.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Object.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Palette.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Palette.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Palette.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Palette.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Palette.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Palette.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Palette.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Palette.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Panel.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Panel.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Panel.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Panel.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Panel.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Panel.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Panel.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Panel.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Pen.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Pen.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Pen.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Pen.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Pen.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Pen.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Pen.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Pen.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PopupMenu.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PopupMenu.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PopupMenu.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_PopupMenu.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PopupMenu.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PopupMenu.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PopupMenu.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_PopupMenu.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintControl.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintControl.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintControl.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintControl.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintDialog.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintDialog.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintDialog.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintDialog.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintDialog.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintDialog.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintDialog.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintDialog.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintJob.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintJob.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Rectangle.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Rectangle.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Rectangle.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Rectangle.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Rectangle.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Rectangle.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Rectangle.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Rectangle.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Robot.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Robot.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Robot.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Robot.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_ScrollPane.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_ScrollPane.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_ScrollPane.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_ScrollPane.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_ScrollPane.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_ScrollPane.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_ScrollPane.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_ScrollPane.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Scrollbar.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Scrollbar.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Scrollbar.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Scrollbar.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Scrollbar.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Scrollbar.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Scrollbar.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Scrollbar.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextArea.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_TextArea.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextArea.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_TextArea.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextArea.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_TextArea.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextArea.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_TextArea.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextComponent.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_TextComponent.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextComponent.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_TextComponent.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextComponent.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_TextComponent.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextComponent.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_TextComponent.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextField.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_TextField.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextField.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_TextField.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextField.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_TextField.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextField.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_TextField.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Toolkit.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Toolkit.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Toolkit.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Toolkit.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TrayIcon.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TrayIcon.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TrayIcon.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TrayIcon.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsConfig.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsConfig.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsConfig.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsConfig.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsConfig.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsConfig.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsConfig.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsConfig.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsDevice.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsDevice.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsDevice.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsDevice.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsEnv.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsEnv.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Window.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Window.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Window.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Window.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_new.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_new.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_new.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_new.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_new.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_new.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_new.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_new.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_ole.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_ole.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_ole.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_ole.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_ole.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_ole.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_ole.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awt_ole.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/awtmsg.h b/jdk/src/java.desktop/windows/native/libawt/windows/awtmsg.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/awtmsg.h rename to jdk/src/java.desktop/windows/native/libawt/windows/awtmsg.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/check.bmp b/jdk/src/java.desktop/windows/native/libawt/windows/check.bmp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/check.bmp rename to jdk/src/java.desktop/windows/native/libawt/windows/check.bmp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/colordata.h b/jdk/src/java.desktop/windows/native/libawt/windows/colordata.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/colordata.h rename to jdk/src/java.desktop/windows/native/libawt/windows/colordata.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/hand.cur b/jdk/src/java.desktop/windows/native/libawt/windows/hand.cur similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/hand.cur rename to jdk/src/java.desktop/windows/native/libawt/windows/hand.cur diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/img_util_md.h b/jdk/src/java.desktop/windows/native/libawt/windows/img_util_md.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/img_util_md.h rename to jdk/src/java.desktop/windows/native/libawt/windows/img_util_md.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/initIDs.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/initIDs.cpp similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/initIDs.cpp rename to jdk/src/java.desktop/windows/native/libawt/windows/initIDs.cpp diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/mlib_types_md.h b/jdk/src/java.desktop/windows/native/libawt/windows/mlib_types_md.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/mlib_types_md.h rename to jdk/src/java.desktop/windows/native/libawt/windows/mlib_types_md.h diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/security_warning.ico b/jdk/src/java.desktop/windows/native/libawt/windows/security_warning.ico similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/security_warning.ico rename to jdk/src/java.desktop/windows/native/libawt/windows/security_warning.ico diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/security_warning_bw.ico b/jdk/src/java.desktop/windows/native/libawt/windows/security_warning_bw.ico similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/security_warning_bw.ico rename to jdk/src/java.desktop/windows/native/libawt/windows/security_warning_bw.ico diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/security_warning_int.ico b/jdk/src/java.desktop/windows/native/libawt/windows/security_warning_int.ico similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/security_warning_int.ico rename to jdk/src/java.desktop/windows/native/libawt/windows/security_warning_int.ico diff --git a/jdk/src/java.desktop/windows/native/libawt/sun/windows/stdhdrs.h b/jdk/src/java.desktop/windows/native/libawt/windows/stdhdrs.h similarity index 100% rename from jdk/src/java.desktop/windows/native/libawt/sun/windows/stdhdrs.h rename to jdk/src/java.desktop/windows/native/libawt/windows/stdhdrs.h From a7908759443d966a333f361e10ed026e36b1bf00 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 19 Sep 2014 09:42:27 -0700 Subject: [PATCH 52/81] 8056216: Remove "sun" directory layer from libawt and common Reviewed-by: erikj, ihse, coffeys --- common/bin/unshuffle_list.txt | 668 +++++++++++++++++----------------- 1 file changed, 334 insertions(+), 334 deletions(-) diff --git a/common/bin/unshuffle_list.txt b/common/bin/unshuffle_list.txt index 66f1fcd7b3e..678699a0dcb 100644 --- a/common/bin/unshuffle_list.txt +++ b/common/bin/unshuffle_list.txt @@ -531,87 +531,87 @@ jdk/src/java.desktop/macosx/classes/sun/awt/resources/awtosx.properties : jdk/sr jdk/src/java.desktop/macosx/classes/sun/java2d/BackBufferCapsProvider.java : jdk/src/macosx/classes/sun/java2d/BackBufferCapsProvider.java jdk/src/java.desktop/macosx/conf/flavormap.properties : jdk/src/macosx/lib/flavormap.properties jdk/src/java.desktop/macosx/native/include/jawt_md.h : jdk/src/macosx/javavm/export/jawt_md.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/ApplicationDelegate.h : jdk/src/macosx/native/sun/awt/ApplicationDelegate.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/ApplicationDelegate.m : jdk/src/macosx/native/sun/awt/ApplicationDelegate.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/awt_DrawingSurface.m : jdk/src/macosx/native/sun/awt/awt_DrawingSurface.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTEvent.h : jdk/src/macosx/native/sun/awt/AWTEvent.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTEvent.m : jdk/src/macosx/native/sun/awt/AWTEvent.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/awt.m : jdk/src/macosx/native/sun/awt/awt.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTSurfaceLayers.h : jdk/src/macosx/native/sun/awt/AWTSurfaceLayers.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTSurfaceLayers.m : jdk/src/macosx/native/sun/awt/AWTSurfaceLayers.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTView.h : jdk/src/macosx/native/sun/awt/AWTView.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTView.m : jdk/src/macosx/native/sun/awt/AWTView.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTWindow.h : jdk/src/macosx/native/sun/awt/AWTWindow.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/AWTWindow.m : jdk/src/macosx/native/sun/awt/AWTWindow.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CClipboard.m : jdk/src/macosx/native/sun/awt/CClipboard.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CCursorManager.m : jdk/src/macosx/native/sun/awt/CCursorManager.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDataTransferer.h : jdk/src/macosx/native/sun/awt/CDataTransferer.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDataTransferer.m : jdk/src/macosx/native/sun/awt/CDataTransferer.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDesktopPeer.m : jdk/src/macosx/native/sun/awt/CDesktopPeer.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDragSourceContextPeer.m : jdk/src/macosx/native/sun/awt/CDragSourceContextPeer.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDragSource.h : jdk/src/macosx/native/sun/awt/CDragSource.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDragSource.m : jdk/src/macosx/native/sun/awt/CDragSource.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDropTargetContextPeer.m : jdk/src/macosx/native/sun/awt/CDropTargetContextPeer.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDropTarget.h : jdk/src/macosx/native/sun/awt/CDropTarget.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CDropTarget.m : jdk/src/macosx/native/sun/awt/CDropTarget.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CFileDialog.h : jdk/src/macosx/native/sun/awt/CFileDialog.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CFileDialog.m : jdk/src/macosx/native/sun/awt/CFileDialog.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CFRetainedResource.m : jdk/src/macosx/native/sun/awt/CFRetainedResource.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CGraphicsConfig.m : jdk/src/macosx/native/sun/awt/CGraphicsConfig.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CGraphicsDevice.m : jdk/src/macosx/native/sun/awt/CGraphicsDevice.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CGraphicsEnv.m : jdk/src/macosx/native/sun/awt/CGraphicsEnv.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CImage.m : jdk/src/macosx/native/sun/awt/CImage.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CInputMethod.m : jdk/src/macosx/native/sun/awt/CInputMethod.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuBar.h : jdk/src/macosx/native/sun/awt/CMenuBar.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuBar.m : jdk/src/macosx/native/sun/awt/CMenuBar.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuComponent.h : jdk/src/macosx/native/sun/awt/CMenuComponent.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuComponent.m : jdk/src/macosx/native/sun/awt/CMenuComponent.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenu.h : jdk/src/macosx/native/sun/awt/CMenu.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuItem.h : jdk/src/macosx/native/sun/awt/CMenuItem.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenuItem.m : jdk/src/macosx/native/sun/awt/CMenuItem.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CMenu.m : jdk/src/macosx/native/sun/awt/CMenu.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CPopupMenu.h : jdk/src/macosx/native/sun/awt/CPopupMenu.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CPopupMenu.m : jdk/src/macosx/native/sun/awt/CPopupMenu.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CPrinterJob.m : jdk/src/macosx/native/sun/awt/CPrinterJob.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CRobot.m : jdk/src/macosx/native/sun/awt/CRobot.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CSystemColors.h : jdk/src/macosx/native/sun/awt/CSystemColors.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CSystemColors.m : jdk/src/macosx/native/sun/awt/CSystemColors.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CTextPipe.m : jdk/src/macosx/native/sun/awt/CTextPipe.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CTrayIcon.h : jdk/src/macosx/native/sun/awt/CTrayIcon.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CTrayIcon.m : jdk/src/macosx/native/sun/awt/CTrayIcon.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/CWrapper.m : jdk/src/macosx/native/sun/awt/CWrapper.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/DnDUtilities.h : jdk/src/macosx/native/sun/awt/DnDUtilities.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/DnDUtilities.m : jdk/src/macosx/native/sun/awt/DnDUtilities.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/GeomUtilities.h : jdk/src/macosx/native/sun/awt/GeomUtilities.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/GeomUtilities.m : jdk/src/macosx/native/sun/awt/GeomUtilities.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/ImageSurfaceData.h : jdk/src/macosx/native/sun/awt/ImageSurfaceData.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/ImageSurfaceData.m : jdk/src/macosx/native/sun/awt/ImageSurfaceData.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/InitIDs.h : jdk/src/macosx/native/sun/awt/InitIDs.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/InitIDs.m : jdk/src/macosx/native/sun/awt/InitIDs.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaAccessibilityAction.h : jdk/src/macosx/native/sun/awt/JavaAccessibilityAction.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaAccessibilityAction.m : jdk/src/macosx/native/sun/awt/JavaAccessibilityAction.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaAccessibilityUtilities.h : jdk/src/macosx/native/sun/awt/JavaAccessibilityUtilities.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaAccessibilityUtilities.m : jdk/src/macosx/native/sun/awt/JavaAccessibilityUtilities.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaComponentAccessibility.h : jdk/src/macosx/native/sun/awt/JavaComponentAccessibility.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaComponentAccessibility.m : jdk/src/macosx/native/sun/awt/JavaComponentAccessibility.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaTextAccessibility.h : jdk/src/macosx/native/sun/awt/JavaTextAccessibility.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/JavaTextAccessibility.m : jdk/src/macosx/native/sun/awt/JavaTextAccessibility.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/LWCToolkit.h : jdk/src/macosx/native/sun/awt/LWCToolkit.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/LWCToolkit.m : jdk/src/macosx/native/sun/awt/LWCToolkit.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/OSVersion.h : jdk/src/macosx/native/sun/awt/OSVersion.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/OSVersion.m : jdk/src/macosx/native/sun/awt/OSVersion.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrinterSurfaceData.h : jdk/src/macosx/native/sun/awt/PrinterSurfaceData.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrinterSurfaceData.m : jdk/src/macosx/native/sun/awt/PrinterSurfaceData.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrinterView.h : jdk/src/macosx/native/sun/awt/PrinterView.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrinterView.m : jdk/src/macosx/native/sun/awt/PrinterView.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrintModel.h : jdk/src/macosx/native/sun/awt/PrintModel.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/PrintModel.m : jdk/src/macosx/native/sun/awt/PrintModel.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/QuartzRenderer.m : jdk/src/macosx/native/sun/awt/QuartzRenderer.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/QuartzSurfaceData.h : jdk/src/macosx/native/sun/awt/QuartzSurfaceData.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/awt/QuartzSurfaceData.m : jdk/src/macosx/native/sun/awt/QuartzSurfaceData.m -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/font : jdk/src/macosx/native/sun/font -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl/J2D_GL/cglext.h : jdk/src/macosx/native/sun/java2d/opengl/J2D_GL/cglext.h -jdk/src/java.desktop/macosx/native/libawt_lwawt/sun/java2d/opengl : jdk/src/macosx/native/sun/java2d/opengl +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.h : jdk/src/macosx/native/sun/awt/ApplicationDelegate.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m : jdk/src/macosx/native/sun/awt/ApplicationDelegate.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/awt_DrawingSurface.m : jdk/src/macosx/native/sun/awt/awt_DrawingSurface.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.h : jdk/src/macosx/native/sun/awt/AWTEvent.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m : jdk/src/macosx/native/sun/awt/AWTEvent.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/awt.m : jdk/src/macosx/native/sun/awt/awt.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.h : jdk/src/macosx/native/sun/awt/AWTSurfaceLayers.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.m : jdk/src/macosx/native/sun/awt/AWTSurfaceLayers.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.h : jdk/src/macosx/native/sun/awt/AWTView.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m : jdk/src/macosx/native/sun/awt/AWTView.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.h : jdk/src/macosx/native/sun/awt/AWTWindow.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m : jdk/src/macosx/native/sun/awt/AWTWindow.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CClipboard.m : jdk/src/macosx/native/sun/awt/CClipboard.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CCursorManager.m : jdk/src/macosx/native/sun/awt/CCursorManager.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDataTransferer.h : jdk/src/macosx/native/sun/awt/CDataTransferer.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDataTransferer.m : jdk/src/macosx/native/sun/awt/CDataTransferer.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDesktopPeer.m : jdk/src/macosx/native/sun/awt/CDesktopPeer.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSourceContextPeer.m : jdk/src/macosx/native/sun/awt/CDragSourceContextPeer.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.h : jdk/src/macosx/native/sun/awt/CDragSource.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m : jdk/src/macosx/native/sun/awt/CDragSource.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTargetContextPeer.m : jdk/src/macosx/native/sun/awt/CDropTargetContextPeer.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.h : jdk/src/macosx/native/sun/awt/CDropTarget.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.m : jdk/src/macosx/native/sun/awt/CDropTarget.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFileDialog.h : jdk/src/macosx/native/sun/awt/CFileDialog.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFileDialog.m : jdk/src/macosx/native/sun/awt/CFileDialog.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CFRetainedResource.m : jdk/src/macosx/native/sun/awt/CFRetainedResource.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsConfig.m : jdk/src/macosx/native/sun/awt/CGraphicsConfig.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m : jdk/src/macosx/native/sun/awt/CGraphicsDevice.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsEnv.m : jdk/src/macosx/native/sun/awt/CGraphicsEnv.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CImage.m : jdk/src/macosx/native/sun/awt/CImage.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CInputMethod.m : jdk/src/macosx/native/sun/awt/CInputMethod.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuBar.h : jdk/src/macosx/native/sun/awt/CMenuBar.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuBar.m : jdk/src/macosx/native/sun/awt/CMenuBar.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuComponent.h : jdk/src/macosx/native/sun/awt/CMenuComponent.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuComponent.m : jdk/src/macosx/native/sun/awt/CMenuComponent.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.h : jdk/src/macosx/native/sun/awt/CMenu.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.h : jdk/src/macosx/native/sun/awt/CMenuItem.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m : jdk/src/macosx/native/sun/awt/CMenuItem.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenu.m : jdk/src/macosx/native/sun/awt/CMenu.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPopupMenu.h : jdk/src/macosx/native/sun/awt/CPopupMenu.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPopupMenu.m : jdk/src/macosx/native/sun/awt/CPopupMenu.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m : jdk/src/macosx/native/sun/awt/CPrinterJob.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m : jdk/src/macosx/native/sun/awt/CRobot.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CSystemColors.h : jdk/src/macosx/native/sun/awt/CSystemColors.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CSystemColors.m : jdk/src/macosx/native/sun/awt/CSystemColors.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTextPipe.m : jdk/src/macosx/native/sun/awt/CTextPipe.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.h : jdk/src/macosx/native/sun/awt/CTrayIcon.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.m : jdk/src/macosx/native/sun/awt/CTrayIcon.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CWrapper.m : jdk/src/macosx/native/sun/awt/CWrapper.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/DnDUtilities.h : jdk/src/macosx/native/sun/awt/DnDUtilities.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/DnDUtilities.m : jdk/src/macosx/native/sun/awt/DnDUtilities.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/GeomUtilities.h : jdk/src/macosx/native/sun/awt/GeomUtilities.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/GeomUtilities.m : jdk/src/macosx/native/sun/awt/GeomUtilities.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ImageSurfaceData.h : jdk/src/macosx/native/sun/awt/ImageSurfaceData.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/ImageSurfaceData.m : jdk/src/macosx/native/sun/awt/ImageSurfaceData.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/InitIDs.h : jdk/src/macosx/native/sun/awt/InitIDs.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/InitIDs.m : jdk/src/macosx/native/sun/awt/InitIDs.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityAction.h : jdk/src/macosx/native/sun/awt/JavaAccessibilityAction.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityAction.m : jdk/src/macosx/native/sun/awt/JavaAccessibilityAction.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.h : jdk/src/macosx/native/sun/awt/JavaAccessibilityUtilities.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaAccessibilityUtilities.m : jdk/src/macosx/native/sun/awt/JavaAccessibilityUtilities.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.h : jdk/src/macosx/native/sun/awt/JavaComponentAccessibility.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m : jdk/src/macosx/native/sun/awt/JavaComponentAccessibility.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.h : jdk/src/macosx/native/sun/awt/JavaTextAccessibility.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaTextAccessibility.m : jdk/src/macosx/native/sun/awt/JavaTextAccessibility.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.h : jdk/src/macosx/native/sun/awt/LWCToolkit.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m : jdk/src/macosx/native/sun/awt/LWCToolkit.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/OSVersion.h : jdk/src/macosx/native/sun/awt/OSVersion.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/OSVersion.m : jdk/src/macosx/native/sun/awt/OSVersion.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterSurfaceData.h : jdk/src/macosx/native/sun/awt/PrinterSurfaceData.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterSurfaceData.m : jdk/src/macosx/native/sun/awt/PrinterSurfaceData.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.h : jdk/src/macosx/native/sun/awt/PrinterView.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m : jdk/src/macosx/native/sun/awt/PrinterView.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrintModel.h : jdk/src/macosx/native/sun/awt/PrintModel.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/PrintModel.m : jdk/src/macosx/native/sun/awt/PrintModel.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzRenderer.m : jdk/src/macosx/native/sun/awt/QuartzRenderer.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.h : jdk/src/macosx/native/sun/awt/QuartzSurfaceData.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/QuartzSurfaceData.m : jdk/src/macosx/native/sun/awt/QuartzSurfaceData.m +jdk/src/java.desktop/macosx/native/libawt_lwawt/font : jdk/src/macosx/native/sun/font +jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/J2D_GL/cglext.h : jdk/src/macosx/native/sun/java2d/opengl/J2D_GL/cglext.h +jdk/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl : jdk/src/macosx/native/sun/java2d/opengl jdk/src/java.desktop/macosx/native/libjawt/jawt.m : jdk/src/macosx/native/sun/awt/jawt.m jdk/src/java.desktop/macosx/native/libjsound : jdk/src/macosx/native/com/sun/media/sound jdk/src/java.desktop/macosx/native/libosxapp : jdk/src/macosx/native/sun/osxapp @@ -686,26 +686,26 @@ jdk/src/java.desktop/share/conf/images/cursors : jdk/src/share/lib/images/cursor jdk/src/java.desktop/share/conf/psfontj2d.properties : jdk/src/share/classes/sun/print/psfontj2d.properties jdk/src/java.desktop/share/conf/psfont.properties.ja : jdk/src/share/classes/sun/print/psfont.properties.ja jdk/src/java.desktop/share/conf/sound.properties : jdk/src/share/lib/sound.properties -jdk/src/java.desktop/share/native/common/sun/awt/debug : jdk/src/share/native/sun/awt/debug -jdk/src/java.desktop/share/native/common/sun/awt/medialib/mlib_ImageCopy_Bit.c : jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c -jdk/src/java.desktop/share/native/common/sun/awt/medialib/mlib_ImageCreate.c : jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c -jdk/src/java.desktop/share/native/common/sun/awt/medialib/mlib_sys.c : jdk/src/share/native/sun/awt/medialib/mlib_sys.c -jdk/src/java.desktop/share/native/common/sun/awt/utility/rect.c : jdk/src/share/native/sun/awt/utility/rect.c -jdk/src/java.desktop/share/native/common/sun/font/AccelGlyphCache.c : jdk/src/share/native/sun/font/AccelGlyphCache.c -jdk/src/java.desktop/share/native/common/sun/font/AccelGlyphCache.h : jdk/src/share/native/sun/font/AccelGlyphCache.h -jdk/src/java.desktop/share/native/common/sun/font/fontscalerdefs.h : jdk/src/share/native/sun/font/fontscalerdefs.h -jdk/src/java.desktop/share/native/common/sun/font/sunfontids.h : jdk/src/share/native/sun/font/sunfontids.h -jdk/src/java.desktop/share/native/common/sun/java2d/opengl/J2D_GL : jdk/src/share/native/sun/java2d/opengl/J2D_GL -jdk/src/java.desktop/share/native/common/sun/java2d/opengl : jdk/src/share/native/sun/java2d/opengl +jdk/src/java.desktop/share/native/common/awt/debug : jdk/src/share/native/sun/awt/debug +jdk/src/java.desktop/share/native/common/awt/medialib/mlib_ImageCopy_Bit.c : jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c +jdk/src/java.desktop/share/native/common/awt/medialib/mlib_ImageCreate.c : jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c +jdk/src/java.desktop/share/native/common/awt/medialib/mlib_sys.c : jdk/src/share/native/sun/awt/medialib/mlib_sys.c +jdk/src/java.desktop/share/native/common/awt/utility/rect.c : jdk/src/share/native/sun/awt/utility/rect.c +jdk/src/java.desktop/share/native/common/font/AccelGlyphCache.c : jdk/src/share/native/sun/font/AccelGlyphCache.c +jdk/src/java.desktop/share/native/common/font/AccelGlyphCache.h : jdk/src/share/native/sun/font/AccelGlyphCache.h +jdk/src/java.desktop/share/native/common/font/fontscalerdefs.h : jdk/src/share/native/sun/font/fontscalerdefs.h +jdk/src/java.desktop/share/native/common/font/sunfontids.h : jdk/src/share/native/sun/font/sunfontids.h +jdk/src/java.desktop/share/native/common/java2d/opengl/J2D_GL : jdk/src/share/native/sun/java2d/opengl/J2D_GL +jdk/src/java.desktop/share/native/common/java2d/opengl : jdk/src/share/native/sun/java2d/opengl jdk/src/java.desktop/share/native/include/jawt.h : jdk/src/share/javavm/export/jawt.h -jdk/src/java.desktop/share/native/libawt/sun/awt/image/cvutils : jdk/src/share/native/sun/awt/image/cvutils -jdk/src/java.desktop/share/native/libawt/sun/awt/image/gif/gifdecoder.c : jdk/src/share/native/sun/awt/image/gif/gifdecoder.c -jdk/src/java.desktop/share/native/libawt/sun/awt/image : jdk/src/share/native/sun/awt/image -jdk/src/java.desktop/share/native/libawt/sun/awt/medialib/awt_ImagingLib.c : jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c -jdk/src/java.desktop/share/native/libawt/sun/awt/medialib/awt_ImagingLib.h : jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.h -jdk/src/java.desktop/share/native/libawt/sun/java2d : jdk/src/share/native/sun/java2d -jdk/src/java.desktop/share/native/libawt/sun/java2d/loops : jdk/src/share/native/sun/java2d/loops -jdk/src/java.desktop/share/native/libawt/sun/java2d/pipe : jdk/src/share/native/sun/java2d/pipe +jdk/src/java.desktop/share/native/libawt/awt/image/cvutils : jdk/src/share/native/sun/awt/image/cvutils +jdk/src/java.desktop/share/native/libawt/awt/image/gif/gifdecoder.c : jdk/src/share/native/sun/awt/image/gif/gifdecoder.c +jdk/src/java.desktop/share/native/libawt/awt/image : jdk/src/share/native/sun/awt/image +jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c : jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c +jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.h : jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.h +jdk/src/java.desktop/share/native/libawt/java2d : jdk/src/share/native/sun/java2d +jdk/src/java.desktop/share/native/libawt/java2d/loops : jdk/src/share/native/sun/java2d/loops +jdk/src/java.desktop/share/native/libawt/java2d/pipe : jdk/src/share/native/sun/java2d/pipe jdk/src/java.desktop/share/native/libfontmanager/DrawGlyphList.c : jdk/src/share/native/sun/font/DrawGlyphList.c jdk/src/java.desktop/share/native/libfontmanager/FontInstanceAdapter.cpp : jdk/src/share/native/sun/font/FontInstanceAdapter.cpp jdk/src/java.desktop/share/native/libfontmanager/FontInstanceAdapter.h : jdk/src/share/native/sun/font/FontInstanceAdapter.h @@ -833,80 +833,80 @@ jdk/src/java.desktop/unix/classes/sun/print : jdk/src/solaris/classes/sun/print jdk/src/java.desktop/unix/conf/flavormap.properties : jdk/src/solaris/lib/flavormap.properties jdk/src/java.desktop/unix/conf/fonts/fonts.dir : jdk/src/solaris/classes/sun/awt/motif/java.fonts.dir jdk/src/java.desktop/unix/conf/images/cursors/cursors.properties : jdk/src/solaris/lib/images/cursors/cursors.properties -jdk/src/java.desktop/unix/native/common/sun/awt/awt_Component.h : jdk/src/solaris/native/sun/awt/awt_Component.h -jdk/src/java.desktop/unix/native/common/sun/awt/awt_DrawingSurface.h : jdk/src/solaris/native/sun/awt/awt_DrawingSurface.h -jdk/src/java.desktop/unix/native/common/sun/awt/awt_Font.c : jdk/src/solaris/native/sun/awt/awt_Font.c -jdk/src/java.desktop/unix/native/common/sun/awt/awt_Font.h : jdk/src/solaris/native/sun/awt/awt_Font.h -jdk/src/java.desktop/unix/native/common/sun/awt/awt_GraphicsEnv.h : jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.h -jdk/src/java.desktop/unix/native/common/sun/awt/awt.h : jdk/src/solaris/native/sun/awt/awt.h -jdk/src/java.desktop/unix/native/common/sun/awt/awt_Mlib.h : jdk/src/solaris/native/sun/awt/awt_Mlib.h -jdk/src/java.desktop/unix/native/common/sun/awt/awt_p.h : jdk/src/solaris/native/sun/awt/awt_p.h -jdk/src/java.desktop/unix/native/common/sun/awt/awt_util.h : jdk/src/solaris/native/sun/awt/awt_util.h -jdk/src/java.desktop/unix/native/common/sun/awt/colordata.h : jdk/src/solaris/native/sun/awt/colordata.h -jdk/src/java.desktop/unix/native/common/sun/awt/color.h : jdk/src/solaris/native/sun/awt/color.h -jdk/src/java.desktop/unix/native/common/sun/awt/CUPSfuncs.c : jdk/src/solaris/native/sun/awt/CUPSfuncs.c -jdk/src/java.desktop/unix/native/common/sun/awt/fontconfig.h : jdk/src/solaris/native/sun/awt/fontconfig.h -jdk/src/java.desktop/unix/native/common/sun/awt/fontpath.c : jdk/src/solaris/native/sun/awt/fontpath.c -jdk/src/java.desktop/unix/native/common/sun/awt/img_util_md.h : jdk/src/solaris/native/sun/awt/img_util_md.h -jdk/src/java.desktop/unix/native/common/sun/awt/initIDs.c : jdk/src/solaris/native/sun/awt/initIDs.c -jdk/src/java.desktop/unix/native/common/sun/awt/medialib/mlib_v_ImageCopy_f.c : jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageCopy_f.c -jdk/src/java.desktop/unix/native/common/sun/awt/medialib/mlib_v_ImageCopy_f.h : jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageCopy_f.h -jdk/src/java.desktop/unix/native/common/sun/awt/medialib/vis_proto.h : jdk/src/solaris/native/sun/awt/medialib/vis_proto.h -jdk/src/java.desktop/unix/native/common/sun/awt/utility/rect.h : jdk/src/solaris/native/sun/awt/utility/rect.h -jdk/src/java.desktop/unix/native/common/sun/awt/X11Color.c : jdk/src/solaris/native/sun/awt/X11Color.c -jdk/src/java.desktop/unix/native/common/sun/font/X11FontScaler.h : jdk/src/solaris/native/sun/font/X11FontScaler.h -jdk/src/java.desktop/unix/native/common/sun/java2d/opengl/J2D_GL : jdk/src/solaris/native/sun/java2d/opengl/J2D_GL -jdk/src/java.desktop/unix/native/common/sun/java2d/opengl : jdk/src/solaris/native/sun/java2d/opengl -jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11FontScaler_md.c : jdk/src/solaris/native/sun/java2d/x11/X11FontScaler_md.c -jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11PMBlitLoops.c : jdk/src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c -jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11Renderer.c : jdk/src/solaris/native/sun/java2d/x11/X11Renderer.c -jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11SurfaceData.c : jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c -jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11SurfaceData.h : jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h -jdk/src/java.desktop/unix/native/common/sun/java2d/x11/X11TextRenderer_md.c : jdk/src/solaris/native/sun/java2d/x11/X11TextRenderer_md.c +jdk/src/java.desktop/unix/native/common/awt/awt_Component.h : jdk/src/solaris/native/sun/awt/awt_Component.h +jdk/src/java.desktop/unix/native/common/awt/awt_DrawingSurface.h : jdk/src/solaris/native/sun/awt/awt_DrawingSurface.h +jdk/src/java.desktop/unix/native/common/awt/awt_Font.c : jdk/src/solaris/native/sun/awt/awt_Font.c +jdk/src/java.desktop/unix/native/common/awt/awt_Font.h : jdk/src/solaris/native/sun/awt/awt_Font.h +jdk/src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h : jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.h +jdk/src/java.desktop/unix/native/common/awt/awt.h : jdk/src/solaris/native/sun/awt/awt.h +jdk/src/java.desktop/unix/native/common/awt/awt_Mlib.h : jdk/src/solaris/native/sun/awt/awt_Mlib.h +jdk/src/java.desktop/unix/native/common/awt/awt_p.h : jdk/src/solaris/native/sun/awt/awt_p.h +jdk/src/java.desktop/unix/native/common/awt/awt_util.h : jdk/src/solaris/native/sun/awt/awt_util.h +jdk/src/java.desktop/unix/native/common/awt/colordata.h : jdk/src/solaris/native/sun/awt/colordata.h +jdk/src/java.desktop/unix/native/common/awt/color.h : jdk/src/solaris/native/sun/awt/color.h +jdk/src/java.desktop/unix/native/common/awt/CUPSfuncs.c : jdk/src/solaris/native/sun/awt/CUPSfuncs.c +jdk/src/java.desktop/unix/native/common/awt/fontconfig.h : jdk/src/solaris/native/sun/awt/fontconfig.h +jdk/src/java.desktop/unix/native/common/awt/fontpath.c : jdk/src/solaris/native/sun/awt/fontpath.c +jdk/src/java.desktop/unix/native/common/awt/img_util_md.h : jdk/src/solaris/native/sun/awt/img_util_md.h +jdk/src/java.desktop/unix/native/common/awt/initIDs.c : jdk/src/solaris/native/sun/awt/initIDs.c +jdk/src/java.desktop/unix/native/common/awt/medialib/mlib_v_ImageCopy_f.c : jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageCopy_f.c +jdk/src/java.desktop/unix/native/common/awt/medialib/mlib_v_ImageCopy_f.h : jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageCopy_f.h +jdk/src/java.desktop/unix/native/common/awt/medialib/vis_proto.h : jdk/src/solaris/native/sun/awt/medialib/vis_proto.h +jdk/src/java.desktop/unix/native/common/awt/utility/rect.h : jdk/src/solaris/native/sun/awt/utility/rect.h +jdk/src/java.desktop/unix/native/common/awt/X11Color.c : jdk/src/solaris/native/sun/awt/X11Color.c +jdk/src/java.desktop/unix/native/common/font/X11FontScaler.h : jdk/src/solaris/native/sun/font/X11FontScaler.h +jdk/src/java.desktop/unix/native/common/java2d/opengl/J2D_GL : jdk/src/solaris/native/sun/java2d/opengl/J2D_GL +jdk/src/java.desktop/unix/native/common/java2d/opengl : jdk/src/solaris/native/sun/java2d/opengl +jdk/src/java.desktop/unix/native/common/java2d/x11/X11FontScaler_md.c : jdk/src/solaris/native/sun/java2d/x11/X11FontScaler_md.c +jdk/src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c : jdk/src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c +jdk/src/java.desktop/unix/native/common/java2d/x11/X11Renderer.c : jdk/src/solaris/native/sun/java2d/x11/X11Renderer.c +jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c : jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c +jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h : jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h +jdk/src/java.desktop/unix/native/common/java2d/x11/X11TextRenderer_md.c : jdk/src/solaris/native/sun/java2d/x11/X11TextRenderer_md.c jdk/src/java.desktop/unix/native/include/jawt_md.h : jdk/src/solaris/javavm/export/jawt_md.h -jdk/src/java.desktop/unix/native/libawt_headless/sun/awt/HeadlessToolkit.c : jdk/src/solaris/native/sun/awt/HeadlessToolkit.c -jdk/src/java.desktop/unix/native/libawt_headless/sun/awt/VDrawingArea.c : jdk/src/solaris/native/sun/awt/VDrawingArea.c -jdk/src/java.desktop/unix/native/libawt/sun/awt/awt_LoadLibrary.c : jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c -jdk/src/java.desktop/unix/native/libawt/sun/awt/awt_Mlib.c : jdk/src/solaris/native/sun/awt/awt_Mlib.c -jdk/src/java.desktop/unix/native/libawt/sun/awt/medialib/mlib_v_ImageCopy_blk.s : jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageCopy_blk.s -jdk/src/java.desktop/unix/native/libawt/sun/awt/medialib/mlib_v_ImageCopy.c : jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageCopy.c -jdk/src/java.desktop/unix/native/libawt/sun/awt/medialib/vis_asi.h : jdk/src/solaris/native/sun/awt/medialib/vis_asi.h -jdk/src/java.desktop/unix/native/libawt/sun/java2d/j2d_md.h : jdk/src/solaris/native/sun/java2d/j2d_md.h -jdk/src/java.desktop/unix/native/libawt/sun/java2d/loops : jdk/src/solaris/native/sun/java2d/loops -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_AWTEvent.c : jdk/src/solaris/native/sun/awt/awt_AWTEvent.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_AWTEvent.h : jdk/src/solaris/native/sun/awt/awt_AWTEvent.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_DrawingSurface.c : jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Event.c : jdk/src/solaris/native/sun/awt/awt_Event.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Event.h : jdk/src/solaris/native/sun/awt/awt_Event.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_GraphicsEnv.c : jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_InputMethod.c : jdk/src/solaris/native/sun/awt/awt_InputMethod.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Insets.c : jdk/src/solaris/native/sun/awt/awt_Insets.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Insets.h : jdk/src/solaris/native/sun/awt/awt_Insets.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_MenuComponent.h : jdk/src/solaris/native/sun/awt/awt_MenuComponent.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_Robot.c : jdk/src/solaris/native/sun/awt/awt_Robot.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_UNIXToolkit.c : jdk/src/solaris/native/sun/awt/awt_UNIXToolkit.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/awt_util.c : jdk/src/solaris/native/sun/awt/awt_util.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/canvas.h : jdk/src/solaris/native/sun/awt/canvas.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/gtk2_interface.c : jdk/src/solaris/native/sun/awt/gtk2_interface.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/gtk2_interface.h : jdk/src/solaris/native/sun/awt/gtk2_interface.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/HPkeysym.h : jdk/src/solaris/native/sun/awt/HPkeysym.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/list.c : jdk/src/solaris/native/sun/awt/list.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/list.h : jdk/src/solaris/native/sun/awt/list.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/multi_font.c : jdk/src/solaris/native/sun/awt/multi_font.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/multi_font.h : jdk/src/solaris/native/sun/awt/multi_font.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/multiVis.c : jdk/src/solaris/native/sun/awt/multiVis.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/multiVis.h : jdk/src/solaris/native/sun/awt/multiVis.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/randr.h : jdk/src/solaris/native/sun/awt/randr.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/robot_common.c : jdk/src/solaris/native/sun/awt/robot_common.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/robot_common.h : jdk/src/solaris/native/sun/awt/robot_common.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/sun_awt_X11_GtkFileDialogPeer.c : jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/swing_GTKEngine.c : jdk/src/solaris/native/sun/awt/swing_GTKEngine.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/swing_GTKStyle.c : jdk/src/solaris/native/sun/awt/swing_GTKStyle.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/wsutils.h : jdk/src/solaris/native/sun/awt/wsutils.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/awt/Xrandr.h : jdk/src/solaris/native/sun/awt/Xrandr.h -jdk/src/java.desktop/unix/native/libawt_xawt/sun/java2d/x11/XRBackendNative.c : jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/java2d/x11/XRSurfaceData.c : jdk/src/solaris/native/sun/java2d/x11/XRSurfaceData.c -jdk/src/java.desktop/unix/native/libawt_xawt/sun/xawt : jdk/src/solaris/native/sun/xawt +jdk/src/java.desktop/unix/native/libawt_headless/awt/HeadlessToolkit.c : jdk/src/solaris/native/sun/awt/HeadlessToolkit.c +jdk/src/java.desktop/unix/native/libawt_headless/awt/VDrawingArea.c : jdk/src/solaris/native/sun/awt/VDrawingArea.c +jdk/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c : jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c +jdk/src/java.desktop/unix/native/libawt/awt/awt_Mlib.c : jdk/src/solaris/native/sun/awt/awt_Mlib.c +jdk/src/java.desktop/unix/native/libawt/awt/medialib/mlib_v_ImageCopy_blk.s : jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageCopy_blk.s +jdk/src/java.desktop/unix/native/libawt/awt/medialib/mlib_v_ImageCopy.c : jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageCopy.c +jdk/src/java.desktop/unix/native/libawt/awt/medialib/vis_asi.h : jdk/src/solaris/native/sun/awt/medialib/vis_asi.h +jdk/src/java.desktop/unix/native/libawt/java2d/j2d_md.h : jdk/src/solaris/native/sun/java2d/j2d_md.h +jdk/src/java.desktop/unix/native/libawt/java2d/loops : jdk/src/solaris/native/sun/java2d/loops +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_AWTEvent.c : jdk/src/solaris/native/sun/awt/awt_AWTEvent.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_AWTEvent.h : jdk/src/solaris/native/sun/awt/awt_AWTEvent.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_DrawingSurface.c : jdk/src/solaris/native/sun/awt/awt_DrawingSurface.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.c : jdk/src/solaris/native/sun/awt/awt_Event.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.h : jdk/src/solaris/native/sun/awt/awt_Event.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c : jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c : jdk/src/solaris/native/sun/awt/awt_InputMethod.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.c : jdk/src/solaris/native/sun/awt/awt_Insets.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.h : jdk/src/solaris/native/sun/awt/awt_Insets.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_MenuComponent.h : jdk/src/solaris/native/sun/awt/awt_MenuComponent.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c : jdk/src/solaris/native/sun/awt/awt_Robot.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c : jdk/src/solaris/native/sun/awt/awt_UNIXToolkit.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_util.c : jdk/src/solaris/native/sun/awt/awt_util.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/canvas.h : jdk/src/solaris/native/sun/awt/canvas.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c : jdk/src/solaris/native/sun/awt/gtk2_interface.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.h : jdk/src/solaris/native/sun/awt/gtk2_interface.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/HPkeysym.h : jdk/src/solaris/native/sun/awt/HPkeysym.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/list.c : jdk/src/solaris/native/sun/awt/list.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/list.h : jdk/src/solaris/native/sun/awt/list.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/multi_font.c : jdk/src/solaris/native/sun/awt/multi_font.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/multi_font.h : jdk/src/solaris/native/sun/awt/multi_font.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c : jdk/src/solaris/native/sun/awt/multiVis.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.h : jdk/src/solaris/native/sun/awt/multiVis.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/randr.h : jdk/src/solaris/native/sun/awt/randr.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/robot_common.c : jdk/src/solaris/native/sun/awt/robot_common.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/robot_common.h : jdk/src/solaris/native/sun/awt/robot_common.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c : jdk/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/swing_GTKEngine.c : jdk/src/solaris/native/sun/awt/swing_GTKEngine.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/swing_GTKStyle.c : jdk/src/solaris/native/sun/awt/swing_GTKStyle.c +jdk/src/java.desktop/unix/native/libawt_xawt/awt/wsutils.h : jdk/src/solaris/native/sun/awt/wsutils.h +jdk/src/java.desktop/unix/native/libawt_xawt/awt/Xrandr.h : jdk/src/solaris/native/sun/awt/Xrandr.h +jdk/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c : jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c +jdk/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRSurfaceData.c : jdk/src/solaris/native/sun/java2d/x11/XRSurfaceData.c +jdk/src/java.desktop/unix/native/libawt_xawt/xawt : jdk/src/solaris/native/sun/xawt jdk/src/java.desktop/unix/native/libfontmanager/X11FontScaler.c : jdk/src/solaris/native/sun/font/X11FontScaler.c jdk/src/java.desktop/unix/native/libfontmanager/X11TextRenderer.c : jdk/src/solaris/native/sun/font/X11TextRenderer.c jdk/src/java.desktop/unix/native/libjawt/jawt.c : jdk/src/solaris/native/sun/awt/jawt.c @@ -978,168 +978,168 @@ jdk/src/java.desktop/windows/classes/sun/awt/windows/ThemeReader.java : jdk/src/ jdk/src/java.desktop/windows/classes/sun/font : jdk/src/windows/classes/sun/font jdk/src/java.desktop/windows/conf/flavormap.properties : jdk/src/windows/lib/flavormap.properties jdk/src/java.desktop/windows/conf/images/cursors/cursors.properties : jdk/src/windows/lib/images/cursors/cursors.properties -jdk/src/java.desktop/windows/native/common/sun/awt/utility/rect.h : jdk/src/windows/native/sun/awt/utility/rect.h +jdk/src/java.desktop/windows/native/common/awt/utility/rect.h : jdk/src/windows/native/sun/awt/utility/rect.h jdk/src/java.desktop/windows/native/include/jawt_md.h : jdk/src/windows/javavm/export/jawt_md.h -jdk/src/java.desktop/windows/native/libawt/sun/java2d/d3d : jdk/src/windows/native/sun/java2d/d3d -jdk/src/java.desktop/windows/native/libawt/sun/java2d : jdk/src/windows/native/sun/java2d -jdk/src/java.desktop/windows/native/libawt/sun/windows/alloc.h : jdk/src/windows/native/sun/windows/alloc.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_AWTEvent.cpp : jdk/src/windows/native/sun/windows/awt_AWTEvent.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_AWTEvent.h : jdk/src/windows/native/sun/windows/awt_AWTEvent.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_BitmapUtil.cpp : jdk/src/windows/native/sun/windows/awt_BitmapUtil.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_BitmapUtil.h : jdk/src/windows/native/sun/windows/awt_BitmapUtil.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Brush.cpp : jdk/src/windows/native/sun/windows/awt_Brush.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Brush.h : jdk/src/windows/native/sun/windows/awt_Brush.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Button.cpp : jdk/src/windows/native/sun/windows/awt_Button.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Button.h : jdk/src/windows/native/sun/windows/awt_Button.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Canvas.cpp : jdk/src/windows/native/sun/windows/awt_Canvas.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Canvas.h : jdk/src/windows/native/sun/windows/awt_Canvas.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Checkbox.cpp : jdk/src/windows/native/sun/windows/awt_Checkbox.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Checkbox.h : jdk/src/windows/native/sun/windows/awt_Checkbox.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Choice.cpp : jdk/src/windows/native/sun/windows/awt_Choice.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Choice.h : jdk/src/windows/native/sun/windows/awt_Choice.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Clipboard.cpp : jdk/src/windows/native/sun/windows/awt_Clipboard.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Clipboard.h : jdk/src/windows/native/sun/windows/awt_Clipboard.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Color.cpp : jdk/src/windows/native/sun/windows/awt_Color.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Color.h : jdk/src/windows/native/sun/windows/awt_Color.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Component.cpp : jdk/src/windows/native/sun/windows/awt_Component.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Component.h : jdk/src/windows/native/sun/windows/awt_Component.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Container.cpp : jdk/src/windows/native/sun/windows/awt_Container.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Container.h : jdk/src/windows/native/sun/windows/awt_Container.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Cursor.cpp : jdk/src/windows/native/sun/windows/awt_Cursor.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Cursor.h : jdk/src/windows/native/sun/windows/awt_Cursor.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_CustomPaletteDef.h : jdk/src/windows/native/sun/windows/awt_CustomPaletteDef.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DataTransferer.cpp : jdk/src/windows/native/sun/windows/awt_DataTransferer.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DataTransferer.h : jdk/src/windows/native/sun/windows/awt_DataTransferer.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DCHolder.cpp : jdk/src/windows/native/sun/windows/awt_DCHolder.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DCHolder.h : jdk/src/windows/native/sun/windows/awt_DCHolder.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Debug.cpp : jdk/src/windows/native/sun/windows/awt_Debug.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Debug.h : jdk/src/windows/native/sun/windows/awt_Debug.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Desktop.cpp : jdk/src/windows/native/sun/windows/awt_Desktop.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DesktopProperties.cpp : jdk/src/windows/native/sun/windows/awt_DesktopProperties.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DesktopProperties.h : jdk/src/windows/native/sun/windows/awt_DesktopProperties.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Dialog.cpp : jdk/src/windows/native/sun/windows/awt_Dialog.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Dialog.h : jdk/src/windows/native/sun/windows/awt_Dialog.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Dimension.cpp : jdk/src/windows/native/sun/windows/awt_Dimension.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Dimension.h : jdk/src/windows/native/sun/windows/awt_Dimension.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DnDDS.cpp : jdk/src/windows/native/sun/windows/awt_DnDDS.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DnDDS.h : jdk/src/windows/native/sun/windows/awt_DnDDS.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DnDDT.cpp : jdk/src/windows/native/sun/windows/awt_DnDDT.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DnDDT.h : jdk/src/windows/native/sun/windows/awt_DnDDT.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DrawingSurface.cpp : jdk/src/windows/native/sun/windows/awt_DrawingSurface.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_DrawingSurface.h : jdk/src/windows/native/sun/windows/awt_DrawingSurface.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Event.cpp : jdk/src/windows/native/sun/windows/awt_Event.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Event.h : jdk/src/windows/native/sun/windows/awt_Event.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_FileDialog.cpp : jdk/src/windows/native/sun/windows/awt_FileDialog.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_FileDialog.h : jdk/src/windows/native/sun/windows/awt_FileDialog.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Font.cpp : jdk/src/windows/native/sun/windows/awt_Font.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Font.h : jdk/src/windows/native/sun/windows/awt_Font.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Frame.cpp : jdk/src/windows/native/sun/windows/awt_Frame.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Frame.h : jdk/src/windows/native/sun/windows/awt_Frame.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_GDIObject.cpp : jdk/src/windows/native/sun/windows/awt_GDIObject.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_GDIObject.h : jdk/src/windows/native/sun/windows/awt_GDIObject.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt.h : jdk/src/windows/native/sun/windows/awt.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_IconCursor.cpp : jdk/src/windows/native/sun/windows/awt_IconCursor.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_IconCursor.h : jdk/src/windows/native/sun/windows/awt_IconCursor.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputEvent.cpp : jdk/src/windows/native/sun/windows/awt_InputEvent.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputEvent.h : jdk/src/windows/native/sun/windows/awt_InputEvent.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputMethod.cpp : jdk/src/windows/native/sun/windows/awt_InputMethod.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputTextInfor.cpp : jdk/src/windows/native/sun/windows/awt_InputTextInfor.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_InputTextInfor.h : jdk/src/windows/native/sun/windows/awt_InputTextInfor.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Insets.cpp : jdk/src/windows/native/sun/windows/awt_Insets.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Insets.h : jdk/src/windows/native/sun/windows/awt_Insets.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_KeyboardFocusManager.cpp : jdk/src/windows/native/sun/windows/awt_KeyboardFocusManager.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_KeyEvent.cpp : jdk/src/windows/native/sun/windows/awt_KeyEvent.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_KeyEvent.h : jdk/src/windows/native/sun/windows/awt_KeyEvent.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Label.cpp : jdk/src/windows/native/sun/windows/awt_Label.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Label.h : jdk/src/windows/native/sun/windows/awt_Label.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_List.cpp : jdk/src/windows/native/sun/windows/awt_List.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_List.h : jdk/src/windows/native/sun/windows/awt_List.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MenuBar.cpp : jdk/src/windows/native/sun/windows/awt_MenuBar.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MenuBar.h : jdk/src/windows/native/sun/windows/awt_MenuBar.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Menu.cpp : jdk/src/windows/native/sun/windows/awt_Menu.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Menu.h : jdk/src/windows/native/sun/windows/awt_Menu.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MenuItem.cpp : jdk/src/windows/native/sun/windows/awt_MenuItem.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MenuItem.h : jdk/src/windows/native/sun/windows/awt_MenuItem.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Mlib.cpp : jdk/src/windows/native/sun/windows/awt_Mlib.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Mlib.h : jdk/src/windows/native/sun/windows/awt_Mlib.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MouseEvent.cpp : jdk/src/windows/native/sun/windows/awt_MouseEvent.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_MouseEvent.h : jdk/src/windows/native/sun/windows/awt_MouseEvent.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awtmsg.h : jdk/src/windows/native/sun/windows/awtmsg.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_new.cpp : jdk/src/windows/native/sun/windows/awt_new.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_new.h : jdk/src/windows/native/sun/windows/awt_new.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Object.cpp : jdk/src/windows/native/sun/windows/awt_Object.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Object.h : jdk/src/windows/native/sun/windows/awt_Object.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_ole.cpp : jdk/src/windows/native/sun/windows/awt_ole.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_ole.h : jdk/src/windows/native/sun/windows/awt_ole.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Palette.cpp : jdk/src/windows/native/sun/windows/awt_Palette.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Palette.h : jdk/src/windows/native/sun/windows/awt_Palette.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Panel.cpp : jdk/src/windows/native/sun/windows/awt_Panel.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Panel.h : jdk/src/windows/native/sun/windows/awt_Panel.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Pen.cpp : jdk/src/windows/native/sun/windows/awt_Pen.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Pen.h : jdk/src/windows/native/sun/windows/awt_Pen.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PopupMenu.cpp : jdk/src/windows/native/sun/windows/awt_PopupMenu.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PopupMenu.h : jdk/src/windows/native/sun/windows/awt_PopupMenu.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintControl.cpp : jdk/src/windows/native/sun/windows/awt_PrintControl.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintControl.h : jdk/src/windows/native/sun/windows/awt_PrintControl.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintDialog.cpp : jdk/src/windows/native/sun/windows/awt_PrintDialog.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintDialog.h : jdk/src/windows/native/sun/windows/awt_PrintDialog.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_PrintJob.cpp : jdk/src/windows/native/sun/windows/awt_PrintJob.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt.rc : jdk/src/windows/native/sun/windows/awt.rc -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Rectangle.cpp : jdk/src/windows/native/sun/windows/awt_Rectangle.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Rectangle.h : jdk/src/windows/native/sun/windows/awt_Rectangle.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Robot.cpp : jdk/src/windows/native/sun/windows/awt_Robot.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Robot.h : jdk/src/windows/native/sun/windows/awt_Robot.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Scrollbar.cpp : jdk/src/windows/native/sun/windows/awt_Scrollbar.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Scrollbar.h : jdk/src/windows/native/sun/windows/awt_Scrollbar.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_ScrollPane.cpp : jdk/src/windows/native/sun/windows/awt_ScrollPane.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_ScrollPane.h : jdk/src/windows/native/sun/windows/awt_ScrollPane.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextArea.cpp : jdk/src/windows/native/sun/windows/awt_TextArea.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextArea.h : jdk/src/windows/native/sun/windows/awt_TextArea.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextComponent.cpp : jdk/src/windows/native/sun/windows/awt_TextComponent.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextComponent.h : jdk/src/windows/native/sun/windows/awt_TextComponent.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextField.cpp : jdk/src/windows/native/sun/windows/awt_TextField.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TextField.h : jdk/src/windows/native/sun/windows/awt_TextField.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Toolkit.cpp : jdk/src/windows/native/sun/windows/awt_Toolkit.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Toolkit.h : jdk/src/windows/native/sun/windows/awt_Toolkit.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TrayIcon.cpp : jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_TrayIcon.h : jdk/src/windows/native/sun/windows/awt_TrayIcon.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsConfig.cpp : jdk/src/windows/native/sun/windows/awt_Win32GraphicsConfig.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsConfig.h : jdk/src/windows/native/sun/windows/awt_Win32GraphicsConfig.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsDevice.cpp : jdk/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsDevice.h : jdk/src/windows/native/sun/windows/awt_Win32GraphicsDevice.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Win32GraphicsEnv.cpp : jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Window.cpp : jdk/src/windows/native/sun/windows/awt_Window.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/awt_Window.h : jdk/src/windows/native/sun/windows/awt_Window.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/check.bmp : jdk/src/windows/native/sun/windows/check.bmp -jdk/src/java.desktop/windows/native/libawt/sun/windows/CmdIDList.cpp : jdk/src/windows/native/sun/windows/CmdIDList.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/CmdIDList.h : jdk/src/windows/native/sun/windows/CmdIDList.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/colordata.h : jdk/src/windows/native/sun/windows/colordata.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/ComCtl32Util.cpp : jdk/src/windows/native/sun/windows/ComCtl32Util.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/ComCtl32Util.h : jdk/src/windows/native/sun/windows/ComCtl32Util.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/Devices.cpp : jdk/src/windows/native/sun/windows/Devices.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/Devices.h : jdk/src/windows/native/sun/windows/Devices.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/DllUtil.cpp : jdk/src/windows/native/sun/windows/DllUtil.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/DllUtil.h : jdk/src/windows/native/sun/windows/DllUtil.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/GDIHashtable.cpp : jdk/src/windows/native/sun/windows/GDIHashtable.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/GDIHashtable.h : jdk/src/windows/native/sun/windows/GDIHashtable.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/hand.cur : jdk/src/windows/native/sun/windows/hand.cur -jdk/src/java.desktop/windows/native/libawt/sun/windows/Hashtable.cpp : jdk/src/windows/native/sun/windows/Hashtable.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/Hashtable.h : jdk/src/windows/native/sun/windows/Hashtable.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/img_util_md.h : jdk/src/windows/native/sun/windows/img_util_md.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/initIDs.cpp : jdk/src/windows/native/sun/windows/initIDs.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/mlib_types_md.h : jdk/src/windows/native/sun/windows/mlib_types_md.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/MouseInfo.cpp : jdk/src/windows/native/sun/windows/MouseInfo.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/ObjectList.cpp : jdk/src/windows/native/sun/windows/ObjectList.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/ObjectList.h : jdk/src/windows/native/sun/windows/ObjectList.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/README.JNI : jdk/src/windows/native/sun/windows/README.JNI -jdk/src/java.desktop/windows/native/libawt/sun/windows/security_warning_bw.ico : jdk/src/windows/native/sun/windows/security_warning_bw.ico -jdk/src/java.desktop/windows/native/libawt/sun/windows/security_warning.ico : jdk/src/windows/native/sun/windows/security_warning.ico -jdk/src/java.desktop/windows/native/libawt/sun/windows/security_warning_int.ico : jdk/src/windows/native/sun/windows/security_warning_int.ico -jdk/src/java.desktop/windows/native/libawt/sun/windows/ShellFolder2.cpp : jdk/src/windows/native/sun/windows/ShellFolder2.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/stdhdrs.h : jdk/src/windows/native/sun/windows/stdhdrs.h -jdk/src/java.desktop/windows/native/libawt/sun/windows/ThemeReader.cpp : jdk/src/windows/native/sun/windows/ThemeReader.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/WBufferStrategy.cpp : jdk/src/windows/native/sun/windows/WBufferStrategy.cpp -jdk/src/java.desktop/windows/native/libawt/sun/windows/WPrinterJob.cpp : jdk/src/windows/native/sun/windows/WPrinterJob.cpp +jdk/src/java.desktop/windows/native/libawt/java2d/d3d : jdk/src/windows/native/sun/java2d/d3d +jdk/src/java.desktop/windows/native/libawt/java2d : jdk/src/windows/native/sun/java2d +jdk/src/java.desktop/windows/native/libawt/windows/alloc.h : jdk/src/windows/native/sun/windows/alloc.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_AWTEvent.cpp : jdk/src/windows/native/sun/windows/awt_AWTEvent.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_AWTEvent.h : jdk/src/windows/native/sun/windows/awt_AWTEvent.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_BitmapUtil.cpp : jdk/src/windows/native/sun/windows/awt_BitmapUtil.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_BitmapUtil.h : jdk/src/windows/native/sun/windows/awt_BitmapUtil.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Brush.cpp : jdk/src/windows/native/sun/windows/awt_Brush.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Brush.h : jdk/src/windows/native/sun/windows/awt_Brush.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Button.cpp : jdk/src/windows/native/sun/windows/awt_Button.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Button.h : jdk/src/windows/native/sun/windows/awt_Button.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Canvas.cpp : jdk/src/windows/native/sun/windows/awt_Canvas.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Canvas.h : jdk/src/windows/native/sun/windows/awt_Canvas.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Checkbox.cpp : jdk/src/windows/native/sun/windows/awt_Checkbox.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Checkbox.h : jdk/src/windows/native/sun/windows/awt_Checkbox.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp : jdk/src/windows/native/sun/windows/awt_Choice.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Choice.h : jdk/src/windows/native/sun/windows/awt_Choice.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Clipboard.cpp : jdk/src/windows/native/sun/windows/awt_Clipboard.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Clipboard.h : jdk/src/windows/native/sun/windows/awt_Clipboard.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Color.cpp : jdk/src/windows/native/sun/windows/awt_Color.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Color.h : jdk/src/windows/native/sun/windows/awt_Color.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp : jdk/src/windows/native/sun/windows/awt_Component.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.h : jdk/src/windows/native/sun/windows/awt_Component.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Container.cpp : jdk/src/windows/native/sun/windows/awt_Container.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Container.h : jdk/src/windows/native/sun/windows/awt_Container.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Cursor.cpp : jdk/src/windows/native/sun/windows/awt_Cursor.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Cursor.h : jdk/src/windows/native/sun/windows/awt_Cursor.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_CustomPaletteDef.h : jdk/src/windows/native/sun/windows/awt_CustomPaletteDef.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_DataTransferer.cpp : jdk/src/windows/native/sun/windows/awt_DataTransferer.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_DataTransferer.h : jdk/src/windows/native/sun/windows/awt_DataTransferer.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_DCHolder.cpp : jdk/src/windows/native/sun/windows/awt_DCHolder.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_DCHolder.h : jdk/src/windows/native/sun/windows/awt_DCHolder.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Debug.cpp : jdk/src/windows/native/sun/windows/awt_Debug.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Debug.h : jdk/src/windows/native/sun/windows/awt_Debug.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp : jdk/src/windows/native/sun/windows/awt_Desktop.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_DesktopProperties.cpp : jdk/src/windows/native/sun/windows/awt_DesktopProperties.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_DesktopProperties.h : jdk/src/windows/native/sun/windows/awt_DesktopProperties.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Dialog.cpp : jdk/src/windows/native/sun/windows/awt_Dialog.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Dialog.h : jdk/src/windows/native/sun/windows/awt_Dialog.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Dimension.cpp : jdk/src/windows/native/sun/windows/awt_Dimension.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Dimension.h : jdk/src/windows/native/sun/windows/awt_Dimension.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.cpp : jdk/src/windows/native/sun/windows/awt_DnDDS.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDS.h : jdk/src/windows/native/sun/windows/awt_DnDDS.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.cpp : jdk/src/windows/native/sun/windows/awt_DnDDT.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_DnDDT.h : jdk/src/windows/native/sun/windows/awt_DnDDT.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.cpp : jdk/src/windows/native/sun/windows/awt_DrawingSurface.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.h : jdk/src/windows/native/sun/windows/awt_DrawingSurface.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Event.cpp : jdk/src/windows/native/sun/windows/awt_Event.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Event.h : jdk/src/windows/native/sun/windows/awt_Event.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_FileDialog.cpp : jdk/src/windows/native/sun/windows/awt_FileDialog.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_FileDialog.h : jdk/src/windows/native/sun/windows/awt_FileDialog.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp : jdk/src/windows/native/sun/windows/awt_Font.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Font.h : jdk/src/windows/native/sun/windows/awt_Font.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp : jdk/src/windows/native/sun/windows/awt_Frame.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.h : jdk/src/windows/native/sun/windows/awt_Frame.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_GDIObject.cpp : jdk/src/windows/native/sun/windows/awt_GDIObject.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_GDIObject.h : jdk/src/windows/native/sun/windows/awt_GDIObject.h +jdk/src/java.desktop/windows/native/libawt/windows/awt.h : jdk/src/windows/native/sun/windows/awt.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_IconCursor.cpp : jdk/src/windows/native/sun/windows/awt_IconCursor.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_IconCursor.h : jdk/src/windows/native/sun/windows/awt_IconCursor.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_InputEvent.cpp : jdk/src/windows/native/sun/windows/awt_InputEvent.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_InputEvent.h : jdk/src/windows/native/sun/windows/awt_InputEvent.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_InputMethod.cpp : jdk/src/windows/native/sun/windows/awt_InputMethod.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_InputTextInfor.cpp : jdk/src/windows/native/sun/windows/awt_InputTextInfor.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_InputTextInfor.h : jdk/src/windows/native/sun/windows/awt_InputTextInfor.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Insets.cpp : jdk/src/windows/native/sun/windows/awt_Insets.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Insets.h : jdk/src/windows/native/sun/windows/awt_Insets.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_KeyboardFocusManager.cpp : jdk/src/windows/native/sun/windows/awt_KeyboardFocusManager.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_KeyEvent.cpp : jdk/src/windows/native/sun/windows/awt_KeyEvent.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_KeyEvent.h : jdk/src/windows/native/sun/windows/awt_KeyEvent.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Label.cpp : jdk/src/windows/native/sun/windows/awt_Label.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Label.h : jdk/src/windows/native/sun/windows/awt_Label.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_List.cpp : jdk/src/windows/native/sun/windows/awt_List.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_List.h : jdk/src/windows/native/sun/windows/awt_List.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp : jdk/src/windows/native/sun/windows/awt_MenuBar.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuBar.h : jdk/src/windows/native/sun/windows/awt_MenuBar.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Menu.cpp : jdk/src/windows/native/sun/windows/awt_Menu.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Menu.h : jdk/src/windows/native/sun/windows/awt_Menu.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp : jdk/src/windows/native/sun/windows/awt_MenuItem.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.h : jdk/src/windows/native/sun/windows/awt_MenuItem.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Mlib.cpp : jdk/src/windows/native/sun/windows/awt_Mlib.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Mlib.h : jdk/src/windows/native/sun/windows/awt_Mlib.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_MouseEvent.cpp : jdk/src/windows/native/sun/windows/awt_MouseEvent.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_MouseEvent.h : jdk/src/windows/native/sun/windows/awt_MouseEvent.h +jdk/src/java.desktop/windows/native/libawt/windows/awtmsg.h : jdk/src/windows/native/sun/windows/awtmsg.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_new.cpp : jdk/src/windows/native/sun/windows/awt_new.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_new.h : jdk/src/windows/native/sun/windows/awt_new.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Object.cpp : jdk/src/windows/native/sun/windows/awt_Object.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Object.h : jdk/src/windows/native/sun/windows/awt_Object.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_ole.cpp : jdk/src/windows/native/sun/windows/awt_ole.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_ole.h : jdk/src/windows/native/sun/windows/awt_ole.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Palette.cpp : jdk/src/windows/native/sun/windows/awt_Palette.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Palette.h : jdk/src/windows/native/sun/windows/awt_Palette.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Panel.cpp : jdk/src/windows/native/sun/windows/awt_Panel.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Panel.h : jdk/src/windows/native/sun/windows/awt_Panel.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Pen.cpp : jdk/src/windows/native/sun/windows/awt_Pen.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Pen.h : jdk/src/windows/native/sun/windows/awt_Pen.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_PopupMenu.cpp : jdk/src/windows/native/sun/windows/awt_PopupMenu.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_PopupMenu.h : jdk/src/windows/native/sun/windows/awt_PopupMenu.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp : jdk/src/windows/native/sun/windows/awt_PrintControl.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.h : jdk/src/windows/native/sun/windows/awt_PrintControl.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintDialog.cpp : jdk/src/windows/native/sun/windows/awt_PrintDialog.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintDialog.h : jdk/src/windows/native/sun/windows/awt_PrintDialog.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp : jdk/src/windows/native/sun/windows/awt_PrintJob.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt.rc : jdk/src/windows/native/sun/windows/awt.rc +jdk/src/java.desktop/windows/native/libawt/windows/awt_Rectangle.cpp : jdk/src/windows/native/sun/windows/awt_Rectangle.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Rectangle.h : jdk/src/windows/native/sun/windows/awt_Rectangle.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp : jdk/src/windows/native/sun/windows/awt_Robot.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Robot.h : jdk/src/windows/native/sun/windows/awt_Robot.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Scrollbar.cpp : jdk/src/windows/native/sun/windows/awt_Scrollbar.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Scrollbar.h : jdk/src/windows/native/sun/windows/awt_Scrollbar.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_ScrollPane.cpp : jdk/src/windows/native/sun/windows/awt_ScrollPane.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_ScrollPane.h : jdk/src/windows/native/sun/windows/awt_ScrollPane.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_TextArea.cpp : jdk/src/windows/native/sun/windows/awt_TextArea.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_TextArea.h : jdk/src/windows/native/sun/windows/awt_TextArea.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_TextComponent.cpp : jdk/src/windows/native/sun/windows/awt_TextComponent.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_TextComponent.h : jdk/src/windows/native/sun/windows/awt_TextComponent.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_TextField.cpp : jdk/src/windows/native/sun/windows/awt_TextField.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_TextField.h : jdk/src/windows/native/sun/windows/awt_TextField.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp : jdk/src/windows/native/sun/windows/awt_Toolkit.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.h : jdk/src/windows/native/sun/windows/awt_Toolkit.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp : jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.h : jdk/src/windows/native/sun/windows/awt_TrayIcon.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsConfig.cpp : jdk/src/windows/native/sun/windows/awt_Win32GraphicsConfig.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsConfig.h : jdk/src/windows/native/sun/windows/awt_Win32GraphicsConfig.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp : jdk/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.h : jdk/src/windows/native/sun/windows/awt_Win32GraphicsDevice.h +jdk/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp : jdk/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp : jdk/src/windows/native/sun/windows/awt_Window.cpp +jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.h : jdk/src/windows/native/sun/windows/awt_Window.h +jdk/src/java.desktop/windows/native/libawt/windows/check.bmp : jdk/src/windows/native/sun/windows/check.bmp +jdk/src/java.desktop/windows/native/libawt/windows/CmdIDList.cpp : jdk/src/windows/native/sun/windows/CmdIDList.cpp +jdk/src/java.desktop/windows/native/libawt/windows/CmdIDList.h : jdk/src/windows/native/sun/windows/CmdIDList.h +jdk/src/java.desktop/windows/native/libawt/windows/colordata.h : jdk/src/windows/native/sun/windows/colordata.h +jdk/src/java.desktop/windows/native/libawt/windows/ComCtl32Util.cpp : jdk/src/windows/native/sun/windows/ComCtl32Util.cpp +jdk/src/java.desktop/windows/native/libawt/windows/ComCtl32Util.h : jdk/src/windows/native/sun/windows/ComCtl32Util.h +jdk/src/java.desktop/windows/native/libawt/windows/Devices.cpp : jdk/src/windows/native/sun/windows/Devices.cpp +jdk/src/java.desktop/windows/native/libawt/windows/Devices.h : jdk/src/windows/native/sun/windows/Devices.h +jdk/src/java.desktop/windows/native/libawt/windows/DllUtil.cpp : jdk/src/windows/native/sun/windows/DllUtil.cpp +jdk/src/java.desktop/windows/native/libawt/windows/DllUtil.h : jdk/src/windows/native/sun/windows/DllUtil.h +jdk/src/java.desktop/windows/native/libawt/windows/GDIHashtable.cpp : jdk/src/windows/native/sun/windows/GDIHashtable.cpp +jdk/src/java.desktop/windows/native/libawt/windows/GDIHashtable.h : jdk/src/windows/native/sun/windows/GDIHashtable.h +jdk/src/java.desktop/windows/native/libawt/windows/hand.cur : jdk/src/windows/native/sun/windows/hand.cur +jdk/src/java.desktop/windows/native/libawt/windows/Hashtable.cpp : jdk/src/windows/native/sun/windows/Hashtable.cpp +jdk/src/java.desktop/windows/native/libawt/windows/Hashtable.h : jdk/src/windows/native/sun/windows/Hashtable.h +jdk/src/java.desktop/windows/native/libawt/windows/img_util_md.h : jdk/src/windows/native/sun/windows/img_util_md.h +jdk/src/java.desktop/windows/native/libawt/windows/initIDs.cpp : jdk/src/windows/native/sun/windows/initIDs.cpp +jdk/src/java.desktop/windows/native/libawt/windows/mlib_types_md.h : jdk/src/windows/native/sun/windows/mlib_types_md.h +jdk/src/java.desktop/windows/native/libawt/windows/MouseInfo.cpp : jdk/src/windows/native/sun/windows/MouseInfo.cpp +jdk/src/java.desktop/windows/native/libawt/windows/ObjectList.cpp : jdk/src/windows/native/sun/windows/ObjectList.cpp +jdk/src/java.desktop/windows/native/libawt/windows/ObjectList.h : jdk/src/windows/native/sun/windows/ObjectList.h +jdk/src/java.desktop/windows/native/libawt/windows/README.JNI : jdk/src/windows/native/sun/windows/README.JNI +jdk/src/java.desktop/windows/native/libawt/windows/security_warning_bw.ico : jdk/src/windows/native/sun/windows/security_warning_bw.ico +jdk/src/java.desktop/windows/native/libawt/windows/security_warning.ico : jdk/src/windows/native/sun/windows/security_warning.ico +jdk/src/java.desktop/windows/native/libawt/windows/security_warning_int.ico : jdk/src/windows/native/sun/windows/security_warning_int.ico +jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp : jdk/src/windows/native/sun/windows/ShellFolder2.cpp +jdk/src/java.desktop/windows/native/libawt/windows/stdhdrs.h : jdk/src/windows/native/sun/windows/stdhdrs.h +jdk/src/java.desktop/windows/native/libawt/windows/ThemeReader.cpp : jdk/src/windows/native/sun/windows/ThemeReader.cpp +jdk/src/java.desktop/windows/native/libawt/windows/WBufferStrategy.cpp : jdk/src/windows/native/sun/windows/WBufferStrategy.cpp +jdk/src/java.desktop/windows/native/libawt/windows/WPrinterJob.cpp : jdk/src/windows/native/sun/windows/WPrinterJob.cpp jdk/src/java.desktop/windows/native/libfontmanager : jdk/src/windows/native/sun/font jdk/src/java.desktop/windows/native/libjawt/jawt.cpp : jdk/src/windows/native/sun/windows/jawt.cpp jdk/src/java.desktop/windows/native/libjsound : jdk/src/windows/native/com/sun/media/sound From a1e360202d9fa336fa2bc4a00b5472d0071cc503 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 19 Sep 2014 11:13:27 -0700 Subject: [PATCH 53/81] 8058756: OpenJDK builds fail on Windows - cannot copy freetype.dll Reviewed-by: erikj, aph --- jdk/make/copy/Copy-java.desktop.gmk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/make/copy/Copy-java.desktop.gmk b/jdk/make/copy/Copy-java.desktop.gmk index d83f4ee926f..13658ca2a8a 100644 --- a/jdk/make/copy/Copy-java.desktop.gmk +++ b/jdk/make/copy/Copy-java.desktop.gmk @@ -68,7 +68,7 @@ ifneq ($(FREETYPE_BUNDLE_LIB_PATH), ) endif $(FREETYPE_TARGET_LIB): $(FREETYPE_BUNDLE_LIB_PATH)/$(call SHARED_LIBRARY,freetype) - $(CP) $(FREETYPE_BUNDLE_LIB_PATH)/$(call SHARED_LIBRARY,freetype) $@ + $(install-file) ifeq ($(OPENJDK_BUILD_OS), windows) $(CHMOD) +rx $@ endif From ada2c7577219e538c2ec10ee946eaaf61fc3d379 Mon Sep 17 00:00:00 2001 From: Anisha Nagarajan Date: Mon, 22 Sep 2014 11:23:19 +0400 Subject: [PATCH 54/81] 8054877: javadoc issues in javax.print Fixes "no @throws or @exception tag" issues in javax.print. Reviewed-by: prr --- .../java.desktop/share/classes/javax/print/DocFlavor.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jdk/src/java.desktop/share/classes/javax/print/DocFlavor.java b/jdk/src/java.desktop/share/classes/javax/print/DocFlavor.java index cb00e00753b..bfc5cee66b7 100644 --- a/jdk/src/java.desktop/share/classes/javax/print/DocFlavor.java +++ b/jdk/src/java.desktop/share/classes/javax/print/DocFlavor.java @@ -610,6 +610,9 @@ public class DocFlavor implements Serializable, Cloneable { /** * Write the instance to a stream (ie serialize the object). + * + * @throws IOException if I/O errors occur while writing to the underlying + * stream */ private void writeObject(ObjectOutputStream s) throws IOException { @@ -620,6 +623,10 @@ public class DocFlavor implements Serializable, Cloneable { /** * Reconstitute an instance from a stream (that is, deserialize it). * + * @throws ClassNotFoundException if the class of a serialized object could + * not be found. + * @throws IOException if I/O errors occur while reading from the underlying + * stream * @serialData * The serialised form of a DocFlavor is the String naming the * representation class followed by the String representing the canonical From 9ef4115fe75c88bcb9b2ff6901f17d299684b700 Mon Sep 17 00:00:00 2001 From: Anisha Nagarajan Date: Mon, 22 Sep 2014 11:25:33 +0400 Subject: [PATCH 55/81] 6588417: Incorrect javadoc: no @throws or @exception tag in javax.* Fix remaining missing @throws tags. Reviewed-by: prr --- .../imageio/stream/FileCacheImageInputStream.java | 7 +++++-- .../classes/javax/imageio/stream/MemoryCache.java | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java index b581de9d0f8..d6b7f537bca 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/FileCacheImageInputStream.java @@ -87,7 +87,7 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl { * null. * @exception IllegalArgumentException if cacheDir is * non-null but is not a directory. - * @exception IOException if a cache file cannot be created. + * @throws IOException if a cache file cannot be created. */ public FileCacheImageInputStream(InputStream stream, File cacheDir) throws IOException { @@ -122,6 +122,9 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl { * or the end of the source is reached. The return value * is equal to the smaller of pos and the * length of the source file. + * + * @throws IOException if an I/O error occurs while reading from the + * source file */ private long readUntil(long pos) throws IOException { // We've already got enough data cached @@ -244,7 +247,7 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl { * and removing the cache file. The source InputStream * is not closed. * - * @exception IOException if an error occurs. + * @throws IOException if an error occurs. */ public void close() throws IOException { super.close(); diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCache.java b/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCache.java index 48c5e50ea19..026424faa8f 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCache.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/MemoryCache.java @@ -82,6 +82,8 @@ class MemoryCache { * or the end of the source is reached. The return value * is equal to the smaller of pos and the * length of the source. + * + * @throws IOException if there is no more memory for cache */ public long loadFromStream(InputStream stream, long pos) throws IOException { @@ -143,6 +145,8 @@ class MemoryCache { * the requested data is not in the cache (including if pos * is in a block already disposed), or if either pos or * len is < 0. + * @throws IOException if there is an I/O exception while writing to the + * stream */ public void writeToStream(OutputStream stream, long pos, long len) throws IOException { @@ -177,6 +181,8 @@ class MemoryCache { /** * Ensure that there is space to write a byte at the given position. + * + * throws IOException if there is no more memory left for cache */ private void pad(long pos) throws IOException { long currIndex = cacheStart + cache.size() - 1; @@ -197,7 +203,7 @@ class MemoryCache { * the incoming data. * * @param b an array of bytes containing data to be written. - * @param off the starting offset withing the data array. + * @param off the starting offset within the data array. * @param len the number of bytes to be written. * @param pos the cache position at which to begin writing. * @@ -205,6 +211,7 @@ class MemoryCache { * @exception IndexOutOfBoundsException if off, * len, or pos are negative, * or if off+len > b.length. + * @throws IOException if there is an I/O error while writing to the cache */ public void write(byte[] b, int off, int len, long pos) throws IOException { @@ -248,6 +255,7 @@ class MemoryCache { * @param pos the cache position at which to begin writing. * * @exception IndexOutOfBoundsException if pos is negative. + * @throws IOException if there is an I/O error while writing to the cache */ public void write(int b, long pos) throws IOException { if (pos < 0) { @@ -279,6 +287,9 @@ class MemoryCache { * Returns the single byte at the given position, as an * int. Returns -1 if this position has * not been cached or has been disposed. + * + * @throws IOException if an I/O error occurs while reading from the byte + * array */ public int read(long pos) throws IOException { if (pos >= length) { @@ -304,6 +315,8 @@ class MemoryCache { * off + len > b.length or if any portion of the * requested data is not in the cache (including if * pos is in a block that has already been disposed). + * @throws IOException if an I/O exception occurs while reading from the + * byte array */ public void read(byte[] b, int off, int len, long pos) throws IOException { From 62f4b355b5439f66e74dab5aaba91695352d7382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Mon, 22 Sep 2014 13:28:28 +0200 Subject: [PATCH 56/81] 8047764: Indexed or polymorphic set on global affects Object.prototype Reviewed-by: lagergren, attila --- .../api/scripting/ScriptObjectMirror.java | 9 +- .../internal/objects/ArrayBufferView.java | 4 +- .../jdk/nashorn/internal/objects/Global.java | 12 +- .../nashorn/internal/objects/NativeArray.java | 42 +-- .../nashorn/internal/objects/NativeDebug.java | 5 +- .../internal/objects/NativeJSAdapter.java | 96 +++--- .../nashorn/internal/objects/NativeJSON.java | 2 +- .../internal/objects/NativeJavaImporter.java | 2 +- .../runtime/DefaultPropertyAccess.java | 62 ++-- .../internal/runtime/ECMAException.java | 2 +- .../internal/runtime/FindProperty.java | 11 + .../internal/runtime/GlobalConstants.java | 10 +- .../internal/runtime/JSONFunctions.java | 8 +- .../internal/runtime/NativeJavaPackage.java | 4 +- .../internal/runtime/PropertyAccess.java | 64 ++-- .../internal/runtime/RewriteException.java | 3 +- .../internal/runtime/ScriptObject.java | 275 ++++++++++-------- .../internal/runtime/ScriptingFunctions.java | 6 +- .../internal/runtime/SetMethodCreator.java | 2 +- .../nashorn/internal/runtime/Undefined.java | 5 +- .../nashorn/internal/runtime/WithObject.java | 10 +- .../linker/NashornCallSiteDescriptor.java | 20 +- .../test/script/basic/JDK-8047764-strict.js | 69 +++++ .../basic/JDK-8047764-strict.js.EXPECTED | 15 + nashorn/test/script/basic/JDK-8047764.js | 94 ++++++ .../test/script/basic/JDK-8047764.js.EXPECTED | 30 ++ 26 files changed, 567 insertions(+), 295 deletions(-) create mode 100644 nashorn/test/script/basic/JDK-8047764-strict.js create mode 100644 nashorn/test/script/basic/JDK-8047764-strict.js.EXPECTED create mode 100644 nashorn/test/script/basic/JDK-8047764.js create mode 100644 nashorn/test/script/basic/JDK-8047764.js.EXPECTED diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptObjectMirror.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptObjectMirror.java index 7f4ca755f51..e28da041a77 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptObjectMirror.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptObjectMirror.java @@ -50,6 +50,7 @@ import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.ScriptRuntime; import jdk.nashorn.internal.runtime.arrays.ArrayData; +import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor; /** * Mirror object that wraps a given Nashorn Script object. @@ -261,7 +262,7 @@ public final class ScriptObjectMirror extends AbstractJSObject implements Bindin public void setSlot(final int index, final Object value) { inGlobal(new Callable() { @Override public Void call() { - sobj.set(index, unwrap(value, global), strict); + sobj.set(index, unwrap(value, global), getCallSiteFlags()); return null; } }); @@ -425,7 +426,7 @@ public final class ScriptObjectMirror extends AbstractJSObject implements Bindin for (final Map.Entry entry : map.entrySet()) { final Object value = entry.getValue(); final Object modValue = globalChanged? wrap(value, oldGlobal) : value; - sobj.set(entry.getKey(), unwrap(modValue, global), strict); + sobj.set(entry.getKey(), unwrap(modValue, global), getCallSiteFlags()); } return null; } @@ -756,6 +757,10 @@ public final class ScriptObjectMirror extends AbstractJSObject implements Bindin return (obj == ScriptRuntime.UNDEFINED)? null : obj; } + private int getCallSiteFlags() { + return strict ? NashornCallSiteDescriptor.CALLSITE_STRICT : 0; + } + // internals only below this. private V inGlobal(final Callable callable) { final Global oldGlobal = Context.getGlobal(); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java index 445dc19c293..93506c37148 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java @@ -228,11 +228,11 @@ abstract class ArrayBufferView extends ScriptObject { private static void copyElements(final ArrayBufferView dest, final int length, final ScriptObject source, final int offset) { if (!dest.isFloatArray()) { for (int i = 0, j = offset; i < length; i++, j++) { - dest.set(j, source.getInt(i, INVALID_PROGRAM_POINT), false); + dest.set(j, source.getInt(i, INVALID_PROGRAM_POINT), 0); } } else { for (int i = 0, j = offset; i < length; i++, j++) { - dest.set(j, source.getDouble(i, INVALID_PROGRAM_POINT), false); + dest.set(j, source.getDouble(i, INVALID_PROGRAM_POINT), 0); } } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java index eb7fd63ae8e..b8ec90fd0ad 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java @@ -1825,10 +1825,10 @@ public final class Global extends ScriptObject implements Scope { // ECMA 15.11.4.2 Error.prototype.name // Error.prototype.name = "Error"; - errorProto.set(NativeError.NAME, "Error", false); + errorProto.set(NativeError.NAME, "Error", 0); // ECMA 15.11.4.3 Error.prototype.message // Error.prototype.message = ""; - errorProto.set(NativeError.MESSAGE, "", false); + errorProto.set(NativeError.MESSAGE, "", 0); this.builtinEvalError = initErrorSubtype("EvalError", errorProto); this.builtinRangeError = initErrorSubtype("RangeError", errorProto); @@ -1841,8 +1841,8 @@ public final class Global extends ScriptObject implements Scope { private ScriptFunction initErrorSubtype(final String name, final ScriptObject errorProto) { final ScriptFunction cons = initConstructor(name, ScriptFunction.class); final ScriptObject prototype = ScriptFunction.getPrototype(cons); - prototype.set(NativeError.NAME, name, false); - prototype.set(NativeError.MESSAGE, "", false); + prototype.set(NativeError.NAME, name, 0); + prototype.set(NativeError.MESSAGE, "", 0); prototype.setInitialProto(errorProto); return cons; } @@ -1902,7 +1902,7 @@ public final class Global extends ScriptObject implements Scope { private static void copyOptions(final ScriptObject options, final ScriptEnvironment scriptEnv) { for (final Field f : scriptEnv.getClass().getFields()) { try { - options.set(f.getName(), f.get(scriptEnv), false); + options.set(f.getName(), f.get(scriptEnv), 0); } catch (final IllegalArgumentException | IllegalAccessException exp) { throw new RuntimeException(exp); } @@ -2046,7 +2046,7 @@ public final class Global extends ScriptObject implements Scope { // builtinFunction.setInitialProto(anon); builtinFunction.setPrototype(anon); - anon.set("constructor", builtinFunction, false); + anon.set("constructor", builtinFunction, 0); anon.deleteOwnProperty(anon.getMap().findProperty("prototype")); // use "getter" so that [[ThrowTypeError]] function's arity is 0 - as specified in step 10 of section 13.2.3 diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java index 776803b3063..163e86a45cf 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java @@ -32,6 +32,7 @@ import static jdk.nashorn.internal.runtime.PropertyDescriptor.WRITABLE; import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex; import static jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator.arrayLikeIterator; import static jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator.reverseArrayLikeIterator; +import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.CALLSITE_STRICT; import java.lang.invoke.MethodHandle; import java.util.ArrayList; @@ -69,6 +70,7 @@ import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator; import jdk.nashorn.internal.runtime.arrays.IteratorAction; import jdk.nashorn.internal.runtime.linker.Bootstrap; import jdk.nashorn.internal.runtime.linker.InvokeByName; +import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor; /** * Runtime representation of a JavaScript array. NativeArray only holds numeric @@ -341,7 +343,7 @@ public final class NativeArray extends ScriptObject { if (!newWritable) { // make 'length' property not writable final ScriptObject newDesc = Global.newEmptyInstance(); - newDesc.set(WRITABLE, false, false); + newDesc.set(WRITABLE, false, 0); return super.defineOwnProperty("length", newDesc, false); } @@ -808,7 +810,7 @@ public final class NativeArray extends ScriptObject { final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { - sobj.set("length", 0, true); + sobj.set("length", 0, CALLSITE_STRICT); return ScriptRuntime.UNDEFINED; } @@ -816,7 +818,7 @@ public final class NativeArray extends ScriptObject { final Object element = sobj.get(index); sobj.delete(index, true); - sobj.set("length", index, true); + sobj.set("length", index, CALLSITE_STRICT); return element; } catch (final ClassCastException | NullPointerException e) { @@ -844,9 +846,9 @@ public final class NativeArray extends ScriptObject { long len = JSType.toUint32(sobj.getLength()); for (final Object element : args) { - sobj.set(len++, element, true); + sobj.set(len++, element, CALLSITE_STRICT); } - sobj.set("length", len, true); + sobj.set("length", len, CALLSITE_STRICT); return len; } catch (final ClassCastException | NullPointerException e) { @@ -928,8 +930,8 @@ public final class NativeArray extends ScriptObject { } long len = JSType.toUint32(sobj.getLength()); - sobj.set(len++, arg, true); - sobj.set("length", len, true); + sobj.set(len++, arg, CALLSITE_STRICT); + sobj.set("length", len, CALLSITE_STRICT); return len; } catch (final ClassCastException | NullPointerException e) { throw typeError("not.an.object", ScriptRuntime.safeToString(self)); @@ -957,14 +959,14 @@ public final class NativeArray extends ScriptObject { final boolean upperExists = sobj.has(upper); if (lowerExists && upperExists) { - sobj.set(lower, upperValue, true); - sobj.set(upper, lowerValue, true); + sobj.set(lower, upperValue, CALLSITE_STRICT); + sobj.set(upper, lowerValue, CALLSITE_STRICT); } else if (!lowerExists && upperExists) { - sobj.set(lower, upperValue, true); + sobj.set(lower, upperValue, CALLSITE_STRICT); sobj.delete(upper, true); } else if (lowerExists && !upperExists) { sobj.delete(lower, true); - sobj.set(upper, lowerValue, true); + sobj.set(upper, lowerValue, CALLSITE_STRICT); } } return sobj; @@ -1003,7 +1005,7 @@ public final class NativeArray extends ScriptObject { for (long k = 1; k < len; k++) { final boolean hasCurrent = sobj.has(k); if (hasCurrent) { - sobj.set(k - 1, sobj.get(k), true); + sobj.set(k - 1, sobj.get(k), CALLSITE_STRICT); } else if (hasPrevious) { sobj.delete(k - 1, true); } @@ -1015,7 +1017,7 @@ public final class NativeArray extends ScriptObject { len = 0; } - sobj.set("length", len, true); + sobj.set("length", len, CALLSITE_STRICT); return first; } @@ -1226,7 +1228,7 @@ public final class NativeArray extends ScriptObject { final long to = k + items.length; if (sobj.has(from)) { - sobj.set(to, sobj.get(from), true); + sobj.set(to, sobj.get(from), CALLSITE_STRICT); } else { sobj.delete(to, true); } @@ -1242,7 +1244,7 @@ public final class NativeArray extends ScriptObject { if (sobj.has(from)) { final Object fromValue = sobj.get(from); - sobj.set(to, fromValue, true); + sobj.set(to, fromValue, CALLSITE_STRICT); } else { sobj.delete(to, true); } @@ -1251,11 +1253,11 @@ public final class NativeArray extends ScriptObject { long k = start; for (int i = 0; i < items.length; i++, k++) { - sobj.set(k, items[i], true); + sobj.set(k, items[i], CALLSITE_STRICT); } final long newLength = len - deleteCount + items.length; - sobj.set("length", newLength, true); + sobj.set("length", newLength, CALLSITE_STRICT); return array; } @@ -1295,19 +1297,19 @@ public final class NativeArray extends ScriptObject { if (sobj.has(from)) { final Object fromValue = sobj.get(from); - sobj.set(to, fromValue, true); + sobj.set(to, fromValue, CALLSITE_STRICT); } else { sobj.delete(to, true); } } for (int j = 0; j < items.length; j++) { - sobj.set(j, items[j], true); + sobj.set(j, items[j], CALLSITE_STRICT); } } final long newLength = len + items.length; - sobj.set("length", newLength, true); + sobj.set("length", newLength, CALLSITE_STRICT); return newLength; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDebug.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDebug.java index dc6ba044606..20dd85e5c4f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDebug.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDebug.java @@ -42,6 +42,7 @@ import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.events.RuntimeEvent; import jdk.nashorn.internal.runtime.linker.LinkerCallSite; +import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor; /** * Nashorn specific debug utils. This is meant for Nashorn developers. @@ -266,7 +267,7 @@ public final class NativeDebug extends ScriptObject { */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) public static void setEventQueueCapacity(final Object self, final Object newCapacity) { - ((ScriptObject)self).set(EVENT_QUEUE_CAPACITY, newCapacity, true); + ((ScriptObject)self).set(EVENT_QUEUE_CAPACITY, newCapacity, NashornCallSiteDescriptor.CALLSITE_STRICT); } /** @@ -355,7 +356,7 @@ public final class NativeDebug extends ScriptObject { if (sobj.has(EVENT_QUEUE)) { q = (LinkedList>)((ScriptObject)self).get(EVENT_QUEUE); } else { - ((ScriptObject)self).set(EVENT_QUEUE, q = new LinkedList<>(), true); + ((ScriptObject)self).set(EVENT_QUEUE, q = new LinkedList<>(), NashornCallSiteDescriptor.CALLSITE_STRICT); } return q; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java index ab544697159..f2b1bef4f72 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java @@ -250,146 +250,146 @@ public final class NativeJSAdapter extends ScriptObject { } @Override - public void set(final Object key, final int value, final boolean strict) { + public void set(final Object key, final int value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final Object key, final long value, final boolean strict) { + public void set(final Object key, final long value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final Object key, final double value, final boolean strict) { + public void set(final Object key, final double value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final Object key, final Object value, final boolean strict) { + public void set(final Object key, final Object value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final double key, final int value, final boolean strict) { + public void set(final double key, final int value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final double key, final long value, final boolean strict) { + public void set(final double key, final long value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final double key, final double value, final boolean strict) { + public void set(final double key, final double value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final double key, final Object value, final boolean strict) { + public void set(final double key, final Object value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final long key, final int value, final boolean strict) { + public void set(final long key, final int value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final long key, final long value, final boolean strict) { + public void set(final long key, final long value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final long key, final double value, final boolean strict) { + public void set(final long key, final double value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final long key, final Object value, final boolean strict) { + public void set(final long key, final Object value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final int key, final int value, final boolean strict) { + public void set(final int key, final int value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final int key, final long value, final boolean strict) { + public void set(final int key, final long value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final int key, final double value, final boolean strict) { + public void set(final int key, final double value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } @Override - public void set(final int key, final Object value, final boolean strict) { + public void set(final int key, final Object value, final int flags) { if (overrides && super.hasOwnProperty(key)) { - super.set(key, value, strict); + super.set(key, value, flags); } else { - callAdaptee(__put__, key, value, strict); + callAdaptee(__put__, key, value, flags); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSON.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSON.java index 2578d39a914..7bd8a4a3c9b 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSON.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSON.java @@ -191,7 +191,7 @@ public final class NativeJSON extends ScriptObject { state.gap = gap; final ScriptObject wrapper = Global.newEmptyInstance(); - wrapper.set("", value, false); + wrapper.set("", value, 0); return str("", wrapper, state); } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJavaImporter.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJavaImporter.java index 1443c943b45..d1aa8cb1653 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJavaImporter.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJavaImporter.java @@ -146,7 +146,7 @@ public final class NativeJavaImporter extends ScriptObject { final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND); final Object value = createProperty(name); if(value != null) { - set(name, value, false); + set(name, value, 0); return true; } return false; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/DefaultPropertyAccess.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/DefaultPropertyAccess.java index c1ae1f59fe1..e69eda92c17 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/DefaultPropertyAccess.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/DefaultPropertyAccess.java @@ -112,82 +112,82 @@ public abstract class DefaultPropertyAccess implements PropertyAccess { } @Override - public void set(final double key, final int value, final boolean strict) { - set(JSType.toObject(key), JSType.toObject(value), strict); + public void set(final double key, final int value, final int flags) { + set(JSType.toObject(key), JSType.toObject(value), flags); } @Override - public void set(final double key, final long value, final boolean strict) { - set(JSType.toObject(key), JSType.toObject(value), strict); + public void set(final double key, final long value, final int flags) { + set(JSType.toObject(key), JSType.toObject(value), flags); } @Override - public void set(final double key, final double value, final boolean strict) { - set(JSType.toObject(key), JSType.toObject(value), strict); + public void set(final double key, final double value, final int flags) { + set(JSType.toObject(key), JSType.toObject(value), flags); } @Override - public void set(final double key, final Object value, final boolean strict) { - set(JSType.toObject(key), JSType.toObject(value), strict); + public void set(final double key, final Object value, final int flags) { + set(JSType.toObject(key), JSType.toObject(value), flags); } @Override - public void set(final long key, final int value, final boolean strict) { - set(JSType.toObject(key), JSType.toObject(value), strict); + public void set(final long key, final int value, final int flags) { + set(JSType.toObject(key), JSType.toObject(value), flags); } @Override - public void set(final long key, final long value, final boolean strict) { - set(JSType.toObject(key), JSType.toObject(value), strict); + public void set(final long key, final long value, final int flags) { + set(JSType.toObject(key), JSType.toObject(value), flags); } @Override - public void set(final long key, final double value, final boolean strict) { - set(JSType.toObject(key), JSType.toObject(value), strict); + public void set(final long key, final double value, final int flags) { + set(JSType.toObject(key), JSType.toObject(value), flags); } @Override - public void set(final long key, final Object value, final boolean strict) { - set(JSType.toObject(key), value, strict); + public void set(final long key, final Object value, final int flags) { + set(JSType.toObject(key), value, flags); } @Override - public void set(final int key, final int value, final boolean strict) { - set(JSType.toObject(key), JSType.toObject(value), strict); + public void set(final int key, final int value, final int flags) { + set(JSType.toObject(key), JSType.toObject(value), flags); } @Override - public void set(final int key, final long value, final boolean strict) { - set(JSType.toObject(key), JSType.toObject(value), strict); + public void set(final int key, final long value, final int flags) { + set(JSType.toObject(key), JSType.toObject(value), flags); } @Override - public void set(final int key, final double value, final boolean strict) { - set(JSType.toObject(key), JSType.toObject(value), strict); + public void set(final int key, final double value, final int flags) { + set(JSType.toObject(key), JSType.toObject(value), flags); } @Override - public void set(final int key, final Object value, final boolean strict) { - set(JSType.toObject(key), value, strict); + public void set(final int key, final Object value, final int flags) { + set(JSType.toObject(key), value, flags); } @Override - public void set(final Object key, final int value, final boolean strict) { - set(key, JSType.toObject(value), strict); + public void set(final Object key, final int value, final int flags) { + set(key, JSType.toObject(value), flags); } @Override - public void set(final Object key, final long value, final boolean strict) { - set(key, JSType.toObject(value), strict); + public void set(final Object key, final long value, final int flags) { + set(key, JSType.toObject(value), flags); } @Override - public void set(final Object key, final double value, final boolean strict) { - set(key, JSType.toObject(value), strict); + public void set(final Object key, final double value, final int flags) { + set(key, JSType.toObject(value), flags); } @Override - public abstract void set(Object key, Object value, boolean strict); + public abstract void set(Object key, Object value, int flags); @Override public abstract boolean has(Object key); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ECMAException.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ECMAException.java index ce691afaf02..954a170705d 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ECMAException.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ECMAException.java @@ -285,7 +285,7 @@ public final class ECMAException extends NashornException { if (!sobj.has(EXCEPTION_PROPERTY)) { sobj.addOwnProperty(EXCEPTION_PROPERTY, Property.NOT_ENUMERABLE, this); } else { - sobj.set(EXCEPTION_PROPERTY, this, false); + sobj.set(EXCEPTION_PROPERTY, this, 0); } } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FindProperty.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FindProperty.java index 72a2d835208..06f682bf169 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FindProperty.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FindProperty.java @@ -138,6 +138,17 @@ public final class FindProperty { return prototype; } + /** + * Return the {@code ScriptObject} where the search started. This is usually the ScriptObject the + * operation was started on, except for properties found inside a 'with' statement, where it is the + * top-level 'with' expression object. + * + * @return the start object. + */ + public ScriptObject getSelf() { + return self; + } + /** * Return the appropriate receiver for a getter. * @return appropriate receiver diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java index df947cdb0c0..3a1048125a5 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java @@ -309,7 +309,7 @@ public final class GlobalConstants implements Loggable { * * @param find property lookup * @param inv normal guarded invocation for this setter, as computed by the ScriptObject linker - * @param desc callsite descriptr + * @param desc callsite descriptor * @param request link request * * @return null if failed to set up constant linkage @@ -376,8 +376,12 @@ public final class GlobalConstants implements Loggable { * @return resulting getter, or null if failed to create constant */ synchronized GuardedInvocation findGetMethod(final FindProperty find, final ScriptObject receiver, final CallSiteDescriptor desc) { - // Also return null if property may have side effects - if ((GLOBAL_ONLY && !find.getOwner().isGlobal()) || find.getProperty() instanceof UserAccessorProperty) { + // Only use constant getter for fast scope access, because the receiver may change between invocations + // for slow-scope and non-scope callsites. + // Also return null for user accessor properties as they may have side effects. + if (!NashornCallSiteDescriptor.isFastScope(desc) + || (GLOBAL_ONLY && !find.getOwner().isGlobal()) + || find.getProperty() instanceof UserAccessorProperty) { return null; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java index 5fe57725469..a400bbd9adb 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java @@ -122,7 +122,7 @@ public final class JSONFunctions { if (newElement == ScriptRuntime.UNDEFINED) { valueObj.delete(key, false); } else { - setPropertyValue(valueObj, key, newElement, false); + setPropertyValue(valueObj, key, newElement); } } } @@ -179,7 +179,7 @@ public final class JSONFunctions { final String name = pNode.getKeyName(); final Object value = convertNode(global, valueNode); - setPropertyValue(object, name, value, false); + setPropertyValue(object, name, value); } return object; @@ -193,14 +193,14 @@ public final class JSONFunctions { } // add a new property if does not exist already, or else set old property - private static void setPropertyValue(final ScriptObject sobj, final String name, final Object value, final boolean strict) { + private static void setPropertyValue(final ScriptObject sobj, final String name, final Object value) { final int index = ArrayIndex.getArrayIndex(name); if (ArrayIndex.isValidArrayIndex(index)) { // array index key sobj.defineOwnProperty(index, value); } else if (sobj.getMap().findProperty(name) != null) { // pre-existing non-inherited property, call set - sobj.set(name, value, strict); + sobj.set(name, value, 0); } else { // add new property sobj.addOwnProperty(name, Property.WRITABLE_ENUMERABLE_CONFIGURABLE, value); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NativeJavaPackage.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NativeJavaPackage.java index 27c9bca7613..2d110e08a53 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NativeJavaPackage.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NativeJavaPackage.java @@ -256,7 +256,7 @@ public final class NativeJavaPackage extends ScriptObject { final Object constructor = BeansLinker.getConstructorMethod( javaClass, propertyName.substring(openBrace + 1, lastChar)); if (constructor != null) { - set(propertyName, constructor, false); + set(propertyName, constructor, 0); return constructor; } // we didn't find a matching constructor! @@ -270,7 +270,7 @@ public final class NativeJavaPackage extends ScriptObject { propertyValue = StaticClass.forClass(javaClass); } - set(propertyName, propertyValue, false); + set(propertyName, propertyValue, 0); return propertyValue; } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyAccess.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyAccess.java index 6f09e997587..420ef44f3a6 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyAccess.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyAccess.java @@ -163,129 +163,129 @@ public interface PropertyAccess { * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(Object key, int value, boolean strict); + public void set(Object key, int value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(Object key, long value, boolean strict); + public void set(Object key, long value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(Object key, double value, boolean strict); + public void set(Object key, double value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(Object key, Object value, boolean strict); + public void set(Object key, Object value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(double key, int value, boolean strict); + public void set(double key, int value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(double key, long value, boolean strict); + public void set(double key, long value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(double key, double value, boolean strict); + public void set(double key, double value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(double key, Object value, boolean strict); + public void set(double key, Object value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(long key, int value, boolean strict); + public void set(long key, int value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(long key, long value, boolean strict); + public void set(long key, long value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(long key, double value, boolean strict); + public void set(long key, double value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(long key, Object value, boolean strict); + public void set(long key, Object value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(int key, int value, boolean strict); + public void set(int key, int value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(int key, long value, boolean strict); + public void set(int key, long value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(int key, double value, boolean strict); + public void set(int key, double value, int flags); /** * Set the value of a given key * @param key the key * @param value the value - * @param strict are we in strict mode + * @param flags call site flags */ - public void set(int key, Object value, boolean strict); + public void set(int key, Object value, int flags); /** * Check if the given key exists anywhere in the proto chain diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RewriteException.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RewriteException.java index 37d65f2f5e5..4c0e0a3a7c6 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RewriteException.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RewriteException.java @@ -45,6 +45,7 @@ import jdk.nashorn.internal.codegen.types.Type; import jdk.nashorn.internal.lookup.MethodHandleFactory; import jdk.nashorn.internal.lookup.MethodHandleFunctionality; import jdk.nashorn.internal.objects.Global; +import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor; /** * Used to signal to the linker to relink the callee @@ -161,7 +162,7 @@ public final class RewriteException extends Exception { assert runtimeScope == null; runtimeScope = (ScriptObject)value; } else if(name != null) { - locals.set(name, value, true); + locals.set(name, value, NashornCallSiteDescriptor.CALLSITE_STRICT); } } locals.setProto(runtimeScope); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java index cabd13575f5..8d616b58e6a 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java @@ -198,10 +198,10 @@ public abstract class ScriptObject implements PropertyAccess { public static final Call SET_USER_ACCESSORS = virtualCall(MethodHandles.lookup(), ScriptObject.class, "setUserAccessors", void.class, String.class, ScriptFunction.class, ScriptFunction.class); static final MethodHandle[] SET_SLOW = new MethodHandle[] { - findOwnMH_V("set", void.class, Object.class, int.class, boolean.class), - findOwnMH_V("set", void.class, Object.class, long.class, boolean.class), - findOwnMH_V("set", void.class, Object.class, double.class, boolean.class), - findOwnMH_V("set", void.class, Object.class, Object.class, boolean.class) + findOwnMH_V("set", void.class, Object.class, int.class, int.class), + findOwnMH_V("set", void.class, Object.class, long.class, int.class), + findOwnMH_V("set", void.class, Object.class, double.class, int.class), + findOwnMH_V("set", void.class, Object.class, Object.class, int.class) }; /** Method handle to reset the map of this ScriptObject */ @@ -593,7 +593,7 @@ public abstract class ScriptObject implements PropertyAccess { if (newValue && property != null) { // Temporarily clear flags. property = modifyOwnProperty(property, 0); - set(key, value, false); + set(key, value, 0); //this might change the map if we change types of the property //hence we need to read it again. note that we should probably //have the setter return the new property throughout and in @@ -758,7 +758,7 @@ public abstract class ScriptObject implements PropertyAccess { * @return FindPropertyData or null if not found. */ public final FindProperty findProperty(final String key, final boolean deep) { - return findProperty(key, deep, false, this); + return findProperty(key, deep, this); } /** @@ -775,16 +775,11 @@ public abstract class ScriptObject implements PropertyAccess { * * @param key Property key. * @param deep Whether the search should look up proto chain. - * @param stopOnNonScope should a deep search stop on the first non-scope object? * @param start the object on which the lookup was originally initiated * * @return FindPropertyData or null if not found. */ - FindProperty findProperty(final String key, final boolean deep, final boolean stopOnNonScope, final ScriptObject start) { - // if doing deep search, stop search on the first non-scope object if asked to do so - if (stopOnNonScope && start != this && !isScope()) { - return null; - } + FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) { final PropertyMap selfMap = getMap(); final Property property = selfMap.findProperty(key); @@ -796,7 +791,7 @@ public abstract class ScriptObject implements PropertyAccess { if (deep) { final ScriptObject myProto = getProto(); if (myProto != null) { - return myProto.findProperty(key, deep, stopOnNonScope, start); + return myProto.findProperty(key, deep, start); } } @@ -1164,7 +1159,7 @@ public abstract class ScriptObject implements PropertyAccess { * @param value the value to write at the given index */ public void setArgument(final int key, final Object value) { - set(key, value, false); + set(key, value, 0); } /** @@ -1725,7 +1720,8 @@ public abstract class ScriptObject implements PropertyAccess { */ public Object put(final Object key, final Object value, final boolean strict) { final Object oldValue = get(key); - set(key, value, strict); + final int flags = strict ? NashornCallSiteDescriptor.CALLSITE_STRICT : 0; + set(key, value, flags); return oldValue; } @@ -1738,8 +1734,9 @@ public abstract class ScriptObject implements PropertyAccess { * @param strict strict mode or not */ public void putAll(final Map otherMap, final boolean strict) { + final int flags = strict ? NashornCallSiteDescriptor.CALLSITE_STRICT : 0; for (final Map.Entry entry : otherMap.entrySet()) { - set(entry.getKey(), entry.getValue(), strict); + set(entry.getKey(), entry.getValue(), flags); } } @@ -2042,7 +2039,7 @@ public abstract class ScriptObject implements PropertyAccess { final PropertyMap newMap = map.replaceProperty(property, property.removeFlags(Property.NEEDS_DECLARATION)); setMap(newMap); - set(key, value, true); + set(key, value, 0); } /** @@ -2135,7 +2132,6 @@ public abstract class ScriptObject implements PropertyAccess { return findMegaMorphicSetMethod(desc, name); } - final boolean scope = isScope(); final boolean explicitInstanceOfCheck = explicitInstanceOfCheck(desc, request); /* @@ -2145,16 +2141,18 @@ public abstract class ScriptObject implements PropertyAccess { * * toString = function() { print("global toString"); } // don't affect Object.prototype.toString */ - FindProperty find = findProperty(name, true, scope, this); + FindProperty find = findProperty(name, true, this); // If it's not a scope search, then we don't want any inherited properties except those with user defined accessors. - if (!scope && find != null && find.isInherited() && !(find.getProperty() instanceof UserAccessorProperty)) { + if (find != null && find.isInherited() && !(find.getProperty() instanceof UserAccessorProperty)) { // We should still check if inherited data property is not writable if (isExtensible() && !find.getProperty().isWritable()) { - return createEmptySetMethod(desc, explicitInstanceOfCheck, "property.not.writable", false); + return createEmptySetMethod(desc, explicitInstanceOfCheck, "property.not.writable", true); + } + // Otherwise, forget the found property unless this is a scope callsite and the owner is a scope object as well. + if (!NashornCallSiteDescriptor.isScope(desc) || !find.getOwner().isScope()) { + find = null; } - // Otherwise, forget the found property - find = null; } if (find != null) { @@ -2180,8 +2178,8 @@ public abstract class ScriptObject implements PropertyAccess { private GuardedInvocation createEmptySetMethod(final CallSiteDescriptor desc, final boolean explicitInstanceOfCheck, final String strictErrorMessage, final boolean canBeFastScope) { final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND); - if (NashornCallSiteDescriptor.isStrict(desc)) { - throw typeError(strictErrorMessage, name, ScriptRuntime.safeToString(this)); + if (NashornCallSiteDescriptor.isStrict(desc)) { + throw typeError(strictErrorMessage, name, ScriptRuntime.safeToString(this)); } assert canBeFastScope || !NashornCallSiteDescriptor.isFastScope(desc); return new GuardedInvocation( @@ -2207,7 +2205,7 @@ public abstract class ScriptObject implements PropertyAccess { private GuardedInvocation findMegaMorphicSetMethod(final CallSiteDescriptor desc, final String name) { final MethodType type = desc.getMethodType().insertParameterTypes(1, Object.class); //never bother with ClassCastExceptionGuard for megamorphic callsites - final GuardedInvocation inv = findSetIndexMethod(getClass(), false, type, NashornCallSiteDescriptor.isStrict(desc)); + final GuardedInvocation inv = findSetIndexMethod(getClass(), desc, false, type); return inv.replaceMethods(MH.insertArguments(inv.getInvocation(), 1, name), inv.getGuard()); } @@ -2230,24 +2228,26 @@ public abstract class ScriptObject implements PropertyAccess { * @return GuardedInvocation to be invoked at call site. */ protected GuardedInvocation findSetIndexMethod(final CallSiteDescriptor desc, final LinkRequest request) { // array, index, value - return findSetIndexMethod(getClass(), explicitInstanceOfCheck(desc, request), desc.getMethodType(), NashornCallSiteDescriptor.isStrict(desc)); + return findSetIndexMethod(getClass(), desc, explicitInstanceOfCheck(desc, request), desc.getMethodType()); } /** * Find the appropriate SETINDEX method for an invoke dynamic call. * + * @param clazz the receiver class + * @param desc the call site descriptor + * @param explicitInstanceOfCheck add an explicit instanceof check? * @param callType the method type at the call site - * @param isStrict are we in strict mode? * * @return GuardedInvocation to be invoked at call site. */ - private static GuardedInvocation findSetIndexMethod(final Class clazz, final boolean explicitInstanceOfCheck, final MethodType callType, final boolean isStrict) { + private static GuardedInvocation findSetIndexMethod(final Class clazz, final CallSiteDescriptor desc, final boolean explicitInstanceOfCheck, final MethodType callType) { assert callType.parameterCount() == 3; final Class keyClass = callType.parameterType(1); final Class valueClass = callType.parameterType(2); - MethodHandle methodHandle = findOwnMH_V(clazz, "set", void.class, keyClass, valueClass, boolean.class); - methodHandle = MH.insertArguments(methodHandle, 3, isStrict); + MethodHandle methodHandle = findOwnMH_V(clazz, "set", void.class, keyClass, valueClass, int.class); + methodHandle = MH.insertArguments(methodHandle, 3, NashornCallSiteDescriptor.getFlags(desc)); return new GuardedInvocation(methodHandle, getScriptObjectGuard(callType, explicitInstanceOfCheck), (SwitchPoint)null, explicitInstanceOfCheck ? null : ClassCastException.class); } @@ -2672,7 +2672,7 @@ public abstract class ScriptObject implements PropertyAccess { if (isValidArrayIndex(index)) { for (ScriptObject object = this; ; ) { if (object.getMap().containsArrayKeys()) { - final FindProperty find = object.findProperty(key, false, false, this); + final FindProperty find = object.findProperty(key, false, this); if (find != null) { return getIntValue(find, programPoint); @@ -2755,7 +2755,7 @@ public abstract class ScriptObject implements PropertyAccess { if (isValidArrayIndex(index)) { for (ScriptObject object = this; ; ) { if (object.getMap().containsArrayKeys()) { - final FindProperty find = object.findProperty(key, false, false, this); + final FindProperty find = object.findProperty(key, false, this); if (find != null) { return getLongValue(find, programPoint); } @@ -2837,7 +2837,7 @@ public abstract class ScriptObject implements PropertyAccess { if (isValidArrayIndex(index)) { for (ScriptObject object = this; ; ) { if (object.getMap().containsArrayKeys()) { - final FindProperty find = object.findProperty(key, false, false, this); + final FindProperty find = object.findProperty(key, false, this); if (find != null) { return getDoubleValue(find, programPoint); } @@ -2919,7 +2919,7 @@ public abstract class ScriptObject implements PropertyAccess { if (isValidArrayIndex(index)) { for (ScriptObject object = this; ; ) { if (object.getMap().containsArrayKeys()) { - final FindProperty find = object.findProperty(key, false, false, this); + final FindProperty find = object.findProperty(key, false, this); if (find != null) { return find.getObjectValue(); @@ -2996,48 +2996,48 @@ public abstract class ScriptObject implements PropertyAccess { return get(index, JSType.toString(key)); } - private boolean doesNotHaveCheckArrayKeys(final long longIndex, final int value, final boolean strict) { + private boolean doesNotHaveCheckArrayKeys(final long longIndex, final int value, final int callSiteFlags) { if (getMap().containsArrayKeys()) { final String key = JSType.toString(longIndex); final FindProperty find = findProperty(key, true); if (find != null) { - setObject(find, strict, key, value); + setObject(find, callSiteFlags, key, value); return true; } } return false; } - private boolean doesNotHaveCheckArrayKeys(final long longIndex, final long value, final boolean strict) { + private boolean doesNotHaveCheckArrayKeys(final long longIndex, final long value, final int callSiteFlags) { if (getMap().containsArrayKeys()) { final String key = JSType.toString(longIndex); final FindProperty find = findProperty(key, true); if (find != null) { - setObject(find, strict, key, value); + setObject(find, callSiteFlags, key, value); return true; } } return false; } - private boolean doesNotHaveCheckArrayKeys(final long longIndex, final double value, final boolean strict) { + private boolean doesNotHaveCheckArrayKeys(final long longIndex, final double value, final int callSiteFlags) { if (getMap().containsArrayKeys()) { final String key = JSType.toString(longIndex); final FindProperty find = findProperty(key, true); if (find != null) { - setObject(find, strict, key, value); + setObject(find, callSiteFlags, key, value); return true; } } return false; } - private boolean doesNotHaveCheckArrayKeys(final long longIndex, final Object value, final boolean strict) { + private boolean doesNotHaveCheckArrayKeys(final long longIndex, final Object value, final int callSiteFlags) { if (getMap().containsArrayKeys()) { final String key = JSType.toString(longIndex); final FindProperty find = findProperty(key, true); if (find != null) { - setObject(find, strict, key, value); + setObject(find, callSiteFlags, key, value); return true; } } @@ -3045,10 +3045,10 @@ public abstract class ScriptObject implements PropertyAccess { } //value agnostic - private boolean doesNotHaveEnsureLength(final long longIndex, final long oldLength, final boolean strict) { + private boolean doesNotHaveEnsureLength(final long longIndex, final long oldLength, final int callSiteFlags) { if (longIndex >= oldLength) { if (!isExtensible()) { - if (strict) { + if (NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)) { throw typeError("object.non.extensible", JSType.toString(longIndex), ScriptRuntime.safeToString(this)); } return true; @@ -3068,37 +3068,41 @@ public abstract class ScriptObject implements PropertyAccess { } } - private void doesNotHave(final int index, final int value, final boolean strict) { + private void doesNotHave(final int index, final int value, final int callSiteFlags) { final long oldLength = getArray().length(); final long longIndex = ArrayIndex.toLongIndex(index); - if (!doesNotHaveCheckArrayKeys(longIndex, value, strict) && !doesNotHaveEnsureLength(longIndex, oldLength, strict)) { + if (!doesNotHaveCheckArrayKeys(longIndex, value, callSiteFlags) && !doesNotHaveEnsureLength(longIndex, oldLength, callSiteFlags)) { + final boolean strict = NashornCallSiteDescriptor.isStrictFlag(callSiteFlags); setArray(getArray().set(index, value, strict)); doesNotHaveEnsureDelete(longIndex, oldLength, strict); } } - private void doesNotHave(final int index, final long value, final boolean strict) { + private void doesNotHave(final int index, final long value, final int callSiteFlags) { final long oldLength = getArray().length(); final long longIndex = ArrayIndex.toLongIndex(index); - if (!doesNotHaveCheckArrayKeys(longIndex, value, strict) && !doesNotHaveEnsureLength(longIndex, oldLength, strict)) { + if (!doesNotHaveCheckArrayKeys(longIndex, value, callSiteFlags) && !doesNotHaveEnsureLength(longIndex, oldLength, callSiteFlags)) { + final boolean strict = NashornCallSiteDescriptor.isStrictFlag(callSiteFlags); setArray(getArray().set(index, value, strict)); doesNotHaveEnsureDelete(longIndex, oldLength, strict); } } - private void doesNotHave(final int index, final double value, final boolean strict) { + private void doesNotHave(final int index, final double value, final int callSiteFlags) { final long oldLength = getArray().length(); final long longIndex = ArrayIndex.toLongIndex(index); - if (!doesNotHaveCheckArrayKeys(longIndex, value, strict) && !doesNotHaveEnsureLength(longIndex, oldLength, strict)) { + if (!doesNotHaveCheckArrayKeys(longIndex, value, callSiteFlags) && !doesNotHaveEnsureLength(longIndex, oldLength, callSiteFlags)) { + final boolean strict = NashornCallSiteDescriptor.isStrictFlag(callSiteFlags); setArray(getArray().set(index, value, strict)); doesNotHaveEnsureDelete(longIndex, oldLength, strict); } } - private void doesNotHave(final int index, final Object value, final boolean strict) { + private void doesNotHave(final int index, final Object value, final int callSiteFlags) { final long oldLength = getArray().length(); final long longIndex = ArrayIndex.toLongIndex(index); - if (!doesNotHaveCheckArrayKeys(longIndex, value, strict) && !doesNotHaveEnsureLength(longIndex, oldLength, strict)) { + if (!doesNotHaveCheckArrayKeys(longIndex, value, callSiteFlags) && !doesNotHaveEnsureLength(longIndex, oldLength, callSiteFlags)) { + final boolean strict = NashornCallSiteDescriptor.isStrictFlag(callSiteFlags); setArray(getArray().set(index, value, strict)); doesNotHaveEnsureDelete(longIndex, oldLength, strict); } @@ -3108,32 +3112,47 @@ public abstract class ScriptObject implements PropertyAccess { * This is the most generic of all Object setters. Most of the others use this in some form. * TODO: should be further specialized * - * @param find found property - * @param strict are we in strict mode - * @param key property key - * @param value property value + * @param find found property + * @param callSiteFlags callsite flags + * @param key property key + * @param value property value */ - public final void setObject(final FindProperty find, final boolean strict, final String key, final Object value) { + public final void setObject(final FindProperty find, final int callSiteFlags, final String key, final Object value) { FindProperty f = find; - if (f != null && f.isInherited() && !(f.getProperty() instanceof UserAccessorProperty) && !isScope()) { - // Setting a property should not modify the property in prototype unless this is a scope object. - f = null; + if (f != null && f.isInherited() && !(f.getProperty() instanceof UserAccessorProperty)) { + final boolean isScope = NashornCallSiteDescriptor.isScopeFlag(callSiteFlags); + // If the start object of the find is not this object it means the property was found inside a + // 'with' statement expression (see WithObject.findProperty()). In this case we forward the 'set' + // to the 'with' object. + // Note that although a 'set' operation involving a with statement follows scope rules outside + // the 'with' expression (the 'set' operation is performed on the owning prototype if it exists), + // it follows non-scope rules inside the 'with' expression (set is performed on the top level object). + // This is why we clear the callsite flags and FindProperty in the forward call to the 'with' object. + if (isScope && f.getSelf() != this) { + f.getSelf().setObject(null, 0, key, value); + return; + } + // Setting a property should not modify the property in prototype unless this is a scope callsite + // and the owner is a scope object as well (with the exception of 'with' statement handled above). + if (!isScope || !f.getOwner().isScope()) { + f = null; + } } if (f != null) { if (!f.getProperty().isWritable()) { - if (strict) { + if (NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)) { throw typeError("property.not.writable", key, ScriptRuntime.safeToString(this)); } return; } - f.setValue(value, strict); + f.setValue(value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)); } else if (!isExtensible()) { - if (strict) { + if (NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)) { throw typeError("object.non.extensible", key, ScriptRuntime.safeToString(this)); } } else { @@ -3153,293 +3172,293 @@ public abstract class ScriptObject implements PropertyAccess { } @Override - public void set(final Object key, final int value, final boolean strict) { + public void set(final Object key, final int value, final int callSiteFlags) { final Object primitiveKey = JSType.toPrimitive(key, String.class); final int index = getArrayIndex(primitiveKey); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(primitiveKey); - setObject(findProperty(propName, true), strict, propName, JSType.toObject(value)); + setObject(findProperty(propName, true), callSiteFlags, propName, JSType.toObject(value)); } @Override - public void set(final Object key, final long value, final boolean strict) { + public void set(final Object key, final long value, final int callSiteFlags) { final Object primitiveKey = JSType.toPrimitive(key, String.class); final int index = getArrayIndex(primitiveKey); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(primitiveKey); - setObject(findProperty(propName, true), strict, propName, JSType.toObject(value)); + setObject(findProperty(propName, true), callSiteFlags, propName, JSType.toObject(value)); } @Override - public void set(final Object key, final double value, final boolean strict) { + public void set(final Object key, final double value, final int callSiteFlags) { final Object primitiveKey = JSType.toPrimitive(key, String.class); final int index = getArrayIndex(primitiveKey); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(primitiveKey); - setObject(findProperty(propName, true), strict, propName, JSType.toObject(value)); + setObject(findProperty(propName, true), callSiteFlags, propName, JSType.toObject(value)); } @Override - public void set(final Object key, final Object value, final boolean strict) { + public void set(final Object key, final Object value, final int callSiteFlags) { final Object primitiveKey = JSType.toPrimitive(key, String.class); final int index = getArrayIndex(primitiveKey); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(primitiveKey); - setObject(findProperty(propName, true), strict, propName, value); + setObject(findProperty(propName, true), callSiteFlags, propName, value); } @Override - public void set(final double key, final int value, final boolean strict) { + public void set(final double key, final int value, final int callSiteFlags) { final int index = getArrayIndex(key); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(key); - setObject(findProperty(propName, true), strict, propName, JSType.toObject(value)); + setObject(findProperty(propName, true), callSiteFlags, propName, JSType.toObject(value)); } @Override - public void set(final double key, final long value, final boolean strict) { + public void set(final double key, final long value, final int callSiteFlags) { final int index = getArrayIndex(key); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(key); - setObject(findProperty(propName, true), strict, propName, JSType.toObject(value)); + setObject(findProperty(propName, true), callSiteFlags, propName, JSType.toObject(value)); } @Override - public void set(final double key, final double value, final boolean strict) { + public void set(final double key, final double value, final int callSiteFlags) { final int index = getArrayIndex(key); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(key); - setObject(findProperty(propName, true), strict, propName, JSType.toObject(value)); + setObject(findProperty(propName, true), callSiteFlags, propName, JSType.toObject(value)); } @Override - public void set(final double key, final Object value, final boolean strict) { + public void set(final double key, final Object value, final int callSiteFlags) { final int index = getArrayIndex(key); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(key); - setObject(findProperty(propName, true), strict, propName, value); + setObject(findProperty(propName, true), callSiteFlags, propName, value); } @Override - public void set(final long key, final int value, final boolean strict) { + public void set(final long key, final int value, final int callSiteFlags) { final int index = getArrayIndex(key); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(key); - setObject(findProperty(propName, true), strict, propName, JSType.toObject(value)); + setObject(findProperty(propName, true), callSiteFlags, propName, JSType.toObject(value)); } @Override - public void set(final long key, final long value, final boolean strict) { + public void set(final long key, final long value, final int callSiteFlags) { final int index = getArrayIndex(key); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(key); - setObject(findProperty(propName, true), strict, propName, JSType.toObject(value)); + setObject(findProperty(propName, true), callSiteFlags, propName, JSType.toObject(value)); } @Override - public void set(final long key, final double value, final boolean strict) { + public void set(final long key, final double value, final int callSiteFlags) { final int index = getArrayIndex(key); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(key); - setObject(findProperty(propName, true), strict, propName, JSType.toObject(value)); + setObject(findProperty(propName, true), callSiteFlags, propName, JSType.toObject(value)); } @Override - public void set(final long key, final Object value, final boolean strict) { + public void set(final long key, final Object value, final int callSiteFlags) { final int index = getArrayIndex(key); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(key); - setObject(findProperty(propName, true), strict, propName, value); + setObject(findProperty(propName, true), callSiteFlags, propName, value); } @Override - public void set(final int key, final int value, final boolean strict) { + public void set(final int key, final int value, final int callSiteFlags) { final int index = getArrayIndex(key); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(key); - setObject(findProperty(propName, true), strict, propName, JSType.toObject(value)); + setObject(findProperty(propName, true), callSiteFlags, propName, JSType.toObject(value)); } @Override - public void set(final int key, final long value, final boolean strict) { + public void set(final int key, final long value, final int callSiteFlags) { final int index = getArrayIndex(key); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(key); - setObject(findProperty(propName, true), strict, propName, JSType.toObject(value)); + setObject(findProperty(propName, true), callSiteFlags, propName, JSType.toObject(value)); } @Override - public void set(final int key, final double value, final boolean strict) { + public void set(final int key, final double value, final int callSiteFlags) { final int index = getArrayIndex(key); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(key); - setObject(findProperty(propName, true), strict, propName, JSType.toObject(value)); + setObject(findProperty(propName, true), callSiteFlags, propName, JSType.toObject(value)); } @Override - public void set(final int key, final Object value, final boolean strict) { + public void set(final int key, final Object value, final int callSiteFlags) { final int index = getArrayIndex(key); if (isValidArrayIndex(index)) { if (getArray().has(index)) { - setArray(getArray().set(index, value, strict)); + setArray(getArray().set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags))); } else { - doesNotHave(index, value, strict); + doesNotHave(index, value, callSiteFlags); } return; } final String propName = JSType.toString(key); - setObject(findProperty(propName, true), strict, propName, value); + setObject(findProperty(propName, true), callSiteFlags, propName, value); } @Override diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptingFunctions.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptingFunctions.java index 2113b79c22e..83583232836 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptingFunctions.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptingFunctions.java @@ -221,9 +221,9 @@ public final class ScriptingFunctions { final String err = errBuffer.toString(); // Set globals for secondary results. - global.set(OUT_NAME, out, false); - global.set(ERR_NAME, err, false); - global.set(EXIT_NAME, exit, false); + global.set(OUT_NAME, out, 0); + global.set(ERR_NAME, err, 0); + global.set(EXIT_NAME, exit, 0); // Propagate exception if present. for (final IOException element : exception) { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java index 757cb3051e9..99ec3135a85 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java @@ -205,7 +205,7 @@ final class SetMethodCreator { //slow setter, that calls ScriptObject.set with appropraite type and key name MethodHandle slowSetter = ScriptObject.SET_SLOW[getAccessorTypeIndex(type)]; - slowSetter = MH.insertArguments(slowSetter, 3, NashornCallSiteDescriptor.isStrict(desc)); + slowSetter = MH.insertArguments(slowSetter, 3, NashornCallSiteDescriptor.getFlags(desc)); slowSetter = MH.insertArguments(slowSetter, 1, name); slowSetter = MH.asType(slowSetter, slowSetter.type().changeParameterType(0, Object.class)); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Undefined.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Undefined.java index fc1a028ab62..57c7e5f10c2 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Undefined.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Undefined.java @@ -34,6 +34,7 @@ import jdk.internal.dynalink.CallSiteDescriptor; import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.internal.dynalink.support.CallSiteDescriptorFactory; import jdk.internal.dynalink.support.Guards; +import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor; /** * Unique instance of this class is used to represent JavaScript undefined. @@ -128,7 +129,7 @@ public final class Undefined extends DefaultPropertyAccess { } private static final MethodHandle GET_METHOD = findOwnMH("get", Object.class, Object.class); - private static final MethodHandle SET_METHOD = MH.insertArguments(findOwnMH("set", void.class, Object.class, Object.class, boolean.class), 3, Boolean.TRUE); + private static final MethodHandle SET_METHOD = MH.insertArguments(findOwnMH("set", void.class, Object.class, Object.class, int.class), 3, NashornCallSiteDescriptor.CALLSITE_STRICT); private static GuardedInvocation findGetMethod(final CallSiteDescriptor desc) { return new GuardedInvocation(MH.insertArguments(GET_METHOD, 1, desc.getNameToken(2)), UNDEFINED_GUARD).asType(desc); @@ -152,7 +153,7 @@ public final class Undefined extends DefaultPropertyAccess { } @Override - public void set(final Object key, final Object value, final boolean strict) { + public void set(final Object key, final Object value, final int flags) { throw typeError("cant.set.property.of.undefined", ScriptRuntime.safeToString(key)); } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java index 723b510f6a9..54ec06f5319 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java @@ -193,18 +193,20 @@ public final class WithObject extends ScriptObject implements Scope { * * @param key Property key. * @param deep Whether the search should look up proto chain. - * @param stopOnNonScope should a deep search stop on the first non-scope object? * @param start the object on which the lookup was originally initiated * * @return FindPropertyData or null if not found. */ @Override - FindProperty findProperty(final String key, final boolean deep, final boolean stopOnNonScope, final ScriptObject start) { - final FindProperty exprProperty = expression.findProperty(key, deep, stopOnNonScope, start); + FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) { + // We call findProperty on 'expression' with 'expression' itself as start parameter. + // This way in ScriptObject.setObject we can tell the property is from a 'with' expression + // (as opposed from another non-scope object in the proto chain such as Object.prototype). + final FindProperty exprProperty = expression.findProperty(key, true, expression); if (exprProperty != null) { return exprProperty; } - return super.findProperty(key, deep, stopOnNonScope, start); + return super.findProperty(key, deep, start); } @Override diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java index 1871a2cb4cb..27fc3a2e7c1 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java @@ -255,7 +255,7 @@ public final class NashornCallSiteDescriptor extends AbstractCallSiteDescriptor * @return the Nashorn-specific flags for the call site, or 0 if the passed descriptor is not a Nashorn call site * descriptor. */ - private static int getFlags(final CallSiteDescriptor desc) { + public static int getFlags(final CallSiteDescriptor desc) { return desc instanceof NashornCallSiteDescriptor ? ((NashornCallSiteDescriptor)desc).flags : 0; } @@ -342,6 +342,24 @@ public final class NashornCallSiteDescriptor extends AbstractCallSiteDescriptor return isFlag(desc, CALLSITE_DECLARE); } + /** + * Returns true if {@code flags} has the {@link #CALLSITE_STRICT} bit set. + * @param flags the flags + * @return true if the flag is set, false otherwise. + */ + public static boolean isStrictFlag(final int flags) { + return (flags & CALLSITE_STRICT) != 0; + } + + /** + * Returns true if {@code flags} has the {@link #CALLSITE_SCOPE} bit set. + * @param flags the flags + * @return true if the flag is set, false otherwise. + */ + public static boolean isScopeFlag(final int flags) { + return (flags & CALLSITE_SCOPE) != 0; + } + /** * Get a program point from a descriptor (must be optimistic) * @param desc descriptor diff --git a/nashorn/test/script/basic/JDK-8047764-strict.js b/nashorn/test/script/basic/JDK-8047764-strict.js new file mode 100644 index 00000000000..d10b5b37d47 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8047764-strict.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2014, 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. + */ + +/** + * JDK-8047764: Indexed or polymorphic set on global affects Object.prototype + * + * @test + * @run + */ + +// Same as JDK-8047764.js but running in strict mode +"use strict"; + +// Test global set operation on properties defined in Object.prototype + +Object.defineProperty(Object.prototype, "prop1", { get: function() { return 1; }, set: function(v) { print("setting prop1: " + v); }}); +Object.defineProperty(Object.prototype, "prop2", { value: 1, writable: false, configurable: false }); + +try { + prop1 = 1; + print("prop 1: " + prop2); +} catch (e) { + print(e.name); +} + +try { + prop2 = 2; + print("prop 2: " + prop2); +} catch (e) { + print(e.name); +} + +// Make sure various ways of setting global toString don't affect Object.prototype.toString + +function checkToString() { + print(global); + print(Object.prototype); + print(global.toString === Object.prototype.toString); + print(objProtoToString === Object.prototype.toString); +} + +var global = this; +var objProtoToString = Object.prototype.toString; +global["toString"] = function() { return "global toString 1"; }; +checkToString(); +global.toString = function() { return "global toString 2"; }; +checkToString(); +toString = function() { return "global toString 3"; }; +checkToString(); diff --git a/nashorn/test/script/basic/JDK-8047764-strict.js.EXPECTED b/nashorn/test/script/basic/JDK-8047764-strict.js.EXPECTED new file mode 100644 index 00000000000..c452cfac1aa --- /dev/null +++ b/nashorn/test/script/basic/JDK-8047764-strict.js.EXPECTED @@ -0,0 +1,15 @@ +setting prop1: 1 +prop 1: 1 +TypeError +global toString 1 +[object Object] +false +true +global toString 2 +[object Object] +false +true +global toString 3 +[object Object] +false +true diff --git a/nashorn/test/script/basic/JDK-8047764.js b/nashorn/test/script/basic/JDK-8047764.js new file mode 100644 index 00000000000..3920323f48d --- /dev/null +++ b/nashorn/test/script/basic/JDK-8047764.js @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2014, 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. + */ + +/** + * JDK-8047764: Indexed or polymorphic set on global affects Object.prototype + * + * @test + * @run + */ + +// Test global set operation on properties defined in Object.prototype + +Object.defineProperty(Object.prototype, "prop1", { get: function() { return 1; }, set: function(v) { print("setting prop1: " + v); }}); +Object.defineProperty(Object.prototype, "prop2", { value: 1, writable: false, configurable: false }); + +try { + prop1 = 1; + print("prop 1: " + prop2); +} catch (e) { + print(e.name); +} + +try { + prop2 = 2; + print("prop 2: " + prop2); +} catch (e) { + print(e.name); +} + +// Make sure various ways of setting global toString don't affect Object.prototype.toString + +function checkToString() { + print(global); + print(Object.prototype); + print(global.toString === Object.prototype.toString); + print(objProtoToString === Object.prototype.toString); +} + +var global = this; +var objProtoToString = Object.prototype.toString; +global["toString"] = function() { return "global toString 1"; }; +checkToString(); +global.toString = function() { return "global toString 2"; }; +checkToString(); +toString = function() { return "global toString 3"; }; +checkToString(); + +// Test setters on 'with' object + +var p = { prop3: 3, toString: function() { return "[object p]"; }}; +Object.defineProperty(p, "prop4", { get: function() { print("get", this); return 4; }, set: function(v) { print("set", this, v); }}); +var o = Object.create(p); +o.toString = function() { return "[object o]"; }; + +with(o) { + (function() { + var m = 5; + (function() { + print(prop3); + prop3 = m; + print(prop3); + print(prop4); + prop4 = m; + print(prop4); + })(); + })(); +} + +print(o.hasOwnProperty("prop3")); +print(o.prop3); +print(p.prop3); +print(o.hasOwnProperty("prop4")); +print(o.prop4); +print(p.prop4); diff --git a/nashorn/test/script/basic/JDK-8047764.js.EXPECTED b/nashorn/test/script/basic/JDK-8047764.js.EXPECTED new file mode 100644 index 00000000000..5c9b0eb5fd0 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8047764.js.EXPECTED @@ -0,0 +1,30 @@ +setting prop1: 1 +prop 1: 1 +prop 2: 1 +global toString 1 +[object Object] +false +true +global toString 2 +[object Object] +false +true +global toString 3 +[object Object] +false +true +3 +5 +get [object o] +4 +set [object o] 5 +get [object o] +4 +true +5 +3 +false +get [object o] +4 +get [object p] +4 From 00019f9c0332d591f839b30851c832250ddc9d21 Mon Sep 17 00:00:00 2001 From: Attila Szegedi Date: Mon, 22 Sep 2014 14:46:04 +0200 Subject: [PATCH 57/81] 8058561: NPE in LocalVariableTypesCalculator Reviewed-by: lagergren, sundar --- .../codegen/LocalVariableTypesCalculator.java | 12 +++++- nashorn/test/script/basic/JDK-8058561.js | 42 +++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 nashorn/test/script/basic/JDK-8058561.js diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java index 995b29a6157..c9580d41341 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java @@ -558,7 +558,7 @@ final class LocalVariableTypesCalculator extends NodeVisitor{ // of the compilation that the object being iterated over must use strings for property // names (e.g., it is a native JS object or array), then we'll not bother trying to treat // the property names optimistically. - !forNode.isForEach() && compiler.hasStringPropertyIterator(iterable.getExpression())); + !compiler.useOptimisticTypes() || (!forNode.isForEach() && compiler.hasStringPropertyIterator(iterable.getExpression()))); } else { if(init != null) { init.accept(this); @@ -686,6 +686,10 @@ final class LocalVariableTypesCalculator extends NodeVisitor{ @Override public boolean enterReturnNode(final ReturnNode returnNode) { + if(!reachable) { + return false; + } + final Expression returnExpr = returnNode.getExpression(); final Type returnExprType; if(returnExpr != null) { @@ -701,6 +705,9 @@ final class LocalVariableTypesCalculator extends NodeVisitor{ @Override public boolean enterSplitNode(final SplitNode splitNode) { + if(!reachable) { + return false; + } // Need to visit inside of split nodes. While it's true that they don't have local variables, we need to visit // breaks, continues, and returns in them. if(topSplit == null) { @@ -950,6 +957,9 @@ final class LocalVariableTypesCalculator extends NodeVisitor{ @Override public boolean enterVarNode(final VarNode varNode) { + if (!reachable) { + return false; + } final Expression init = varNode.getInit(); if(init != null) { init.accept(this); diff --git a/nashorn/test/script/basic/JDK-8058561.js b/nashorn/test/script/basic/JDK-8058561.js new file mode 100644 index 00000000000..f27d1d1b677 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8058561.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2010, 2014, 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. + */ + +/** + * JDK-8058561: NPE in LocalVariableTypesCalculator + * + * @test + * @run + * @option --lazy-compilation=false + */ + +// Just attempting to compile this caused the NPE +function func(x, y) { + while(true) { + switch (y[0]) { + case "bar": + x = 'xxx'; + break; + } + } + return x; +} From ce60f8015f52389a0c3067a25865b2d4dc890842 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Mon, 22 Sep 2014 15:57:34 +0100 Subject: [PATCH 58/81] 8025917: JDK demo applets not running with >=7u40 or (JDK 8 and JDK 9) Reviewed-by: alexp --- jdk/src/demo/share/README | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jdk/src/demo/share/README b/jdk/src/demo/share/README index ae56b64d728..e70be01a0a2 100644 --- a/jdk/src/demo/share/README +++ b/jdk/src/demo/share/README @@ -4,3 +4,12 @@ deliberately simplified. Additional steps required for a production-quality application, such as security checks, input validation, and proper error handling, might not be present in the sample code. + +In some cases, the default security settings may block an execution +of demo applets in a browser. To adjust the security settings, please +refer to the following resource: + +http://java.com/en/download/help/java_blocked.xml + +Some demo applets need to be accessed through the HTTP or HTTPS +protocols to enable access to the required resources. From a5187396f5151b976953a66c9806293e1f6f979f Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Mon, 22 Sep 2014 16:59:23 -0700 Subject: [PATCH 59/81] 4477961: java.lang.Math.toDegrees(double) could be optimized Change toDegrees() and toRadians() to multiplication by a compile-time constant. Reviewed-by: mduigou, shade --- .../java.base/share/classes/java/lang/Math.java | 16 ++++++++++++++-- .../share/classes/java/lang/StrictMath.java | 17 +++++++++++++++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/Math.java b/jdk/src/java.base/share/classes/java/lang/Math.java index 1befa43f14e..6606ac07c83 100644 --- a/jdk/src/java.base/share/classes/java/lang/Math.java +++ b/jdk/src/java.base/share/classes/java/lang/Math.java @@ -122,6 +122,18 @@ public final class Math { */ public static final double PI = 3.14159265358979323846; + /** + * Constant by which to multiply an angular value in degrees to obtain an + * angular value in radians. + */ + private static final double DEGREES_TO_RADIANS = 0.017453292519943295; + + /** + * Constant by which to multiply an angular value in radians to obtain an + * angular value in degrees. + */ + private static final double RADIANS_TO_DEGREES = 57.29577951308232; + /** * Returns the trigonometric sine of an angle. Special cases: *

      • If the argument is NaN or an infinity, then the @@ -233,7 +245,7 @@ public final class Math { * @since 1.2 */ public static double toRadians(double angdeg) { - return angdeg / 180.0 * PI; + return angdeg * DEGREES_TO_RADIANS; } /** @@ -249,7 +261,7 @@ public final class Math { * @since 1.2 */ public static double toDegrees(double angrad) { - return angrad * 180.0 / PI; + return angrad * RADIANS_TO_DEGREES; } /** diff --git a/jdk/src/java.base/share/classes/java/lang/StrictMath.java b/jdk/src/java.base/share/classes/java/lang/StrictMath.java index ae4af2bcac8..ffb9f62fce9 100644 --- a/jdk/src/java.base/share/classes/java/lang/StrictMath.java +++ b/jdk/src/java.base/share/classes/java/lang/StrictMath.java @@ -97,6 +97,19 @@ public final class StrictMath { */ public static final double PI = 3.14159265358979323846; + /** + * Constant by which to multiply an angular value in degrees to obtain an + * angular value in radians. + */ + private static final double DEGREES_TO_RADIANS = 0.017453292519943295; + + /** + * Constant by which to multiply an angular value in radians to obtain an + * angular value in degrees. + */ + + private static final double RADIANS_TO_DEGREES = 57.29577951308232; + /** * Returns the trigonometric sine of an angle. Special cases: *
        • If the argument is NaN or an infinity, then the @@ -179,7 +192,7 @@ public final class StrictMath { public static strictfp double toRadians(double angdeg) { // Do not delegate to Math.toRadians(angdeg) because // this method has the strictfp modifier. - return angdeg / 180.0 * PI; + return angdeg * DEGREES_TO_RADIANS; } /** @@ -196,7 +209,7 @@ public final class StrictMath { public static strictfp double toDegrees(double angrad) { // Do not delegate to Math.toDegrees(angrad) because // this method has the strictfp modifier. - return angrad * 180.0 / PI; + return angrad * RADIANS_TO_DEGREES; } /** From 643e8d87e6f815605cbc2b3606ff8c16ea07d88c Mon Sep 17 00:00:00 2001 From: Sergey Lugovoy Date: Tue, 23 Sep 2014 15:58:44 +0400 Subject: [PATCH 60/81] 8057779: Tests failed on Windows when in output contains path to script Reviewed-by: sundar, lagergren, hannesw --- nashorn/test/script/basic/es6/const-empty.js | 2 +- nashorn/test/script/basic/es6/const-redeclare-extra.js | 2 +- nashorn/test/script/basic/es6/const-redeclare.js | 2 +- nashorn/test/script/basic/es6/let-redeclare-extra.js | 2 +- nashorn/test/script/basic/es6/let-redeclare.js | 2 +- nashorn/test/script/basic/es6/let_const_reuse.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nashorn/test/script/basic/es6/const-empty.js b/nashorn/test/script/basic/es6/const-empty.js index 0687aa2eb0f..c34d1d5119b 100644 --- a/nashorn/test/script/basic/es6/const-empty.js +++ b/nashorn/test/script/basic/es6/const-empty.js @@ -33,5 +33,5 @@ try { eval('"use strict";\n' + 'const x;\n'); } catch (e) { - print(e); + print(String(e).replace(/\\/g, "/")); } diff --git a/nashorn/test/script/basic/es6/const-redeclare-extra.js b/nashorn/test/script/basic/es6/const-redeclare-extra.js index 6d77e18e5ca..94fc53b2977 100644 --- a/nashorn/test/script/basic/es6/const-redeclare-extra.js +++ b/nashorn/test/script/basic/es6/const-redeclare-extra.js @@ -35,7 +35,7 @@ function tryIt (code) { try { eval(code) } catch (e) { - print(e) + print(String(e).replace(/\\/g, "/")) } } diff --git a/nashorn/test/script/basic/es6/const-redeclare.js b/nashorn/test/script/basic/es6/const-redeclare.js index 8e4aa7e448f..efe34ac2ef6 100644 --- a/nashorn/test/script/basic/es6/const-redeclare.js +++ b/nashorn/test/script/basic/es6/const-redeclare.js @@ -34,5 +34,5 @@ try { 'const x = 2;\n' + 'const x = 2;\n'); } catch (e) { - print(e); + print(String(e).replace(/\\/g, "/")); } diff --git a/nashorn/test/script/basic/es6/let-redeclare-extra.js b/nashorn/test/script/basic/es6/let-redeclare-extra.js index 630513f4ed3..ddb205e47f9 100644 --- a/nashorn/test/script/basic/es6/let-redeclare-extra.js +++ b/nashorn/test/script/basic/es6/let-redeclare-extra.js @@ -34,7 +34,7 @@ function tryIt (code) { try { eval(code) } catch (e) { - print(e) + print(String(e).replace(/\\/g, "/")) } } diff --git a/nashorn/test/script/basic/es6/let-redeclare.js b/nashorn/test/script/basic/es6/let-redeclare.js index b6ad0f0ae57..adc05196070 100644 --- a/nashorn/test/script/basic/es6/let-redeclare.js +++ b/nashorn/test/script/basic/es6/let-redeclare.js @@ -34,5 +34,5 @@ try { 'let x = 2;\n' + 'let x = 2;\n'); } catch (e) { - print(e); + print(String(e).replace(/\\/g, "/")); } diff --git a/nashorn/test/script/basic/es6/let_const_reuse.js b/nashorn/test/script/basic/es6/let_const_reuse.js index 556c23dc131..bc9e8f84930 100644 --- a/nashorn/test/script/basic/es6/let_const_reuse.js +++ b/nashorn/test/script/basic/es6/let_const_reuse.js @@ -34,7 +34,7 @@ function tryIt (code) { try { eval(code) } catch (e) { - print(e) + print(String(e).replace(/\\/g, "/")) } } From 9556b4137d94e6ce7eed8a316416b8c81019e180 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Tue, 23 Sep 2014 07:23:25 -0700 Subject: [PATCH 61/81] 8047933: Race between jdk/make/scripts/genExceptions.sh and com.sun.tools.javadoc.Main Reviewed-by: ihse, tbell --- make/Main.gmk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/make/Main.gmk b/make/Main.gmk index 230fec4140e..7dd1eaab7e7 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -382,6 +382,10 @@ else # header file used by jdk.jdwp libs. jdk.jdwp.agent-libs: jdk.jdi-gensrc + # The swing beans need to have java base properly generated to avoid errors + # in javadoc. + java.desktop-gensrc: java.base-gensrc + # Explicitly add dependencies for special targets java.base-java: unpack-sec From d6f69e8da5abf64e29cd5e608d9ba0b8ec8d615a Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Wed, 24 Sep 2014 11:55:27 +0200 Subject: [PATCH 62/81] 8058899: Put test 'java/lang/instrument/NativeMethodPrefixAgent.java' on ProblemList Reviewed-by: sla --- jdk/test/ProblemList.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index b664710bf43..e87acf9134a 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -122,6 +122,13 @@ ############################################################################ +# jdk_instrument + +# 8058536 +java/lang/instrument/NativeMethodPrefixAgent.java generic-all + +############################################################################ + # jdk_management # 8044591 From 2d52d7e64d7adb1e6f87779f4db25cbbea3c98d2 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Wed, 24 Sep 2014 11:55:36 +0200 Subject: [PATCH 63/81] 8057149: sun/management/jmxremote/startstop/JMXStartStopTest.java fails with "Starting agent on port ... should report port in use" Reviewed-by: sla --- .../jmxremote/startstop/JMXStartStopTest.java | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java index 6d142174f6b..bc755ac411e 100644 --- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java +++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java @@ -614,20 +614,34 @@ public class JMXStartStopTest { try (ServerSocket ss = new ServerSocket(0)) { busyPort = ss.getLocalPort(); - jcmd( - line -> { - boolean match = line.contains("Port already in use: " + - busyPort); - System.out.println("[match] " + line + " => " + match); - if (match) { - checks.getAndUpdate((op) -> op | 4); - } - }, - CMD_START, - "jmxremote.port=" + ss.getLocalPort(), - "jmxremote.rmi.port=" + pa.getPort2(), - "jmxremote.authenticate=false", - "jmxremote.ssl=false"); + int retryCntr = 1; + do { + final boolean[] retry = new boolean[]{false}; + jcmd( + line -> { + boolean match = line.contains("Port already in use: " + + busyPort); + System.out.println("[match] " + line + " => " + match); + if (match) { + checks.getAndUpdate((op) -> op | 4); + retry[0] = false; + } else if (line.contains("Exception thrown by the agent")) { + retry[0] = true; + } + }, + CMD_START, + "jmxremote.port=" + ss.getLocalPort(), + "jmxremote.rmi.port=" + pa.getPort2(), + "jmxremote.authenticate=false", + "jmxremote.ssl=false" + ); + if (!retry[0]) { + break; + } + System.out.println("Attempt " + retryCntr + " >>>"); + System.out.println("Unexpected reply from the agent. Retrying in 500ms ..."); + Thread.sleep(500); + } while (retryCntr++ < 10); } if ((checks.get() & 1) == 0) { throw new Exception("Starting agent on port " + pa.getPort1() + " should " + From f07521a354dbb5e2082c95f13fbfa962ffdcb17d Mon Sep 17 00:00:00 2001 From: Srinivasan Raghavan Date: Wed, 24 Sep 2014 14:19:25 +0400 Subject: [PATCH 64/81] 8058653: [TEST_BUG] Test java/awt/Graphics2D/DrawString/DrawStringCrash.java fails with OutOfMemoryError Reviewed-by: serb, prr --- jdk/test/java/awt/Graphics2D/DrawString/DrawStringCrash.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/test/java/awt/Graphics2D/DrawString/DrawStringCrash.java b/jdk/test/java/awt/Graphics2D/DrawString/DrawStringCrash.java index a1eeb6b1a20..de8a900b4e0 100644 --- a/jdk/test/java/awt/Graphics2D/DrawString/DrawStringCrash.java +++ b/jdk/test/java/awt/Graphics2D/DrawString/DrawStringCrash.java @@ -52,7 +52,7 @@ public class DrawStringCrash { Graphics2D g2d = bi.createGraphics(); while (len < maxLen) { try { - g2d.drawString(s, 20, 20); + g2d.drawString(sb.toString(), 20, 20); } catch (OutOfMemoryError e) { return; } From e3bda3bd0aa9213652221fb26b0128059e39b5eb Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Wed, 24 Sep 2014 09:43:10 -0700 Subject: [PATCH 65/81] 8058643: (str) Re-examine hashCode implementation Reviewed-by: martin, alanb, sherman, redestad --- jdk/src/java.base/share/classes/java/lang/String.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/lang/String.java b/jdk/src/java.base/share/classes/java/lang/String.java index 00f57044624..27c0ead5b10 100644 --- a/jdk/src/java.base/share/classes/java/lang/String.java +++ b/jdk/src/java.base/share/classes/java/lang/String.java @@ -1451,11 +1451,9 @@ public final class String */ public int hashCode() { int h = hash; - if (h == 0 && value.length > 0) { - char val[] = value; - - for (int i = 0; i < value.length; i++) { - h = 31 * h + val[i]; + if (h == 0) { + for (char v : value) { + h = 31 * h + v; } hash = h; } From 5d6a7146ba2e33439491063337f63aed1ac690f8 Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Thu, 25 Sep 2014 00:19:11 +0400 Subject: [PATCH 66/81] 8058099: (fc) Cleanup in FileChannel/FileDispatcher native implementation [win] Reviewed-by: alanb --- .../native/libnio/ch/FileChannelImpl.c | 25 +-- .../native/libnio/ch/FileDispatcherImpl.c | 164 ++++++++---------- 2 files changed, 88 insertions(+), 101 deletions(-) diff --git a/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c b/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c index 89215f2b581..0c03958aa33 100644 --- a/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c +++ b/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c @@ -140,24 +140,25 @@ JNIEXPORT jlong JNICALL Java_sun_nio_ch_FileChannelImpl_position0(JNIEnv *env, jobject this, jobject fdo, jlong offset) { - DWORD lowPos = 0; - long highPos = 0; + BOOL result = 0; HANDLE h = (HANDLE)(handleval(env, fdo)); + LARGE_INTEGER where; + DWORD whence; if (offset < 0) { - lowPos = SetFilePointer(h, 0, &highPos, FILE_CURRENT); + where.QuadPart = 0; + whence = FILE_CURRENT; } else { - lowPos = (DWORD)offset; - highPos = (long)(offset >> 32); - lowPos = SetFilePointer(h, lowPos, &highPos, FILE_BEGIN); + where.QuadPart = offset; + whence = FILE_BEGIN; } - if (lowPos == ((DWORD)-1)) { - if (GetLastError() != ERROR_SUCCESS) { - JNU_ThrowIOExceptionWithLastError(env, "Seek failed"); - return IOS_THROWN; - } + + result = SetFilePointerEx(h, where, &where, whence); + if (result == 0) { + JNU_ThrowIOExceptionWithLastError(env, "Seek failed"); + return IOS_THROWN; } - return (((jlong)highPos) << 32) | lowPos; + return (jlong)where.QuadPart; } JNIEXPORT void JNICALL diff --git a/jdk/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c b/jdk/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c index fcf0d04fbf8..e24d788cb39 100644 --- a/jdk/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c +++ b/jdk/src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c @@ -126,39 +126,30 @@ Java_sun_nio_ch_FileDispatcherImpl_pread0(JNIEnv *env, jclass clazz, jobject fdo DWORD read = 0; BOOL result = 0; HANDLE h = (HANDLE)(handleval(env, fdo)); - DWORD lowPos = 0; - long highPos = 0; - DWORD lowOffset = 0; - long highOffset = 0; + LARGE_INTEGER currPos; + OVERLAPPED ov; if (h == INVALID_HANDLE_VALUE) { JNU_ThrowIOExceptionWithLastError(env, "Invalid handle"); return IOS_THROWN; } - lowPos = SetFilePointer(h, 0, &highPos, FILE_CURRENT); - if (lowPos == ((DWORD)-1)) { - if (GetLastError() != ERROR_SUCCESS) { - JNU_ThrowIOExceptionWithLastError(env, "Seek failed"); - return IOS_THROWN; - } + currPos.QuadPart = 0; + result = SetFilePointerEx(h, currPos, &currPos, FILE_CURRENT); + if (result == 0) { + JNU_ThrowIOExceptionWithLastError(env, "Seek failed"); + return IOS_THROWN; } - lowOffset = (DWORD)offset; - highOffset = (DWORD)(offset >> 32); - lowOffset = SetFilePointer(h, lowOffset, &highOffset, FILE_BEGIN); - if (lowOffset == ((DWORD)-1)) { - if (GetLastError() != ERROR_SUCCESS) { - JNU_ThrowIOExceptionWithLastError(env, "Seek failed"); - return IOS_THROWN; - } - } + ZeroMemory(&ov, sizeof(ov)); + ov.Offset = (DWORD)offset; + ov.OffsetHigh = (DWORD)(offset >> 32); result = ReadFile(h, /* File handle to read */ (LPVOID)address, /* address to put data */ len, /* number of bytes to read */ &read, /* number of bytes read */ - NULL); /* struct with offset */ + &ov); /* position to read from */ if (result == 0) { int error = GetLastError(); @@ -168,17 +159,18 @@ Java_sun_nio_ch_FileDispatcherImpl_pread0(JNIEnv *env, jclass clazz, jobject fdo if (error == ERROR_NO_DATA) { return IOS_UNAVAILABLE; } - JNU_ThrowIOExceptionWithLastError(env, "Read failed"); - return IOS_THROWN; - } - - lowPos = SetFilePointer(h, lowPos, &highPos, FILE_BEGIN); - if (lowPos == ((DWORD)-1)) { - if (GetLastError() != ERROR_SUCCESS) { - JNU_ThrowIOExceptionWithLastError(env, "Seek failed"); + if (error != ERROR_HANDLE_EOF) { + JNU_ThrowIOExceptionWithLastError(env, "Read failed"); return IOS_THROWN; } } + + result = SetFilePointerEx(h, currPos, NULL, FILE_BEGIN); + if (result == 0) { + JNU_ThrowIOExceptionWithLastError(env, "Seek failed"); + return IOS_THROWN; + } + return convertReturnVal(env, (jint)read, JNI_TRUE); } @@ -194,18 +186,18 @@ Java_sun_nio_ch_FileDispatcherImpl_write0(JNIEnv *env, jclass clazz, jobject fdo OVERLAPPED ov; LPOVERLAPPED lpOv; if (append == JNI_TRUE) { + ZeroMemory(&ov, sizeof(ov)); ov.Offset = (DWORD)0xFFFFFFFF; ov.OffsetHigh = (DWORD)0xFFFFFFFF; - ov.hEvent = NULL; lpOv = &ov; } else { lpOv = NULL; } - result = WriteFile(h, /* File handle to write */ - (LPCVOID)address, /* pointers to the buffers */ - len, /* number of bytes to write */ - &written, /* receives number of bytes written */ - lpOv); /* overlapped struct */ + result = WriteFile(h, /* File handle to write */ + (LPCVOID)address, /* pointer to the buffer */ + len, /* number of bytes to write */ + &written, /* receives number of bytes written */ + lpOv); /* overlapped struct */ } if ((h == INVALID_HANDLE_VALUE) || (result == 0)) { @@ -232,9 +224,9 @@ Java_sun_nio_ch_FileDispatcherImpl_writev0(JNIEnv *env, jclass clazz, jobject fd OVERLAPPED ov; LPOVERLAPPED lpOv; if (append == JNI_TRUE) { + ZeroMemory(&ov, sizeof(ov)); ov.Offset = (DWORD)0xFFFFFFFF; ov.OffsetHigh = (DWORD)0xFFFFFFFF; - ov.hEvent = NULL; lpOv = &ov; } else { lpOv = NULL; @@ -270,46 +262,35 @@ Java_sun_nio_ch_FileDispatcherImpl_pwrite0(JNIEnv *env, jclass clazz, jobject fd BOOL result = 0; DWORD written = 0; HANDLE h = (HANDLE)(handleval(env, fdo)); - DWORD lowPos = 0; - long highPos = 0; - DWORD lowOffset = 0; - long highOffset = 0; + LARGE_INTEGER currPos; + OVERLAPPED ov; - lowPos = SetFilePointer(h, 0, &highPos, FILE_CURRENT); - if (lowPos == ((DWORD)-1)) { - if (GetLastError() != ERROR_SUCCESS) { - JNU_ThrowIOExceptionWithLastError(env, "Seek failed"); - return IOS_THROWN; - } + currPos.QuadPart = 0; + result = SetFilePointerEx(h, currPos, &currPos, FILE_CURRENT); + if (result == 0) { + JNU_ThrowIOExceptionWithLastError(env, "Seek failed"); + return IOS_THROWN; } - lowOffset = (DWORD)offset; - highOffset = (DWORD)(offset >> 32); - lowOffset = SetFilePointer(h, lowOffset, &highOffset, FILE_BEGIN); - if (lowOffset == ((DWORD)-1)) { - if (GetLastError() != ERROR_SUCCESS) { - JNU_ThrowIOExceptionWithLastError(env, "Seek failed"); - return IOS_THROWN; - } - } + ZeroMemory(&ov, sizeof(ov)); + ov.Offset = (DWORD)offset; + ov.OffsetHigh = (DWORD)(offset >> 32); - result = WriteFile(h, /* File handle to write */ - (LPCVOID)address, /* pointers to the buffers */ - len, /* number of bytes to write */ - &written, /* receives number of bytes written */ - NULL); /* no overlapped struct */ + result = WriteFile(h, /* File handle to write */ + (LPCVOID)address, /* pointer to the buffer */ + len, /* number of bytes to write */ + &written, /* receives number of bytes written */ + &ov); /* position to write at */ if ((h == INVALID_HANDLE_VALUE) || (result == 0)) { JNU_ThrowIOExceptionWithLastError(env, "Write failed"); return IOS_THROWN; } - lowPos = SetFilePointer(h, lowPos, &highPos, FILE_BEGIN); - if (lowPos == ((DWORD)-1)) { - if (GetLastError() != ERROR_SUCCESS) { - JNU_ThrowIOExceptionWithLastError(env, "Seek failed"); - return IOS_THROWN; - } + result = SetFilePointerEx(h, currPos, NULL, FILE_BEGIN); + if (result == 0) { + JNU_ThrowIOExceptionWithLastError(env, "Seek failed"); + return IOS_THROWN; } return convertReturnVal(env, (jint)written, JNI_FALSE); @@ -342,20 +323,17 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_FileDispatcherImpl_truncate0(JNIEnv *env, jobject this, jobject fdo, jlong size) { - DWORD lowPos = 0; - long highPos = 0; BOOL result = 0; HANDLE h = (HANDLE)(handleval(env, fdo)); + LARGE_INTEGER offset; - lowPos = (DWORD)size; - highPos = (long)(size >> 32); - lowPos = SetFilePointer(h, lowPos, &highPos, FILE_BEGIN); - if (lowPos == ((DWORD)-1)) { - if (GetLastError() != ERROR_SUCCESS) { - JNU_ThrowIOExceptionWithLastError(env, "Truncation failed"); - return IOS_THROWN; - } + offset.QuadPart = size; + result = SetFilePointerEx(h, offset, NULL, FILE_BEGIN); + if (result == 0) { + JNU_ThrowIOExceptionWithLastError(env, "Truncation failed"); + return IOS_THROWN; } + result = SetEndOfFile(h); if (result == 0) { JNU_ThrowIOExceptionWithLastError(env, "Truncation failed"); @@ -367,18 +345,16 @@ Java_sun_nio_ch_FileDispatcherImpl_truncate0(JNIEnv *env, jobject this, JNIEXPORT jlong JNICALL Java_sun_nio_ch_FileDispatcherImpl_size0(JNIEnv *env, jobject this, jobject fdo) { - DWORD sizeLow = 0; - DWORD sizeHigh = 0; + BOOL result = 0; HANDLE h = (HANDLE)(handleval(env, fdo)); + LARGE_INTEGER size; - sizeLow = GetFileSize(h, &sizeHigh); - if (sizeLow == ((DWORD)-1)) { - if (GetLastError() != ERROR_SUCCESS) { - JNU_ThrowIOExceptionWithLastError(env, "Size failed"); - return IOS_THROWN; - } + result = GetFileSizeEx(h, &size); + if (result == 0) { + JNU_ThrowIOExceptionWithLastError(env, "Size failed"); + return IOS_THROWN; } - return (((jlong)sizeHigh) << 32) | sizeLow; + return (jlong)size.QuadPart; } JNIEXPORT jint JNICALL @@ -407,7 +383,7 @@ Java_sun_nio_ch_FileDispatcherImpl_lock0(JNIEnv *env, jobject this, jobject fdo, if (result == 0) { int error = GetLastError(); if (error == ERROR_IO_PENDING) { - LPDWORD dwBytes; + DWORD dwBytes; result = GetOverlappedResult(h, &o, &dwBytes, TRUE); if (result != 0) { return sun_nio_ch_FileDispatcherImpl_LOCKED; @@ -442,8 +418,19 @@ Java_sun_nio_ch_FileDispatcherImpl_release0(JNIEnv *env, jobject this, o.Offset = lowPos; o.OffsetHigh = highPos; result = UnlockFileEx(h, 0, lowNumBytes, highNumBytes, &o); - if (result == 0 && GetLastError() != ERROR_NOT_LOCKED) { - JNU_ThrowIOExceptionWithLastError(env, "Release failed"); + if (result == 0) { + int error = GetLastError(); + if (error == ERROR_IO_PENDING) { + DWORD dwBytes; + result = GetOverlappedResult(h, &o, &dwBytes, TRUE); + if (result == 0) { + return; + } + error = GetLastError(); + } + if (error != ERROR_NOT_LOCKED) { + JNU_ThrowIOExceptionWithLastError(env, "Release failed"); + } } } @@ -464,8 +451,7 @@ Java_sun_nio_ch_FileDispatcherImpl_close0(JNIEnv *env, jclass clazz, jobject fdo } JNIEXPORT void JNICALL -Java_sun_nio_ch_FileDispatcherImpl_closeByHandle(JNIEnv *env, jclass clazz, - jlong fd) +Java_sun_nio_ch_FileDispatcherImpl_closeByHandle(JNIEnv *env, jclass clazz, jlong fd) { closeFile(env, fd); } From c0f7675bb7389039314606e061c5a503102df9a8 Mon Sep 17 00:00:00 2001 From: Brent Christian Date: Wed, 24 Sep 2014 15:02:19 -0700 Subject: [PATCH 67/81] 8050142: Optimize java.util.Formatter Reviewed-by: sherman, bchristi, lagergren --- .../share/classes/java/util/Formatter.java | 464 +++++++++--------- 1 file changed, 219 insertions(+), 245 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/Formatter.java b/jdk/src/java.base/share/classes/java/util/Formatter.java index 60671646a5d..a12952bde02 100644 --- a/jdk/src/java.base/share/classes/java/util/Formatter.java +++ b/jdk/src/java.base/share/classes/java/util/Formatter.java @@ -2498,7 +2498,7 @@ public final class Formatter implements Closeable, Flushable { // last ordinary index int lasto = -1; - FormatString[] fsa = parse(format); + List fsa = parse(format); for (FormatString fs : fsa) { int index = fs.index(); try { @@ -2541,7 +2541,7 @@ public final class Formatter implements Closeable, Flushable { /** * Finds format specifiers in the format string. */ - private FormatString[] parse(String s) { + private List parse(String s) { ArrayList al = new ArrayList<>(); Matcher m = fsPattern.matcher(s); for (int i = 0, len = s.length(); i < len; ) { @@ -2553,21 +2553,21 @@ public final class Formatter implements Closeable, Flushable { // Make sure we didn't miss any invalid format specifiers checkText(s, i, m.start()); // Assume previous characters were fixed text - al.add(new FixedString(s.substring(i, m.start()))); + al.add(new FixedString(s, i, m.start())); } - al.add(new FormatSpecifier(m)); + al.add(new FormatSpecifier(s, m)); i = m.end(); } else { // No more valid format specifiers. Check for possible invalid // format specifiers. checkText(s, i, len); // The rest of the string is fixed text - al.add(new FixedString(s.substring(i))); + al.add(new FixedString(s, i, s.length())); break; } } - return al.toArray(new FormatString[al.size()]); + return al; } private static void checkText(String s, int start, int end) { @@ -2588,11 +2588,17 @@ public final class Formatter implements Closeable, Flushable { private class FixedString implements FormatString { private String s; - FixedString(String s) { this.s = s; } + private int start; + private int end; + FixedString(String s, int start, int end) { + this.s = s; + this.start = start; + this.end = end; + } public int index() { return -2; } public void print(Object arg, Locale l) - throws IOException { a.append(s); } - public String toString() { return s; } + throws IOException { a.append(s, start, end); } + public String toString() { return s.substring(start, end); } } /** @@ -2635,17 +2641,13 @@ public final class Formatter implements Closeable, Flushable { return index; } - private Flags flags(String s) { - f = Flags.parse(s); + private Flags flags(String s, int start, int end) { + f = Flags.parse(s, start, end); if (f.contains(Flags.PREVIOUS)) index = -1; return f; } - Flags flags() { - return f; - } - private int width(String s) { width = -1; if (s != null) { @@ -2660,10 +2662,6 @@ public final class Formatter implements Closeable, Flushable { return width; } - int width() { - return width; - } - private int precision(String s) { precision = -1; if (s != null) { @@ -2679,44 +2677,41 @@ public final class Formatter implements Closeable, Flushable { return precision; } - int precision() { - return precision; - } - - private char conversion(String s) { - c = s.charAt(0); + private char conversion(char conv) { + c = conv; if (!dt) { - if (!Conversion.isValid(c)) + if (!Conversion.isValid(c)) { throw new UnknownFormatConversionException(String.valueOf(c)); - if (Character.isUpperCase(c)) + } + if (Character.isUpperCase(c)) { f.add(Flags.UPPERCASE); - c = Character.toLowerCase(c); - if (Conversion.isText(c)) + c = Character.toLowerCase(c); + } + if (Conversion.isText(c)) { index = -2; + } } return c; } - private char conversion() { - return c; - } - - FormatSpecifier(Matcher m) { + FormatSpecifier(String s, Matcher m) { int idx = 1; index(m.group(idx++)); - flags(m.group(idx++)); + flags(s, m.start(idx), m.end(idx++)); width(m.group(idx++)); precision(m.group(idx++)); - String tT = m.group(idx++); - if (tT != null) { + int tTStart = m.start(idx); + int tTEnd = m.end(idx++); + if (tTStart != -1 && tTEnd != -1) { dt = true; - if (tT.equals("T")) + if (tTStart == tTEnd - 1 && s.charAt(tTStart) == 'T') { f.add(Flags.UPPERCASE); + } } - conversion(m.group(idx)); + conversion(s.charAt(m.start(idx))); if (dt) checkDateTime(); @@ -2909,21 +2904,25 @@ public final class Formatter implements Closeable, Flushable { s = s.substring(0, precision); if (f.contains(Flags.UPPERCASE)) s = s.toUpperCase(); - a.append(justify(s)); + appendJustified(a, s); } - private String justify(String s) { - if (width == -1) - return s; - StringBuilder sb = new StringBuilder(); - boolean pad = f.contains(Flags.LEFT_JUSTIFY); - int sp = width - s.length(); - if (!pad) - for (int i = 0; i < sp; i++) sb.append(' '); - sb.append(s); - if (pad) - for (int i = 0; i < sp; i++) sb.append(' '); - return sb.toString(); + private Appendable appendJustified(Appendable a, CharSequence cs) throws IOException { + if (width == -1) { + return a.append(cs); + } + boolean padRight = f.contains(Flags.LEFT_JUSTIFY); + int sp = width - cs.length(); + if (padRight) { + a.append(cs); + } + for (int i = 0; i < sp; i++) { + a.append(' '); + } + if (!padRight) { + a.append(cs); + } + return a; } public String toString() { @@ -3088,17 +3087,13 @@ public final class Formatter implements Closeable, Flushable { if (c == Conversion.DECIMAL_INTEGER) { boolean neg = value < 0; - char[] va; - if (value < 0) - va = Long.toString(value, 10).substring(1).toCharArray(); - else - va = Long.toString(value, 10).toCharArray(); + String valueStr = Long.toString(value, 10); // leading sign indicator leadingSign(sb, neg); // the value - localizedMagnitude(sb, va, f, adjustWidth(width, f, neg), l); + localizedMagnitude(sb, valueStr, neg ? 1 : 0, f, adjustWidth(width, f, neg), l); // trailing sign indicator trailingSign(sb, neg); @@ -3113,8 +3108,9 @@ public final class Formatter implements Closeable, Flushable { // apply ALTERNATE (radix indicator for octal) before ZERO_PAD if (f.contains(Flags.ALTERNATE)) sb.append('0'); - if (f.contains(Flags.ZERO_PAD)) - for (int i = 0; i < width - len; i++) sb.append('0'); + if (f.contains(Flags.ZERO_PAD)) { + trailingZeros(sb, width - len); + } sb.append(s); } else if (c == Conversion.HEXADECIMAL_INTEGER) { checkBadFlags(Flags.PARENTHESES, Flags.LEADING_SPACE, @@ -3127,15 +3123,16 @@ public final class Formatter implements Closeable, Flushable { // apply ALTERNATE (radix indicator for hex) before ZERO_PAD if (f.contains(Flags.ALTERNATE)) sb.append(f.contains(Flags.UPPERCASE) ? "0X" : "0x"); - if (f.contains(Flags.ZERO_PAD)) - for (int i = 0; i < width - len; i++) sb.append('0'); + if (f.contains(Flags.ZERO_PAD)) { + trailingZeros(sb, width - len); + } if (f.contains(Flags.UPPERCASE)) s = s.toUpperCase(); sb.append(s); } // justify based on width - a.append(justify(sb.toString())); + appendJustified(a, sb); } // neg := val < 0 @@ -3172,8 +3169,7 @@ public final class Formatter implements Closeable, Flushable { // the value if (c == Conversion.DECIMAL_INTEGER) { - char[] va = v.toString().toCharArray(); - localizedMagnitude(sb, va, f, adjustWidth(width, f, neg), l); + localizedMagnitude(sb, v.toString(), 0, f, adjustWidth(width, f, neg), l); } else if (c == Conversion.OCTAL_INTEGER) { String s = v.toString(8); @@ -3187,8 +3183,7 @@ public final class Formatter implements Closeable, Flushable { sb.append('0'); } if (f.contains(Flags.ZERO_PAD)) { - for (int i = 0; i < width - len; i++) - sb.append('0'); + trailingZeros(sb, width - len); } sb.append(s); } else if (c == Conversion.HEXADECIMAL_INTEGER) { @@ -3203,9 +3198,9 @@ public final class Formatter implements Closeable, Flushable { len += 2; sb.append(f.contains(Flags.UPPERCASE) ? "0X" : "0x"); } - if (f.contains(Flags.ZERO_PAD)) - for (int i = 0; i < width - len; i++) - sb.append('0'); + if (f.contains(Flags.ZERO_PAD)) { + trailingZeros(sb, width - len); + } if (f.contains(Flags.UPPERCASE)) s = s.toUpperCase(); sb.append(s); @@ -3215,7 +3210,7 @@ public final class Formatter implements Closeable, Flushable { trailingSign(sb, (value.signum() == -1)); // justify based on width - a.append(justify(sb.toString())); + appendJustified(a, sb); } private void print(float value, Locale l) throws IOException { @@ -3246,7 +3241,7 @@ public final class Formatter implements Closeable, Flushable { } // justify based on width - a.append(justify(sb.toString())); + appendJustified(a, sb); } // !Double.isInfinite(value) && !Double.isNaN(value) @@ -3263,31 +3258,31 @@ public final class Formatter implements Closeable, Flushable { = FormattedFloatingDecimal.valueOf(value, prec, FormattedFloatingDecimal.Form.SCIENTIFIC); - char[] mant = addZeros(fd.getMantissa(), prec); + StringBuilder mant = new StringBuilder().append(fd.getMantissa()); + addZeros(mant, prec); // If the precision is zero and the '#' flag is set, add the // requested decimal point. - if (f.contains(Flags.ALTERNATE) && (prec == 0)) - mant = addDot(mant); + if (f.contains(Flags.ALTERNATE) && (prec == 0)) { + mant.append('.'); + } char[] exp = (value == 0.0) ? new char[] {'+','0','0'} : fd.getExponent(); int newW = width; - if (width != -1) + if (width != -1) { newW = adjustWidth(width - exp.length - 1, f, neg); - localizedMagnitude(sb, mant, f, newW, l); + } + localizedMagnitude(sb, mant, 0, f, newW, l); sb.append(f.contains(Flags.UPPERCASE) ? 'E' : 'e'); - Flags flags = f.dup().remove(Flags.GROUP); char sign = exp[0]; assert(sign == '+' || sign == '-'); sb.append(sign); - char[] tmp = new char[exp.length - 1]; - System.arraycopy(exp, 1, tmp, 0, exp.length - 1); - sb.append(localizedMagnitude(null, tmp, flags, -1, l)); + localizedMagnitudeExp(sb, exp, 1, l); } else if (c == Conversion.DECIMAL_FLOAT) { // Create a new FormattedFloatingDecimal with the desired // precision. @@ -3297,17 +3292,18 @@ public final class Formatter implements Closeable, Flushable { = FormattedFloatingDecimal.valueOf(value, prec, FormattedFloatingDecimal.Form.DECIMAL_FLOAT); - char[] mant = addZeros(fd.getMantissa(), prec); + StringBuilder mant = new StringBuilder().append(fd.getMantissa()); + addZeros(mant, prec); // If the precision is zero and the '#' flag is set, add the // requested decimal point. if (f.contains(Flags.ALTERNATE) && (prec == 0)) - mant = addDot(mant); + mant.append('.'); int newW = width; if (width != -1) newW = adjustWidth(width, f, neg); - localizedMagnitude(sb, mant, f, newW, l); + localizedMagnitude(sb, mant, 0, f, newW, l); } else if (c == Conversion.GENERAL) { int prec = precision; if (precision == -1) @@ -3316,18 +3312,18 @@ public final class Formatter implements Closeable, Flushable { prec = 1; char[] exp; - char[] mant; + StringBuilder mant = new StringBuilder(); int expRounded; if (value == 0.0) { exp = null; - mant = new char[] {'0'}; + mant.append('0'); expRounded = 0; } else { FormattedFloatingDecimal fd = FormattedFloatingDecimal.valueOf(value, prec, FormattedFloatingDecimal.Form.GENERAL); exp = fd.getExponent(); - mant = fd.getMantissa(); + mant.append(fd.getMantissa()); expRounded = fd.getExponentRounded(); } @@ -3337,11 +3333,12 @@ public final class Formatter implements Closeable, Flushable { prec -= expRounded + 1; } - mant = addZeros(mant, prec); + addZeros(mant, prec); // If the precision is zero and the '#' flag is set, add the // requested decimal point. - if (f.contains(Flags.ALTERNATE) && (prec == 0)) - mant = addDot(mant); + if (f.contains(Flags.ALTERNATE) && (prec == 0)) { + mant.append('.'); + } int newW = width; if (width != -1) { @@ -3350,19 +3347,16 @@ public final class Formatter implements Closeable, Flushable { else newW = adjustWidth(width, f, neg); } - localizedMagnitude(sb, mant, f, newW, l); + localizedMagnitude(sb, mant, 0, f, newW, l); if (exp != null) { sb.append(f.contains(Flags.UPPERCASE) ? 'E' : 'e'); - Flags flags = f.dup().remove(Flags.GROUP); char sign = exp[0]; assert(sign == '+' || sign == '-'); sb.append(sign); - char[] tmp = new char[exp.length - 1]; - System.arraycopy(exp, 1, tmp, 0, exp.length - 1); - sb.append(localizedMagnitude(null, tmp, flags, -1, l)); + localizedMagnitudeExp(sb, exp, 1, l); } } else if (c == Conversion.HEXADECIMAL_FLOAT) { int prec = precision; @@ -3374,74 +3368,71 @@ public final class Formatter implements Closeable, Flushable { String s = hexDouble(value, prec); - char[] va; + StringBuilder va = new StringBuilder(); boolean upper = f.contains(Flags.UPPERCASE); sb.append(upper ? "0X" : "0x"); - if (f.contains(Flags.ZERO_PAD)) - for (int i = 0; i < width - s.length() - 2; i++) - sb.append('0'); + if (f.contains(Flags.ZERO_PAD)) { + trailingZeros(sb, width - s.length() - 2); + } int idx = s.indexOf('p'); - va = s.substring(0, idx).toCharArray(); if (upper) { - String tmp = new String(va); + String tmp = s.substring(0, idx); // don't localize hex tmp = tmp.toUpperCase(Locale.US); - va = tmp.toCharArray(); + va.append(tmp); + } else { + va.append(s, 0, idx); } - sb.append(prec != 0 ? addZeros(va, prec) : va); + if (prec != 0) { + addZeros(va, prec); + } + sb.append(va); sb.append(upper ? 'P' : 'p'); - sb.append(s.substring(idx+1)); + sb.append(s, idx+1, s.length()); } } // Add zeros to the requested precision. - private char[] addZeros(char[] v, int prec) { + private void addZeros(StringBuilder sb, int prec) { // Look for the dot. If we don't find one, the we'll need to add // it before we add the zeros. + int len = sb.length(); int i; - for (i = 0; i < v.length; i++) { - if (v[i] == '.') + for (i = 0; i < len; i++) { + if (sb.charAt(i) == '.') { break; + } } boolean needDot = false; - if (i == v.length) { + if (i == len) { needDot = true; } // Determine existing precision. - int outPrec = v.length - i - (needDot ? 0 : 1); + int outPrec = len - i - (needDot ? 0 : 1); assert (outPrec <= prec); - if (outPrec == prec) - return v; - - // Create new array with existing contents. - char[] tmp - = new char[v.length + prec - outPrec + (needDot ? 1 : 0)]; - System.arraycopy(v, 0, tmp, 0, v.length); + if (outPrec == prec) { + return; + } // Add dot if previously determined to be necessary. - int start = v.length; if (needDot) { - tmp[v.length] = '.'; - start++; + sb.append('.'); } // Add zeros. - for (int j = start; j < tmp.length; j++) - tmp[j] = '0'; - - return tmp; + trailingZeros(sb, prec - outPrec); } // Method assumes that d > 0. private String hexDouble(double d, int prec) { // Let Double.toHexString handle simple cases - if(!Double.isFinite(d) || d == 0.0 || prec == 0 || prec >= 13) + if (!Double.isFinite(d) || d == 0.0 || prec == 0 || prec >= 13) { // remove "0x" return Double.toHexString(d).substring(2); - else { + } else { assert(prec >= 1 && prec <= 12); int exponent = Math.getExponent(d); @@ -3534,7 +3525,7 @@ public final class Formatter implements Closeable, Flushable { trailingSign(sb, neg); // justify based on width - a.append(justify(sb.toString())); + appendJustified(a, sb); } // value > 0 @@ -3565,7 +3556,7 @@ public final class Formatter implements Closeable, Flushable { = new BigDecimalLayout(v.unscaledValue(), v.scale(), BigDecimalLayoutForm.SCIENTIFIC); - char[] mant = bdl.mantissa(); + StringBuilder mant = bdl.mantissa(); // Add a decimal point if necessary. The mantissa may not // contain a decimal point if the scale is zero (the internal @@ -3573,29 +3564,29 @@ public final class Formatter implements Closeable, Flushable { // precision is one. Append a decimal point if '#' is set or if // we require zero padding to get to the requested precision. if ((origPrec == 1 || !bdl.hasDot()) - && (nzeros > 0 || (f.contains(Flags.ALTERNATE)))) - mant = addDot(mant); + && (nzeros > 0 || (f.contains(Flags.ALTERNATE)))) { + mant.append('.'); + } // Add trailing zeros in the case precision is greater than // the number of available digits after the decimal separator. - mant = trailingZeros(mant, nzeros); + trailingZeros(mant, nzeros); - char[] exp = bdl.exponent(); + StringBuilder exp = bdl.exponent(); int newW = width; - if (width != -1) - newW = adjustWidth(width - exp.length - 1, f, neg); - localizedMagnitude(sb, mant, f, newW, l); + if (width != -1) { + newW = adjustWidth(width - exp.length() - 1, f, neg); + } + localizedMagnitude(sb, mant, 0, f, newW, l); sb.append(f.contains(Flags.UPPERCASE) ? 'E' : 'e'); Flags flags = f.dup().remove(Flags.GROUP); - char sign = exp[0]; + char sign = exp.charAt(0); assert(sign == '+' || sign == '-'); - sb.append(exp[0]); + sb.append(sign); - char[] tmp = new char[exp.length - 1]; - System.arraycopy(exp, 1, tmp, 0, exp.length - 1); - sb.append(localizedMagnitude(null, tmp, flags, -1, l)); + sb.append(localizedMagnitude(null, exp, 1, flags, -1, l)); } else if (c == Conversion.DECIMAL_FLOAT) { // Create a new BigDecimal with the desired precision. int prec = (precision == -1 ? 6 : precision); @@ -3619,7 +3610,7 @@ public final class Formatter implements Closeable, Flushable { value.scale(), BigDecimalLayoutForm.DECIMAL_FLOAT); - char mant[] = bdl.mantissa(); + StringBuilder mant = bdl.mantissa(); int nzeros = (bdl.scale() < prec ? prec - bdl.scale() : 0); // Add a decimal point if necessary. The mantissa may not @@ -3627,14 +3618,16 @@ public final class Formatter implements Closeable, Flushable { // representation has no fractional part). Append a decimal // point if '#' is set or we require zero padding to get to the // requested precision. - if (bdl.scale() == 0 && (f.contains(Flags.ALTERNATE) || nzeros > 0)) - mant = addDot(bdl.mantissa()); + if (bdl.scale() == 0 && (f.contains(Flags.ALTERNATE) + || nzeros > 0)) { + mant.append('.'); + } // Add trailing zeros if the precision is greater than the // number of available digits after the decimal separator. - mant = trailingZeros(mant, nzeros); + trailingZeros(mant, nzeros); - localizedMagnitude(sb, mant, f, adjustWidth(width, f, neg), l); + localizedMagnitude(sb, mant, 0, f, adjustWidth(width, f, neg), l); } else if (c == Conversion.GENERAL) { int prec = precision; if (precision == -1) @@ -3693,36 +3686,18 @@ public final class Formatter implements Closeable, Flushable { return scale; } - // char[] with canonical string representation - public char[] layoutChars() { - StringBuilder sb = new StringBuilder(mant); - if (exp != null) { - sb.append('E'); - sb.append(exp); - } - return toCharArray(sb); - } - - public char[] mantissa() { - return toCharArray(mant); + public StringBuilder mantissa() { + return mant; } // The exponent will be formatted as a sign ('+' or '-') followed // by the exponent zero-padded to include at least two digits. - public char[] exponent() { - return toCharArray(exp); - } - - private char[] toCharArray(StringBuilder sb) { - if (sb == null) - return null; - char[] result = new char[sb.length()]; - sb.getChars(0, result.length, result, 0); - return result; + public StringBuilder exponent() { + return exp; } private void layout(BigInteger intVal, int scale, BigDecimalLayoutForm form) { - char coeff[] = intVal.toString().toCharArray(); + String coeff = intVal.toString(); this.scale = scale; // Construct a buffer, with sufficient capacity for all cases. @@ -3730,71 +3705,73 @@ public final class Formatter implements Closeable, Flushable { // if '.' needed, +2 for "E+", + up to 10 for adjusted // exponent. Otherwise it could have +1 if negative, plus // leading "0.00000" - mant = new StringBuilder(coeff.length + 14); + int len = coeff.length(); + mant = new StringBuilder(len + 14); if (scale == 0) { - int len = coeff.length; if (len > 1) { - mant.append(coeff[0]); + mant.append(coeff.charAt(0)); if (form == BigDecimalLayoutForm.SCIENTIFIC) { mant.append('.'); dot = true; - mant.append(coeff, 1, len - 1); + mant.append(coeff, 1, len); exp = new StringBuilder("+"); - if (len < 10) - exp.append("0").append(len - 1); - else + if (len < 10) { + exp.append('0').append(len - 1); + } else { exp.append(len - 1); + } } else { - mant.append(coeff, 1, len - 1); + mant.append(coeff, 1, len); } } else { mant.append(coeff); - if (form == BigDecimalLayoutForm.SCIENTIFIC) + if (form == BigDecimalLayoutForm.SCIENTIFIC) { exp = new StringBuilder("+00"); + } } return; } - long adjusted = -(long) scale + (coeff.length - 1); + long adjusted = -(long) scale + (len - 1); if (form == BigDecimalLayoutForm.DECIMAL_FLOAT) { // count of padding zeros - int pad = scale - coeff.length; + int pad = scale - len; if (pad >= 0) { // 0.xxx form mant.append("0."); dot = true; - for (; pad > 0 ; pad--) mant.append('0'); + trailingZeros(mant, pad); mant.append(coeff); } else { - if (-pad < coeff.length) { + if (-pad < len) { // xx.xx form mant.append(coeff, 0, -pad); mant.append('.'); dot = true; - mant.append(coeff, -pad, scale); + mant.append(coeff, -pad, -pad + scale); } else { // xx form - mant.append(coeff, 0, coeff.length); - for (int i = 0; i < -scale; i++) - mant.append('0'); + mant.append(coeff, 0, len); + trailingZeros(mant, -scale); this.scale = 0; } } } else { // x.xxx form - mant.append(coeff[0]); - if (coeff.length > 1) { + mant.append(coeff.charAt(0)); + if (len > 1) { mant.append('.'); dot = true; - mant.append(coeff, 1, coeff.length-1); + mant.append(coeff, 1, len); } exp = new StringBuilder(); if (adjusted != 0) { long abs = Math.abs(adjusted); // require sign exp.append(adjusted < 0 ? '-' : '+'); - if (abs < 10) + if (abs < 10) { exp.append('0'); + } exp.append(abs); } else { exp.append("+00"); @@ -3810,45 +3787,27 @@ public final class Formatter implements Closeable, Flushable { return newW; } - // Add a '.' to th mantissa if required - private char[] addDot(char[] mant) { - char[] tmp = mant; - tmp = new char[mant.length + 1]; - System.arraycopy(mant, 0, tmp, 0, mant.length); - tmp[tmp.length - 1] = '.'; - return tmp; - } - - // Add trailing zeros in the case precision is greater than the number - // of available digits after the decimal separator. - private char[] trailingZeros(char[] mant, int nzeros) { - char[] tmp = mant; - if (nzeros > 0) { - tmp = new char[mant.length + nzeros]; - System.arraycopy(mant, 0, tmp, 0, mant.length); - for (int i = mant.length; i < tmp.length; i++) - tmp[i] = '0'; + // Add trailing zeros + private void trailingZeros(StringBuilder sb, int nzeros) { + for (int i = 0; i < nzeros; i++) { + sb.append('0'); } - return tmp; } - private void print(Calendar t, char c, Locale l) throws IOException - { + private void print(Calendar t, char c, Locale l) throws IOException { StringBuilder sb = new StringBuilder(); print(sb, t, c, l); // justify based on width - String s = justify(sb.toString()); - if (f.contains(Flags.UPPERCASE)) - s = s.toUpperCase(); - - a.append(s); + if (f.contains(Flags.UPPERCASE)) { + appendJustified(a, sb.toString().toUpperCase()); + } else { + appendJustified(a, sb); + } } - private Appendable print(StringBuilder sb, Calendar t, char c, - Locale l) - throws IOException - { + private Appendable print(StringBuilder sb, Calendar t, char c, Locale l) + throws IOException { if (sb == null) sb = new StringBuilder(); switch (c) { @@ -4021,6 +3980,7 @@ public final class Formatter implements Closeable, Flushable { // this may be in wrong place for some locales StringBuilder tsb = new StringBuilder(); print(tsb, t, DateTime.AM_PM, l); + sb.append(tsb.toString().toUpperCase(l != null ? l : Locale.US)); break; } @@ -4058,10 +4018,11 @@ public final class Formatter implements Closeable, Flushable { StringBuilder sb = new StringBuilder(); print(sb, t, c, l); // justify based on width - String s = justify(sb.toString()); - if (f.contains(Flags.UPPERCASE)) - s = s.toUpperCase(); - a.append(s); + if (f.contains(Flags.UPPERCASE)) { + appendJustified(a, sb.toString().toUpperCase()); + } else { + appendJustified(a, sb); + } } private Appendable print(StringBuilder sb, TemporalAccessor t, char c, @@ -4309,20 +4270,17 @@ public final class Formatter implements Closeable, Flushable { return zero; } - private StringBuilder - localizedMagnitude(StringBuilder sb, long value, Flags f, - int width, Locale l) - { - char[] va = Long.toString(value, 10).toCharArray(); - return localizedMagnitude(sb, va, f, width, l); + private StringBuilder localizedMagnitude(StringBuilder sb, + long value, Flags f, int width, Locale l) { + return localizedMagnitude(sb, Long.toString(value, 10), 0, f, width, l); } - private StringBuilder - localizedMagnitude(StringBuilder sb, char[] value, Flags f, - int width, Locale l) - { - if (sb == null) + private StringBuilder localizedMagnitude(StringBuilder sb, + CharSequence value, final int offset, Flags f, int width, + Locale l) { + if (sb == null) { sb = new StringBuilder(); + } int begin = sb.length(); char zero = getZero(l); @@ -4332,10 +4290,10 @@ public final class Formatter implements Closeable, Flushable { int grpSize = -1; char decSep = '\0'; - int len = value.length; + int len = value.length(); int dot = len; - for (int j = 0; j < len; j++) { - if (value[j] == '.') { + for (int j = offset; j < len; j++) { + if (value.charAt(j) == '.') { dot = j; break; } @@ -4363,7 +4321,7 @@ public final class Formatter implements Closeable, Flushable { } // localize the digits inserting group separators as necessary - for (int j = 0; j < len; j++) { + for (int j = offset; j < len; j++) { if (j == dot) { sb.append(decSep); // no more group separators after the decimal separator @@ -4371,20 +4329,36 @@ public final class Formatter implements Closeable, Flushable { continue; } - char c = value[j]; + char c = value.charAt(j); sb.append((char) ((c - '0') + zero)); - if (grpSep != '\0' && j != dot - 1 && ((dot - j) % grpSize == 1)) + if (grpSep != '\0' && j != dot - 1 && ((dot - j) % grpSize == 1)) { sb.append(grpSep); + } } // apply zero padding - len = sb.length(); - if (width != -1 && f.contains(Flags.ZERO_PAD)) - for (int k = 0; k < width - len; k++) + if (width != -1 && f.contains(Flags.ZERO_PAD)) { + for (int k = sb.length(); k < width; k++) { sb.insert(begin, zero); + } + } return sb; } + + // Specialized localization of exponents, where the source value can only + // contain characters '0' through '9', starting at index offset, and no + // group separators is added for any locale. + private void localizedMagnitudeExp(StringBuilder sb, char[] value, + final int offset, Locale l) { + char zero = getZero(l); + + int len = value.length; + for (int j = offset; j < len; j++) { + char c = value[j]; + sb.append((char) ((c - '0') + zero)); + } + } } private static class Flags { @@ -4433,10 +4407,10 @@ public final class Formatter implements Closeable, Flushable { return this; } - public static Flags parse(String s) { - char[] ca = s.toCharArray(); + public static Flags parse(String s, int start, int end) { Flags f = new Flags(0); - for (char c : ca) { + for (int i = start; i < end; i++) { + char c = s.charAt(i); Flags v = parse(c); if (f.contains(v)) throw new DuplicateFormatFlagsException(v.toString()); From f5a79eeb0cf7b4d2a609318c79762b48958843de Mon Sep 17 00:00:00 2001 From: Miroslav Kos Date: Thu, 25 Sep 2014 10:02:12 +0200 Subject: [PATCH 68/81] 8038966: JAX-WS handles wrongly xsd:any arguments for Web services Reviewed-by: coffeys --- .../v2/runtime/ContentHandlerAdaptor.java | 22 +++++++++---------- .../unmarshaller/StAXStreamConnector.java | 14 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java index 819872f6d33..7b7081d365f 100644 --- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java +++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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,10 +25,6 @@ package com.sun.xml.internal.bind.v2.runtime; -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - import com.sun.istack.internal.FinalArrayList; import com.sun.istack.internal.SAXException2; @@ -36,6 +32,9 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; +import javax.xml.stream.XMLStreamException; +import java.io.IOException; + /** * Receives SAX2 events and send the equivalent events to * {@link XMLSerializer} @@ -70,14 +69,14 @@ final class ContentHandlerAdaptor extends DefaultHandler { private boolean containsPrefixMapping(String prefix, String uri) { for( int i=0; i Date: Thu, 25 Sep 2014 12:51:43 +0200 Subject: [PATCH 69/81] 8059034: ProcessTools.startProcess() might leak processes Reviewed-by: sla, miauno --- jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java index 1610fec9f08..8935d967f5d 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java @@ -36,12 +36,10 @@ import java.util.concurrent.CountDownLatch; import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; -import java.util.concurrent.Phaser; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.function.Predicate; import java.util.function.Consumer; -import java.util.stream.Collector; import java.util.stream.Collectors; import sun.management.VMManagement; @@ -177,6 +175,11 @@ public final class ProcessTools { for(Map.Entry s : Thread.getAllStackTraces().entrySet()) { printStack(s.getKey(), s.getValue()); } + + if (p.isAlive()) { + p.destroyForcibly(); + } + stdoutTask.cancel(true); stderrTask.cancel(true); throw e; From 0a17643e73c578500dbd5699918204757194112e Mon Sep 17 00:00:00 2001 From: Miroslav Kos Date: Thu, 25 Sep 2014 13:03:27 +0200 Subject: [PATCH 70/81] 8038966: JAX-WS handles wrongly xsd:any arguments for Web services Reviewed-by: coffeys --- .../xml/ws/xsanymixed/CopyingResponse.java | 35 ++++ .../javax/xml/ws/xsanymixed/ServiceImpl.java | 51 +++++ jdk/test/javax/xml/ws/xsanymixed/Test.java | 197 ++++++++++++++++++ .../javax/xml/ws/xsanymixed/compile-wsdl.sh | 36 ++++ jdk/test/javax/xml/ws/xsanymixed/service.wsdl | 87 ++++++++ 5 files changed, 406 insertions(+) create mode 100644 jdk/test/javax/xml/ws/xsanymixed/CopyingResponse.java create mode 100644 jdk/test/javax/xml/ws/xsanymixed/ServiceImpl.java create mode 100644 jdk/test/javax/xml/ws/xsanymixed/Test.java create mode 100644 jdk/test/javax/xml/ws/xsanymixed/compile-wsdl.sh create mode 100644 jdk/test/javax/xml/ws/xsanymixed/service.wsdl diff --git a/jdk/test/javax/xml/ws/xsanymixed/CopyingResponse.java b/jdk/test/javax/xml/ws/xsanymixed/CopyingResponse.java new file mode 100644 index 00000000000..88c4084e58b --- /dev/null +++ b/jdk/test/javax/xml/ws/xsanymixed/CopyingResponse.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2014, 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 org.somewhere.ws.EchoRequest; +import org.somewhere.ws.EchoResponse; + +public class CopyingResponse extends EchoResponse { + + public CopyingResponse() {} + + public CopyingResponse(EchoRequest request) { + content = request.getContent(); + } +} diff --git a/jdk/test/javax/xml/ws/xsanymixed/ServiceImpl.java b/jdk/test/javax/xml/ws/xsanymixed/ServiceImpl.java new file mode 100644 index 00000000000..b0458938acd --- /dev/null +++ b/jdk/test/javax/xml/ws/xsanymixed/ServiceImpl.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2014, 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 org.somewhere.ws.EchoRequest; +import org.somewhere.ws.EchoResponse; +import org.somewhere.ws.TestPort; + +import javax.jws.WebService; +import javax.xml.namespace.QName; + + +/** + * Simple Webservice implementation just copying xml part as is + * from incoming request into outgoing response + */ +@WebService( + endpointInterface = "org.somewhere.ws.TestPort", + targetNamespace = "http://ws.somewhere.org/", + serviceName = "TestService", + portName = "TestPort") +public class ServiceImpl implements TestPort { + + public static final QName PORT_NAME = new QName("http://ws.somewhere.org/", "TestPort"); + public static final QName SERVICE_NAME = new QName("http://ws.somewhere.org/", "TestService"); + + @Override + public EchoResponse echo(EchoRequest request) { + return new CopyingResponse(request); + } + +} diff --git a/jdk/test/javax/xml/ws/xsanymixed/Test.java b/jdk/test/javax/xml/ws/xsanymixed/Test.java new file mode 100644 index 00000000000..4287d8c08c5 --- /dev/null +++ b/jdk/test/javax/xml/ws/xsanymixed/Test.java @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2014, 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 8036981 8038966 8051441 + * @summary the content of xs:any content:mixed should remain as is, + * no white space changes and no changes to namespace prefixes + * @run shell compile-wsdl.sh + * @run main/othervm Test + */ + +import com.sun.net.httpserver.HttpServer; + +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; +import javax.xml.ws.Dispatch; +import javax.xml.ws.Endpoint; +import javax.xml.ws.Service; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.StringReader; +import java.net.InetSocketAddress; +import java.net.URL; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; + +import static java.nio.file.FileVisitResult.CONTINUE; + +public class Test { + + private static HttpServer httpServer; + private static Endpoint endpoint; + private static final String NL = System.getProperty("line.separator"); + + private static final String XS_ANY_MIXED_PART = + "" + NL + + " " + NL + NL + + "" + NL + NL + + " any" + NL + + " white" + NL + + " space" + NL + NL + + " ... and" + NL + NL + + " NO namespace prefixes!!!" + NL + NL + + " " + NL + NL + + " " + NL + + "" + NL + + ""; + + private static final String XML_REQUEST = "" + + "" + + "" + NL + + XS_ANY_MIXED_PART + NL + + "" + + ""; + + private static String deployWebservice() throws IOException { + // Manually create HttpServer here using ephemeral address for port + // so as to not end up with attempt to bind to an in-use port + httpServer = HttpServer.create(new InetSocketAddress(0), 0); + httpServer.start(); + endpoint = Endpoint.create(new ServiceImpl()); + endpoint.publish(httpServer.createContext("/wservice")); + + String wsdlAddress = "http://localhost:" + httpServer.getAddress().getPort() + "/wservice?wsdl"; + log("address = " + wsdlAddress); + return wsdlAddress; + } + + private static void stopWebservice() { + if (endpoint != null && endpoint.isPublished()) { + endpoint.stop(); + } + if (httpServer != null) { + httpServer.stop(0); + } + } + + public static void main(String[] args) throws IOException, TransformerException { + + try { + String address = deployWebservice(); + Service service = Service.create(new URL(address), ServiceImpl.SERVICE_NAME); + + Dispatch d = service.createDispatch(ServiceImpl.PORT_NAME, Source.class, Service.Mode.MESSAGE); + Source response = d.invoke(new StreamSource(new StringReader(XML_REQUEST))); + + String resultXml = toString(response); + + log("= request ======== \n"); + log(XML_REQUEST); + log("= result ========= \n"); + log(resultXml); + log("\n=================="); + + boolean xsAnyMixedPartSame = resultXml.contains(XS_ANY_MIXED_PART); + log("resultXml.contains(XS_ANY_PART) = " + xsAnyMixedPartSame); + if (!xsAnyMixedPartSame) { + fail("The xs:any content=mixed part is supposed to be same in request and response."); + throw new RuntimeException(); + } + + log("TEST PASSED"); + } finally { + stopWebservice(); + + // if you need to debug or explore wsdl generation result + // comment this line out: + deleteGeneratedFiles(); + } + } + + private static String toString(Source response) throws TransformerException, IOException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + transformer.transform(response, new StreamResult(bos)); + bos.close(); + return new String(bos.toByteArray()); + } + + private static void fail(String message) { + log("TEST FAILED."); + throw new RuntimeException(message); + } + + private static void log(String msg) { + System.out.println(msg); + } + + private static void deleteGeneratedFiles() { + Path p = Paths.get("..", "classes", "javax", "xml", "ws", "xsanymixed", "org"); + System.out.println("performing cleanup, deleting wsdl compilation result: " + p.toFile().getAbsolutePath()); + if (Files.exists(p)) { + try { + Files.walkFileTree(p, new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile( + Path file, + BasicFileAttributes attrs) throws IOException { + + System.out.println("deleting file [" + file.toFile().getAbsoluteFile() + "]"); + Files.delete(file); + return CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory( + Path dir, + IOException exc) throws IOException { + + System.out.println("deleting dir [" + dir.toFile().getAbsoluteFile() + "]"); + if (exc == null) { + Files.delete(dir); + return CONTINUE; + } else { + throw exc; + } + } + }); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } + } + +} diff --git a/jdk/test/javax/xml/ws/xsanymixed/compile-wsdl.sh b/jdk/test/javax/xml/ws/xsanymixed/compile-wsdl.sh new file mode 100644 index 00000000000..a93050af1a0 --- /dev/null +++ b/jdk/test/javax/xml/ws/xsanymixed/compile-wsdl.sh @@ -0,0 +1,36 @@ +#! /bin/sh + +# +# Copyright (c) 2014, 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. +# + +# + +if [ "x$TESTJAVA" = x ]; then + TESTJAVA=$1; shift + TESTCLASSES=. +fi + +echo "compiling [test-service.wsdl] wsdl ..." +$TESTJAVA/bin/wsimport -keep -d ${TESTCLASSES} ${TESTSRC}/service.wsdl + +echo "WSDL compiled. Main test class Test.java can be compiled now." diff --git a/jdk/test/javax/xml/ws/xsanymixed/service.wsdl b/jdk/test/javax/xml/ws/xsanymixed/service.wsdl new file mode 100644 index 00000000000..3a8f541e349 --- /dev/null +++ b/jdk/test/javax/xml/ws/xsanymixed/service.wsdl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From aeecc19f04e92f9eb3886276c99efa8baed3c257 Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Thu, 25 Sep 2014 12:24:19 +0100 Subject: [PATCH 71/81] 8056026: Debug security logging should print Provider used for each crypto operation Reviewed-by: mullan --- .../java/security/KeyPairGenerator.java | 19 +++++++- .../share/classes/java/security/KeyStore.java | 12 +++++ .../classes/java/security/MessageDigest.java | 26 ++++++++--- .../classes/java/security/SecureRandom.java | 11 +++++ .../classes/java/security/Signature.java | 27 ++++++++++- .../share/classes/javax/crypto/Cipher.java | 46 ++++++++++++++++++- .../classes/javax/crypto/KeyAgreement.java | 17 ++++++- .../classes/javax/crypto/KeyGenerator.java | 18 +++++++- .../share/classes/javax/crypto/Mac.java | 17 ++++++- .../classes/sun/security/util/Debug.java | 12 ++++- 10 files changed, 190 insertions(+), 15 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java index c09d2510294..20567688939 100644 --- a/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java +++ b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -33,6 +33,7 @@ import java.security.Provider.Service; import sun.security.jca.*; import sun.security.jca.GetInstance.Instance; +import sun.security.util.Debug; /** * The KeyPairGenerator class is used to generate pairs of @@ -126,6 +127,11 @@ import sun.security.jca.GetInstance.Instance; public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { + private static final Debug pdebug = + Debug.getInstance("provider", "Provider"); + private static final boolean skipDebug = + Debug.isOn("engine=") && !Debug.isOn("keypairgenerator"); + private final String algorithm; // The provider @@ -167,6 +173,12 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { kpg = new Delegate(spi, algorithm); } kpg.provider = instance.provider; + + if (!skipDebug && pdebug != null) { + pdebug.println("KeyPairGenerator." + algorithm + + " algorithm from: " + kpg.provider.getName()); + } + return kpg; } @@ -557,6 +569,11 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi { provider = instance.provider; this.serviceIterator = serviceIterator; initType = I_NONE; + + if (!skipDebug && pdebug != null) { + pdebug.println("KeyPairGenerator." + algorithm + + " algorithm from: " + provider.getName()); + } } /** diff --git a/jdk/src/java.base/share/classes/java/security/KeyStore.java b/jdk/src/java.base/share/classes/java/security/KeyStore.java index 80bf17da68f..4278369e8be 100644 --- a/jdk/src/java.base/share/classes/java/security/KeyStore.java +++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java @@ -37,6 +37,8 @@ import javax.crypto.SecretKey; import javax.security.auth.DestroyFailedException; import javax.security.auth.callback.*; +import sun.security.util.Debug; + /** * This class represents a storage facility for cryptographic * keys and certificates. @@ -177,6 +179,11 @@ import javax.security.auth.callback.*; public class KeyStore { + private static final Debug pdebug = + Debug.getInstance("provider", "Provider"); + private static final boolean skipDebug = + Debug.isOn("engine=") && !Debug.isOn("keystore"); + /* * Constant to lookup in the Security properties file to determine * the default keystore type. @@ -801,6 +808,11 @@ public class KeyStore { this.keyStoreSpi = keyStoreSpi; this.provider = provider; this.type = type; + + if (!skipDebug && pdebug != null) { + pdebug.println("KeyStore." + type.toUpperCase() + " type from: " + + this.provider.getName()); + } } /** diff --git a/jdk/src/java.base/share/classes/java/security/MessageDigest.java b/jdk/src/java.base/share/classes/java/security/MessageDigest.java index 60d41ffac72..cf3e3a3a1c3 100644 --- a/jdk/src/java.base/share/classes/java/security/MessageDigest.java +++ b/jdk/src/java.base/share/classes/java/security/MessageDigest.java @@ -35,6 +35,8 @@ import java.io.ByteArrayInputStream; import java.nio.ByteBuffer; +import sun.security.util.Debug; + /** * This MessageDigest class provides applications the functionality of a * message digest algorithm, such as SHA-1 or SHA-256. @@ -103,6 +105,11 @@ import java.nio.ByteBuffer; public abstract class MessageDigest extends MessageDigestSpi { + private static final Debug pdebug = + Debug.getInstance("provider", "Provider"); + private static final boolean skipDebug = + Debug.isOn("engine=") && !Debug.isOn("messagedigest"); + private String algorithm; // The state of this digest @@ -156,18 +163,23 @@ public abstract class MessageDigest extends MessageDigestSpi { public static MessageDigest getInstance(String algorithm) throws NoSuchAlgorithmException { try { + MessageDigest md; Object[] objs = Security.getImpl(algorithm, "MessageDigest", (String)null); if (objs[0] instanceof MessageDigest) { - MessageDigest md = (MessageDigest)objs[0]; - md.provider = (Provider)objs[1]; - return md; + md = (MessageDigest)objs[0]; } else { - MessageDigest delegate = - new Delegate((MessageDigestSpi)objs[0], algorithm); - delegate.provider = (Provider)objs[1]; - return delegate; + md = new Delegate((MessageDigestSpi)objs[0], algorithm); } + md.provider = (Provider)objs[1]; + + if (!skipDebug && pdebug != null) { + pdebug.println("MessageDigest." + algorithm + + " algorithm from: " + md.provider.getName()); + } + + return md; + } catch(NoSuchProviderException e) { throw new NoSuchAlgorithmException(algorithm + " not found"); } diff --git a/jdk/src/java.base/share/classes/java/security/SecureRandom.java b/jdk/src/java.base/share/classes/java/security/SecureRandom.java index 0accb4cc7a4..a9c4469e8e1 100644 --- a/jdk/src/java.base/share/classes/java/security/SecureRandom.java +++ b/jdk/src/java.base/share/classes/java/security/SecureRandom.java @@ -32,6 +32,7 @@ import java.security.Provider.Service; import sun.security.jca.*; import sun.security.jca.GetInstance.Instance; +import sun.security.util.Debug; /** * This class provides a cryptographically strong random number @@ -93,6 +94,11 @@ import sun.security.jca.GetInstance.Instance; public class SecureRandom extends java.util.Random { + private static final Debug pdebug = + Debug.getInstance("provider", "Provider"); + private static final boolean skipDebug = + Debug.isOn("engine=") && !Debug.isOn("securerandom"); + /** * The provider. * @@ -235,6 +241,11 @@ public class SecureRandom extends java.util.Random { this.secureRandomSpi = secureRandomSpi; this.provider = provider; this.algorithm = algorithm; + + if (!skipDebug && pdebug != null) { + pdebug.println("SecureRandom." + algorithm + + " algorithm from: " + this.provider.getName()); + } } /** diff --git a/jdk/src/java.base/share/classes/java/security/Signature.java b/jdk/src/java.base/share/classes/java/security/Signature.java index 7c5bd96eb28..60a7e01b6c9 100644 --- a/jdk/src/java.base/share/classes/java/security/Signature.java +++ b/jdk/src/java.base/share/classes/java/security/Signature.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2014, 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 @@ -121,6 +121,11 @@ public abstract class Signature extends SignatureSpi { private static final Debug debug = Debug.getInstance("jca", "Signature"); + private static final Debug pdebug = + Debug.getInstance("provider", "Provider"); + private static final boolean skipDebug = + Debug.isOn("engine=") && !Debug.isOn("signature"); + /* * The algorithm for this signature object. * This value is used to map an OID to the particular algorithm. @@ -451,6 +456,11 @@ public abstract class Signature extends SignatureSpi { throws InvalidKeyException { engineInitVerify(publicKey); state = VERIFY; + + if (!skipDebug && pdebug != null) { + pdebug.println("Signature." + algorithm + + " verification algorithm from: " + this.provider.getName()); + } } /** @@ -495,6 +505,11 @@ public abstract class Signature extends SignatureSpi { PublicKey publicKey = certificate.getPublicKey(); engineInitVerify(publicKey); state = VERIFY; + + if (!skipDebug && pdebug != null) { + pdebug.println("Signature." + algorithm + + " verification algorithm from: " + this.provider.getName()); + } } /** @@ -511,6 +526,11 @@ public abstract class Signature extends SignatureSpi { throws InvalidKeyException { engineInitSign(privateKey); state = SIGN; + + if (!skipDebug && pdebug != null) { + pdebug.println("Signature." + algorithm + + " signing algorithm from: " + this.provider.getName()); + } } /** @@ -529,6 +549,11 @@ public abstract class Signature extends SignatureSpi { throws InvalidKeyException { engineInitSign(privateKey, random); state = SIGN; + + if (!skipDebug && pdebug != null) { + pdebug.println("Signature." + algorithm + + " signing algorithm from: " + this.provider.getName()); + } } /** diff --git a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java index ffcc7cf329c..95935402483 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java +++ b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -167,6 +167,11 @@ public class Cipher { private static final Debug debug = Debug.getInstance("jca", "Cipher"); + private static final Debug pdebug = + Debug.getInstance("provider", "Provider"); + private static final boolean skipDebug = + Debug.isOn("engine=") && !Debug.isOn("cipher"); + /** * Constant used to initialize cipher to encryption mode. */ @@ -1110,6 +1115,21 @@ public class Cipher { } } + private static String getOpmodeString(int opmode) { + switch (opmode) { + case ENCRYPT_MODE: + return "encryption"; + case DECRYPT_MODE: + return "decryption"; + case WRAP_MODE: + return "key wrapping"; + case UNWRAP_MODE: + return "key unwrapping"; + default: + return ""; + } + } + /** * Initializes this cipher with a key. * @@ -1235,6 +1255,12 @@ public class Cipher { initialized = true; this.opmode = opmode; + + if (!skipDebug && pdebug != null) { + pdebug.println("Cipher." + transformation + " " + + getOpmodeString(opmode) + " algorithm from: " + + this.provider.getName()); + } } /** @@ -1372,6 +1398,12 @@ public class Cipher { initialized = true; this.opmode = opmode; + + if (!skipDebug && pdebug != null) { + pdebug.println("Cipher." + transformation + " " + + getOpmodeString(opmode) + " algorithm from: " + + this.provider.getName()); + } } /** @@ -1509,6 +1541,12 @@ public class Cipher { initialized = true; this.opmode = opmode; + + if (!skipDebug && pdebug != null) { + pdebug.println("Cipher." + transformation + " " + + getOpmodeString(opmode) + " algorithm from: " + + this.provider.getName()); + } } /** @@ -1693,6 +1731,12 @@ public class Cipher { initialized = true; this.opmode = opmode; + + if (!skipDebug && pdebug != null) { + pdebug.println("Cipher." + transformation + " " + + getOpmodeString(opmode) + " algorithm from: " + + this.provider.getName()); + } } /** diff --git a/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java b/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java index 70221aa0c6e..2c24470300f 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java +++ b/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -78,6 +78,11 @@ public class KeyAgreement { private static final Debug debug = Debug.getInstance("jca", "KeyAgreement"); + private static final Debug pdebug = + Debug.getInstance("provider", "Provider"); + private static final boolean skipDebug = + Debug.isOn("engine=") && !Debug.isOn("keyagreement"); + // The provider private Provider provider; @@ -468,6 +473,11 @@ public class KeyAgreement { throw new InvalidKeyException(e); } } + + if (!skipDebug && pdebug != null) { + pdebug.println("KeyAgreement." + algorithm + " algorithm from: " + + this.provider.getName()); + } } /** @@ -524,6 +534,11 @@ public class KeyAgreement { } else { chooseProvider(I_PARAMS, key, params, random); } + + if (!skipDebug && pdebug != null) { + pdebug.println("KeyAgreement." + algorithm + " algorithm from: " + + this.provider.getName()); + } } /** diff --git a/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java b/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java index 030207eab51..9da64e967cb 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java +++ b/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -33,6 +33,7 @@ import java.security.spec.*; import sun.security.jca.*; import sun.security.jca.GetInstance.Instance; +import sun.security.util.Debug; /** * This class provides the functionality of a secret (symmetric) key generator. @@ -108,6 +109,11 @@ import sun.security.jca.GetInstance.Instance; public class KeyGenerator { + private static final Debug pdebug = + Debug.getInstance("provider", "Provider"); + private static final boolean skipDebug = + Debug.isOn("engine=") && !Debug.isOn("keygenerator"); + // see java.security.KeyPairGenerator for failover notes private final static int I_NONE = 1; @@ -145,6 +151,11 @@ public class KeyGenerator { this.spi = keyGenSpi; this.provider = provider; this.algorithm = algorithm; + + if (!skipDebug && pdebug != null) { + pdebug.println("KeyGenerator." + algorithm + " algorithm from: " + + this.provider.getName()); + } } private KeyGenerator(String algorithm) throws NoSuchAlgorithmException { @@ -158,6 +169,11 @@ public class KeyGenerator { throw new NoSuchAlgorithmException (algorithm + " KeyGenerator not available"); } + + if (!skipDebug && pdebug != null) { + pdebug.println("KeyGenerator." + algorithm + " algorithm from: " + + this.provider.getName()); + } } /** diff --git a/jdk/src/java.base/share/classes/javax/crypto/Mac.java b/jdk/src/java.base/share/classes/javax/crypto/Mac.java index d0e241dc87f..8a497daa821 100644 --- a/jdk/src/java.base/share/classes/javax/crypto/Mac.java +++ b/jdk/src/java.base/share/classes/javax/crypto/Mac.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -77,6 +77,11 @@ public class Mac implements Cloneable { private static final Debug debug = Debug.getInstance("jca", "Mac"); + private static final Debug pdebug = + Debug.getInstance("provider", "Provider"); + private static final boolean skipDebug = + Debug.isOn("engine=") && !Debug.isOn("mac"); + // The provider private Provider provider; @@ -413,6 +418,11 @@ public class Mac implements Cloneable { throw new InvalidKeyException("init() failed", e); } initialized = true; + + if (!skipDebug && pdebug != null) { + pdebug.println("Mac." + algorithm + " algorithm from: " + + this.provider.getName()); + } } /** @@ -435,6 +445,11 @@ public class Mac implements Cloneable { chooseProvider(key, params); } initialized = true; + + if (!skipDebug && pdebug != null) { + pdebug.println("Mac." + algorithm + " algorithm from: " + + this.provider.getName()); + } } /** diff --git a/jdk/src/java.base/share/classes/sun/security/util/Debug.java b/jdk/src/java.base/share/classes/sun/security/util/Debug.java index 0b8a7c4c456..8e2bb9e2874 100644 --- a/jdk/src/java.base/share/classes/sun/security/util/Debug.java +++ b/jdk/src/java.base/share/classes/sun/security/util/Debug.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -104,7 +104,15 @@ public class Debug { System.err.println("codebase="); System.err.println(" only dump output if specified codebase"); System.err.println(" is being checked"); - + System.err.println(); + System.err.println("The following can be used with provider:"); + System.err.println(); + System.err.println("engine="); + System.err.println(" only dump output for the specified list"); + System.err.println(" of JCA engines. Supported values:"); + System.err.println(" Cipher, KeyAgreement, KeyGenerator,"); + System.err.println(" KeyPairGenerator, KeyStore, Mac,"); + System.err.println(" MessageDigest, SecureRandom, Signature."); System.err.println(); System.err.println("Note: Separate multiple options with a comma"); System.exit(0); From da0b4cb7dfc33674ff7035133fd1fd2cb53b47df Mon Sep 17 00:00:00 2001 From: Marcus Lagergren Date: Thu, 25 Sep 2014 15:53:47 +0200 Subject: [PATCH 72/81] 8025435: Optimistic builtins support, implemented initial optimistic versions of push, pop, and charCodeAt Reviewed-by: attila, hannesw, sundar --- .../internal/tools/nasgen/ClassGenerator.java | 1 - .../internal/tools/nasgen/MemberInfo.java | 77 +++- .../tools/nasgen/MethodGenerator.java | 31 +- .../tools/nasgen/ScriptClassInfo.java | 12 +- .../nasgen/ScriptClassInfoCollector.java | 40 +- .../tools/nasgen/ScriptClassInstrumentor.java | 2 - .../tools/nasgen/StringConstants.java | 29 +- nashorn/samples/BufferArray.java | 24 +- .../internal/codegen/ApplySpecialization.java | 17 +- .../internal/codegen/ClassEmitter.java | 9 +- .../nashorn/internal/codegen/CompileUnit.java | 8 + .../internal/codegen/MethodEmitter.java | 17 +- .../codegen/OptimisticTypesPersistence.java | 4 +- .../jdk/nashorn/internal/ir/FunctionNode.java | 10 +- .../jdk/nashorn/internal/ir/LiteralNode.java | 9 +- .../jdk/nashorn/internal/ir/Symbol.java | 11 + .../internal/lookup/MethodHandleFactory.java | 66 ++- .../lookup/MethodHandleFunctionality.java | 9 + .../internal/objects/ArrayBufferView.java | 1 + .../jdk/nashorn/internal/objects/Global.java | 236 +++++----- .../nashorn/internal/objects/NativeArray.java | 421 +++++++++++++++--- .../internal/objects/NativeDataView.java | 6 +- .../nashorn/internal/objects/NativeDate.java | 5 +- .../internal/objects/NativeFloat32Array.java | 6 +- .../internal/objects/NativeFloat64Array.java | 6 +- .../internal/objects/NativeInt16Array.java | 6 +- .../internal/objects/NativeInt32Array.java | 6 +- .../internal/objects/NativeInt8Array.java | 6 +- .../internal/objects/NativeJSAdapter.java | 1 - .../internal/objects/NativeRegExp.java | 9 +- .../internal/objects/NativeString.java | 137 +++++- .../internal/objects/NativeUint16Array.java | 6 +- .../internal/objects/NativeUint32Array.java | 6 +- .../internal/objects/NativeUint8Array.java | 6 +- .../objects/NativeUint8ClampedArray.java | 6 +- .../internal/objects/ScriptFunctionImpl.java | 18 +- .../annotations/SpecializedFunction.java | 315 ++++++++++++- .../internal/runtime/AccessorProperty.java | 50 +-- .../internal/runtime/CodeInstaller.java | 8 +- .../nashorn/internal/runtime/CodeStore.java | 5 + .../internal/runtime/CompiledFunction.java | 109 ++++- .../jdk/nashorn/internal/runtime/Context.java | 43 ++ .../runtime/FinalScriptFunctionData.java | 21 +- .../internal/runtime/FindProperty.java | 3 + .../internal/runtime/GlobalConstants.java | 6 +- .../internal/runtime/GlobalFunctions.java | 18 + .../internal/runtime/OptimisticBuiltins.java | 65 +++ .../nashorn/internal/runtime/Property.java | 36 +- .../nashorn/internal/runtime/PropertyMap.java | 2 +- .../RecompilableScriptFunctionData.java | 14 +- .../internal/runtime/ScriptEnvironment.java | 4 - .../internal/runtime/ScriptFunction.java | 119 ++++- .../internal/runtime/ScriptFunctionData.java | 26 +- .../internal/runtime/ScriptObject.java | 61 ++- .../internal/runtime/ScriptRuntime.java | 27 +- .../internal/runtime/SetMethodCreator.java | 25 +- .../internal/runtime/Specialization.java | 114 +++++ .../internal/runtime/StoredScript.java | 6 + .../runtime/UserAccessorProperty.java | 1 - .../internal/runtime/arrays/ArrayData.java | 19 +- .../internal/runtime/arrays/ArrayFilter.java | 2 +- .../runtime/arrays/ContinuousArrayData.java | 80 +++- .../internal/runtime/arrays/IntArrayData.java | 81 +++- .../arrays/IntElements.java} | 25 +- .../runtime/arrays/IntOrLongElements.java | 34 ++ .../runtime/arrays/LongArrayData.java | 45 +- .../runtime/arrays/NumberArrayData.java | 45 +- .../runtime/arrays/NumericElements.java | 35 ++ .../runtime/arrays/ObjectArrayData.java | 44 +- .../runtime/arrays/SparseArrayData.java | 2 +- .../runtime/arrays/TypedArrayData.java | 3 +- .../runtime/linker/PrimitiveLookup.java | 28 +- nashorn/test/examples/charcodeat-benchmark.js | 63 +++ nashorn/test/examples/push-pop-benchmark.js | 59 +++ .../basic/apply_to_call/apply_to_call5.js | 111 +++++ .../apply_to_call/apply_to_call5.js.EXPECTED | 19 + nashorn/test/script/basic/fastpushpop.js | 61 +++ .../test/script/basic/fastpushpop.js.EXPECTED | 6 + nashorn/test/script/basic/run-octane.js | 6 +- 79 files changed, 2579 insertions(+), 531 deletions(-) create mode 100644 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/OptimisticBuiltins.java create mode 100644 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Specialization.java rename nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/{objects/annotations/SpecializedConstructor.java => runtime/arrays/IntElements.java} (51%) create mode 100644 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntOrLongElements.java create mode 100644 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumericElements.java create mode 100644 nashorn/test/examples/charcodeat-benchmark.js create mode 100644 nashorn/test/examples/push-pop-benchmark.js create mode 100644 nashorn/test/script/basic/apply_to_call/apply_to_call5.js create mode 100644 nashorn/test/script/basic/apply_to_call/apply_to_call5.js.EXPECTED create mode 100644 nashorn/test/script/basic/fastpushpop.js create mode 100644 nashorn/test/script/basic/fastpushpop.js.EXPECTED diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java index 2059567bb31..7587431654f 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java @@ -292,7 +292,6 @@ public class ClassGenerator { mi.push(memInfo.getArity()); mi.invokeVirtual(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_SETARITY, SCRIPTFUNCTION_SETARITY_DESC); } - } static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo memInfo) { diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java index c8a929dc609..cc3524da2ab 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java @@ -28,7 +28,6 @@ import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_ARRAY_DES import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC; import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_DESC; import static jdk.nashorn.internal.tools.nasgen.StringConstants.STRING_DESC; - import jdk.internal.org.objectweb.asm.Opcodes; import jdk.internal.org.objectweb.asm.Type; import jdk.nashorn.internal.objects.annotations.Where; @@ -75,10 +74,6 @@ public final class MemberInfo implements Cloneable { * This is a specialized version of a function */ SPECIALIZED_FUNCTION, - /** - * This is a specialized version of a constructor - */ - SPECIALIZED_CONSTRUCTOR } // keep in sync with jdk.nashorn.internal.objects.annotations.Attribute @@ -107,6 +102,12 @@ public final class MemberInfo implements Cloneable { private Where where; + private Type linkLogicClass; + + private boolean isSpecializedConstructor; + + private boolean isOptimistic; + /** * @return the kind */ @@ -135,6 +136,57 @@ public final class MemberInfo implements Cloneable { this.name = name; } + /** + * Tag something as specialized constructor or not + * @param isSpecializedConstructor boolean, true if specialized constructor + */ + public void setIsSpecializedConstructor(final boolean isSpecializedConstructor) { + this.isSpecializedConstructor = isSpecializedConstructor; + } + + /** + * Check if something is a specialized constructor + * @return true if specialized constructor + */ + public boolean isSpecializedConstructor() { + return isSpecializedConstructor; + } + + /** + * Check if this is an optimistic builtin function + * @return true if optimistic builtin + */ + public boolean isOptimistic() { + return isOptimistic; + } + + /** + * Tag something as optimitic builtin or not + * @param isOptimistic boolean, true if builtin constructor + */ + public void setIsOptimistic(final boolean isOptimistic) { + this.isOptimistic = isOptimistic; + } + + /** + * Get the SpecializedFunction guard for specializations, i.e. optimistic + * builtins + * @return specialization, null if none + */ + public Type getLinkLogicClass() { + return linkLogicClass; + } + + /** + * Set thre SpecializedFunction link logic class for specializations, i.e. optimistic + * builtins + * @param linkLogicClass link logic class + */ + + public void setLinkLogicClass(final Type linkLogicClass) { + this.linkLogicClass = linkLogicClass; + } + /** * @return the attributes */ @@ -304,19 +356,6 @@ public final class MemberInfo implements Cloneable { } } break; - case SPECIALIZED_CONSTRUCTOR: { - final Type returnType = Type.getReturnType(javaDesc); - if (!isJSObjectType(returnType)) { - error("return value of a @SpecializedConstructor method should be a valid JS type, found " + returnType); - } - final Type[] argTypes = Type.getArgumentTypes(javaDesc); - for (int i = 0; i < argTypes.length; i++) { - if (!isValidJSType(argTypes[i])) { - error(i + "'th argument of a @SpecializedConstructor method is not valid JS type, found " + argTypes[i]); - } - } - } - break; case FUNCTION: { final Type returnType = Type.getReturnType(javaDesc); if (!(isValidJSType(returnType) || Type.VOID_TYPE == returnType)) { @@ -351,7 +390,7 @@ public final class MemberInfo implements Cloneable { break; case SPECIALIZED_FUNCTION: { final Type returnType = Type.getReturnType(javaDesc); - if (!(isValidJSType(returnType) || Type.VOID_TYPE == returnType)) { + if (!(isValidJSType(returnType) || (isSpecializedConstructor() && Type.VOID_TYPE == returnType))) { error("return value of a @SpecializedFunction method should be a valid JS type, found " + returnType); } final Type[] argTypes = Type.getArgumentTypes(javaDesc); diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java index 6f153c18b8e..1a99d828991 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java @@ -55,6 +55,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC; import static jdk.internal.org.objectweb.asm.Opcodes.IALOAD; import static jdk.internal.org.objectweb.asm.Opcodes.IASTORE; import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_0; +import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_1; import static jdk.internal.org.objectweb.asm.Opcodes.ILOAD; import static jdk.internal.org.objectweb.asm.Opcodes.INVOKEINTERFACE; import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL; @@ -75,13 +76,16 @@ import static jdk.internal.org.objectweb.asm.Opcodes.SALOAD; import static jdk.internal.org.objectweb.asm.Opcodes.SASTORE; import static jdk.internal.org.objectweb.asm.Opcodes.SIPUSH; import static jdk.internal.org.objectweb.asm.Opcodes.SWAP; -import static jdk.nashorn.internal.tools.nasgen.StringConstants.METHODHANDLE_TYPE; -import static jdk.nashorn.internal.tools.nasgen.StringConstants.TYPE_METHODHANDLE; - +import static jdk.nashorn.internal.tools.nasgen.StringConstants.INIT; +import static jdk.nashorn.internal.tools.nasgen.StringConstants.SPECIALIZATION_INIT2; +import static jdk.nashorn.internal.tools.nasgen.StringConstants.SPECIALIZATION_INIT3; +import static jdk.nashorn.internal.tools.nasgen.StringConstants.SPECIALIZATION_TYPE; +import static jdk.nashorn.internal.tools.nasgen.StringConstants.TYPE_SPECIALIZATION; import java.util.List; import jdk.internal.org.objectweb.asm.Handle; import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.org.objectweb.asm.Type; +import jdk.nashorn.internal.objects.annotations.SpecializedFunction.LinkLogic; /** * Base class for all method generating classes. @@ -94,6 +98,8 @@ public class MethodGenerator extends MethodVisitor { private final Type returnType; private final Type[] argumentTypes; + static final Type EMPTY_LINK_LOGIC_TYPE = Type.getType(LinkLogic.getEmptyLinkLogicClass()); + MethodGenerator(final MethodVisitor mv, final int access, final String name, final String descriptor) { super(Main.ASM_VERSION, mv); this.access = access; @@ -379,6 +385,11 @@ public class MethodGenerator extends MethodVisitor { super.visitFieldInsn(GETFIELD, owner, field, desc); } + private static boolean linkLogicIsEmpty(final Type type) { + assert EMPTY_LINK_LOGIC_TYPE != null; //type is ok for null if we are a @SpecializedFunction without any attribs + return EMPTY_LINK_LOGIC_TYPE.equals(type); + } + void memberInfoArray(final String className, final List mis) { if (mis.isEmpty()) { pushNull(); @@ -387,12 +398,22 @@ public class MethodGenerator extends MethodVisitor { int pos = 0; push(mis.size()); - newObjectArray(METHODHANDLE_TYPE); + newObjectArray(SPECIALIZATION_TYPE); for (final MemberInfo mi : mis) { dup(); push(pos++); + visitTypeInsn(NEW, SPECIALIZATION_TYPE); + dup(); visitLdcInsn(new Handle(H_INVOKESTATIC, className, mi.getJavaName(), mi.getJavaDesc())); - arrayStore(TYPE_METHODHANDLE); + final Type linkLogicClass = mi.getLinkLogicClass(); + final boolean linkLogic = !linkLogicIsEmpty(linkLogicClass); + final String ctor = linkLogic ? SPECIALIZATION_INIT3 : SPECIALIZATION_INIT2; + if (linkLogic) { + visitLdcInsn(linkLogicClass); + } + visitInsn(mi.isOptimistic() ? ICONST_1 : ICONST_0); + visitMethodInsn(INVOKESPECIAL, SPECIALIZATION_TYPE, INIT, ctor, false); + arrayStore(TYPE_SPECIALIZATION); } } diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java index 0a1579ff5c8..9e3dfc174ab 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java @@ -37,8 +37,8 @@ import jdk.nashorn.internal.objects.annotations.Getter; import jdk.nashorn.internal.objects.annotations.Property; import jdk.nashorn.internal.objects.annotations.ScriptClass; import jdk.nashorn.internal.objects.annotations.Setter; -import jdk.nashorn.internal.objects.annotations.SpecializedConstructor; import jdk.nashorn.internal.objects.annotations.SpecializedFunction; +import jdk.nashorn.internal.objects.annotations.SpecializedFunction.LinkLogic; import jdk.nashorn.internal.objects.annotations.Where; import jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind; @@ -56,8 +56,8 @@ public final class ScriptClassInfo { static final String SETTER_ANNO_DESC = Type.getDescriptor(Setter.class); static final String PROPERTY_ANNO_DESC = Type.getDescriptor(Property.class); static final String WHERE_ENUM_DESC = Type.getDescriptor(Where.class); + static final String LINK_LOGIC_DESC = Type.getDescriptor(LinkLogic.class); static final String SPECIALIZED_FUNCTION = Type.getDescriptor(SpecializedFunction.class); - static final String SPECIALIZED_CONSTRUCTOR = Type.getDescriptor(SpecializedConstructor.class); static final Map annotations = new HashMap<>(); @@ -69,7 +69,6 @@ public final class ScriptClassInfo { annotations.put(SETTER_ANNO_DESC, Kind.SETTER); annotations.put(PROPERTY_ANNO_DESC, Kind.PROPERTY); annotations.put(SPECIALIZED_FUNCTION, Kind.SPECIALIZED_FUNCTION); - annotations.put(SPECIALIZED_CONSTRUCTOR, Kind.SPECIALIZED_CONSTRUCTOR); } // name of the script class @@ -119,11 +118,12 @@ public final class ScriptClassInfo { List getSpecializedConstructors() { final List res = new LinkedList<>(); for (final MemberInfo memInfo : members) { - if (memInfo.getKind() == Kind.SPECIALIZED_CONSTRUCTOR) { + if (memInfo.isSpecializedConstructor()) { + assert memInfo.getKind() == Kind.SPECIALIZED_FUNCTION; res.add(memInfo); } } - return res; + return Collections.unmodifiableList(res); } int getPrototypeMemberCount() { @@ -175,7 +175,7 @@ public final class ScriptClassInfo { res.add(memInfo); } } - return res; + return Collections.unmodifiableList(res); } MemberInfo findSetter(final MemberInfo getter) { diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfoCollector.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfoCollector.java index a83628e0a8e..ffe8bd3bbc7 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfoCollector.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfoCollector.java @@ -27,7 +27,6 @@ package jdk.nashorn.internal.tools.nasgen; import static jdk.nashorn.internal.tools.nasgen.ScriptClassInfo.SCRIPT_CLASS_ANNO_DESC; import static jdk.nashorn.internal.tools.nasgen.ScriptClassInfo.WHERE_ENUM_DESC; - import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.IOException; @@ -41,6 +40,7 @@ import jdk.internal.org.objectweb.asm.ClassVisitor; import jdk.internal.org.objectweb.asm.FieldVisitor; import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.org.objectweb.asm.Opcodes; +import jdk.internal.org.objectweb.asm.Type; import jdk.nashorn.internal.objects.annotations.Where; import jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind; @@ -194,6 +194,7 @@ public class ScriptClassInfoCollector extends ClassVisitor { final MemberInfo memInfo = new MemberInfo(); + //annokind == e.g. GETTER or SPECIALIZED_FUNCTION memInfo.setKind(annoKind); memInfo.setJavaName(methodName); memInfo.setJavaDesc(methodDesc); @@ -208,12 +209,18 @@ public class ScriptClassInfoCollector extends ClassVisitor { private Integer attributes; private Integer arity; private Where where; + private boolean isSpecializedConstructor; + private boolean isOptimistic; + private Type linkLogicClass = MethodGenerator.EMPTY_LINK_LOGIC_TYPE; @Override public void visit(final String annotationName, final Object annotationValue) { switch (annotationName) { case "name": this.name = (String)annotationValue; + if (name.isEmpty()) { + name = null; + } break; case "attributes": this.attributes = (Integer)annotationValue; @@ -221,6 +228,17 @@ public class ScriptClassInfoCollector extends ClassVisitor { case "arity": this.arity = (Integer)annotationValue; break; + case "isConstructor": + assert annoKind == Kind.SPECIALIZED_FUNCTION; + this.isSpecializedConstructor = (Boolean)annotationValue; + break; + case "isOptimistic": + assert annoKind == Kind.SPECIALIZED_FUNCTION; + this.isOptimistic = (Boolean)annotationValue; + break; + case "linkLogic": + this.linkLogicClass = (Type)annotationValue; + break; default: break; } @@ -230,12 +248,19 @@ public class ScriptClassInfoCollector extends ClassVisitor { @Override public void visitEnum(final String enumName, final String desc, final String enumValue) { - if ("where".equals(enumName) && WHERE_ENUM_DESC.equals(desc)) { - this.where = Where.valueOf(enumValue); + switch (enumName) { + case "where": + if (WHERE_ENUM_DESC.equals(desc)) { + this.where = Where.valueOf(enumValue); + } + break; + default: + break; } super.visitEnum(enumName, desc, enumValue); } + @SuppressWarnings("fallthrough") @Override public void visitEnd() { super.visitEnd(); @@ -256,7 +281,6 @@ public class ScriptClassInfoCollector extends ClassVisitor { case SETTER: where = Where.INSTANCE; break; - case SPECIALIZED_CONSTRUCTOR: case CONSTRUCTOR: where = Where.CONSTRUCTOR; break; @@ -264,12 +288,18 @@ public class ScriptClassInfoCollector extends ClassVisitor { where = Where.PROTOTYPE; break; case SPECIALIZED_FUNCTION: - //TODO is this correct + if (isSpecializedConstructor) { + where = Where.CONSTRUCTOR; + } + //fallthru default: break; } } memInfo.setWhere(where); + memInfo.setLinkLogicClass(linkLogicClass); + memInfo.setIsSpecializedConstructor(isSpecializedConstructor); + memInfo.setIsOptimistic(isOptimistic); } }; } diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java index 784cbd3d7de..dfd0b488cc2 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java @@ -38,7 +38,6 @@ import static jdk.nashorn.internal.tools.nasgen.StringConstants.DEFAULT_INIT_DES import static jdk.nashorn.internal.tools.nasgen.StringConstants.INIT; import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC; import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_TYPE; - import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -50,7 +49,6 @@ import jdk.internal.org.objectweb.asm.ClassVisitor; import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.FieldVisitor; import jdk.internal.org.objectweb.asm.MethodVisitor; -import jdk.internal.org.objectweb.asm.Opcodes; import jdk.internal.org.objectweb.asm.util.CheckClassAdapter; import jdk.nashorn.internal.objects.annotations.Where; import jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind; diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/StringConstants.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/StringConstants.java index fb72bbe65ec..8656a42bd22 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/StringConstants.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/StringConstants.java @@ -37,6 +37,7 @@ import jdk.nashorn.internal.runtime.AccessorProperty; import jdk.nashorn.internal.runtime.PropertyMap; import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptObject; +import jdk.nashorn.internal.runtime.Specialization; /** * String constants used for code generation/instrumentation. @@ -44,20 +45,26 @@ import jdk.nashorn.internal.runtime.ScriptObject; @SuppressWarnings("javadoc") public interface StringConstants { // standard jdk types, methods - static final Type TYPE_METHODHANDLE = Type.getType(MethodHandle.class); - static final Type TYPE_METHODHANDLE_ARRAY = Type.getType(MethodHandle[].class); - static final Type TYPE_OBJECT = Type.getType(Object.class); - static final Type TYPE_STRING = Type.getType(String.class); - static final Type TYPE_COLLECTION = Type.getType(Collection.class); - static final Type TYPE_COLLECTIONS = Type.getType(Collections.class); - static final Type TYPE_ARRAYLIST = Type.getType(ArrayList.class); - static final Type TYPE_LIST = Type.getType(List.class); + static final Type TYPE_METHODHANDLE = Type.getType(MethodHandle.class); + static final Type TYPE_METHODHANDLE_ARRAY = Type.getType(MethodHandle[].class); + static final Type TYPE_SPECIALIZATION = Type.getType(Specialization.class); + static final Type TYPE_SPECIALIZATION_ARRAY = Type.getType(Specialization[].class); + static final Type TYPE_OBJECT = Type.getType(Object.class); + static final Type TYPE_STRING = Type.getType(String.class); + static final Type TYPE_CLASS = Type.getType(Class.class); + static final Type TYPE_COLLECTION = Type.getType(Collection.class); + static final Type TYPE_COLLECTIONS = Type.getType(Collections.class); + static final Type TYPE_ARRAYLIST = Type.getType(ArrayList.class); + static final Type TYPE_LIST = Type.getType(List.class); static final String CLINIT = ""; static final String INIT = ""; static final String DEFAULT_INIT_DESC = Type.getMethodDescriptor(Type.VOID_TYPE); static final String METHODHANDLE_TYPE = TYPE_METHODHANDLE.getInternalName(); + static final String SPECIALIZATION_TYPE = TYPE_SPECIALIZATION.getInternalName(); + static final String SPECIALIZATION_INIT2 = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_METHODHANDLE, Type.getType(boolean.class)); + static final String SPECIALIZATION_INIT3 = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_METHODHANDLE, TYPE_CLASS, Type.getType(boolean.class)); static final String OBJECT_TYPE = TYPE_OBJECT.getInternalName(); static final String OBJECT_DESC = TYPE_OBJECT.getDescriptor(); static final String STRING_TYPE = TYPE_STRING.getInternalName(); @@ -122,11 +129,11 @@ public interface StringConstants { static final String SCRIPTFUNCTIONIMPL_MAKEFUNCTION_DESC = Type.getMethodDescriptor(TYPE_SCRIPTFUNCTION, TYPE_STRING, TYPE_METHODHANDLE); static final String SCRIPTFUNCTIONIMPL_MAKEFUNCTION_SPECS_DESC = - Type.getMethodDescriptor(TYPE_SCRIPTFUNCTION, TYPE_STRING, TYPE_METHODHANDLE, TYPE_METHODHANDLE_ARRAY); + Type.getMethodDescriptor(TYPE_SCRIPTFUNCTION, TYPE_STRING, TYPE_METHODHANDLE, TYPE_SPECIALIZATION_ARRAY); static final String SCRIPTFUNCTIONIMPL_INIT_DESC3 = - Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING, TYPE_METHODHANDLE, TYPE_METHODHANDLE_ARRAY); + Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING, TYPE_METHODHANDLE, TYPE_SPECIALIZATION_ARRAY); static final String SCRIPTFUNCTIONIMPL_INIT_DESC4 = - Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING, TYPE_METHODHANDLE, TYPE_PROPERTYMAP, TYPE_METHODHANDLE_ARRAY); + Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING, TYPE_METHODHANDLE, TYPE_PROPERTYMAP, TYPE_SPECIALIZATION_ARRAY); // ScriptObject static final String SCRIPTOBJECT_TYPE = TYPE_SCRIPTOBJECT.getInternalName(); diff --git a/nashorn/samples/BufferArray.java b/nashorn/samples/BufferArray.java index 00d6602358e..f1751f50860 100644 --- a/nashorn/samples/BufferArray.java +++ b/nashorn/samples/BufferArray.java @@ -52,41 +52,49 @@ public class BufferArray extends AbstractJSObject { // underlying nio buffer private final DoubleBuffer buf; - public BufferArray(int size) { + /** + * Constructor + * @param size initial size + */ + public BufferArray(final int size) { buf = DoubleBuffer.allocate(size); } - public BufferArray(DoubleBuffer buf) { + /** + * Constructur + * @param buf {@link DoubleBuffer} to link to + */ + public BufferArray(final DoubleBuffer buf) { this.buf = buf; } // called to check if indexed property exists @Override - public boolean hasSlot(int index) { + public boolean hasSlot(final int index) { return index > 0 && index < buf.capacity(); } // get the value from that index @Override - public Object getSlot(int index) { + public Object getSlot(final int index) { return buf.get(index); } // set the value at that index @Override - public void setSlot(int index, Object value) { + public void setSlot(final int index, final Object value) { buf.put(index, ((Number)value).doubleValue()); } // do you have a property of that given name? @Override - public boolean hasMember(String name) { + public boolean hasMember(final String name) { return "length".equals(name) || "buf".equals(name); } // get the value of that named property @Override - public Object getMember(String name) { + public Object getMember(final String name) { switch (name) { case "length": return buf.capacity(); @@ -94,7 +102,7 @@ public class BufferArray extends AbstractJSObject { // return a 'function' value for this property return new AbstractJSObject() { @Override - public Object call(Object thiz, Object... args) { + public Object call(final Object thiz, final Object... args) { return BufferArray.this.buf; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java index d1668894ab3..28900f73779 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java @@ -136,6 +136,7 @@ public final class ApplySpecialization extends NodeVisitor imple } }; + final Set argumentsFound = new HashSet<>(); final Deque> stack = new ArrayDeque<>(); //ensure that arguments is only passed as arg to apply try { @@ -145,7 +146,11 @@ public final class ApplySpecialization extends NodeVisitor imple } private boolean isArguments(final Expression expr) { - return expr instanceof IdentNode && ARGUMENTS.equals(((IdentNode)expr).getName()); + if (expr instanceof IdentNode && ARGUMENTS.equals(((IdentNode)expr).getName())) { + argumentsFound.add(expr); + return true; + } + return false; } private boolean isParam(final String name) { @@ -159,7 +164,7 @@ public final class ApplySpecialization extends NodeVisitor imple @Override public Node leaveIdentNode(final IdentNode identNode) { - if (isParam(identNode.getName()) || ARGUMENTS.equals(identNode.getName()) && !isCurrentArg(identNode)) { + if (isParam(identNode.getName()) || isArguments(identNode) && !isCurrentArg(identNode)) { throw uoe; //avoid filling in stack trace } return identNode; @@ -186,7 +191,9 @@ public final class ApplySpecialization extends NodeVisitor imple } }); } catch (final UnsupportedOperationException e) { - log.fine("'arguments' escapes, is not used in standard call dispatch, or is reassigned in '" + functionNode.getName() + "'. Aborting"); + if (!argumentsFound.isEmpty()) { + log.fine("'arguments' is used but escapes, or is reassigned in '" + functionNode.getName() + "'. Aborting"); + } return true; //bad } @@ -267,9 +274,9 @@ public final class ApplySpecialization extends NodeVisitor imple return false; } - if (!Global.instance().isSpecialNameValid("apply")) { + if (!Global.isBuiltinFunctionPrototypeApply()) { log.fine("Apply transform disabled: apply/call overridden"); - assert !Global.instance().isSpecialNameValid("call") : "call and apply should have the same SwitchPoint"; + assert !Global.isBuiltinFunctionPrototypeCall() : "call and apply should have the same SwitchPoint"; return false; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ClassEmitter.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ClassEmitter.java index 9f7fe79d2b0..7a89e490508 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ClassEmitter.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ClassEmitter.java @@ -51,15 +51,14 @@ import static jdk.nashorn.internal.codegen.CompilerConstants.className; import static jdk.nashorn.internal.codegen.CompilerConstants.methodDescriptor; import static jdk.nashorn.internal.codegen.CompilerConstants.typeDescriptor; import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup; - import java.io.ByteArrayOutputStream; import java.io.PrintWriter; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.Collections; import java.util.EnumSet; import java.util.HashSet; import java.util.Set; - import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.org.objectweb.asm.util.TraceClassVisitor; @@ -160,8 +159,12 @@ public class ClassEmitter implements Emitter { this.methodNames = new HashSet<>(); } + /** + * Return the method names encountered + * @return method names + */ public Set getMethodNames() { - return methodNames; + return Collections.unmodifiableSet(methodNames); } /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java index d45a58f1c0b..2d3cd2bed25 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java @@ -60,6 +60,10 @@ public final class CompileUnit implements Comparable { emittedUnitCount++; } + /** + * Get the amount of emitted compile units so far in the system + * @return emitted compile unit count + */ public static int getEmittedUnitCount() { return emittedUnitCount; } @@ -72,6 +76,10 @@ public final class CompileUnit implements Comparable { return isUsed; } + /** + * Check if a compile unit has code, not counting inits and clinits + * @return true of if there is "real code" in the compile unit + */ public boolean hasCode() { return (classEmitter.getMethodCount() - classEmitter.getInitCount() - classEmitter.getClinitCount()) > 0; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java index 2bd4c4c5452..c1af31b5c22 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java @@ -71,7 +71,6 @@ import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup import static jdk.nashorn.internal.codegen.ObjectClassGenerator.PRIMITIVE_FIELD_TYPE; import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.CALLSITE_OPTIMISTIC; import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.CALLSITE_PROGRAM_POINT_SHIFT; - import java.io.PrintStream; import java.lang.reflect.Array; import java.util.Collection; @@ -99,13 +98,13 @@ import jdk.nashorn.internal.ir.LocalVariableConversion; import jdk.nashorn.internal.ir.RuntimeNode; import jdk.nashorn.internal.ir.Symbol; import jdk.nashorn.internal.ir.TryNode; -import jdk.nashorn.internal.objects.Global; import jdk.nashorn.internal.runtime.ArgumentSetter; import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.Debug; import jdk.nashorn.internal.runtime.JSType; import jdk.nashorn.internal.runtime.RewriteException; import jdk.nashorn.internal.runtime.ScriptObject; +import jdk.nashorn.internal.runtime.ScriptRuntime; import jdk.nashorn.internal.runtime.UnwarrantedOptimismException; import jdk.nashorn.internal.runtime.linker.Bootstrap; import jdk.nashorn.internal.runtime.logging.DebugLogger; @@ -180,9 +179,6 @@ public class MethodEmitter implements Emitter { /** Bootstrap for array populators */ private static final Handle POPULATE_ARRAY_BOOTSTRAP = new Handle(H_INVOKESTATIC, RewriteException.BOOTSTRAP.className(), RewriteException.BOOTSTRAP.name(), RewriteException.BOOTSTRAP.descriptor()); - /** Bootstrap for global name invalidation */ - private static final Handle INVALIDATE_NAME_BOOTSTRAP = new Handle(H_INVOKESTATIC, Global.BOOTSTRAP.className(), Global.BOOTSTRAP.name(), Global.BOOTSTRAP.descriptor()); - /** * Constructor - internal use from ClassEmitter only * @see ClassEmitter#method @@ -2131,10 +2127,13 @@ public class MethodEmitter implements Emitter { } MethodEmitter invalidateSpecialName(final String name) { - //this is a nop if the global hasn't registered this as a special name - we can just ignore it - if (Global.instance().isSpecialName(name)) { - debug("dynamic_invalidate_name", "name=", name); - method.visitInvokeDynamicInsn(name, "()V", INVALIDATE_NAME_BOOTSTRAP); + switch (name) { + case "apply": + case "call": + debug("invalidate_name", "name=", name); + load("Function"); + invoke(ScriptRuntime.INVALIDATE_RESERVED_BUILTIN_NAME); + break; } return this; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java index 3c835ac539a..35308fc3a79 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java @@ -429,7 +429,6 @@ public final class OptimisticTypesPersistence { } private static void doCleanup() throws IOException { - final long start = System.nanoTime(); final Path[] files = getAllRegularFilesInLastModifiedOrder(); final int nFiles = files.length; final int filesToDelete = Math.max(0, nFiles - MAX_FILES); @@ -445,7 +444,6 @@ public final class OptimisticTypesPersistence { } files[i] = null; // gc eligible }; - final long duration = System.nanoTime() - start; } private static Path[] getAllRegularFilesInLastModifiedOrder() throws IOException { @@ -497,7 +495,7 @@ public final class OptimisticTypesPersistence { private static long getTime(final Path path) { try { return Files.getLastModifiedTime(path).toMillis(); - } catch (IOException e) { + } catch (final IOException e) { // All files for which we can't retrieve the last modified date will be considered oldest. return -1L; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java index b911f22272b..1bbc7ab0834 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java @@ -238,17 +238,21 @@ public final class FunctionNode extends LexicalContextExpression implements Flag * Note that even IS_STRICT is one such flag but that requires special handling. */ - // parser, lower debugging this function + /** parser, print parse tree */ public static final int IS_PRINT_PARSE = 1 << 18; + /** parser, print lower parse tree */ public static final int IS_PRINT_LOWER_PARSE = 1 << 19; + /** parser, print AST */ public static final int IS_PRINT_AST = 1 << 20; + /** parser, print lower AST */ public static final int IS_PRINT_LOWER_AST = 1 << 21; + /** parser, print symbols */ public static final int IS_PRINT_SYMBOLS = 1 << 22; + // callsite tracing, profiling within this function /** profile callsites in this function? */ public static final int IS_PROFILE = 1 << 23; - // callsite tracing, profiling within this function /** trace callsite enterexit in this function? */ public static final int IS_TRACE_ENTEREXIT = 1 << 24; @@ -337,7 +341,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag private FunctionNode( final FunctionNode functionNode, final long lastToken, - Object endParserState, + final Object endParserState, final int flags, final String name, final Type returnType, diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java index c6ede9467f1..42a9cf4c193 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java @@ -237,6 +237,10 @@ public abstract class LiteralNode extends Expression implements PropertyKey { return value; } + private static Expression[] valueToArray(final List value) { + return value.toArray(new Expression[value.size()]); + } + /** * Create a new null literal * @@ -981,10 +985,9 @@ public abstract class LiteralNode extends Expression implements PropertyKey { * @return the new literal node */ public static LiteralNode newInstance(final long token, final int finish, final List value) { - return new ArrayLiteralNode(token, finish, value.toArray(new Expression[value.size()])); + return new ArrayLiteralNode(token, finish, valueToArray(value)); } - /** * Create a new array literal based on a parent node (source, token, finish) * @@ -994,7 +997,7 @@ public abstract class LiteralNode extends Expression implements PropertyKey { * @return the new literal node */ public static LiteralNode newInstance(final Node parent, final List value) { - return new ArrayLiteralNode(parent.getToken(), parent.getFinish(), value.toArray(new Expression[value.size()])); + return new ArrayLiteralNode(parent.getToken(), parent.getFinish(), valueToArray(value)); } /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Symbol.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Symbol.java index c6e4a50f788..8d7acfbd804 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Symbol.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Symbol.java @@ -448,14 +448,25 @@ public final class Symbol implements Comparable { return (flags & IS_FUNCTION_SELF) != 0; } + /** + * Is this a block scoped symbol + * @return true if block scoped + */ public boolean isBlockScoped() { return isLet() || isConst(); } + /** + * Has this symbol been declared + * @return true if declared + */ public boolean hasBeenDeclared() { return (flags & HAS_BEEN_DECLARED) != 0; } + /** + * Mark this symbol as declared + */ public void setHasBeenDeclared() { if (!hasBeenDeclared()) { flags |= HAS_BEEN_DECLARED; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/MethodHandleFactory.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/MethodHandleFactory.java index 8ef13d794c0..06222159a02 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/MethodHandleFactory.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/MethodHandleFactory.java @@ -116,6 +116,10 @@ public final class MethodHandleFactory { private static final String VOID_TAG = "[VOID]"; + private static void err(final String str) { + Context.getContext().getErr().println(str); + } + /** * Tracer that is applied before a value is returned from the traced function. It will output the return * value and its class @@ -124,13 +128,16 @@ public final class MethodHandleFactory { * @return return value unmodified */ static Object traceReturn(final DebugLogger logger, final Object value) { - if (logger.isEnabled()) { - final String str = " return" + - (VOID_TAG.equals(value) ? - ";" : - " " + stripName(value) + "; // [type=" + (value == null ? "null]" : stripName(value.getClass()) + ']')); + final String str = " return" + + (VOID_TAG.equals(value) ? + ";" : + " " + stripName(value) + "; // [type=" + (value == null ? "null]" : stripName(value.getClass()) + ']')); + if (logger == null) { + err(str); + } else if (logger.isEnabled()) { logger.log(TRACE_LEVEL, str); } + return value; } @@ -169,8 +176,11 @@ public final class MethodHandleFactory { } } - assert logger != null; - logger.log(TRACE_LEVEL, sb); + if (logger == null) { + err(sb.toString()); + } else { + logger.log(TRACE_LEVEL, sb); + } stacktrace(logger); } @@ -181,7 +191,12 @@ public final class MethodHandleFactory { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final PrintStream ps = new PrintStream(baos); new Throwable().printStackTrace(ps); - logger.log(TRACE_LEVEL, baos.toString()); + final String st = baos.toString(); + if (logger == null) { + err(st); + } else { + logger.log(TRACE_LEVEL, st); + } } private static String argString(final Object arg) { @@ -201,12 +216,24 @@ public final class MethodHandleFactory { if (arg instanceof ScriptObject) { return arg.toString() + " (map=" + Debug.id(((ScriptObject)arg).getMap()) + - ")"; + ')'; } return arg.toString(); } + /** + * Add a debug printout to a method handle, tracing parameters and return values + * Output will be unconditional to stderr + * + * @param mh method handle to trace + * @param tag start of trace message + * @return traced method handle + */ + public static MethodHandle addDebugPrintout(final MethodHandle mh, final Object tag) { + return addDebugPrintout(null, Level.OFF, mh, 0, true, tag); + } + /** * Add a debug printout to a method handle, tracing parameters and return values * @@ -221,6 +248,20 @@ public final class MethodHandleFactory { } /** + * Add a debug printout to a method handle, tracing parameters and return values + * Output will be unconditional to stderr + * + * @param mh method handle to trace + * @param paramStart first param to print/trace + * @param printReturnValue should we print/trace return value if available? + * @param tag start of trace message + * @return traced method handle + */ + public static MethodHandle addDebugPrintout(final MethodHandle mh, final int paramStart, final boolean printReturnValue, final Object tag) { + return addDebugPrintout(null, Level.OFF, mh, paramStart, printReturnValue, tag); + } + + /** * Add a debug printout to a method handle, tracing parameters and return values * * @param logger a specific logger to which to write the output @@ -240,7 +281,6 @@ public final class MethodHandleFactory { return mh; } - assert logger != null; assert TRACE != null; MethodHandle trace = MethodHandles.insertArguments(TRACE, 0, logger, tag, paramStart); @@ -427,6 +467,12 @@ public final class MethodHandleFactory { return debug(mh, "constant", type, value); } + @Override + public MethodHandle identity(final Class type) { + final MethodHandle mh = MethodHandles.identity(type); + return debug(mh, "identity", type); + } + @Override public MethodHandle asCollector(final MethodHandle handle, final Class arrayType, final int arrayLength) { final MethodHandle mh = handle.asCollector(arrayType, arrayLength); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/MethodHandleFunctionality.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/MethodHandleFunctionality.java index 756c0b7bd1c..beaa85c2c87 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/MethodHandleFunctionality.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/MethodHandleFunctionality.java @@ -172,6 +172,15 @@ public interface MethodHandleFunctionality { */ public MethodHandle constant(Class type, Object value); + /** + * Wrapper for {@link java.lang.invoke.MethodHandles#identity(Class)} + * + * @param type type of value + * + * @return method handle that returns identity argument + */ + public MethodHandle identity(Class type); + /** * Wrapper for {@link java.lang.invoke.MethodHandle#asType(MethodType)} * diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java index 93506c37148..efcc3ddcf60 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java @@ -31,6 +31,7 @@ import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_ import java.nio.ByteBuffer; import java.nio.ByteOrder; + import jdk.internal.dynalink.CallSiteDescriptor; import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.internal.dynalink.linker.LinkRequest; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java index b8ec90fd0ad..0f6490c2da3 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java @@ -25,23 +25,19 @@ package jdk.nashorn.internal.objects; -import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall; import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; - import java.io.IOException; import java.io.PrintWriter; -import java.lang.invoke.CallSite; -import java.lang.invoke.ConstantCallSite; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; import java.lang.invoke.SwitchPoint; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; @@ -52,8 +48,6 @@ import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.internal.dynalink.linker.LinkRequest; import jdk.nashorn.api.scripting.ClassFilter; import jdk.nashorn.api.scripting.ScriptObjectMirror; -import jdk.nashorn.internal.codegen.ApplySpecialization; -import jdk.nashorn.internal.codegen.CompilerConstants.Call; import jdk.nashorn.internal.lookup.Lookup; import jdk.nashorn.internal.objects.annotations.Attribute; import jdk.nashorn.internal.objects.annotations.Property; @@ -72,6 +66,7 @@ import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.ScriptRuntime; import jdk.nashorn.internal.runtime.ScriptingFunctions; +import jdk.nashorn.internal.runtime.Specialization; import jdk.nashorn.internal.runtime.arrays.ArrayData; import jdk.nashorn.internal.runtime.linker.Bootstrap; import jdk.nashorn.internal.runtime.linker.InvokeByName; @@ -107,10 +102,6 @@ public final class Global extends ScriptObject implements Scope { * it's when you start adding property checks for said builtins you have * problems with guard speed. */ - public final Map optimisticFunctionMap; - - /** Name invalidator for things like call/apply */ - public static final Call BOOTSTRAP = staticCall(MethodHandles.lookup(), Global.class, "invalidateNameBootstrap", CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class); /** Nashorn extension: arguments array */ @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE) @@ -428,9 +419,6 @@ public final class Global extends ScriptObject implements Scope { private static final MethodHandle LOADWITHNEWGLOBAL = findOwnMH_S("loadWithNewGlobal", Object.class, Object.class, Object[].class); private static final MethodHandle EXIT = findOwnMH_S("exit", Object.class, Object.class, Object.class); - /** Invalidate a reserved name, such as "apply" or "call" if assigned */ - public MethodHandle INVALIDATE_RESERVED_NAME = MH.bindTo(findOwnMH_V("invalidateReservedName", void.class, String.class), this); - // initialized by nasgen private static PropertyMap $nasgenmap$; @@ -482,7 +470,6 @@ public final class Global extends ScriptObject implements Scope { super(checkAndGetMap(context)); this.context = context; this.setIsScope(); - this.optimisticFunctionMap = new HashMap<>(); //we can only share one instance of Global constants between globals, or we consume way too much //memory - this is good enough for most programs while (gcsInstance.get() == null) { @@ -1244,6 +1231,40 @@ public final class Global extends ScriptObject implements Scope { return instance.function == instance.getBuiltinFunction(); } + /** + * Get the switchpoint used to check property changes for Function.prototype.apply + * @return the switchpoint guarding apply (same as guarding call, and everything else in function) + */ + public static SwitchPoint getBuiltinFunctionApplySwitchPoint() { + return ScriptFunction.getPrototype(Global.instance().getBuiltinFunction()).getProperty("apply").getBuiltinSwitchPoint(); + } + + private static boolean isBuiltinFunctionProperty(final String name) { + final Global instance = Global.instance(); + final ScriptFunction builtinFunction = instance.getBuiltinFunction(); + if (builtinFunction == null) { + return false; //conservative for compile-only mode + } + final boolean isBuiltinFunction = instance.function == builtinFunction; + return isBuiltinFunction && ScriptFunction.getPrototype(builtinFunction).getProperty(name).isBuiltin(); + } + + /** + * Check if the Function.prototype.apply has not been replaced + * @return true if Function.prototype.apply has been replaced + */ + public static boolean isBuiltinFunctionPrototypeApply() { + return isBuiltinFunctionProperty("apply"); + } + + /** + * Check if the Function.prototype.apply has not been replaced + * @return true if Function.prototype.call has been replaced + */ + public static boolean isBuiltinFunctionPrototypeCall() { + return isBuiltinFunctionProperty("call"); + } + private ScriptFunction getBuiltinJSAdapter() { return builtinJSAdapter; } @@ -1688,6 +1709,12 @@ public final class Global extends ScriptObject implements Scope { splitState = state; } + private T initConstructorAndSwitchPoint(final String name, final Class clazz) { + final T func = initConstructor(name, clazz); + tagBuiltinProperties(name, func); + return func; + } + private void init(final ScriptEngine engine) { assert Context.getGlobal() == this : "this global is not set as current"; @@ -1702,8 +1729,19 @@ public final class Global extends ScriptObject implements Scope { // initialize global function properties this.eval = this.builtinEval = ScriptFunctionImpl.makeFunction("eval", EVAL); - this.parseInt = ScriptFunctionImpl.makeFunction("parseInt", GlobalFunctions.PARSEINT, - new MethodHandle[] { GlobalFunctions.PARSEINT_OI, GlobalFunctions.PARSEINT_O }); + this.parseInt = ScriptFunctionImpl.makeFunction("parseInt", GlobalFunctions.PARSEINT, + new Specialization[] { + new Specialization(GlobalFunctions.PARSEINT_Z), + new Specialization(GlobalFunctions.PARSEINT_I), + new Specialization(GlobalFunctions.PARSEINT_J), + new Specialization(GlobalFunctions.PARSEINT_OI), + new Specialization(GlobalFunctions.PARSEINT_O) }); + this.parseFloat = ScriptFunctionImpl.makeFunction("parseFloat", GlobalFunctions.PARSEFLOAT); + this.isNaN = ScriptFunctionImpl.makeFunction("isNaN", GlobalFunctions.IS_NAN, + new Specialization[] { + new Specialization(GlobalFunctions.IS_NAN_I), + new Specialization(GlobalFunctions.IS_NAN_J), + new Specialization(GlobalFunctions.IS_NAN_D) }); this.parseFloat = ScriptFunctionImpl.makeFunction("parseFloat", GlobalFunctions.PARSEFLOAT); this.isNaN = ScriptFunctionImpl.makeFunction("isNaN", GlobalFunctions.IS_NAN); this.isFinite = ScriptFunctionImpl.makeFunction("isFinite", GlobalFunctions.IS_FINITE); @@ -1720,15 +1758,15 @@ public final class Global extends ScriptObject implements Scope { this.quit = ScriptFunctionImpl.makeFunction("quit", EXIT); // built-in constructors - this.builtinArray = initConstructor("Array", ScriptFunction.class); - this.builtinBoolean = initConstructor("Boolean", ScriptFunction.class); - this.builtinDate = initConstructor("Date", ScriptFunction.class); - this.builtinJSON = initConstructor("JSON", ScriptObject.class); - this.builtinJSAdapter = initConstructor("JSAdapter", ScriptFunction.class); - this.builtinMath = initConstructor("Math", ScriptObject.class); - this.builtinNumber = initConstructor("Number", ScriptFunction.class); - this.builtinRegExp = initConstructor("RegExp", ScriptFunction.class); - this.builtinString = initConstructor("String", ScriptFunction.class); + this.builtinArray = initConstructorAndSwitchPoint("Array", ScriptFunction.class); + this.builtinBoolean = initConstructorAndSwitchPoint("Boolean", ScriptFunction.class); + this.builtinDate = initConstructorAndSwitchPoint("Date", ScriptFunction.class); + this.builtinJSON = initConstructorAndSwitchPoint("JSON", ScriptObject.class); + this.builtinJSAdapter = initConstructorAndSwitchPoint("JSAdapter", ScriptFunction.class); + this.builtinMath = initConstructorAndSwitchPoint("Math", ScriptObject.class); + this.builtinNumber = initConstructorAndSwitchPoint("Number", ScriptFunction.class); + this.builtinRegExp = initConstructorAndSwitchPoint("RegExp", ScriptFunction.class); + this.builtinString = initConstructorAndSwitchPoint("String", ScriptFunction.class); // initialize String.prototype.length to 0 // add String.prototype.length @@ -1830,6 +1868,8 @@ public final class Global extends ScriptObject implements Scope { // Error.prototype.message = ""; errorProto.set(NativeError.MESSAGE, "", 0); + tagBuiltinProperties("Error", builtinError); + this.builtinEvalError = initErrorSubtype("EvalError", errorProto); this.builtinRangeError = initErrorSubtype("RangeError", errorProto); this.builtinReferenceError = initErrorSubtype("ReferenceError", errorProto); @@ -1844,6 +1884,7 @@ public final class Global extends ScriptObject implements Scope { prototype.set(NativeError.NAME, name, 0); prototype.set(NativeError.MESSAGE, "", 0); prototype.setInitialProto(errorProto); + tagBuiltinProperties(name, cons); return cons; } @@ -1910,17 +1951,18 @@ public final class Global extends ScriptObject implements Scope { } private void initTypedArray() { - this.builtinArrayBuffer = initConstructor("ArrayBuffer", ScriptFunction.class); - this.builtinDataView = initConstructor("DataView", ScriptFunction.class); - this.builtinInt8Array = initConstructor("Int8Array", ScriptFunction.class); - this.builtinUint8Array = initConstructor("Uint8Array", ScriptFunction.class); - this.builtinUint8ClampedArray = initConstructor("Uint8ClampedArray", ScriptFunction.class); - this.builtinInt16Array = initConstructor("Int16Array", ScriptFunction.class); - this.builtinUint16Array = initConstructor("Uint16Array", ScriptFunction.class); - this.builtinInt32Array = initConstructor("Int32Array", ScriptFunction.class); - this.builtinUint32Array = initConstructor("Uint32Array", ScriptFunction.class); - this.builtinFloat32Array = initConstructor("Float32Array", ScriptFunction.class); - this.builtinFloat64Array = initConstructor("Float64Array", ScriptFunction.class); + this.builtinArrayBuffer = initConstructorAndSwitchPoint("ArrayBuffer", ScriptFunction.class); + this.builtinDataView = initConstructorAndSwitchPoint("DataView", ScriptFunction.class); + this.builtinInt8Array = initConstructorAndSwitchPoint("Int8Array", ScriptFunction.class); + this.builtinUint8Array = initConstructorAndSwitchPoint("Uint8Array", ScriptFunction.class); + this.builtinUint8ClampedArray = initConstructorAndSwitchPoint("Uint8ClampedArray", ScriptFunction.class); + this.builtinInt16Array = initConstructorAndSwitchPoint("Int16Array", ScriptFunction.class); + this.builtinUint16Array = initConstructorAndSwitchPoint("Uint16Array", ScriptFunction.class); + this.builtinInt32Array = initConstructorAndSwitchPoint("Int32Array", ScriptFunction.class); + this.builtinUint32Array = initConstructorAndSwitchPoint("Uint32Array", ScriptFunction.class); + this.builtinFloat32Array = initConstructorAndSwitchPoint("Float32Array", ScriptFunction.class); + this.builtinFloat64Array = initConstructorAndSwitchPoint("Float64Array", ScriptFunction.class); + } private void copyBuiltins() { @@ -1993,10 +2035,6 @@ public final class Global extends ScriptObject implements Scope { return UNDEFINED; } - /** - * These classes are generated by nasgen tool and so we have to use - * reflection to load and create new instance of these classes. - */ private T initConstructor(final String name, final Class clazz) { try { // Assuming class name pattern for built-in JS constructors. @@ -2021,12 +2059,52 @@ public final class Global extends ScriptObject implements Scope { } res.setIsBuiltin(); + return res; } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new RuntimeException(e); } } + private List extractBuiltinProperties(final String name, final ScriptObject func) { + final List list = new ArrayList<>(); + + list.addAll(Arrays.asList(func.getMap().getProperties())); + + if (func instanceof ScriptFunction) { + final ScriptObject proto = ScriptFunction.getPrototype((ScriptFunction)func); + if (proto != null) { + list.addAll(Arrays.asList(proto.getMap().getProperties())); + } + } + + final jdk.nashorn.internal.runtime.Property prop = getProperty(name); + if (prop != null) { + list.add(prop); + } + + return list; + } + + /** + * Given a builtin object, traverse its properties recursively and associate them with a name that + * will be a key to their invalidation switchpoint. + * @param name name for key + * @param func builtin script object + */ + private void tagBuiltinProperties(final String name, final ScriptObject func) { + SwitchPoint sp = context.getBuiltinSwitchPoint(name); + if (sp == null) { + sp = context.newBuiltinSwitchPoint(name); + } + + //get all builtin properties in this builtin object and register switchpoints keyed on the propery name, + //one overwrite destroys all for now, e.g. Function.prototype.apply = 17; also destroys Function.prototype.call etc + for (final jdk.nashorn.internal.runtime.Property prop : extractBuiltinProperties(name, func)) { + prop.setBuiltinSwitchPoint(sp); + } + } + // Function and Object constructors are inter-dependent. Also, // Function.prototype // functions are not properly initialized. We fix the references here. @@ -2035,7 +2113,8 @@ public final class Global extends ScriptObject implements Scope { // to play with object references carefully!! private void initFunctionAndObject() { // First-n-foremost is Function - this.builtinFunction = initConstructor("Function", ScriptFunction.class); + + this.builtinFunction = initConstructor("Function", ScriptFunction.class); // create global anonymous function final ScriptFunction anon = ScriptFunctionImpl.newAnonymousFunction(); @@ -2101,13 +2180,6 @@ public final class Global extends ScriptObject implements Scope { } } - //make sure apply and call have the same invalidation switchpoint - final SwitchPoint sp = new SwitchPoint(); - optimisticFunctionMap.put("apply", sp); - optimisticFunctionMap.put("call", sp); - getFunctionPrototype().getProperty("apply").setChangeCallback(sp); - getFunctionPrototype().getProperty("call").setChangeCallback(sp); - properties = getObjectPrototype().getMap().getProperties(); for (final jdk.nashorn.internal.runtime.Property property : properties) { @@ -2125,10 +2197,10 @@ public final class Global extends ScriptObject implements Scope { } } } - } - private static MethodHandle findOwnMH_V(final String name, final Class rtype, final Class... types) { - return MH.findVirtual(MethodHandles.lookup(), Global.class, name, MH.type(rtype, types)); + tagBuiltinProperties("Object", builtinObject); + tagBuiltinProperties("Function", builtinFunction); + tagBuiltinProperties("Function", anon); } private static MethodHandle findOwnMH_S(final String name, final Class rtype, final Class... types) { @@ -2147,62 +2219,4 @@ public final class Global extends ScriptObject implements Scope { protected boolean isGlobal() { return true; } - - /** - * Check if there is a switchpoint for a reserved name. If there - * is, it must be invalidated upon properties with this name - * @param name property name - * @return switchpoint for invalidating this property, or null if not registered - */ - public SwitchPoint getChangeCallback(final String name) { - return optimisticFunctionMap.get(name); - } - - /** - * Is this a special name, that might be subject to invalidation - * on write, such as "apply" or "call" - * @param name name to check - * @return true if special name - */ - public boolean isSpecialName(final String name) { - return getChangeCallback(name) != null; - } - - /** - * Check if a reserved property name is invalidated - * @param name property name - * @return true if someone has written to it since Global was instantiated - */ - public boolean isSpecialNameValid(final String name) { - final SwitchPoint sp = getChangeCallback(name); - return sp != null && !sp.hasBeenInvalidated(); - } - - /** - * Tag a reserved name as invalidated - used when someone writes - * to a property with this name - overly conservative, but link time - * is too late to apply e.g. apply->call specialization - * @param name property name - */ - public void invalidateReservedName(final String name) { - final SwitchPoint sp = getChangeCallback(name); - if (sp != null) { - getContext().getLogger(ApplySpecialization.class).info("Overwrote special name '" + name +"' - invalidating switchpoint"); - SwitchPoint.invalidateAll(new SwitchPoint[] { sp }); - } - } - - /** - * Bootstrapper for invalidating a builtin name - * @param lookup lookup - * @param name name to invalidate - * @param type methodhandle type - * @return callsite for invalidator - */ - public static CallSite invalidateNameBootstrap(final MethodHandles.Lookup lookup, final String name, final MethodType type) { - final MethodHandle target = MH.insertArguments(Global.instance().INVALIDATE_RESERVED_NAME, 0, name); - return new ConstantCallSite(target); - } - - } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java index 163e86a45cf..c0fd1669cdc 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2014, 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 @@ -33,8 +33,8 @@ import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex; import static jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator.arrayLikeIterator; import static jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator.reverseArrayLikeIterator; import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.CALLSITE_STRICT; - import java.lang.invoke.MethodHandle; +import java.lang.invoke.SwitchPoint; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -52,12 +52,13 @@ import jdk.nashorn.internal.objects.annotations.Function; import jdk.nashorn.internal.objects.annotations.Getter; import jdk.nashorn.internal.objects.annotations.ScriptClass; import jdk.nashorn.internal.objects.annotations.Setter; -import jdk.nashorn.internal.objects.annotations.SpecializedConstructor; import jdk.nashorn.internal.objects.annotations.SpecializedFunction; +import jdk.nashorn.internal.objects.annotations.SpecializedFunction.LinkLogic; import jdk.nashorn.internal.objects.annotations.Where; import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.Debug; import jdk.nashorn.internal.runtime.JSType; +import jdk.nashorn.internal.runtime.OptimisticBuiltins; import jdk.nashorn.internal.runtime.PropertyDescriptor; import jdk.nashorn.internal.runtime.PropertyMap; import jdk.nashorn.internal.runtime.ScriptFunction; @@ -67,17 +68,20 @@ import jdk.nashorn.internal.runtime.Undefined; import jdk.nashorn.internal.runtime.arrays.ArrayData; import jdk.nashorn.internal.runtime.arrays.ArrayIndex; import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator; +import jdk.nashorn.internal.runtime.arrays.ContinuousArrayData; +import jdk.nashorn.internal.runtime.arrays.IntElements; +import jdk.nashorn.internal.runtime.arrays.IntOrLongElements; import jdk.nashorn.internal.runtime.arrays.IteratorAction; +import jdk.nashorn.internal.runtime.arrays.NumericElements; import jdk.nashorn.internal.runtime.linker.Bootstrap; import jdk.nashorn.internal.runtime.linker.InvokeByName; -import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor; /** * Runtime representation of a JavaScript array. NativeArray only holds numeric * keyed values. All other values are stored in spill. */ @ScriptClass("Array") -public final class NativeArray extends ScriptObject { +public final class NativeArray extends ScriptObject implements OptimisticBuiltins { private static final Object JOIN = new Object(); private static final Object EVERY_CALLBACK_INVOKER = new Object(); private static final Object SOME_CALLBACK_INVOKER = new Object(); @@ -88,6 +92,16 @@ public final class NativeArray extends ScriptObject { private static final Object CALL_CMP = new Object(); private static final Object TO_LOCALE_STRING = new Object(); + private SwitchPoint lengthMadeNotWritableSwitchPoint; + private PushLinkLogic pushLinkLogic; + private PopLinkLogic popLinkLogic; + + /** + * Index for the modification SwitchPoint that triggers when length + * becomes not writable + */ + private static final int LENGTH_NOT_WRITABLE_SWITCHPOINT = 0; + /* * Constructors. */ @@ -420,6 +434,28 @@ public final class NativeArray extends ScriptObject { return getArray().asObjectArray(); } + @Override + public void setIsLengthNotWritable() { + super.setIsLengthNotWritable(); + /* + * Switchpoints are created lazily. If we link any push or pop site, + * we need to create the "length made not writable" switchpoint, if it + * doesn't exist. + * + * If the switchpoint already exists, we will find it here, and invalidate + * it, invalidating all previous callsites that use it. + * + * If the switchpoint doesn't exist, no push/pop has been linked so far, + * because that would create it too. We invalidate it immediately and the + * check link logic for all future callsites will fail immediately at link + * time + */ + if (lengthMadeNotWritableSwitchPoint == null) { + lengthMadeNotWritableSwitchPoint = new SwitchPoint(); + } + SwitchPoint.invalidateAll(new SwitchPoint[] { lengthMadeNotWritableSwitchPoint }); + } + /** * ECMA 15.4.3.2 Array.isArray ( arg ) * @@ -638,7 +674,7 @@ public final class NativeArray extends ScriptObject { * @param self self reference * @return the new NativeArray */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static NativeArray construct(final boolean newObj, final Object self) { return new NativeArray(0); } @@ -653,7 +689,7 @@ public final class NativeArray extends ScriptObject { * @param element first element * @return the new NativeArray */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static Object construct(final boolean newObj, final Object self, final boolean element) { return new NativeArray(new Object[] { element }); } @@ -668,7 +704,7 @@ public final class NativeArray extends ScriptObject { * @param length array length * @return the new NativeArray */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static NativeArray construct(final boolean newObj, final Object self, final int length) { if (length >= 0) { return new NativeArray(length); @@ -687,7 +723,7 @@ public final class NativeArray extends ScriptObject { * @param length array length * @return the new NativeArray */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static NativeArray construct(final boolean newObj, final Object self, final long length) { if (length >= 0L && length <= JSType.MAX_UINT) { return new NativeArray(length); @@ -706,7 +742,7 @@ public final class NativeArray extends ScriptObject { * @param length array length * @return the new NativeArray */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static NativeArray construct(final boolean newObj, final Object self, final double length) { final long uint32length = JSType.toUint32(length); @@ -721,7 +757,7 @@ public final class NativeArray extends ScriptObject { * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] ) * * @param self self reference - * @param args arguments to concat + * @param args arguments * @return resulting NativeArray */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) @@ -792,6 +828,68 @@ public final class NativeArray extends ScriptObject { return sb.toString(); } + /** + * Specialization of pop for ContinuousArrayData + * The link guard checks that the array is continuous AND not empty. + * The runtime guard checks that the guard is continuous (CCE otherwise) + * + * Primitive specialization, {@link LinkLogic} + * + * @param self self reference + * @return element popped + * @throws ClassCastException if array is empty, facilitating Undefined return value + */ + @SpecializedFunction(name="pop", linkLogic=PopLinkLogic.class) + public static int popInt(final Object self) { + //must be non empty IntArrayData + return getContinuousNonEmptyArrayDataCCE(self, IntElements.class).fastPopInt(); + } + + /** + * Specialization of pop for ContinuousArrayData + * + * Primitive specialization, {@link LinkLogic} + * + * @param self self reference + * @return element popped + * @throws ClassCastException if array is empty, facilitating Undefined return value + */ + @SpecializedFunction(name="pop", linkLogic=PopLinkLogic.class) + public static long popLong(final Object self) { + //must be non empty Int or LongArrayData + return getContinuousNonEmptyArrayDataCCE(self, IntOrLongElements.class).fastPopLong(); + } + + /** + * Specialization of pop for ContinuousArrayData + * + * Primitive specialization, {@link LinkLogic} + * + * @param self self reference + * @return element popped + * @throws ClassCastException if array is empty, facilitating Undefined return value + */ + @SpecializedFunction(name="pop", linkLogic=PopLinkLogic.class) + public static double popDouble(final Object self) { + //must be non empty int long or double array data + return getContinuousNonEmptyArrayDataCCE(self, NumericElements.class).fastPopDouble(); + } + + /** + * Specialization of pop for ContinuousArrayData + * + * Primitive specialization, {@link LinkLogic} + * + * @param self self reference + * @return element popped + * @throws ClassCastException if array is empty, facilitating Undefined return value + */ + @SpecializedFunction(name="pop", linkLogic=PopLinkLogic.class) + public static Object popObject(final Object self) { + //can be any data, because the numeric ones will throw cce and force relink + return getContinuousArrayDataCCE(self, null).fastPopObject(); + } + /** * ECMA 15.4.4.6 Array.prototype.pop () * @@ -826,6 +924,62 @@ public final class NativeArray extends ScriptObject { } } + /** + * ECMA 15.4.4.7 Array.prototype.push (args...) + * + * Primitive specialization, {@link LinkLogic} + * + * @param self self reference + * @param arg a primitive to push + * @return array length after push + */ + @SpecializedFunction(linkLogic=PushLinkLogic.class) + public static long push(final Object self, final int arg) { + return getContinuousArrayDataCCE(self, Integer.class).fastPush(arg); + } + + /** + * ECMA 15.4.4.7 Array.prototype.push (args...) + * + * Primitive specialization, {@link LinkLogic} + * + * @param self self reference + * @param arg a primitive to push + * @return array length after push + */ + @SpecializedFunction(linkLogic=PushLinkLogic.class) + public static long push(final Object self, final long arg) { + return getContinuousArrayDataCCE(self, Long.class).fastPush(arg); + } + + /** + * ECMA 15.4.4.7 Array.prototype.push (args...) + * + * Primitive specialization, {@link LinkLogic} + * + * @param self self reference + * @param arg a primitive to push + * @return array length after push + */ + @SpecializedFunction(linkLogic=PushLinkLogic.class) + public static long push(final Object self, final double arg) { + return getContinuousArrayDataCCE(self, Double.class).fastPush(arg); + } + + /** + * ECMA 15.4.4.7 Array.prototype.push (args...) + * + * Primitive specialization, {@link LinkLogic} + * + * @param self self reference + * @param arg a primitive to push + * @return array length after push + */ + @SpecializedFunction(name="push", linkLogic=PushLinkLogic.class) + public static long pushObject(final Object self, final Object arg) { + return getContinuousArrayDataCCE(self, Object.class).fastPush(arg); + } + /** * ECMA 15.4.4.7 Array.prototype.push (args...) * @@ -856,61 +1010,6 @@ public final class NativeArray extends ScriptObject { } } - /** - * ECMA 15.4.4.7 Array.prototype.push (args...) specialized for single int argument - * - * @param self self reference - * @param arg argument to push - * @return array after pushes - */ -/* @SpecializedFunction - public static long push(final Object self, final int arg) { - try { - final ScriptObject sobj = (ScriptObject)self; - final ArrayData arrayData = sobj.getArray(); - final long length = arrayData.length(); - - if (bulkable(sobj) && length + 1 <= JSType.MAX_UINT) { - sobj.setArray(arrayData.ensure(length).set(ArrayIndex.getArrayIndex(length), arg, true)); - return length + 1; - } - - long len = JSType.toUint32(sobj.getLength()); - sobj.set(len++, arg, true); - sobj.set("length", len, true); - return len; - } catch (final ClassCastException | NullPointerException e) { - throw typeError("not.an.object", ScriptRuntime.safeToString(self)); - } - } -*/ - /** - * ECMA 15.4.4.7 Array.prototype.push (args...) specialized for single number argument - * - * @param self self reference - * @param arg argument to push - * @return array after pushes - */ - /* @SpecializedFunction - public static long push(final Object self, final double arg) { - try { - final ScriptObject sobj = (ScriptObject)self; final ArrayData arrayData = sobj.getArray(); - final long length = arrayData.length(); - - if (bulkable(sobj) && length + 1 <= JSType.MAX_UINT) { - sobj.setArray(arrayData.ensure(length).set(ArrayIndex.getArrayIndex(length), arg, true)); - return length + 1; - } - - long len = JSType.toUint32(sobj.getLength()); - sobj.set(len++, arg, true); - sobj.set("length", len, true); - return len; - } catch (final ClassCastException | NullPointerException e) { - throw typeError("not.an.object", ScriptRuntime.safeToString(self)); - } - } -*/ /** * ECMA 15.4.4.7 Array.prototype.push (args...) specialized for single object argument * @@ -925,7 +1024,7 @@ public final class NativeArray extends ScriptObject { final ArrayData arrayData = sobj.getArray(); final long length = arrayData.length(); if (bulkable(sobj) && length < JSType.MAX_UINT) { - sobj.setArray(arrayData.push(true, arg)); //ensure(length).set(ArrayIndex.getArrayIndex(length), arg, true)); + sobj.setArray(arrayData.push(true, arg)); return length + 1; } @@ -1584,6 +1683,192 @@ public final class NativeArray extends ScriptObject { @Override public String toString() { - return "NativeArray@" + Debug.id(this) + '@' + getArray().getClass().getSimpleName(); + return "NativeArray@" + Debug.id(this) + " [" + getArray().getClass().getSimpleName() + ']'; + } + + @Override + public SpecializedFunction.LinkLogic getLinkLogic(final Class clazz) { + if (clazz == PushLinkLogic.class) { + return pushLinkLogic == null ? new PushLinkLogic(this) : pushLinkLogic; + } else if (clazz == PopLinkLogic.class) { + return popLinkLogic == null ? new PopLinkLogic(this) : pushLinkLogic; + } + return null; + } + + @Override + public boolean hasPerInstanceAssumptions() { + return true; //length switchpoint + } + + /** + * This is an abstract super class that contains common functionality for all + * specialized optimistic builtins in NativeArray. For example, it handles the + * modification switchpoint which is touched when length is written. + */ + private static abstract class ArrayLinkLogic extends SpecializedFunction.LinkLogic { + private final NativeArray array; + + protected ArrayLinkLogic(final NativeArray array) { + this.array = array; + } + + private SwitchPoint getSwitchPoint() { + return array.lengthMadeNotWritableSwitchPoint; + } + + private SwitchPoint newSwitchPoint() { + assert array.lengthMadeNotWritableSwitchPoint == null; + final SwitchPoint sp = new SwitchPoint(); + array.lengthMadeNotWritableSwitchPoint = sp; + return sp; + } + + protected static ContinuousArrayData getContinuousArrayData(final Object self) { + try { + //cast to NativeArray, to avoid cases like x = {0:0, 1:1}, x.length = 2, where we can't use the array push/pop + return (ContinuousArrayData)((NativeArray)self).getArray(); + } catch (final Exception e) { + return null; + } + } + + /** + * Push and pop callsites can throw ClassCastException as a mechanism to have them + * relinked - this enabled fast checks of the kind of ((IntArrayData)arrayData).push(x) + * for an IntArrayData only push - if this fails, a CCE will be thrown and we will relink + */ + @Override + public Class getRelinkException() { + return ClassCastException.class; + } + + @Override + public boolean hasModificationSwitchPoints() { + return getSwitchPoint() != null; + } + + @Override + public boolean hasModificationSwitchPoint(final int index) { + assert index == LENGTH_NOT_WRITABLE_SWITCHPOINT; + return hasModificationSwitchPoints(); + } + + @Override + public SwitchPoint getOrCreateModificationSwitchPoint(final int index) { + assert index == LENGTH_NOT_WRITABLE_SWITCHPOINT; + SwitchPoint sp = getSwitchPoint(); + if (sp == null) { + sp = newSwitchPoint(); + } + return sp; + } + + @Override + public SwitchPoint[] getOrCreateModificationSwitchPoints() { + return new SwitchPoint[] { getOrCreateModificationSwitchPoint(LENGTH_NOT_WRITABLE_SWITCHPOINT) }; + } + + @Override + public void invalidateModificationSwitchPoint(final int index) { + assert index == LENGTH_NOT_WRITABLE_SWITCHPOINT; + invalidateModificationSwitchPoints(); + } + + @Override + public void invalidateModificationSwitchPoints() { + final SwitchPoint sp = getSwitchPoint(); + assert sp != null : "trying to invalidate non-existant modified SwitchPoint"; + if (!sp.hasBeenInvalidated()) { + SwitchPoint.invalidateAll(new SwitchPoint[] { sp }); + } + } + + @Override + public boolean hasInvalidatedModificationSwitchPoint(final int index) { + assert index == LENGTH_NOT_WRITABLE_SWITCHPOINT; + return hasInvalidatedModificationSwitchPoints(); + } + + @Override + public boolean hasInvalidatedModificationSwitchPoints() { + final SwitchPoint sp = getSwitchPoint(); + return sp != null && !sp.hasBeenInvalidated(); + } + } + + /** + * This is linker logic for optimistic pushes + */ + private static final class PushLinkLogic extends ArrayLinkLogic { + private PushLinkLogic(final NativeArray array) { + super(array); + } + + @Override + public boolean canLink(final Object self, final CallSiteDescriptor desc, final LinkRequest request) { + return getContinuousArrayData(self) != null; + } + } + + /** + * This is linker logic for optimistic pops + */ + private static final class PopLinkLogic extends ArrayLinkLogic { + private PopLinkLogic(final NativeArray array) { + super(array); + } + + /** + * We need to check if we are dealing with a continuous non empty array data here, + * as pop with a primitive return value returns undefined for arrays with length 0 + */ + @Override + public boolean canLink(final Object self, final CallSiteDescriptor desc, final LinkRequest request) { + final ContinuousArrayData data = getContinuousNonEmptyArrayData(self); + if (data != null) { + final Class elementType = data.getElementType(); + final Class returnType = desc.getMethodType().returnType(); + final boolean typeFits = JSType.getAccessorTypeIndex(returnType) >= JSType.getAccessorTypeIndex(elementType); + return typeFits; + } + return false; + } + + private ContinuousArrayData getContinuousNonEmptyArrayData(final Object self) { + final ContinuousArrayData data = getContinuousArrayData(self); + if (data != null) { + return data.length() == 0 ? null : data; + } + return null; + } + } + + //runtime calls for push and pops. they could be used as guards, but they also perform the runtime logic, + //so rather than synthesizing them into a guard method handle that would also perform the push on the + //retrieved receiver, we use this as runtime logic + + //TODO - fold these into the Link logics, but I'll do that as a later step, as I want to do a checkin + //where everything works first + + private static final ContinuousArrayData getContinuousNonEmptyArrayDataCCE(final Object self, final Class clazz) { + try { + @SuppressWarnings("unchecked") + final ContinuousArrayData data = (ContinuousArrayData)(T)((NativeArray)self).getArray(); + if (data.length() != 0L) { + return data; //if length is 0 we cannot pop and have to relink, because then we'd have to return an undefined, which is a wider type than e.g. int + } + } catch (final NullPointerException e) { + //fallthru + } + throw new ClassCastException(); + } + + private static final ContinuousArrayData getContinuousArrayDataCCE(final Object self, final Class elementType) { + try { + return (ContinuousArrayData)((NativeArray)self).getArray(elementType); //ensure element type can fit "elementType" + } catch (final NullPointerException e) { + throw new ClassCastException(); + } } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDataView.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDataView.java index 470803ef811..0adde064abb 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDataView.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDataView.java @@ -27,7 +27,6 @@ package jdk.nashorn.internal.objects; import static jdk.nashorn.internal.runtime.ECMAErrors.rangeError; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; - import java.nio.ByteBuffer; import java.nio.ByteOrder; import jdk.nashorn.internal.objects.annotations.Attribute; @@ -35,7 +34,6 @@ import jdk.nashorn.internal.objects.annotations.Constructor; import jdk.nashorn.internal.objects.annotations.Function; import jdk.nashorn.internal.objects.annotations.Property; import jdk.nashorn.internal.objects.annotations.ScriptClass; -import jdk.nashorn.internal.objects.annotations.SpecializedConstructor; import jdk.nashorn.internal.objects.annotations.SpecializedFunction; import jdk.nashorn.internal.runtime.JSType; import jdk.nashorn.internal.runtime.PropertyMap; @@ -156,7 +154,7 @@ public class NativeDataView extends ScriptObject { * @param offset offset in bytes from the start of the ArrayBuffer * @return newly constructed DataView object */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static NativeDataView constructor(final boolean newObj, final Object self, final Object arrBuf, final int offset) { if (!(arrBuf instanceof NativeArrayBuffer)) { throw typeError("not.an.arraybuffer.in.dataview"); @@ -174,7 +172,7 @@ public class NativeDataView extends ScriptObject { * @param length is the number of bytes from the offset that this DataView will reference * @return newly constructed DataView object */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static NativeDataView constructor(final boolean newObj, final Object self, final Object arrBuf, final int offset, final int length) { if (!(arrBuf instanceof NativeArrayBuffer)) { throw typeError("not.an.arraybuffer.in.dataview"); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDate.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDate.java index eac59c46cc3..c85016a5938 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDate.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDate.java @@ -30,7 +30,6 @@ import static java.lang.Double.isInfinite; import static java.lang.Double.isNaN; import static jdk.nashorn.internal.runtime.ECMAErrors.rangeError; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; - import java.util.Locale; import java.util.TimeZone; import java.util.concurrent.Callable; @@ -38,7 +37,7 @@ import jdk.nashorn.internal.objects.annotations.Attribute; import jdk.nashorn.internal.objects.annotations.Constructor; import jdk.nashorn.internal.objects.annotations.Function; import jdk.nashorn.internal.objects.annotations.ScriptClass; -import jdk.nashorn.internal.objects.annotations.SpecializedConstructor; +import jdk.nashorn.internal.objects.annotations.SpecializedFunction; import jdk.nashorn.internal.objects.annotations.Where; import jdk.nashorn.internal.parser.DateParser; import jdk.nashorn.internal.runtime.ConsString; @@ -155,7 +154,7 @@ public final class NativeDate extends ScriptObject { * @param self self references * @return Date representing now */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static Object construct(final boolean isNew, final Object self) { final NativeDate result = new NativeDate(); return isNew ? result : toStringImpl(result, FORMAT_DATE_TIME); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java index b2639c458c0..049d8fa8142 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.objects; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.nio.ByteBuffer; @@ -84,6 +83,11 @@ public final class NativeFloat32Array extends ArrayBufferView { super(((FloatBuffer)nb.position(start).limit(end)).slice(), end - start); } + @Override + public Class getElementType() { + return double.class; + } + @Override protected MethodHandle getGetElem() { return GET_ELEM; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java index 93162952765..79268cc51a9 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.objects; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.nio.ByteBuffer; @@ -94,6 +93,11 @@ public final class NativeFloat64Array extends ArrayBufferView { return SET_ELEM; } + @Override + public Class getElementType() { + return double.class; + } + private double getElem(final int index) { try { return nb.get(index); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java index ad61cbd2f42..72e24a20418 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.objects; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.nio.ByteBuffer; @@ -95,6 +94,11 @@ public final class NativeInt16Array extends ArrayBufferView { return SET_ELEM; } + @Override + public Class getElementType() { + return int.class; + } + private int getElem(final int index) { try { return nb.get(index); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java index b018f04e86d..56b3106fb44 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.objects; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.nio.ByteBuffer; @@ -112,6 +111,11 @@ public final class NativeInt32Array extends ArrayBufferView { } } + @Override + public Class getElementType() { + return int.class; + } + @Override public int getInt(final int index) { return getElem(index); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java index 6f9f6e7bec3..68e6b0bc1ca 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.objects; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.nio.ByteBuffer; @@ -93,6 +92,11 @@ public final class NativeInt8Array extends ArrayBufferView { return SET_ELEM; } + @Override + public Class getElementType() { + return int.class; + } + private int getElem(final int index) { try { return nb.get(index); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java index f2b1bef4f72..c5ca91010fa 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java @@ -48,7 +48,6 @@ import jdk.nashorn.internal.runtime.PropertyMap; import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.ScriptRuntime; -import jdk.nashorn.internal.runtime.UnwarrantedOptimismException; import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator; import jdk.nashorn.internal.scripts.JO; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExp.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExp.java index 01806d44660..33ef284985f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExp.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExp.java @@ -33,13 +33,14 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.Callable; + import jdk.nashorn.internal.objects.annotations.Attribute; import jdk.nashorn.internal.objects.annotations.Constructor; import jdk.nashorn.internal.objects.annotations.Function; import jdk.nashorn.internal.objects.annotations.Getter; import jdk.nashorn.internal.objects.annotations.Property; import jdk.nashorn.internal.objects.annotations.ScriptClass; -import jdk.nashorn.internal.objects.annotations.SpecializedConstructor; +import jdk.nashorn.internal.objects.annotations.SpecializedFunction; import jdk.nashorn.internal.objects.annotations.Where; import jdk.nashorn.internal.runtime.BitVector; import jdk.nashorn.internal.runtime.JSType; @@ -143,7 +144,7 @@ public final class NativeRegExp extends ScriptObject { * @param self self reference * @return new NativeRegExp */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static NativeRegExp constructor(final boolean isNew, final Object self) { return new NativeRegExp("", ""); } @@ -158,7 +159,7 @@ public final class NativeRegExp extends ScriptObject { * @param pattern pattern * @return new NativeRegExp */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static NativeRegExp constructor(final boolean isNew, final Object self, final Object pattern) { return newRegExp(pattern, UNDEFINED); } @@ -174,7 +175,7 @@ public final class NativeRegExp extends ScriptObject { * @param flags flags * @return new NativeRegExp */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static NativeRegExp constructor(final boolean isNew, final Object self, final Object pattern, final Object flags) { return newRegExp(pattern, flags); } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeString.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeString.java index 69d34c2d4b5..850af622934 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeString.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeString.java @@ -29,7 +29,6 @@ import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.JSType.isRepresentableAsInt; import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; @@ -49,11 +48,12 @@ import jdk.nashorn.internal.objects.annotations.Constructor; import jdk.nashorn.internal.objects.annotations.Function; import jdk.nashorn.internal.objects.annotations.Getter; import jdk.nashorn.internal.objects.annotations.ScriptClass; -import jdk.nashorn.internal.objects.annotations.SpecializedConstructor; import jdk.nashorn.internal.objects.annotations.SpecializedFunction; +import jdk.nashorn.internal.objects.annotations.SpecializedFunction.LinkLogic; import jdk.nashorn.internal.objects.annotations.Where; import jdk.nashorn.internal.runtime.ConsString; import jdk.nashorn.internal.runtime.JSType; +import jdk.nashorn.internal.runtime.OptimisticBuiltins; import jdk.nashorn.internal.runtime.PropertyMap; import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptObject; @@ -67,7 +67,7 @@ import jdk.nashorn.internal.runtime.linker.PrimitiveLookup; * ECMA 15.5 String Objects. */ @ScriptClass("String") -public final class NativeString extends ScriptObject { +public final class NativeString extends ScriptObject implements OptimisticBuiltins { private final CharSequence value; @@ -568,6 +568,14 @@ public final class NativeString extends ScriptObject { return pos < 0 || pos >= str.length() ? "" : String.valueOf(str.charAt(pos)); } + private static int getValidChar(final Object self, final int pos) { + try { + return ((CharSequence)self).charAt(pos); + } catch (final IndexOutOfBoundsException e) { + throw new ClassCastException(); + } + } + /** * ECMA 15.5.4.5 String.prototype.charCodeAt (pos) * @param self self reference @@ -576,7 +584,9 @@ public final class NativeString extends ScriptObject { */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static double charCodeAt(final Object self, final Object pos) { - return charCodeAtImpl(checkObjectToString(self), JSType.toInteger(pos)); + final String str = checkObjectToString(self); + final int idx = JSType.toInteger(pos); + return idx < 0 || idx >= str.length() ? Double.NaN : str.charAt(idx); } /** @@ -585,9 +595,20 @@ public final class NativeString extends ScriptObject { * @param pos position in string * @return number representing charcode at position */ - @SpecializedFunction - public static double charCodeAt(final Object self, final double pos) { - return charCodeAt(self, (int) pos); + @SpecializedFunction(linkLogic=CharCodeAtLinkLogic.class) + public static int charCodeAt(final Object self, final double pos) { + return charCodeAt(self, (int)pos); //toInt pos is ok + } + + /** + * ECMA 15.5.4.5 String.prototype.charCodeAt (pos) - specialized version for long position + * @param self self reference + * @param pos position in string + * @return number representing charcode at position + */ + @SpecializedFunction(linkLogic=CharCodeAtLinkLogic.class) + public static int charCodeAt(final Object self, final long pos) { + return charCodeAt(self, (int)pos); } /** @@ -596,13 +617,10 @@ public final class NativeString extends ScriptObject { * @param pos position in string * @return number representing charcode at position */ - @SpecializedFunction - public static double charCodeAt(final Object self, final int pos) { - return charCodeAtImpl(checkObjectToString(self), pos); - } - private static double charCodeAtImpl(final String str, final int pos) { - return pos < 0 || pos >= str.length() ? Double.NaN : str.charAt(pos); + @SpecializedFunction(linkLogic=CharCodeAtLinkLogic.class) + public static int charCodeAt(final Object self, final int pos) { + return getValidChar(self, pos); } /** @@ -1097,7 +1115,6 @@ public final class NativeString extends ScriptObject { */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static String trim(final Object self) { - final String str = checkObjectToString(self); int start = 0; int end = str.length() - 1; @@ -1181,7 +1198,7 @@ public final class NativeString extends ScriptObject { * * @return new NativeString ("") */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static Object constructor(final boolean newObj, final Object self) { return newObj ? newObj("") : ""; } @@ -1197,7 +1214,7 @@ public final class NativeString extends ScriptObject { * * @return new NativeString (arg) */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static Object constructor(final boolean newObj, final Object self, final Object arg) { final CharSequence str = JSType.toCharSequence(arg); return newObj ? newObj(str) : str.toString(); @@ -1214,8 +1231,42 @@ public final class NativeString extends ScriptObject { * * @return new NativeString containing the string representation of the arg */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static Object constructor(final boolean newObj, final Object self, final int arg) { + final String str = Integer.toString(arg); + return newObj ? newObj(str) : str; + } + + /** + * ECMA 15.5.2.1 new String ( [ value ] ) - special version with exactly one {@code int} arg + * + * Constructor + * + * @param newObj is this constructor invoked with the new operator + * @param self self reference + * @param arg the arg + * + * @return new NativeString containing the string representation of the arg + */ + @SpecializedFunction(isConstructor=true) + public static Object constructor(final boolean newObj, final Object self, final long arg) { + final String str = Long.toString(arg); + return newObj ? newObj(str) : str; + } + + /** + * ECMA 15.5.2.1 new String ( [ value ] ) - special version with exactly one {@code int} arg + * + * Constructor + * + * @param newObj is this constructor invoked with the new operator + * @param self self reference + * @param arg the arg + * + * @return new NativeString containing the string representation of the arg + */ + @SpecializedFunction(isConstructor=true) + public static Object constructor(final boolean newObj, final Object self, final double arg) { final String str = JSType.toString(arg); return newObj ? newObj(str) : str; } @@ -1231,9 +1282,9 @@ public final class NativeString extends ScriptObject { * * @return new NativeString containing the string representation of the arg */ - @SpecializedConstructor + @SpecializedFunction(isConstructor=true) public static Object constructor(final boolean newObj, final Object self, final boolean arg) { - final String str = JSType.toString(arg); + final String str = Boolean.toString(arg); return newObj ? newObj(str) : str; } @@ -1281,7 +1332,7 @@ public final class NativeString extends ScriptObject { } else if (self != null && self == Global.instance().getStringPrototype()) { return ""; } else { - throw typeError( "not.a.string", ScriptRuntime.safeToString(self)); + throw typeError("not.a.string", ScriptRuntime.safeToString(self)); } } @@ -1310,4 +1361,50 @@ public final class NativeString extends ScriptObject { return MH.findStatic(MethodHandles.lookup(), NativeString.class, name, type); } + @Override + public LinkLogic getLinkLogic(final Class clazz) { + if (clazz == CharCodeAtLinkLogic.class) { + return CharCodeAtLinkLogic.INSTANCE; + } + return null; + } + + @Override + public boolean hasPerInstanceAssumptions() { + return false; + } + + /** + * This is linker logic charCodeAt - when we specialize further methods in NativeString + * It may be expanded. It's link check makes sure that we are dealing with a char + * sequence and that we are in range + */ + private static final class CharCodeAtLinkLogic extends SpecializedFunction.LinkLogic { + + private static final CharCodeAtLinkLogic INSTANCE = new CharCodeAtLinkLogic(); + + @Override + public boolean canLink(final Object self, final CallSiteDescriptor desc, final LinkRequest request) { + try { + //check that it's a char sequence or throw cce + final CharSequence cs = (CharSequence)self; + //check that the index, representable as an int, is inside the array + final int intIndex = JSType.toInteger(request.getArguments()[1]); + return intIndex >= 0 && intIndex < cs.length(); //can link + } catch (final ClassCastException | IndexOutOfBoundsException e) { + //fallthru + } + return false; + } + + /** + * charCodeAt callsites can throw ClassCastException as a mechanism to have them + * relinked - this enabled fast checks of the kind of ((IntArrayData)arrayData).push(x) + * for an IntArrayData only push - if this fails, a CCE will be thrown and we will relink + */ + @Override + public Class getRelinkException() { + return ClassCastException.class; + } + } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java index 68bd410c77f..d049c9331f3 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.objects; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.nio.ByteBuffer; @@ -118,6 +117,11 @@ public final class NativeUint16Array extends ArrayBufferView { return true; } + @Override + public Class getElementType() { + return int.class; + } + @Override public int getInt(final int index) { return getElem(index); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java index 47ee08da77b..2ae2be056ae 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.objects; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.nio.ByteBuffer; @@ -127,6 +126,11 @@ public final class NativeUint32Array extends ArrayBufferView { return true; } + @Override + public Class getElementType() { + return int.class; + } + @Override public int getInt(final int index) { return (int)getLong(index); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java index 15e01245b02..1067baa58d4 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.objects; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.nio.ByteBuffer; @@ -118,6 +117,11 @@ public final class NativeUint8Array extends ArrayBufferView { return true; } + @Override + public Class getElementType() { + return int.class; + } + @Override public int getInt(final int index) { return getElem(index); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java index db19ab37a59..ffd0f14cfec 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java @@ -28,7 +28,6 @@ package jdk.nashorn.internal.objects; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall; import static jdk.nashorn.internal.lookup.Lookup.MH; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.nio.ByteBuffer; @@ -98,6 +97,11 @@ public final class NativeUint8ClampedArray extends ArrayBufferView { return SET_ELEM; } + @Override + public Class getElementType() { + return int.class; + } + private int getElem(final int index) { try { return nb.get(index) & 0xff; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java index a52051ca967..36e7716b702 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java @@ -30,6 +30,7 @@ import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; import java.lang.invoke.MethodHandle; import java.util.ArrayList; + import jdk.nashorn.internal.runtime.AccessorProperty; import jdk.nashorn.internal.runtime.GlobalFunctions; import jdk.nashorn.internal.runtime.Property; @@ -38,6 +39,7 @@ import jdk.nashorn.internal.runtime.RecompilableScriptFunctionData; import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptFunctionData; import jdk.nashorn.internal.runtime.ScriptObject; +import jdk.nashorn.internal.runtime.Specialization; /** * Concrete implementation of ScriptFunction. This sets correct map for the @@ -58,7 +60,7 @@ public class ScriptFunctionImpl extends ScriptFunction { // Marker object for lazily initialized prototype object private static final Object LAZY_PROTOTYPE = new Object(); - private ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final MethodHandle[] specs, final Global global) { + private ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final Specialization[] specs, final Global global) { super(name, invokeHandle, map$, null, specs, ScriptFunctionData.IS_BUILTIN_CONSTRUCTOR); init(global); } @@ -71,11 +73,11 @@ public class ScriptFunctionImpl extends ScriptFunction { * @param invokeHandle handle for invocation * @param specs specialized versions of this method, if available, null otherwise */ - ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final MethodHandle[] specs) { + ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final Specialization[] specs) { this(name, invokeHandle, specs, Global.instance()); } - private ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final PropertyMap map, final MethodHandle[] specs, final Global global) { + private ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final PropertyMap map, final Specialization[] specs, final Global global) { super(name, invokeHandle, map.addAll(map$), null, specs, ScriptFunctionData.IS_BUILTIN_CONSTRUCTOR); init(global); } @@ -89,11 +91,11 @@ public class ScriptFunctionImpl extends ScriptFunction { * @param map initial property map * @param specs specialized versions of this method, if available, null otherwise */ - ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final PropertyMap map, final MethodHandle[] specs) { + ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final PropertyMap map, final Specialization[] specs) { this(name, invokeHandle, map, specs, Global.instance()); } - private ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final ScriptObject scope, final MethodHandle[] specs, final int flags, final Global global) { + private ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final ScriptObject scope, final Specialization[] specs, final int flags, final Global global) { super(name, methodHandle, getMap(isStrict(flags)), scope, specs, flags); init(global); } @@ -107,7 +109,7 @@ public class ScriptFunctionImpl extends ScriptFunction { * @param specs specialized versions of this method, if available, null otherwise * @param flags {@link ScriptFunctionData} flags */ - ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final ScriptObject scope, final MethodHandle[] specs, final int flags) { + ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final ScriptObject scope, final Specialization[] specs, final int flags) { this(name, methodHandle, scope, specs, flags, Global.instance()); } @@ -184,7 +186,7 @@ public class ScriptFunctionImpl extends ScriptFunction { return new AnonymousFunction(); } - private static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final MethodHandle[] specs, final int flags) { + private static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final Specialization[] specs, final int flags) { final ScriptFunctionImpl func = new ScriptFunctionImpl(name, methodHandle, null, specs, flags); func.setPrototype(UNDEFINED); // Non-constructor built-in functions do not have "prototype" property @@ -201,7 +203,7 @@ public class ScriptFunctionImpl extends ScriptFunction { * @param specs specialized versions of function if available, null otherwise * @return new ScriptFunction */ - static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final MethodHandle[] specs) { + static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final Specialization[] specs) { return makeFunction(name, methodHandle, specs, ScriptFunctionData.IS_BUILTIN); } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/SpecializedFunction.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/SpecializedFunction.java index 1e75d2a72a3..6c74d72bc83 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/SpecializedFunction.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/SpecializedFunction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2014, 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,18 +29,315 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.SwitchPoint; +import jdk.internal.dynalink.CallSiteDescriptor; +import jdk.internal.dynalink.linker.LinkRequest; +import jdk.nashorn.internal.runtime.ScriptFunction; /** - * The SpecializedFunction annotation is used to flag more type specific functions than the standard one in - * Native objects. For example {@link jdk.nashorn.internal.objects.NativeMath#max} takes an arbitrary number of - * Object elements as an array. Call this function, including the varargs collector that allocates the array - * upon each invocation, is much more expensive than calling a specialized function that takes two arguments - * of, e.g. int type from the call site, such as {@link jdk.nashorn.internal.objects.NativeMath#max(Object, int, int)}. - * {@link jdk.nashorn.internal.runtime.ScriptFunction} will try to look up the most specific function when - * linking the callsite. + * The SpecializedFunction annotation is used to flag more type specific + * functions than the standard one in the native objects */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface SpecializedFunction { - //empty + + /** + * Functionality for testing if we are allowed to link a specialized + * function the first time we encounter it. Then the guard will handle the + * rest of the invocations + * + * This is the same for all callsites in Nashorn, the first time callsite is + * linked, we have to manually check that the linkage is OK. Even if we add + * a guard and it fails upon the first try, this is not good enough. + * (Symmetrical to how it works everywhere else in the Nashorn runtime). + * + * Here we abstract out a few of the most common link guard checks. + */ + public static abstract class LinkLogic { + /** + * Empty link logic instance - this is the default + * "no special linking or runtime guard behavior" + */ + public static final LinkLogic EMPTY_INSTANCE = new Empty(); + + private static final SwitchPoint[] INVALIDATED_SWITCHPOINTS = new SwitchPoint[0]; + + private SwitchPoint[] modificationSwitchPoints; //cache + + /** Empty link logic class - allow all linking, no guards */ + private static final class Empty extends LinkLogic { + @Override + public boolean canLink(final Object self, final CallSiteDescriptor desc, final LinkRequest request) { + return true; + } + + @Override + public boolean isEmpty() { + return true; + } + }; + + /** + * Get the class representing the empty link logic + * @return class representing empty link logic + */ + public static Class getEmptyLinkLogicClass() { + return Empty.class; + } + + /** + * Should this callsite relink when an exception is thrown + * + * @return the relink exception, or null if none + */ + public Class getRelinkException() { + return null; + } + + /** + * Is this link logic class empty - i.e. no special linking logic + * supplied + * + * @param clazz class to check + * + * @return true if this link logic is empty + */ + public static boolean isEmpty(final Class clazz) { + return clazz == Empty.class; + } + + /** + * Is this link logic instance empty - i.e. no special linking logic + * supplied + * + * @return true if this link logic instance is empty + */ + public boolean isEmpty() { + return false; + } + + /** + * Given a callsite, can we link this method based on the receiver and + * parameters? + * + * @param self receiver + * @param desc callsite descriptor + * @param request link request + * + * @return true if we can link this callsite at this time + */ + public abstract boolean canLink(final Object self, final CallSiteDescriptor desc, final LinkRequest request); + + /** + * Given a callsite, do we require an extra guard for specialization to + * go through? + * + * @param self receiver + * + * @return true if a guard is to be woven into the callsite + */ + public boolean needsGuard(final Object self) { + return true; + } + + /** + * Given a callsite, and optional arguments, do we need an extra guard + * for specialization to go through - this guard can be a function of + * the arguments too + * + * @param self receiver + * @param args arguments + * + * @return true if a guard is to be woven into the callsite + */ + public boolean needsGuard(final Object self, final Object... args) { + return true; + } + + /** + * Given a callsite, and optional arguments, return any extra guard we + * might need for specialization as a method handle. + * + * @return methodhandle for guard, or null if no guard is needed + */ + public MethodHandle getGuard() { + return null; + } + + /** + * Return the modification SwitchPoint of a particular index from this OptimisticBuiltins + * If none exists, one is created and that one is return. + * + * The implementor must map indexes to specific SwitchPoints for specific events and keep + * track of what they mean, for example NativeArray.LENGTH_NOT_WRITABLE_SWITCHPOINT + * might be a useful index mapping + * + * @param index index for SwitchPoint to get or create + * @return modification SwitchPoint of particular index for the receiver + */ + public SwitchPoint getOrCreateModificationSwitchPoint(final int index) { + return null; + } + + /** + * Return the modification SwitchPoint from this OptimisticBuiltins. If none + * exists, one is created and that one is return. + * + * @return modification SwitchPoint for the receiver + */ + public SwitchPoint[] getOrCreateModificationSwitchPoints() { + return null; + } + + /** + * Hook to invalidate a modification SwitchPoint by index. + * + * @param index index for SwitchPoint to invalidate + */ + public void invalidateModificationSwitchPoint(final int index) { + //empty + } + + /** + * Hook to invalidate all modification SwitchPoints for a receiver + */ + public void invalidateModificationSwitchPoints() { + //empty + } + + /** + * Check whether the receiver has an invalidated modification SwitchPoint. + * + * @param index index for the modification SwitchPoint + * @return true if the particular SwitchPoint at the index is invalidated + */ + public boolean hasInvalidatedModificationSwitchPoint(final int index) { + return false; + } + + /** + * Check whether at least one of the modification SwitchPoints has been + * invalidated + * @return true if one of the SwitchPoints has been invalidated + */ + public boolean hasInvalidatedModificationSwitchPoints() { + return false; + } + + /** + * Check whether this OptimisticBuiltins has a SwitchPoints of particular + * index. + * + * As creation overhead for a SwitchPoint is non-zero, we have to create them lazily instead of, + * e.g. in the constructor of every subclass. + * + * @param index index for the modification SwitchPoint + * @return true if a modification SwitchPoint exists, no matter if it has been invalidated or not + */ + public boolean hasModificationSwitchPoint(final int index) { + return false; + } + + /** + * Check whether this OptimisticBuiltins has SwitchPoints. + * + * As creation overhead for a SwitchPoint is non-zero, we have to create them lazily instead of, + * e.g. in the constructor of every subclass. + * + * @return true if a modification SwitchPoint exists, no matter if it has been invalidated or not + */ + public boolean hasModificationSwitchPoints() { + return false; + } + + /** + * Check, given a link request and a receiver, if this specialization + * fits This is used by the linker in {@link ScriptFunction} to figure + * out if an optimistic builtin can be linked when first discovered + * + * @param self receiver + * @param desc callsite descriptor + * @param request link request + + * @return true if we can link, false otherwise - that means we have to + * pick a non specialized target + */ + public boolean checkLinkable(final Object self, final CallSiteDescriptor desc, final LinkRequest request) { + // no matter what the modification switchpoints are, if any of them are invalidated, + // we can't link. Side effect is that if it's the first time we see this callsite, + // we have to create the SwitchPoint(s) so future modification switchpoint invalidations + // relink it + final SwitchPoint[] sps = getOrCreateModificationSwitchPoints(self); + if (sps == INVALIDATED_SWITCHPOINTS) { + // nope, can't do the fast link as this assumption + // has been invalidated already, e.g. length of an + // array set to not writable + return false; + } + modificationSwitchPoints = sps; //cache + + // check the link guard, if it says we can link, go ahead + return canLink(self, desc, request); + } + + private SwitchPoint[] getOrCreateModificationSwitchPoints(final Object self) { + final SwitchPoint[] sps = getOrCreateModificationSwitchPoints(); //ask for all my switchpoints + if (sps != null) { //switchpoint exists, but some may be invalidated + for (final SwitchPoint sp : sps) { + if (sp.hasBeenInvalidated()) { + return INVALIDATED_SWITCHPOINTS; + } + } + } + return sps; + } + + /** + * Get the cached modification switchpoints. Only possible to do after a link + * check call has been performed, one that has answered "true", or you will get the + * wrong information. + * + * Should be used only from {@link ScriptFunction#findCallMethod} + * + * @return cached modification switchpoints for this callsite, null if none + */ + public SwitchPoint[] getModificationSwitchPoints() { + return modificationSwitchPoints == null ? null : modificationSwitchPoints.clone(); + } + } + + /** + * name override for return value polymorphism, for example we can't have + * pop(V)I and pop(V)D in the same Java class, so they need to be named, + * e.g. popInt(V)I and popDouble(V)D for disambiguation, however, their + * names still need to resolve to "pop" to JavaScript so we can still + * specialize on return values and so that the linker can find them + * + * @return name, "" means no override, use the Java function name, e.g. + * "push" + */ + String name() default ""; + + /** + * Return the guard for this specialized function. The default is no guard. + * + * @return guard + */ + Class linkLogic() default LinkLogic.Empty.class; + + /** + * Is this a specialized constructor? + */ + boolean isConstructor() default false; + + /** + * Can this function throw UnwarrantedOptimismExceptions? This works just + * like the normal functions, but we need the function to be + * immutable/non-state modifying, as we can't generate continuations for + * native code. Luckily a lot of the methods we want to specialize have this + * property + */ + boolean isOptimistic() default false; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java index 44b3c3b075d..e29353683c0 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java @@ -36,7 +36,6 @@ import static jdk.nashorn.internal.lookup.MethodHandleFactory.stripName; import static jdk.nashorn.internal.runtime.JSType.getAccessorTypeIndex; import static jdk.nashorn.internal.runtime.JSType.getNumberOfAccessorTypes; import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT; - import java.io.IOException; import java.io.ObjectInputStream; import java.lang.invoke.MethodHandle; @@ -57,9 +56,7 @@ public class AccessorProperty extends Property { private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); private static final MethodHandle REPLACE_MAP = findOwnMH_S("replaceMap", Object.class, Object.class, PropertyMap.class); - private static final MethodHandle INVALIDATE_SP = findOwnMH_S("invalidateSwitchPoint", Object.class, Object.class, SwitchPoint.class); - - private static final SwitchPoint NO_CHANGE_CALLBACK = new SwitchPoint(); + private static final MethodHandle INVALIDATE_SP = findOwnMH_S("invalidateSwitchPoint", Object.class, AccessorProperty.class, Object.class); private static final int NOOF_TYPES = getNumberOfAccessorTypes(); private static final long serialVersionUID = 3371720170182154920L; @@ -221,7 +218,7 @@ public class AccessorProperty extends Property { * @param setter the property setter or null if non writable, non configurable */ private AccessorProperty(final String key, final int flags, final int slot, final MethodHandle getter, final MethodHandle setter) { - super(key, flags | (getter.type().returnType().isPrimitive() ? IS_NASGEN_PRIMITIVE : 0), slot); + super(key, flags | IS_BUILTIN | (getter.type().returnType().isPrimitive() ? IS_NASGEN_PRIMITIVE : 0), slot); assert !isSpill(); // we don't need to prep the setters these will never be invalidated as this is a nasgen @@ -602,7 +599,6 @@ public class AccessorProperty extends Property { private Property getWiderProperty(final Class type) { return copy(type); //invalidate cache of new property - } private PropertyMap getWiderMap(final PropertyMap oldMap, final Property newProperty) { @@ -627,8 +623,10 @@ public class AccessorProperty extends Property { } @SuppressWarnings("unused") - private static Object invalidateSwitchPoint(final Object obj, final SwitchPoint sp) { - SwitchPoint.invalidateAll(new SwitchPoint[] { sp }); + private static Object invalidateSwitchPoint(final AccessorProperty property, final Object obj) { + if (!property.builtinSwitchPoint.hasBeenInvalidated()) { + SwitchPoint.invalidateAll(new SwitchPoint[] { property.builtinSwitchPoint }); + } return obj; } @@ -668,12 +666,8 @@ public class AccessorProperty extends Property { mh = generateSetter(!forType.isPrimitive() ? Object.class : forType, type); } - /** - * Check if this is a special global name that requires switchpoint invalidation - */ - final SwitchPoint ccb = getChangeCallback(); - if (ccb != null && ccb != NO_CHANGE_CALLBACK) { - mh = MH.filterArguments(mh, 0, MH.insertArguments(debugInvalidate(getKey(), ccb), 1, changeCallback)); + if (isBuiltin()) { + mh = MH.filterArguments(mh, 0, debugInvalidate(MH.insertArguments(INVALIDATE_SP, 0, this), getKey())); } assert mh.type().returnType() == void.class : mh.type(); @@ -681,25 +675,6 @@ public class AccessorProperty extends Property { return mh; } - /** - * Get the change callback for this property - * @return switchpoint that is invalidated when property changes - */ - protected SwitchPoint getChangeCallback() { - if (changeCallback == null) { - try { - changeCallback = Global.instance().getChangeCallback(getKey()); - } catch (final NullPointerException e) { - assert !"apply".equals(getKey()) && !"call".equals(getKey()); - //empty - } - if (changeCallback == null) { - changeCallback = NO_CHANGE_CALLBACK; - } - } - return changeCallback; - } - @Override public final boolean canChangeType() { if (OBJECT_FIELDS_ONLY) { @@ -724,7 +699,6 @@ public class AccessorProperty extends Property { return currentType; } - private MethodHandle debug(final MethodHandle mh, final Class forType, final Class type, final String tag) { if (!Context.DEBUG || !Global.hasInstance()) { return mh; @@ -780,9 +754,9 @@ public class AccessorProperty extends Property { return mh; } - private static MethodHandle debugInvalidate(final String key, final SwitchPoint sp) { + private static MethodHandle debugInvalidate(final MethodHandle invalidator, final String key) { if (!Context.DEBUG || !Global.hasInstance()) { - return INVALIDATE_SP; + return invalidator; } final Context context = Context.getContextTrusted(); @@ -790,11 +764,11 @@ public class AccessorProperty extends Property { return context.addLoggingToHandle( ObjectClassGenerator.class, - INVALIDATE_SP, + invalidator, new Supplier() { @Override public String get() { - return "Field change callback for " + key + " triggered: " + sp; + return "Field change callback for " + key + " triggered "; } }); } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java index 7a7df467819..4e001b4da2e 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java @@ -81,13 +81,17 @@ public interface CodeInstaller { /** * Store a compiled script for later reuse + * + * @param cacheKey key to use in cache * @param source the script source * @param mainClassName the main class name * @param classBytes map of class names to class bytes + * @param initializers compilation id -> FunctionInitializer map * @param constants constants array + * @param compilationId compilation id */ - public void storeScript(String cacheKey, Source source, String mainClassName, Map classBytes, - Map initializers, Object[] constants, int compilationId); + public void storeScript(final String cacheKey, final Source source, final String mainClassName, final Map classBytes, + final Map initializers, final Object[] constants, final int compilationId); /** * Load a previously compiled script diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java index a736cc360f8..b06473ee61f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java @@ -118,6 +118,8 @@ public abstract class CodeStore implements Loggable { * @param initializers the function initializers * @param constants the constants array * @param compilationId the compilation id + * + * @return stored script */ public StoredScript store(final String functionKey, final Source source, @@ -153,11 +155,13 @@ public abstract class CodeStore implements Loggable { /** * Returns a new StoredScript instance. * + * @param source the source * @param mainClassName the main class name * @param classBytes a map of class bytes * @param initializers function initializers * @param constants the constants array * @param compilationId the compilation id + * * @return The compiled script */ public StoredScript storedScriptFor(final Source source, final String mainClassName, @@ -216,6 +220,7 @@ public abstract class CodeStore implements Loggable { * Constructor * * @param path directory to store code in + * @param readOnly is this a read only code store * @param minSize minimum file size for caching scripts * @throws IOException */ diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java index 28a81dea91e..d41496086df 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java @@ -33,12 +33,13 @@ import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.lang.invoke.MutableCallSite; import java.lang.invoke.SwitchPoint; +import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; import java.util.function.Supplier; import java.util.logging.Level; - import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.nashorn.internal.codegen.Compiler; import jdk.nashorn.internal.codegen.Compiler.CompilationPhases; @@ -46,6 +47,7 @@ import jdk.nashorn.internal.codegen.TypeMap; import jdk.nashorn.internal.codegen.types.ArrayType; import jdk.nashorn.internal.codegen.types.Type; import jdk.nashorn.internal.ir.FunctionNode; +import jdk.nashorn.internal.objects.annotations.SpecializedFunction.LinkLogic; import jdk.nashorn.internal.runtime.events.RecompilationEvent; import jdk.nashorn.internal.runtime.linker.Bootstrap; import jdk.nashorn.internal.runtime.logging.DebugLogger; @@ -63,6 +65,8 @@ final class CompiledFunction { private final DebugLogger log; + static final Collection NO_FUNCTIONS = Collections.emptySet(); + /** * The method type may be more specific than the invoker, if. e.g. * the invoker is guarded, and a guard with a generic object only @@ -75,20 +79,40 @@ final class CompiledFunction { private final int flags; // from FunctionNode private final MethodType callSiteType; + private final Specialization specialization; + CompiledFunction(final MethodHandle invoker) { - this(invoker, null); + this(invoker, null, null); } - static CompiledFunction createBuiltInConstructor(final MethodHandle invoker) { - return new CompiledFunction(MH.insertArguments(invoker, 0, false), createConstructorFromInvoker(MH.insertArguments(invoker, 0, true))); + static CompiledFunction createBuiltInConstructor(final MethodHandle invoker, final Specialization specialization) { + return new CompiledFunction(MH.insertArguments(invoker, 0, false), createConstructorFromInvoker(MH.insertArguments(invoker, 0, true)), specialization); } - CompiledFunction(final MethodHandle invoker, final MethodHandle constructor) { - this(invoker, constructor, 0, null, DebugLogger.DISABLED_LOGGER); + CompiledFunction(final MethodHandle invoker, final MethodHandle constructor, final Specialization specialization) { + this(invoker, constructor, 0, null, specialization, DebugLogger.DISABLED_LOGGER); } - CompiledFunction(final MethodHandle invoker, final MethodHandle constructor, final int flags, final MethodType callSiteType, final DebugLogger log) { - this.invoker = invoker; + CompiledFunction(final MethodHandle invoker, final MethodHandle constructor, final int flags, final MethodType callSiteType, final Specialization specialization, final DebugLogger log) { + this.specialization = specialization; + if (specialization != null && specialization.isOptimistic()) { + /* + * An optimistic builtin with isOptimistic=true works like any optimistic generated function, i.e. it + * can throw unwarranted optimism exceptions. As native functions trivially can't have parts of them + * regenerated as restof methods, this only works if the methods are atomic/functional in their behavior + * and doesn't modify state before an UOE can be thrown. If they aren't, we can reexecute a wider version + * of the same builtin in a recompilation handler for FinalScriptFunctionData. There are several + * candidate methods in Native* that would benefit from this, but I haven't had time to implement any + * of them currently. In order to fit in with the relinking framework, the current thinking is + * that the methods still take a program point to fit in with other optimistic functions, but + * it is set to "first", which is the beginning of the method. The relinker can tell the difference + * between builtin and JavaScript functions. This might change. TODO + */ + this.invoker = MH.insertArguments(invoker, invoker.type().parameterCount() - 1, UnwarrantedOptimismException.FIRST_PROGRAM_POINT); + throw new AssertionError("Optimistic (UnwarrantedOptimismException throwing) builtin functions are currently not in use"); + } else { + this.invoker = invoker; + } this.constructor = constructor; this.flags = flags; this.callSiteType = callSiteType; @@ -97,7 +121,7 @@ final class CompiledFunction { CompiledFunction(final MethodHandle invoker, final RecompilableScriptFunctionData functionData, final Map invalidatedProgramPoints, final MethodType callSiteType, final int flags) { - this(invoker, null, flags, callSiteType, functionData.getLogger()); + this(invoker, null, flags, callSiteType, null, functionData.getLogger()); if ((flags & FunctionNode.IS_DEOPTIMIZABLE) != 0) { optimismInfo = new OptimismInfo(functionData, invalidatedProgramPoints); } else { @@ -105,10 +129,45 @@ final class CompiledFunction { } } + static CompiledFunction createBuiltInConstructor(final MethodHandle invoker) { + return new CompiledFunction(MH.insertArguments(invoker, 0, false), createConstructorFromInvoker(MH.insertArguments(invoker, 0, true)), null); + } + + boolean isSpecialization() { + return specialization != null; + } + + boolean hasLinkLogic() { + return getLinkLogicClass() != null; + } + + Class getLinkLogicClass() { + if (isSpecialization()) { + final Class linkLogicClass = specialization.getLinkLogicClass(); + assert !LinkLogic.isEmpty(linkLogicClass) : "empty link logic classes should have been removed by nasgen"; + return linkLogicClass; + } + return null; + } + int getFlags() { return flags; } + /** + * An optimistic specialization is one that can throw UnwarrantedOptimismException. + * This is allowed for native methods, as long as they are functional, i.e. don't change + * any state between entering and throwing the UOE. Then we can re-execute a wider version + * of the method in the continuation. Rest-of method generation for optimistic builtins is + * of course not possible, but this approach works and fits into the same relinking + * framework + * + * @return true if optimistic builtin + */ + boolean isOptimistic() { + return isSpecialization() ? specialization.isOptimistic() : false; + } + boolean isApplyToCall() { return (flags & FunctionNode.HAS_APPLY_TO_CALL_SPECIALIZATION) != 0; } @@ -119,7 +178,19 @@ final class CompiledFunction { @Override public String toString() { - return "[invokerType=" + invoker.type() + " ctor=" + constructor + " weight=" + weight() + " isApplyToCall=" + isApplyToCall() + "]"; + final StringBuilder sb = new StringBuilder(); + final Class linkLogicClass = getLinkLogicClass(); + + sb.append("[invokerType="). + append(invoker.type()). + append(" ctor="). + append(constructor). + append(" weight="). + append(weight()). + append(" linkLogic="). + append(linkLogicClass != null ? linkLogicClass.getSimpleName() : "none"); + + return sb.toString(); } boolean needsCallee() { @@ -281,10 +352,12 @@ final class CompiledFunction { if (other == null) { return true; } - return betterThanFinal(type(), other.type(), callSiteMethodType); + return betterThanFinal(this, other, callSiteMethodType); } - static boolean betterThanFinal(final MethodType thisMethodType, final MethodType otherMethodType, final MethodType callSiteMethodType) { + private static boolean betterThanFinal(final CompiledFunction cf, final CompiledFunction other, final MethodType callSiteMethodType) { + final MethodType thisMethodType = cf.type(); + final MethodType otherMethodType = other.type(); final int thisParamCount = getParamCount(thisMethodType); final int otherParamCount = getParamCount(otherMethodType); final int callSiteRawParamCount = getParamCount(callSiteMethodType); @@ -406,7 +479,17 @@ final class CompiledFunction { return false; } - throw new AssertionError(thisMethodType + " identically applicable to " + otherMethodType + " for " + callSiteMethodType); // Signatures are identical + //if they are equal, pick the specialized one first + if (cf.isSpecialization() != other.isSpecialization()) { + return cf.isSpecialization(); //always pick the specialized version if we can + } + + if (cf.isSpecialization() && other.isSpecialization()) { + return cf.getLinkLogicClass() != null; //pick link logic specialization above generic specializations + } + + // Signatures are identical + throw new AssertionError(thisMethodType + " identically applicable to " + otherMethodType + " for " + callSiteMethodType); } private static Type[] toTypeWithoutCallee(final MethodType type, final int thisIndex) { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java index aa3306a4633..68c576f756f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java @@ -40,6 +40,7 @@ import java.io.PrintWriter; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; +import java.lang.invoke.SwitchPoint; import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; import java.lang.reflect.Field; @@ -63,7 +64,9 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.function.Consumer; import java.util.function.Supplier; import java.util.logging.Level; + import javax.script.ScriptEngine; + import jdk.internal.org.objectweb.asm.ClassReader; import jdk.internal.org.objectweb.asm.util.CheckClassAdapter; import jdk.nashorn.api.scripting.ClassFilter; @@ -127,6 +130,16 @@ public final class Context { private static MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); private static MethodType CREATE_PROGRAM_FUNCTION_TYPE = MethodType.methodType(ScriptFunction.class, ScriptObject.class); + /** + * Keeps track of which builtin prototypes and properties have been relinked + * Currently we are conservative and associate the name of a builtin class with all + * its properties, so it's enough to invalidate a property to break all assumptions + * about a prototype. This can be changed to a more fine grained approach, but no one + * ever needs this, given the very rare occurance of swapping out only parts of + * a builtin v.s. the entire builtin object + */ + private final Map builtinSwitchPoints = new HashMap<>(); + /* Force DebuggerSupport to be loaded. */ static { DebuggerSupport.FORCELOAD = true; @@ -1371,4 +1384,34 @@ public final class Context { return null; } + /** + * This is a special kind of switchpoint used to guard builtin + * properties and prototypes. In the future it might contain + * logic to e.g. multiple switchpoint classes. + */ + public static final class BuiltinSwitchPoint extends SwitchPoint { + + } + + /** + * Create a new builtin switchpoint and return it + * @param name key name + * @return new builtin switchpoint + */ + public SwitchPoint newBuiltinSwitchPoint(final String name) { + assert builtinSwitchPoints.get(name) == null; + final SwitchPoint sp = new BuiltinSwitchPoint(); + builtinSwitchPoints.put(name, sp); + return sp; + } + + /** + * Return the builtin switchpoint for a particular key name + * @param name key name + * @return builtin switchpoint or null if none + */ + public SwitchPoint getBuiltinSwitchPoint(final String name) { + return builtinSwitchPoints.get(name); + } + } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java index f75dc82991d..c868aab2884 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java @@ -60,13 +60,13 @@ final class FinalScriptFunctionData extends ScriptFunctionData { * @param specs specializations * @param flags {@link ScriptFunctionData} flags */ - FinalScriptFunctionData(final String name, final MethodHandle mh, final MethodHandle[] specs, final int flags) { + FinalScriptFunctionData(final String name, final MethodHandle mh, final Specialization[] specs, final int flags) { super(name, methodHandleArity(mh), flags); addInvoker(mh); if (specs != null) { - for (final MethodHandle spec : specs) { - addInvoker(spec); + for (final Specialization spec : specs) { + addInvoker(spec.getMethodHandle(), spec); } } } @@ -114,16 +114,25 @@ final class FinalScriptFunctionData extends ScriptFunctionData { return MethodType.genericMethodType(max + 1); } - private void addInvoker(final MethodHandle mh) { + private CompiledFunction addInvoker(final MethodHandle mh, final Specialization specialization) { assert !needsCallee(mh); + + final CompiledFunction invoker; if (isConstructor(mh)) { // only nasgen constructors: (boolean, self, args) are subject to binding a boolean newObj. isConstructor // is too conservative a check. However, isConstructor(mh) always implies isConstructor param assert isConstructor(); - code.add(CompiledFunction.createBuiltInConstructor(mh)); + invoker = CompiledFunction.createBuiltInConstructor(mh); } else { - code.add(new CompiledFunction(mh)); + invoker = new CompiledFunction(mh, null, specialization); } + code.add(invoker); + + return invoker; + } + + private CompiledFunction addInvoker(final MethodHandle mh) { + return addInvoker(mh, null); } private static int methodHandleArity(final MethodHandle mh) { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FindProperty.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FindProperty.java index 06f682bf169..b4e00124837 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FindProperty.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FindProperty.java @@ -79,6 +79,8 @@ public final class FindProperty { * * @param type type of getter, e.g. int.class if we want a function with {@code get()I} signature * @param programPoint program point, or INVALID_PROGRAM_POINT if pessimistic + * @param request link request + * * @return method handle for the getter */ public MethodHandle getGetter(final Class type, final int programPoint, final LinkRequest request) { @@ -102,6 +104,7 @@ public final class FindProperty { * * @param type type of setter, e.g. int.class if we want a function with {@code set(I)V} signature * @param strict are we in strict mode + * @param request link request * * @return method handle for the getter */ diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java index 3a1048125a5..6099a70bce8 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java @@ -358,8 +358,12 @@ public final class GlobalConstants implements Loggable { * @param c constant value * @return method handle (with dummy receiver) that returns this constant */ + public static MethodHandle staticConstantGetter(final Object c) { + return MH.dropArguments(JSType.unboxConstant(c), 0, Object.class); + } + private MethodHandle constantGetter(final Object c) { - final MethodHandle mh = MH.dropArguments(JSType.unboxConstant(c), 0, Object.class); + final MethodHandle mh = staticConstantGetter(c); if (log.isEnabled()) { return MethodHandleFactory.addDebugPrintout(log, Level.FINEST, mh, "getting as constant"); } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalFunctions.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalFunctions.java index 2776cc66205..c7094adcad3 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalFunctions.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalFunctions.java @@ -42,12 +42,30 @@ public final class GlobalFunctions { /** Methodhandle (specialized) to implementation of ECMA 15.1.2.2, parseInt */ public static final MethodHandle PARSEINT_OI = findOwnMH("parseInt", double.class, Object.class, Object.class, int.class); + /** ParseInt - NaN for booleans (thru string conversion to number conversion) */ + public static final MethodHandle PARSEINT_Z = MH.dropArguments(MH.dropArguments(MH.constant(double.class, Double.NaN), 0, boolean.class), 0, Object.class); + + /** ParseInt - identity for ints */ + public static final MethodHandle PARSEINT_I = MH.dropArguments(MH.identity(int.class), 0, Object.class); + + /** ParseInt - identity for longs */ + public static final MethodHandle PARSEINT_J = MH.dropArguments(MH.identity(long.class), 0, Object.class); + /** Methodhandle (specialized) to implementation of ECMA 15.1.2.2, parseInt */ public static final MethodHandle PARSEINT_O = findOwnMH("parseInt", double.class, Object.class, Object.class); /** Methodhandle to implementation of ECMA 15.1.2.3, parseFloat */ public static final MethodHandle PARSEFLOAT = findOwnMH("parseFloat", double.class, Object.class, Object.class); + /** isNan for integers - always false */ + public static final MethodHandle IS_NAN_I = MH.dropArguments(MH.constant(boolean.class, false), 0, Object.class); + + /** isNan for longs - always false */ + public static final MethodHandle IS_NAN_J = MH.dropArguments(MH.constant(boolean.class, false), 0, Object.class); + + /** IsNan for doubles - use Double.isNaN */ + public static final MethodHandle IS_NAN_D = MH.dropArguments(MH.findStatic(MethodHandles.lookup(), Double.class, "isNaN", MH.type(boolean.class, double.class)), 0, Object.class); + /** Methodhandle to implementation of ECMA 15.1.2.4, isNaN */ public static final MethodHandle IS_NAN = findOwnMH("isNaN", boolean.class, Object.class, Object.class); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/OptimisticBuiltins.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/OptimisticBuiltins.java new file mode 100644 index 00000000000..6829ddeb97f --- /dev/null +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/OptimisticBuiltins.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2010, 2014, 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. + */ + +package jdk.nashorn.internal.runtime; + +import jdk.nashorn.internal.objects.annotations.SpecializedFunction; +import jdk.nashorn.internal.objects.annotations.SpecializedFunction.LinkLogic; + +/** + * This is an interface for classes that need custom linkage logic. This means Native objects + * that contain optimistic native methods, that need special/extra rules for linking, guards and + * SwitchPointing, known and internal to the Native object for its linkage + */ +public interface OptimisticBuiltins { + + /** + * Return an instance of the linking logic we need for a particular LinkLogic + * subclass, gotten from the compile time annotation of a specialized builtin method + * No assumptions can be made about the lifetime of the instance. The receiver may + * keep it as a perpetual final instance field or create new linking logic depending + * on its current state for each call, depending on if the global state has changed + * or other factors + * + * @param clazz linking logic class + * @return linking logic instance for this class + */ + public SpecializedFunction.LinkLogic getLinkLogic(final Class clazz); + + /** + * Does this link logic vary depending on which instance we are working with. + * Then we have to sort out certain primitives, as they are created as new + * objects in the wrapFilter by JavaScript semantics. An example of instance only + * assumptions are switchPoints per instance, as in NativeArray. NativeString is + * fine, as it's only static. + * + * TODO: finer granularity on this, on the function level so certain functions + * are forbidden only. Currently we don't have enough specialization to bump into this + * + * @return true if there are per instance assumptions for the optimism + */ + public boolean hasPerInstanceAssumptions(); + +} diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java index 1f9f1459313..f57246cacad 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java @@ -28,7 +28,6 @@ package jdk.nashorn.internal.runtime; import static jdk.nashorn.internal.runtime.PropertyDescriptor.CONFIGURABLE; import static jdk.nashorn.internal.runtime.PropertyDescriptor.ENUMERABLE; import static jdk.nashorn.internal.runtime.PropertyDescriptor.WRITABLE; - import java.io.Serializable; import java.lang.invoke.MethodHandle; import java.lang.invoke.SwitchPoint; @@ -84,6 +83,9 @@ public abstract class Property implements Serializable { */ public static final int IS_NASGEN_PRIMITIVE = 1 << 6; + /** Is this a builtin property, e.g. Function.prototype.apply */ + public static final int IS_BUILTIN = 1 << 7; + /** Is this property bound to a receiver? This means get/set operations will be delegated to * a statically defined object instead of the object passed as callsite parameter. */ public static final int IS_BOUND = 1 << 7; @@ -101,7 +103,7 @@ public abstract class Property implements Serializable { private final int slot; /** SwitchPoint that is invalidated when property is changed, optional */ - protected transient SwitchPoint changeCallback; + protected transient SwitchPoint builtinSwitchPoint; private static final long serialVersionUID = 2099814273074501176L; @@ -125,10 +127,10 @@ public abstract class Property implements Serializable { * @param property source property */ Property(final Property property, final int flags) { - this.key = property.key; - this.slot = property.slot; - this.changeCallback = property.changeCallback; - this.flags = flags; + this.key = property.key; + this.slot = property.slot; + this.builtinSwitchPoint = property.builtinSwitchPoint; + this.flags = flags; } /** @@ -182,8 +184,26 @@ public abstract class Property implements Serializable { * changed * @param sp SwitchPoint to use for change callback */ - public final void setChangeCallback(final SwitchPoint sp) { - this.changeCallback = sp; + public final void setBuiltinSwitchPoint(final SwitchPoint sp) { + this.builtinSwitchPoint = sp; + } + + /** + * Builtin properties have an invalidation switchpoint that is + * invalidated when they are set, this is a getter for it + * @return builtin switchpoint, or null if none + */ + public final SwitchPoint getBuiltinSwitchPoint() { + return builtinSwitchPoint; + } + + /** + * Checks if this is a builtin property, this means that it has + * a builtin switchpoint that hasn't been invalidated by a setter + * @return true if builtin, untouched (unset) property + */ + public boolean isBuiltin() { + return builtinSwitchPoint != null && !builtinSwitchPoint.hasBeenInvalidated(); } /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java index d8e76082996..61912332fc8 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java @@ -950,7 +950,7 @@ public final class PropertyMap implements Iterable, Serializable { @Override public void remove() { - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException("remove"); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java index 2d5ccc05c6d..7ef0e3562db 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java @@ -26,11 +26,11 @@ package jdk.nashorn.internal.runtime; import static jdk.nashorn.internal.lookup.Lookup.MH; - import java.io.IOException; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -454,7 +454,7 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp // CompilationEnvironment#declareLocalSymbol()). if (log.isEnabled()) { - log.info("Type specialization of '", functionName, "' signature: ", actualCallSiteType); + log.info("Parameter type specialization of '", functionName, "' signature: ", actualCallSiteType); } final boolean persistentCache = usePersistentCodeCache() && persist; @@ -597,6 +597,8 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp * Initializes this function data with the eagerly generated version of the code. This method can only be invoked * by the compiler internals in Nashorn and is public for implementation reasons only. Attempting to invoke it * externally will result in an exception. + * + * @param initializer FunctionInitializer for this data */ public void initializeCode(final FunctionInitializer initializer) { // Since the method is public, we double-check that we aren't invoked with an inappropriate compile unit. @@ -658,8 +660,8 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp @Override - synchronized CompiledFunction getBest(final MethodType callSiteType, final ScriptObject runtimeScope) { - CompiledFunction existingBest = super.getBest(callSiteType, runtimeScope); + synchronized CompiledFunction getBest(final MethodType callSiteType, final ScriptObject runtimeScope, final Collection forbidden) { + CompiledFunction existingBest = super.getBest(callSiteType, runtimeScope, forbidden); if (existingBest == null) { existingBest = addCode(compileTypeSpecialization(callSiteType, runtimeScope, true), callSiteType); } @@ -723,6 +725,10 @@ public final class RecompilableScriptFunctionData extends ScriptFunctionData imp return functionNodeId; } + /** + * Get the source for the script + * @return source + */ public Source getSource() { return source; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java index e6034bf565f..cd528a01a1c 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java @@ -181,9 +181,6 @@ public final class ScriptEnvironment { /** print symbols and their contents for the script */ public final boolean _print_symbols; - /** range analysis for known types */ - public final boolean _range_analysis; - /** is this environment in scripting mode? */ public final boolean _scripting; @@ -255,7 +252,6 @@ public final class ScriptEnvironment { _print_parse = options.getBoolean("print.parse"); _print_lower_parse = options.getBoolean("print.lower.parse"); _print_symbols = options.getBoolean("print.symbols"); - _range_analysis = options.getBoolean("range.analysis"); _scripting = options.getBoolean("scripting"); _strict = options.getBoolean("strict"); _version = options.getBoolean("version"); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java index d9f71a2a349..60d880bf079 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java @@ -30,26 +30,29 @@ import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.lang.invoke.SwitchPoint; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.Collections; - +import java.util.HashSet; +import java.util.List; import jdk.internal.dynalink.CallSiteDescriptor; import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.internal.dynalink.linker.LinkRequest; import jdk.internal.dynalink.support.Guards; import jdk.nashorn.internal.codegen.ApplySpecialization; +import jdk.nashorn.internal.codegen.Compiler; import jdk.nashorn.internal.codegen.CompilerConstants.Call; import jdk.nashorn.internal.objects.Global; import jdk.nashorn.internal.objects.NativeFunction; -import jdk.nashorn.internal.runtime.ScriptFunctionData; -import jdk.nashorn.internal.runtime.ScriptObject; -import jdk.nashorn.internal.runtime.ScriptRuntime; +import jdk.nashorn.internal.objects.annotations.SpecializedFunction.LinkLogic; import jdk.nashorn.internal.runtime.linker.Bootstrap; import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor; +import jdk.nashorn.internal.runtime.logging.DebugLogger; /** * Runtime representation of a JavaScript function. @@ -114,7 +117,7 @@ public abstract class ScriptFunction extends ScriptObject { final MethodHandle methodHandle, final PropertyMap map, final ScriptObject scope, - final MethodHandle[] specs, + final Specialization[] specs, final int flags) { this(new FinalScriptFunctionData(name, methodHandle, specs, flags), map, scope); @@ -468,13 +471,12 @@ public abstract class ScriptFunction extends ScriptObject { protected GuardedInvocation findNewMethod(final CallSiteDescriptor desc, final LinkRequest request) { final MethodType type = desc.getMethodType(); assert desc.getMethodType().returnType() == Object.class && !NashornCallSiteDescriptor.isOptimistic(desc); - final CompiledFunction cf = data.getBestConstructor(type, scope); + final CompiledFunction cf = data.getBestConstructor(type, scope, CompiledFunction.NO_FUNCTIONS); final GuardedInvocation bestCtorInv = cf.createConstructorInvocation(); //TODO - ClassCastException return new GuardedInvocation(pairArguments(bestCtorInv.getInvocation(), type), getFunctionGuard(this, cf.getFlags()), bestCtorInv.getSwitchPoints(), null); } - @SuppressWarnings("unused") private static Object wrapFilter(final Object obj) { if (obj instanceof ScriptObject || !ScriptFunctionData.isPrimitiveThis(obj)) { return obj; @@ -489,6 +491,35 @@ public abstract class ScriptFunction extends ScriptObject { return Context.getGlobal(); } + /** + * Some receivers are primitive, in that case, according to the Spec we create a new + * native object per callsite with the wrap filter. We can only apply optimistic builtins + * if there is no per instance state saved for these wrapped objects (e.g. currently NativeStrings), + * otherwise we can't create optimistic versions + * + * @param self receiver + * @param linkLogicClass linkLogicClass, or null if no link logic exists + * @return link logic instance, or null if one could not be constructed for this receiver + */ + private LinkLogic getLinkLogic(final Object self, final Class linkLogicClass) { + if (linkLogicClass == null) { + return LinkLogic.EMPTY_INSTANCE; //always OK to link this, specialization but without special linking logic + } + + if (!Context.getContextTrusted().getEnv()._optimistic_types) { + return null; //if optimistic types are off, optimistic builtins are too + } + + final Object wrappedSelf = wrapFilter(self); + if (wrappedSelf instanceof OptimisticBuiltins) { + if (wrappedSelf != self && ((OptimisticBuiltins)wrappedSelf).hasPerInstanceAssumptions()) { + return null; //pessimistic - we created a wrapped object different from the primitive, but the assumptions have instance state + } + return ((OptimisticBuiltins)wrappedSelf).getLinkLogic(linkLogicClass); + } + return null; + } + /** * dyn:call call site signature: (callee, thiz, [args...]) * generated method signature: (callee, thiz, [args...]) @@ -547,8 +578,53 @@ public abstract class ScriptFunction extends ScriptObject { } } //else just fall through and link as ordinary function or unstable apply - final int programPoint = NashornCallSiteDescriptor.isOptimistic(desc) ? NashornCallSiteDescriptor.getProgramPoint(desc) : INVALID_PROGRAM_POINT; - final CompiledFunction cf = data.getBestInvoker(type, scope); + int programPoint = INVALID_PROGRAM_POINT; + if (NashornCallSiteDescriptor.isOptimistic(desc)) { + programPoint = NashornCallSiteDescriptor.getProgramPoint(desc); + } + + CompiledFunction cf = data.getBestInvoker(type, scope, CompiledFunction.NO_FUNCTIONS); + final Object self = request.getArguments()[1]; + final Collection forbidden = new HashSet<>(); + + //check for special fast versions of the compiled function + final List sps = new ArrayList<>(); + Class exceptionGuard = null; + + while (cf.isSpecialization()) { + final Class linkLogicClass = cf.getLinkLogicClass(); + //if linklogic is null, we can always link with the standard mechanism, it's still a specialization + final LinkLogic linkLogic = getLinkLogic(self, linkLogicClass); + + if (linkLogic != null && linkLogic.checkLinkable(self, desc, request)) { + final DebugLogger log = Context.getContextTrusted().getLogger(Compiler.class); + + if (log.isEnabled()) { + log.info("Linking optimistic builtin function: '", name, "' args=", Arrays.toString(request.getArguments()), " desc=", desc); + } + + final SwitchPoint[] msps = linkLogic.getModificationSwitchPoints(); + if (msps != null) { + for (final SwitchPoint sp : msps) { + if (sp != null) { + assert !sp.hasBeenInvalidated(); + sps.add(sp); + } + } + } + + exceptionGuard = linkLogic.getRelinkException(); + + break; + } + + //could not link this specialization because link check failed + forbidden.add(cf); + final CompiledFunction oldCf = cf; + cf = data.getBestInvoker(type, scope, forbidden); + assert oldCf != cf; + } + final GuardedInvocation bestInvoker = cf.createFunctionInvocation(type.returnType(), programPoint); final MethodHandle callHandle = bestInvoker.getInvocation(); @@ -588,7 +664,20 @@ public abstract class ScriptFunction extends ScriptObject { boundHandle = pairArguments(boundHandle, type); - return new GuardedInvocation(boundHandle, guard == null ? getFunctionGuard(this, cf.getFlags()) : guard, bestInvoker.getSwitchPoints(), null); + if (bestInvoker.getSwitchPoints() != null) { + sps.addAll(Arrays.asList(bestInvoker.getSwitchPoints())); + } + final SwitchPoint[] spsArray = sps.isEmpty() ? null : sps.toArray(new SwitchPoint[sps.size()]); + + return new GuardedInvocation( + boundHandle, + guard == null ? + getFunctionGuard( + this, + cf.getFlags()) : + guard, + spsArray, + exceptionGuard); } private GuardedInvocation createApplyOrCallCall(final boolean isApply, final CallSiteDescriptor desc, final LinkRequest request, final Object[] args) { @@ -610,7 +699,7 @@ public abstract class ScriptFunction extends ScriptObject { //box call back to apply CallSiteDescriptor appliedDesc = desc; - final SwitchPoint applyToCallSwitchPoint = Global.instance().getChangeCallback("apply"); + final SwitchPoint applyToCallSwitchPoint = Global.getBuiltinFunctionApplySwitchPoint(); //enough to change the proto switchPoint here final boolean isApplyToCall = NashornCallSiteDescriptor.isApplyToCall(desc); @@ -656,7 +745,7 @@ public abstract class ScriptFunction extends ScriptObject { } } - appliedDesc = appliedDesc.changeMethodType(appliedType); + appliedDesc = appliedDesc.changeMethodType(appliedType); //no extra args // Create the same arguments for the delegate linking request that would be passed in an actual apply'd invocation final Object[] appliedArgs = new Object[isApply ? 3 : appliedType.parameterCount()]; @@ -681,6 +770,7 @@ public abstract class ScriptFunction extends ScriptObject { // Ask the linker machinery for an invocation of the target function final LinkRequest appliedRequest = request.replaceArguments(appliedDesc, appliedArgs); + GuardedInvocation appliedInvocation; try { appliedInvocation = Bootstrap.getLinkerServices().getGuardedInvocation(appliedRequest); @@ -742,7 +832,7 @@ public abstract class ScriptFunction extends ScriptObject { // We need to account for the dropped (apply|call) function argument. guard = MH.dropArguments(guard, 0, descType.parameterType(0)); // Take the "isApplyFunction" guard, and bind it to this function. - MethodHandle applyFnGuard = MH.insertArguments(IS_APPLY_FUNCTION, 2, this); + MethodHandle applyFnGuard = MH.insertArguments(IS_APPLY_FUNCTION, 2, this); //TODO replace this with switchpoint // Adapt the guard to receive all the arguments that the original guard does. applyFnGuard = MH.dropArguments(applyFnGuard, 2, guardType.parameterArray()); // Fold the original function guard into our apply guard. @@ -894,6 +984,7 @@ public abstract class ScriptFunction extends ScriptObject { return self instanceof ScriptFunction && ((ScriptFunction)self).data == data && arg instanceof ScriptObject; } + //TODO this can probably be removed given that we have builtin switchpoints in the context @SuppressWarnings("unused") private static boolean isApplyFunction(final boolean appliedFnCondition, final Object self, final Object expectedSelf) { // NOTE: we're using self == expectedSelf as we're only using this with built-in functions apply() and call() diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java index d92b12d9d66..3472cda1012 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java @@ -28,13 +28,13 @@ package jdk.nashorn.internal.runtime; import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; - import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; +import java.util.Collection; import java.util.LinkedList; import java.util.List; import jdk.nashorn.internal.runtime.linker.LinkerCallSite; @@ -136,7 +136,7 @@ public abstract class ScriptFunctionData implements Serializable { final MethodHandle boundInvoker = bindInvokeHandle(originalInv.createComposableInvoker(), fn, self, args); if (isConstructor()) { - return new CompiledFunction(boundInvoker, bindConstructHandle(originalInv.createComposableConstructor(), fn, args)); + return new CompiledFunction(boundInvoker, bindConstructHandle(originalInv.createComposableConstructor(), fn, args), null); } return new CompiledFunction(boundInvoker); @@ -224,18 +224,22 @@ public abstract class ScriptFunctionData implements Serializable { * @param callSiteType callsite type * @return compiled function object representing the best invoker. */ - final CompiledFunction getBestInvoker(final MethodType callSiteType, final ScriptObject runtimeScope) { - final CompiledFunction cf = getBest(callSiteType, runtimeScope); + final CompiledFunction getBestInvoker(final MethodType callSiteType, final ScriptObject runtimeScope) { + return getBestInvoker(callSiteType, runtimeScope, CompiledFunction.NO_FUNCTIONS); + } + + final CompiledFunction getBestInvoker(final MethodType callSiteType, final ScriptObject runtimeScope, final Collection forbidden) { + final CompiledFunction cf = getBest(callSiteType, runtimeScope, forbidden); assert cf != null; return cf; } - final CompiledFunction getBestConstructor(final MethodType callSiteType, final ScriptObject runtimeScope) { + final CompiledFunction getBestConstructor(final MethodType callSiteType, final ScriptObject runtimeScope, final Collection forbidden) { if (!isConstructor()) { throw typeError("not.a.constructor", toSource()); } // Constructor call sites don't have a "this", but getBest is meant to operate on "callee, this, ..." style - final CompiledFunction cf = getBest(callSiteType.insertParameterTypes(1, Object.class), runtimeScope); + final CompiledFunction cf = getBest(callSiteType.insertParameterTypes(1, Object.class), runtimeScope, forbidden); return cf; } @@ -350,7 +354,7 @@ public abstract class ScriptFunctionData implements Serializable { * scope is not known, but that might cause compilation of code that will need more deoptimization passes. * @return the best function for the specified call site type. */ - CompiledFunction getBest(final MethodType callSiteType, final ScriptObject runtimeScope) { + CompiledFunction getBest(final MethodType callSiteType, final ScriptObject runtimeScope, final Collection forbidden) { assert callSiteType.parameterCount() >= 2 : callSiteType; // Must have at least (callee, this) assert callSiteType.parameterType(0).isAssignableFrom(ScriptFunction.class) : callSiteType; // Callee must be assignable from script function @@ -363,8 +367,8 @@ public abstract class ScriptFunctionData implements Serializable { } CompiledFunction best = null; - for(final CompiledFunction candidate: code) { - if(candidate.betterThanFinal(best, callSiteType)) { + for (final CompiledFunction candidate: code) { + if (!forbidden.contains(candidate) && candidate.betterThanFinal(best, callSiteType)) { best = candidate; } } @@ -376,7 +380,7 @@ public abstract class ScriptFunctionData implements Serializable { abstract boolean isRecompilable(); CompiledFunction getGeneric(final ScriptObject runtimeScope) { - return getBest(getGenericType(), runtimeScope); + return getBest(getGenericType(), runtimeScope, CompiledFunction.NO_FUNCTIONS); } /** @@ -420,7 +424,7 @@ public abstract class ScriptFunctionData implements Serializable { final List boundList = new LinkedList<>(); final ScriptObject runtimeScope = fn.getScope(); - final CompiledFunction bindTarget = new CompiledFunction(getGenericInvoker(runtimeScope), getGenericConstructor(runtimeScope)); + final CompiledFunction bindTarget = new CompiledFunction(getGenericInvoker(runtimeScope), getGenericConstructor(runtimeScope), null); boundList.add(bind(bindTarget, fn, self, allArgs)); return new FinalScriptFunctionData(name, Math.max(0, getArity() - length), boundList, boundFlags); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java index 8d616b58e6a..62b12adee3e 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java @@ -47,7 +47,6 @@ import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.isValid; import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndex; import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex; import static jdk.nashorn.internal.runtime.linker.NashornGuards.explicitInstanceOfCheck; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; @@ -820,6 +819,19 @@ public abstract class ScriptObject implements PropertyAccess { return false; } + private SwitchPoint findBuiltinSwitchPoint(final String key) { + for (ScriptObject myProto = getProto(); myProto != null; myProto = myProto.getProto()) { + final Property prop = myProto.getMap().findProperty(key); + if (prop != null) { + final SwitchPoint sp = prop.getBuiltinSwitchPoint(); + if (sp != null && !sp.hasBeenInvalidated()) { + return sp; + } + } + } + return null; + } + /** * Add a new property to the object. *

          @@ -1513,6 +1525,23 @@ public abstract class ScriptObject implements PropertyAccess { flags |= IS_LENGTH_NOT_WRITABLE; } + /** + * Get the {@link ArrayData}, for this ScriptObject, ensuring it is of a type + * that can handle elementType + * @param elementType elementType + * @return array data + */ + public final ArrayData getArray(final Class elementType) { + if (elementType == null) { + return arrayData; + } + final ArrayData newArrayData = arrayData.convert(elementType); + if (newArrayData != arrayData) { + arrayData = newArrayData; + } + return newArrayData; + } + /** * Get the {@link ArrayData} for this ScriptObject if it is an array * @return array data @@ -1916,17 +1945,6 @@ public abstract class ScriptObject implements PropertyAccess { return MH.filterArguments(methodHandle, 0, filter.asType(filter.type().changeReturnType(methodHandle.type().parameterType(0)))); } - //this will only return true if apply is still builtin - private static SwitchPoint checkReservedName(final CallSiteDescriptor desc, final LinkRequest request) { - final boolean isApplyToCall = NashornCallSiteDescriptor.isApplyToCall(desc); - final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND); - if ("apply".equals(name) && isApplyToCall && Global.instance().isSpecialNameValid(name)) { - assert Global.instance().getChangeCallback("apply") == Global.instance().getChangeCallback("call"); - return Global.instance().getChangeCallback("apply"); - } - return null; - } - /** * Find the appropriate GET method for an invoke dynamic call. * @@ -1938,14 +1956,13 @@ public abstract class ScriptObject implements PropertyAccess { */ protected GuardedInvocation findGetMethod(final CallSiteDescriptor desc, final LinkRequest request, final String operator) { final boolean explicitInstanceOfCheck = explicitInstanceOfCheck(desc, request); - final String name; - final SwitchPoint reservedNameSwitchPoint; - reservedNameSwitchPoint = checkReservedName(desc, request); - if (reservedNameSwitchPoint != null) { - name = "call"; //turn apply into call, it is the builtin apply and has been modified to explode args - } else { - name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND); + String name; + name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND); + if (NashornCallSiteDescriptor.isApplyToCall(desc)) { + if (Global.isBuiltinFunctionPrototypeApply()) { + name = "call"; + } } if (request.isCallSiteUnstable() || hasWithScope()) { @@ -2006,7 +2023,7 @@ public abstract class ScriptObject implements PropertyAccess { assert OBJECT_FIELDS_ONLY || guard != null : "we always need a map guard here"; final GuardedInvocation inv = new GuardedInvocation(mh, guard, protoSwitchPoint, exception); - return inv.addSwitchPoint(reservedNameSwitchPoint); + return inv.addSwitchPoint(findBuiltinSwitchPoint(name)); } private static GuardedInvocation findMegaMorphicGetMethod(final CallSiteDescriptor desc, final String name, final boolean isMethod) { @@ -2166,7 +2183,7 @@ public abstract class ScriptObject implements PropertyAccess { } } - final GuardedInvocation inv = new SetMethodCreator(this, find, desc, request).createGuardedInvocation(); + final GuardedInvocation inv = new SetMethodCreator(this, find, desc, request).createGuardedInvocation(findBuiltinSwitchPoint(name)); final GuardedInvocation cinv = Global.getConstants().findSetMethod(find, this, inv, desc, request); if (cinv != null) { @@ -2429,7 +2446,7 @@ public abstract class ScriptObject implements PropertyAccess { @Override public void remove() { - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException("remove"); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java index 47b2a8dab82..e927d4fce1d 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java @@ -32,9 +32,9 @@ import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError; import static jdk.nashorn.internal.runtime.ECMAErrors.syntaxError; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.JSType.isRepresentableAsInt; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; +import java.lang.invoke.SwitchPoint; import java.lang.reflect.Array; import java.util.Collections; import java.util.Iterator; @@ -46,6 +46,7 @@ import java.util.Objects; import jdk.internal.dynalink.beans.StaticClass; import jdk.nashorn.api.scripting.JSObject; import jdk.nashorn.api.scripting.ScriptObjectMirror; +import jdk.nashorn.internal.codegen.ApplySpecialization; import jdk.nashorn.internal.codegen.CompilerConstants; import jdk.nashorn.internal.codegen.CompilerConstants.Call; import jdk.nashorn.internal.ir.debug.JSONWriter; @@ -112,6 +113,11 @@ public final class ScriptRuntime { */ public static final Call THROW_REFERENCE_ERROR = staticCall(MethodHandles.lookup(), ScriptRuntime.class, "throwReferenceError", void.class, String.class); + /** + * Used to invalidate builtin names, e.g "Function" mapping to all properties in Function.prototype and Function.prototype itself. + */ + public static final Call INVALIDATE_RESERVED_BUILTIN_NAME = staticCallNoLookup(ScriptRuntime.class, "invalidateReservedBuiltinName", void.class, String.class); + /** * Converts a switch tag value to a simple integer. deflt value if it can't. * @@ -290,7 +296,7 @@ public final class ScriptRuntime { @Override public void remove() { - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException("remove"); } } @@ -328,7 +334,7 @@ public final class ScriptRuntime { @Override public void remove() { - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException("remove"); } }; } @@ -998,4 +1004,19 @@ public final class ScriptRuntime { return nx < ny; } + /** + * Tag a reserved name as invalidated - used when someone writes + * to a property with this name - overly conservative, but link time + * is too late to apply e.g. apply->call specialization + * @param name property name + */ + public static void invalidateReservedBuiltinName(final String name) { + final Context context = Context.getContextTrusted(); + final SwitchPoint sp = context.getBuiltinSwitchPoint(name); + assert sp != null; + if (sp != null) { + context.getLogger(ApplySpecialization.class).info("Overwrote special name '" + name +"' - invalidating switchpoint"); + SwitchPoint.invalidateAll(new SwitchPoint[] { sp }); + } + } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java index 99ec3135a85..90bbf43c8a6 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java @@ -28,7 +28,6 @@ package jdk.nashorn.internal.runtime; import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError; import static jdk.nashorn.internal.runtime.JSType.getAccessorTypeIndex; - import java.lang.invoke.MethodHandle; import java.lang.invoke.SwitchPoint; import jdk.internal.dynalink.CallSiteDescriptor; @@ -81,8 +80,8 @@ final class SetMethodCreator { * Creates the actual guarded invocation that represents the dynamic setter method for the property. * @return the actual guarded invocation that represents the dynamic setter method for the property. */ - GuardedInvocation createGuardedInvocation() { - return createSetMethod().createGuardedInvocation(); + GuardedInvocation createGuardedInvocation(final SwitchPoint builtinSwitchPoint) { + return createSetMethod(builtinSwitchPoint).createGuardedInvocation(); } /** @@ -119,7 +118,7 @@ final class SetMethodCreator { } } - private SetMethod createSetMethod() { + private SetMethod createSetMethod(final SwitchPoint builtinSwitchPoint) { if (find != null) { return createExistingPropertySetter(); } @@ -130,7 +129,7 @@ final class SetMethodCreator { return createGlobalPropertySetter(); } - return createNewPropertySetter(); + return createNewPropertySetter(builtinSwitchPoint); } private void checkStrictCreateNewVariable() { @@ -185,8 +184,8 @@ final class SetMethodCreator { return new SetMethod(MH.filterArguments(global.addSpill(type, getName()), 0, ScriptObject.GLOBALFILTER), null); } - private SetMethod createNewPropertySetter() { - final SetMethod sm = map.getFreeFieldSlot() > -1 ? createNewFieldSetter() : createNewSpillPropertySetter(); + private SetMethod createNewPropertySetter(final SwitchPoint builtinSwitchPoint) { + final SetMethod sm = map.getFreeFieldSlot() > -1 ? createNewFieldSetter(builtinSwitchPoint) : createNewSpillPropertySetter(builtinSwitchPoint); final PropertyListeners listeners = map.getListeners(); if (listeners != null) { listeners.propertyAdded(sm.property); @@ -194,7 +193,9 @@ final class SetMethodCreator { return sm; } - private SetMethod createNewSetter(final Property property) { + private SetMethod createNewSetter(final Property property, final SwitchPoint builtinSwitchPoint) { + property.setBuiltinSwitchPoint(builtinSwitchPoint); + final PropertyMap oldMap = getMap(); final PropertyMap newMap = getNewMap(property); final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc); @@ -230,12 +231,12 @@ final class SetMethodCreator { return new SetMethod(MH.asType(MH.guardWithTest(extCheck, casGuard, nop), fastSetter.type()), property); } - private SetMethod createNewFieldSetter() { - return createNewSetter(new AccessorProperty(getName(), 0, sobj.getClass(), getMap().getFreeFieldSlot(), type)); + private SetMethod createNewFieldSetter(final SwitchPoint builtinSwitchPoint) { + return createNewSetter(new AccessorProperty(getName(), 0, sobj.getClass(), getMap().getFreeFieldSlot(), type), builtinSwitchPoint); } - private SetMethod createNewSpillPropertySetter() { - return createNewSetter(new SpillProperty(getName(), 0, getMap().getFreeSpillSlot(), type)); + private SetMethod createNewSpillPropertySetter(final SwitchPoint builtinSwitchPoint) { + return createNewSetter(new SpillProperty(getName(), 0, getMap().getFreeSpillSlot(), type), builtinSwitchPoint); } private PropertyMap getNewMap(final Property property) { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Specialization.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Specialization.java new file mode 100644 index 00000000000..9807cc61e84 --- /dev/null +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Specialization.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2010, 2014, 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. + */ + +package jdk.nashorn.internal.runtime; + +import java.lang.invoke.MethodHandle; +import jdk.nashorn.internal.objects.annotations.SpecializedFunction; +import jdk.nashorn.internal.objects.annotations.SpecializedFunction.LinkLogic; + +/** + * Specialization info for a {@link SpecializedFunction} + */ +public final class Specialization { + private final MethodHandle mh; + private final Class linkLogicClass; + private final boolean isOptimistic; + + /** + * Constructor + * + * @param mh invoker method handler + */ + public Specialization(final MethodHandle mh) { + this(mh, false); + } + + /** + * Constructor + * + * @param mh invoker method handler + * @param isOptimistic is this an optimistic native method, i.e. can it throw {@link UnwarrantedOptimismException} + * which would have to lead to a relink and return value processing + */ + public Specialization(final MethodHandle mh, final boolean isOptimistic) { + this(mh, null, isOptimistic); + } + + /** + * Constructor + * + * @param mh invoker method handler + * @param linkLogicClass extra link logic needed for this function. Instances of this class also contains logic for checking + * if this can be linked on its first encounter, which is needed as per our standard linker semantics + * @param isOptimistic is this an optimistic native method, i.e. can it throw {@link UnwarrantedOptimismException} + * which would have to lead to a relink and return value processing + */ + public Specialization(final MethodHandle mh, final Class linkLogicClass, final boolean isOptimistic) { + this.mh = mh; + this.isOptimistic = isOptimistic; + if (linkLogicClass != null) { + //null out the "empty" link logic class for optimization purposes + //we only use the empty instance because we can't default class annotations + //to null + this.linkLogicClass = LinkLogic.isEmpty(linkLogicClass) ? null : linkLogicClass; + } else { + this.linkLogicClass = null; + } + } + + /** + * Get the method handle for the invoker of this ScriptFunction + * @return the method handle + */ + public MethodHandle getMethodHandle() { + return mh; + } + + /** + * Get the link logic class for this ScriptFunction + * @return link logic class info, i.e. one whose instance contains stuff like + * "do we need exception check for every call", and logic to check if we may link + */ + public Class getLinkLogicClass() { + return linkLogicClass; + } + + /** + * An optimistic specialization is one that can throw UnwarrantedOptimismException. + * This is allowed for native methods, as long as they are functional, i.e. don't change + * any state between entering and throwing the UOE. Then we can re-execute a wider version + * of the method in the continuation. Rest-of method generation for optimistic builtins is + * of course not possible, but this approach works and fits into the same relinking + * framework + * + * @return true if optimistic + */ + public boolean isOptimistic() { + return isOptimistic; + } + +} + diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java index 5b6a77b2926..14a0ced0c05 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java @@ -55,8 +55,10 @@ public final class StoredScript implements Serializable { /** * Constructor. * + * @param compilationId compilation id * @param mainClassName main class name * @param classBytes map of class names to class bytes + * @param initializers initializer map, id -> FunctionInitializer * @param constants constants array */ public StoredScript(final int compilationId, final String mainClassName, final Map classBytes, final Map initializers, final Object[] constants) { @@ -67,6 +69,10 @@ public final class StoredScript implements Serializable { this.initializers = initializers; } + /** + * Get the compilation id for this StoredScript + * @return compilation id + */ public int getCompilationId() { return compilationId; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/UserAccessorProperty.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/UserAccessorProperty.java index 7350ff43551..5fdec0094a3 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/UserAccessorProperty.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/UserAccessorProperty.java @@ -25,7 +25,6 @@ package jdk.nashorn.internal.runtime; -import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall; import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.JSType.CONVERT_OBJECT_OPTIMISTIC; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java index 897636ebe44..49667465bfb 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.runtime.arrays; import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.nio.ByteBuffer; @@ -58,7 +57,7 @@ public abstract class ArrayData { /** * Length of the array data. Not necessarily length of the wrapped array. */ - private long length; + protected long length; /** * Method handle to throw an {@link UnwarrantedOptimismException} when getting an element @@ -520,7 +519,7 @@ public abstract class ArrayData { * @param type new element type * @return new array data */ - protected abstract ArrayData convert(Class type); + public abstract ArrayData convert(Class type); /** * Push an array of items to the end of the array @@ -655,7 +654,7 @@ public abstract class ArrayData { * @param size current size * @return next size to allocate for internal array */ - protected static int nextSize(final int size) { + public static int nextSize(final int size) { return alignUp(size + 1) * 2; } @@ -681,6 +680,18 @@ public abstract class ArrayData { } } + /** + * Find a fast call if one exists + * + * @param clazz array data class + * @param desc callsite descriptor + * @param request link request + * @return fast property getter if one is found + */ + public GuardedInvocation findFastCallMethod(final Class clazz, final CallSiteDescriptor desc, final LinkRequest request) { + return null; + } + /** * Find a fast property getter if one exists * diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java index be41673b2af..8313589f490 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java @@ -201,7 +201,7 @@ abstract class ArrayFilter extends ArrayData { } @Override - protected ArrayData convert(final Class type) { + public ArrayData convert(final Class type) { underlying = underlying.convert(type); setLength(underlying.length()); return this; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java index f6e4d38c854..202499e2222 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java @@ -30,7 +30,6 @@ import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.JSType.getAccessorTypeIndex; import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT; import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.isValid; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; @@ -115,6 +114,12 @@ public abstract class ContinuousArrayData extends ArrayData { return index; } + /** + * Returns the type used to store an element in this array + * @return element type + */ + public abstract Class getElementType(); + /** * Look up a continuous array element getter * @param get getter, sometimes combined with a has check that throws CCE on failure for relink @@ -175,11 +180,6 @@ public abstract class ContinuousArrayData extends ArrayData { return MH.asType(setHas, setHas.type().changeParameterType(2, elementType).changeParameterType(0, clazz)); } - @Override - public GuardedInvocation findFastGetMethod(final Class clazz, final CallSiteDescriptor desc, final LinkRequest request, final String operator) { - return null; - } - /** Fast access guard - it is impractical for JIT performance reasons to use only CCE asType as guard :-(, also we need the null case explicitly, which is the one that CCE doesn't handle */ protected static final MethodHandle FAST_ACCESS_GUARD = @@ -269,4 +269,72 @@ public abstract class ContinuousArrayData extends ArrayData { return null; } + + /** + * Specialization - fast push implementation + * @param arg argument + * @return new array length + */ + public long fastPush(final int arg) { + throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink + } + + /** + * Specialization - fast push implementation + * @param arg argument + * @return new array length + */ + public long fastPush(final long arg) { + throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink + } + + /** + * Specialization - fast push implementation + * @param arg argument + * @return new array length + */ + public long fastPush(final double arg) { + throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink + } + + /** + * Specialization - fast push implementation + * @param arg argument + * @return new array length + */ + public long fastPush(final Object arg) { + throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink + } + + /** + * Specialization - fast pop implementation + * @return element value + */ + public int fastPopInt() { + throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink + } + + /** + * Specialization - fast pop implementation + * @return element value + */ + public long fastPopLong() { + throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink + } + + /** + * Specialization - fast pop implementation + * @return element value + */ + public double fastPopDouble() { + throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink + } + + /** + * Specialization - fast pop implementation + * @return element value + */ + public Object fastPopObject() { + throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink + } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntArrayData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntArrayData.java index 57d0cd90e45..01f872a8e96 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntArrayData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntArrayData.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.runtime.arrays; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.util.Arrays; @@ -38,7 +37,7 @@ import jdk.nashorn.internal.runtime.ScriptRuntime; * Implementation of {@link ArrayData} as soon as an int has been * written to the array. This is the default data for new arrays */ -final class IntArrayData extends ContinuousArrayData { +final class IntArrayData extends ContinuousArrayData implements IntElements { /** * The wrapped array */ @@ -64,9 +63,19 @@ final class IntArrayData extends ContinuousArrayData { this.array = array; } + @Override + public Class getElementType() { + return int.class; + } + private static final MethodHandle HAS_GET_ELEM = specialCall(MethodHandles.lookup(), IntArrayData.class, "getElem", int.class, int.class).methodHandle(); private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), IntArrayData.class, "setElem", void.class, int.class, int.class).methodHandle(); + @Override + public Object[] asObjectArray() { + return toObjectArray(); + } + @SuppressWarnings("unused") private int getElem(final int index) { if (has(index)) { @@ -99,11 +108,6 @@ final class IntArrayData extends ContinuousArrayData { return new IntArrayData(array.clone(), (int) length()); } - @Override - public Object[] asObjectArray() { - return toObjectArray(array, (int) length()); - } - @Override public Object asArrayOfType(final Class componentType) { if (componentType == int.class) { @@ -112,7 +116,7 @@ final class IntArrayData extends ContinuousArrayData { return super.asArrayOfType(componentType); } - private static Object[] toObjectArray(final int[] array, final int length) { + private Object[] toObjectArray() { assert length <= array.length : "length exceeds internal array size"; final Object[] oarray = new Object[array.length]; @@ -123,7 +127,7 @@ final class IntArrayData extends ContinuousArrayData { return oarray; } - private static double[] toDoubleArray(final int[] array, final int length) { + private double[] toDoubleArray() { assert length <= array.length : "length exceeds internal array size"; final double[] darray = new double[array.length]; @@ -134,7 +138,7 @@ final class IntArrayData extends ContinuousArrayData { return darray; } - private static long[] toLongArray(final int[] array, final int length) { + private long[] toLongArray() { assert length <= array.length : "length exceeds internal array size"; final long[] larray = new long[array.length]; @@ -145,18 +149,30 @@ final class IntArrayData extends ContinuousArrayData { return larray; } + private LongArrayData convertToLong() { + return new LongArrayData(toLongArray(), (int)length); + } + + private NumberArrayData convertToDouble() { + return new NumberArrayData(toDoubleArray(), (int)length); + } + + private ObjectArrayData convertToObject() { + return new ObjectArrayData(toObjectArray(), (int)length); + } + @Override public ArrayData convert(final Class type) { if (type == Integer.class) { return this; } - final int length = (int) length(); if (type == Long.class) { - return new LongArrayData(IntArrayData.toLongArray(array, length), length); + return convertToLong(); } else if (type == Double.class) { - return new NumberArrayData(IntArrayData.toDoubleArray(array, length), length); + return convertToDouble(); } else { - return new ObjectArrayData(IntArrayData.toObjectArray(array, length), length); + assert type == null || (!Number.class.isAssignableFrom(type) && !type.isPrimitive()); + return convertToObject(); } } @@ -355,4 +371,41 @@ final class IntArrayData extends ContinuousArrayData { return returnValue; } + + @Override + public long fastPush(final int arg) { + final int len = (int)length; + if (len == array.length) { + array = Arrays.copyOf(array, nextSize(len)); + } + array[len] = arg; + return ++length; + } + + //length must not be zero + @Override + public int fastPopInt() { + if (length == 0) { + throw new ClassCastException(); //relink + } + final int newLength = (int)--length; + final int elem = array[newLength]; + array[newLength] = 0; + return elem; + } + + @Override + public long fastPopLong() { + return fastPopInt(); + } + + @Override + public double fastPopDouble() { + return fastPopInt(); + } + + @Override + public Object fastPopObject() { + return fastPopInt(); + } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/SpecializedConstructor.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntElements.java similarity index 51% rename from nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/SpecializedConstructor.java rename to nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntElements.java index 9e6bd0ad09c..5bd26843277 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/SpecializedConstructor.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntElements.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2014, 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 @@ -22,26 +22,13 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - -package jdk.nashorn.internal.objects.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; +package jdk.nashorn.internal.runtime.arrays; /** - * The SpecializedConstructor annotation is used to flag more type specific constructors than the standard one in - * Native objects. For example {@link jdk.nashorn.internal.objects.NativeArray#construct} takes an arbitrary number of - * Object elements as an array. Call this constructor, including the varargs collector that allocates the array - * upon each invocation, is much more expensive than calling a specialized constructor that takes one arguments - * of, e.g. int type from the call site, such as - * {@link jdk.nashorn.internal.objects.NativeArray#construct(boolean, Object, int)}. - * {@link jdk.nashorn.internal.runtime.ScriptFunction} will try to look up the most specific function when - * linking the callsite. + * Marker interface for any ContinuousArray with int elements + * Used for type checks that throw ClassCastExceptions and force relinks + * for fast NativeArray specializations of builtin methods */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface SpecializedConstructor { +public interface IntElements extends IntOrLongElements { //empty } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntOrLongElements.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntOrLongElements.java new file mode 100644 index 00000000000..f176d75757c --- /dev/null +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntOrLongElements.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2010, 2014, 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. + */ +package jdk.nashorn.internal.runtime.arrays; + +/** + * Marker interface for any ContinuousArray with int or long elements + * Used for type checks that throw ClassCastExceptions and force relinks + * for fast NativeArray specializations of builtin methods + */ +public interface IntOrLongElements extends NumericElements { + //empty +} diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LongArrayData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LongArrayData.java index 4fc0c63ecd7..c4f3142bb4c 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LongArrayData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LongArrayData.java @@ -27,7 +27,6 @@ package jdk.nashorn.internal.runtime.arrays; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; import static jdk.nashorn.internal.lookup.Lookup.MH; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.util.Arrays; @@ -39,7 +38,7 @@ import jdk.nashorn.internal.runtime.ScriptRuntime; * Implementation of {@link ArrayData} as soon as a long has been * written to the array */ -final class LongArrayData extends ContinuousArrayData { +final class LongArrayData extends ContinuousArrayData implements IntOrLongElements { /** * The wrapped array */ @@ -56,6 +55,11 @@ final class LongArrayData extends ContinuousArrayData { this.array = array; } + @Override + public Class getElementType() { + return long.class; + } + @Override public ArrayData copy() { return new LongArrayData(array.clone(), (int)length()); @@ -324,4 +328,41 @@ final class LongArrayData extends ContinuousArrayData { return returnValue; } + + @Override + public long fastPush(final int arg) { + return fastPush((long)arg); + } + + @Override + public long fastPush(final long arg) { + final int len = (int)length; + if (len == array.length) { + array = Arrays.copyOf(array, nextSize(len)); + } + array[len] = arg; + return ++length; + } + + @Override + public long fastPopLong() { + if (length == 0) { + throw new ClassCastException(); + } + final int newLength = (int)--length; + final long elem = array[newLength]; + array[newLength] = 0; + return elem; + //return array[(int)--length]; + } + + @Override + public double fastPopDouble() { + return fastPopLong(); + } + + @Override + public Object fastPopObject() { + return fastPopLong(); + } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java index 0739ae8ee05..4eeba6ffdb9 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java @@ -28,7 +28,6 @@ package jdk.nashorn.internal.runtime.arrays; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.util.Arrays; @@ -38,7 +37,7 @@ import jdk.nashorn.internal.codegen.types.Type; * Implementation of {@link ArrayData} as soon as a double has been * written to the array */ -final class NumberArrayData extends ContinuousArrayData { +final class NumberArrayData extends ContinuousArrayData implements NumericElements { /** * The wrapped array */ @@ -55,6 +54,11 @@ final class NumberArrayData extends ContinuousArrayData { this.array = array; } + @Override + public Class getElementType() { + return double.class; + } + @Override public ArrayData copy() { return new NumberArrayData(array.clone(), (int) length()); @@ -298,4 +302,41 @@ final class NumberArrayData extends ContinuousArrayData { return returnValue; } + + @Override + public long fastPush(final int arg) { + return fastPush((double)arg); + } + + @Override + public long fastPush(final long arg) { + return fastPush((double)arg); + } + + @Override + public long fastPush(final double arg) { + final int len = (int)length; + if (len == array.length) { + //note that fastpush never creates spares arrays, there is nothing to gain by that - it will just use even more memory + array = Arrays.copyOf(array, nextSize(len)); + } + array[len] = arg; + return ++length; + } + + @Override + public double fastPopDouble() { + if (length == 0) { + throw new ClassCastException(); + } + final int newLength = (int)--length; + final double elem = array[newLength]; + array[newLength] = 0; + return elem; + } + + @Override + public Object fastPopObject() { + return fastPopDouble(); + } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumericElements.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumericElements.java new file mode 100644 index 00000000000..ad940e2aa02 --- /dev/null +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumericElements.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2010, 2014, 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. + */ +package jdk.nashorn.internal.runtime.arrays; + +/** + * Marker interface for any ContinuousArray with numeric elements + * (int, long or double) + * Used for type checks that throw ClassCastExceptions and force relinks + * for fast NativeArray specializations of builtin methods + */ +public interface NumericElements { + //empty +} diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java index 636c8c256ac..7f563020002 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.runtime.arrays; import static jdk.nashorn.internal.codegen.CompilerConstants.specialCall; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.util.Arrays; @@ -56,9 +55,14 @@ final class ObjectArrayData extends ContinuousArrayData { this.array = array; } + @Override + public Class getElementType() { + return Object.class; + } + @Override public ArrayData copy() { - return new ObjectArrayData(array.clone(), (int) length()); + return new ObjectArrayData(array.clone(), (int)length); } @Override @@ -231,6 +235,42 @@ final class ObjectArrayData extends ContinuousArrayData { return new DeletedRangeArrayFilter(this, fromIndex, toIndex); } + @Override + public long fastPush(final int arg) { + return fastPush((Object)arg); + } + + @Override + public long fastPush(final long arg) { + return fastPush((Object)arg); + } + + @Override + public long fastPush(final double arg) { + return fastPush((Object)arg); + } + + @Override + public long fastPush(final Object arg) { + final int len = (int)length; + if (len == array.length) { + array = Arrays.copyOf(array, nextSize(len)); + } + array[len] = arg; + return ++length; + } + + @Override + public Object fastPopObject() { + if (length == 0) { + return ScriptRuntime.UNDEFINED; + } + final int newLength = (int)--length; + final Object elem = array[newLength]; + array[newLength] = ScriptRuntime.EMPTY; + return elem; + } + @Override public Object pop() { if (length() == 0) { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java index 623e3159f04..cfb38bdfbff 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java @@ -329,7 +329,7 @@ class SparseArrayData extends ArrayData { } @Override - protected ArrayData convert(final Class type) { + public ArrayData convert(final Class type) { underlying = underlying.convert(type); return this; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/TypedArrayData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/TypedArrayData.java index 291e59e068c..002dd8bc0f4 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/TypedArrayData.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/TypedArrayData.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.runtime.arrays; import static jdk.nashorn.internal.lookup.Lookup.MH; - import java.lang.invoke.MethodHandle; import java.nio.Buffer; import jdk.internal.dynalink.CallSiteDescriptor; @@ -134,7 +133,7 @@ public abstract class TypedArrayData extends ContinuousArrayDa } @Override - protected ArrayData convert(final Class type) { + public ArrayData convert(final Class type) { throw new UnsupportedOperationException(); } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java index f377c9d80f2..2a536bbf0a3 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java @@ -26,14 +26,16 @@ package jdk.nashorn.internal.runtime.linker; import static jdk.nashorn.internal.lookup.Lookup.MH; - import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; +import java.lang.invoke.SwitchPoint; import jdk.internal.dynalink.CallSiteDescriptor; import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.internal.dynalink.linker.LinkRequest; import jdk.internal.dynalink.support.Guards; +import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.FindProperty; +import jdk.nashorn.internal.runtime.GlobalConstants; import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.UserAccessorProperty; @@ -86,27 +88,41 @@ public final class PrimitiveLookup { final MethodHandle protoFilter) { final CallSiteDescriptor desc = request.getCallSiteDescriptor(); - if(desc.getNameTokenCount() > 2) { + //checks whether the property name is hard-coded in the call-site (i.e. a getProp vs a getElem, or setProp vs setElem) + //if it is we can make assumptions on the property: that if it is not defined on primitive wrapper itself it never will be. + //so in that case we can skip creation of primitive wrapper and start our search with the prototype. + if (desc.getNameTokenCount() > 2) { final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND); final FindProperty find = wrappedReceiver.findProperty(name, true); - if(find == null) { + + if (find == null) { // Give up early, give chance to BeanLinker and NashornBottomLinker to deal with it. return null; - } else if (find.isInherited() && !(find.getProperty() instanceof UserAccessorProperty)) { + } + + final SwitchPoint sp = find.getProperty().getBuiltinSwitchPoint(); //can use this instead of proto filter + if (sp instanceof Context.BuiltinSwitchPoint && !sp.hasBeenInvalidated()) { + return new GuardedInvocation(GlobalConstants.staticConstantGetter(find.getObjectValue()), guard, sp, null); + } + + if (find.isInherited() && !(find.getProperty() instanceof UserAccessorProperty)) { // If property is found in the prototype object bind the method handle directly to // the proto filter instead of going through wrapper instantiation below. final ScriptObject proto = wrappedReceiver.getProto(); final GuardedInvocation link = proto.lookup(desc, request); if (link != null) { - final MethodHandle invocation = link.getInvocation(); + final MethodHandle invocation = link.getInvocation(); //this contains the builtin switchpoint + final MethodHandle adaptedInvocation = MH.asType(invocation, invocation.type().changeParameterType(0, Object.class)); final MethodHandle method = MH.filterArguments(adaptedInvocation, 0, protoFilter); final MethodHandle protoGuard = MH.filterArguments(link.getGuard(), 0, protoFilter); + return new GuardedInvocation(method, NashornGuards.combineGuards(guard, protoGuard)); } } } + final GuardedInvocation link = wrappedReceiver.lookup(desc, request); if (link != null) { MethodHandle method = link.getInvocation(); @@ -116,8 +132,10 @@ public final class PrimitiveLookup { assert receiverType.isAssignableFrom(wrapType.returnType()); method = MH.filterArguments(method, 0, MH.asType(wrapFilter, wrapType.changeReturnType(receiverType))); } + return new GuardedInvocation(method, guard, link.getSwitchPoints(), null); } + return null; } } diff --git a/nashorn/test/examples/charcodeat-benchmark.js b/nashorn/test/examples/charcodeat-benchmark.js new file mode 100644 index 00000000000..308e2a07e68 --- /dev/null +++ b/nashorn/test/examples/charcodeat-benchmark.js @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2010, 2014, 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. + */ + +/** + * Simple benchmark to measure charCodeAt specialized method performance + */ + +var str = "sghjkdsfkjghsdfjkfkjdfkjdfjkdfjkfdjkfdkfldjfhdfpkjdhafgksdjfgldfgjldfkjgdlfjgldkfjgkldfj"; +var RESULT1 = 9187; +var RESULT2 = 1496; + +function f() { + var len = str.length; + var c = 0; + for (var i = 0; i < len; i++) { + c += str.charCodeAt(i); + } + return c; +} + +function bench(res) { + var d = new Date; + var sum = 0; + for (var i = 0; i < 1e6; i++) { + sum |= f(); + } + if (sum == res) { + print("Verified OK"); + } else { + print("Verification failed " + sum + " should be " + res); + } + print((new Date - d) + " ms"); +} + +bench(RESULT1); + +print("Replacing charCodeAt... "); + +String.prototype.charCodeAt = function() { return 17; } + +bench(RESULT2); + +print("Done"); diff --git a/nashorn/test/examples/push-pop-benchmark.js b/nashorn/test/examples/push-pop-benchmark.js new file mode 100644 index 00000000000..16f4c940223 --- /dev/null +++ b/nashorn/test/examples/push-pop-benchmark.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2010, 2014, 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. + */ + +/** + * Simple benchmark to measure push/pop specialized method performance + */ + +var a = []; + +var RESULT = 15; + +function bench() { + var sum = 0; + for (var i=0;i<10;i++) { + a.push(i); + } + for (var i=0;i<10;i++) { + sum |= a.pop(); + } + return sum; +} + +function runbench() { + var sum = 0; + for (var iters = 0; iters<1e8; iters++) { + sum |= bench(); + } + return sum; +} + +var d = new Date; +var res = runbench(); +print((new Date - d) + " ms"); +print(); +if (res != RESULT) { + print("ERROR: Wrong result - should be " + RESULT); +} else { + print("Verified OK - result is correct"); +} diff --git a/nashorn/test/script/basic/apply_to_call/apply_to_call5.js b/nashorn/test/script/basic/apply_to_call/apply_to_call5.js new file mode 100644 index 00000000000..adb9401ed16 --- /dev/null +++ b/nashorn/test/script/basic/apply_to_call/apply_to_call5.js @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2010, 2014, 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. + */ + +/** + * apply_to_call5.js - do one apply to call specialization, then override, apply and make sure it reverts (i.e. stops + * calling call) + * + * @test + * @run + */ + +print("start"); + +var x = { + a : 0, + b : 0, + c : 0, + initialize : function(x,y,z) { + this.a = x; + this.b = y; + this.c = z; + } +}; + +function test() { + x.initialize.apply(x, arguments); +} + +test(4711,23,17); +print(x.a); +print(x.b); +print(x.c); + +print("Overwriting apply now"); +x.initialize.apply = function() { print("New function for apply - not a property"); } + +test(4712); +print(x.a); + + +var x2 = { + a : 0, + b : 0, + c : 0, + initialize : function(x,y,z) { + this.a = x; + this.b = y; + this.c = z; + } +}; + +function test2() { + x2.initialize.apply(x2, arguments); +} + +test2(4711,23,17); +print(x2.a); +print(x2.b); +print(x2.c); + +print("Overwriting apply now"); +x2.initialize['apply'] = function() { print("New function for apply - not a property"); } + +test(4712); +print(x2.a); + +var x3 = { + a : 0, + b : 0, + c : 0, + initialize : function(x,y,z) { + this.a = x; + this.b = y; + this.c = z; + } +}; + +function test3() { + x3.initialize.apply(x3, arguments); +} + +test3(4711,23,17); +print(x3.a); +print(x3.b); +print(x3.c); + +print("Overwriting apply now"); +eval("x3.initialize['apply'] = function() { print('New function for apply - not a property'); }"); + +test(4712); +print(x3.a); diff --git a/nashorn/test/script/basic/apply_to_call/apply_to_call5.js.EXPECTED b/nashorn/test/script/basic/apply_to_call/apply_to_call5.js.EXPECTED new file mode 100644 index 00000000000..4d678e903e8 --- /dev/null +++ b/nashorn/test/script/basic/apply_to_call/apply_to_call5.js.EXPECTED @@ -0,0 +1,19 @@ +start +4711 +23 +17 +Overwriting apply now +New function for apply - not a property +4711 +4711 +23 +17 +Overwriting apply now +New function for apply - not a property +4711 +4711 +23 +17 +Overwriting apply now +New function for apply - not a property +4711 diff --git a/nashorn/test/script/basic/fastpushpop.js b/nashorn/test/script/basic/fastpushpop.js new file mode 100644 index 00000000000..fffd3f2307b --- /dev/null +++ b/nashorn/test/script/basic/fastpushpop.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2010, 2014, 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. + */ + +/** + * fastpushpop.js: make sure guards work for fast push implementation + * and normal one + * + * @test + * @run + */ + +var a = [1,2,3]; +a.push(4); +a.push(5); +a.push(6); +print(a); + +var a2 = Object.defineProperty(a,"length", { writable: false }); +try { + a2.push(7); +} catch (e) { + print("first: " + (e instanceof TypeError)); +} + +print(a2); + +var b = [1,2,3,,,,4711.17,"dingo!"]; +b.push(4); +b.push(5); +b.push(6); +print(b); + +var b2 = Object.defineProperty(b,"length", { writable: false }); +try { + b2.push(7); +} catch (e) { + print("second: " + (e instanceof TypeError)); +} + +print(b2); + diff --git a/nashorn/test/script/basic/fastpushpop.js.EXPECTED b/nashorn/test/script/basic/fastpushpop.js.EXPECTED new file mode 100644 index 00000000000..0120e1d9d0f --- /dev/null +++ b/nashorn/test/script/basic/fastpushpop.js.EXPECTED @@ -0,0 +1,6 @@ +1,2,3,4,5,6 +first: true +1,2,3,4,5,6,7 +1,2,3,,,,4711.17,dingo!,4,5,6 +second: true +1,2,3,,,,4711.17,dingo!,4,5,6,7 diff --git a/nashorn/test/script/basic/run-octane.js b/nashorn/test/script/basic/run-octane.js index 0c666f2f12c..97e34818325 100644 --- a/nashorn/test/script/basic/run-octane.js +++ b/nashorn/test/script/basic/run-octane.js @@ -54,7 +54,7 @@ function load_bench(arg) { } } - print_verbose(arg, "loading '" + arg.name + "' [" + f + "]..."); + print_verbose(arg, "loading '" + arg.name + "' [" + f + "]... " + file_name); load(file_name); } @@ -139,7 +139,7 @@ function run_one_benchmark(arg, iters) { mean_score /= iters; } catch (e) { print_always(arg, "*** Aborted and setting score to zero. Reason: " + e); - if (e instanceof java.lang.Throwable) { + if (is_this_nashorn() && e instanceof java.lang.Throwable) { e.printStackTrace(); } mean_score = min_score = max_score = 0; @@ -148,7 +148,7 @@ function run_one_benchmark(arg, iters) { var res = mean_score.toFixed(0); if (verbose) { - res += " ops/minute (" + min_score.toFixed(0) + "-" + max_score.toFixed(0) + "), warmup=" + scores[0].toFixed(0); + res += " ops/minute (" + min_score.toFixed(0) + "-" + max_score.toFixed(0) + "), warmup=" + scores[0].toFixed(0); } print_always(arg, res); } From d4f3f7da8fcae801f123c93269c68ceb5738378d Mon Sep 17 00:00:00 2001 From: Marcus Lagergren Date: Thu, 25 Sep 2014 18:21:15 +0200 Subject: [PATCH 73/81] 8059132: Nasgen build in JDK9 can't handle new class dependencies to Nashorn - bootstrapping problem Reviewed-by: sundar --- .../src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java | 3 +-- .../src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java index 1a99d828991..3d968e8e192 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java @@ -85,7 +85,6 @@ import java.util.List; import jdk.internal.org.objectweb.asm.Handle; import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.org.objectweb.asm.Type; -import jdk.nashorn.internal.objects.annotations.SpecializedFunction.LinkLogic; /** * Base class for all method generating classes. @@ -98,7 +97,7 @@ public class MethodGenerator extends MethodVisitor { private final Type returnType; private final Type[] argumentTypes; - static final Type EMPTY_LINK_LOGIC_TYPE = Type.getType(LinkLogic.getEmptyLinkLogicClass()); + static final Type EMPTY_LINK_LOGIC_TYPE = Type.getType("Ljdk/nashorn/internal/objects/annotations/SpecializedFunction$LinkLogic$Empty;"); MethodGenerator(final MethodVisitor mv, final int access, final String name, final String descriptor) { super(Main.ASM_VERSION, mv); diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java index 9e3dfc174ab..5436eb8fde3 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java @@ -38,7 +38,6 @@ import jdk.nashorn.internal.objects.annotations.Property; import jdk.nashorn.internal.objects.annotations.ScriptClass; import jdk.nashorn.internal.objects.annotations.Setter; import jdk.nashorn.internal.objects.annotations.SpecializedFunction; -import jdk.nashorn.internal.objects.annotations.SpecializedFunction.LinkLogic; import jdk.nashorn.internal.objects.annotations.Where; import jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind; @@ -56,8 +55,8 @@ public final class ScriptClassInfo { static final String SETTER_ANNO_DESC = Type.getDescriptor(Setter.class); static final String PROPERTY_ANNO_DESC = Type.getDescriptor(Property.class); static final String WHERE_ENUM_DESC = Type.getDescriptor(Where.class); - static final String LINK_LOGIC_DESC = Type.getDescriptor(LinkLogic.class); static final String SPECIALIZED_FUNCTION = Type.getDescriptor(SpecializedFunction.class); + static final String LINK_LOGIC_DESC = "Ljdk/nashorn/internal/objects/annotations/SpecializedFunction$LinkLogic;"; static final Map annotations = new HashMap<>(); From ea278f4b2208da9bfd52ea2902c206a72d3f294d Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Thu, 25 Sep 2014 21:16:00 +0400 Subject: [PATCH 74/81] 8059101: unshuffle_patch.sh should be able to deal with stdin/stdout Reviewed-by: dfuchs, chegar --- common/bin/unshuffle_patch.sh | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/common/bin/unshuffle_patch.sh b/common/bin/unshuffle_patch.sh index f237cca7999..f380fb6f2f1 100644 --- a/common/bin/unshuffle_patch.sh +++ b/common/bin/unshuffle_patch.sh @@ -35,11 +35,11 @@ usage() { exit 1 } -SCRIPT_DIR=`pwd`/`dirname $0` +SCRIPT_DIR=`dirname $0` UNSHUFFLE_LIST=$SCRIPT_DIR"/unshuffle_list.txt" if [ ! -f "$UNSHUFFLE_LIST" ] ; then - echo "FATAL: cannot find $UNSHUFFLE_LIST" + echo "FATAL: cannot find $UNSHUFFLE_LIST" >&2 exit 1 fi @@ -68,7 +68,7 @@ done # Make sure we have the right number of arguments if [ ! $# -eq 3 ] ; then - echo "ERROR: Invalid number of arguments." + echo "ERROR: Invalid number of arguments." >&2 usage fi @@ -83,21 +83,28 @@ for r in $repos ; do fi done if [ $found = "false" ] ; then - echo "ERROR: Unknown repo: $repo. Should be one of [$repos]." + echo "ERROR: Unknown repo: $repo. Should be one of [$repos]." >&2 usage fi # Check given input/output files input="$2" -output="$3" +if [ "x$input" = "x-" ] ; then + input="/dev/stdin" +fi -if [ ! -f $input ] ; then - echo "ERROR: Cannot find input patch file: $input" +if [ ! -f $input -a "x$input" != "x/dev/stdin" ] ; then + echo "ERROR: Cannot find input patch file: $input" >&2 exit 1 fi -if [ -f $output ] ; then - echo "ERROR: Output patch already exists: $output" +output="$3" +if [ "x$output" = "x-" ] ; then + output="/dev/stdout" +fi + +if [ -f $output -a "x$output" != "x/dev/stdout" ] ; then + echo "ERROR: Output patch already exists: $output" >&2 exit 1 fi @@ -105,7 +112,7 @@ what="" ## shuffle or unshuffle verbose() { if [ ${vflag} = "true" ] ; then - echo "$@" + echo "$@" >&2 fi } @@ -117,7 +124,7 @@ unshuffle() { path= if echo "$line" | egrep '^diff' > /dev/null ; then if ! echo "$line" | egrep '\-\-git' > /dev/null ; then - echo "ERROR: Only git patches supported. Please use 'hg export --git ...'." + echo "ERROR: Only git patches supported. Please use 'hg export --git ...'." >&2 exit 1 fi path="`echo "$line" | sed -e s@'diff --git a/'@@ -e s@' b/.*$'@@`" From 1e4125aa8d11adfb5c12a7c2e689fa457147f274 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 25 Sep 2014 12:40:16 -0700 Subject: [PATCH 75/81] Added tag jdk9-b32 for changeset f83990f1ceae --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index f999c59a70d..74c7da0a060 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -274,3 +274,4 @@ ea2f7981236f3812436958748ab3d26e80a35130 jdk9-b28 9e6581aeda388a23fbee021fc33e6aa152a60657 jdk9-b29 36e9bc875325813ac9c44ac0c617a463091fa9f5 jdk9-b30 69a84c16d9c28e0e3d504b9c8766c24bafcd58f6 jdk9-b31 +7e3512dae8e020d44399c0f1c579ff1fe3090ed6 jdk9-b32 From feb5f12af6f2bd80ac079aba4028d2ebb8ea0c89 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 25 Sep 2014 12:40:17 -0700 Subject: [PATCH 76/81] Added tag jdk9-b32 for changeset 16409c45f454 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 2cd0f3f9909..6609668c640 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -434,3 +434,4 @@ f95347244306affc32ce3056f27ceff7b2100810 jdk9-b27 deb29e92f68ace2808a36ecfa18c7d61dcb645bb jdk9-b29 5c722dffbc0f34eb8d903dca7b261e52248fa17e jdk9-b30 9f7d155d28e519f3e4645dc21cf185c25f3176ed jdk9-b31 +af46576a8d7cb4003028b8ee8bf408cfe227315b jdk9-b32 From 3658bffb5f866ecd354b01c66ce9610eac371a6e Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 25 Sep 2014 12:40:17 -0700 Subject: [PATCH 77/81] Added tag jdk9-b32 for changeset 559e6ee4a338 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index 0614d2d8d68..2708324441e 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -274,3 +274,4 @@ a00b04ef067e39f50b9a0fea6f1904e35d632a73 jdk9-b28 163a9cd806fd09970baf1f5f42b92a3cfe7ee945 jdk9-b29 98967ae6ae53ebf15615e07cd5a6b1ae04dfd84c jdk9-b30 c432b80aadd0cb2b2361b02add4d671957d4cec9 jdk9-b31 +b5b139354630edb2d06190bf31653acbdcea63a8 jdk9-b32 From 2fa6e4e30a2b99bcde6abb0757aa19c3ff5fac6c Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 25 Sep 2014 12:40:19 -0700 Subject: [PATCH 78/81] Added tag jdk9-b32 for changeset a0aa269fe46c --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index b4e86b446b6..4d3182caa24 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -274,3 +274,4 @@ dc1e26434b3fd7e9b8eeab149103c1e30965f95c jdk9-b28 30adcd13a313ea91e81164801a2f89282756d933 jdk9-b29 d181d4002214e4914d5525bd5ee13369311c765c jdk9-b30 292317ebc7dbaca6b3965f0bc7b38a2cee733b7a jdk9-b31 +b940ca3d2c7e8a279ca850706b89c2ad3a841e82 jdk9-b32 From 02fc3f8c375f3f4dfe808b5c8148d6bdea12864a Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 25 Sep 2014 12:40:24 -0700 Subject: [PATCH 79/81] Added tag jdk9-b32 for changeset 5de9ea7b214e --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index 9a4f2b0c12b..5d173d48b85 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -277,3 +277,4 @@ dcaa586ab756420e9a62643793bacef2c84bf637 jdk9-b27 3d1a4bfb6abbf5011ba6d8896301ee3b6ef3ba72 jdk9-b29 e58d3ea638c3824f01547596b2a98aa5f77c4a5c jdk9-b30 7af228ae847f3c02aaafb7b01cdbb3bdc2e89e77 jdk9-b31 +838a2f693e51b869e7bc26a20afffdde1300394e jdk9-b32 From 4f13da209a1c722c9a6a9f11d9e01850856439c6 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 25 Sep 2014 12:40:26 -0700 Subject: [PATCH 80/81] Added tag jdk9-b32 for changeset 6558cf507217 --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 51363dadfc8..0a06af6709d 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -274,3 +274,4 @@ f0870554049807d3392bd7976ab114f7f2b7bafa jdk9-b27 2da27e8e2c865e154f0c2eb9009f011a44649b11 jdk9-b29 8d24fb4493f13d380a2adf62d444e1e5a4451f37 jdk9-b30 71e99dae28f9791287b88d46e16a266b564f22be jdk9-b31 +8bdf7083b5bd02aa330ba622895e586dd3378d37 jdk9-b32 From aaa117b4418d0c25ef84845721f32ddf0ca3ea94 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 25 Sep 2014 12:40:31 -0700 Subject: [PATCH 81/81] Added tag jdk9-b32 for changeset 281a3ca2fd5e --- nashorn/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/nashorn/.hgtags b/nashorn/.hgtags index 4ae5386fc05..aaff99865de 100644 --- a/nashorn/.hgtags +++ b/nashorn/.hgtags @@ -265,3 +265,4 @@ ed60a4e9dd35dcabb9b24e90434f5f615d988981 jdk9-b26 e541ebaf2ab7038333ad0c13f4decd327c26dd15 jdk9-b29 072dbed6c5d968a6b9e156c36cd8838b4ff86ea1 jdk9-b30 77efdecfa2a5c28672b7c7dcc2d1b52dcb90d493 jdk9-b31 +62ba20541b948fb98a7036d9f01baa54e95fb6fa jdk9-b32