This commit is contained in:
Daniel D. Daugherty 2015-03-13 09:18:28 -07:00
commit 6029190551
43 changed files with 308 additions and 220 deletions

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -63,10 +63,6 @@ public class PPC64Frame extends Frame {
// Entry frames
private static int ENTRY_FRAME_CALL_WRAPPER_OFFSET;
// Native frames
private static int NATIVE_FRAME_INITIAL_PARAM_OFFSET;
static {
VM.registerVMInitializedObserver(new Observer() {
public void update(Observable o, Object data) {
@ -76,10 +72,8 @@ public class PPC64Frame extends Frame {
}
private static synchronized void initialize(TypeDataBase db) {
int abi_minframe_size = db.lookupIntConstant("frame::abi_minframe_size").intValue();
int entry_frame_locals_size = db.lookupIntConstant("frame::entry_frame_locals_size").intValue();
int wordLength = (int) VM.getVM().getAddressSize();
NATIVE_FRAME_INITIAL_PARAM_OFFSET = -abi_minframe_size/wordLength;
ENTRY_FRAME_CALL_WRAPPER_OFFSET = -entry_frame_locals_size/wordLength;
}
@ -389,13 +383,6 @@ public class PPC64Frame extends Frame {
// Return address:
public Address getSenderPC() { return getSenderSP().getAddressAt(2 * VM.getVM().getAddressSize()); }
// return address of param, zero origin index.
// MPJ note: Appears to be unused.
public Address getNativeParamAddr(int idx) {
return null;
// return addressOfStackSlot(NATIVE_FRAME_INITIAL_PARAM_OFFSET + idx);
}
public Address getSenderSP() { return getFP(); }
public Address addressOfInterpreterFrameLocals() {
return addressOfStackSlot(INTERPRETER_FRAME_LOCALS_OFFSET);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -63,9 +63,6 @@ public class X86Frame extends Frame {
// Entry frames
private static int ENTRY_FRAME_CALL_WRAPPER_OFFSET;
// Native frames
private static final int NATIVE_FRAME_INITIAL_PARAM_OFFSET = 2;
private static VMReg rbp;
static {
@ -423,20 +420,12 @@ public class X86Frame extends Frame {
return addressOfStackSlot(LINK_OFFSET).getAddressAt(0);
}
// FIXME: not implementable yet
//inline void frame::set_link(intptr_t* addr) { *(intptr_t **)addr_at(link_offset) = addr; }
public Address getUnextendedSP() { return raw_unextendedSP; }
// Return address:
public Address getSenderPCAddr() { return addressOfStackSlot(RETURN_ADDR_OFFSET); }
public Address getSenderPC() { return getSenderPCAddr().getAddressAt(0); }
// return address of param, zero origin index.
public Address getNativeParamAddr(int idx) {
return addressOfStackSlot(NATIVE_FRAME_INITIAL_PARAM_OFFSET + idx);
}
public Address getSenderSP() { return addressOfStackSlot(SENDER_SP_OFFSET); }
public Address addressOfInterpreterFrameLocals() {

@ -1,5 +1,5 @@
#
# Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 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
@ -233,7 +233,7 @@ checks: check_os_version check_j2se_version
# Solaris 2.5.1, 2.6).
# Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok.
SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3%
SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3% 4%
OS_VERSION := $(shell uname -r)
EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION))

@ -69,6 +69,7 @@ ProjectCreatorIncludesPRIVATE=\
-ignorePath ppc \
-ignorePath zero \
-ignorePath aix \
-ignorePath aarch64 \
-hidePath .hg

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -136,12 +136,7 @@
entry_frame_call_wrapper_offset = -8,
// we don't need a save area
arg_reg_save_area_bytes = 0,
// TODO - check that this is still correct
// Native frames
native_frame_initial_param_offset = 2
arg_reg_save_area_bytes = 0
};
@ -195,9 +190,6 @@
inline address* sender_pc_addr() const;
// return address of param, zero origin index.
inline address* native_param_addr(int idx) const;
// expression stack tos if we are nested in a java call
intptr_t* interpreter_frame_last_sp() const;

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -166,7 +166,6 @@ inline bool frame::is_older(intptr_t* id) const { assert(this->id() != NULL &&
inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); }
inline void frame::set_link(intptr_t* addr) { *(intptr_t **)addr_at(link_offset) = addr; }
inline intptr_t* frame::unextended_sp() const { return _unextended_sp; }
@ -176,9 +175,6 @@ inline intptr_t* frame::unextended_sp() const { return _unextended_sp; }
inline address* frame::sender_pc_addr() const { return (address*) addr_at( return_addr_offset); }
inline address frame::sender_pc() const { return *sender_pc_addr(); }
// return address of param, zero origin index.
inline address* frame::native_param_addr(int idx) const { return (address*) addr_at( native_frame_initial_param_offset+idx); }
#ifdef CC_INTERP
inline interpreterState frame::get_interpreterState() const {

@ -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
@ -69,8 +69,6 @@ inline int frame::frame_size(RegisterMap* map) const { return sender_sp() - sp()
inline intptr_t* frame::link() const { return (intptr_t *)(fp()[FP->sp_offset_in_saved_window()] + STACK_BIAS); }
inline void frame::set_link(intptr_t* addr) { assert(link()==addr, "frame nesting is controlled by hardware"); }
inline intptr_t* frame::unextended_sp() const { return sp() + _sp_adjustment_by_callee; }
// return address:

@ -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
@ -128,21 +128,16 @@
entry_frame_after_call_words = 28,
entry_frame_call_wrapper_offset = 2,
arg_reg_save_area_bytes = 32, // Register argument save area
arg_reg_save_area_bytes = 32 // Register argument save area
#else
entry_frame_after_call_words = 13,
entry_frame_call_wrapper_offset = -6,
arg_reg_save_area_bytes = 0,
arg_reg_save_area_bytes = 0
#endif // _WIN64
#else
entry_frame_call_wrapper_offset = 2,
entry_frame_call_wrapper_offset = 2
#endif // AMD64
// Native frames
native_frame_initial_param_offset = 2
};
intptr_t ptr_at(int offset) const {
@ -195,9 +190,6 @@
inline address* sender_pc_addr() const;
// return address of param, zero origin index.
inline address* native_param_addr(int idx) const;
// expression stack tos if we are nested in a java call
intptr_t* interpreter_frame_last_sp() const;

@ -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
@ -139,8 +139,6 @@ inline bool frame::is_older(intptr_t* id) const { assert(this->id() != NULL &&
inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); }
inline void frame::set_link(intptr_t* addr) { *(intptr_t **)addr_at(link_offset) = addr; }
inline intptr_t* frame::unextended_sp() const { return _unextended_sp; }
@ -149,9 +147,6 @@ inline intptr_t* frame::unextended_sp() const { return _unextended_sp; }
inline address* frame::sender_pc_addr() const { return (address*) addr_at( return_addr_offset); }
inline address frame::sender_pc() const { return *sender_pc_addr(); }
// return address of param, zero origin index.
inline address* frame::native_param_addr(int idx) const { return (address*) addr_at( native_frame_initial_param_offset+idx); }
#ifdef CC_INTERP
inline interpreterState frame::get_interpreterState() const {

@ -109,7 +109,15 @@ static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
}
sigthreadmask(SIG_UNBLOCK, &newset, NULL);
VMError err(NULL, sig, NULL, info, ucVoid);
// support safefetch faults in error handling
ucontext_t* const uc = (ucontext_t*) ucVoid;
address const pc = uc ? os::Aix::ucontext_get_pc(uc) : NULL;
if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
os::Aix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return;
}
VMError err(NULL, sig, pc, info, ucVoid);
err.report_and_die();
}

@ -99,6 +99,7 @@ class Bsd {
static void set_page_size(int val) { _page_size = val; }
static address ucontext_get_pc(ucontext_t* uc);
static void ucontext_set_pc(ucontext_t* uc, address pc);
static intptr_t* ucontext_get_sp(ucontext_t* uc);
static intptr_t* ucontext_get_fp(ucontext_t* uc);

@ -112,7 +112,16 @@ static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
}
pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
VMError err(NULL, sig, NULL, info, ucVoid);
// support safefetch faults in error handling
ucontext_t* const uc = (ucontext_t*) ucVoid;
address const pc = uc ? os::Bsd::ucontext_get_pc(uc) : NULL;
if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
os::Bsd::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return;
}
VMError err(NULL, sig, pc, info, ucVoid);
err.report_and_die();
}

@ -143,6 +143,7 @@ class Linux {
static int vm_default_page_size(void) { return _vm_default_page_size; }
static address ucontext_get_pc(ucontext_t* uc);
static void ucontext_set_pc(ucontext_t* uc, address pc);
static intptr_t* ucontext_get_sp(ucontext_t* uc);
static intptr_t* ucontext_get_fp(ucontext_t* uc);

@ -112,7 +112,16 @@ static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
}
pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
VMError err(NULL, sig, NULL, info, ucVoid);
// support safefetch faults in error handling
ucontext_t* const uc = (ucontext_t*) ucVoid;
address const pc = uc ? os::Linux::ucontext_get_pc(uc) : NULL;
if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return;
}
VMError err(NULL, sig, pc, info, ucVoid);
err.report_and_die();
}

@ -137,6 +137,7 @@ class Solaris {
// ucontext_get_fp() is only used by Solaris X86 (see note below)
static intptr_t* ucontext_get_fp(ucontext_t* uc);
static address ucontext_get_pc(ucontext_t* uc);
static void ucontext_set_pc(ucontext_t* uc, address pc);
// For Analyzer Forte AsyncGetCallTrace profiling support:
// Parameter ret_fp is only used by Solaris X86.

@ -109,7 +109,15 @@ static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
}
thr_sigsetmask(SIG_UNBLOCK, &newset, NULL);
VMError err(NULL, sig, NULL, info, ucVoid);
// support safefetch faults in error handling
ucontext_t* const uc = (ucontext_t*) ucVoid;
address const pc = uc ? os::Solaris::ucontext_get_pc(uc) : NULL;
if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
os::Solaris::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return;
}
VMError err(NULL, sig, pc, info, ucVoid);
err.report_and_die();
}

@ -1,6 +1,6 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2013 SAP AG. All rights reserved.
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2015 SAP AG. 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
@ -48,7 +48,5 @@ define_pd_global(intx, StackShadowPages, 6 DEBUG_ONLY(+2));
// Only used on 64 bit platforms
define_pd_global(uintx,HeapBaseMinAddress, 2*G);
// Only used on 64 bit Windows platforms
define_pd_global(bool, UseVectoredExceptions, false);
#endif // OS_CPU_AIX_OJDKPPC_VM_GLOBALS_AIX_PPC_HPP

@ -397,7 +397,7 @@ JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrec
// continue at the next instruction after the faulting read. Returning
// garbage from this read is ok.
thread->set_pending_unsafe_access_error();
uc->uc_mcontext.jmp_context.iar = ((unsigned long)pc) + 4;
os::Aix::ucontext_set_pc(uc, pc + 4);
return 1;
}
}
@ -420,7 +420,7 @@ JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrec
// continue at the next instruction after the faulting read. Returning
// garbage from this read is ok.
thread->set_pending_unsafe_access_error();
uc->uc_mcontext.jmp_context.iar = ((unsigned long)pc) + 4;
os::Aix::ucontext_set_pc(uc, pc + 4);
return 1;
}
}
@ -445,7 +445,7 @@ run_stub:
if (stub != NULL) {
// Save all thread context in case we need to restore it.
if (thread != NULL) thread->set_saved_exception_pc(pc);
uc->uc_mcontext.jmp_context.iar = (unsigned long)stub;
os::Aix::ucontext_set_pc(uc, stub);
return 1;
}

