aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramurillo <none@none>2012-01-20 16:56:31 -0800
committeramurillo <none@none>2012-01-20 16:56:31 -0800
commitf067038cf3aed01aba821cfbb6437c41ff50c6fe (patch)
tree7847f8c028ecce6aee8a831beadd88d6abada763
parent8ee0157298a0c422ba8127475e12e231e90d6f7e (diff)
parentd14318ae385aac494834a587fd109a4e51a76f8c (diff)
-rw-r--r--make/Makefile12
-rw-r--r--make/bsd/makefiles/vm.make10
-rw-r--r--make/defs.make4
-rw-r--r--make/hotspot_version2
-rw-r--r--make/linux/makefiles/vm.make10
-rw-r--r--make/solaris/makefiles/vm.make6
-rw-r--r--make/windows/build.bat2
-rw-r--r--make/windows/create_obj_files.sh7
-rw-r--r--make/windows/makefiles/projectcreator.make5
-rw-r--r--make/windows/makefiles/vm.make36
-rw-r--r--src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp5
-rw-r--r--src/cpu/sparc/vm/c1_LIRAssembler_sparc.hpp4
-rw-r--r--src/cpu/sparc/vm/frame_sparc.inline.hpp4
-rw-r--r--src/cpu/sparc/vm/methodHandles_sparc.cpp2
-rw-r--r--src/cpu/x86/vm/c1_LIRAssembler_x86.cpp5
-rw-r--r--src/cpu/x86/vm/frame_x86.cpp20
-rw-r--r--src/cpu/x86/vm/frame_x86.hpp3
-rw-r--r--src/cpu/x86/vm/methodHandles_x86.cpp4
-rw-r--r--src/cpu/zero/vm/frame_zero.inline.hpp6
-rw-r--r--src/cpu/zero/vm/methodHandles_zero.hpp40
-rw-r--r--src/os/bsd/vm/decoder_machO.cpp31
-rw-r--r--src/os/bsd/vm/decoder_machO.hpp (renamed from src/os/bsd/vm/decoder_bsd.cpp)46
-rw-r--r--src/os/bsd/vm/os_bsd.cpp2
-rw-r--r--src/os/linux/vm/decoder_linux.cpp5
-rw-r--r--src/os/linux/vm/os_linux.cpp2
-rw-r--r--src/os/solaris/vm/decoder_solaris.cpp5
-rw-r--r--src/os/solaris/vm/os_solaris.cpp4
-rw-r--r--src/os/windows/vm/decoder_windows.cpp58
-rw-r--r--src/os/windows/vm/decoder_windows.hpp61
-rw-r--r--src/os/windows/vm/os_windows.cpp2
-rw-r--r--src/share/vm/classfile/symbolTable.cpp18
-rw-r--r--src/share/vm/classfile/symbolTable.hpp3
-rw-r--r--src/share/vm/classfile/systemDictionary.cpp6
-rw-r--r--src/share/vm/oops/klass.cpp3
-rw-r--r--src/share/vm/oops/klass.hpp8
-rw-r--r--src/share/vm/oops/methodKlass.cpp1
-rw-r--r--src/share/vm/oops/methodOop.hpp8
-rw-r--r--src/share/vm/prims/jni.cpp15
-rw-r--r--src/share/vm/prims/jniExport.hpp42
-rw-r--r--src/share/vm/prims/methodHandles.cpp58
-rw-r--r--src/share/vm/prims/methodHandles.hpp40
-rw-r--r--src/share/vm/runtime/frame.cpp19
-rw-r--r--src/share/vm/runtime/frame.hpp11
-rw-r--r--src/share/vm/runtime/globals.hpp4
-rw-r--r--src/share/vm/runtime/java.cpp7
-rw-r--r--src/share/vm/runtime/mutexLocker.cpp14
-rw-r--r--src/share/vm/runtime/mutexLocker.hpp6
-rw-r--r--src/share/vm/runtime/os.cpp1
-rw-r--r--src/share/vm/runtime/sharedRuntime.cpp2
-rw-r--r--src/share/vm/runtime/thread.cpp24
-rw-r--r--src/share/vm/runtime/thread.hpp6
-rw-r--r--src/share/vm/runtime/vm_operations.hpp1
-rw-r--r--src/share/vm/trace/traceEventTypes.hpp30
-rw-r--r--src/share/vm/trace/traceMacros.hpp43
-rw-r--r--src/share/vm/trace/tracing.hpp30
-rw-r--r--src/share/vm/utilities/decoder.cpp121
-rw-r--r--src/share/vm/utilities/decoder.hpp111
-rw-r--r--src/share/vm/utilities/decoder_elf.cpp76
-rw-r--r--src/share/vm/utilities/decoder_elf.hpp55
-rw-r--r--src/share/vm/utilities/elfFile.cpp39
-rw-r--r--src/share/vm/utilities/elfFile.hpp27
-rw-r--r--src/share/vm/utilities/elfStringTable.cpp21
-rw-r--r--src/share/vm/utilities/elfStringTable.hpp22
-rw-r--r--src/share/vm/utilities/elfSymbolTable.cpp24
-rw-r--r--src/share/vm/utilities/elfSymbolTable.hpp16
-rw-r--r--src/share/vm/utilities/globalDefinitions.hpp5
-rw-r--r--src/share/vm/utilities/vmError.cpp2
67 files changed, 875 insertions, 447 deletions
diff --git a/make/Makefile b/make/Makefile
index 5bef04909..1d6af55a3 100644
--- a/make/Makefile
+++ b/make/Makefile
@@ -367,7 +367,7 @@ endif
$(EXPORT_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar
$(install-file)
-# Include files (jvmti.h, jvmticmlr.h, jni.h, $(JDK_INCLUDE_SUBDIR)/jni_md.h, jmm.h)
+# Include files (jvmti.h, jvmticmlr.h, jni.h, $(JDK_INCLUDE_SUBDIR)/jni_md.h, jmm.h, jfr.h)
$(EXPORT_INCLUDE_DIR)/%: $(GEN_DIR)/jvmtifiles/%
$(install-file)
@@ -384,6 +384,16 @@ $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h: $(HS_JNI_ARCH_SRC)
$(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/services/%
$(install-file)
+JFR_EXISTS=$(shell if [ -d $(HS_ALT_SRC) ]; then echo 1; else echo 0; fi)
+# export jfr.h
+ifeq ($JFR_EXISTS,1)
+$(EXPORT_INCLUDE_DIR)/%: $(HS_ALT_SRC)/share/vm/jfr/agent/%
+ $(install-file)
+else
+$(EXPORT_INCLUDE_DIR)/jfr.h:
+
+endif
+
# Doc files (jvmti.html)
$(EXPORT_DOCS_DIR)/platform/jvmti/%: $(DOCS_DIR)/%
$(install-file)
diff --git a/make/bsd/makefiles/vm.make b/make/bsd/makefiles/vm.make
index 35eca5dbe..0fad06397 100644
--- a/make/bsd/makefiles/vm.make
+++ b/make/bsd/makefiles/vm.make
@@ -96,6 +96,10 @@ ifdef DEFAULT_LIBPATH
CPPFLAGS += -DDEFAULT_LIBPATH="\"$(DEFAULT_LIBPATH)\""
endif
+ifndef JAVASE_EMBEDDED
+CFLAGS += -DINCLUDE_TRACE
+endif
+
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
CFLAGS += $(CFLAGS_WARN/BYFILE)
@@ -147,6 +151,12 @@ SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
+ifndef JAVASE_EMBEDDED
+SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
+ find $(HS_ALT_SRC)/share/vm/jfr -type d; \
+ fi)
+endif
+
CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
CORE_PATHS+=$(GENERATED)/jvmtifiles
diff --git a/make/defs.make b/make/defs.make
index 7434daebc..3a355c769 100644
--- a/make/defs.make
+++ b/make/defs.make
@@ -294,3 +294,7 @@ EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jvmticmlr.h
EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jni.h
EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h
EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h
+
+ifndef JAVASE_EMBEDDED
+EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jfr.h
+endif
diff --git a/make/hotspot_version b/make/hotspot_version
index 75a0f4c2b..82956ba6a 100644
--- a/make/hotspot_version
+++ b/make/hotspot_version
@@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2011
HS_MAJOR_VER=23
HS_MINOR_VER=0
-HS_BUILD_NUMBER=10
+HS_BUILD_NUMBER=11
JDK_MAJOR_VER=1
JDK_MINOR_VER=8
diff --git a/make/linux/makefiles/vm.make b/make/linux/makefiles/vm.make
index d40678202..fa2bcc3b0 100644
--- a/make/linux/makefiles/vm.make
+++ b/make/linux/makefiles/vm.make
@@ -98,6 +98,10 @@ CPPFLAGS = \
${JRE_VERSION} \
${VM_DISTRO}
+ifndef JAVASE_EMBEDDED
+CFLAGS += -DINCLUDE_TRACE
+endif
+
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
CFLAGS += $(CFLAGS_WARN/BYFILE)
@@ -143,6 +147,12 @@ SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
+ifndef JAVASE_EMBEDDED
+SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
+ find $(HS_ALT_SRC)/share/vm/jfr -type d; \
+ fi)
+endif
+
CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
CORE_PATHS+=$(GENERATED)/jvmtifiles
diff --git a/make/solaris/makefiles/vm.make b/make/solaris/makefiles/vm.make
index 7b950af7f..0895ea0ba 100644
--- a/make/solaris/makefiles/vm.make
+++ b/make/solaris/makefiles/vm.make
@@ -93,7 +93,7 @@ CFLAGS += $(CFLAGS_WARN)
CFLAGS += $(CFLAGS/NOEX)
# Extra flags from gnumake's invocation or environment
-CFLAGS += $(EXTRA_CFLAGS)
+CFLAGS += $(EXTRA_CFLAGS) -DINCLUDE_TRACE
# Math Library (libm.so), do not use -lm.
# There might be two versions of libm.so on the build system:
@@ -160,6 +160,10 @@ SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
+SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
+ find $(HS_ALT_SRC)/share/vm/jfr -type d; \
+ fi)
+
CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
CORE_PATHS+=$(GENERATED)/jvmtifiles
diff --git a/make/windows/build.bat b/make/windows/build.bat
index ee0a6b058..ac63bb2ad 100644
--- a/make/windows/build.bat
+++ b/make/windows/build.bat
@@ -35,6 +35,8 @@ cl 2>&1 | grep "IA-64" >NUL
if %errorlevel% == 0 goto isia64
cl 2>&1 | grep "AMD64" >NUL
if %errorlevel% == 0 goto amd64
+cl 2>&1 | grep "x64" >NUL
+if %errorlevel% == 0 goto amd64
set ARCH=x86
set BUILDARCH=i486
set Platform_arch=x86
diff --git a/make/windows/create_obj_files.sh b/make/windows/create_obj_files.sh
index 59fe3a693..61903387d 100644
--- a/make/windows/create_obj_files.sh
+++ b/make/windows/create_obj_files.sh
@@ -73,6 +73,13 @@ done
BASE_PATHS="${BASE_PATHS} ${GENERATED}/jvmtifiles"
+if [ -d "${ALTSRC}/share/vm/jfr" ]; then
+ BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr/agent"
+ BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr/agent/isolated_deps/util"
+ BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr/jvm"
+ BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr"
+fi
+
CORE_PATHS="${BASE_PATHS}"
# shared is already in BASE_PATHS. Should add vm/memory but that one is also in BASE_PATHS.
if [ -d "${ALTSRC}/share/vm/gc_implementation" ]; then
diff --git a/make/windows/makefiles/projectcreator.make b/make/windows/makefiles/projectcreator.make
index 938ce82e9..3a6f9aa1b 100644
--- a/make/windows/makefiles/projectcreator.make
+++ b/make/windows/makefiles/projectcreator.make
@@ -58,7 +58,8 @@ ProjectCreatorIncludesPRIVATE=\
-absoluteInclude $(HOTSPOTBUILDSPACE)/%f/generated \
-ignorePath $(HOTSPOTBUILDSPACE)/%f/generated \
-ignorePath src\share\vm\adlc \
- -ignorePath src\share\vm\shark
+ -ignorePath src\share\vm\shark \
+ -ignorePath posix
# This is referenced externally by both the IDE and batch builds
ProjectCreatorOptions=
@@ -88,7 +89,7 @@ ProjectCreatorIDEOptions=\
-jdkTargetRoot $(HOTSPOTJDKDIST) \
-define ALIGN_STACK_FRAMES \
-define VM_LITTLE_ENDIAN \
- -prelink "" "Generating vm.def..." "cd $(HOTSPOTBUILDSPACE)\%f\%b set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME) $(HOTSPOTMKSHOME)\sh $(HOTSPOTWORKSPACE)\make\windows\build_vm_def.sh $(LINK_VER)" \
+ -prelink "" "Generating vm.def..." "cd $(HOTSPOTBUILDSPACE)\%f\%b set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME) set JAVA_HOME=$(HOTSPOTJDKDIST) $(HOTSPOTMKSHOME)\sh $(HOTSPOTWORKSPACE)\make\windows\build_vm_def.sh $(LINK_VER)" \
-postbuild "" "Building hotspot.exe..." "cd $(HOTSPOTBUILDSPACE)\%f\%b set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME) nmake -f $(HOTSPOTWORKSPACE)\make\windows\projectfiles\common\Makefile LOCAL_MAKE=$(HOTSPOTBUILDSPACE)\%f\local.make JAVA_HOME=$(HOTSPOTJDKDIST) launcher" \
-ignoreFile jsig.c \
-ignoreFile jvmtiEnvRecommended.cpp \
diff --git a/make/windows/makefiles/vm.make b/make/windows/makefiles/vm.make
index f0b1b9336..d8c43a1f3 100644
--- a/make/windows/makefiles/vm.make
+++ b/make/windows/makefiles/vm.make
@@ -19,7 +19,7 @@
# 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.
-#
+#
#
# Resource file containing VERSIONINFO
@@ -30,7 +30,7 @@ Res_Files=.\version.res
COMMONSRC=$(WorkSpace)\src
ALTSRC=$(WorkSpace)\src\closed
-!ifdef RELEASE
+!ifdef RELEASE
!ifdef DEVELOP
CPP_FLAGS=$(CPP_FLAGS) /D "DEBUG"
!else
@@ -74,6 +74,10 @@ CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_BUILD_TARGET=\"$(BUILD_FLAVOR)\""
CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_BUILD_USER=\"$(BuildUser)\""
CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_VM_DISTRO=\"$(HOTSPOT_VM_DISTRO)\""
+!ifndef JAVASE_EMBEDDED
+CPP_FLAGS=$(CPP_FLAGS) /D "INCLUDE_TRACE"
+!endif
+
CPP_FLAGS=$(CPP_FLAGS) $(CPP_INCLUDE_DIRS)
# Define that so jni.h is on correct side
@@ -97,7 +101,7 @@ AGCT_EXPORT=/export:AsyncGetCallTrace
!endif
# If you modify exports below please do the corresponding changes in
-# src/share/tools/ProjectCreator/WinGammaPlatformVC7.java
+# src/share/tools/ProjectCreator/WinGammaPlatformVC7.java
LINK_FLAGS=$(LINK_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 \
/export:JNI_GetDefaultJavaVMInitArgs \
/export:JNI_CreateJavaVM \
@@ -170,6 +174,7 @@ VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/oops
VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/prims
VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/runtime
VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/services
+VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/trace
VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/utilities
VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/libadt
VM_PATH=$(VM_PATH);$(WorkSpace)/src/os/windows/vm
@@ -177,6 +182,13 @@ VM_PATH=$(VM_PATH);$(WorkSpace)/src/os_cpu/windows_$(Platform_arch)/vm
VM_PATH=$(VM_PATH);$(WorkSpace)/src/cpu/$(Platform_arch)/vm
VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/opto
+!if exists($(ALTSRC)\share\vm\jfr)
+VM_PATH=$(VM_PATH);$(ALTSRC)/share/vm/jfr/agent
+VM_PATH=$(VM_PATH);$(ALTSRC)/share/vm/jfr/agent/isolated_deps/util
+VM_PATH=$(VM_PATH);$(ALTSRC)/share/vm/jfr/jvm
+VM_PATH=$(VM_PATH);$(ALTSRC)/share/vm/jfr
+!endif
+
VM_PATH={$(VM_PATH)}
# Special case files not using precompiled header files.
@@ -263,6 +275,9 @@ bytecodeInterpreterWithChecks.obj: ..\generated\jvmtifiles\bytecodeInterpreterWi
{$(COMMONSRC)\share\vm\services}.cpp.obj::
$(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+{$(COMMONSRC)\share\vm\trace}.cpp.obj::
+ $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
{$(COMMONSRC)\share\vm\utilities}.cpp.obj::
$(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
@@ -340,6 +355,9 @@ bytecodeInterpreterWithChecks.obj: ..\generated\jvmtifiles\bytecodeInterpreterWi
{$(ALTSRC)\share\vm\services}.cpp.obj::
$(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+{$(ALTSRC)\share\vm\trace}.cpp.obj::
+ $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
{$(ALTSRC)\share\vm\utilities}.cpp.obj::
$(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
@@ -371,6 +389,18 @@ bytecodeInterpreterWithChecks.obj: ..\generated\jvmtifiles\bytecodeInterpreterWi
{..\generated\jvmtifiles}.cpp.obj::
$(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+{$(ALTSRC)\share\vm\jfr}.cpp.obj::
+ $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\jfr\agent}.cpp.obj::
+ $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\jfr\agent\isolated_deps\util}.cpp.obj::
+ $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\jfr\jvm}.cpp.obj::
+ $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
default::
_build_pch_file.obj:
diff --git a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
index 96953eebf..565fdee65 100644
--- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
+++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp
@@ -391,7 +391,7 @@ int LIR_Assembler::emit_exception_handler() {
__ call(Runtime1::entry_for(Runtime1::handle_exception_from_callee_id), relocInfo::runtime_call_type);
__ delayed()->nop();
__ should_not_reach_here();
- assert(code_offset() - offset <= exception_handler_size, "overflow");
+ guarantee(code_offset() - offset <= exception_handler_size, "overflow");
__ end_a_stub();
return offset;
@@ -474,8 +474,7 @@ int LIR_Assembler::emit_deopt_handler() {
AddressLiteral deopt_blob(SharedRuntime::deopt_blob()->unpack());
__ JUMP(deopt_blob, G3_scratch, 0); // sethi;jmp
__ delayed()->nop();
- assert(code_offset() - offset <= deopt_handler_size, "overflow");
- debug_only(__ stop("should have gone to the caller");)
+ guarantee(code_offset() - offset <= deopt_handler_size, "overflow");
__ end_a_stub();
return offset;
diff --git a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.hpp b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.hpp
index 386159c89..1fa8e2456 100644
--- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.hpp
+++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.hpp
@@ -69,7 +69,7 @@ enum {
#else
call_stub_size = 20,
#endif // _LP64
- exception_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(10*4),
- deopt_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(10*4) };
+ exception_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(128),
+ deopt_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(64) };
#endif // CPU_SPARC_VM_C1_LIRASSEMBLER_SPARC_HPP
diff --git a/src/cpu/sparc/vm/frame_sparc.inline.hpp b/src/cpu/sparc/vm/frame_sparc.inline.hpp
index 3a8bc79b8..381f235d2 100644
--- a/src/cpu/sparc/vm/frame_sparc.inline.hpp
+++ b/src/cpu/sparc/vm/frame_sparc.inline.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -82,6 +82,8 @@ inline address* frame::O0_addr() const { return (address*) &younger_sp()[ I0->s
inline intptr_t* frame::sender_sp() const { return fp(); }
+inline intptr_t* frame::real_fp() const { return fp(); }
+
// Used only in frame::oopmapreg_to_location
// This return a value in VMRegImpl::slot_size
inline int frame::pd_oop_map_offset_adjustment() const {
diff --git a/src/cpu/sparc/vm/methodHandles_sparc.cpp b/src/cpu/sparc/vm/methodHandles_sparc.cpp
index 5bdf88e53..1627685da 100644
--- a/src/cpu/sparc/vm/methodHandles_sparc.cpp
+++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp
@@ -1045,7 +1045,7 @@ int MethodHandles::adapter_conversion_ops_supported_mask() {
|(1<<java_lang_invoke_AdapterMethodHandle::OP_DROP_ARGS)
// OP_COLLECT_ARGS is below...
|(1<<java_lang_invoke_AdapterMethodHandle::OP_SPREAD_ARGS)
- |(!UseRicochetFrames ? 0 :
+ |(
java_lang_invoke_MethodTypeForm::vmlayout_offset_in_bytes() <= 0 ? 0 :
((1<<java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF)
|(1<<java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS)
diff --git a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
index 3c24feb72..c745ade29 100644
--- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
+++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
@@ -406,7 +406,7 @@ int LIR_Assembler::emit_exception_handler() {
// search an exception handler (rax: exception oop, rdx: throwing pc)
__ call(RuntimeAddress(Runtime1::entry_for(Runtime1::handle_exception_from_callee_id)));
__ should_not_reach_here();
- assert(code_offset() - offset <= exception_handler_size, "overflow");
+ guarantee(code_offset() - offset <= exception_handler_size, "overflow");
__ end_a_stub();
return offset;
@@ -490,8 +490,7 @@ int LIR_Assembler::emit_deopt_handler() {
__ pushptr(here.addr());
__ jump(RuntimeAddress(SharedRuntime::deopt_blob()->unpack()));
-
- assert(code_offset() - offset <= deopt_handler_size, "overflow");
+ guarantee(code_offset() - offset <= deopt_handler_size, "overflow");
__ end_a_stub();
return offset;
diff --git a/src/cpu/x86/vm/frame_x86.cpp b/src/cpu/x86/vm/frame_x86.cpp
index 5d4da6260..94166ea0f 100644
--- a/src/cpu/x86/vm/frame_x86.cpp
+++ b/src/cpu/x86/vm/frame_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -675,3 +675,21 @@ intptr_t *frame::initial_deoptimization_info() {
// used to reset the saved FP
return fp();
}
+
+intptr_t* frame::real_fp() const {
+ if (_cb != NULL) {
+ // use the frame size if valid
+ int size = _cb->frame_size();
+ if ((size > 0) &&
+ (! is_ricochet_frame())) {
+ // Work-around: ricochet explicitly excluded because frame size is not
+ // constant for the ricochet blob but its frame_size could not, for
+ // some reasons, be declared as <= 0. This potentially confusing
+ // size declaration should be fixed as another CR.
+ return unextended_sp() + size;
+ }
+ }
+ // else rely on fp()
+ assert(! is_compiled_frame(), "unknown compiled frame size");
+ return fp();
+}
diff --git a/src/cpu/x86/vm/frame_x86.hpp b/src/cpu/x86/vm/frame_x86.hpp
index a307a3404..01f6e6cc8 100644
--- a/src/cpu/x86/vm/frame_x86.hpp
+++ b/src/cpu/x86/vm/frame_x86.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -188,6 +188,7 @@
frame(intptr_t* sp, intptr_t* fp);
// accessors for the instance variables
+ // Note: not necessarily the real 'frame pointer' (see real_fp)
intptr_t* fp() const { return _fp; }
inline address* sender_pc_addr() const;
diff --git a/src/cpu/x86/vm/methodHandles_x86.cpp b/src/cpu/x86/vm/methodHandles_x86.cpp
index 7d987e588..acd65fb94 100644
--- a/src/cpu/x86/vm/methodHandles_x86.cpp
+++ b/src/cpu/x86/vm/methodHandles_x86.cpp
@@ -1005,7 +1005,7 @@ void trace_method_handle_stub(const char* adaptername,
intptr_t* base_sp = last_sp;
typedef MethodHandles::RicochetFrame RicochetFrame;
RicochetFrame* rfp = (RicochetFrame*)((address)saved_bp - RicochetFrame::sender_link_offset_in_bytes());
- if (!UseRicochetFrames || Universe::heap()->is_in((address) rfp->saved_args_base())) {
+ if (Universe::heap()->is_in((address) rfp->saved_args_base())) {
// Probably an interpreter frame.
base_sp = (intptr_t*) saved_bp[frame::interpreter_frame_monitor_block_top_offset];
}
@@ -1104,7 +1104,7 @@ int MethodHandles::adapter_conversion_ops_supported_mask() {
|(1<<java_lang_invoke_AdapterMethodHandle::OP_DROP_ARGS)
//OP_COLLECT_ARGS is below...
|(1<<java_lang_invoke_AdapterMethodHandle::OP_SPREAD_ARGS)
- |(!UseRicochetFrames ? 0 :
+ |(
java_lang_invoke_MethodTypeForm::vmlayout_offset_in_bytes() <= 0 ? 0 :
((1<<java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF)
|(1<<java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS)
diff --git a/src/cpu/zero/vm/frame_zero.inline.hpp b/src/cpu/zero/vm/frame_zero.inline.hpp
index 9ad237de9..d4c272b11 100644
--- a/src/cpu/zero/vm/frame_zero.inline.hpp
+++ b/src/cpu/zero/vm/frame_zero.inline.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -72,6 +72,10 @@ inline intptr_t* frame::sender_sp() const {
return fp() + 1;
}
+inline intptr_t* frame::real_fp() const {
+ return fp();
+}
+
inline intptr_t* frame::link() const {
ShouldNotCallThis();
}
diff --git a/src/cpu/zero/vm/methodHandles_zero.hpp b/src/cpu/zero/vm/methodHandles_zero.hpp
index 84da09947..086f3375f 100644
--- a/src/cpu/zero/vm/methodHandles_zero.hpp
+++ b/src/cpu/zero/vm/methodHandles_zero.hpp
@@ -29,43 +29,3 @@ enum /* platform_dependent_constants */ {
adapter_code_size = 0
};
-#define TARGET_ARCH_NYI_6939861 1
-// ..#ifdef TARGET_ARCH_NYI_6939861
-// .. // Here are some backward compatible declarations until the 6939861 ports are updated.
-// .. #define _adapter_flyby (_EK_LIMIT + 10)
-// .. #define _adapter_ricochet (_EK_LIMIT + 11)
-// .. #define _adapter_opt_spread_1 _adapter_opt_spread_1_ref
-// .. #define _adapter_opt_spread_more _adapter_opt_spread_ref
-// .. enum {
-// .. _INSERT_NO_MASK = -1,
-// .. _INSERT_REF_MASK = 0,
-// .. _INSERT_INT_MASK = 1,
-// .. _INSERT_LONG_MASK = 3
-// .. };
-// .. static void get_ek_bound_mh_info(EntryKind ek, BasicType& arg_type, int& arg_mask, int& arg_slots) {
-// .. arg_type = ek_bound_mh_arg_type(ek);
-// .. arg_mask = 0;
-// .. arg_slots = type2size[arg_type];;
-// .. }
-// .. static void get_ek_adapter_opt_swap_rot_info(EntryKind ek, int& swap_bytes, int& rotate) {
-// .. int swap_slots = ek_adapter_opt_swap_slots(ek);
-// .. rotate = ek_adapter_opt_swap_mode(ek);
-// .. swap_bytes = swap_slots * Interpreter::stackElementSize;
-// .. }
-// .. static int get_ek_adapter_opt_spread_info(EntryKind ek) {
-// .. return ek_adapter_opt_spread_count(ek);
-// .. }
-// ..
-// .. static void insert_arg_slots(MacroAssembler* _masm,
-// .. RegisterOrConstant arg_slots,
-// .. int arg_mask,
-// .. Register argslot_reg,
-// .. Register temp_reg, Register temp2_reg, Register temp3_reg = noreg);
-// ..
-// .. static void remove_arg_slots(MacroAssembler* _masm,
-// .. RegisterOrConstant arg_slots,
-// .. Register argslot_reg,
-// .. Register temp_reg, Register temp2_reg, Register temp3_reg = noreg);
-// ..
-// .. static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN;
-// ..#endif //TARGET_ARCH_NYI_6939861
diff --git a/src/os/bsd/vm/decoder_machO.cpp b/src/os/bsd/vm/decoder_machO.cpp
new file mode 100644
index 000000000..d77a32f7e
--- /dev/null
+++ b/src/os/bsd/vm/decoder_machO.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ */
+
+#include "precompiled.hpp"
+
+#ifdef __APPLE__
+#include "decoder_machO.hpp"
+#endif
+
+
diff --git a/src/os/bsd/vm/decoder_bsd.cpp b/src/os/bsd/vm/decoder_machO.hpp
index dd959298f..48d0a9b98 100644
--- a/src/os/bsd/vm/decoder_bsd.cpp
+++ b/src/os/bsd/vm/decoder_machO.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -22,45 +22,21 @@
*
*/
-#include "prims/jvm.h"
-#include "utilities/decoder.hpp"
-
-#include <cxxabi.h>
+#ifndef OS_BSD_VM_DECODER_MACHO_HPP
+#define OS_BSD_VM_DECODER_MACHO_HPP
#ifdef __APPLE__
-void Decoder::initialize() {
- _initialized = true;
-}
-
-void Decoder::uninitialize() {
- _initialized = false;
-}
-
-bool Decoder::can_decode_C_frame_in_vm() {
- return false;
-}
-
-Decoder::decoder_status Decoder::decode(address addr, const char* filepath, char *buf, int buflen, int *offset) {
- return symbol_not_found;
-}
+#include "utilities/decoder.hpp"
+// Just a placehold for now
+class MachODecoder: public NullDecoder {
+public:
+ MachODecoder() { }
+ ~MachODecoder() { }
+};
#endif
-bool Decoder::demangle(const char* symbol, char *buf, int buflen) {
- int status;
- char* result;
- size_t size = (size_t)buflen;
+#endif // OS_BSD_VM_DECODER_MACHO_HPP
- // 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;
-}
diff --git a/src/os/bsd/vm/os_bsd.cpp b/src/os/bsd/vm/os_bsd.cpp
index c6e27b273..2526e65f2 100644
--- a/src/os/bsd/vm/os_bsd.cpp
+++ b/src/os/bsd/vm/os_bsd.cpp
@@ -1920,7 +1920,7 @@ bool os::dll_address_to_function_name(address addr, char *buf,
return true;
} else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
- dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) {
+ buf, buflen, offset, dlinfo.dli_fname)) {
return true;
}
}
diff --git a/src/os/linux/vm/decoder_linux.cpp b/src/os/linux/vm/decoder_linux.cpp
index 88da33b65..e46239694 100644
--- a/src/os/linux/vm/decoder_linux.cpp
+++ b/src/os/linux/vm/decoder_linux.cpp
@@ -23,11 +23,11 @@
*/
#include "prims/jvm.h"
-#include "utilities/decoder.hpp"
+#include "utilities/decoder_elf.hpp"
#include <cxxabi.h>
-bool Decoder::demangle(const char* symbol, char *buf, int buflen) {
+bool ElfDecoder::demangle(const char* symbol, char *buf, int buflen) {
int status;
char* result;
size_t size = (size_t)buflen;
@@ -43,3 +43,4 @@ bool Decoder::demangle(const char* symbol, char *buf, int buflen) {
}
return false;
}
+
diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp
index 0946b753e..f2e198813 100644
--- a/src/os/linux/vm/os_linux.cpp
+++ b/src/os/linux/vm/os_linux.cpp
@@ -1732,7 +1732,7 @@ bool os::dll_address_to_function_name(address addr, char *buf,
return true;
} else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
- dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) {
+ buf, buflen, offset, dlinfo.dli_fname)) {
return true;
}
}
diff --git a/src/os/solaris/vm/decoder_solaris.cpp b/src/os/solaris/vm/decoder_solaris.cpp
index a7b4b51fb..d700706a0 100644
--- a/src/os/solaris/vm/decoder_solaris.cpp
+++ b/src/os/solaris/vm/decoder_solaris.cpp
@@ -22,10 +22,11 @@
*
*/
-#include "utilities/decoder.hpp"
+#include "utilities/decoder_elf.hpp"
#include <demangle.h>
-bool Decoder::demangle(const char* symbol, char *buf, int buflen) {
+bool ElfDecoder::demangle(const char* symbol, char *buf, int buflen) {
return !cplus_demangle(symbol, buf, (size_t)buflen);
}
+
diff --git a/src/os/solaris/vm/os_solaris.cpp b/src/os/solaris/vm/os_solaris.cpp
index 925152c3b..939ef4229 100644
--- a/src/os/solaris/vm/os_solaris.cpp
+++ b/src/os/solaris/vm/os_solaris.cpp
@@ -1997,7 +1997,7 @@ bool os::dll_address_to_function_name(address addr, char *buf,
}
if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
- dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) {
+ buf, buflen, offset, dlinfo.dli_fname)) {
return true;
}
}
@@ -2015,7 +2015,7 @@ bool os::dll_address_to_function_name(address addr, char *buf,
return true;
} else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
- dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) {
+ buf, buflen, offset, dlinfo.dli_fname)) {
return true;
}
}
diff --git a/src/os/windows/vm/decoder_windows.cpp b/src/os/windows/vm/decoder_windows.cpp
index 942f3ec20..847e23108 100644
--- a/src/os/windows/vm/decoder_windows.cpp
+++ b/src/os/windows/vm/decoder_windows.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -24,22 +24,24 @@
#include "precompiled.hpp"
#include "prims/jvm.h"
-#include "runtime/os.hpp"
-#include "utilities/decoder.hpp"
+#include "decoder_windows.hpp"
-HMODULE Decoder::_dbghelp_handle = NULL;
-bool Decoder::_can_decode_in_vm = false;
-pfn_SymGetSymFromAddr64 Decoder::_pfnSymGetSymFromAddr64 = NULL;
-pfn_UndecorateSymbolName Decoder::_pfnUndecorateSymbolName = NULL;
+WindowsDecoder::WindowsDecoder() {
+ _dbghelp_handle = NULL;
+ _can_decode_in_vm = false;
+ _pfnSymGetSymFromAddr64 = NULL;
+ _pfnUndecorateSymbolName = NULL;
-void Decoder::initialize() {
- if (!_initialized) {
- _initialized = true;
+ _decoder_status = no_error;
+ initialize();
+}
- HINSTANCE handle = os::win32::load_Windows_dll("dbghelp.dll", NULL, 0);
+void WindowsDecoder::initialize() {
+ if (!has_error() && _dbghelp_handle == NULL) {
+ HMODULE handle = ::LoadLibrary("dbghelp.dll");
if (!handle) {
_decoder_status = helper_not_found;
- return;
+ return;
}
_dbghelp_handle = handle;
@@ -70,32 +72,29 @@ void Decoder::initialize() {
// find out if jvm.dll contains private symbols, by decoding
// current function and comparing the result
- address addr = (address)Decoder::initialize;
+ address addr = (address)Decoder::decode;
char buf[MAX_PATH];
- if (decode(addr, buf, sizeof(buf), NULL) == no_error) {
- _can_decode_in_vm = !strcmp(buf, "Decoder::initialize");
+ if (decode(addr, buf, sizeof(buf), NULL)) {
+ _can_decode_in_vm = !strcmp(buf, "Decoder::decode");
}
}
}
-void Decoder::uninitialize() {
- assert(_initialized, "Decoder not yet initialized");
+void WindowsDecoder::uninitialize() {
_pfnSymGetSymFromAddr64 = NULL;
_pfnUndecorateSymbolName = NULL;
if (_dbghelp_handle != NULL) {
::FreeLibrary(_dbghelp_handle);
}
- _initialized = false;
+ _dbghelp_handle = NULL;
}
-bool Decoder::can_decode_C_frame_in_vm() {
- initialize();
- return _can_decode_in_vm;
+bool WindowsDecoder::can_decode_C_frame_in_vm() const {
+ return (!has_error() && _can_decode_in_vm);
}
-Decoder::decoder_status Decoder::decode(address addr, char *buf, int buflen, int *offset) {
- assert(_initialized, "Decoder not yet initialized");
+bool WindowsDecoder::decode(address addr, char *buf, int buflen, int* offset, const char* modulepath) {
if (_pfnSymGetSymFromAddr64 != NULL) {
PIMAGEHLP_SYMBOL64 pSymbol;
char symbolInfo[MAX_PATH + sizeof(IMAGEHLP_SYMBOL64)];
@@ -105,19 +104,20 @@ Decoder::decoder_status Decoder::decode(address addr, char *buf, int buflen, int
DWORD64 displacement;
if (_pfnSymGetSymFromAddr64(::GetCurrentProcess(), (DWORD64)addr, &displacement, pSymbol)) {
if (buf != NULL) {
- if (!demangle(pSymbol->Name, buf, buflen)) {
+ if (demangle(pSymbol->Name, buf, buflen)) {
jio_snprintf(buf, buflen, "%s", pSymbol->Name);
}
}
- if (offset != NULL) *offset = (int)displacement;
- return no_error;
+ if(offset != NULL) *offset = (int)displacement;
+ return true;
}
}
- return helper_not_found;
+ if (buf != NULL && buflen > 0) buf[0] = '\0';
+ if (offset != NULL) *offset = -1;
+ return false;
}
-bool Decoder::demangle(const char* symbol, char *buf, int buflen) {
- assert(_initialized, "Decoder not yet initialized");
+bool WindowsDecoder::demangle(const char* symbol, char *buf, int buflen) {
return _pfnUndecorateSymbolName != NULL &&
_pfnUndecorateSymbolName(symbol, buf, buflen, UNDNAME_COMPLETE);
}
diff --git a/src/os/windows/vm/decoder_windows.hpp b/src/os/windows/vm/decoder_windows.hpp
new file mode 100644
index 000000000..8ba488fc5
--- /dev/null
+++ b/src/os/windows/vm/decoder_windows.hpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ */
+
+#ifndef OS_WINDOWS_VM_DECODER_WINDOWS_HPP
+#define OS_WINDOWS_VM_DECIDER_WINDOWS_HPP
+
+#include <windows.h>
+#include <imagehlp.h>
+
+#include "utilities/decoder.hpp"
+
+// functions needed for decoding symbols
+typedef DWORD (WINAPI *pfn_SymSetOptions)(DWORD);
+typedef BOOL (WINAPI *pfn_SymInitialize)(HANDLE, PCTSTR, BOOL);
+typedef BOOL (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
+typedef DWORD (WINAPI *pfn_UndecorateSymbolName)(const char*, char*, DWORD, DWORD);
+
+class WindowsDecoder: public NullDecoder {
+
+public:
+ WindowsDecoder();
+ ~WindowsDecoder() { uninitialize(); };
+
+ 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);
+
+private:
+ void initialize();
+ void uninitialize();
+
+private:
+ HMODULE _dbghelp_handle;
+ bool _can_decode_in_vm;
+ pfn_SymGetSymFromAddr64 _pfnSymGetSymFromAddr64;
+ pfn_UndecorateSymbolName _pfnUndecorateSymbolName;
+};
+
+#endif // OS_WINDOWS_VM_DECODER_WINDOWS_HPP
+
diff --git a/src/os/windows/vm/os_windows.cpp b/src/os/windows/vm/os_windows.cpp
index 889faf540..56d51b6d6 100644
--- a/src/os/windows/vm/os_windows.cpp
+++ b/src/os/windows/vm/os_windows.cpp
@@ -1391,7 +1391,7 @@ bool os::dll_address_to_library_name(address addr, char* buf,
bool os::dll_address_to_function_name(address addr, char *buf,
int buflen, int *offset) {
- if (Decoder::decode(addr, buf, buflen, offset) == Decoder::no_error) {
+ if (Decoder::decode(addr, buf, buflen, offset)) {
return true;
}
if (offset != NULL) *offset = -1;
diff --git a/src/share/vm/classfile/symbolTable.cpp b/src/share/vm/classfile/symbolTable.cpp
index e3dd08629..4dcdc5338 100644
--- a/src/share/vm/classfile/symbolTable.cpp
+++ b/src/share/vm/classfile/symbolTable.cpp
@@ -204,6 +204,24 @@ Symbol* SymbolTable::lookup_only(const char* name, int len,
return s;
}
+// Look up the address of the literal in the SymbolTable for this Symbol*
+// Do not create any new symbols
+// Do not increment the reference count to keep this alive
+Symbol** SymbolTable::lookup_symbol_addr(Symbol* sym){
+ unsigned int hash = hash_symbol((char*)sym->bytes(), sym->utf8_length());
+ int index = the_table()->hash_to_index(hash);
+
+ for (HashtableEntry<Symbol*>* e = the_table()->bucket(index); e != NULL; e = e->next()) {
+ if (e->hash() == hash) {
+ Symbol* literal_sym = e->literal();
+ if (sym == literal_sym) {
+ return e->literal_addr();
+ }
+ }
+ }
+ return NULL;
+}
+
// Suggestion: Push unicode-based lookup all the way into the hashing
// and probing logic, so there is no need for convert_to_utf8 until
// an actual new Symbol* is created.
diff --git a/src/share/vm/classfile/symbolTable.hpp b/src/share/vm/classfile/symbolTable.hpp
index ca0b07d78..be74fab49 100644
--- a/src/share/vm/classfile/symbolTable.hpp
+++ b/src/share/vm/classfile/symbolTable.hpp
@@ -144,6 +144,9 @@ public:
static void release(Symbol* sym);
+ // Look up the address of the literal in the SymbolTable for this Symbol*
+ static Symbol** lookup_symbol_addr(Symbol* sym);
+
// jchar (utf16) version of lookups
static Symbol* lookup_unicode(const jchar* name, int len, TRAPS);
static Symbol* lookup_only_unicode(const jchar* name, int len, unsigned int& hash);
diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp
index 1591b795f..88ccc91b7 100644
--- a/src/share/vm/classfile/systemDictionary.cpp
+++ b/src/share/vm/classfile/systemDictionary.cpp
@@ -2131,6 +2131,12 @@ void SystemDictionary::update_dictionary(int d_index, unsigned int d_hash,
}
}
+ // Assign a classid if one has not already been assigned. The
+ // counter does not need to be atomically incremented since this
+ // is only done while holding the SystemDictionary_lock.
+ // All loaded classes get a unique ID.
+ TRACE_INIT_ID(k);
+
// Check for a placeholder. If there, remove it and make a
// new system dictionary entry.
placeholders()->find_and_remove(p_index, p_hash, name, class_loader, THREAD);
diff --git a/src/share/vm/oops/klass.cpp b/src/share/vm/oops/klass.cpp
index 39cb26ebb..e2997eaac 100644
--- a/src/share/vm/oops/klass.cpp
+++ b/src/share/vm/oops/klass.cpp
@@ -158,6 +158,9 @@ klassOop Klass::base_create_klass_oop(KlassHandle& klass, int size,
kl->set_next_sibling(NULL);
kl->set_alloc_count(0);
kl->set_alloc_size(0);
+#ifdef TRACE_SET_KLASS_TRACE_ID
+ TRACE_SET_KLASS_TRACE_ID(kl, 0);
+#endif
kl->set_prototype_header(markOopDesc::prototype());
kl->set_biased_lock_revocation_count(0);
diff --git a/src/share/vm/oops/klass.hpp b/src/share/vm/oops/klass.hpp
index ae727d9ec..d4f5d504f 100644
--- a/src/share/vm/oops/klass.hpp
+++ b/src/share/vm/oops/klass.hpp
@@ -33,6 +33,7 @@
#include "oops/klassPS.hpp"
#include "oops/oop.hpp"
#include "runtime/orderAccess.hpp"
+#include "trace/traceMacros.hpp"
#include "utilities/accessFlags.hpp"
#ifndef SERIALGC
#include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp"
@@ -80,6 +81,7 @@
// [last_biased_lock_bulk_revocation_time] (64 bits)
// [prototype_header]
// [biased_lock_revocation_count]
+// [trace_id]
// Forward declarations.
@@ -263,6 +265,9 @@ class Klass : public Klass_vtbl {
markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type
jint _biased_lock_revocation_count;
+#ifdef TRACE_DEFINE_KLASS_TRACE_ID
+ TRACE_DEFINE_KLASS_TRACE_ID;
+#endif
public:
// returns the enclosing klassOop
@@ -683,6 +688,9 @@ class Klass : public Klass_vtbl {
jlong last_biased_lock_bulk_revocation_time() { return _last_biased_lock_bulk_revocation_time; }
void set_last_biased_lock_bulk_revocation_time(jlong cur_time) { _last_biased_lock_bulk_revocation_time = cur_time; }
+#ifdef TRACE_DEFINE_KLASS_METHODS
+ TRACE_DEFINE_KLASS_METHODS;
+#endif
// garbage collection support
virtual void follow_weak_klass_links(
diff --git a/src/share/vm/oops/methodKlass.cpp b/src/share/vm/oops/methodKlass.cpp
index f8d15108e..b2d62358d 100644
--- a/src/share/vm/oops/methodKlass.cpp
+++ b/src/share/vm/oops/methodKlass.cpp
@@ -83,6 +83,7 @@ methodOop methodKlass::allocate(constMethodHandle xconst,
m->set_max_stack(0);
m->set_max_locals(0);
m->set_intrinsic_id(vmIntrinsics::_none);
+ m->set_jfr_towrite(false);
m->set_method_data(NULL);
m->set_interpreter_throwout_count(0);
m->set_vtable_index(methodOopDesc::garbage_vtable_index);
diff --git a/src/share/vm/oops/methodOop.hpp b/src/share/vm/oops/methodOop.hpp
index e8e73c631..cc9520a7f 100644
--- a/src/share/vm/oops/methodOop.hpp
+++ b/src/share/vm/oops/methodOop.hpp
@@ -77,7 +77,7 @@
// | method_size | max_stack |
// | max_locals | size_of_parameters |
// |------------------------------------------------------|
-// | intrinsic_id, (unused) | throwout_count |
+// |intrinsic_id| flags | throwout_count |
// |------------------------------------------------------|
// | num_breakpoints | (unused) |
// |------------------------------------------------------|
@@ -124,6 +124,8 @@ class methodOopDesc : public oopDesc {
u2 _max_locals; // Number of local variables used by this method
u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words
u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
+ u1 _jfr_towrite : 1, // Flags
+ : 7;
u2 _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
u2 _number_of_breakpoints; // fullspeed debugging support
InvocationCounter _invocation_counter; // Incremented before each activation of the method - used to trigger frequency-based optimizations
@@ -225,6 +227,7 @@ class methodOopDesc : public oopDesc {
void clear_number_of_breakpoints() { _number_of_breakpoints = 0; }
// index into instanceKlass methods() array
+ // note: also used by jfr
u2 method_idnum() const { return constMethod()->method_idnum(); }
void set_method_idnum(u2 idnum) { constMethod()->set_method_idnum(idnum); }
@@ -650,6 +653,9 @@ class methodOopDesc : public oopDesc {
void init_intrinsic_id(); // updates from _none if a match
static vmSymbols::SID klass_id_for_intrinsics(klassOop holder);
+ bool jfr_towrite() { return _jfr_towrite; }
+ void set_jfr_towrite(bool towrite) { _jfr_towrite = towrite; }
+
// On-stack replacement support
bool has_osr_nmethod(int level, bool match_level) {
return instanceKlass::cast(method_holder())->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL;
diff --git a/src/share/vm/prims/jni.cpp b/src/share/vm/prims/jni.cpp
index fc35714bb..833f6f181 100644
--- a/src/share/vm/prims/jni.cpp
+++ b/src/share/vm/prims/jni.cpp
@@ -48,6 +48,7 @@
#include "oops/typeArrayOop.hpp"
#include "prims/jni.h"
#include "prims/jniCheck.hpp"
+#include "prims/jniExport.hpp"
#include "prims/jniFastGetField.hpp"
#include "prims/jvm.h"
#include "prims/jvm_misc.hpp"
@@ -66,6 +67,8 @@
#include "runtime/signature.hpp"
#include "runtime/vm_operations.hpp"
#include "services/runtimeService.hpp"
+#include "trace/tracing.hpp"
+#include "trace/traceEventTypes.hpp"
#include "utilities/defaultStream.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/events.hpp"
@@ -5139,6 +5142,11 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_CreateJavaVM(JavaVM **vm, void **penv, v
if (JvmtiExport::should_post_thread_life()) {
JvmtiExport::post_thread_start(thread);
}
+
+ EVENT_BEGIN(TraceEventThreadStart, event);
+ EVENT_COMMIT(event,
+ EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj())));
+
// Check if we should compile all classes on bootclasspath
NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();)
// Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
@@ -5337,6 +5345,10 @@ static jint attach_current_thread(JavaVM *vm, void **penv, void *_args, bool dae
JvmtiExport::post_thread_start(thread);
}
+ EVENT_BEGIN(TraceEventThreadStart, event);
+ EVENT_COMMIT(event,
+ EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj())));
+
*(JNIEnv**)penv = thread->jni_environment();
// Now leaving the VM, so change thread_state. This is normally automatically taken care
@@ -5464,8 +5476,7 @@ jint JNICALL jni_GetEnv(JavaVM *vm, void **penv, jint version) {
return ret;
}
- if (JvmtiExport::is_jvmti_version(version)) {
- ret = JvmtiExport::get_jvmti_interface(vm, penv, version);
+ if (JniExportedInterface::GetExportedInterface(vm, penv, version, &ret)) {
return ret;
}
diff --git a/src/share/vm/prims/jniExport.hpp b/src/share/vm/prims/jniExport.hpp
new file mode 100644
index 000000000..841b3dc5c
--- /dev/null
+++ b/src/share/vm/prims/jniExport.hpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 1997, 2011, 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.
+ *
+ */
+
+#ifndef SHARE_VM_PRIMS_JNI_EXPORT_HPP
+#define SHARE_VM_PRIMS_JNI_EXPORT_HPP
+
+#include "prims/jni.h"
+#include "prims/jvmtiExport.hpp"
+
+class JniExportedInterface {
+ public:
+ static bool GetExportedInterface(JavaVM* vm, void** penv, jint version, jint* iface) {
+ if (JvmtiExport::is_jvmti_version(version)) {
+ *iface = JvmtiExport::get_jvmti_interface(vm, penv, version);
+ return true;
+ }
+ return false;
+ }
+};
+
+#endif // SHARE_VM_PRIMS_JNI_EXPORT_HPP
diff --git a/src/share/vm/prims/methodHandles.cpp b/src/share/vm/prims/methodHandles.cpp
index d43cb97ae..552fbe6a8 100644
--- a/src/share/vm/prims/methodHandles.cpp
+++ b/src/share/vm/prims/methodHandles.cpp
@@ -194,9 +194,6 @@ bool MethodHandles::spot_check_entry_names() {
// MethodHandles::generate_adapters
//
void MethodHandles::generate_adapters() {
-#ifdef TARGET_ARCH_NYI_6939861
- if (FLAG_IS_DEFAULT(UseRicochetFrames)) UseRicochetFrames = false;
-#endif
if (!EnableInvokeDynamic || SystemDictionary::MethodHandle_klass() == NULL) return;
assert(_adapter_code == NULL, "generate only once");
@@ -230,18 +227,6 @@ void MethodHandlesAdapterGenerator::generate() {
}
-#ifdef TARGET_ARCH_NYI_6939861
-// these defs belong in methodHandles_<arch>.cpp
-frame MethodHandles::ricochet_frame_sender(const frame& fr, RegisterMap *map) {
- ShouldNotCallThis();
- return fr;
-}
-void MethodHandles::ricochet_frame_oops_do(const frame& fr, OopClosure* f, const RegisterMap* reg_map) {
- ShouldNotCallThis();
-}
-#endif //TARGET_ARCH_NYI_6939861
-
-
//------------------------------------------------------------------------------
// MethodHandles::ek_supported
//
@@ -251,28 +236,11 @@ bool MethodHandles::ek_supported(MethodHandles::EntryKind ek) {
case _adapter_unused_13:
return false; // not defined yet
case _adapter_prim_to_ref:
- return UseRicochetFrames && conv_op_supported(java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF);
+ return conv_op_supported(java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF);
case _adapter_collect_args:
- return UseRicochetFrames && conv_op_supported(java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS);
+ return conv_op_supported(java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS);
case _adapter_fold_args:
- return UseRicochetFrames && conv_op_supported(java_lang_invoke_AdapterMethodHandle::OP_FOLD_ARGS);
- case _adapter_opt_return_any:
- return UseRicochetFrames;
-#ifdef TARGET_ARCH_NYI_6939861
- // ports before 6939861 supported only three kinds of spread ops
- case _adapter_spread_args:
- // restrict spreads to three kinds:
- switch (ek) {
- case _adapter_opt_spread_0:
- case _adapter_opt_spread_1:
- case _adapter_opt_spread_more:
- break;
- default:
- return false;
- break;
- }
- break;
-#endif //TARGET_ARCH_NYI_6939861
+ return conv_op_supported(java_lang_invoke_AdapterMethodHandle::OP_FOLD_ARGS);
}
return true;
}
@@ -1988,9 +1956,6 @@ void MethodHandles::verify_AdapterMethodHandle(Handle mh, int argnum, TRAPS) {
case _adapter_prim_to_ref: // boxer MH to use
case _adapter_collect_args: // method handle which collects the args
case _adapter_fold_args: // method handle which collects the args
- if (!UseRicochetFrames) {
- { err = "box/collect/fold operators are not supported"; break; }
- }
if (!java_lang_invoke_MethodHandle::is_instance(argument()))
{ err = "MethodHandle adapter argument required"; break; }
arg_mtype = Handle(THREAD, java_lang_invoke_MethodHandle::type(argument()));
@@ -2370,7 +2335,6 @@ void MethodHandles::init_AdapterMethodHandle(Handle mh, Handle target, int argnu
case _adapter_prim_to_ref:
{
- assert(UseRicochetFrames, "else don't come here");
// vminfo will be the location to insert the return value
vminfo = argslot;
ek_opt = _adapter_opt_collect_ref;
@@ -2436,20 +2400,6 @@ void MethodHandles::init_AdapterMethodHandle(Handle mh, Handle target, int argnu
case _adapter_spread_args:
{
-#ifdef TARGET_ARCH_NYI_6939861
- // ports before 6939861 supported only three kinds of spread ops
- if (!UseRicochetFrames) {
- int array_size = slots_pushed + 1;
- assert(array_size >= 0, "");
- vminfo = array_size;
- switch (array_size) {
- case 0: ek_opt = _adapter_opt_spread_0; break;
- case 1: ek_opt = _adapter_opt_spread_1; break;
- default: ek_opt = _adapter_opt_spread_more; break;
- }
- break;
- }
-#endif //TARGET_ARCH_NYI_6939861
// vminfo will be the required length of the array
int array_size = (slots_pushed + 1) / (type2size[dest] == 2 ? 2 : 1);
vminfo = array_size;
@@ -2494,7 +2444,6 @@ void MethodHandles::init_AdapterMethodHandle(Handle mh, Handle target, int argnu
case _adapter_collect_args:
{
- assert(UseRicochetFrames, "else don't come here");
int elem_slots = argument_slot_count(java_lang_invoke_MethodHandle::type(argument()));
// vminfo will be the location to insert the return value
vminfo = argslot;
@@ -2563,7 +2512,6 @@ void MethodHandles::init_AdapterMethodHandle(Handle mh, Handle target, int argnu
case _adapter_fold_args:
{
- assert(UseRicochetFrames, "else don't come here");
int elem_slots = argument_slot_count(java_lang_invoke_MethodHandle::type(argument()));
// vminfo will be the location to insert the return value
vminfo = argslot + elem_slots;
diff --git a/src/share/vm/prims/methodHandles.hpp b/src/share/vm/prims/methodHandles.hpp
index f1c44ba7b..514ba6aa9 100644
--- a/src/share/vm/prims/methodHandles.hpp
+++ b/src/share/vm/prims/methodHandles.hpp
@@ -738,46 +738,6 @@ public:
#ifdef TARGET_ARCH_ppc
# include "methodHandles_ppc.hpp"
#endif
-
-#ifdef TARGET_ARCH_NYI_6939861
- // Here are some backward compatible declarations until the 6939861 ports are updated.
- #define _adapter_flyby (_EK_LIMIT + 10)
- #define _adapter_ricochet (_EK_LIMIT + 11)
- #define _adapter_opt_spread_1 _adapter_opt_spread_1_ref
- #define _adapter_opt_spread_more _adapter_opt_spread_ref
- enum {
- _INSERT_NO_MASK = -1,
- _INSERT_REF_MASK = 0,
- _INSERT_INT_MASK = 1,
- _INSERT_LONG_MASK = 3
- };
- static void get_ek_bound_mh_info(EntryKind ek, BasicType& arg_type, int& arg_mask, int& arg_slots) {
- arg_type = ek_bound_mh_arg_type(ek);
- arg_mask = 0;
- arg_slots = type2size[arg_type];;
- }
- static void get_ek_adapter_opt_swap_rot_info(EntryKind ek, int& swap_bytes, int& rotate) {
- int swap_slots = ek_adapter_opt_swap_slots(ek);
- rotate = ek_adapter_opt_swap_mode(ek);
- swap_bytes = swap_slots * Interpreter::stackElementSize;
- }
- static int get_ek_adapter_opt_spread_info(EntryKind ek) {
- return ek_adapter_opt_spread_count(ek);
- }
-
- static void insert_arg_slots(MacroAssembler* _masm,
- RegisterOrConstant arg_slots,
- int arg_mask,
- Register argslot_reg,
- Register temp_reg, Register temp2_reg, Register temp3_reg = noreg);
-
- static void remove_arg_slots(MacroAssembler* _masm,
- RegisterOrConstant arg_slots,
- Register argslot_reg,
- Register temp_reg, Register temp2_reg, Register temp3_reg = noreg);
-
- static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN;
-#endif //TARGET_ARCH_NYI_6939861
};
diff --git a/src/share/vm/runtime/frame.cpp b/src/share/vm/runtime/frame.cpp
index c3a08529a..7f4a2ac65 100644
--- a/src/share/vm/runtime/frame.cpp
+++ b/src/share/vm/runtime/frame.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -1334,24 +1334,21 @@ void frame::interpreter_frame_verify_monitor(BasicObjectLock* value) const {
void frame::describe(FrameValues& values, int frame_no) {
+ intptr_t* frame_pointer = real_fp();
if (is_entry_frame() || is_compiled_frame() || is_interpreted_frame() || is_native_frame()) {
// Label values common to most frames
values.describe(-1, unextended_sp(), err_msg("unextended_sp for #%d", frame_no));
values.describe(-1, sp(), err_msg("sp for #%d", frame_no));
- if (is_compiled_frame()) {
- values.describe(-1, sp() + _cb->frame_size(), err_msg("computed fp for #%d", frame_no));
- } else {
- values.describe(-1, fp(), err_msg("fp for #%d", frame_no));
- }
+ values.describe(-1, frame_pointer, err_msg("frame pointer for #%d", frame_no));
}
if (is_interpreted_frame()) {
methodOop m = interpreter_frame_method();
int bci = interpreter_frame_bci();
// Label the method and current bci
- values.describe(-1, MAX2(sp(), fp()),
+ values.describe(-1, MAX2(sp(), frame_pointer),
FormatBuffer<1024>("#%d method %s @ %d", frame_no, m->name_and_sig_as_C_string(), bci), 2);
- values.describe(-1, MAX2(sp(), fp()),
+ values.describe(-1, MAX2(sp(), frame_pointer),
err_msg("- %d locals %d max stack", m->max_locals(), m->max_stack()), 1);
if (m->max_locals() > 0) {
intptr_t* l0 = interpreter_frame_local_at(0);
@@ -1383,18 +1380,18 @@ void frame::describe(FrameValues& values, int frame_no) {
}
} else if (is_entry_frame()) {
// For now just label the frame
- values.describe(-1, MAX2(sp(), fp()), err_msg("#%d entry frame", frame_no), 2);
+ values.describe(-1, MAX2(sp(), frame_pointer), err_msg("#%d entry frame", frame_no), 2);
} else if (is_compiled_frame()) {
// For now just label the frame
nmethod* nm = cb()->as_nmethod_or_null();
- values.describe(-1, MAX2(sp(), fp()),
+ values.describe(-1, MAX2(sp(), frame_pointer),
FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for method %s%s", frame_no,
nm, nm->method()->name_and_sig_as_C_string(),
is_deoptimized_frame() ? " (deoptimized" : ""), 2);
} else if (is_native_frame()) {
// For now just label the frame
nmethod* nm = cb()->as_nmethod_or_null();
- values.describe(-1, MAX2(sp(), fp()),
+ values.describe(-1, MAX2(sp(), frame_pointer),
FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for native method %s", frame_no,
nm, nm->method()->name_and_sig_as_C_string()), 2);
}
diff --git a/src/share/vm/runtime/frame.hpp b/src/share/vm/runtime/frame.hpp
index ec00e3a68..02e06d160 100644
--- a/src/share/vm/runtime/frame.hpp
+++ b/src/share/vm/runtime/frame.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -221,6 +221,15 @@ class frame VALUE_OBJ_CLASS_SPEC {
// returns the stack pointer of the calling frame
intptr_t* sender_sp() const;
+ // Returns the real 'frame pointer' for the current frame.
+ // This is the value expected by the platform ABI when it defines a
+ // frame pointer register. It may differ from the effective value of
+ // the FP register when that register is used in the JVM for other
+ // purposes (like compiled frames on some platforms).
+ // On other platforms, it is defined so that the stack area used by
+ // this frame goes from real_fp() to sp().
+ intptr_t* real_fp() const;
+
// Deoptimization info, if needed (platform dependent).
// Stored in the initial_info field of the unroll info, to be used by
// the platform dependent deoptimization blobs.
diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp
index 02311e215..88e593850 100644
--- a/src/share/vm/runtime/globals.hpp
+++ b/src/share/vm/runtime/globals.hpp
@@ -3826,10 +3826,6 @@ class CommandLineFlags {
develop(bool, StressMethodHandleWalk, false, \
"Process all method handles with MethodHandleWalk") \
\
- diagnostic(bool, UseRicochetFrames, true, \
- "use ricochet stack frames for method handle combination, " \
- "if the platform supports them") \
- \
experimental(bool, TrustFinalNonStaticFields, false, \
"trust final non-static declarations for constant folding") \
\
diff --git a/src/share/vm/runtime/java.cpp b/src/share/vm/runtime/java.cpp
index c04bd23ca..f256e515e 100644
--- a/src/share/vm/runtime/java.cpp
+++ b/src/share/vm/runtime/java.cpp
@@ -57,6 +57,8 @@
#include "runtime/task.hpp"
#include "runtime/timer.hpp"
#include "runtime/vm_operations.hpp"
+#include "trace/tracing.hpp"
+#include "trace/traceEventTypes.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/histogram.hpp"
@@ -502,6 +504,11 @@ void before_exit(JavaThread * thread) {
if (JvmtiExport::should_post_thread_life()) {
JvmtiExport::post_thread_end(thread);
}
+
+ EVENT_BEGIN(TraceEventThreadEnd, event);
+ EVENT_COMMIT(event,
+ EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj())));
+
// Always call even when there are not JVMTI environments yet, since environments
// may be attached late and JVMTI must track phases of VM execution
JvmtiExport::post_vm_death();
diff --git a/src/share/vm/runtime/mutexLocker.cpp b/src/share/vm/runtime/mutexLocker.cpp
index 7653b5bef..0a2d8795b 100644
--- a/src/share/vm/runtime/mutexLocker.cpp
+++ b/src/share/vm/runtime/mutexLocker.cpp
@@ -132,7 +132,13 @@ Mutex* HotCardCache_lock = NULL;
Monitor* GCTaskManager_lock = NULL;
Mutex* Management_lock = NULL;
-Monitor* Service_lock = NULL;
+Monitor* Service_lock = NULL;
+Mutex* Stacktrace_lock = NULL;
+
+Monitor* JfrQuery_lock = NULL;
+Monitor* JfrMsg_lock = NULL;
+Mutex* JfrBuffer_lock = NULL;
+Mutex* JfrStream_lock = NULL;
#define MAX_NUM_MUTEX 128
static Monitor * _mutex_array[MAX_NUM_MUTEX];
@@ -207,6 +213,7 @@ void mutex_init() {
def(Patching_lock , Mutex , special, true ); // used for safepointing and code patching.
def(ObjAllocPost_lock , Monitor, special, false);
def(Service_lock , Monitor, special, true ); // used for service thread operations
+ def(Stacktrace_lock , Mutex, special, true ); // used for JFR stacktrace database
def(JmethodIdCreation_lock , Mutex , leaf, true ); // used for creating jmethodIDs.
def(SystemDictionary_lock , Monitor, leaf, true ); // lookups done by VM thread
@@ -271,6 +278,11 @@ void mutex_init() {
def(Debug3_lock , Mutex , nonleaf+4, true );
def(ProfileVM_lock , Monitor, nonleaf+4, false); // used for profiling of the VMThread
def(CompileThread_lock , Monitor, nonleaf+5, false );
+
+ def(JfrQuery_lock , Monitor, nonleaf, true); // JFR locks, keep these in consecutive order
+ def(JfrMsg_lock , Monitor, nonleaf+2, true);
+ def(JfrBuffer_lock , Mutex, nonleaf+3, true);
+ def(JfrStream_lock , Mutex, nonleaf+4, true);
}
GCMutexLocker::GCMutexLocker(Monitor * mutex) {
diff --git a/src/share/vm/runtime/mutexLocker.hpp b/src/share/vm/runtime/mutexLocker.hpp
index 37a3d3132..2a6bf369d 100644
--- a/src/share/vm/runtime/mutexLocker.hpp
+++ b/src/share/vm/runtime/mutexLocker.hpp
@@ -135,6 +135,12 @@ extern Mutex* HotCardCache_lock; // protects the hot card cache
extern Mutex* Management_lock; // a lock used to serialize JVM management
extern Monitor* Service_lock; // a lock used for service thread operation
+extern Mutex* Stacktrace_lock; // used to guard access to the stacktrace table
+
+extern Monitor* JfrQuery_lock; // protects JFR use
+extern Monitor* JfrMsg_lock; // protects JFR messaging
+extern Mutex* JfrBuffer_lock; // protects JFR buffer operations
+extern Mutex* JfrStream_lock; // protects JFR stream access
// A MutexLocker provides mutual exclusion with respect to a given mutex
// for the scope which contains the locker. The lock is an OS lock, not
diff --git a/src/share/vm/runtime/os.cpp b/src/share/vm/runtime/os.cpp
index 773948971..33495d66d 100644
--- a/src/share/vm/runtime/os.cpp
+++ b/src/share/vm/runtime/os.cpp
@@ -1101,6 +1101,7 @@ bool os::set_boot_path(char fileSep, char pathSep) {
"%/lib/jsse.jar:"
"%/lib/jce.jar:"
"%/lib/charsets.jar:"
+ "%/lib/jfr.jar:"
#ifdef __APPLE__
"%/lib/JObjC.jar:"
#endif
diff --git a/src/share/vm/runtime/sharedRuntime.cpp b/src/share/vm/runtime/sharedRuntime.cpp
index 486c21dcf..bea5e6bfd 100644
--- a/src/share/vm/runtime/sharedRuntime.cpp
+++ b/src/share/vm/runtime/sharedRuntime.cpp
@@ -121,7 +121,6 @@ void SharedRuntime::generate_stubs() {
void SharedRuntime::generate_ricochet_blob() {
if (!EnableInvokeDynamic) return; // leave it as a null
-#ifndef TARGET_ARCH_NYI_6939861
// allocate space for the code
ResourceMark rm;
// setup code generation tools
@@ -142,7 +141,6 @@ void SharedRuntime::generate_ricochet_blob() {
}
_ricochet_blob = RicochetBlob::create(&buffer, bounce_offset, exception_offset, frame_size_in_words);
-#endif
}
diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp
index da291036e..18c04a905 100644
--- a/src/share/vm/runtime/thread.cpp
+++ b/src/share/vm/runtime/thread.cpp
@@ -73,6 +73,7 @@
#include "services/attachListener.hpp"
#include "services/management.hpp"
#include "services/threadService.hpp"
+#include "trace/traceEventTypes.hpp"
#include "utilities/defaultStream.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/events.hpp"
@@ -232,6 +233,7 @@ Thread::Thread() {
CHECK_UNHANDLED_OOPS_ONLY(_gc_locked_out_count = 0;)
_jvmti_env_iteration_count = 0;
set_allocated_bytes(0);
+ set_trace_buffer(NULL);
_vm_operation_started_count = 0;
_vm_operation_completed_count = 0;
_current_pending_monitor = NULL;
@@ -1512,6 +1514,10 @@ void JavaThread::run() {
JvmtiExport::post_thread_start(this);
}
+ EVENT_BEGIN(TraceEventThreadStart, event);
+ EVENT_COMMIT(event,
+ EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(this->threadObj())));
+
// We call another function to do the rest so we are sure that the stack addresses used
// from there will be lower than the stack base just computed
thread_main_inner();
@@ -1641,6 +1647,15 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
}
}
+ // Called before the java thread exit since we want to read info
+ // from java_lang_Thread object
+ EVENT_BEGIN(TraceEventThreadEnd, event);
+ EVENT_COMMIT(event,
+ EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(this->threadObj())));
+
+ // Call after last event on thread
+ EVENT_THREAD_EXIT(this);
+
// Call Thread.exit(). We try 3 times in case we got another Thread.stop during
// the execution of the method. If that is not enough, then we don't really care. Thread.stop
// is deprecated anyhow.
@@ -3186,6 +3201,11 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
return status;
}
+ // Must be run after init_ft which initializes ft_enabled
+ if (TRACE_INITIALIZE() != JNI_OK) {
+ vm_exit_during_initialization("Failed to initialize tracing backend");
+ }
+
// Should be done after the heap is fully created
main_thread->cache_global_variables();
@@ -3423,6 +3443,10 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
create_vm_init_libraries();
}
+ if (!TRACE_START()) {
+ vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
+ }
+
// Notify JVMTI agents that VM initialization is complete - nop if no agents.
JvmtiExport::post_vm_initialized();
diff --git a/src/share/vm/runtime/thread.hpp b/src/share/vm/runtime/thread.hpp
index da13f1225..37bbf2937 100644
--- a/src/share/vm/runtime/thread.hpp
+++ b/src/share/vm/runtime/thread.hpp
@@ -41,6 +41,7 @@
#include "runtime/stubRoutines.hpp"
#include "runtime/threadLocalStorage.hpp"
#include "runtime/unhandledOops.hpp"
+#include "trace/tracing.hpp"
#include "utilities/exceptions.hpp"
#include "utilities/top.hpp"
#ifndef SERIALGC
@@ -246,6 +247,8 @@ class Thread: public ThreadShadow {
jlong _allocated_bytes; // Cumulative number of bytes allocated on
// the Java heap
+ TRACE_BUFFER _trace_buffer; // Thread-local buffer for tracing
+
int _vm_operation_started_count; // VM_Operation support
int _vm_operation_completed_count; // VM_Operation support
@@ -414,6 +417,9 @@ class Thread: public ThreadShadow {
return allocated_bytes;
}
+ TRACE_BUFFER trace_buffer() { return _trace_buffer; }
+ void set_trace_buffer(TRACE_BUFFER buf) { _trace_buffer = buf; }
+
// VM operation support
int vm_operation_ticket() { return ++_vm_operation_started_count; }
int vm_operation_completed_count() { return _vm_operation_completed_count; }
diff --git a/src/share/vm/runtime/vm_operations.hpp b/src/share/vm/runtime/vm_operations.hpp
index 77f262f6e..081c428a6 100644
--- a/src/share/vm/runtime/vm_operations.hpp
+++ b/src/share/vm/runtime/vm_operations.hpp
@@ -93,6 +93,7 @@
template(HeapWalkOperation) \
template(HeapIterateOperation) \
template(ReportJavaOutOfMemory) \
+ template(JFRCheckpoint) \
template(Exit) \
class VM_Operation: public CHeapObj {
diff --git a/src/share/vm/trace/traceEventTypes.hpp b/src/share/vm/trace/traceEventTypes.hpp
new file mode 100644
index 000000000..e7448aaeb
--- /dev/null
+++ b/src/share/vm/trace/traceEventTypes.hpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 1997, 2012, 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.
+ *
+ */
+
+#ifndef SHARE_VM_TRACE_TRACE_EVENT_TYPES_HPP
+#define SHARE_VM_TRACE_TRACE_EVENT_TYPES_HPP
+
+/* Empty, just a placeholder for tracing events */
+
+#endif
diff --git a/src/share/vm/trace/traceMacros.hpp b/src/share/vm/trace/traceMacros.hpp
new file mode 100644
index 000000000..e92593529
--- /dev/null
+++ b/src/share/vm/trace/traceMacros.hpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1997, 2011, 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.
+ *
+ */
+
+#ifndef SHARE_VM_TRACE_TRACE_MACRO_HPP
+#define SHARE_VM_TRACE_TRACE_MACRO_HPP
+
+#define EVENT_BEGIN(type, name)
+#define EVENT_SET(name, field, value)
+#define EVENT_COMMIT(name, ...)
+#define EVENT_STARTED(name, time)
+#define EVENT_ENDED(name, time)
+#define EVENT_THREAD_EXIT(thread)
+
+#define TRACE_ENABLED 0
+
+#define TRACE_INIT_ID(k)
+#define TRACE_BUFFER void*
+
+#define TRACE_START() true
+#define TRACE_INITIALIZE() 0
+
+#endif
diff --git a/src/share/vm/trace/tracing.hpp b/src/share/vm/trace/tracing.hpp
new file mode 100644
index 000000000..dcf0e5eb8
--- /dev/null
+++ b/src/share/vm/trace/tracing.hpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 1997, 2011, 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.
+ *
+ */
+
+#ifndef SHARE_VM_TRACE_TRACING_HPP
+#define SHARE_VM_TRACE_TRACING_HPP
+
+#include "trace/traceMacros.hpp"
+
+#endif
diff --git a/src/share/vm/utilities/decoder.cpp b/src/share/vm/utilities/decoder.cpp
index ed156de23..712c54cc7 100644
--- a/src/share/vm/utilities/decoder.cpp
+++ b/src/share/vm/utilities/decoder.cpp
@@ -24,80 +24,85 @@
#include "precompiled.hpp"
#include "prims/jvm.h"
+#include "runtime/mutexLocker.hpp"
#include "utilities/decoder.hpp"
-Decoder::decoder_status Decoder::_decoder_status = Decoder::no_error;
-bool Decoder::_initialized = false;
-
-#if !defined(_WINDOWS) && !defined(__APPLE__)
+#if defined(_WINDOWS)
+ #include "decoder_windows.hpp"
+#elif defined(__APPLE__)
+ #include "decoder_machO.hpp"
+#else
+ #include "decoder_elf.hpp"
+#endif
-// Implementation of common functionalities among Solaris and Linux
-#include "utilities/elfFile.hpp"
+NullDecoder* Decoder::_decoder = NULL;
+NullDecoder Decoder::_do_nothing_decoder;
+Mutex* Decoder::_decoder_lock = new Mutex(Mutex::safepoint,
+ "DecoderLock");
-ElfFile* Decoder::_opened_elf_files = NULL;
+// _decoder_lock should already acquired before enter this method
+NullDecoder* Decoder::get_decoder() {
+ assert(_decoder_lock != NULL && _decoder_lock->owned_by_self(),
+ "Require DecoderLock to enter");
-bool Decoder::can_decode_C_frame_in_vm() {
- return true;
-}
+ if (_decoder != NULL) {
+ return _decoder;
+ }
-void Decoder::initialize() {
- _initialized = true;
-}
+ // Decoder is a secondary service. Although, it is good to have,
+ // but we can live without it.
+#if defined(_WINDOWS)
+ _decoder = new (std::nothrow) WindowsDecoder();
+#elif defined (__APPLE__)
+ _decoder = new (std::nothrow)MachODecoder();
+#else
+ _decoder = new (std::nothrow)ElfDecoder();
+#endif
-void Decoder::uninitialize() {
- if (_opened_elf_files != NULL) {
- delete _opened_elf_files;
- _opened_elf_files = NULL;
+ if (_decoder == NULL || _decoder->has_error()) {
+ if (_decoder != NULL) {
+ delete _decoder;
+ }
+ _decoder = &_do_nothing_decoder;
}
- _initialized = false;
+ return _decoder;
}
-Decoder::decoder_status Decoder::decode(address addr, const char* filepath, char *buf, int buflen, int *offset) {
- if (_decoder_status != no_error) {
- return _decoder_status;
- }
+bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath) {
+ assert(_decoder_lock != NULL, "Just check");
+ MutexLockerEx locker(_decoder_lock, true);
+ NullDecoder* decoder = get_decoder();
+ assert(decoder != NULL, "null decoder");
- ElfFile* file = get_elf_file(filepath);
- if (_decoder_status != no_error) {
- return _decoder_status;
- }
+ return decoder->decode(addr, buf, buflen, offset, modulepath);
+}
- const char* symbol = file->decode(addr, offset);
- if (file->get_status() == out_of_memory) {
- _decoder_status = out_of_memory;
- return _decoder_status;
- } else if (symbol != NULL) {
- if (!demangle(symbol, buf, buflen)) {
- jio_snprintf(buf, buflen, "%s", symbol);
- }
- return no_error;
- } else {
- return symbol_not_found;
- }
+bool Decoder::demangle(const char* symbol, char* buf, int buflen) {
+ assert(_decoder_lock != NULL, "Just check");
+ MutexLockerEx locker(_decoder_lock, true);
+ NullDecoder* decoder = get_decoder();
+ assert(decoder != NULL, "null decoder");
+ return decoder->demangle(symbol, buf, buflen);
}
-ElfFile* Decoder::get_elf_file(const char* filepath) {
- if (_decoder_status != no_error) {
- return NULL;
- }
- ElfFile* file = _opened_elf_files;
- while (file != NULL) {
- if (file->same_elf_file(filepath)) {
- return file;
- }
- file = file->m_next;
- }
+bool Decoder::can_decode_C_frame_in_vm() {
+ assert(_decoder_lock != NULL, "Just check");
+ MutexLockerEx locker(_decoder_lock, true);
+ NullDecoder* decoder = get_decoder();
+ assert(decoder != NULL, "null decoder");
+ return decoder->can_decode_C_frame_in_vm();
+}
- file = new ElfFile(filepath);
- if (file == NULL) {
- _decoder_status = out_of_memory;
- }
- if (_opened_elf_files != NULL) {
- file->m_next = _opened_elf_files;
+// shutdown real decoder and replace it with
+// _do_nothing_decoder
+void Decoder::shutdown() {
+ assert(_decoder_lock != NULL, "Just check");
+ MutexLockerEx locker(_decoder_lock, true);
+
+ if (_decoder != NULL && _decoder != &_do_nothing_decoder) {
+ delete _decoder;
}
- _opened_elf_files = file;
- return file;
+ _decoder = &_do_nothing_decoder;
}
-#endif
diff --git a/src/share/vm/utilities/decoder.hpp b/src/share/vm/utilities/decoder.hpp
index 70ffe2197..82179a686 100644
--- a/src/share/vm/utilities/decoder.hpp
+++ b/src/share/vm/utilities/decoder.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -23,83 +23,78 @@
*/
-#ifndef __DECODER_HPP
-#define __DECODER_HPP
+#ifndef SHARE_VM_UTILITIES_DECODER_HPP
+#define SHARE_VM_UTILITIES_DECODER_HPP
#include "memory/allocation.hpp"
+#include "runtime/mutex.hpp"
-#ifdef _WINDOWS
-#include <windows.h>
-#include <imagehlp.h>
-
-// functions needed for decoding symbols
-typedef DWORD (WINAPI *pfn_SymSetOptions)(DWORD);
-typedef BOOL (WINAPI *pfn_SymInitialize)(HANDLE, PCTSTR, BOOL);
-typedef BOOL (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
-typedef DWORD (WINAPI *pfn_UndecorateSymbolName)(const char*, char*, DWORD, DWORD);
-
-#elif defined(__APPLE__)
-
-#else
-
-class ElfFile;
-
-#endif // _WINDOWS
-
-
-class Decoder: public StackObj {
-
- public:
+class NullDecoder: public CHeapObj {
+public:
// status code for decoding native C frame
enum decoder_status {
- no_error, // successfully decoded frames
+ not_available = -10, // real decoder is not available
+ no_error = 0, // successfully decoded frames
out_of_memory, // out of memory
file_invalid, // invalid elf file
file_not_found, // could not found symbol file (on windows), such as jvm.pdb or jvm.map
helper_not_found, // could not load dbghelp.dll (Windows only)
helper_func_error, // decoding functions not found (Windows only)
- helper_init_error, // SymInitialize failed (Windows only)
- symbol_not_found // could not find the symbol
+ helper_init_error // SymInitialize failed (Windows only)
};
- public:
- Decoder() { initialize(); };
- ~Decoder() { uninitialize(); };
+ NullDecoder() {
+ _decoder_status = not_available;
+ }
- static bool can_decode_C_frame_in_vm();
+ ~NullDecoder() {};
+
+ virtual bool decode(address pc, char* buf, int buflen, int* offset,
+ const char* modulepath = NULL) {
+ return false;
+ }
- static void initialize();
- static void uninitialize();
+ virtual bool demangle(const char* symbol, char* buf, int buflen) {
+ return false;
+ }
-#ifdef _WINDOWS
- static decoder_status decode(address addr, char *buf, int buflen, int *offset);
-#else
- static decoder_status decode(address addr, const char* filepath, char *buf, int buflen, int *offset);
-#endif
+ virtual bool can_decode_C_frame_in_vm() const {
+ return false;
+ }
- static bool demangle(const char* symbol, char *buf, int buflen);
+ virtual decoder_status status() const {
+ return _decoder_status;
+ }
- static decoder_status get_status() { return _decoder_status; };
+ virtual bool has_error() const {
+ return is_error(_decoder_status);
+ }
-#if !defined(_WINDOWS) && !defined(__APPLE__)
- private:
- static ElfFile* get_elf_file(const char* filepath);
-#endif // _WINDOWS
+ static bool is_error(decoder_status status) {
+ return (status > 0);
+ }
+
+protected:
+ decoder_status _decoder_status;
+};
+
+
+class Decoder: AllStatic {
+public:
+ static bool decode(address pc, char* buf, int buflen, int* offset, const char* modulepath = NULL);
+ static bool demangle(const char* symbol, char* buf, int buflen);
+ static bool can_decode_C_frame_in_vm();
+ static void shutdown();
+protected:
+ static NullDecoder* get_decoder();
- private:
- static decoder_status _decoder_status;
- static bool _initialized;
+private:
+ static NullDecoder* _decoder;
+ static NullDecoder _do_nothing_decoder;
-#ifdef _WINDOWS
- static HMODULE _dbghelp_handle;
- static bool _can_decode_in_vm;
- static pfn_SymGetSymFromAddr64 _pfnSymGetSymFromAddr64;
- static pfn_UndecorateSymbolName _pfnUndecorateSymbolName;
-#elif __APPLE__
-#else
- static ElfFile* _opened_elf_files;
-#endif // _WINDOWS
+protected:
+ static Mutex* _decoder_lock;
};
-#endif // __DECODER_HPP
+#endif // SHARE_VM_UTILITIES_DECODER_HPP
diff --git a/src/share/vm/utilities/decoder_elf.cpp b/src/share/vm/utilities/decoder_elf.cpp
new file mode 100644
index 000000000..d5733a873
--- /dev/null
+++ b/src/share/vm/utilities/decoder_elf.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ */
+
+#include "precompiled.hpp"
+
+#if !defined(_WINDOWS) && !defined(__APPLE__)
+#include "decoder_elf.hpp"
+
+ElfDecoder::~ElfDecoder() {
+ if (_opened_elf_files != NULL) {
+ delete _opened_elf_files;
+ _opened_elf_files = NULL;
+ }
+}
+
+bool ElfDecoder::decode(address addr, char *buf, int buflen, int* offset, const char* filepath) {
+ assert(filepath, "null file path");
+ assert(buf != NULL && buflen > 0, "Invalid buffer");
+ if (has_error()) return false;
+ ElfFile* file = get_elf_file(filepath);
+ if (file == NULL) {
+ return false;
+ }
+
+ if (!file->decode(addr, buf, buflen, offset)) {
+ return false;
+ }
+ if (buf[0] != '\0') {
+ demangle(buf, buf, buflen);
+ }
+ return true;
+}
+
+ElfFile* ElfDecoder::get_elf_file(const char* filepath) {
+ ElfFile* file;
+
+ file = _opened_elf_files;
+ while (file != NULL) {
+ if (file->same_elf_file(filepath)) {
+ return file;
+ }
+ file = file->next();
+ }
+
+ file = new (std::nothrow)ElfFile(filepath);
+ if (file != NULL) {
+ if (_opened_elf_files != NULL) {
+ file->set_next(_opened_elf_files);
+ }
+ _opened_elf_files = file;
+ }
+
+ return file;
+}
+#endif
diff --git a/src/share/vm/utilities/decoder_elf.hpp b/src/share/vm/utilities/decoder_elf.hpp
new file mode 100644
index 000000000..f0dff7534
--- /dev/null
+++ b/src/share/vm/utilities/decoder_elf.hpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ */
+
+#ifndef SHARE_VM_UTILITIES_DECODER_ELF_HPP
+#define SHARE_VM_UTILITIES_DECODER_ELF_HPP
+
+#if !defined(_WINDOWS) && !defined(__APPLE__)
+
+#include "utilities/decoder.hpp"
+#include "utilities/elfFile.hpp"
+
+class ElfDecoder: public NullDecoder {
+
+public:
+ ElfDecoder() {
+ _opened_elf_files = NULL;
+ _decoder_status = no_error;
+ }
+ ~ElfDecoder();
+
+ 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);
+
+private:
+ ElfFile* get_elf_file(const char* filepath);
+
+private:
+ ElfFile* _opened_elf_files;
+};
+
+#endif
+#endif // SHARE_VM_UTILITIES_DECODER_ELF_HPP
diff --git a/src/share/vm/utilities/elfFile.cpp b/src/share/vm/utilities/elfFile.cpp
index 2db1f71e0..2e4b68302 100644
--- a/src/share/vm/utilities/elfFile.cpp
+++ b/src/share/vm/utilities/elfFile.cpp
@@ -44,7 +44,7 @@ ElfFile::ElfFile(const char* filepath) {
m_string_tables = NULL;
m_symbol_tables = NULL;
m_next = NULL;
- m_status = Decoder::no_error;
+ m_status = NullDecoder::no_error;
int len = strlen(filepath) + 1;
m_filepath = (const char*)os::malloc(len * sizeof(char));
@@ -54,10 +54,10 @@ ElfFile::ElfFile(const char* filepath) {
if (m_file != NULL) {
load_tables();
} else {
- m_status = Decoder::file_not_found;
+ m_status = NullDecoder::file_not_found;
}
} else {
- m_status = Decoder::out_of_memory;
+ m_status = NullDecoder::out_of_memory;
}
}
@@ -96,41 +96,41 @@ bool ElfFile::is_elf_file(Elf_Ehdr& hdr) {
bool ElfFile::load_tables() {
assert(m_file, "file not open");
- assert(m_status == Decoder::no_error, "already in error");
+ assert(!NullDecoder::is_error(m_status), "already in error");
// read elf file header
if (fread(&m_elfHdr, sizeof(m_elfHdr), 1, m_file) != 1) {
- m_status = Decoder::file_invalid;
+ m_status = NullDecoder::file_invalid;
return false;
}
if (!is_elf_file(m_elfHdr)) {
- m_status = Decoder::file_invalid;
+ m_status = NullDecoder::file_invalid;
return false;
}
// walk elf file's section headers, and load string tables
Elf_Shdr shdr;
if (!fseek(m_file, m_elfHdr.e_shoff, SEEK_SET)) {
- if (m_status != Decoder::no_error) return false;
+ if (NullDecoder::is_error(m_status)) return false;
for (int index = 0; index < m_elfHdr.e_shnum; index ++) {
if (fread((void*)&shdr, sizeof(Elf_Shdr), 1, m_file) != 1) {
- m_status = Decoder::file_invalid;
+ m_status = NullDecoder::file_invalid;
return false;
}
// string table
if (shdr.sh_type == SHT_STRTAB) {
ElfStringTable* table = new (std::nothrow) ElfStringTable(m_file, shdr, index);
if (table == NULL) {
- m_status = Decoder::out_of_memory;
+ m_status = NullDecoder::out_of_memory;
return false;
}
add_string_table(table);
} else if (shdr.sh_type == SHT_SYMTAB || shdr.sh_type == SHT_DYNSYM) {
ElfSymbolTable* table = new (std::nothrow) ElfSymbolTable(m_file, shdr);
if (table == NULL) {
- m_status = Decoder::out_of_memory;
+ m_status = NullDecoder::out_of_memory;
return false;
}
add_symbol_table(table);
@@ -140,32 +140,33 @@ bool ElfFile::load_tables() {
return true;
}
-const char* ElfFile::decode(address addr, int* offset) {
+bool ElfFile::decode(address addr, char* buf, int buflen, int* offset) {
// something already went wrong, just give up
- if (m_status != Decoder::no_error) {
- return NULL;
+ if (NullDecoder::is_error(m_status)) {
+ return false;
}
-
ElfSymbolTable* symbol_table = m_symbol_tables;
int string_table_index;
int pos_in_string_table;
int off = INT_MAX;
bool found_symbol = false;
while (symbol_table != NULL) {
- if (Decoder::no_error == symbol_table->lookup(addr, &string_table_index, &pos_in_string_table, &off)) {
+ if (symbol_table->lookup(addr, &string_table_index, &pos_in_string_table, &off)) {
found_symbol = true;
}
symbol_table = symbol_table->m_next;
}
- if (!found_symbol) return NULL;
+ if (!found_symbol) return false;
ElfStringTable* string_table = get_string_table(string_table_index);
+
if (string_table == NULL) {
- m_status = Decoder::file_invalid;
- return NULL;
+ m_status = NullDecoder::file_invalid;
+ return false;
}
if (offset) *offset = off;
- return string_table->string_at(pos_in_string_table);
+
+ return string_table->string_at(pos_in_string_table, buf, buflen);
}
diff --git a/src/share/vm/utilities/elfFile.hpp b/src/share/vm/utilities/elfFile.hpp
index b40b90ae6..e6f4ce263 100644
--- a/src/share/vm/utilities/elfFile.hpp
+++ b/src/share/vm/utilities/elfFile.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -22,8 +22,8 @@
*
*/
-#ifndef __ELF_FILE_HPP
-#define __ELF_FILE_HPP
+#ifndef SHARE_VM_UTILITIES_ELF_FILE_HPP
+#define SHARE_VM_UTILITIES_ELF_FILE_HPP
#if !defined(_WINDOWS) && !defined(__APPLE__)
@@ -83,12 +83,12 @@ class ElfSymbolTable;
// part of code to be very defensive, and bait out if anything went wrong.
class ElfFile: public CHeapObj {
- friend class Decoder;
+ friend class ElfDecoder;
public:
ElfFile(const char* filepath);
~ElfFile();
- const char* decode(address addr, int* offset);
+ bool decode(address addr, char* buf, int buflen, int* offset);
const char* filepath() {
return m_filepath;
}
@@ -99,7 +99,7 @@ class ElfFile: public CHeapObj {
return (m_filepath && !strcmp(filepath, m_filepath));
}
- Decoder::decoder_status get_status() {
+ NullDecoder::decoder_status get_status() {
return m_status;
}
@@ -119,8 +119,9 @@ class ElfFile: public CHeapObj {
// return a string table at specified section index
ElfStringTable* get_string_table(int index);
- // look up an address and return the nearest symbol
- const char* look_up(Elf_Shdr shdr, address addr, int* offset);
+protected:
+ ElfFile* next() const { return m_next; }
+ void set_next(ElfFile* file) { m_next = file; }
protected:
ElfFile* m_next;
@@ -131,17 +132,17 @@ class ElfFile: public CHeapObj {
FILE* m_file;
// Elf header
- Elf_Ehdr m_elfHdr;
+ Elf_Ehdr m_elfHdr;
// symbol tables
- ElfSymbolTable* m_symbol_tables;
+ ElfSymbolTable* m_symbol_tables;
// string tables
- ElfStringTable* m_string_tables;
+ ElfStringTable* m_string_tables;
- Decoder::decoder_status m_status;
+ NullDecoder::decoder_status m_status;
};
#endif // _WINDOWS
-#endif // __ELF_FILE_HPP
+#endif // SHARE_VM_UTILITIES_ELF_FILE_HPP
diff --git a/src/share/vm/utilities/elfStringTable.cpp b/src/share/vm/utilities/elfStringTable.cpp
index 905f82bfe..89286cb18 100644
--- a/src/share/vm/utilities/elfStringTable.cpp
+++ b/src/share/vm/utilities/elfStringTable.cpp
@@ -38,7 +38,7 @@ ElfStringTable::ElfStringTable(FILE* file, Elf_Shdr shdr, int index) {
m_index = index;
m_next = NULL;
m_file = file;
- m_status = Decoder::no_error;
+ m_status = NullDecoder::no_error;
// try to load the string table
long cur_offset = ftell(file);
@@ -48,7 +48,7 @@ ElfStringTable::ElfStringTable(FILE* file, Elf_Shdr shdr, int index) {
if (fseek(file, shdr.sh_offset, SEEK_SET) ||
fread((void*)m_table, shdr.sh_size, 1, file) != 1 ||
fseek(file, cur_offset, SEEK_SET)) {
- m_status = Decoder::file_invalid;
+ m_status = NullDecoder::file_invalid;
os::free((void*)m_table);
m_table = NULL;
}
@@ -67,22 +67,23 @@ ElfStringTable::~ElfStringTable() {
}
}
-const char* ElfStringTable::string_at(int pos) {
- if (m_status != Decoder::no_error) {
- return NULL;
+bool ElfStringTable::string_at(int pos, char* buf, int buflen) {
+ if (NullDecoder::is_error(m_status)) {
+ return false;
}
if (m_table != NULL) {
- return (const char*)(m_table + pos);
+ jio_snprintf(buf, buflen, "%s", (const char*)(m_table + pos));
+ return true;
} else {
long cur_pos = ftell(m_file);
if (cur_pos == -1 ||
fseek(m_file, m_shdr.sh_offset + pos, SEEK_SET) ||
- fread(m_symbol, 1, MAX_SYMBOL_LEN, m_file) <= 0 ||
+ fread(buf, 1, buflen, m_file) <= 0 ||
fseek(m_file, cur_pos, SEEK_SET)) {
- m_status = Decoder::file_invalid;
- return NULL;
+ m_status = NullDecoder::file_invalid;
+ return false;
}
- return (const char*)m_symbol;
+ return true;
}
}
diff --git a/src/share/vm/utilities/elfStringTable.hpp b/src/share/vm/utilities/elfStringTable.hpp
index a984e3a33..96f30b159 100644
--- a/src/share/vm/utilities/elfStringTable.hpp
+++ b/src/share/vm/utilities/elfStringTable.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -22,8 +22,8 @@
*
*/
-#ifndef __ELF_STRING_TABLE_HPP
-#define __ELF_STRING_TABLE_HPP
+#ifndef SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP
+#define SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP
#if !defined(_WINDOWS) && !defined(__APPLE__)
@@ -35,9 +35,6 @@
// The string table represents a string table section in an elf file.
// Whenever there is enough memory, it will load whole string table as
// one blob. Otherwise, it will load string from file when requested.
-
-#define MAX_SYMBOL_LEN 256
-
class ElfStringTable: CHeapObj {
friend class ElfFile;
public:
@@ -48,10 +45,10 @@ class ElfStringTable: CHeapObj {
int index() { return m_index; };
// get string at specified offset
- const char* string_at(int offset);
+ bool string_at(int offset, char* buf, int buflen);
// get status code
- Decoder::decoder_status get_status() { return m_status; };
+ NullDecoder::decoder_status get_status() { return m_status; };
protected:
ElfStringTable* m_next;
@@ -69,13 +66,10 @@ class ElfStringTable: CHeapObj {
// section header
Elf_Shdr m_shdr;
- // buffer for reading individual string
- char m_symbol[MAX_SYMBOL_LEN];
-
// error code
- Decoder::decoder_status m_status;
+ NullDecoder::decoder_status m_status;
};
-#endif // _WINDOWS
+#endif // _WINDOWS and _APPLE
-#endif // __ELF_STRING_TABLE_HPP
+#endif // SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP
diff --git a/src/share/vm/utilities/elfSymbolTable.cpp b/src/share/vm/utilities/elfSymbolTable.cpp
index d1606010d..3ac9b9215 100644
--- a/src/share/vm/utilities/elfSymbolTable.cpp
+++ b/src/share/vm/utilities/elfSymbolTable.cpp
@@ -34,7 +34,7 @@ ElfSymbolTable::ElfSymbolTable(FILE* file, Elf_Shdr shdr) {
m_symbols = NULL;
m_next = NULL;
m_file = file;
- m_status = Decoder::no_error;
+ m_status = NullDecoder::no_error;
// try to load the string table
long cur_offset = ftell(file);
@@ -45,16 +45,16 @@ ElfSymbolTable::ElfSymbolTable(FILE* file, Elf_Shdr shdr) {
if (fseek(file, shdr.sh_offset, SEEK_SET) ||
fread((void*)m_symbols, shdr.sh_size, 1, file) != 1 ||
fseek(file, cur_offset, SEEK_SET)) {
- m_status = Decoder::file_invalid;
+ m_status = NullDecoder::file_invalid;
os::free(m_symbols);
m_symbols = NULL;
}
}
- if (m_status == Decoder::no_error) {
+ if (!NullDecoder::is_error(m_status)) {
memcpy(&m_shdr, &shdr, sizeof(Elf_Shdr));
}
} else {
- m_status = Decoder::file_invalid;
+ m_status = NullDecoder::file_invalid;
}
}
@@ -68,13 +68,13 @@ ElfSymbolTable::~ElfSymbolTable() {
}
}
-Decoder::decoder_status ElfSymbolTable::lookup(address addr, int* stringtableIndex, int* posIndex, int* offset) {
+bool ElfSymbolTable::lookup(address addr, int* stringtableIndex, int* posIndex, int* offset) {
assert(stringtableIndex, "null string table index pointer");
assert(posIndex, "null string table offset pointer");
assert(offset, "null offset pointer");
- if (m_status != Decoder::no_error) {
- return m_status;
+ if (NullDecoder::is_error(m_status)) {
+ return false;
}
address pc = 0;
@@ -97,8 +97,8 @@ Decoder::decoder_status ElfSymbolTable::lookup(address addr, int* stringtableInd
long cur_pos;
if ((cur_pos = ftell(m_file)) == -1 ||
fseek(m_file, m_shdr.sh_offset, SEEK_SET)) {
- m_status = Decoder::file_invalid;
- return m_status;
+ m_status = NullDecoder::file_invalid;
+ return false;
}
Elf_Sym sym;
@@ -114,13 +114,13 @@ Decoder::decoder_status ElfSymbolTable::lookup(address addr, int* stringtableInd
}
}
} else {
- m_status = Decoder::file_invalid;
- return m_status;
+ m_status = NullDecoder::file_invalid;
+ return false;
}
}
fseek(m_file, cur_pos, SEEK_SET);
}
- return m_status;
+ return true;
}
#endif // _WINDOWS
diff --git a/src/share/vm/utilities/elfSymbolTable.hpp b/src/share/vm/utilities/elfSymbolTable.hpp
index c8a11fca2..a149b99df 100644
--- a/src/share/vm/utilities/elfSymbolTable.hpp
+++ b/src/share/vm/utilities/elfSymbolTable.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -22,8 +22,8 @@
*
*/
-#ifndef __ELF_SYMBOL_TABLE_HPP
-#define __ELF_SYMBOL_TABLE_HPP
+#ifndef SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP
+#define SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP
#if !defined(_WINDOWS) && !defined(__APPLE__)
@@ -45,9 +45,9 @@ class ElfSymbolTable: public CHeapObj {
~ElfSymbolTable();
// search the symbol that is nearest to the specified address.
- Decoder::decoder_status lookup(address addr, int* stringtableIndex, int* posIndex, int* offset);
+ bool lookup(address addr, int* stringtableIndex, int* posIndex, int* offset);
- Decoder::decoder_status get_status() { return m_status; };
+ NullDecoder::decoder_status get_status() { return m_status; };
protected:
ElfSymbolTable* m_next;
@@ -62,9 +62,9 @@ class ElfSymbolTable: public CHeapObj {
// section header
Elf_Shdr m_shdr;
- Decoder::decoder_status m_status;
+ NullDecoder::decoder_status m_status;
};
-#endif // _WINDOWS
+#endif // _WINDOWS and _APPLE
-#endif // __ELF_SYMBOL_TABLE_HPP
+#endif // SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP
diff --git a/src/share/vm/utilities/globalDefinitions.hpp b/src/share/vm/utilities/globalDefinitions.hpp
index 1425912ce..89201f62f 100644
--- a/src/share/vm/utilities/globalDefinitions.hpp
+++ b/src/share/vm/utilities/globalDefinitions.hpp
@@ -298,6 +298,11 @@ const jushort max_jushort = (jushort)-1; // 0xFFFF largest jushort
const juint max_juint = (juint)-1; // 0xFFFFFFFF largest juint
const julong max_julong = (julong)-1; // 0xFF....FF largest julong
+typedef jbyte s1;
+typedef jshort s2;
+typedef jint s4;
+typedef jlong s8;
+
//----------------------------------------------------------------------------------------------------
// JVM spec restrictions
diff --git a/src/share/vm/utilities/vmError.cpp b/src/share/vm/utilities/vmError.cpp
index 94ed68ea8..a212f7646 100644
--- a/src/share/vm/utilities/vmError.cpp
+++ b/src/share/vm/utilities/vmError.cpp
@@ -571,8 +571,6 @@ void VMError::report(outputStream* st) {
if (fr.pc()) {
st->print_cr("Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)");
- // initialize decoder to decode C frames
- Decoder decoder;
int count = 0;
while (count++ < StackPrintLimit) {