This commit is contained in:
Zhengyu Gu 2012-08-01 15:00:50 -07:00
commit 9047207b09
24 changed files with 290 additions and 46 deletions

View File

@ -170,3 +170,4 @@ c029c972396cea042a0dc67c0f7ccf2fe68007d4 jdk8-b41
600c9a1feb01633cbcf2341a43d1d21e6497ecd0 jdk8-b46
b820143a6f1ce993c6e6f31db4d64de990f42654 jdk8-b47
086271e35b0a419b38e8bda9bebd70693811df0a jdk8-b48
cecd7026f30cbd83b0601925a7a5e059aec98138 jdk8-b49

View File

@ -170,3 +170,4 @@ e4f81a817447c3a4f6868f083c81c2fb1b15d44c jdk8-b44
27fa766a2298ba8347dc198f0cf85ba6618e17db jdk8-b46
1dcb4b7b9373e64e135c12fe1f8699f1f80e51e8 jdk8-b47
3f6c72d1c2a6e5c9e7d81c3dc984886678a128ad jdk8-b48
c97b99424815c43818e3cc3ffcdd1a60f3198b52 jdk8-b49

View File

@ -170,3 +170,4 @@ cd879aff5d3cc1f58829aab3116880aa19525b78 jdk8-b43
30141e598d72a6146126cb86b034ed6d0bd191b3 jdk8-b46
21e46ea21c6a26246fb7a1926ac7fe8d580d0518 jdk8-b47
7e2b179a5b4dbd3f097e28daa00abfcc72ba3e0b jdk8-b48
fe44e58a6bdbeae350ce96aafb49770a5dca5d8a jdk8-b49

View File

@ -263,3 +263,5 @@ cf37a594c38db2ea926954154636f9f81da2e032 jdk8-b46
66b0450071c1534e014b131892cc86b63f1d009c hs24-b16
1e26f61bbb521642639f56fae11326f1932f5a7d jdk8-b48
bd54fe36b5e50f9ef1e30a5047b27fee5297e268 hs24-b17
e3619706a7253540a2d94e9e841acaab8ace7038 jdk8-b49
72e0362c3f0cfacbbac8af8a5b9d2e182f21c17b hs24-b18

View File

@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2012
HS_MAJOR_VER=24
HS_MINOR_VER=0
HS_BUILD_NUMBER=18
HS_BUILD_NUMBER=19
JDK_MAJOR_VER=1
JDK_MINOR_VER=8

View File

@ -36,6 +36,11 @@ OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@))
ifeq ("${Platform_compiler}", "sparcWorks")
OPT_CFLAGS/SLOWER = -xO2
ifeq ($(COMPILER_REV_NUMERIC), 510)
# CC 5.10 has bug XXXXX with -xO4
OPT_CFLAGS/jvmtiClassFileReconstituter.o = $(OPT_CFLAGS/SLOWER)
endif # COMPILER_REV_NUMERIC == 510
ifeq ($(COMPILER_REV_NUMERIC), 509)
# To avoid jvm98 crash
OPT_CFLAGS/instanceKlass.o = $(OPT_CFLAGS/SLOWER)

View File

@ -32,6 +32,11 @@ OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@))
# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files)
ifeq ("${Platform_compiler}", "sparcWorks")
ifeq ($(COMPILER_REV_NUMERIC), 510)
# CC 5.10 has bug XXXXX with -xO4
OPT_CFLAGS/jvmtiClassFileReconstituter.o = $(OPT_CFLAGS/O2)
endif # COMPILER_REV_NUMERIC == 510
ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
# dtrace cannot handle tail call optimization (6672627, 6693876)
OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT)

View File

@ -40,6 +40,11 @@ endif
# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files)
ifeq ("${Platform_compiler}", "sparcWorks")
ifeq ($(COMPILER_REV_NUMERIC), 510)
# CC 5.10 has bug XXXXX with -xO4
OPT_CFLAGS/jvmtiClassFileReconstituter.o = $(OPT_CFLAGS/O2)
endif # COMPILER_REV_NUMERIC == 510
ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
# dtrace cannot handle tail call optimization (6672627, 6693876)
OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT)

View File