@ -309,6 +309,10 @@ address os::Bsd::ucontext_get_pc(ucontext_t * uc) {
return (address)uc->context_pc;
}
void os::Bsd::ucontext_set_pc(ucontext_t * uc, address pc) {
uc->context_pc = (intptr_t)pc ;
}
intptr_t* os::Bsd::ucontext_get_sp(ucontext_t * uc) {
return (intptr_t*)uc->context_sp;
}
@ -463,7 +467,7 @@ JVM_handle_bsd_signal(int sig,
pc = (address) os::Bsd::ucontext_get_pc(uc);
if (StubRoutines::is_safefetch_fault(pc)) {
uc->context_pc = intptr_t(StubRoutines::continuation_for_safefetch_fault(pc));
os::Bsd::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return 1;
}
@ -703,7 +707,7 @@ JVM_handle_bsd_signal(int sig,
// save all thread context in case we need to restore it
if (thread != NULL) thread->set_saved_exception_pc(pc);
uc->context_pc = (intptr_t)stub;
os::Bsd::ucontext_set_pc(uc, stub);
return true;
}

@ -107,6 +107,10 @@ address os::Bsd::ucontext_get_pc(ucontext_t* uc) {
return NULL;
}
void os::Bsd::ucontext_set_pc(ucontext_t * uc, address pc) {
ShouldNotCallThis();
}
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
intptr_t** ret_sp,
intptr_t** ret_fp) {

@ -1,6 +1,6 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2013 SAP AG. All rights reserved.
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2015 SAP AG. 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
@ -48,7 +48,5 @@ define_pd_global(intx, StackShadowPages, 6 DEBUG_ONLY(+2));
// Only used on 64 bit platforms
define_pd_global(uintx,HeapBaseMinAddress, 2*G);
// Only used on 64 bit Windows platforms
define_pd_global(bool, UseVectoredExceptions, false);
#endif // OS_CPU_LINUX_PPC_VM_GLOBALS_LINUX_PPC_HPP

@ -113,6 +113,14 @@ address os::Linux::ucontext_get_pc(ucontext_t * uc) {
return (address)uc->uc_mcontext.regs->nip;
}
// modify PC in ucontext.
// Note: Only use this for an ucontext handed down to a signal handler. See comment
// in ucontext_get_pc.
void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
uc->uc_mcontext.regs->nip = (unsigned long)pc;
}
intptr_t* os::Linux::ucontext_get_sp(ucontext_t * uc) {
return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
}
@ -213,7 +221,7 @@ JVM_handle_linux_signal(int sig,
if (uc) {
address const pc = os::Linux::ucontext_get_pc(uc);
if (pc && StubRoutines::is_safefetch_fault(pc)) {
uc->uc_mcontext.regs->nip = (unsigned long)StubRoutines::continuation_for_safefetch_fault(pc);
os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return true;
}
}
@ -360,7 +368,7 @@ JVM_handle_linux_signal(int sig,
// continue at the next instruction after the faulting read. Returning
// garbage from this read is ok.
thread->set_pending_unsafe_access_error();
uc->uc_mcontext.regs->nip = ((unsigned long)pc) + 4;
os::Linux::ucontext_set_pc(uc, pc + 4);
return true;
}
}
@ -379,7 +387,7 @@ JVM_handle_linux_signal(int sig,
// continue at the next instruction after the faulting read. Returning
// garbage from this read is ok.
thread->set_pending_unsafe_access_error();
uc->uc_mcontext.regs->nip = ((unsigned long)pc) + 4;
os::Linux::ucontext_set_pc(uc, pc + 4);
return true;
}
}
@ -402,7 +410,7 @@ JVM_handle_linux_signal(int sig,
if (stub != NULL) {
// Save all thread context in case we need to restore it.
if (thread != NULL) thread->set_saved_exception_pc(pc);
uc->uc_mcontext.regs->nip = (unsigned long)stub;
os::Linux::ucontext_set_pc(uc, stub);
return true;
}

@ -85,11 +85,6 @@ enum {
CON_O7,
};
static inline void set_cont_address(sigcontext* ctx, address addr) {
SIG_PC(ctx) = (intptr_t)addr;
SIG_NPC(ctx) = (intptr_t)(addr+4);
}
// For Forte Analyzer AsyncGetCallTrace profiling support - thread is
// currently interrupted by SIGPROF.
// os::Solaris::fetch_frame_from_ucontext() tries to skip nested
@ -351,6 +346,12 @@ address os::Linux::ucontext_get_pc(ucontext_t* uc) {
return (address) SIG_PC((sigcontext*)uc);
}
void os::Linux::ucontext_set_pc(ucontext_t* uc, address pc) {
sigcontext_t* ctx = (sigcontext_t*) uc;
SIG_PC(ctx) = (intptr_t)addr;
SIG_NPC(ctx) = (intptr_t)(addr+4);
}
intptr_t* os::Linux::ucontext_get_sp(ucontext_t *uc) {
return (intptr_t*)
((intptr_t)SIG_REGS((sigcontext*)uc).u_regs[CON_O6] + STACK_BIAS);
@ -366,7 +367,7 @@ intptr_t* os::Linux::ucontext_get_fp(ucontext_t *uc) {
inline static bool checkPrefetch(sigcontext* uc, address pc) {
if (StubRoutines::is_safefetch_fault(pc)) {
set_cont_address(uc, address(StubRoutines::continuation_for_safefetch_fault(pc)));
os::Linux::ucontext_set_pc((ucontext_t*)uc, StubRoutines::continuation_for_safefetch_fault(pc));
return true;
}
return false;
@ -666,7 +667,7 @@ JVM_handle_linux_signal(int sig,
// save all thread context in case we need to restore it
thread->set_saved_exception_pc(pc);
thread->set_saved_exception_npc(npc);
set_cont_address(uc, stub);
os::Linux::ucontext_set_pc((ucontext_t*)uc, stub);
return true;
}
}

@ -122,6 +122,10 @@ address os::Linux::ucontext_get_pc(ucontext_t * uc) {
return (address)uc->uc_mcontext.gregs[REG_PC];
}
void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc;
}
intptr_t* os::Linux::ucontext_get_sp(ucontext_t * uc) {
return (intptr_t*)uc->uc_mcontext.gregs[REG_SP];
}
@ -279,7 +283,7 @@ JVM_handle_linux_signal(int sig,
pc = (address) os::Linux::ucontext_get_pc(uc);
if (StubRoutines::is_safefetch_fault(pc)) {
uc->uc_mcontext.gregs[REG_PC] = intptr_t(StubRoutines::continuation_for_safefetch_fault(pc));
os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return 1;
}
@ -514,7 +518,7 @@ JVM_handle_linux_signal(int sig,
// save all thread context in case we need to restore it
if (thread != NULL) thread->set_saved_exception_pc(pc);
uc->uc_mcontext.gregs[REG_PC] = (greg_t)stub;
os::Linux::ucontext_set_pc(uc, stub);
return true;
}

@ -100,6 +100,10 @@ address os::Linux::ucontext_get_pc(ucontext_t* uc) {
ShouldNotCallThis();
}
void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
ShouldNotCallThis();
}
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
intptr_t** ret_sp,
intptr_t** ret_fp) {

@ -184,6 +184,11 @@ ExtendedPC os::Solaris::ucontext_get_ExtendedPC(ucontext_t *uc) {
return ExtendedPC(pc);
}
void os::Solaris::ucontext_set_pc(ucontext_t* uc, address pc) {
uc->uc_mcontext.gregs [REG_PC] = (greg_t) pc;
uc->uc_mcontext.gregs [REG_nPC] = (greg_t) (pc + 4);
}
// Assumes ucontext is valid
intptr_t* os::Solaris::ucontext_get_sp(ucontext_t *uc) {
return (intptr_t*)((intptr_t)uc->uc_mcontext.gregs[REG_SP] + STACK_BIAS);
@ -355,8 +360,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
// SafeFetch() support
if (StubRoutines::is_safefetch_fault(pc)) {
uc->uc_mcontext.gregs[REG_PC] = intptr_t(StubRoutines::continuation_for_safefetch_fault(pc));
uc->uc_mcontext.gregs[REG_nPC] = uc->uc_mcontext.gregs[REG_PC] + 4;
os::Solaris::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return 1;
}
@ -494,8 +498,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
// simulate a branch to the stub (a "call" in the safepoint stub case)
// factor me: setPC
uc->uc_mcontext.gregs[REG_PC ] = (greg_t)stub;
uc->uc_mcontext.gregs[REG_nPC] = (greg_t)(stub + 4);
os::Solaris::ucontext_set_pc(uc, stub);
#ifndef PRODUCT
if (TraceJumps) thread->record_jump(stub, NULL, __FILE__, __LINE__);

@ -174,6 +174,10 @@ ExtendedPC os::Solaris::ucontext_get_ExtendedPC(ucontext_t *uc) {
return ExtendedPC((address)uc->uc_mcontext.gregs[REG_PC]);
}
void os::Solaris::ucontext_set_pc(ucontext_t* uc, address pc) {
uc->uc_mcontext.gregs [REG_PC] = (greg_t) pc;
}
// Assumes ucontext is valid
intptr_t* os::Solaris::ucontext_get_sp(ucontext_t *uc) {
return (intptr_t*)uc->uc_mcontext.gregs[REG_SP];
@ -411,7 +415,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
pc = (address) uc->uc_mcontext.gregs[REG_PC];
if (StubRoutines::is_safefetch_fault(pc)) {
uc->uc_mcontext.gregs[REG_PC] = intptr_t(StubRoutines::continuation_for_safefetch_fault(pc));
os::Solaris::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return true;
}
@ -614,8 +618,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
if (thread != NULL) thread->set_saved_exception_pc(pc);
// 12/02/99: On Sparc it appears that the full context is also saved
// but as yet, no one looks at or restores that saved context
// factor me: setPC
uc->uc_mcontext.gregs[REG_PC] = (greg_t)stub;
os::Solaris::ucontext_set_pc(uc, stub);
return true;
}

@ -364,10 +364,6 @@ WB_ENTRY(void, WB_NMTReleaseMemory(JNIEnv* env, jobject o, jlong addr, jlong siz
os::release_memory((char *)(uintptr_t)addr, size);
WB_END
WB_ENTRY(jboolean, WB_NMTIsDetailSupported(JNIEnv* env))
return MemTracker::tracking_level() == NMT_detail;
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) {
@ -1321,7 +1317,6 @@ static JNINativeMethod methods[] = {
{CC"NMTCommitMemory", CC"(JJ)V", (void*)&WB_NMTCommitMemory },
{CC"NMTUncommitMemory", CC"(JJ)V", (void*)&WB_NMTUncommitMemory },
{CC"NMTReleaseMemory", CC"(JJ)V", (void*)&WB_NMTReleaseMemory },
{CC"NMTIsDetailSupported",CC"()Z", (void*)&WB_NMTIsDetailSupported},
{CC"NMTChangeTrackingLevel", CC"()Z", (void*)&WB_NMTChangeTrackingLevel},
{CC"NMTGetHashSize", CC"()I", (void*)&WB_NMTGetHashSize },
#endif // INCLUDE_NMT

@ -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
@ -194,7 +194,6 @@ class frame VALUE_OBJ_CLASS_SPEC {
public:
// Link (i.e., the pointer to the previous frame)
intptr_t* link() const;
void set_link(intptr_t* addr);
// Return address
address sender_pc() const;

@ -921,6 +921,9 @@ class CommandLineFlags {
"If > 0, provokes an error inside VM error handler (a secondary " \
"crash). see test_error_handler() in debug.cpp.") \
\
notproduct(bool, TestSafeFetchInErrorHandler, false, \
"If true, tests SafeFetch inside error handler.") \
\
develop(bool, Verbose, false, \
"Print additional debugging information from other modes") \
\

@ -210,8 +210,36 @@ static void test_arraycopy_func(address func, int alignment) {
assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything");
}
}
#endif
// simple test for SafeFetch32
static void test_safefetch32() {
int dummy = 17;
int* const p_invalid = (int*) get_segfault_address();
int* const p_valid = &dummy;
int result_invalid = SafeFetch32(p_invalid, 0xABC);
assert(result_invalid == 0xABC, "SafeFetch32 error");
int result_valid = SafeFetch32(p_valid, 0xABC);
assert(result_valid == 17, "SafeFetch32 error");
}
// simple test for SafeFetchN
static void test_safefetchN() {
#ifdef _LP64
const intptr_t v1 = UCONST64(0xABCD00000000ABCD);
const intptr_t v2 = UCONST64(0xDEFD00000000DEFD);
#else
const intptr_t v1 = 0xABCDABCD;
const intptr_t v2 = 0xDEFDDEFD;
#endif
intptr_t dummy = v1;
intptr_t* const p_invalid = (intptr_t*) get_segfault_address();
intptr_t* const p_valid = &dummy;
intptr_t result_invalid = SafeFetchN(p_invalid, v2);
assert(result_invalid == v2, "SafeFetchN error");
intptr_t result_valid = SafeFetchN(p_valid, v2);
assert(result_valid == v1, "SafeFetchN error");
}
#endif
void StubRoutines::initialize2() {
if (_code2 == NULL) {
@ -300,6 +328,13 @@ void StubRoutines::initialize2() {
test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::aligned_conjoint_words), sizeof(jlong));
test_arraycopy_func(CAST_FROM_FN_PTR(address, Copy::aligned_disjoint_words), sizeof(jlong));
// test safefetch routines
// Not on Windows 32bit until 8074860 is fixed
#if ! (defined(_WIN32) && defined(_M_IX86))
test_safefetch32();
test_safefetchN();
#endif
#endif
}

@ -448,4 +448,9 @@ inline intptr_t SafeFetchN(intptr_t* adr, intptr_t errValue) {
return StubRoutines::SafeFetchN_stub()(adr, errValue);
}
// returns true if SafeFetch32 and SafeFetchN can be used safely (stubroutines are already generated)
inline bool CanUseSafeFetch32() { return StubRoutines::SafeFetch32_stub() ? true : false; }
inline bool CanUseSafeFetchN() { return StubRoutines::SafeFetchN_stub() ? true : false; }
#endif // SHARE_VM_RUNTIME_STUBROUTINES_HPP

@ -2584,7 +2584,6 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
/**********************/ \
/* frame */ \
/**********************/ \
NOT_ZERO(PPC64_ONLY(declare_constant(frame::abi_minframe_size))) \
NOT_ZERO(PPC64_ONLY(declare_constant(frame::entry_frame_locals_size))) \
\
NOT_ZERO(X86_ONLY(declare_constant(frame::entry_frame_call_wrapper_offset))) \

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2014, 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
@ -53,11 +53,7 @@ NMT_TrackingLevel MemTracker::init_tracking_level() {
if (strcmp(nmt_option, "summary") == 0) {
level = NMT_summary;
} else if (strcmp(nmt_option, "detail") == 0) {
#if PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
level = NMT_detail;
#else
level = NMT_summary;
#endif // PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
} else if (strcmp(nmt_option, "off") != 0) {
// The option value is invalid
_is_nmt_env_valid = false;
@ -95,17 +91,9 @@ void MemTracker::init() {
bool MemTracker::check_launcher_nmt_support(const char* value) {
if (strcmp(value, "=detail") == 0) {
#if !PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
jio_fprintf(defaultStream::error_stream(),
"NMT detail is not supported on this platform. Using NMT summary instead.\n");
if (MemTracker::tracking_level() != NMT_summary) {
return false;
}
#else
if (MemTracker::tracking_level() != NMT_detail) {
return false;
}
#endif
} else if (strcmp(value, "=summary") == 0) {
if (MemTracker::tracking_level() != NMT_summary) {
return false;

@ -446,15 +446,6 @@ enum RTMState {
# include "globalDefinitions_aarch64.hpp"
#endif
/*
* If a platform does not support native stack walking
* the platform specific globalDefinitions (above)
* can set PLATFORM_NATIVE_STACK_WALKING_SUPPORTED to 0
*/
#ifndef PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
#define PLATFORM_NATIVE_STACK_WALKING_SUPPORTED 1
#endif
// To assure the IRIW property on processors that are not multiple copy
// atomic, sync instructions must be issued between volatile reads to
// assure their ordering, instead of after volatile stores.

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -32,10 +32,6 @@ const NativeCallStack NativeCallStack::EMPTY_STACK(0, false);
NativeCallStack::NativeCallStack(int toSkip, bool fillStack) :
_hash_value(0) {
#if !PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
fillStack = false;
#endif
if (fillStack) {
os::get_native_stack(_stack, NMT_TrackingStackDepth, toSkip);
} else {
@ -95,11 +91,7 @@ void NativeCallStack::print_on(outputStream* out, int indent) const {
int offset;
if (is_empty()) {
for (int index = 0; index < indent; index ++) out->print(" ");
#if PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
out->print("[BOOTSTRAP]");
#else
out->print("[No stack]");
#endif
} else {
for (int frame = 0; frame < NMT_TrackingStackDepth; frame ++) {
pc = get_frame(frame);

@ -358,19 +358,39 @@ void VMError::report(outputStream* st) {
// test secondary error handling. Test it twice, to test that resetting
// error handler after a secondary crash works.
STEP(13, "(test secondary crash 1)")
STEP(11, "(test secondary crash 1)")
if (_verbose && TestCrashInErrorHandler != 0) {
st->print_cr("Will crash now (TestCrashInErrorHandler=%d)...",
TestCrashInErrorHandler);
controlled_crash(TestCrashInErrorHandler);
}
STEP(14, "(test secondary crash 2)")
STEP(12, "(test secondary crash 2)")
if (_verbose && TestCrashInErrorHandler != 0) {
st->print_cr("Will crash now (TestCrashInErrorHandler=%d)...",
TestCrashInErrorHandler);
controlled_crash(TestCrashInErrorHandler);
}
STEP(13, "(test safefetch in error handler)")
// test whether it is safe to use SafeFetch32 in Crash Handler. Test twice
// to test that resetting the signal handler works correctly.
if (_verbose && TestSafeFetchInErrorHandler) {
st->print_cr("Will test SafeFetch...");
if (CanUseSafeFetch32()) {
int* const invalid_pointer = (int*) get_segfault_address();
const int x = 0x76543210;
int i1 = SafeFetch32(invalid_pointer, x);
int i2 = SafeFetch32(invalid_pointer, x);
if (i1 == x && i2 == x) {
st->print_cr("SafeFetch OK."); // Correctly deflected and returned default pattern
} else {
st->print_cr("??");
}
} else {
st->print_cr("not possible; skipped.");
}
}
#endif // PRODUCT
STEP(15, "(printing type of error)")

@ -0,0 +1,92 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.regex.Pattern;
import com.oracle.java.testlibrary.OutputAnalyzer;
import com.oracle.java.testlibrary.Platform;
import com.oracle.java.testlibrary.ProcessTools;
/*
* @test
* @bug 8074552
* @summary SafeFetch32 and SafeFetchN do not work in error handling
* @library /testlibrary
* @author Thomas Stuefe (SAP)
*/
public class SafeFetchInErrorHandlingTest {
public static void main(String[] args) throws Exception {
if (!Platform.isDebugBuild()) {
return;
}
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions",
"-Xmx100M",
"-XX:ErrorHandlerTest=14",
"-XX:+TestSafeFetchInErrorHandler",
"-version");
OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
// we should have crashed with a SIGSEGV
output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*");
output_detail.shouldMatch("# +(?:SIGSEGV|EXCEPTION_ACCESS_VIOLATION).*");
// extract hs-err file
String hs_err_file = output_detail.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
if (hs_err_file == null) {
throw new RuntimeException("Did not find hs-err file in output.\n");
}
File f = new File(hs_err_file);
if (!f.exists()) {
throw new RuntimeException("hs-err file missing at "
+ f.getAbsolutePath() + ".\n");
}
System.out.println("Found hs_err file. Scanning...");
FileInputStream fis = new FileInputStream(f);
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
String line = null;
Pattern [] pattern = new Pattern[] {
Pattern.compile("Will test SafeFetch..."),
Pattern.compile("SafeFetch OK."),
};
int currentPattern = 0;
String lastLine = null;
while ((line = br.readLine()) != null) {
if (currentPattern < pattern.length) {
if (pattern[currentPattern].matcher(line).matches()) {
System.out.println("Found: " + line + ".");
currentPattern ++;
}
}
lastLine = line;
}
br.close();
if (currentPattern < pattern.length) {
throw new RuntimeException("hs-err file incomplete (first missing pattern: " + currentPattern + ")");
}
if (!lastLine.equals("END.")) {
throw new RuntimeException("hs-err file incomplete (missing END marker.)");
} else {
System.out.println("End marker found.");
}
System.out.println("OK.");
}
}

@ -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
@ -27,7 +27,6 @@
* @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

@ -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
@ -27,7 +27,6 @@
* @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.*;

@ -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
@ -46,13 +46,6 @@ public class ThreadedVirtualAllocTestType {
String pid = Integer.toString(ProcessTools.getProcessId());
ProcessBuilder pb = new ProcessBuilder();
boolean has_nmt_detail = wb.NMTIsDetailSupported();
if (has_nmt_detail) {
System.out.println("NMT detail support detected.");
} else {
System.out.println("NMT detail support not detected.");
}
Thread reserveThread = new Thread() {
public void run() {
addr = wb.NMTReserveMemory(reserveSize);
@ -64,9 +57,7 @@ public class ThreadedVirtualAllocTestType {
pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"});
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=512KB, committed=0KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 512KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 512KB for Test");
Thread commitThread = new Thread() {
public void run() {
@ -78,9 +69,7 @@ public class ThreadedVirtualAllocTestType {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=512KB, committed=128KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
Thread uncommitThread = new Thread() {
public void run() {
@ -107,4 +96,4 @@ public class ThreadedVirtualAllocTestType {
output.shouldNotContain("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved");
}
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -49,13 +49,6 @@ public class VirtualAllocCommitUncommitRecommit {
String pid = Integer.toString(ProcessTools.getProcessId());
ProcessBuilder pb = new ProcessBuilder();
boolean has_nmt_detail = wb.NMTIsDetailSupported();
if (has_nmt_detail) {
System.out.println("NMT detail support detected.");
} else {
System.out.println("NMT detail support not detected.");
}
// reserve
addr = wb.NMTReserveMemory(reserveSize);
pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid,
@ -63,11 +56,9 @@ public class VirtualAllocCommitUncommitRecommit {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=0KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
long addrA = addr;
long addrB = addr + commitSize;
@ -85,11 +76,9 @@ public class VirtualAllocCommitUncommitRecommit {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=512KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
// uncommit BC
wb.NMTUncommitMemory(addrB, commitSize);
wb.NMTUncommitMemory(addrC, commitSize);
@ -97,11 +86,9 @@ public class VirtualAllocCommitUncommitRecommit {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=256KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
// commit EF
wb.NMTCommitMemory(addrE, commitSize);
@ -109,22 +96,18 @@ public class VirtualAllocCommitUncommitRecommit {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=512KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
// uncommit A
wb.NMTUncommitMemory(addrA, commitSize);
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=384KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
// commit ABC
wb.NMTCommitMemory(addrA, commitSize);
@ -133,11 +116,9 @@ public class VirtualAllocCommitUncommitRecommit {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=768KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
// uncommit ABCDEF
wb.NMTUncommitMemory(addrA, commitSize);
@ -149,11 +130,9 @@ public class VirtualAllocCommitUncommitRecommit {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=0KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
// release
wb.NMTReleaseMemory(addr, reserveSize);

@ -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
@ -47,30 +47,19 @@ public class VirtualAllocTestType {
String pid = Integer.toString(ProcessTools.getProcessId());
ProcessBuilder pb = new ProcessBuilder();
boolean has_nmt_detail = wb.NMTIsDetailSupported();
if (has_nmt_detail) {
System.out.println("NMT detail support detected.");
} else {
System.out.println("NMT detail support not detected.");
}
addr = wb.NMTReserveMemory(reserveSize);
pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"});
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=256KB, committed=0KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 256KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 256KB for Test");
wb.NMTCommitMemory(addr, commitSize);
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=256KB, committed=128KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
wb.NMTUncommitMemory(addr, commitSize);
@ -85,4 +74,4 @@ public class VirtualAllocTestType {
output.shouldNotContain("Test (reserved=");
output.shouldNotMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved");
}
}
}