--- a/hotspot/src/os/aix/vm/decoder_aix.hpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/os/aix/vm/decoder_aix.hpp Wed Jun 17 15:45:43 2015 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright 2013 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -38,8 +38,8 @@
virtual bool demangle(const char* symbol, char* buf, int buflen) { return false; } // demangled by getFuncName
- virtual bool decode(address addr, char* buf, int buflen, int* offset, const char* modulepath) {
- return (::getFuncName((codeptr_t)addr, buf, buflen, offset, 0, 0, 0) == 0);
+ virtual bool decode(address addr, char* buf, int buflen, int* offset, const char* modulepath, bool demangle) {
+ return (::getFuncName((codeptr_t)addr, buf, buflen, offset, 0, 0, 0, demangle) == 0);
}
virtual bool decode(address addr, char *buf, int buflen, int* offset, const void *base) {
ShouldNotReachHere();
--- a/hotspot/src/os/aix/vm/os_aix.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/os/aix/vm/os_aix.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -1439,7 +1439,8 @@
}
bool os::dll_address_to_function_name(address addr, char *buf,
- int buflen, int *offset) {
+ int buflen, int *offset,
+ bool demangle) {
if (offset) {
*offset = -1;
}
@@ -1454,7 +1455,7 @@
}
// Go through Decoder::decode to call getFuncName which reads the name from the traceback table.
- return Decoder::decode(addr, buf, buflen, offset);
+ return Decoder::decode(addr, buf, buflen, offset, demangle);
}
static int getModuleName(codeptr_t pc, // [in] program counter
--- a/hotspot/src/os/aix/vm/porting_aix.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/os/aix/vm/porting_aix.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -114,7 +114,8 @@
int* p_displacement, // [out] optional: displacement (-1 if not available)
const struct tbtable** p_tb, // [out] optional: ptr to traceback table to get further
// information (NULL if not available)
- char* p_errmsg, size_t errmsglen // [out] optional: user provided buffer for error messages
+ char* p_errmsg, size_t errmsglen,// [out] optional: user provided buffer for error messages
+ bool demangle // [in] whether to demangle the name
) {
struct tbtable* tb = 0;
unsigned int searchcount = 0;
@@ -216,15 +217,17 @@
p_name[0] = '\0';
// If it is a C++ name, try and demangle it using the Demangle interface (see demangle.h).
- char* rest;
- Name* const name = Demangle(buf, rest);
- if (name) {
- const char* const demangled_name = name->Text();
- if (demangled_name) {
- strncpy(p_name, demangled_name, namelen-1);
- p_name[namelen-1] = '\0';
+ if (demangle) {
+ char* rest;
+ Name* const name = Demangle(buf, rest);
+ if (name) {
+ const char* const demangled_name = name->Text();
+ if (demangled_name) {
+ strncpy(p_name, demangled_name, namelen-1);
+ p_name[namelen-1] = '\0';
+ }
+ delete name;
}
- delete name;
}
// Fallback: if demangling did not work, just provide the unmangled name.
@@ -325,7 +328,7 @@
int displacement = 0;
if (getFuncName((codeptr_t) p, funcname, sizeof(funcname), &displacement,
- NULL, NULL, 0) == 0) {
+ NULL, NULL, 0, true /* demangle */) == 0) {
if (funcname[0] != '\0') {
const char* const interned = dladdr_fixed_strings.intern(funcname);
info->dli_sname = interned;
--- a/hotspot/src/os/aix/vm/porting_aix.hpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/os/aix/vm/porting_aix.hpp Wed Jun 17 15:45:43 2015 +0000
@@ -87,7 +87,8 @@
char* p_name, size_t namelen, // [out] optional: user provided buffer for the function name
int* p_displacement, // [out] optional: displacement
const struct tbtable** p_tb, // [out] optional: ptr to traceback table to get further information
- char* p_errmsg, size_t errmsglen // [out] optional: user provided buffer for error messages
+ char* p_errmsg, size_t errmsglen,// [out] optional: user provided buffer for error messages
+ bool demangle = true // [in] whether to demangle the name
);
// -------------------------------------------------------------------------
--- a/hotspot/src/os/bsd/vm/decoder_machO.hpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/os/bsd/vm/decoder_machO.hpp Wed Jun 17 15:45:43 2015 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -42,7 +42,7 @@
virtual bool decode(address pc, char* buf, int buflen, int* offset,
const void* base);
virtual bool decode(address pc, char* buf, int buflen, int* offset,
- const char* module_path = NULL) {
+ const char* module_path, bool demangle) {
ShouldNotReachHere();
return false;
}
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -1339,7 +1339,8 @@
#define MACH_MAXSYMLEN 256
bool os::dll_address_to_function_name(address addr, char *buf,
- int buflen, int *offset) {
+ int buflen, int *offset,
+ bool demangle) {
// buf is not optional, but offset is optional
assert(buf != NULL, "sanity check");
@@ -1349,7 +1350,7 @@
if (dladdr((void*)addr, &dlinfo) != 0) {
// see if we have a matching symbol
if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) {
- if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) {
+ if (!(demangle && Decoder::demangle(dlinfo.dli_sname, buf, buflen))) {
jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname);
}
if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
@@ -1358,15 +1359,16 @@
// no matching symbol so try for just file info
if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) {
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
- buf, buflen, offset, dlinfo.dli_fname)) {
+ buf, buflen, offset, dlinfo.dli_fname, demangle)) {
return true;
}
}
// Handle non-dynamic manually:
if (dlinfo.dli_fbase != NULL &&
- Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, dlinfo.dli_fbase)) {
- if (!Decoder::demangle(localbuf, buf, buflen)) {
+ Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset,
+ dlinfo.dli_fbase)) {
+ if (!(demangle && Decoder::demangle(localbuf, buf, buflen))) {
jio_snprintf(buf, buflen, "%s", localbuf);
}
return true;
--- a/hotspot/src/os/linux/vm/os_linux.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -1623,7 +1623,8 @@
}
bool os::dll_address_to_function_name(address addr, char *buf,
- int buflen, int *offset) {
+ int buflen, int *offset,
+ bool demangle) {
// buf is not optional, but offset is optional
assert(buf != NULL, "sanity check");
@@ -1632,7 +1633,7 @@
if (dladdr((void*)addr, &dlinfo) != 0) {
// see if we have a matching symbol
if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) {
- if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) {
+ if (!(demangle && Decoder::demangle(dlinfo.dli_sname, buf, buflen))) {
jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname);
}
if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
@@ -1641,7 +1642,7 @@
// no matching symbol so try for just file info
if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) {
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
- buf, buflen, offset, dlinfo.dli_fname)) {
+ buf, buflen, offset, dlinfo.dli_fname, demangle)) {
return true;
}
}
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -1627,7 +1627,8 @@
static dladdr1_func_type dladdr1_func = NULL;
bool os::dll_address_to_function_name(address addr, char *buf,
- int buflen, int * offset) {
+ int buflen, int * offset,
+ bool demangle) {
// buf is not optional, but offset is optional
assert(buf != NULL, "sanity check");
@@ -1655,7 +1656,7 @@
if (dlinfo.dli_saddr != NULL &&
(char *)dlinfo.dli_saddr + info->st_size > (char *)addr) {
if (dlinfo.dli_sname != NULL) {
- if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) {
+ if (!(demangle && Decoder::demangle(dlinfo.dli_sname, buf, buflen))) {
jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname);
}
if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
@@ -1665,7 +1666,7 @@
// no matching symbol so try for just file info
if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) {
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
- buf, buflen, offset, dlinfo.dli_fname)) {
+ buf, buflen, offset, dlinfo.dli_fname, demangle)) {
return true;
}
}
@@ -1679,7 +1680,7 @@
if (dladdr((void *)addr, &dlinfo) != 0) {
// see if we have a matching symbol
if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) {
- if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) {
+ if (!(demangle && Decoder::demangle(dlinfo.dli_sname, buf, buflen))) {
jio_snprintf(buf, buflen, dlinfo.dli_sname);
}
if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
@@ -1688,7 +1689,7 @@
// no matching symbol so try for just file info
if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) {
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
- buf, buflen, offset, dlinfo.dli_fname)) {
+ buf, buflen, offset, dlinfo.dli_fname, demangle)) {
return true;
}
}
--- a/hotspot/src/os/windows/vm/decoder_windows.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/os/windows/vm/decoder_windows.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -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
@@ -162,7 +162,7 @@
// current function and comparing the result
address addr = (address)Decoder::demangle;
char buf[MAX_PATH];
- if (decode(addr, buf, sizeof(buf), NULL)) {
+ if (decode(addr, buf, sizeof(buf), NULL, NULL, true /* demangle */)) {
_can_decode_in_vm = !strcmp(buf, "Decoder::demangle");
}
}
@@ -187,7 +187,7 @@
}
-bool WindowsDecoder::decode(address addr, char *buf, int buflen, int* offset, const char* modulepath) {
+bool WindowsDecoder::decode(address addr, char *buf, int buflen, int* offset, const char* modulepath, bool demangle_name) {
if (_pfnSymGetSymFromAddr64 != NULL) {
PIMAGEHLP_SYMBOL64 pSymbol;
char symbolInfo[MAX_PATH + sizeof(IMAGEHLP_SYMBOL64)];
@@ -197,7 +197,7 @@
DWORD64 displacement;
if (_pfnSymGetSymFromAddr64(::GetCurrentProcess(), (DWORD64)addr, &displacement, pSymbol)) {
if (buf != NULL) {
- if (demangle(pSymbol->Name, buf, buflen)) {
+ if (!(demangle_name && demangle(pSymbol->Name, buf, buflen))) {
jio_snprintf(buf, buflen, "%s", pSymbol->Name);
}
}
--- a/hotspot/src/os/windows/vm/decoder_windows.hpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/os/windows/vm/decoder_windows.hpp Wed Jun 17 15:45:43 2015 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -60,7 +60,7 @@
bool can_decode_C_frame_in_vm() const;
bool demangle(const char* symbol, char *buf, int buflen);
- bool decode(address addr, char *buf, int buflen, int* offset, const char* modulepath = NULL);
+ bool decode(address addr, char *buf, int buflen, int* offset, const char* modulepath, bool demangle);
bool decode(address addr, char *buf, int buflen, int* offset, const void* base) {
ShouldNotReachHere();
return false;
--- a/hotspot/src/os/windows/vm/os_windows.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/os/windows/vm/os_windows.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -1369,11 +1369,12 @@
}
bool os::dll_address_to_function_name(address addr, char *buf,
- int buflen, int *offset) {
+ int buflen, int *offset,
+ bool demangle) {
// buf is not optional, but offset is optional
assert(buf != NULL, "sanity check");
- if (Decoder::decode(addr, buf, buflen, offset)) {
+ if (Decoder::decode(addr, buf, buflen, offset, demangle)) {
return true;
}
if (offset != NULL) *offset = -1;
--- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java Wed Jun 17 15:45:43 2015 +0000
@@ -363,9 +363,6 @@
// Set /On option
addAttr(rv, "Optimization", opt);
- // Set /FR option.
- addAttr(rv, "BrowseInformation", "true");
- addAttr(rv, "BrowseInformationFile", "$(IntDir)");
// Set /MD option.
addAttr(rv, "RuntimeLibrary", "MultiThreadedDLL");
// Set /Oy- option
--- a/hotspot/src/share/vm/gc/serial/genMarkSweep.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/share/vm/gc/serial/genMarkSweep.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -208,7 +208,7 @@
level,
false, // Younger gens are not roots.
GenCollectedHeap::SO_None,
- GenCollectedHeap::StrongRootsOnly,
+ ClassUnloading,
&follow_root_closure,
&follow_root_closure,
&follow_cld_closure);
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -381,6 +381,9 @@
if (!constants()->is_shared()) {
MetadataFactory::free_metadata(loader_data, constants());
}
+ // Delete any cached resolution errors for the constant pool
+ SystemDictionary::delete_resolution_error(constants());
+
set_constants(NULL);
}
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -4089,9 +4089,6 @@
mnt->adjust_method_entries(the_class(), &trace_name_printed);
}
- // Fix Resolution Error table also to remove old constant pools
- SystemDictionary::delete_resolution_error(old_constants);
-
if (the_class->oop_map_cache() != NULL) {
// Flush references to any obsolete methods from the oop map cache
// so that obsolete methods are not pinned.
--- a/hotspot/src/share/vm/runtime/arguments.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -1384,6 +1384,12 @@
if (!FLAG_IS_DEFAULT(OldPLABSize) || !FLAG_IS_DEFAULT(OldPLABWeight)) {
CFLS_LAB::modify_initialization(OldPLABSize, OldPLABWeight);
}
+
+ if (!ClassUnloading) {
+ FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
+ FLAG_SET_CMDLINE(bool, ExplicitGCInvokesConcurrentAndUnloadsClasses, false);
+ }
+
if (PrintGCDetails && Verbose) {
tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
(unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
--- a/hotspot/src/share/vm/runtime/os.hpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/share/vm/runtime/os.hpp Wed Jun 17 15:45:43 2015 +0000
@@ -539,7 +539,8 @@
// If function name is not found, buf[0] is set to '\0' and offset is
// set to -1 (if offset is non-NULL).
static bool dll_address_to_function_name(address addr, char* buf,
- int buflen, int* offset);
+ int buflen, int* offset,
+ bool demangle = true);
// Locate DLL/DSO. On success, full path of the library is copied to
// buf, and offset is optionally set to be the distance between addr
--- a/hotspot/src/share/vm/utilities/decoder.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/share/vm/utilities/decoder.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -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
@@ -102,7 +102,7 @@
return _shared_decoder_lock;
}
-bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath) {
+bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath, bool demangle) {
assert(_shared_decoder_lock != NULL, "Just check");
bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
MutexLockerEx locker(error_handling_thread ? NULL : _shared_decoder_lock, true);
@@ -110,7 +110,7 @@
get_error_handler_instance(): get_shared_instance();
assert(decoder != NULL, "null decoder");
- return decoder->decode(addr, buf, buflen, offset, modulepath);
+ return decoder->decode(addr, buf, buflen, offset, modulepath, demangle);
}
bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const void* base) {
--- a/hotspot/src/share/vm/utilities/decoder.hpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/share/vm/utilities/decoder.hpp Wed Jun 17 15:45:43 2015 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, 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
@@ -46,8 +46,12 @@
// decode an pc address to corresponding function name and an offset from the beginning of
// the function
+ //
+ // Note: the 'base' variant does not demangle names. The
+ // demangling that was done systematically in the 'modulepath' variant
+ // is now optional.
virtual bool decode(address pc, char* buf, int buflen, int* offset,
- const char* modulepath = NULL) = 0;
+ const char* modulepath = NULL, bool demangle = true) = 0;
virtual bool decode(address pc, char* buf, int buflen, int* offset, const void* base) = 0;
// demangle a C++ symbol
@@ -81,7 +85,7 @@
~NullDecoder() {};
virtual bool decode(address pc, char* buf, int buflen, int* offset,
- const char* modulepath = NULL) {
+ const char* modulepath, bool demangle) {
return false;
}
@@ -101,7 +105,10 @@
class Decoder : AllStatic {
public:
- static bool decode(address pc, char* buf, int buflen, int* offset, const char* modulepath = NULL);
+ static bool decode(address pc, char* buf, int buflen, int* offset, const char* modulepath = NULL, bool demangle = true);
+ static bool decode(address pc, char* buf, int buflen, int* offset, bool demangle) {
+ return decode(pc, buf, buflen, offset, (const char*) NULL, demangle);
+ }
static bool decode(address pc, char* buf, int buflen, int* offset, const void* base);
static bool demangle(const char* symbol, char* buf, int buflen);
static bool can_decode_C_frame_in_vm();
--- a/hotspot/src/share/vm/utilities/decoder_elf.cpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/share/vm/utilities/decoder_elf.cpp Wed Jun 17 15:45:43 2015 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -34,7 +34,7 @@
}
}
-bool ElfDecoder::decode(address addr, char *buf, int buflen, int* offset, const char* filepath) {
+bool ElfDecoder::decode(address addr, char *buf, int buflen, int* offset, const char* filepath, bool demangle_name) {
assert(filepath, "null file path");
assert(buf != NULL && buflen > 0, "Invalid buffer");
if (has_error()) return false;
@@ -46,7 +46,7 @@
if (!file->decode(addr, buf, buflen, offset)) {
return false;
}
- if (buf[0] != '\0') {
+ if (demangle_name && (buf[0] != '\0')) {
demangle(buf, buf, buflen);
}
return true;
--- a/hotspot/src/share/vm/utilities/decoder_elf.hpp Wed Jun 17 11:30:51 2015 -0400
+++ b/hotspot/src/share/vm/utilities/decoder_elf.hpp Wed Jun 17 15:45:43 2015 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -42,7 +42,7 @@
bool can_decode_C_frame_in_vm() const { return true; }
bool demangle(const char* symbol, char *buf, int buflen);
- bool decode(address addr, char *buf, int buflen, int* offset, const char* filepath = NULL);
+ bool decode(address addr, char *buf, int buflen, int* offset, const char* filepath, bool demangle);
bool decode(address addr, char *buf, int buflen, int* offset, const void *base) {
ShouldNotReachHere();
return false;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java Wed Jun 17 15:45:43 2015 +0000
@@ -0,0 +1,143 @@
+/*
+ * 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
+ * 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 8076110
+ * @summary Redefine running methods that have cached resolution errors
+ * @library /testlibrary
+ * @modules java.instrument
+ * java.base/jdk.internal.org.objectweb.asm
+ * @build RedefineClassHelper
+ * @run main RedefineClassHelper
+ * @run main/othervm -javaagent:redefineagent.jar -XX:TraceRedefineClasses=0x600 RedefineRunningMethodsWithResolutionErrors
+ */
+
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Label;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Opcodes;
+
+import java.lang.reflect.InvocationTargetException;
+
+public class RedefineRunningMethodsWithResolutionErrors extends ClassLoader implements Opcodes {
+
+ @Override
+ protected Class<?> findClass(String name) throws ClassNotFoundException {
+ if (name.equals("C")) {
+ byte[] b = loadC(false);
+ return defineClass(name, b, 0, b.length);
+ } else {
+ return super.findClass(name);
+ }
+ }
+
+ private static byte[] loadC(boolean redefine) {
+ ClassWriter cw = new ClassWriter(0);
+
+ cw.visit(52, ACC_SUPER | ACC_PUBLIC, "C", null, "java/lang/Object", null);
+ {
+ MethodVisitor mv;
+
+ mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "m", "()V", null, null);
+ mv.visitCode();
+
+ // First time we run we will:
+ // 1) Cache resolution errors
+ // 2) Redefine the class / method
+ // 3) Try to read the resolution errors that were cached
+ //
+ // The redefined method will never run, throw error to be sure
+ if (redefine) {
+ createThrowRuntimeExceptionCode(mv, "The redefined method was called");
+ } else {
+ createMethodBody(mv);
+ }
+ mv.visitMaxs(3, 0);
+ mv.visitEnd();
+ }
+ cw.visitEnd();
+ return cw.toByteArray();
+ }
+
+ private static void createMethodBody(MethodVisitor mv) {
+ Label classExists = new Label();
+
+ // Cache resolution errors
+ createLoadNonExistentClassCode(mv, classExists);
+
+ // Redefine our own class and method
+ mv.visitMethodInsn(INVOKESTATIC, "RedefineRunningMethodsWithResolutionErrors", "redefine", "()V");
+
+ // Provoke the same error again to make sure the resolution error cache works
+ createLoadNonExistentClassCode(mv, classExists);
+
+ // Test passed
+ mv.visitInsn(RETURN);
+
+ mv.visitFrame(F_SAME, 0, new Object[0], 0, new Object[0]);
+ mv.visitLabel(classExists);
+
+ createThrowRuntimeExceptionCode(mv, "Loaded class that shouldn't exist (\"NonExistentClass\")");
+ }
+
+ private static void createLoadNonExistentClassCode(MethodVisitor mv, Label classExists) {
+ Label tryLoadBegin = new Label();
+ Label tryLoadEnd = new Label();
+ Label catchLoadBlock = new Label();
+ mv.visitTryCatchBlock(tryLoadBegin, tryLoadEnd, catchLoadBlock, "java/lang/NoClassDefFoundError");
+
+ // Try to load a class that does not exist to provoke resolution errors
+ mv.visitLabel(tryLoadBegin);
+ mv.visitMethodInsn(INVOKESTATIC, "NonExistentClass", "nonExistentMethod", "()V");
+ mv.visitLabel(tryLoadEnd);
+
+ // No NoClassDefFoundError means NonExistentClass existed, which shouldn't happen
+ mv.visitJumpInsn(GOTO, classExists);
+
+ mv.visitFrame(F_SAME1, 0, new Object[0], 1, new Object[] { "java/lang/NoClassDefFoundError" });
+ mv.visitLabel(catchLoadBlock);
+
+ // Ignore the expected NoClassDefFoundError
+ mv.visitInsn(POP);
+ }
+
+ private static void createThrowRuntimeExceptionCode(MethodVisitor mv, String msg) {
+ mv.visitTypeInsn(NEW, "java/lang/RuntimeException");
+ mv.visitInsn(DUP);
+ mv.visitLdcInsn(msg);
+ mv.visitMethodInsn(INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V");
+ mv.visitInsn(ATHROW);
+ }
+
+ private static Class<?> c;
+
+ public static void redefine() throws Exception {
+ RedefineClassHelper.redefineClass(c, loadC(true));
+ }
+
+ public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ c = Class.forName("C", true, new RedefineRunningMethodsWithResolutionErrors());
+ c.getMethod("m").invoke(null);
+ }
+}