@ -26,6 +26,139 @@
#ifdef __APPLE__
#include "decoder_machO.hpp"
#include <cxxabi.h>
#include <mach-o/loader.h>
#include <mach-o/nlist.h>
bool MachODecoder::demangle(const char* symbol, char *buf, int buflen) {
int status;
char* result;
size_t size = (size_t)buflen;
// Don't pass buf to __cxa_demangle. In case of the 'buf' is too small,
// __cxa_demangle will call system "realloc" for additional memory, which
// may use different malloc/realloc mechanism that allocates 'buf'.
if ((result = abi::__cxa_demangle(symbol, NULL, NULL, &status)) != NULL) {
jio_snprintf(buf, buflen, "%s", result);
// call c library's free
::free(result);
return true;
}
return false;
}
bool MachODecoder::decode(address addr, char *buf,
int buflen, int *offset, const void *mach_base) {
struct symtab_command * symt = (struct symtab_command *)
mach_find_command((struct mach_header_64 *)mach_base, LC_SYMTAB);
if (symt == NULL) {
DEBUG_ONLY(tty->print_cr("no symtab in mach file at 0x%lx", mach_base));
return false;
}
uint32_t off = symt->symoff; /* symbol table offset (within this mach file) */
uint32_t nsyms = symt->nsyms; /* number of symbol table entries */
uint32_t stroff = symt->stroff; /* string table offset */
uint32_t strsize = symt->strsize; /* string table size in bytes */
// iterate through symbol table trying to match our offset
uint32_t addr_relative = (uintptr_t) mach_base - (uintptr_t) addr; // offset we seek in the symtab
void * symtab_addr = (void*) ((uintptr_t) mach_base + off);
struct nlist_64 *cur_nlist = (struct nlist_64 *) symtab_addr;
struct nlist_64 *last_nlist = cur_nlist; // no size stored in an entry, so keep previously seen nlist
int32_t found_strx = 0;
int32_t found_symval = 0;
for (uint32_t i=0; i < nsyms; i++) {
uint32_t this_value = cur_nlist->n_value;
if (addr_relative == this_value) {
found_strx = cur_nlist->n_un.n_strx;
found_symval = this_value;
break;
} else if (addr_relative > this_value) {
// gone past it, use previously seen nlist:
found_strx = last_nlist->n_un.n_strx;
found_symval = last_nlist->n_value;
break;
}
last_nlist = cur_nlist;
cur_nlist = cur_nlist + sizeof(struct nlist_64);
}
if (found_strx == 0) {
return false;
}
// write the offset:
*offset = addr_relative - found_symval;
// lookup found_strx in the string table
char * symname = mach_find_in_stringtable((char*) ((uintptr_t)mach_base + stroff), strsize, found_strx);
if (symname) {
strncpy(buf, symname, buflen);
return true;
}
DEBUG_ONLY(tty->print_cr("no string or null string found."));
return false;
}
void* MachODecoder::mach_find_command(struct mach_header_64 * mach_base, uint32_t command_wanted) {
// possibly verify it is a mach_header, use magic number.
// commands begin immediately after the header.
struct load_command *pos = (struct load_command *) mach_base + sizeof(struct mach_header_64);
for (uint32_t i = 0; i < mach_base->ncmds; i++) {
struct load_command *this_cmd = (struct load_command *) pos;
if (this_cmd->cmd == command_wanted) {
return pos;
}
int cmdsize = this_cmd->cmdsize;
pos += cmdsize;
}
return NULL;
}
char* MachODecoder::mach_find_in_stringtable(char *strtab, uint32_t tablesize, int strx_wanted) {
if (strx_wanted == 0) {
return NULL;
}
char *strtab_end = strtab + tablesize;
// find the first string, skip over the space char
// (or the four zero bytes we see e.g. in libclient)
if (*strtab == ' ') {
strtab++;
if (*strtab != 0) {
DEBUG_ONLY(tty->print_cr("string table has leading space but no following zero."));
return NULL;
}
strtab++;
} else {
if ((uint32_t) *strtab != 0) {
DEBUG_ONLY(tty->print_cr("string table without leading space or leading int of zero."));
return NULL;
}
strtab+=4;
}
// read the real strings starting at index 1
int cur_strx = 1;
while (strtab < strtab_end) {
if (cur_strx == strx_wanted) {
return strtab;
}
// find start of next string
while (*strtab != 0) {
strtab++;
}
strtab++; // skip the terminating zero
cur_strx++;
}
DEBUG_ONLY(tty->print_cr("string number %d not found.", strx_wanted));
return NULL;
}
#endif

