Merge
This commit is contained in:
commit
9a011ee40a
@ -264,11 +264,11 @@ void TemplateInterpreterGenerator::generate_counter_incr(Label* overflow, Label*
|
||||
__ cmpdi(CCR0, Rmdo, 0);
|
||||
__ beq(CCR0, no_mdo);
|
||||
|
||||
// Increment backedge counter in the MDO.
|
||||
const int mdo_bc_offs = in_bytes(MethodData::backedge_counter_offset()) + in_bytes(InvocationCounter::counter_offset());
|
||||
__ lwz(Rscratch2, mdo_bc_offs, Rmdo);
|
||||
// Increment invocation counter in the MDO.
|
||||
const int mdo_ic_offs = in_bytes(MethodData::invocation_counter_offset()) + in_bytes(InvocationCounter::counter_offset());
|
||||
__ lwz(Rscratch2, mdo_ic_offs, Rmdo);
|
||||
__ addi(Rscratch2, Rscratch2, increment);
|
||||
__ stw(Rscratch2, mdo_bc_offs, Rmdo);
|
||||
__ stw(Rscratch2, mdo_ic_offs, Rmdo);
|
||||
__ load_const_optimized(Rscratch1, mask, R0);
|
||||
__ and_(Rscratch1, Rscratch2, Rscratch1);
|
||||
__ bne(CCR0, done);
|
||||
@ -276,12 +276,12 @@ void TemplateInterpreterGenerator::generate_counter_incr(Label* overflow, Label*
|
||||
}
|
||||
|
||||
// Increment counter in MethodCounters*.
|
||||
const int mo_bc_offs = in_bytes(MethodCounters::backedge_counter_offset()) + in_bytes(InvocationCounter::counter_offset());
|
||||
const int mo_ic_offs = in_bytes(MethodCounters::invocation_counter_offset()) + in_bytes(InvocationCounter::counter_offset());
|
||||
__ bind(no_mdo);
|
||||
__ get_method_counters(R19_method, R3_counters, done);
|
||||
__ lwz(Rscratch2, mo_bc_offs, R3_counters);
|
||||
__ lwz(Rscratch2, mo_ic_offs, R3_counters);
|
||||
__ addi(Rscratch2, Rscratch2, increment);
|
||||
__ stw(Rscratch2, mo_bc_offs, R3_counters);
|
||||
__ stw(Rscratch2, mo_ic_offs, R3_counters);
|
||||
__ load_const_optimized(Rscratch1, mask, R0);
|
||||
__ and_(Rscratch1, Rscratch2, Rscratch1);
|
||||
__ beq(CCR0, *overflow);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2007, 2008, 2011 Red Hat, Inc.
|
||||
* Copyright 2007, 2008, 2011, 2015, Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -237,7 +237,13 @@ inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) {
|
||||
// operation. Note that some platforms only support this with the
|
||||
// limitation that the only valid value to store is the immediate
|
||||
// constant 1. There is a test for this in JNI_CreateJavaVM().
|
||||
return __sync_lock_test_and_set (dest, exchange_value);
|
||||
jint result = __sync_lock_test_and_set (dest, exchange_value);
|
||||
// All atomic operations are expected to be full memory barriers
|
||||
// (see atomic.hpp). However, __sync_lock_test_and_set is not
|
||||
// a full memory barrier, but an acquire barrier. Hence, this added
|
||||
// barrier.
|
||||
__sync_synchronize();
|
||||
return result;
|
||||
#endif // M68K
|
||||
#endif // ARM
|
||||
}
|
||||
@ -250,7 +256,9 @@ inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value,
|
||||
#ifdef M68K
|
||||
return m68k_lock_test_and_set(dest, exchange_value);
|
||||
#else
|
||||
return __sync_lock_test_and_set (dest, exchange_value);
|
||||
intptr_t result = __sync_lock_test_and_set (dest, exchange_value);
|
||||
__sync_synchronize();
|
||||
return result;
|
||||
#endif // M68K
|
||||
#endif // ARM
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2007, 2008, 2011 Red Hat, Inc.
|
||||
* Copyright 2007, 2008, 2011, 2015, Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -231,7 +231,13 @@ inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) {
|
||||
// operation. Note that some platforms only support this with the
|
||||
// limitation that the only valid value to store is the immediate
|
||||
// constant 1. There is a test for this in JNI_CreateJavaVM().
|
||||
return __sync_lock_test_and_set (dest, exchange_value);
|
||||
jint result = __sync_lock_test_and_set (dest, exchange_value);
|
||||
// All atomic operations are expected to be full memory barriers
|
||||
// (see atomic.hpp). However, __sync_lock_test_and_set is not
|
||||
// a full memory barrier, but an acquire barrier. Hence, this added
|
||||
// barrier.
|
||||
__sync_synchronize();
|
||||
return result;
|
||||
#endif // M68K
|
||||
#endif // ARM
|
||||
}
|
||||
@ -244,7 +250,9 @@ inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value,
|
||||
#ifdef M68K
|
||||
return m68k_lock_test_and_set(dest, exchange_value);
|
||||
#else
|
||||
return __sync_lock_test_and_set (dest, exchange_value);
|
||||
intptr_t result = __sync_lock_test_and_set (dest, exchange_value);
|
||||
__sync_synchronize();
|
||||
return result;
|
||||
#endif // M68K
|
||||
#endif // ARM
|
||||
}
|
||||
|
@ -3170,7 +3170,9 @@ void Metaspace::global_initialize() {
|
||||
}
|
||||
|
||||
// the min_misc_data_size and min_misc_code_size estimates are based on
|
||||
// MetaspaceShared::generate_vtable_methods()
|
||||
// MetaspaceShared::generate_vtable_methods().
|
||||
// The minimum size only accounts for the vtable methods. Any size less than the
|
||||
// minimum required size would cause vm crash when allocating the vtable methods.
|
||||
uint min_misc_data_size = align_size_up(
|
||||
MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size * sizeof(void*), max_alignment);
|
||||
|
||||
@ -3336,6 +3338,10 @@ void Metaspace::initialize(Mutex* lock, MetaspaceType type) {
|
||||
Metachunk* new_chunk = get_initialization_chunk(NonClassType,
|
||||
word_size,
|
||||
vsm()->medium_chunk_bunch());
|
||||
// For dumping shared archive, report error if allocation has failed.
|
||||
if (DumpSharedSpaces && new_chunk == NULL) {
|
||||
report_insufficient_metaspace(MetaspaceAux::committed_bytes() + word_size * BytesPerWord);
|
||||
}
|
||||
assert(!DumpSharedSpaces || new_chunk != NULL, "should have enough space for both chunks");
|
||||
if (new_chunk != NULL) {
|
||||
// Add to this manager's list of chunks in use and current_chunk().
|
||||
@ -3349,6 +3355,11 @@ void Metaspace::initialize(Mutex* lock, MetaspaceType type) {
|
||||
class_vsm()->medium_chunk_bunch());
|
||||
if (class_chunk != NULL) {
|
||||
class_vsm()->add_chunk(class_chunk, true);
|
||||
} else {
|
||||
// For dumping shared archive, report error if allocation has failed.
|
||||
if (DumpSharedSpaces) {
|
||||
report_insufficient_metaspace(MetaspaceAux::committed_bytes() + class_word_size * BytesPerWord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2951,10 +2951,6 @@ class CommandLineFlags {
|
||||
develop(intx, MallocCatchPtr, -1, \
|
||||
"Hit breakpoint when mallocing/freeing this pointer") \
|
||||
\
|
||||
notproduct(intx, AssertRepeat, 1, \
|
||||
"number of times to evaluate expression in assert " \
|
||||
"(to estimate overhead); only works with -DUSE_REPEATED_ASSERTS") \
|
||||
\
|
||||
notproduct(ccstrlist, SuppressErrorAt, "", \
|
||||
"List of assertions (file:line) to muzzle") \
|
||||
\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, 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
|
||||
@ -547,20 +547,16 @@ static void verify_memory(void* ptr) {
|
||||
// This function supports testing of the malloc out of memory
|
||||
// condition without really running the system out of memory.
|
||||
//
|
||||
static u_char* testMalloc(size_t alloc_size) {
|
||||
assert(MallocMaxTestWords > 0, "sanity check");
|
||||
static bool has_reached_max_malloc_test_peak(size_t alloc_size) {
|
||||
if (MallocMaxTestWords > 0) {
|
||||
jint words = (jint)(alloc_size / BytesPerWord);
|
||||
|
||||
if ((cur_malloc_words + (alloc_size / BytesPerWord)) > MallocMaxTestWords) {
|
||||
return NULL;
|
||||
if ((cur_malloc_words + words) > MallocMaxTestWords) {
|
||||
return true;
|
||||
}
|
||||
Atomic::add(words, (volatile jint *)&cur_malloc_words);
|
||||
}
|
||||
|
||||
u_char* ptr = (u_char*)::malloc(alloc_size);
|
||||
|
||||
if (ptr != NULL) {
|
||||
Atomic::add(((jint) (alloc_size / BytesPerWord)),
|
||||
(volatile jint *) &cur_malloc_words);
|
||||
}
|
||||
return ptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
void* os::malloc(size_t size, MEMFLAGS flags) {
|
||||
@ -608,13 +604,14 @@ void* os::malloc(size_t size, MEMFLAGS memflags, const NativeCallStack& stack) {
|
||||
|
||||
NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
|
||||
|
||||
u_char* ptr;
|
||||
if (MallocMaxTestWords > 0) {
|
||||
ptr = testMalloc(alloc_size);
|
||||
} else {
|
||||
ptr = (u_char*)::malloc(alloc_size);
|
||||
// For the test flag -XX:MallocMaxTestWords
|
||||
if (has_reached_max_malloc_test_peak(size)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u_char* ptr;
|
||||
ptr = (u_char*)::malloc(alloc_size);
|
||||
|
||||
#ifdef ASSERT
|
||||
if (ptr == NULL) {
|
||||
return NULL;
|
||||
@ -642,6 +639,11 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS flags) {
|
||||
|
||||
void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCallStack& stack) {
|
||||
|
||||
// For the test flag -XX:MallocMaxTestWords
|
||||
if (has_reached_max_malloc_test_peak(size)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef ASSERT
|
||||
NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1));
|
||||
NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2008, 2009, 2010 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -87,30 +87,7 @@
|
||||
#undef assert
|
||||
#endif
|
||||
|
||||
// from hotspot/src/share/vm/utilities/debug.hpp
|
||||
#ifdef ASSERT
|
||||
#ifndef USE_REPEATED_ASSERTS
|
||||
#define assert(p, msg) \
|
||||
do { \
|
||||
if (!(p)) { \
|
||||
report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg); \
|
||||
BREAKPOINT; \
|
||||
} \
|
||||
} while (0)
|
||||
#else // #ifndef USE_REPEATED_ASSERTS
|
||||
#define assert(p, msg)
|
||||
do { \
|
||||
for (int __i = 0; __i < AssertRepeat; __i++) { \
|
||||
if (!(p)) { \
|
||||
report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg); \
|
||||
BREAKPOINT; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#endif // #ifndef USE_REPEATED_ASSERTS
|
||||
#else
|
||||
#define assert(p, msg)
|
||||
#endif
|
||||
#define assert(p, msg) vmassert(p, msg)
|
||||
|
||||
#ifdef DEBUG
|
||||
#undef DEBUG
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, 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
|
||||
@ -273,6 +273,14 @@ void report_out_of_shared_space(SharedSpaceType shared_space) {
|
||||
exit(2);
|
||||
}
|
||||
|
||||
void report_insufficient_metaspace(size_t required_size) {
|
||||
warning("\nThe MaxMetaspaceSize of " UINTX_FORMAT " bytes is not large enough.\n"
|
||||
"Either don't specify the -XX:MaxMetaspaceSize=<size>\n"
|
||||
"or increase the size to at least " SIZE_FORMAT ".\n",
|
||||
MaxMetaspaceSize, required_size);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
void report_java_out_of_memory(const char* message) {
|
||||
static jint out_of_memory_reported = 0;
|
||||
|
||||
@ -326,9 +334,9 @@ void test_error_handler() {
|
||||
|
||||
// Keep this in sync with test/runtime/6888954/vmerrors.sh.
|
||||
switch (n) {
|
||||
case 1: assert(str == NULL, "expected null");
|
||||
case 2: assert(num == 1023 && *str == 'X',
|
||||
err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str));
|
||||
case 1: vmassert(str == NULL, "expected null");
|
||||
case 2: vmassert(num == 1023 && *str == 'X',
|
||||
err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str));
|
||||
case 3: guarantee(str == NULL, "expected null");
|
||||
case 4: guarantee(num == 1023 && *str == 'X',
|
||||
err_msg("num=" SIZE_FORMAT " str=\"%s\"", num, str));
|
||||
|
@ -105,58 +105,42 @@ void FormatBuffer<bufsz>::append(const char* format, ...) {
|
||||
va_end(argp);
|
||||
}
|
||||
|
||||
// Used to format messages for assert(), guarantee(), fatal(), etc.
|
||||
// Used to format messages for vmassert(), guarantee(), fatal(), etc.
|
||||
typedef FormatBuffer<> err_msg;
|
||||
typedef FormatBufferResource err_msg_res;
|
||||
|
||||
// assertions
|
||||
#ifdef ASSERT
|
||||
#ifndef USE_REPEATED_ASSERTS
|
||||
#define assert(p, msg) \
|
||||
#ifndef ASSERT
|
||||
#define vmassert(p, msg)
|
||||
#else
|
||||
// Note: message says "assert" rather than "vmassert" for backward
|
||||
// compatibility with tools that parse/match the message text.
|
||||
#define vmassert(p, msg) \
|
||||
do { \
|
||||
if (!(p)) { \
|
||||
report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg); \
|
||||
BREAKPOINT; \
|
||||
} \
|
||||
} while (0)
|
||||
#else // #ifndef USE_REPEATED_ASSERTS
|
||||
#define assert(p, msg)
|
||||
do { \
|
||||
for (int __i = 0; __i < AssertRepeat; __i++) { \
|
||||
if (!(p)) { \
|
||||
report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", msg); \
|
||||
BREAKPOINT; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#endif // #ifndef USE_REPEATED_ASSERTS
|
||||
#endif
|
||||
|
||||
// This version of assert is for use with checking return status from
|
||||
// For backward compatibility.
|
||||
#define assert(p, msg) vmassert(p, msg)
|
||||
|
||||
// This version of vmassert is for use with checking return status from
|
||||
// library calls that return actual error values eg. EINVAL,
|
||||
// ENOMEM etc, rather than returning -1 and setting errno.
|
||||
// When the status is not what is expected it is very useful to know
|
||||
// what status was actually returned, so we pass the status variable as
|
||||
// an extra arg and use strerror to convert it to a meaningful string
|
||||
// like "Invalid argument", "out of memory" etc
|
||||
#define assert_status(p, status, msg) \
|
||||
do { \
|
||||
if (!(p)) { \
|
||||
report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", \
|
||||
err_msg("error %s(%d) %s", strerror(status), \
|
||||
status, msg)); \
|
||||
BREAKPOINT; \
|
||||
} \
|
||||
} while (0)
|
||||
#define vmassert_status(p, status, msg) \
|
||||
vmassert(p, err_msg("error %s(%d), %s", strerror(status), status, msg))
|
||||
|
||||
// Do not assert this condition if there's already another error reported.
|
||||
#define assert_if_no_error(cond,msg) assert((cond) || is_error_reported(), msg)
|
||||
#else // #ifdef ASSERT
|
||||
#define assert(p,msg)
|
||||
#define assert_status(p,status,msg)
|
||||
#define assert_if_no_error(cond,msg)
|
||||
#endif // #ifdef ASSERT
|
||||
// For backward compatibility.
|
||||
#define assert_status(p, status, msg) vmassert_status(p, status, msg)
|
||||
|
||||
// guarantee is like assert except it's always executed -- use it for
|
||||
// guarantee is like vmassert except it's always executed -- use it for
|
||||
// cheap tests that catch errors that would otherwise be hard to find.
|
||||
// guarantee is also used for Verify options.
|
||||
#define guarantee(p, msg) \
|
||||
@ -252,6 +236,8 @@ enum SharedSpaceType {
|
||||
|
||||
void report_out_of_shared_space(SharedSpaceType space_type);
|
||||
|
||||
void report_insufficient_metaspace(size_t required_size);
|
||||
|
||||
// out of memory reporting
|
||||
void report_java_out_of_memory(const char* message);
|
||||
|
||||
@ -259,7 +245,7 @@ void report_java_out_of_memory(const char* message);
|
||||
bool is_error_reported();
|
||||
void set_error_reported();
|
||||
|
||||
/* Test assert(), fatal(), guarantee(), etc. */
|
||||
/* Test vmassert(), fatal(), guarantee(), etc. */
|
||||
NOT_PRODUCT(void test_error_handler();)
|
||||
|
||||
void pd_ps(frame f);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2015, 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,10 @@
|
||||
#include "runtime/vmThread.hpp"
|
||||
#include "utilities/xmlstream.hpp"
|
||||
|
||||
// Do not assert this condition if there's already another error reported.
|
||||
#define assert_if_no_error(cond, msg) \
|
||||
vmassert((cond) || is_error_reported(), msg)
|
||||
|
||||
void xmlStream::initialize(outputStream* out) {
|
||||
_out = out;
|
||||
_last_flush = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2013, 2015, 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
|
||||
@ -69,7 +69,6 @@ needs_jdk = \
|
||||
gc/metaspace/TestPerfCountersAndMemoryPools.java \
|
||||
runtime/6819213/TestBootNativeLibraryPath.java \
|
||||
runtime/7158988/FieldMonitor.java \
|
||||
runtime/7194254/Test7194254.java \
|
||||
runtime/Metaspace/FragmentMetaspace.java \
|
||||
runtime/NMT/BaselineWithParameter.java \
|
||||
runtime/NMT/JcmdBaselineDetail.java \
|
||||
@ -94,6 +93,7 @@ needs_jdk = \
|
||||
runtime/NMT/VirtualAllocTestType.java \
|
||||
runtime/RedefineObject/TestRedefineObject.java \
|
||||
runtime/Thread/TestThreadDumpMonitorContention.java \
|
||||
runtime/Thread/ThreadPriorities.java \
|
||||
runtime/XCheckJniJsig/XCheckJSig.java \
|
||||
serviceability/attach/AttachWithStalePidFile.java \
|
||||
serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java \
|
||||
|
@ -26,6 +26,7 @@
|
||||
* @bug 8042235
|
||||
* @summary redefining method used by multiple MethodHandles crashes VM
|
||||
* @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java
|
||||
* @ignore 7076820
|
||||
* @run main RedefineMethodUsedByMultipleMethodHandles
|
||||
*/
|
||||
|
||||
|
@ -28,6 +28,7 @@ import com.oracle.java.testlibrary.*;
|
||||
* @bug 8038636
|
||||
* @library /testlibrary
|
||||
* @build Agent
|
||||
* @ignore 7076820
|
||||
* @run main ClassFileInstaller Agent
|
||||
* @run main Launcher
|
||||
* @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:ReservedCodeCacheSize=3M Agent
|
||||
|
@ -28,6 +28,7 @@ import com.oracle.java.testlibrary.*;
|
||||
* @bug 8040237
|
||||
* @library /testlibrary
|
||||
* @build Agent Test A B
|
||||
* @ignore 7076820
|
||||
* @run main ClassFileInstaller Agent
|
||||
* @run main Launcher
|
||||
* @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:ReservedCodeCacheSize=3M Agent
|
||||
|
@ -27,6 +27,7 @@
|
||||
* @summary Test that you can decrease NMT tracking level but not increase it.
|
||||
* @key nmt
|
||||
* @library /testlibrary /../../test/lib
|
||||
* @ignore 8067167
|
||||
* @build ChangeTrackingLevel
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
|
@ -27,6 +27,7 @@
|
||||
* @bug 8005936 8058606
|
||||
* @summary Verify PrintNMTStatistics on normal JVM exit for detail and summary tracking level
|
||||
* @library /testlibrary
|
||||
* @ignore 8067167
|
||||
*/
|
||||
|
||||
import com.oracle.java.testlibrary.*;
|
||||
|
41
hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java
Normal file
41
hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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 8067187
|
||||
* @summary Testing CDS dumping with the -XX:MaxMetaspaceSize=<size> option
|
||||
* @library /testlibrary
|
||||
*/
|
||||
|
||||
import com.oracle.java.testlibrary.*;
|
||||
|
||||
public class MaxMetaspaceSize {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:MaxMetaspaceSize=20m", "-Xshare:dump");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("is not large enough.\nEither don't specify the -XX:MaxMetaspaceSize=<size>\nor increase the size to at least");
|
||||
output.shouldHaveExitValue(2);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2015 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,23 +27,21 @@
|
||||
* @summary Creates several threads with different java priorities and checks
|
||||
* whether jstack reports correct priorities for them.
|
||||
*
|
||||
* @ignore 8060219
|
||||
* @run main Test7194254
|
||||
* @library /testlibrary
|
||||
* @run main ThreadPriorities
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.RuntimeMXBean;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class Test7194254 {
|
||||
import com.oracle.java.testlibrary.*;
|
||||
import static com.oracle.java.testlibrary.Asserts.*;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
public class ThreadPriorities {
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
final int NUMBER_OF_JAVA_PRIORITIES =
|
||||
Thread.MAX_PRIORITY - Thread.MIN_PRIORITY + 1;
|
||||
final CyclicBarrier barrier =
|
||||
@ -68,53 +66,31 @@ public class Test7194254 {
|
||||
barrier.await(); // 1st
|
||||
|
||||
int matches = 0;
|
||||
List<String> failed = new ArrayList<>();
|
||||
try {
|
||||
String pid = getPid();
|
||||
String jstack = System.getProperty("java.home") + "/../bin/jstack";
|
||||
Process process = new ProcessBuilder(jstack, pid)
|
||||
.redirectErrorStream(true).start();
|
||||
Pattern pattern = Pattern.compile(
|
||||
"\\\"Priority=(\\d+)\\\".* prio=(\\d+).*");
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()))) {
|
||||
String line;
|
||||
while((line = reader.readLine()) != null) {
|
||||
Matcher matcher = pattern.matcher(line);
|
||||
if (matcher.matches()) {
|
||||
matches += 1;
|
||||
String expected = matcher.group(1);
|
||||
String actual = matcher.group(2);
|
||||
if (!expected.equals(actual)) {
|
||||
failed.add(line);
|
||||
}
|
||||
}
|
||||
ArrayList<String> failed = new ArrayList<>();
|
||||
ProcessBuilder pb = new ProcessBuilder(
|
||||
JDKToolFinder.getJDKTool("jstack"),
|
||||
String.valueOf(ProcessTools.getProcessId()));
|
||||
|
||||
String[] output = new OutputAnalyzer(pb.start()).getOutput().split("\\n+");
|
||||
|
||||
Pattern pattern = Pattern.compile(
|
||||
"\\\"Priority=(\\d+)\\\".* prio=(\\d+).*");
|
||||
for (String line : output) {
|
||||
Matcher matcher = pattern.matcher(line);
|
||||
if (matcher.matches()) {
|
||||
matches += 1;
|
||||
String expected = matcher.group(1);
|
||||
String actual = matcher.group(2);
|
||||
if (!expected.equals(actual)) {
|
||||
failed.add(line);
|
||||
}
|
||||
}
|
||||
barrier.await(); // 2nd
|
||||
} finally {
|
||||
barrier.reset();
|
||||
}
|
||||
barrier.await(); // 2nd
|
||||
barrier.reset();
|
||||
|
||||
if (matches != NUMBER_OF_JAVA_PRIORITIES) {
|
||||
throw new AssertionError("matches: expected " +
|
||||
NUMBER_OF_JAVA_PRIORITIES + ", but was " + matches);
|
||||
}
|
||||
if (!failed.isEmpty()) {
|
||||
throw new AssertionError(failed.size() + ":" + failed);
|
||||
}
|
||||
System.out.println("Test passes.");
|
||||
assertEquals(matches, NUMBER_OF_JAVA_PRIORITIES);
|
||||
assertTrue(failed.isEmpty(), failed.size() + ":" + failed);
|
||||
}
|
||||
|
||||
static String getPid() {
|
||||
RuntimeMXBean runtimebean = ManagementFactory.getRuntimeMXBean();
|
||||
String vmname = runtimebean.getName();
|
||||
int i = vmname.indexOf('@');
|
||||
if (i != -1) {
|
||||
vmname = vmname.substring(0, i);
|
||||
}
|
||||
return vmname;
|
||||
}
|
||||
|
||||
}
|
||||
|
67
hotspot/test/runtime/Unsafe/Reallocate.java
Normal file
67
hotspot/test/runtime/Unsafe/Reallocate.java
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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 8058897
|
||||
* @library /testlibrary
|
||||
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m Reallocate
|
||||
*/
|
||||
|
||||
import com.oracle.java.testlibrary.*;
|
||||
import sun.misc.Unsafe;
|
||||
import static com.oracle.java.testlibrary.Asserts.*;
|
||||
|
||||
public class Reallocate {
|
||||
public static void main(String args[]) throws Exception {
|
||||
Unsafe unsafe = Utils.getUnsafe();
|
||||
|
||||
long address = unsafe.allocateMemory(1);
|
||||
assertNotEquals(address, 0L);
|
||||
|
||||
// Make sure we reallocate correctly
|
||||
unsafe.putByte(address, Byte.MAX_VALUE);
|
||||
address = unsafe.reallocateMemory(address, 2);
|
||||
assertNotEquals(address, 0L);
|
||||
assertEquals(unsafe.getByte(address), Byte.MAX_VALUE);
|
||||
|
||||
// Reallocating with a 0 size should return a null pointer
|
||||
address = unsafe.reallocateMemory(address, 0);
|
||||
assertEquals(address, 0L);
|
||||
|
||||
// Reallocating with a null pointer should result in a normal allocation
|
||||
address = unsafe.reallocateMemory(0L, 1);
|
||||
assertNotEquals(address, 0L);
|
||||
unsafe.putByte(address, Byte.MAX_VALUE);
|
||||
assertEquals(unsafe.getByte(address), Byte.MAX_VALUE);
|
||||
|
||||
// Make sure we can throw an OOME when we fail to reallocate due to OOM
|
||||
try {
|
||||
unsafe.reallocateMemory(address, 100 * 1024 * 1024 * 8);
|
||||
} catch (OutOfMemoryError e) {
|
||||
// Expected
|
||||
return;
|
||||
}
|
||||
throw new RuntimeException("Did not get expected OOM");
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user