提交 06e5d445 编写于 作者: A amurillo

Merge

...@@ -97,6 +97,7 @@ ifeq ($(INCLUDE_ALL_GCS), false) ...@@ -97,6 +97,7 @@ ifeq ($(INCLUDE_ALL_GCS), false)
ageTable.cpp \ ageTable.cpp \
collectorCounters.cpp \ collectorCounters.cpp \
cSpaceCounters.cpp \ cSpaceCounters.cpp \
gcId.cpp \
gcPolicyCounters.cpp \ gcPolicyCounters.cpp \
gcStats.cpp \ gcStats.cpp \
gcTimer.cpp \ gcTimer.cpp \
......
...@@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2014 ...@@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2014
HS_MAJOR_VER=25 HS_MAJOR_VER=25
HS_MINOR_VER=40 HS_MINOR_VER=40
HS_BUILD_NUMBER=15 HS_BUILD_NUMBER=16
JDK_MAJOR_VER=1 JDK_MAJOR_VER=1
JDK_MINOR_VER=8 JDK_MINOR_VER=8
......
...@@ -374,21 +374,25 @@ jprt.make.rule.test.targets.standard.internalvmtests = \ ...@@ -374,21 +374,25 @@ jprt.make.rule.test.targets.standard.internalvmtests = \
${jprt.my.windows.i586}-fastdebug-c2-internalvmtests, \ ${jprt.my.windows.i586}-fastdebug-c2-internalvmtests, \
${jprt.my.windows.x64}-fastdebug-c2-internalvmtests ${jprt.my.windows.x64}-fastdebug-c2-internalvmtests
jprt.make.rule.test.targets.standard.wbapi = \ jprt.make.rule.test.targets.standard.reg.group = \
${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-wbapitest, \ ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-GROUP, \
${jprt.my.solaris.x64}-{product|fastdebug}-c2-wbapitest, \ ${jprt.my.solaris.x64}-{product|fastdebug}-c2-GROUP, \
${jprt.my.linux.i586}-{product|fastdebug}-c2-wbapitest, \ ${jprt.my.linux.i586}-{product|fastdebug}-c2-GROUP, \
${jprt.my.linux.x64}-{product|fastdebug}-c2-wbapitest, \ ${jprt.my.linux.x64}-{product|fastdebug}-c2-GROUP, \
${jprt.my.windows.i586}-{product|fastdebug}-c2-wbapitest, \ ${jprt.my.windows.i586}-{product|fastdebug}-c2-GROUP, \
${jprt.my.windows.x64}-{product|fastdebug}-c2-wbapitest, \ ${jprt.my.windows.x64}-{product|fastdebug}-c2-GROUP, \
${jprt.my.linux.i586}-{product|fastdebug}-c1-wbapitest, \ ${jprt.my.linux.i586}-{product|fastdebug}-c1-GROUP, \
${jprt.my.windows.i586}-{product|fastdebug}-c1-wbapitest ${jprt.my.windows.i586}-{product|fastdebug}-c1-GROUP
jprt.make.rule.test.targets.standard = \ jprt.make.rule.test.targets.standard = \
${jprt.make.rule.test.targets.standard.client}, \ ${jprt.make.rule.test.targets.standard.client}, \
${jprt.make.rule.test.targets.standard.server}, \ ${jprt.make.rule.test.targets.standard.server}, \
${jprt.make.rule.test.targets.standard.internalvmtests}, \ ${jprt.make.rule.test.targets.standard.internalvmtests}, \
${jprt.make.rule.test.targets.standard.wbapi} ${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_wbapitest}, \
${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_compiler}, \
${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_gc}, \
${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_runtime}, \
${jprt.make.rule.test.targets.standard.reg.group:GROUP=hotspot_serviceability}
jprt.make.rule.test.targets.embedded = \ jprt.make.rule.test.targets.embedded = \
${jprt.make.rule.test.targets.standard.client} ${jprt.make.rule.test.targets.standard.client}
......
...@@ -873,14 +873,19 @@ void VM_Version::get_processor_features() { ...@@ -873,14 +873,19 @@ void VM_Version::get_processor_features() {
if (supports_bmi1()) { if (supports_bmi1()) {
// tzcnt does not require VEX prefix // tzcnt does not require VEX prefix
if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstruction)) { if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstruction)) {
UseCountTrailingZerosInstruction = true; if (!UseBMI1Instructions && !FLAG_IS_DEFAULT(UseBMI1Instructions)) {
// Don't use tzcnt if BMI1 is switched off on command line.
UseCountTrailingZerosInstruction = false;
} else {
UseCountTrailingZerosInstruction = true;
}
} }
} else if (UseCountTrailingZerosInstruction) { } else if (UseCountTrailingZerosInstruction) {
warning("tzcnt instruction is not available on this CPU"); warning("tzcnt instruction is not available on this CPU");
FLAG_SET_DEFAULT(UseCountTrailingZerosInstruction, false); FLAG_SET_DEFAULT(UseCountTrailingZerosInstruction, false);
} }
// BMI instructions use an encoding with VEX prefix. // BMI instructions (except tzcnt) use an encoding with VEX prefix.
// VEX prefix is generated only when AVX > 0. // VEX prefix is generated only when AVX > 0.
if (supports_bmi1() && supports_avx()) { if (supports_bmi1() && supports_avx()) {
if (FLAG_IS_DEFAULT(UseBMI1Instructions)) { if (FLAG_IS_DEFAULT(UseBMI1Instructions)) {
......
...@@ -4165,8 +4165,12 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name, ...@@ -4165,8 +4165,12 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
tty->print("[Loaded %s from %s]\n", this_klass->external_name(), tty->print("[Loaded %s from %s]\n", this_klass->external_name(),
cfs->source()); cfs->source());
} else if (class_loader.is_null()) { } else if (class_loader.is_null()) {
if (THREAD->is_Java_thread()) { Klass* caller =
Klass* caller = ((JavaThread*)THREAD)->security_get_caller_class(1); THREAD->is_Java_thread()
? ((JavaThread*)THREAD)->security_get_caller_class(1)
: NULL;
// caller can be NULL, for example, during a JVMTI VM_Init hook
if (caller != NULL) {
tty->print("[Loaded %s by instance of %s]\n", tty->print("[Loaded %s by instance of %s]\n",
this_klass->external_name(), this_klass->external_name(),
InstanceKlass::cast(caller)->external_name()); InstanceKlass::cast(caller)->external_name());
......
...@@ -799,10 +799,16 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) { ...@@ -799,10 +799,16 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
// each arm of the Phi. If I know something clever about the exceptions // each arm of the Phi. If I know something clever about the exceptions
// I'm loading the class from, I can replace the LoadKlass with the // I'm loading the class from, I can replace the LoadKlass with the
// klass constant for the exception oop. // klass constant for the exception oop.
if( ex_node->is_Phi() ) { if (ex_node->is_Phi()) {
ex_klass_node = new (C) PhiNode( ex_node->in(0), TypeKlassPtr::OBJECT ); ex_klass_node = new (C) PhiNode(ex_node->in(0), TypeKlassPtr::OBJECT);
for( uint i = 1; i < ex_node->req(); i++ ) { for (uint i = 1; i < ex_node->req(); i++) {
Node* p = basic_plus_adr( ex_node->in(i), ex_node->in(i), oopDesc::klass_offset_in_bytes() ); Node* ex_in = ex_node->in(i);
if (ex_in == top() || ex_in == NULL) {
// This path was not taken.
ex_klass_node->init_req(i, top());
continue;
}
Node* p = basic_plus_adr(ex_in, ex_in, oopDesc::klass_offset_in_bytes());
Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) ); Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) );
ex_klass_node->init_req( i, k ); ex_klass_node->init_req( i, k );
} }
......
...@@ -331,7 +331,36 @@ WB_ENTRY(void, WB_NMTOverflowHashBucket(JNIEnv* env, jobject o, jlong num)) ...@@ -331,7 +331,36 @@ WB_ENTRY(void, WB_NMTOverflowHashBucket(JNIEnv* env, jobject o, jlong num))
} }
WB_END WB_END
WB_ENTRY(jboolean, WB_NMTChangeTrackingLevel(JNIEnv* env))
// Test that we can downgrade NMT levels but not upgrade them.
if (MemTracker::tracking_level() == NMT_off) {
MemTracker::transition_to(NMT_off);
return MemTracker::tracking_level() == NMT_off;
} else {
assert(MemTracker::tracking_level() == NMT_detail, "Should start out as detail tracking");
MemTracker::transition_to(NMT_summary);
assert(MemTracker::tracking_level() == NMT_summary, "Should be summary now");
// Can't go to detail once NMT is set to summary.
MemTracker::transition_to(NMT_detail);
assert(MemTracker::tracking_level() == NMT_summary, "Should still be summary now");
// Shutdown sets tracking level to minimal.
MemTracker::shutdown();
assert(MemTracker::tracking_level() == NMT_minimal, "Should be minimal now");
// Once the tracking level is minimal, we cannot increase to summary.
// The code ignores this request instead of asserting because if the malloc site
// table overflows in another thread, it tries to change the code to summary.
MemTracker::transition_to(NMT_summary);
assert(MemTracker::tracking_level() == NMT_minimal, "Should still be minimal now");
// Really can never go up to detail, verify that the code would never do this.
MemTracker::transition_to(NMT_detail);
assert(MemTracker::tracking_level() == NMT_minimal, "Should still be minimal now");
return MemTracker::tracking_level() == NMT_minimal;
}
WB_END
#endif // INCLUDE_NMT #endif // INCLUDE_NMT
static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) { static jmethodID reflected_method_to_jmid(JavaThread* thread, JNIEnv* env, jobject method) {
...@@ -936,6 +965,7 @@ static JNINativeMethod methods[] = { ...@@ -936,6 +965,7 @@ static JNINativeMethod methods[] = {
{CC"NMTReleaseMemory", CC"(JJ)V", (void*)&WB_NMTReleaseMemory }, {CC"NMTReleaseMemory", CC"(JJ)V", (void*)&WB_NMTReleaseMemory },
{CC"NMTOverflowHashBucket", CC"(J)V", (void*)&WB_NMTOverflowHashBucket}, {CC"NMTOverflowHashBucket", CC"(J)V", (void*)&WB_NMTOverflowHashBucket},
{CC"NMTIsDetailSupported",CC"()Z", (void*)&WB_NMTIsDetailSupported}, {CC"NMTIsDetailSupported",CC"()Z", (void*)&WB_NMTIsDetailSupported},
{CC"NMTChangeTrackingLevel", CC"()Z", (void*)&WB_NMTChangeTrackingLevel},
#endif // INCLUDE_NMT #endif // INCLUDE_NMT
{CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll }, {CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll },
{CC"deoptimizeMethod", CC"(Ljava/lang/reflect/Executable;Z)I", {CC"deoptimizeMethod", CC"(Ljava/lang/reflect/Executable;Z)I",
......
...@@ -214,13 +214,14 @@ class os: AllStatic { ...@@ -214,13 +214,14 @@ class os: AllStatic {
// Interface for detecting multiprocessor system // Interface for detecting multiprocessor system
static inline bool is_MP() { static inline bool is_MP() {
#if !INCLUDE_NMT // During bootstrap if _processor_count is not yet initialized
assert(_processor_count > 0, "invalid processor count"); // we claim to be MP as that is safest. If any platform has a
return _processor_count > 1 || AssumeMP; // stub generator that might be triggered in this phase and for
#else // which being declared MP when in fact not, is a problem - then
// NMT needs atomic operations before this initialization. // the bootstrap routine for the stub generator needs to check
return true; // the processor count directly and leave the bootstrap routine
#endif // in place until called after initialization has ocurred.
return (_processor_count != 1) || AssumeMP;
} }
static julong available_memory(); static julong available_memory();
static julong physical_memory(); static julong physical_memory();
......
...@@ -51,14 +51,6 @@ size_t MallocMemorySnapshot::total_arena() const { ...@@ -51,14 +51,6 @@ size_t MallocMemorySnapshot::total_arena() const {
return amount; return amount;
} }
void MallocMemorySnapshot::reset() {
_tracking_header.reset();
for (int index = 0; index < mt_number_of_types; index ++) {
_malloc[index].reset();
}
}
// Make adjustment by subtracting chunks used by arenas // Make adjustment by subtracting chunks used by arenas
// from total chunks to get total free chunck size // from total chunks to get total free chunck size
void MallocMemorySnapshot::make_adjustment() { void MallocMemorySnapshot::make_adjustment() {
...@@ -116,14 +108,9 @@ bool MallocTracker::initialize(NMT_TrackingLevel level) { ...@@ -116,14 +108,9 @@ bool MallocTracker::initialize(NMT_TrackingLevel level) {
bool MallocTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) { bool MallocTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) {
assert(from != NMT_off, "Can not transition from off state"); assert(from != NMT_off, "Can not transition from off state");
assert(to != NMT_off, "Can not transition to off state"); assert(to != NMT_off, "Can not transition to off state");
if (from == NMT_minimal) { assert (from != NMT_minimal, "cannot transition from minimal state");
MallocMemorySummary::reset();
}
if (to == NMT_detail) { if (from == NMT_detail) {
assert(from == NMT_minimal || from == NMT_summary, "Just check");
return MallocSiteTable::initialize();
} else if (from == NMT_detail) {
assert(to == NMT_minimal || to == NMT_summary, "Just check"); assert(to == NMT_minimal || to == NMT_summary, "Just check");
MallocSiteTable::shutdown(); MallocSiteTable::shutdown();
} }
......
...@@ -51,14 +51,6 @@ class MemoryCounter VALUE_OBJ_CLASS_SPEC { ...@@ -51,14 +51,6 @@ class MemoryCounter VALUE_OBJ_CLASS_SPEC {
DEBUG_ONLY(_peak_size = 0;) DEBUG_ONLY(_peak_size = 0;)
} }
// Reset counters
void reset() {
_size = 0;
_count = 0;
DEBUG_ONLY(_peak_size = 0;)
DEBUG_ONLY(_peak_count = 0;)
}
inline void allocate(size_t sz) { inline void allocate(size_t sz) {
Atomic::add(1, (volatile MemoryCounterType*)&_count); Atomic::add(1, (volatile MemoryCounterType*)&_count);
if (sz > 0) { if (sz > 0) {
...@@ -124,11 +116,6 @@ class MallocMemory VALUE_OBJ_CLASS_SPEC { ...@@ -124,11 +116,6 @@ class MallocMemory VALUE_OBJ_CLASS_SPEC {
_arena.resize(sz); _arena.resize(sz);
} }
void reset() {
_malloc.reset();
_arena.reset();
}
inline size_t malloc_size() const { return _malloc.size(); } inline size_t malloc_size() const { return _malloc.size(); }
inline size_t malloc_count() const { return _malloc.count();} inline size_t malloc_count() const { return _malloc.count();}
inline size_t arena_size() const { return _arena.size(); } inline size_t arena_size() const { return _arena.size(); }
...@@ -176,8 +163,6 @@ class MallocMemorySnapshot : public ResourceObj { ...@@ -176,8 +163,6 @@ class MallocMemorySnapshot : public ResourceObj {
return s->by_type(mtThreadStack)->malloc_count(); return s->by_type(mtThreadStack)->malloc_count();
} }
void reset();
void copy_to(MallocMemorySnapshot* s) { void copy_to(MallocMemorySnapshot* s) {
s->_tracking_header = _tracking_header; s->_tracking_header = _tracking_header;
for (int index = 0; index < mt_number_of_types; index ++) { for (int index = 0; index < mt_number_of_types; index ++) {
...@@ -240,11 +225,6 @@ class MallocMemorySummary : AllStatic { ...@@ -240,11 +225,6 @@ class MallocMemorySummary : AllStatic {
return as_snapshot()->malloc_overhead()->size(); return as_snapshot()->malloc_overhead()->size();
} }
// Reset all counters to zero
static void reset() {
as_snapshot()->reset();
}
static MallocMemorySnapshot* as_snapshot() { static MallocMemorySnapshot* as_snapshot() {
return (MallocMemorySnapshot*)_snapshot; return (MallocMemorySnapshot*)_snapshot;
} }
......
...@@ -90,10 +90,6 @@ class MemBaseline VALUE_OBJ_CLASS_SPEC { ...@@ -90,10 +90,6 @@ class MemBaseline VALUE_OBJ_CLASS_SPEC {
_class_count(0) { _class_count(0) {
} }
~MemBaseline() {
reset();
}
bool baseline(bool summaryOnly = true); bool baseline(bool summaryOnly = true);
BaselineType baseline_type() const { return _baseline_type; } BaselineType baseline_type() const { return _baseline_type; }
...@@ -169,8 +165,7 @@ class MemBaseline VALUE_OBJ_CLASS_SPEC { ...@@ -169,8 +165,7 @@ class MemBaseline VALUE_OBJ_CLASS_SPEC {
// reset the baseline for reuse // reset the baseline for reuse
void reset() { void reset() {
_baseline_type = Not_baselined; _baseline_type = Not_baselined;
_malloc_memory_snapshot.reset(); // _malloc_memory_snapshot and _virtual_memory_snapshot are copied over.
_virtual_memory_snapshot.reset();
_class_count = 0; _class_count = 0;
_malloc_sites.clear(); _malloc_sites.clear();
......
...@@ -96,20 +96,6 @@ class MemSummaryReporter : public MemReporterBase { ...@@ -96,20 +96,6 @@ class MemSummaryReporter : public MemReporterBase {
size_t _class_count; size_t _class_count;
public: public:
// Report summary tracking data from global snapshots directly.
// This constructor is used for final reporting and hs_err reporting.
MemSummaryReporter(MallocMemorySnapshot* malloc_snapshot,
VirtualMemorySnapshot* vm_snapshot, outputStream* output,
size_t class_count = 0, size_t scale = K) :
MemReporterBase(output, scale),
_malloc_snapshot(malloc_snapshot),
_vm_snapshot(vm_snapshot) {
if (class_count == 0) {
_class_count = InstanceKlass::number_of_instance_classes();
} else {
_class_count = class_count;
}
}
// This constructor is for normal reporting from a recent baseline. // This constructor is for normal reporting from a recent baseline.
MemSummaryReporter(MemBaseline& baseline, outputStream* output, MemSummaryReporter(MemBaseline& baseline, outputStream* output,
size_t scale = K) : MemReporterBase(output, scale), size_t scale = K) : MemReporterBase(output, scale),
......
...@@ -144,11 +144,9 @@ void Tracker::record(address addr, size_t size) { ...@@ -144,11 +144,9 @@ void Tracker::record(address addr, size_t size) {
} }
// Shutdown can only be issued via JCmd, and NMT JCmd is serialized // Shutdown can only be issued via JCmd, and NMT JCmd is serialized by lock
// by lock
void MemTracker::shutdown() { void MemTracker::shutdown() {
// We can only shutdown NMT to minimal tracking level if it is // We can only shutdown NMT to minimal tracking level if it is ever on.
// ever on.
if (tracking_level () > NMT_minimal) { if (tracking_level () > NMT_minimal) {
transition_to(NMT_minimal); transition_to(NMT_minimal);
} }
...@@ -157,45 +155,36 @@ void MemTracker::shutdown() { ...@@ -157,45 +155,36 @@ void MemTracker::shutdown() {
bool MemTracker::transition_to(NMT_TrackingLevel level) { bool MemTracker::transition_to(NMT_TrackingLevel level) {
NMT_TrackingLevel current_level = tracking_level(); NMT_TrackingLevel current_level = tracking_level();
assert(level != NMT_off || current_level == NMT_off, "Cannot transition NMT to off");
if (current_level == level) { if (current_level == level) {
return true; return true;
} else if (current_level > level) { } else if (current_level > level) {
// Downgrade tracking level, we want to lower the tracking // Downgrade tracking level, we want to lower the tracking level first
// level first
_tracking_level = level; _tracking_level = level;
// Make _tracking_level visible immediately. // Make _tracking_level visible immediately.
OrderAccess::fence(); OrderAccess::fence();
VirtualMemoryTracker::transition(current_level, level); VirtualMemoryTracker::transition(current_level, level);
MallocTracker::transition(current_level, level); MallocTracker::transition(current_level, level);
if (level == NMT_minimal) _baseline.reset();
} else { } else {
VirtualMemoryTracker::transition(current_level, level); // Upgrading tracking level is not supported and has never been supported.
MallocTracker::transition(current_level, level); // Allocating and deallocating malloc tracking structures is not thread safe and
// leads to inconsistencies unless a lot coarser locks are added.
_tracking_level = level;
// Make _tracking_level visible immediately.
OrderAccess::fence();
} }
return true; return true;
} }
void MemTracker::final_report(outputStream* output) { void MemTracker::report(bool summary_only, outputStream* output) {
assert(output != NULL, "No output stream"); assert(output != NULL, "No output stream");
if (tracking_level() >= NMT_summary) { MemBaseline baseline;
MallocMemorySnapshot* malloc_memory_snapshot = if (baseline.baseline(summary_only)) {
MallocMemorySummary::as_snapshot(); if (summary_only) {
malloc_memory_snapshot->make_adjustment(); MemSummaryReporter rpt(baseline, output);
rpt.report();
VirtualMemorySnapshot* virtual_memory_snapshot = } else {
VirtualMemorySummary::as_snapshot(); MemDetailReporter rpt(baseline, output);
rpt.report();
MemSummaryReporter rptr(malloc_memory_snapshot, }
virtual_memory_snapshot, output);
rptr.report();
// shutdown NMT, the data no longer accurate
shutdown();
} }
} }
......
...@@ -70,6 +70,7 @@ class MemTracker : AllStatic { ...@@ -70,6 +70,7 @@ class MemTracker : AllStatic {
static inline void release_thread_stack(void* addr, size_t size) { } static inline void release_thread_stack(void* addr, size_t size) { }
static void final_report(outputStream*) { } static void final_report(outputStream*) { }
static void error_report(outputStream*) { }
}; };
#else #else
...@@ -270,13 +271,20 @@ class MemTracker : AllStatic { ...@@ -270,13 +271,20 @@ class MemTracker : AllStatic {
// other tools. // other tools.
static inline Mutex* query_lock() { return _query_lock; } static inline Mutex* query_lock() { return _query_lock; }
// Make a final report and shutdown. // Make a final report or report for hs_err file.
// This function generates summary report without creating snapshots, static void error_report(outputStream* output) {
// to avoid additional memory allocation. It uses native memory summary if (tracking_level() >= NMT_summary) {
// counters, and makes adjustment to them, once the adjustment is made, report(true, output); // just print summary for error case.
// the counters are no longer accurate. As the result, this function }
// should only be used for final reporting before shutting down. }
static void final_report(outputStream*);
static void final_report(outputStream* output) {
NMT_TrackingLevel level = tracking_level();
if (level >= NMT_summary) {
report(level == NMT_summary, output);
}
}
// Stored baseline // Stored baseline
static inline MemBaseline& get_baseline() { static inline MemBaseline& get_baseline() {
...@@ -291,6 +299,7 @@ class MemTracker : AllStatic { ...@@ -291,6 +299,7 @@ class MemTracker : AllStatic {
private: private:
static NMT_TrackingLevel init_tracking_level(); static NMT_TrackingLevel init_tracking_level();
static void report(bool summary_only, outputStream* output);
private: private:
// Tracking level // Tracking level
......
...@@ -443,26 +443,28 @@ bool VirtualMemoryTracker::remove_released_region(address addr, size_t size) { ...@@ -443,26 +443,28 @@ bool VirtualMemoryTracker::remove_released_region(address addr, size_t size) {
bool VirtualMemoryTracker::walk_virtual_memory(VirtualMemoryWalker* walker) { bool VirtualMemoryTracker::walk_virtual_memory(VirtualMemoryWalker* walker) {
assert(_reserved_regions != NULL, "Sanity check"); assert(_reserved_regions != NULL, "Sanity check");
ThreadCritical tc; ThreadCritical tc;
LinkedListNode<ReservedMemoryRegion>* head = _reserved_regions->head(); // Check that the _reserved_regions haven't been deleted.
while (head != NULL) { if (_reserved_regions != NULL) {
const ReservedMemoryRegion* rgn = head->peek(); LinkedListNode<ReservedMemoryRegion>* head = _reserved_regions->head();
if (!walker->do_allocation_site(rgn)) { while (head != NULL) {
return false; const ReservedMemoryRegion* rgn = head->peek();
if (!walker->do_allocation_site(rgn)) {
return false;
}
head = head->next();
} }
head = head->next(); }
}
return true; return true;
} }
// Transition virtual memory tracking level. // Transition virtual memory tracking level.
bool VirtualMemoryTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) { bool VirtualMemoryTracker::transition(NMT_TrackingLevel from, NMT_TrackingLevel to) {
if (from == NMT_minimal) { assert (from != NMT_minimal, "cannot convert from the lowest tracking level to anything");
assert(to == NMT_summary || to == NMT_detail, "Just check"); if (to == NMT_minimal) {
VirtualMemorySummary::reset();
} else if (to == NMT_minimal) {
assert(from == NMT_summary || from == NMT_detail, "Just check"); assert(from == NMT_summary || from == NMT_detail, "Just check");
// Clean up virtual memory tracking data structures. // Clean up virtual memory tracking data structures.
ThreadCritical tc; ThreadCritical tc;
// Check for potential race with other thread calling transition
if (_reserved_regions != NULL) { if (_reserved_regions != NULL) {
delete _reserved_regions; delete _reserved_regions;
_reserved_regions = NULL; _reserved_regions = NULL;
......
...@@ -62,11 +62,6 @@ class VirtualMemory VALUE_OBJ_CLASS_SPEC { ...@@ -62,11 +62,6 @@ class VirtualMemory VALUE_OBJ_CLASS_SPEC {
_committed -= sz; _committed -= sz;
} }
void reset() {
_reserved = 0;
_committed = 0;
}
inline size_t reserved() const { return _reserved; } inline size_t reserved() const { return _reserved; }
inline size_t committed() const { return _committed; } inline size_t committed() const { return _committed; }
}; };
...@@ -123,12 +118,6 @@ class VirtualMemorySnapshot : public ResourceObj { ...@@ -123,12 +118,6 @@ class VirtualMemorySnapshot : public ResourceObj {
return amount; return amount;
} }
inline void reset() {
for (int index = 0; index < mt_number_of_types; index ++) {
_virtual_memory[index].reset();
}
}
void copy_to(VirtualMemorySnapshot* s) { void copy_to(VirtualMemorySnapshot* s) {
for (int index = 0; index < mt_number_of_types; index ++) { for (int index = 0; index < mt_number_of_types; index ++) {
s->_virtual_memory[index] = _virtual_memory[index]; s->_virtual_memory[index] = _virtual_memory[index];
...@@ -174,10 +163,6 @@ class VirtualMemorySummary : AllStatic { ...@@ -174,10 +163,6 @@ class VirtualMemorySummary : AllStatic {
as_snapshot()->copy_to(s); as_snapshot()->copy_to(s);
} }
static inline void reset() {
as_snapshot()->reset();
}
static VirtualMemorySnapshot* as_snapshot() { static VirtualMemorySnapshot* as_snapshot() {
return (VirtualMemorySnapshot*)_snapshot; return (VirtualMemorySnapshot*)_snapshot;
} }
......
...@@ -774,7 +774,7 @@ void VMError::report(outputStream* st) { ...@@ -774,7 +774,7 @@ void VMError::report(outputStream* st) {
STEP(228, "(Native Memory Tracking)" ) STEP(228, "(Native Memory Tracking)" )
if (_verbose) { if (_verbose) {
MemTracker::final_report(st); MemTracker::error_report(st);
} }
STEP(230, "" ) STEP(230, "" )
......
# #
# Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -23,14 +23,36 @@ ...@@ -23,14 +23,36 @@
# #
# #
# Makefile to run various jdk tests # Makefile to run various hotspot tests
# #
GETMIXEDPATH=echo GETMIXEDPATH=echo
# Get OS/ARCH specifics # Utilities used
OSNAME = $(shell uname -s) AWK = awk
ifeq ($(OSNAME), SunOS) CAT = cat
CD = cd
CHMOD = chmod
CP = cp
CUT = cut
DIRNAME = dirname
ECHO = echo
EGREP = egrep
EXPAND = expand
FIND = find
MKDIR = mkdir
PWD = pwd
SED = sed
SORT = sort
TEE = tee
UNAME = uname
UNIQ = uniq
WC = wc
ZIP = zip
# Get OS name from uname (Cygwin inexplicably adds _NT-5.1)
UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_)
ifeq ($(UNAME_S), SunOS)
PLATFORM = solaris PLATFORM = solaris
SLASH_JAVA = /java SLASH_JAVA = /java
ARCH = $(shell uname -p) ARCH = $(shell uname -p)
...@@ -38,7 +60,7 @@ ifeq ($(OSNAME), SunOS) ...@@ -38,7 +60,7 @@ ifeq ($(OSNAME), SunOS)
ARCH=i586 ARCH=i586
endif endif
endif endif
ifeq ($(OSNAME), Linux) ifeq ($(UNAME_S), Linux)
PLATFORM = linux PLATFORM = linux
SLASH_JAVA = /java SLASH_JAVA = /java
ARCH = $(shell uname -m) ARCH = $(shell uname -m)
...@@ -46,7 +68,7 @@ ifeq ($(OSNAME), Linux) ...@@ -46,7 +68,7 @@ ifeq ($(OSNAME), Linux)
ARCH = i586 ARCH = i586
endif endif
endif endif
ifeq ($(OSNAME), Darwin) ifeq ($(UNAME_S), Darwin)
PLATFORM = bsd PLATFORM = bsd
SLASH_JAVA = /java SLASH_JAVA = /java
ARCH = $(shell uname -m) ARCH = $(shell uname -m)
...@@ -54,7 +76,7 @@ ifeq ($(OSNAME), Darwin) ...@@ -54,7 +76,7 @@ ifeq ($(OSNAME), Darwin)
ARCH = i586 ARCH = i586
endif endif
endif endif
ifeq ($(findstring BSD,$(OSNAME)), BSD) ifeq ($(findstring BSD,$(UNAME_S)), BSD)
PLATFORM = bsd PLATFORM = bsd
SLASH_JAVA = /java SLASH_JAVA = /java
ARCH = $(shell uname -m) ARCH = $(shell uname -m)
...@@ -63,12 +85,12 @@ ifeq ($(findstring BSD,$(OSNAME)), BSD) ...@@ -63,12 +85,12 @@ ifeq ($(findstring BSD,$(OSNAME)), BSD)
endif endif
endif endif
ifeq ($(PLATFORM),) ifeq ($(PLATFORM),)
# detect wether we're running in MKS or cygwin # detect whether we're running in MKS or cygwin
ifeq ($(OSNAME), Windows_NT) # MKS ifeq ($(UNAME_S), Windows_NT) # MKS
GETMIXEDPATH=dosname -s GETMIXEDPATH=dosname -s
endif endif
ifeq ($(findstring CYGWIN,$(OSNAME)), CYGWIN) ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN)
GETMIXEDPATH=cygpath -m -s GETMIXEDPATH=cygpath -m
endif endif
PLATFORM = windows PLATFORM = windows
SLASH_JAVA = J: SLASH_JAVA = J:
...@@ -92,13 +114,6 @@ ifdef ALT_SLASH_JAVA ...@@ -92,13 +114,6 @@ ifdef ALT_SLASH_JAVA
SLASH_JAVA = $(ALT_SLASH_JAVA) SLASH_JAVA = $(ALT_SLASH_JAVA)
endif endif
# Utilities used
CD = cd
CP = cp
ECHO = echo
MKDIR = mkdir
ZIP = zip
# Root of this test area (important to use full paths in some places) # Root of this test area (important to use full paths in some places)
TEST_ROOT := $(shell pwd) TEST_ROOT := $(shell pwd)
...@@ -136,21 +151,82 @@ ifdef JPRT_ARCHIVE_BUNDLE ...@@ -136,21 +151,82 @@ ifdef JPRT_ARCHIVE_BUNDLE
endif endif
# How to create the test bundle (pass or fail, we want to create this) # How to create the test bundle (pass or fail, we want to create this)
BUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` \ # Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
&& $(CD) $(ABS_TEST_OUTPUT_DIR) \ ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \
&& $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) && $(CD) $(ABS_TEST_OUTPUT_DIR) \
BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} ) && $(CHMOD) -R a+r . \
&& $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
# important results files
SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt")
STATS_TXT_NAME = Stats.txt
STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)")
RUNLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt")
PASSLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt")
FAILLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt")
EXITCODE = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt")
TESTEXIT = \
if [ ! -s $(EXITCODE) ] ; then \
$(ECHO) "ERROR: EXITCODE file not filled in."; \
$(ECHO) "1" > $(EXITCODE); \
fi ; \
testExitCode=`$(CAT) $(EXITCODE)`; \
$(ECHO) "EXIT CODE: $${testExitCode}"; \
exit $${testExitCode}
BUNDLE_UP_AND_EXIT = \
( \
jtregExitCode=$$? && \
_summary="$(SUMMARY_TXT)"; \
$(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
$(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
if [ -r "$${_summary}" ] ; then \
$(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
$(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
$(EGREP) ' Passed\.' $(RUNLIST) \
| $(EGREP) -v ' Error\.' \
| $(EGREP) -v ' Failed\.' > $(PASSLIST); \
( $(EGREP) ' Failed\.' $(RUNLIST); \
$(EGREP) ' Error\.' $(RUNLIST); \
$(EGREP) -v ' Passed\.' $(RUNLIST) ) \
| $(SORT) | $(UNIQ) > $(FAILLIST); \
if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
$(EXPAND) $(FAILLIST) \
| $(CUT) -d' ' -f1 \
| $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
if [ $${jtregExitCode} = 0 ] ; then \
jtregExitCode=1; \
fi; \
fi; \
runc="`$(CAT) $(RUNLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
failc="`$(CAT) $(FAILLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
exclc="FIXME CODETOOLS-7900176"; \
$(ECHO) "TEST STATS: name=$(UNIQUE_DIR) run=$${runc} pass=$${passc} fail=$${failc}" \
>> $(STATS_TXT); \
else \
$(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
fi; \
if [ -f $(STATS_TXT) ] ; then \
$(CAT) $(STATS_TXT); \
fi; \
$(ZIP_UP_RESULTS) ; \
$(TESTEXIT) \
)
################################################################ ################################################################
# Default make rule (runs jtreg_tests) # Default make rule (runs jtreg_tests)
all: jtreg_tests all: hotspot_all
@$(ECHO) "Testing completed successfully" @$(ECHO) "Testing completed successfully"
# Support "hotspot_" prefixed test make targets too # Support "hotspot_" prefixed test make targets (too)
# The hotspot_% targets are for example invoked by the top level Makefile # The hotspot_% targets are used by the top level Makefile
# Unless explicitly defined below, hotspot_<x> is interpreted as a jtreg test group name
hotspot_%: hotspot_%:
$(MAKE) $* $(ECHO) "Running tests: $@"
$(MAKE) -j 1 TEST_SELECTION=":$@" UNIQUE_DIR=$@ jtreg_tests;
# Prep for output # Prep for output
prep: clean prep: clean
...@@ -168,41 +244,64 @@ clean: ...@@ -168,41 +244,64 @@ clean:
# Expect JT_HOME to be set for jtreg tests. (home for jtreg) # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
ifndef JT_HOME ifndef JT_HOME
JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg JT_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
endif ifdef JPRT_JTREG_HOME
ifdef JPRT_JTREG_HOME JT_HOME = $(JPRT_JTREG_HOME)
JT_HOME = $(JPRT_JTREG_HOME) endif
endif endif
# Expect JPRT to set TESTDIRS to the jtreg test dirs # When called from JPRT the TESTDIRS variable is set to the jtreg tests to run
JTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof
ifdef TESTDIRS ifdef TESTDIRS
JTREG_TESTDIRS = $(TESTDIRS) TEST_SELECTION = $(TESTDIRS)
endif
ifdef CONCURRENCY
EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
endif endif
# Default JTREG to run # Default JTREG to run
JTREG = $(JT_HOME)/bin/jtreg JTREG = $(JT_HOME)/bin/jtreg
# Only run automatic tests
JTREG_BASIC_OPTIONS += -a
# Report details on all failed or error tests, times too
JTREG_BASIC_OPTIONS += -v:fail,error,time
# Retain all files for failing tests
JTREG_BASIC_OPTIONS += -retain:fail,error
# Ignore tests are not run and completely silent about it
JTREG_IGNORE_OPTION = -ignore:quiet
JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION)
# Add any extra options
JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
# Set other vm and test options
JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_OPTIONS:%=-vmoption:%) $(JAVA_VM_ARGS:%=-vmoption:%)
# Option to tell jtreg to not run tests marked with "ignore" # Option to tell jtreg to not run tests marked with "ignore"
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
JTREG_KEY_OPTION = -k:!ignore JTREG_KEY_OPTION = -k:!ignore
else else
JTREG_KEY_OPTION = -k:\!ignore JTREG_KEY_OPTION = -k:\!ignore
endif endif
JTREG_BASIC_OPTIONS += $(JTREG_KEY_OPTION)
#EXTRA_JTREG_OPTIONS =
# Make sure jtreg exists
jtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) $(JTREG): $(JT_HOME)
$(JTREG) -a -v:fail,error \
$(JTREG_KEY_OPTION) \ jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
$(EXTRA_JTREG_OPTIONS) \ ( \
-r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \ ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \
-w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \ export JT_HOME; \
-jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ $(shell $(GETMIXEDPATH) "$(JTREG)") \
$(JAVA_OPTIONS:%=-vmoption:%) \ $(JTREG_BASIC_OPTIONS) \
$(JTREG_TESTDIRS) \ -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \
|| $(BUNDLE_UP_FAILED) -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \
$(BUNDLE_UP) -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
$(JTREG_EXCLUSIONS) \
$(JTREG_TEST_OPTIONS) \
$(TEST_SELECTION) \
) ; \
$(BUNDLE_UP_AND_EXIT) \
) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
PHONY_LIST += jtreg_tests PHONY_LIST += jtreg_tests
...@@ -210,7 +309,7 @@ PHONY_LIST += jtreg_tests ...@@ -210,7 +309,7 @@ PHONY_LIST += jtreg_tests
# clienttest (make sure various basic java client options work) # clienttest (make sure various basic java client options work)
clienttest: prep $(PRODUCT_HOME) hotspot_clienttest clienttest: prep $(PRODUCT_HOME)
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X
...@@ -218,73 +317,38 @@ clienttest: prep $(PRODUCT_HOME) ...@@ -218,73 +317,38 @@ clienttest: prep $(PRODUCT_HOME)
$(RM) $(PRODUCT_HOME)/jre/bin/client/classes.jsa $(RM) $(PRODUCT_HOME)/jre/bin/client/classes.jsa
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -Xshare:dump $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -Xshare:dump
PHONY_LIST += clienttest PHONY_LIST += hotspot_clienttest clienttest
################################################################ ################################################################
# servertest (make sure various basic java server options work) # minimaltest (make sure various basic java minimal options work)
servertest: prep $(PRODUCT_HOME) hotspot_minimaltest minimaltest: prep $(PRODUCT_HOME)
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X
PHONY_LIST += servertest PHONY_LIST += hotspot_minimaltest minimaltest
################################################################ ################################################################
# internalvmtests (run internal unit tests inside the VM) # servertest (make sure various basic java server options work)
internalvmtests: prep $(PRODUCT_HOME)
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -XX:+ExecuteInternalVMTests -version
PHONY_LIST += internalvmtests
################################################################
# wbapitest (make sure the whitebox testing api classes work
wbapitest: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG) hotspot_servertest servertest: prep $(PRODUCT_HOME)
$(JTREG) -a -v:fail,error \ $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
$(JTREG_KEY_OPTION) \ $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
$(EXTRA_JTREG_OPTIONS) \ $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X
-r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport \
-w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork \
-jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
$(JAVA_OPTIONS:%=-vmoption:%) \
$(shell $(GETMIXEDPATH) "$(TEST_ROOT)")/sanity \
|| $(BUNDLE_UP_FAILED)
$(BUNDLE_UP)
PHONY_LIST += wbapitest PHONY_LIST += hotspot_servertest servertest
################################################################ ################################################################
# packtest # internalvmtests (run internal unit tests inside the VM)
# Expect JPRT to set JPRT_PACKTEST_HOME.
PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest
ifdef JPRT_PACKTEST_HOME
PACKTEST_HOME = $(JPRT_PACKTEST_HOME)
endif
#EXTRA_PACKTEST_OPTIONS =
packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME)
( $(CD) $(PACKTEST_HOME) && \
$(PACKTEST_HOME)/ptest \
-t "$(PRODUCT_HOME)" \
$(PACKTEST_STRESS_OPTION) \
$(EXTRA_PACKTEST_OPTIONS) \
-W $(ABS_TEST_OUTPUT_DIR) \
$(JAVA_OPTIONS:%=-J %) \
) || $(BUNDLE_UP_FAILED)
$(BUNDLE_UP)
packtest_stress: PACKTEST_STRESS_OPTION=-s hotspot_internalvmtests internalvmtests: prep $(PRODUCT_HOME)
packtest_stress: packtest $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -XX:+ExecuteInternalVMTests -version
PHONY_LIST += packtest packtest_stress PHONY_LIST += hotspot_internalvmtests internalvmtests
################################################################ ################################################################
...@@ -292,4 +356,3 @@ PHONY_LIST += packtest packtest_stress ...@@ -292,4 +356,3 @@ PHONY_LIST += packtest packtest_stress
.PHONY: all clean prep $(PHONY_LIST) .PHONY: all clean prep $(PHONY_LIST)
################################################################ ################################################################
...@@ -125,6 +125,27 @@ compact3 = \ ...@@ -125,6 +125,27 @@ compact3 = \
-:needs_jdk -:needs_jdk
# When called from top level the test suites use the hotspot_ prefix
hotspot_wbapitest = \
sanity/
hotspot_compiler = \
sanity/ExecuteInternalVMTests.java
hotspot_gc = \
sanity/ExecuteInternalVMTests.java
hotspot_runtime = \
sanity/ExecuteInternalVMTests.java
hotspot_serviceability = \
sanity/ExecuteInternalVMTests.java
hotspot_all = \
:hotspot_compiler \
:hotspot_gc \
:hotspot_runtime \
:hotspot_serviceability
# Tests that require compact3 API's # Tests that require compact3 API's
# #
needs_compact3 = \ needs_compact3 = \
......
/*
* 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 8059299
* @summary assert(adr_type != NULL) failed: expecting TypeKlassPtr
* @run main/othervm -Xbatch CatchInlineExceptions
*/
class Exception1 extends Exception {};
class Exception2 extends Exception {};
public class CatchInlineExceptions {
private static int counter0;
private static int counter1;
private static int counter2;
private static int counter;
static void foo(int i) throws Exception {
if ((i & 1023) == 2) {
counter0++;
throw new Exception2();
}
}
static void test(int i) throws Exception {
try {
foo(i);
}
catch (Exception e) {
if (e instanceof Exception1) {
counter1++;
} else if (e instanceof Exception2) {
counter2++;
}
counter++;
throw e;
}
}
public static void main(String[] args) throws Throwable {
for (int i = 0; i < 15000; i++) {
try {
test(i);
} catch (Exception e) {
// expected
}
}
if (counter1 != 0) {
throw new RuntimeException("Failed: counter1(" + counter1 + ") != 0");
}
if (counter2 != counter0) {
throw new RuntimeException("Failed: counter2(" + counter2 + ") != counter0(" + counter0 + ")");
}
if (counter2 != counter) {
throw new RuntimeException("Failed: counter2(" + counter2 + ") != counter(" + counter + ")");
}
System.out.println("TEST PASSED");
}
}
/*
* 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
* 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 8059100
* @summary Test that you can decrease NMT tracking level but not increase it.
* @key nmt
* @library /testlibrary /testlibrary/whitebox
* @build ChangeTrackingLevel
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail ChangeTrackingLevel
*/
import com.oracle.java.testlibrary.*;
import sun.hotspot.WhiteBox;
public class ChangeTrackingLevel {
public static WhiteBox wb = WhiteBox.getWhiteBox();
public static void main(String args[]) throws Exception {
boolean testChangeLevel = wb.NMTChangeTrackingLevel();
if (testChangeLevel) {
System.out.println("NMT level change test passed.");
} else {
// it also fails if the VM asserts.
throw new RuntimeException("NMT level change test failed");
}
}
};
...@@ -101,6 +101,7 @@ public class WhiteBox { ...@@ -101,6 +101,7 @@ public class WhiteBox {
public native void NMTOverflowHashBucket(long num); public native void NMTOverflowHashBucket(long num);
public native long NMTMallocWithPseudoStack(long size, int index); public native long NMTMallocWithPseudoStack(long size, int index);
public native boolean NMTIsDetailSupported(); public native boolean NMTIsDetailSupported();
public native boolean NMTChangeTrackingLevel();
// Compiler // Compiler
public native void deoptimizeAll(); public native void deoptimizeAll();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册