View File

@ -31,10 +31,25 @@
// Just a placehold for now, a real implementation should derive
// from AbstractDecoder
class MachODecoder : public NullDecoder {
public:
class MachODecoder : public AbstractDecoder {
public:
MachODecoder() { }
~MachODecoder() { }
virtual bool can_decode_C_frame_in_vm() const {
return true;
}
virtual bool demangle(const char* symbol, char* buf, int buflen);
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) {
ShouldNotReachHere();
return false;
}
private:
void * mach_find_command(struct mach_header_64 * mach_base, uint32_t command_wanted);
char * mach_find_in_stringtable(char *strtab, uint32_t tablesize, int strx_wanted);
};
#endif

View File

@ -1946,10 +1946,16 @@ bool os::address_is_in_vm(address addr) {
return false;
}
#define MACH_MAXSYMLEN 256
bool os::dll_address_to_function_name(address addr, char *buf,
int buflen, int *offset) {
Dl_info dlinfo;
char localbuf[MACH_MAXSYMLEN];
// dladdr will find names of dynamic functions only, but does
// it set dli_fbase with mach_header address when it "fails" ?
if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) {
if (buf != NULL) {
if(!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) {
@ -1965,6 +1971,14 @@ bool os::dll_address_to_function_name(address addr, char *buf,
}
}
// Handle non-dymanic manually:
if (dlinfo.dli_fbase != NULL &&
Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, dlinfo.dli_fbase)) {
if(!Decoder::demangle(localbuf, buf, buflen)) {
jio_snprintf(buf, buflen, "%s", localbuf);
}
return true;
}
if (buf != NULL) buf[0] = '\0';
if (offset != NULL) *offset = -1;
return false;

View File

@ -72,10 +72,10 @@ void WindowsDecoder::initialize() {
// find out if jvm.dll contains private symbols, by decoding
// current function and comparing the result
address addr = (address)Decoder::decode;
address addr = (address)Decoder::demangle;
char buf[MAX_PATH];
if (decode(addr, buf, sizeof(buf), NULL)) {
_can_decode_in_vm = !strcmp(buf, "Decoder::decode");
_can_decode_in_vm = !strcmp(buf, "Decoder::demangle");
}
}
}

View File

@ -45,6 +45,10 @@ public:
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 void* base) {
ShouldNotReachHere();
return false;
}
private:
void initialize();

View File

@ -757,6 +757,7 @@ void PhaseGVN::dead_loop_check( Node *n ) {
//------------------------------PhaseIterGVN-----------------------------------
// Initialize hash table to fresh and clean for +VerifyOpto
PhaseIterGVN::PhaseIterGVN( PhaseIterGVN *igvn, const char *dummy ) : PhaseGVN(igvn,dummy), _worklist( ),
_stack(C->unique() >> 1),
_delay_transform(false) {
}
@ -764,6 +765,7 @@ PhaseIterGVN::PhaseIterGVN( PhaseIterGVN *igvn, const char *dummy ) : PhaseGVN(i
// Initialize with previous PhaseIterGVN info; used by PhaseCCP
PhaseIterGVN::PhaseIterGVN( PhaseIterGVN *igvn ) : PhaseGVN(igvn),
_worklist( igvn->_worklist ),
_stack( igvn->_stack ),
_delay_transform(igvn->_delay_transform)
{
}
@ -772,6 +774,7 @@ PhaseIterGVN::PhaseIterGVN( PhaseIterGVN *igvn ) : PhaseGVN(igvn),
// Initialize with previous PhaseGVN info from Parser
PhaseIterGVN::PhaseIterGVN( PhaseGVN *gvn ) : PhaseGVN(gvn),
_worklist(*C->for_igvn()),
_stack(C->unique() >> 1),
_delay_transform(false)
{
uint max;
@ -1138,51 +1141,77 @@ const Type* PhaseIterGVN::saturate(const Type* new_type, const Type* old_type,
// Kill a globally dead Node. All uses are also globally dead and are
// aggressively trimmed.
void PhaseIterGVN::remove_globally_dead_node( Node *dead ) {
assert(dead != C->root(), "killing root, eh?");
if (dead->is_top()) return;
NOT_PRODUCT( set_progress(); )
// Remove from iterative worklist
_worklist.remove(dead);
if (!dead->is_Con()) { // Don't kill cons but uses
// Remove from hash table
_table.hash_delete( dead );
// Smash all inputs to 'dead', isolating him completely
for( uint i = 0; i < dead->req(); i++ ) {
Node *in = dead->in(i);
if( in ) { // Points to something?
dead->set_req(i,NULL); // Kill the edge
if (in->outcnt() == 0 && in != C->top()) {// Made input go dead?
remove_dead_node(in); // Recursively remove
} else if (in->outcnt() == 1 &&
in->has_special_unique_user()) {
_worklist.push(in->unique_out());
} else if (in->outcnt() <= 2 && dead->is_Phi()) {
if( in->Opcode() == Op_Region )
_worklist.push(in);
else if( in->is_Store() ) {
DUIterator_Fast imax, i = in->fast_outs(imax);
_worklist.push(in->fast_out(i));
i++;
if(in->outcnt() == 2) {
_worklist.push(in->fast_out(i));
i++;
enum DeleteProgress {
PROCESS_INPUTS,
PROCESS_OUTPUTS
};
assert(_stack.is_empty(), "not empty");
_stack.push(dead, PROCESS_INPUTS);
while (_stack.is_nonempty()) {
dead = _stack.node();
uint progress_state = _stack.index();
assert(dead != C->root(), "killing root, eh?");
assert(!dead->is_top(), "add check for top when pushing");
NOT_PRODUCT( set_progress(); )
if (progress_state == PROCESS_INPUTS) {
// After following inputs, continue to outputs
_stack.set_index(PROCESS_OUTPUTS);
// Remove from iterative worklist
_worklist.remove(dead);
if (!dead->is_Con()) { // Don't kill cons but uses
bool recurse = false;
// Remove from hash table
_table.hash_delete( dead );
// Smash all inputs to 'dead', isolating him completely
for( uint i = 0; i < dead->req(); i++ ) {
Node *in = dead->in(i);
if( in ) { // Points to something?
dead->set_req(i,NULL); // Kill the edge
if (in->outcnt() == 0 && in != C->top()) {// Made input go dead?
_stack.push(in, PROCESS_INPUTS); // Recursively remove
recurse = true;
} else if (in->outcnt() == 1 &&
in->has_special_unique_user()) {
_worklist.push(in->unique_out());
} else if (in->outcnt() <= 2 && dead->is_Phi()) {
if( in->Opcode() == Op_Region )
_worklist.push(in);
else if( in->is_Store() ) {
DUIterator_Fast imax, i = in->fast_outs(imax);
_worklist.push(in->fast_out(i));
i++;
if(in->outcnt() == 2) {
_worklist.push(in->fast_out(i));
i++;
}
assert(!(i < imax), "sanity");
}
}
assert(!(i < imax), "sanity");
}
}
if (dead->is_macro()) {
C->remove_macro_node(dead);
}
if (recurse) {
continue;
}
}
}
if (dead->is_macro()) {
C->remove_macro_node(dead);
// Aggressively kill globally dead uses
// (Rather than pushing all the outs at once, we push one at a time,
// plus the parent to resume later, because of the indefinite number
// of edge deletions per loop trip.)
if (dead->outcnt() > 0) {
// Recursively remove
_stack.push(dead->raw_out(0), PROCESS_INPUTS);
} else {
_stack.pop();
}
}
// Aggressively kill globally dead uses
// (Cannot use DUIterator_Last because of the indefinite number
// of edge deletions per loop trip.)
while (dead->outcnt() > 0) {
remove_globally_dead_node(dead->raw_out(0));
}
}
//------------------------------subsume_node-----------------------------------

View File

@ -403,6 +403,8 @@ class PhaseIterGVN : public PhaseGVN {
// Subsume users of node 'old' into node 'nn'
void subsume_node( Node *old, Node *nn );
Node_Stack _stack; // Stack used to avoid recursion
protected:
// Idealize new Node 'n' with respect to its inputs and its value
@ -438,8 +440,8 @@ public:
// It is significant only for debugging and profiling.
Node* register_new_node_with_optimizer(Node* n, Node* orig = NULL);
// Kill a globally dead Node. It is allowed to have uses which are
// assumed dead and left 'in limbo'.
// Kill a globally dead Node. All uses are also globally dead and are
// aggressively trimmed.
void remove_globally_dead_node( Node *dead );
// Kill all inputs to a dead node, recursively making more dead nodes.

View File

@ -91,6 +91,18 @@ bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const cha
return decoder->decode(addr, buf, buflen, offset, modulepath);
}
bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const void* base) {
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);
AbstractDecoder* decoder = error_handling_thread ?
get_error_handler_instance(): get_shared_instance();
assert(decoder != NULL, "null decoder");
return decoder->decode(addr, buf, buflen, offset, base);
}
bool Decoder::demangle(const char* symbol, char* buf, int buflen) {
assert(_shared_decoder_lock != NULL, "Just check");
bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;

View File

@ -47,6 +47,8 @@ public:
// the function
virtual bool decode(address pc, char* buf, int buflen, int* offset,
const char* modulepath = NULL) = 0;
virtual bool decode(address pc, char* buf, int buflen, int* offset, const void* base) = 0;
// demangle a C++ symbol
virtual bool demangle(const char* symbol, char* buf, int buflen) = 0;
// if the decoder can decode symbols in vm
@ -82,6 +84,10 @@ public:
return false;
}
virtual bool decode(address pc, char* buf, int buflen, int* offset, const void* base) {
return false;
}
virtual bool demangle(const char* symbol, char* buf, int buflen) {
return false;
}
@ -95,6 +101,7 @@ public:
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 void* base);
static bool demangle(const char* symbol, char* buf, int buflen);
static bool can_decode_C_frame_in_vm();

View File

@ -43,6 +43,10 @@ public:
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 void *base) {
ShouldNotReachHere();
return false;
}
private:
ElfFile* get_elf_file(const char* filepath);

View File

@ -135,7 +135,7 @@ template <class T, MEMFLAGS F> void Hashtable<T, F>::move_to(Hashtable<T, F>* ne
// walking the hashtable past these entries requires
// BasicHashtableEntry::make_ptr() call.
bool keep_shared = p->is_shared();
unlink_entry(p);
this->unlink_entry(p);
new_table->add_entry(index, p);
if (keep_shared) {
p->set_shared();

View File

@ -260,7 +260,7 @@ protected:
}
int index_for(Symbol* name) {
return hash_to_index(compute_hash(name));
return this->hash_to_index(compute_hash(name));
}
// Table entry management

View File

@ -170,3 +170,4 @@ eff4ece9c8bc43b3ce2b3758574c4c20147f0689 jdk8-b43
300f45e990643af230d6cca39477ff62c44a9a54 jdk8-b46
404521944ac9383afda7d55d60713b212c730646 jdk8-b47
1c88da9a1365797e49be77ae42c34bbc0a3c3f0c jdk8-b48
f81e981eca7b63316cf9d778f93903a4fc62161d jdk8-b49

View File

@ -170,3 +170,4 @@ e80ac58b5ba904f24e125c742c30d0d740f05f86 jdk8-b45
ae368a83c2404b65c9e38c65e2aa081f2201ca74 jdk8-b46
fe6a060afc404dcf0921708a740de770666b781f jdk8-b47
efb564de8a8ee397a65fab77d45cb20200f6ddd8 jdk8-b48
b48865af8ac559ba6f60fb86fa3fe0ebdd22746c jdk8-b49

View File

@ -170,3 +170,4 @@ b92353a01aa049bc508fc56f0347d5934b7c4390 jdk8-b45
8d2ed9d58453c8049715a72a6d26b6b66b37a94c jdk8-b46
00b22b23269a57d0bb46c57753be2fe9a9d2c1a3 jdk8-b47
3e4ab821f46166fcf63e8fe5c8046216003c941f jdk8-b48
51707c3b75c0f521794d9ab425f4e5b2351c70c1 jdk8-b49

View File

@ -170,3 +170,4 @@ e111e4587ccada8eb93f72e834e378c76256f4b7 jdk8-b45
4ca5994971724731233735f055f33d4936fd11d3 jdk8-b46
7e6be2f239c9a4ac6dec280bd18ec296dd78e464 jdk8-b47
afb0a523155727d42b1c773f783ff3a7cfab8e86 jdk8-b48
c72c164ced676d3c360d99b1c52cc80940fc3122 jdk8-b49