Merge

Wed, 25 Jan 2012 19:26:35 -0500

author
dholmes
date
Wed, 25 Jan 2012 19:26:35 -0500
changeset 3525
d851f3714641
parent 3524
1ac084126285
parent 3441
5f3fcd591768
child 3527
f3fa16bd7159

Merge

src/os/bsd/vm/decoder_bsd.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Tue Jan 24 18:00:54 2012 -0500
     1.2 +++ b/.hgtags	Wed Jan 25 19:26:35 2012 -0500
     1.3 @@ -207,3 +207,9 @@
     1.4  a2fef924d8e6f37dac2a887315e3502876cc8e24 hs23-b08
     1.5  61165f53f1656b9f99e4fb806429bf98b99d59c3 jdk8-b18
     1.6  4bcf61041217f8677dcec18e90e9196acc945bba hs23-b09
     1.7 +9232e0ecbc2cec54dcc8f93004fb00c214446460 jdk8-b19
     1.8 +fe2c8764998112b7fefcd7d41599714813ae4327 jdk8-b20
     1.9 +9952d1c439d64c5fd4ad1236a63a62bd5a49d4c3 jdk8-b21
    1.10 +513351373923f74a7c91755748b95c9771e59f96 hs23-b10
    1.11 +24727fb37561779077fdfa5a33342246f20e5c0f jdk8-b22
    1.12 +dcc292399a39113957eebbd3e487b7e05e2c79fc hs23-b11
     2.1 --- a/make/Makefile	Tue Jan 24 18:00:54 2012 -0500
     2.2 +++ b/make/Makefile	Wed Jan 25 19:26:35 2012 -0500
     2.3 @@ -367,7 +367,7 @@
     2.4  $(EXPORT_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar
     2.5  	$(install-file)
     2.6  
     2.7 -# Include files (jvmti.h, jvmticmlr.h, jni.h, $(JDK_INCLUDE_SUBDIR)/jni_md.h, jmm.h)
     2.8 +# Include files (jvmti.h, jvmticmlr.h, jni.h, $(JDK_INCLUDE_SUBDIR)/jni_md.h, jmm.h, jfr.h)
     2.9  $(EXPORT_INCLUDE_DIR)/%: $(GEN_DIR)/jvmtifiles/%
    2.10  	$(install-file)
    2.11  
    2.12 @@ -384,6 +384,16 @@
    2.13  $(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/services/%
    2.14  	$(install-file)
    2.15  
    2.16 +JFR_EXISTS=$(shell if [ -d $(HS_ALT_SRC) ]; then echo 1; else echo 0; fi)
    2.17 +# export jfr.h
    2.18 +ifeq ($JFR_EXISTS,1)
    2.19 +$(EXPORT_INCLUDE_DIR)/%: $(HS_ALT_SRC)/share/vm/jfr/agent/%
    2.20 +	$(install-file)
    2.21 +else
    2.22 +$(EXPORT_INCLUDE_DIR)/jfr.h:
    2.23 +	
    2.24 +endif
    2.25 +
    2.26  # Doc files (jvmti.html)
    2.27  $(EXPORT_DOCS_DIR)/platform/jvmti/%: $(DOCS_DIR)/%
    2.28  	$(install-file)
     3.1 --- a/make/bsd/makefiles/vm.make	Tue Jan 24 18:00:54 2012 -0500
     3.2 +++ b/make/bsd/makefiles/vm.make	Wed Jan 25 19:26:35 2012 -0500
     3.3 @@ -96,6 +96,10 @@
     3.4  CPPFLAGS += -DDEFAULT_LIBPATH="\"$(DEFAULT_LIBPATH)\""
     3.5  endif
     3.6  
     3.7 +ifndef JAVASE_EMBEDDED
     3.8 +CFLAGS += -DINCLUDE_TRACE
     3.9 +endif
    3.10 +
    3.11  # CFLAGS_WARN holds compiler options to suppress/enable warnings.
    3.12  CFLAGS += $(CFLAGS_WARN/BYFILE)
    3.13  
    3.14 @@ -147,6 +151,12 @@
    3.15  SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
    3.16  SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
    3.17  
    3.18 +ifndef JAVASE_EMBEDDED
    3.19 +SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
    3.20 +  find $(HS_ALT_SRC)/share/vm/jfr -type d; \
    3.21 +  fi)
    3.22 +endif
    3.23 +
    3.24  CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
    3.25  CORE_PATHS+=$(GENERATED)/jvmtifiles
    3.26  
     4.1 --- a/make/defs.make	Tue Jan 24 18:00:54 2012 -0500
     4.2 +++ b/make/defs.make	Wed Jan 25 19:26:35 2012 -0500
     4.3 @@ -294,3 +294,7 @@
     4.4  EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jni.h
     4.5  EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h
     4.6  EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h
     4.7 +
     4.8 +ifndef JAVASE_EMBEDDED
     4.9 +EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jfr.h
    4.10 +endif
     5.1 --- a/make/hotspot_version	Tue Jan 24 18:00:54 2012 -0500
     5.2 +++ b/make/hotspot_version	Wed Jan 25 19:26:35 2012 -0500
     5.3 @@ -35,7 +35,7 @@
     5.4  
     5.5  HS_MAJOR_VER=23
     5.6  HS_MINOR_VER=0
     5.7 -HS_BUILD_NUMBER=10
     5.8 +HS_BUILD_NUMBER=12
     5.9  
    5.10  JDK_MAJOR_VER=1
    5.11  JDK_MINOR_VER=8
     6.1 --- a/make/linux/makefiles/vm.make	Tue Jan 24 18:00:54 2012 -0500
     6.2 +++ b/make/linux/makefiles/vm.make	Wed Jan 25 19:26:35 2012 -0500
     6.3 @@ -98,6 +98,10 @@
     6.4    ${JRE_VERSION}     \
     6.5    ${VM_DISTRO}
     6.6  
     6.7 +ifndef JAVASE_EMBEDDED
     6.8 +CFLAGS += -DINCLUDE_TRACE
     6.9 +endif
    6.10 +
    6.11  # CFLAGS_WARN holds compiler options to suppress/enable warnings.
    6.12  CFLAGS += $(CFLAGS_WARN/BYFILE)
    6.13  
    6.14 @@ -143,6 +147,12 @@
    6.15  SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
    6.16  SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
    6.17  
    6.18 +ifndef JAVASE_EMBEDDED
    6.19 +SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
    6.20 +  find $(HS_ALT_SRC)/share/vm/jfr -type d; \
    6.21 +  fi)
    6.22 +endif
    6.23 +
    6.24  CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
    6.25  CORE_PATHS+=$(GENERATED)/jvmtifiles
    6.26  
     7.1 --- a/make/solaris/makefiles/vm.make	Tue Jan 24 18:00:54 2012 -0500
     7.2 +++ b/make/solaris/makefiles/vm.make	Wed Jan 25 19:26:35 2012 -0500
     7.3 @@ -93,7 +93,7 @@
     7.4  CFLAGS += $(CFLAGS/NOEX)
     7.5  
     7.6  # Extra flags from gnumake's invocation or environment
     7.7 -CFLAGS += $(EXTRA_CFLAGS)
     7.8 +CFLAGS += $(EXTRA_CFLAGS) -DINCLUDE_TRACE
     7.9  
    7.10  # Math Library (libm.so), do not use -lm.
    7.11  #    There might be two versions of libm.so on the build system:
    7.12 @@ -160,6 +160,10 @@
    7.13  SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
    7.14  SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
    7.15  
    7.16 +SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
    7.17 +  find $(HS_ALT_SRC)/share/vm/jfr -type d; \
    7.18 +  fi)
    7.19 +
    7.20  CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
    7.21  CORE_PATHS+=$(GENERATED)/jvmtifiles
    7.22  
     8.1 --- a/make/windows/build.bat	Tue Jan 24 18:00:54 2012 -0500
     8.2 +++ b/make/windows/build.bat	Wed Jan 25 19:26:35 2012 -0500
     8.3 @@ -35,6 +35,8 @@
     8.4  if %errorlevel% == 0 goto isia64
     8.5  cl 2>&1 | grep "AMD64" >NUL
     8.6  if %errorlevel% == 0 goto amd64
     8.7 +cl 2>&1 | grep "x64" >NUL
     8.8 +if %errorlevel% == 0 goto amd64
     8.9  set ARCH=x86
    8.10  set BUILDARCH=i486
    8.11  set Platform_arch=x86
     9.1 --- a/make/windows/create_obj_files.sh	Tue Jan 24 18:00:54 2012 -0500
     9.2 +++ b/make/windows/create_obj_files.sh	Wed Jan 25 19:26:35 2012 -0500
     9.3 @@ -73,6 +73,13 @@
     9.4  
     9.5  BASE_PATHS="${BASE_PATHS} ${GENERATED}/jvmtifiles"
     9.6  
     9.7 +if [ -d "${ALTSRC}/share/vm/jfr" ]; then
     9.8 +  BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr/agent"
     9.9 +  BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr/agent/isolated_deps/util"
    9.10 +  BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr/jvm"
    9.11 +  BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr"
    9.12 +fi
    9.13 +
    9.14  CORE_PATHS="${BASE_PATHS}"
    9.15  # shared is already in BASE_PATHS. Should add vm/memory but that one is also in BASE_PATHS.
    9.16  if [ -d "${ALTSRC}/share/vm/gc_implementation" ]; then
    10.1 --- a/make/windows/makefiles/projectcreator.make	Tue Jan 24 18:00:54 2012 -0500
    10.2 +++ b/make/windows/makefiles/projectcreator.make	Wed Jan 25 19:26:35 2012 -0500
    10.3 @@ -58,7 +58,8 @@
    10.4          -absoluteInclude $(HOTSPOTBUILDSPACE)/%f/generated \
    10.5          -ignorePath $(HOTSPOTBUILDSPACE)/%f/generated \
    10.6          -ignorePath src\share\vm\adlc \
    10.7 -        -ignorePath src\share\vm\shark
    10.8 +        -ignorePath src\share\vm\shark \
    10.9 +        -ignorePath posix
   10.10  
   10.11  # This is referenced externally by both the IDE and batch builds
   10.12  ProjectCreatorOptions=
   10.13 @@ -88,7 +89,7 @@
   10.14          -jdkTargetRoot $(HOTSPOTJDKDIST) \
   10.15          -define ALIGN_STACK_FRAMES \
   10.16          -define VM_LITTLE_ENDIAN \
   10.17 -        -prelink  "" "Generating vm.def..." "cd $(HOTSPOTBUILDSPACE)\%f\%b	set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME)	$(HOTSPOTMKSHOME)\sh $(HOTSPOTWORKSPACE)\make\windows\build_vm_def.sh $(LINK_VER)" \
   10.18 +        -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)" \
   10.19          -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" \
   10.20          -ignoreFile jsig.c \
   10.21          -ignoreFile jvmtiEnvRecommended.cpp \
    11.1 --- a/make/windows/makefiles/vm.make	Tue Jan 24 18:00:54 2012 -0500
    11.2 +++ b/make/windows/makefiles/vm.make	Wed Jan 25 19:26:35 2012 -0500
    11.3 @@ -19,7 +19,7 @@
    11.4  # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    11.5  # or visit www.oracle.com if you need additional information or have any
    11.6  # questions.
    11.7 -#  
    11.8 +#
    11.9  #
   11.10  
   11.11  # Resource file containing VERSIONINFO
   11.12 @@ -30,7 +30,7 @@
   11.13  COMMONSRC=$(WorkSpace)\src
   11.14  ALTSRC=$(WorkSpace)\src\closed
   11.15  
   11.16 -!ifdef RELEASE 
   11.17 +!ifdef RELEASE
   11.18  !ifdef DEVELOP
   11.19  CPP_FLAGS=$(CPP_FLAGS) /D "DEBUG"
   11.20  !else
   11.21 @@ -74,6 +74,10 @@
   11.22  CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_BUILD_USER=\"$(BuildUser)\""
   11.23  CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_VM_DISTRO=\"$(HOTSPOT_VM_DISTRO)\""
   11.24  
   11.25 +!ifndef JAVASE_EMBEDDED
   11.26 +CPP_FLAGS=$(CPP_FLAGS) /D "INCLUDE_TRACE"
   11.27 +!endif
   11.28 +
   11.29  CPP_FLAGS=$(CPP_FLAGS) $(CPP_INCLUDE_DIRS)
   11.30  
   11.31  # Define that so jni.h is on correct side
   11.32 @@ -97,7 +101,7 @@
   11.33  !endif
   11.34  
   11.35  # If you modify exports below please do the corresponding changes in
   11.36 -# src/share/tools/ProjectCreator/WinGammaPlatformVC7.java 
   11.37 +# src/share/tools/ProjectCreator/WinGammaPlatformVC7.java
   11.38  LINK_FLAGS=$(LINK_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 \
   11.39    /export:JNI_GetDefaultJavaVMInitArgs       \
   11.40    /export:JNI_CreateJavaVM                   \
   11.41 @@ -170,6 +174,7 @@
   11.42  VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/prims
   11.43  VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/runtime
   11.44  VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/services
   11.45 +VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/trace
   11.46  VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/utilities
   11.47  VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/libadt
   11.48  VM_PATH=$(VM_PATH);$(WorkSpace)/src/os/windows/vm
   11.49 @@ -177,6 +182,13 @@
   11.50  VM_PATH=$(VM_PATH);$(WorkSpace)/src/cpu/$(Platform_arch)/vm
   11.51  VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/opto
   11.52  
   11.53 +!if exists($(ALTSRC)\share\vm\jfr)
   11.54 +VM_PATH=$(VM_PATH);$(ALTSRC)/share/vm/jfr/agent
   11.55 +VM_PATH=$(VM_PATH);$(ALTSRC)/share/vm/jfr/agent/isolated_deps/util
   11.56 +VM_PATH=$(VM_PATH);$(ALTSRC)/share/vm/jfr/jvm
   11.57 +VM_PATH=$(VM_PATH);$(ALTSRC)/share/vm/jfr
   11.58 +!endif
   11.59 +
   11.60  VM_PATH={$(VM_PATH)}
   11.61  
   11.62  # Special case files not using precompiled header files.
   11.63 @@ -263,6 +275,9 @@
   11.64  {$(COMMONSRC)\share\vm\services}.cpp.obj::
   11.65          $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
   11.66  
   11.67 +{$(COMMONSRC)\share\vm\trace}.cpp.obj::
   11.68 +        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
   11.69 +
   11.70  {$(COMMONSRC)\share\vm\utilities}.cpp.obj::
   11.71          $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
   11.72  
   11.73 @@ -340,6 +355,9 @@
   11.74  {$(ALTSRC)\share\vm\services}.cpp.obj::
   11.75          $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
   11.76  
   11.77 +{$(ALTSRC)\share\vm\trace}.cpp.obj::
   11.78 +        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
   11.79 +
   11.80  {$(ALTSRC)\share\vm\utilities}.cpp.obj::
   11.81          $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
   11.82  
   11.83 @@ -371,6 +389,18 @@
   11.84  {..\generated\jvmtifiles}.cpp.obj::
   11.85          $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
   11.86  
   11.87 +{$(ALTSRC)\share\vm\jfr}.cpp.obj::
   11.88 +        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
   11.89 +
   11.90 +{$(ALTSRC)\share\vm\jfr\agent}.cpp.obj::
   11.91 +        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
   11.92 +
   11.93 +{$(ALTSRC)\share\vm\jfr\agent\isolated_deps\util}.cpp.obj::
   11.94 +        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
   11.95 +
   11.96 +{$(ALTSRC)\share\vm\jfr\jvm}.cpp.obj::
   11.97 +        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
   11.98 +
   11.99  default::
  11.100  
  11.101  _build_pch_file.obj:
    12.1 --- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Tue Jan 24 18:00:54 2012 -0500
    12.2 +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Wed Jan 25 19:26:35 2012 -0500
    12.3 @@ -391,7 +391,7 @@
    12.4    __ call(Runtime1::entry_for(Runtime1::handle_exception_from_callee_id), relocInfo::runtime_call_type);
    12.5    __ delayed()->nop();
    12.6    __ should_not_reach_here();
    12.7 -  assert(code_offset() - offset <= exception_handler_size, "overflow");
    12.8 +  guarantee(code_offset() - offset <= exception_handler_size, "overflow");
    12.9    __ end_a_stub();
   12.10  
   12.11    return offset;
   12.12 @@ -474,8 +474,7 @@
   12.13    AddressLiteral deopt_blob(SharedRuntime::deopt_blob()->unpack());
   12.14    __ JUMP(deopt_blob, G3_scratch, 0); // sethi;jmp
   12.15    __ delayed()->nop();
   12.16 -  assert(code_offset() - offset <= deopt_handler_size, "overflow");
   12.17 -  debug_only(__ stop("should have gone to the caller");)
   12.18 +  guarantee(code_offset() - offset <= deopt_handler_size, "overflow");
   12.19    __ end_a_stub();
   12.20  
   12.21    return offset;
    13.1 --- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.hpp	Tue Jan 24 18:00:54 2012 -0500
    13.2 +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.hpp	Wed Jan 25 19:26:35 2012 -0500
    13.3 @@ -69,7 +69,7 @@
    13.4  #else
    13.5           call_stub_size = 20,
    13.6  #endif // _LP64
    13.7 -         exception_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(10*4),
    13.8 -         deopt_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(10*4) };
    13.9 +         exception_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(128),
   13.10 +         deopt_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(64)  };
   13.11  
   13.12  #endif // CPU_SPARC_VM_C1_LIRASSEMBLER_SPARC_HPP
    14.1 --- a/src/cpu/sparc/vm/frame_sparc.inline.hpp	Tue Jan 24 18:00:54 2012 -0500
    14.2 +++ b/src/cpu/sparc/vm/frame_sparc.inline.hpp	Wed Jan 25 19:26:35 2012 -0500
    14.3 @@ -1,5 +1,5 @@
    14.4  /*
    14.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    14.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    14.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.8   *
    14.9   * This code is free software; you can redistribute it and/or modify it
   14.10 @@ -82,6 +82,8 @@
   14.11  
   14.12  inline intptr_t*    frame::sender_sp() const  { return fp(); }
   14.13  
   14.14 +inline intptr_t* frame::real_fp() const { return fp(); }
   14.15 +
   14.16  // Used only in frame::oopmapreg_to_location
   14.17  // This return a value in VMRegImpl::slot_size
   14.18  inline int frame::pd_oop_map_offset_adjustment() const {
    15.1 --- a/src/cpu/sparc/vm/methodHandles_sparc.cpp	Tue Jan 24 18:00:54 2012 -0500
    15.2 +++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp	Wed Jan 25 19:26:35 2012 -0500
    15.3 @@ -1045,7 +1045,7 @@
    15.4           |(1<<java_lang_invoke_AdapterMethodHandle::OP_DROP_ARGS)
    15.5            // OP_COLLECT_ARGS is below...
    15.6           |(1<<java_lang_invoke_AdapterMethodHandle::OP_SPREAD_ARGS)
    15.7 -         |(!UseRicochetFrames ? 0 :
    15.8 +         |(
    15.9             java_lang_invoke_MethodTypeForm::vmlayout_offset_in_bytes() <= 0 ? 0 :
   15.10             ((1<<java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF)
   15.11             |(1<<java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS)
    16.1 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Tue Jan 24 18:00:54 2012 -0500
    16.2 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Wed Jan 25 19:26:35 2012 -0500
    16.3 @@ -406,7 +406,7 @@
    16.4    // search an exception handler (rax: exception oop, rdx: throwing pc)
    16.5    __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::handle_exception_from_callee_id)));
    16.6    __ should_not_reach_here();
    16.7 -  assert(code_offset() - offset <= exception_handler_size, "overflow");
    16.8 +  guarantee(code_offset() - offset <= exception_handler_size, "overflow");
    16.9    __ end_a_stub();
   16.10  
   16.11    return offset;
   16.12 @@ -490,8 +490,7 @@
   16.13  
   16.14    __ pushptr(here.addr());
   16.15    __ jump(RuntimeAddress(SharedRuntime::deopt_blob()->unpack()));
   16.16 -
   16.17 -  assert(code_offset() - offset <= deopt_handler_size, "overflow");
   16.18 +  guarantee(code_offset() - offset <= deopt_handler_size, "overflow");
   16.19    __ end_a_stub();
   16.20  
   16.21    return offset;
    17.1 --- a/src/cpu/x86/vm/frame_x86.cpp	Tue Jan 24 18:00:54 2012 -0500
    17.2 +++ b/src/cpu/x86/vm/frame_x86.cpp	Wed Jan 25 19:26:35 2012 -0500
    17.3 @@ -1,5 +1,5 @@
    17.4  /*
    17.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    17.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    17.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.8   *
    17.9   * This code is free software; you can redistribute it and/or modify it
   17.10 @@ -675,3 +675,21 @@
   17.11    // used to reset the saved FP
   17.12    return fp();
   17.13  }
   17.14 +
   17.15 +intptr_t* frame::real_fp() const {
   17.16 +  if (_cb != NULL) {
   17.17 +    // use the frame size if valid
   17.18 +    int size = _cb->frame_size();
   17.19 +    if ((size > 0) &&
   17.20 +        (! is_ricochet_frame())) {
   17.21 +      // Work-around: ricochet explicitly excluded because frame size is not
   17.22 +      // constant for the ricochet blob but its frame_size could not, for
   17.23 +      // some reasons, be declared as <= 0. This potentially confusing
   17.24 +      // size declaration should be fixed as another CR.
   17.25 +      return unextended_sp() + size;
   17.26 +    }
   17.27 +  }
   17.28 +  // else rely on fp()
   17.29 +  assert(! is_compiled_frame(), "unknown compiled frame size");
   17.30 +  return fp();
   17.31 +}
    18.1 --- a/src/cpu/x86/vm/frame_x86.hpp	Tue Jan 24 18:00:54 2012 -0500
    18.2 +++ b/src/cpu/x86/vm/frame_x86.hpp	Wed Jan 25 19:26:35 2012 -0500
    18.3 @@ -1,5 +1,5 @@
    18.4  /*
    18.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    18.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    18.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.8   *
    18.9   * This code is free software; you can redistribute it and/or modify it
   18.10 @@ -188,6 +188,7 @@
   18.11    frame(intptr_t* sp, intptr_t* fp);
   18.12  
   18.13    // accessors for the instance variables
   18.14 +  // Note: not necessarily the real 'frame pointer' (see real_fp)
   18.15    intptr_t*   fp() const { return _fp; }
   18.16  
   18.17    inline address* sender_pc_addr() const;
    19.1 --- a/src/cpu/x86/vm/methodHandles_x86.cpp	Tue Jan 24 18:00:54 2012 -0500
    19.2 +++ b/src/cpu/x86/vm/methodHandles_x86.cpp	Wed Jan 25 19:26:35 2012 -0500
    19.3 @@ -1005,7 +1005,7 @@
    19.4    intptr_t* base_sp = last_sp;
    19.5    typedef MethodHandles::RicochetFrame RicochetFrame;
    19.6    RicochetFrame* rfp = (RicochetFrame*)((address)saved_bp - RicochetFrame::sender_link_offset_in_bytes());
    19.7 -  if (!UseRicochetFrames || Universe::heap()->is_in((address) rfp->saved_args_base())) {
    19.8 +  if (Universe::heap()->is_in((address) rfp->saved_args_base())) {
    19.9      // Probably an interpreter frame.
   19.10      base_sp = (intptr_t*) saved_bp[frame::interpreter_frame_monitor_block_top_offset];
   19.11    }
   19.12 @@ -1104,7 +1104,7 @@
   19.13           |(1<<java_lang_invoke_AdapterMethodHandle::OP_DROP_ARGS)
   19.14            //OP_COLLECT_ARGS is below...
   19.15           |(1<<java_lang_invoke_AdapterMethodHandle::OP_SPREAD_ARGS)
   19.16 -         |(!UseRicochetFrames ? 0 :
   19.17 +         |(
   19.18             java_lang_invoke_MethodTypeForm::vmlayout_offset_in_bytes() <= 0 ? 0 :
   19.19             ((1<<java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF)
   19.20             |(1<<java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS)
    20.1 --- a/src/cpu/zero/vm/frame_zero.inline.hpp	Tue Jan 24 18:00:54 2012 -0500
    20.2 +++ b/src/cpu/zero/vm/frame_zero.inline.hpp	Wed Jan 25 19:26:35 2012 -0500
    20.3 @@ -1,5 +1,5 @@
    20.4  /*
    20.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    20.6 + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
    20.7   * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
    20.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.9   *
   20.10 @@ -72,6 +72,10 @@
   20.11    return fp() + 1;
   20.12  }
   20.13  
   20.14 +inline intptr_t* frame::real_fp() const {
   20.15 +  return fp();
   20.16 +}
   20.17 +
   20.18  inline intptr_t* frame::link() const {
   20.19    ShouldNotCallThis();
   20.20  }
    21.1 --- a/src/cpu/zero/vm/methodHandles_zero.hpp	Tue Jan 24 18:00:54 2012 -0500
    21.2 +++ b/src/cpu/zero/vm/methodHandles_zero.hpp	Wed Jan 25 19:26:35 2012 -0500
    21.3 @@ -29,43 +29,3 @@
    21.4    adapter_code_size = 0
    21.5  };
    21.6  
    21.7 -#define TARGET_ARCH_NYI_6939861 1
    21.8 -// ..#ifdef TARGET_ARCH_NYI_6939861
    21.9 -// ..  // Here are some backward compatible declarations until the 6939861 ports are updated.
   21.10 -// ..  #define _adapter_flyby    (_EK_LIMIT + 10)
   21.11 -// ..  #define _adapter_ricochet (_EK_LIMIT + 11)
   21.12 -// ..  #define _adapter_opt_spread_1    _adapter_opt_spread_1_ref
   21.13 -// ..  #define _adapter_opt_spread_more _adapter_opt_spread_ref
   21.14 -// ..  enum {
   21.15 -// ..    _INSERT_NO_MASK   = -1,
   21.16 -// ..    _INSERT_REF_MASK  = 0,
   21.17 -// ..    _INSERT_INT_MASK  = 1,
   21.18 -// ..    _INSERT_LONG_MASK = 3
   21.19 -// ..  };
   21.20 -// ..  static void get_ek_bound_mh_info(EntryKind ek, BasicType& arg_type, int& arg_mask, int& arg_slots) {
   21.21 -// ..    arg_type = ek_bound_mh_arg_type(ek);
   21.22 -// ..    arg_mask = 0;
   21.23 -// ..    arg_slots = type2size[arg_type];;
   21.24 -// ..  }
   21.25 -// ..  static void get_ek_adapter_opt_swap_rot_info(EntryKind ek, int& swap_bytes, int& rotate) {
   21.26 -// ..    int swap_slots = ek_adapter_opt_swap_slots(ek);
   21.27 -// ..    rotate = ek_adapter_opt_swap_mode(ek);
   21.28 -// ..    swap_bytes = swap_slots * Interpreter::stackElementSize;
   21.29 -// ..  }
   21.30 -// ..  static int get_ek_adapter_opt_spread_info(EntryKind ek) {
   21.31 -// ..    return ek_adapter_opt_spread_count(ek);
   21.32 -// ..  }
   21.33 -// ..
   21.34 -// ..  static void insert_arg_slots(MacroAssembler* _masm,
   21.35 -// ..                               RegisterOrConstant arg_slots,
   21.36 -// ..                               int arg_mask,
   21.37 -// ..                               Register argslot_reg,
   21.38 -// ..                               Register temp_reg, Register temp2_reg, Register temp3_reg = noreg);
   21.39 -// ..
   21.40 -// ..  static void remove_arg_slots(MacroAssembler* _masm,
   21.41 -// ..                               RegisterOrConstant arg_slots,
   21.42 -// ..                               Register argslot_reg,
   21.43 -// ..                               Register temp_reg, Register temp2_reg, Register temp3_reg = noreg);
   21.44 -// ..
   21.45 -// ..  static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN;
   21.46 -// ..#endif //TARGET_ARCH_NYI_6939861
    22.1 --- a/src/os/bsd/vm/decoder_bsd.cpp	Tue Jan 24 18:00:54 2012 -0500
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,66 +0,0 @@
    22.4 -/*
    22.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    22.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.7 - *
    22.8 - * This code is free software; you can redistribute it and/or modify it
    22.9 - * under the terms of the GNU General Public License version 2 only, as
   22.10 - * published by the Free Software Foundation.
   22.11 - *
   22.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   22.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   22.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   22.15 - * version 2 for more details (a copy is included in the LICENSE file that
   22.16 - * accompanied this code).
   22.17 - *
   22.18 - * You should have received a copy of the GNU General Public License version
   22.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   22.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   22.21 - *
   22.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   22.23 - * or visit www.oracle.com if you need additional information or have any
   22.24 - * questions.
   22.25 - *
   22.26 - */
   22.27 -
   22.28 -#include "prims/jvm.h"
   22.29 -#include "utilities/decoder.hpp"
   22.30 -
   22.31 -#include <cxxabi.h>
   22.32 -
   22.33 -#ifdef __APPLE__
   22.34 -
   22.35 -void Decoder::initialize() {
   22.36 -  _initialized = true;
   22.37 -}
   22.38 -
   22.39 -void Decoder::uninitialize() {
   22.40 -  _initialized = false;
   22.41 -}
   22.42 -
   22.43 -bool Decoder::can_decode_C_frame_in_vm() {
   22.44 -  return false;
   22.45 -}
   22.46 -
   22.47 -Decoder::decoder_status Decoder::decode(address addr, const char* filepath, char *buf, int buflen, int *offset) {
   22.48 -  return symbol_not_found;
   22.49 -}
   22.50 -
   22.51 -
   22.52 -#endif
   22.53 -
   22.54 -bool Decoder::demangle(const char* symbol, char *buf, int buflen) {
   22.55 -  int   status;
   22.56 -  char* result;
   22.57 -  size_t size = (size_t)buflen;
   22.58 -
   22.59 -  // Don't pass buf to __cxa_demangle. In case of the 'buf' is too small,
   22.60 -  // __cxa_demangle will call system "realloc" for additional memory, which
   22.61 -  // may use different malloc/realloc mechanism that allocates 'buf'.
   22.62 -  if ((result = abi::__cxa_demangle(symbol, NULL, NULL, &status)) != NULL) {
   22.63 -    jio_snprintf(buf, buflen, "%s", result);
   22.64 -      // call c library's free
   22.65 -      ::free(result);
   22.66 -      return true;
   22.67 -  }
   22.68 -  return false;
   22.69 -}
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/src/os/bsd/vm/decoder_machO.cpp	Wed Jan 25 19:26:35 2012 -0500
    23.3 @@ -0,0 +1,31 @@
    23.4 +/*
    23.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    23.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.7 + *
    23.8 + * This code is free software; you can redistribute it and/or modify it
    23.9 + * under the terms of the GNU General Public License version 2 only, as
   23.10 + * published by the Free Software Foundation.
   23.11 + *
   23.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   23.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   23.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   23.15 + * version 2 for more details (a copy is included in the LICENSE file that
   23.16 + * accompanied this code).
   23.17 + *
   23.18 + * You should have received a copy of the GNU General Public License version
   23.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   23.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   23.21 + *
   23.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   23.23 + * or visit www.oracle.com if you need additional information or have any
   23.24 + * questions.
   23.25 + *
   23.26 + */
   23.27 +
   23.28 +#include "precompiled.hpp"
   23.29 +
   23.30 +#ifdef __APPLE__
   23.31 +#include "decoder_machO.hpp"
   23.32 +#endif
   23.33 +
   23.34 +
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/src/os/bsd/vm/decoder_machO.hpp	Wed Jan 25 19:26:35 2012 -0500
    24.3 @@ -0,0 +1,42 @@
    24.4 +/*
    24.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    24.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.7 + *
    24.8 + * This code is free software; you can redistribute it and/or modify it
    24.9 + * under the terms of the GNU General Public License version 2 only, as
   24.10 + * published by the Free Software Foundation.
   24.11 + *
   24.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   24.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   24.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   24.15 + * version 2 for more details (a copy is included in the LICENSE file that
   24.16 + * accompanied this code).
   24.17 + *
   24.18 + * You should have received a copy of the GNU General Public License version
   24.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   24.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   24.21 + *
   24.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   24.23 + * or visit www.oracle.com if you need additional information or have any
   24.24 + * questions.
   24.25 + *
   24.26 + */
   24.27 +
   24.28 +#ifndef OS_BSD_VM_DECODER_MACHO_HPP
   24.29 +#define OS_BSD_VM_DECODER_MACHO_HPP
   24.30 +
   24.31 +#ifdef __APPLE__
   24.32 +
   24.33 +#include "utilities/decoder.hpp"
   24.34 +
   24.35 +// Just a placehold for now
   24.36 +class MachODecoder: public NullDecoder {
   24.37 +public:
   24.38 +  MachODecoder() { }
   24.39 +  ~MachODecoder() { }
   24.40 +};
   24.41 +
   24.42 +#endif
   24.43 +
   24.44 +#endif // OS_BSD_VM_DECODER_MACHO_HPP
   24.45 +
    25.1 --- a/src/os/bsd/vm/os_bsd.cpp	Tue Jan 24 18:00:54 2012 -0500
    25.2 +++ b/src/os/bsd/vm/os_bsd.cpp	Wed Jan 25 19:26:35 2012 -0500
    25.3 @@ -1920,7 +1920,7 @@
    25.4      return true;
    25.5    } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
    25.6      if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
    25.7 -       dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) {
    25.8 +       buf, buflen, offset, dlinfo.dli_fname)) {
    25.9         return true;
   25.10      }
   25.11    }
    26.1 --- a/src/os/linux/vm/decoder_linux.cpp	Tue Jan 24 18:00:54 2012 -0500
    26.2 +++ b/src/os/linux/vm/decoder_linux.cpp	Wed Jan 25 19:26:35 2012 -0500
    26.3 @@ -23,11 +23,11 @@
    26.4   */
    26.5  
    26.6  #include "prims/jvm.h"
    26.7 -#include "utilities/decoder.hpp"
    26.8 +#include "utilities/decoder_elf.hpp"
    26.9  
   26.10  #include <cxxabi.h>
   26.11  
   26.12 -bool Decoder::demangle(const char* symbol, char *buf, int buflen) {
   26.13 +bool ElfDecoder::demangle(const char* symbol, char *buf, int buflen) {
   26.14    int   status;
   26.15    char* result;
   26.16    size_t size = (size_t)buflen;
   26.17 @@ -43,3 +43,4 @@
   26.18    }
   26.19    return false;
   26.20  }
   26.21 +
    27.1 --- a/src/os/linux/vm/os_linux.cpp	Tue Jan 24 18:00:54 2012 -0500
    27.2 +++ b/src/os/linux/vm/os_linux.cpp	Wed Jan 25 19:26:35 2012 -0500
    27.3 @@ -1732,7 +1732,7 @@
    27.4      return true;
    27.5    } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
    27.6      if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
    27.7 -       dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) {
    27.8 +        buf, buflen, offset, dlinfo.dli_fname)) {
    27.9         return true;
   27.10      }
   27.11    }
    28.1 --- a/src/os/solaris/vm/decoder_solaris.cpp	Tue Jan 24 18:00:54 2012 -0500
    28.2 +++ b/src/os/solaris/vm/decoder_solaris.cpp	Wed Jan 25 19:26:35 2012 -0500
    28.3 @@ -22,10 +22,11 @@
    28.4   *
    28.5   */
    28.6  
    28.7 -#include "utilities/decoder.hpp"
    28.8 +#include "utilities/decoder_elf.hpp"
    28.9  
   28.10  #include <demangle.h>
   28.11  
   28.12 -bool Decoder::demangle(const char* symbol, char *buf, int buflen) {
   28.13 +bool ElfDecoder::demangle(const char* symbol, char *buf, int buflen) {
   28.14    return !cplus_demangle(symbol, buf, (size_t)buflen);
   28.15  }
   28.16 +
    29.1 --- a/src/os/solaris/vm/os_solaris.cpp	Tue Jan 24 18:00:54 2012 -0500
    29.2 +++ b/src/os/solaris/vm/os_solaris.cpp	Wed Jan 25 19:26:35 2012 -0500
    29.3 @@ -1997,7 +1997,7 @@
    29.4        }
    29.5        if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
    29.6          if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
    29.7 -          dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) {
    29.8 +           buf, buflen, offset, dlinfo.dli_fname)) {
    29.9            return true;
   29.10          }
   29.11        }
   29.12 @@ -2015,7 +2015,7 @@
   29.13          return true;
   29.14        } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
   29.15          if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
   29.16 -          dlinfo.dli_fname, buf, buflen, offset) == Decoder::no_error) {
   29.17 +          buf, buflen, offset, dlinfo.dli_fname)) {
   29.18            return true;
   29.19          }
   29.20        }
    30.1 --- a/src/os/windows/vm/decoder_windows.cpp	Tue Jan 24 18:00:54 2012 -0500
    30.2 +++ b/src/os/windows/vm/decoder_windows.cpp	Wed Jan 25 19:26:35 2012 -0500
    30.3 @@ -1,5 +1,5 @@
    30.4  /*
    30.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    30.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    30.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.8   *
    30.9   * This code is free software; you can redistribute it and/or modify it
   30.10 @@ -24,22 +24,24 @@
   30.11  
   30.12  #include "precompiled.hpp"
   30.13  #include "prims/jvm.h"
   30.14 -#include "runtime/os.hpp"
   30.15 -#include "utilities/decoder.hpp"
   30.16 +#include "decoder_windows.hpp"
   30.17  
   30.18 -HMODULE                   Decoder::_dbghelp_handle = NULL;
   30.19 -bool                      Decoder::_can_decode_in_vm = false;
   30.20 -pfn_SymGetSymFromAddr64   Decoder::_pfnSymGetSymFromAddr64 = NULL;
   30.21 -pfn_UndecorateSymbolName  Decoder::_pfnUndecorateSymbolName = NULL;
   30.22 +WindowsDecoder::WindowsDecoder() {
   30.23 +  _dbghelp_handle = NULL;
   30.24 +  _can_decode_in_vm = false;
   30.25 +  _pfnSymGetSymFromAddr64 = NULL;
   30.26 +  _pfnUndecorateSymbolName = NULL;
   30.27  
   30.28 -void Decoder::initialize() {
   30.29 -  if (!_initialized) {
   30.30 -    _initialized = true;
   30.31 +  _decoder_status = no_error;
   30.32 +  initialize();
   30.33 +}
   30.34  
   30.35 -    HINSTANCE handle = os::win32::load_Windows_dll("dbghelp.dll", NULL, 0);
   30.36 +void WindowsDecoder::initialize() {
   30.37 +  if (!has_error() && _dbghelp_handle == NULL) {
   30.38 +    HMODULE handle = ::LoadLibrary("dbghelp.dll");
   30.39      if (!handle) {
   30.40        _decoder_status = helper_not_found;
   30.41 -        return;
   30.42 +      return;
   30.43      }
   30.44  
   30.45      _dbghelp_handle = handle;
   30.46 @@ -70,32 +72,29 @@
   30.47  
   30.48       // find out if jvm.dll contains private symbols, by decoding
   30.49       // current function and comparing the result
   30.50 -     address addr = (address)Decoder::initialize;
   30.51 +     address addr = (address)Decoder::decode;
   30.52       char buf[MAX_PATH];
   30.53 -     if (decode(addr, buf, sizeof(buf), NULL) == no_error) {
   30.54 -       _can_decode_in_vm = !strcmp(buf, "Decoder::initialize");
   30.55 +     if (decode(addr, buf, sizeof(buf), NULL)) {
   30.56 +       _can_decode_in_vm = !strcmp(buf, "Decoder::decode");
   30.57       }
   30.58    }
   30.59  }
   30.60  
   30.61 -void Decoder::uninitialize() {
   30.62 -  assert(_initialized, "Decoder not yet initialized");
   30.63 +void WindowsDecoder::uninitialize() {
   30.64    _pfnSymGetSymFromAddr64 = NULL;
   30.65    _pfnUndecorateSymbolName = NULL;
   30.66    if (_dbghelp_handle != NULL) {
   30.67      ::FreeLibrary(_dbghelp_handle);
   30.68    }
   30.69 -  _initialized = false;
   30.70 +  _dbghelp_handle = NULL;
   30.71  }
   30.72  
   30.73 -bool Decoder::can_decode_C_frame_in_vm() {
   30.74 -  initialize();
   30.75 -  return  _can_decode_in_vm;
   30.76 +bool WindowsDecoder::can_decode_C_frame_in_vm() const {
   30.77 +  return  (!has_error() && _can_decode_in_vm);
   30.78  }
   30.79  
   30.80  
   30.81 -Decoder::decoder_status Decoder::decode(address addr, char *buf, int buflen, int *offset) {
   30.82 -  assert(_initialized, "Decoder not yet initialized");
   30.83 +bool WindowsDecoder::decode(address addr, char *buf, int buflen, int* offset, const char* modulepath)  {
   30.84    if (_pfnSymGetSymFromAddr64 != NULL) {
   30.85      PIMAGEHLP_SYMBOL64 pSymbol;
   30.86      char symbolInfo[MAX_PATH + sizeof(IMAGEHLP_SYMBOL64)];
   30.87 @@ -105,19 +104,20 @@
   30.88      DWORD64 displacement;
   30.89      if (_pfnSymGetSymFromAddr64(::GetCurrentProcess(), (DWORD64)addr, &displacement, pSymbol)) {
   30.90        if (buf != NULL) {
   30.91 -        if (!demangle(pSymbol->Name, buf, buflen)) {
   30.92 +        if (demangle(pSymbol->Name, buf, buflen)) {
   30.93            jio_snprintf(buf, buflen, "%s", pSymbol->Name);
   30.94          }
   30.95        }
   30.96 -      if (offset != NULL) *offset = (int)displacement;
   30.97 -      return no_error;
   30.98 +      if(offset != NULL) *offset = (int)displacement;
   30.99 +      return true;
  30.100      }
  30.101    }
  30.102 -  return helper_not_found;
  30.103 +  if (buf != NULL && buflen > 0) buf[0] = '\0';
  30.104 +  if (offset != NULL) *offset = -1;
  30.105 +  return false;
  30.106  }
  30.107  
  30.108 -bool Decoder::demangle(const char* symbol, char *buf, int buflen) {
  30.109 -  assert(_initialized, "Decoder not yet initialized");
  30.110 +bool WindowsDecoder::demangle(const char* symbol, char *buf, int buflen) {
  30.111    return _pfnUndecorateSymbolName != NULL &&
  30.112           _pfnUndecorateSymbolName(symbol, buf, buflen, UNDNAME_COMPLETE);
  30.113  }
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/src/os/windows/vm/decoder_windows.hpp	Wed Jan 25 19:26:35 2012 -0500
    31.3 @@ -0,0 +1,61 @@
    31.4 +/*
    31.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    31.7 + *
    31.8 + * This code is free software; you can redistribute it and/or modify it
    31.9 + * under the terms of the GNU General Public License version 2 only, as
   31.10 + * published by the Free Software Foundation.
   31.11 + *
   31.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   31.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   31.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   31.15 + * version 2 for more details (a copy is included in the LICENSE file that
   31.16 + * accompanied this code).
   31.17 + *
   31.18 + * You should have received a copy of the GNU General Public License version
   31.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   31.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   31.21 + *
   31.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   31.23 + * or visit www.oracle.com if you need additional information or have any
   31.24 + * questions.
   31.25 + *
   31.26 + */
   31.27 +
   31.28 +#ifndef OS_WINDOWS_VM_DECODER_WINDOWS_HPP
   31.29 +#define OS_WINDOWS_VM_DECIDER_WINDOWS_HPP
   31.30 +
   31.31 +#include <windows.h>
   31.32 +#include <imagehlp.h>
   31.33 +
   31.34 +#include "utilities/decoder.hpp"
   31.35 +
   31.36 +// functions needed for decoding symbols
   31.37 +typedef DWORD (WINAPI *pfn_SymSetOptions)(DWORD);
   31.38 +typedef BOOL  (WINAPI *pfn_SymInitialize)(HANDLE, PCTSTR, BOOL);
   31.39 +typedef BOOL  (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
   31.40 +typedef DWORD (WINAPI *pfn_UndecorateSymbolName)(const char*, char*, DWORD, DWORD);
   31.41 +
   31.42 +class WindowsDecoder: public NullDecoder {
   31.43 +
   31.44 +public:
   31.45 +  WindowsDecoder();
   31.46 +  ~WindowsDecoder() { uninitialize(); };
   31.47 +
   31.48 +  bool can_decode_C_frame_in_vm() const;
   31.49 +  bool demangle(const char* symbol, char *buf, int buflen);
   31.50 +  bool decode(address addr, char *buf, int buflen, int* offset, const char* modulepath = NULL);
   31.51 +
   31.52 +private:
   31.53 +  void initialize();
   31.54 +  void uninitialize();
   31.55 +
   31.56 +private:
   31.57 +  HMODULE                   _dbghelp_handle;
   31.58 +  bool                      _can_decode_in_vm;
   31.59 +  pfn_SymGetSymFromAddr64   _pfnSymGetSymFromAddr64;
   31.60 +  pfn_UndecorateSymbolName  _pfnUndecorateSymbolName;
   31.61 +};
   31.62 +
   31.63 +#endif // OS_WINDOWS_VM_DECODER_WINDOWS_HPP
   31.64 +
    32.1 --- a/src/os/windows/vm/os_windows.cpp	Tue Jan 24 18:00:54 2012 -0500
    32.2 +++ b/src/os/windows/vm/os_windows.cpp	Wed Jan 25 19:26:35 2012 -0500
    32.3 @@ -1391,7 +1391,7 @@
    32.4  
    32.5  bool os::dll_address_to_function_name(address addr, char *buf,
    32.6                                        int buflen, int *offset) {
    32.7 -  if (Decoder::decode(addr, buf, buflen, offset) == Decoder::no_error) {
    32.8 +  if (Decoder::decode(addr, buf, buflen, offset)) {
    32.9      return true;
   32.10    }
   32.11    if (offset != NULL)  *offset  = -1;
    33.1 --- a/src/share/vm/classfile/symbolTable.cpp	Tue Jan 24 18:00:54 2012 -0500
    33.2 +++ b/src/share/vm/classfile/symbolTable.cpp	Wed Jan 25 19:26:35 2012 -0500
    33.3 @@ -204,6 +204,24 @@
    33.4    return s;
    33.5  }
    33.6  
    33.7 +// Look up the address of the literal in the SymbolTable for this Symbol*
    33.8 +// Do not create any new symbols
    33.9 +// Do not increment the reference count to keep this alive
   33.10 +Symbol** SymbolTable::lookup_symbol_addr(Symbol* sym){
   33.11 +  unsigned int hash = hash_symbol((char*)sym->bytes(), sym->utf8_length());
   33.12 +  int index = the_table()->hash_to_index(hash);
   33.13 +
   33.14 +  for (HashtableEntry<Symbol*>* e = the_table()->bucket(index); e != NULL; e = e->next()) {
   33.15 +    if (e->hash() == hash) {
   33.16 +      Symbol* literal_sym = e->literal();
   33.17 +      if (sym == literal_sym) {
   33.18 +        return e->literal_addr();
   33.19 +      }
   33.20 +    }
   33.21 +  }
   33.22 +  return NULL;
   33.23 +}
   33.24 +
   33.25  // Suggestion: Push unicode-based lookup all the way into the hashing
   33.26  // and probing logic, so there is no need for convert_to_utf8 until
   33.27  // an actual new Symbol* is created.
    34.1 --- a/src/share/vm/classfile/symbolTable.hpp	Tue Jan 24 18:00:54 2012 -0500
    34.2 +++ b/src/share/vm/classfile/symbolTable.hpp	Wed Jan 25 19:26:35 2012 -0500
    34.3 @@ -144,6 +144,9 @@
    34.4  
    34.5    static void release(Symbol* sym);
    34.6  
    34.7 +  // Look up the address of the literal in the SymbolTable for this Symbol*
    34.8 +  static Symbol** lookup_symbol_addr(Symbol* sym);
    34.9 +
   34.10    // jchar (utf16) version of lookups
   34.11    static Symbol* lookup_unicode(const jchar* name, int len, TRAPS);
   34.12    static Symbol* lookup_only_unicode(const jchar* name, int len, unsigned int& hash);
    35.1 --- a/src/share/vm/classfile/systemDictionary.cpp	Tue Jan 24 18:00:54 2012 -0500
    35.2 +++ b/src/share/vm/classfile/systemDictionary.cpp	Wed Jan 25 19:26:35 2012 -0500
    35.3 @@ -2131,6 +2131,12 @@
    35.4      }
    35.5    }
    35.6  
    35.7 +  // Assign a classid if one has not already been assigned.  The
    35.8 +  // counter does not need to be atomically incremented since this
    35.9 +  // is only done while holding the SystemDictionary_lock.
   35.10 +  // All loaded classes get a unique ID.
   35.11 +  TRACE_INIT_ID(k);
   35.12 +
   35.13    // Check for a placeholder. If there, remove it and make a
   35.14    // new system dictionary entry.
   35.15    placeholders()->find_and_remove(p_index, p_hash, name, class_loader, THREAD);
    36.1 --- a/src/share/vm/oops/klass.cpp	Tue Jan 24 18:00:54 2012 -0500
    36.2 +++ b/src/share/vm/oops/klass.cpp	Wed Jan 25 19:26:35 2012 -0500
    36.3 @@ -158,6 +158,9 @@
    36.4    kl->set_next_sibling(NULL);
    36.5    kl->set_alloc_count(0);
    36.6    kl->set_alloc_size(0);
    36.7 +#ifdef TRACE_SET_KLASS_TRACE_ID
    36.8 +  TRACE_SET_KLASS_TRACE_ID(kl, 0);
    36.9 +#endif
   36.10  
   36.11    kl->set_prototype_header(markOopDesc::prototype());
   36.12    kl->set_biased_lock_revocation_count(0);
    37.1 --- a/src/share/vm/oops/klass.hpp	Tue Jan 24 18:00:54 2012 -0500
    37.2 +++ b/src/share/vm/oops/klass.hpp	Wed Jan 25 19:26:35 2012 -0500
    37.3 @@ -33,6 +33,7 @@
    37.4  #include "oops/klassPS.hpp"
    37.5  #include "oops/oop.hpp"
    37.6  #include "runtime/orderAccess.hpp"
    37.7 +#include "trace/traceMacros.hpp"
    37.8  #include "utilities/accessFlags.hpp"
    37.9  #ifndef SERIALGC
   37.10  #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp"
   37.11 @@ -80,6 +81,7 @@
   37.12  //    [last_biased_lock_bulk_revocation_time] (64 bits)
   37.13  //    [prototype_header]
   37.14  //    [biased_lock_revocation_count]
   37.15 +//    [trace_id]
   37.16  
   37.17  
   37.18  // Forward declarations.
   37.19 @@ -263,6 +265,9 @@
   37.20    markOop  _prototype_header;   // Used when biased locking is both enabled and disabled for this type
   37.21    jint     _biased_lock_revocation_count;
   37.22  
   37.23 +#ifdef TRACE_DEFINE_KLASS_TRACE_ID
   37.24 +  TRACE_DEFINE_KLASS_TRACE_ID;
   37.25 +#endif
   37.26   public:
   37.27  
   37.28    // returns the enclosing klassOop
   37.29 @@ -683,6 +688,9 @@
   37.30    jlong last_biased_lock_bulk_revocation_time() { return _last_biased_lock_bulk_revocation_time; }
   37.31    void  set_last_biased_lock_bulk_revocation_time(jlong cur_time) { _last_biased_lock_bulk_revocation_time = cur_time; }
   37.32  
   37.33 +#ifdef TRACE_DEFINE_KLASS_METHODS
   37.34 +  TRACE_DEFINE_KLASS_METHODS;
   37.35 +#endif
   37.36  
   37.37    // garbage collection support
   37.38    virtual void follow_weak_klass_links(
    38.1 --- a/src/share/vm/oops/methodKlass.cpp	Tue Jan 24 18:00:54 2012 -0500
    38.2 +++ b/src/share/vm/oops/methodKlass.cpp	Wed Jan 25 19:26:35 2012 -0500
    38.3 @@ -83,6 +83,7 @@
    38.4    m->set_max_stack(0);
    38.5    m->set_max_locals(0);
    38.6    m->set_intrinsic_id(vmIntrinsics::_none);
    38.7 +  m->set_jfr_towrite(false);
    38.8    m->set_method_data(NULL);
    38.9    m->set_interpreter_throwout_count(0);
   38.10    m->set_vtable_index(methodOopDesc::garbage_vtable_index);
    39.1 --- a/src/share/vm/oops/methodOop.hpp	Tue Jan 24 18:00:54 2012 -0500
    39.2 +++ b/src/share/vm/oops/methodOop.hpp	Wed Jan 25 19:26:35 2012 -0500
    39.3 @@ -77,7 +77,7 @@
    39.4  // | method_size             | max_stack                  |
    39.5  // | max_locals              | size_of_parameters         |
    39.6  // |------------------------------------------------------|
    39.7 -// | intrinsic_id, (unused)  |  throwout_count            |
    39.8 +// |intrinsic_id|   flags    |  throwout_count            |
    39.9  // |------------------------------------------------------|
   39.10  // | num_breakpoints         |  (unused)                  |
   39.11  // |------------------------------------------------------|
   39.12 @@ -124,6 +124,8 @@
   39.13    u2                _max_locals;                 // Number of local variables used by this method
   39.14    u2                _size_of_parameters;         // size of the parameter block (receiver + arguments) in words
   39.15    u1                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
   39.16 +  u1                _jfr_towrite : 1,            // Flags
   39.17 +                                 : 7;
   39.18    u2                _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
   39.19    u2                _number_of_breakpoints;      // fullspeed debugging support
   39.20    InvocationCounter _invocation_counter;         // Incremented before each activation of the method - used to trigger frequency-based optimizations
   39.21 @@ -225,6 +227,7 @@
   39.22    void clear_number_of_breakpoints()             { _number_of_breakpoints = 0; }
   39.23  
   39.24    // index into instanceKlass methods() array
   39.25 +  // note: also used by jfr
   39.26    u2 method_idnum() const           { return constMethod()->method_idnum(); }
   39.27    void set_method_idnum(u2 idnum)   { constMethod()->set_method_idnum(idnum); }
   39.28  
   39.29 @@ -650,6 +653,9 @@
   39.30    void init_intrinsic_id();     // updates from _none if a match
   39.31    static vmSymbols::SID klass_id_for_intrinsics(klassOop holder);
   39.32  
   39.33 +  bool jfr_towrite()                 { return _jfr_towrite; }
   39.34 +  void set_jfr_towrite(bool towrite) { _jfr_towrite = towrite; }
   39.35 +
   39.36    // On-stack replacement support
   39.37    bool has_osr_nmethod(int level, bool match_level) {
   39.38     return instanceKlass::cast(method_holder())->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL;
    40.1 --- a/src/share/vm/opto/callnode.cpp	Tue Jan 24 18:00:54 2012 -0500
    40.2 +++ b/src/share/vm/opto/callnode.cpp	Wed Jan 25 19:26:35 2012 -0500
    40.3 @@ -1625,21 +1625,20 @@
    40.4  
    40.5  //=============================================================================
    40.6  bool LockNode::is_nested_lock_region() {
    40.7 -  Node* box = box_node();
    40.8 -  if (!box->is_BoxLock() || box->as_BoxLock()->stack_slot() <= 0)
    40.9 +  BoxLockNode* box = box_node()->as_BoxLock();
   40.10 +  int stk_slot = box->stack_slot();
   40.11 +  if (stk_slot <= 0)
   40.12      return false; // External lock or it is not Box (Phi node).
   40.13  
   40.14    // Ignore complex cases: merged locks or multiple locks.
   40.15 -  BoxLockNode* box_lock = box->as_BoxLock();
   40.16    Node* obj = obj_node();
   40.17    LockNode* unique_lock = NULL;
   40.18 -  if (!box_lock->is_simple_lock_region(&unique_lock, obj) ||
   40.19 +  if (!box->is_simple_lock_region(&unique_lock, obj) ||
   40.20        (unique_lock != this)) {
   40.21      return false;
   40.22    }
   40.23  
   40.24    // Look for external lock for the same object.
   40.25 -  int stk_slot = box_lock->stack_slot();
   40.26    SafePointNode* sfn = this->as_SafePoint();
   40.27    JVMState* youngest_jvms = sfn->jvms();
   40.28    int max_depth = youngest_jvms->depth();
   40.29 @@ -1649,7 +1648,7 @@
   40.30      // Loop over monitors
   40.31      for (int idx = 0; idx < num_mon; idx++) {
   40.32        Node* obj_node = sfn->monitor_obj(jvms, idx);
   40.33 -      BoxLockNode* box_node = BoxLockNode::box_node(sfn->monitor_box(jvms, idx));
   40.34 +      BoxLockNode* box_node = sfn->monitor_box(jvms, idx)->as_BoxLock();
   40.35        if ((box_node->stack_slot() < stk_slot) && obj_node->eqv_uncast(obj)) {
   40.36          return true;
   40.37        }
    41.1 --- a/src/share/vm/opto/locknode.cpp	Tue Jan 24 18:00:54 2012 -0500
    41.2 +++ b/src/share/vm/opto/locknode.cpp	Wed Jan 25 19:26:35 2012 -0500
    41.3 @@ -63,7 +63,7 @@
    41.4  }
    41.5  
    41.6  BoxLockNode* BoxLockNode::box_node(Node* box) {
    41.7 -  // Chase down the BoxNode
    41.8 +  // Chase down the BoxNode after RA which may spill box nodes.
    41.9    while (!box->is_BoxLock()) {
   41.10      //    if (box_node->is_SpillCopy()) {
   41.11      //      Node *m = box_node->in(1);
   41.12 @@ -84,18 +84,13 @@
   41.13    return box_node(box)->in_RegMask(0).find_first_elem();
   41.14  }
   41.15  
   41.16 -bool BoxLockNode::same_slot(Node* box1, Node* box2) {
   41.17 -  return box_node(box1)->_slot == box_node(box2)->_slot;
   41.18 -}
   41.19 -
   41.20  // Is BoxLock node used for one simple lock region (same box and obj)?
   41.21  bool BoxLockNode::is_simple_lock_region(LockNode** unique_lock, Node* obj) {
   41.22    LockNode* lock = NULL;
   41.23    bool has_one_lock = false;
   41.24    for (uint i = 0; i < this->outcnt(); i++) {
   41.25      Node* n = this->raw_out(i);
   41.26 -    if (n->is_Phi())
   41.27 -      return false; // Merged regions
   41.28 +    assert(!n->is_Phi(), "should not merge BoxLock nodes");
   41.29      if (n->is_AbstractLock()) {
   41.30        AbstractLockNode* alock = n->as_AbstractLock();
   41.31        // Check lock's box since box could be referenced by Lock's debug info.
   41.32 @@ -123,23 +118,12 @@
   41.33        FastLockNode* flock = n->as_FastLock();
   41.34        assert((flock->box_node() == this) && flock->obj_node()->eqv_uncast(obj),"");
   41.35      }
   41.36 -    if (n->is_SafePoint() && n->as_SafePoint()->jvms()) {
   41.37 -      SafePointNode* sfn = n->as_SafePoint();
   41.38 -      JVMState* youngest_jvms = sfn->jvms();
   41.39 -      int max_depth = youngest_jvms->depth();
   41.40 -      for (int depth = 1; depth <= max_depth; depth++) {
   41.41 -        JVMState* jvms = youngest_jvms->of_depth(depth);
   41.42 -        int num_mon  = jvms->nof_monitors();
   41.43 -        // Loop over monitors
   41.44 -        for (int idx = 0; idx < num_mon; idx++) {
   41.45 -          Node* obj_node = sfn->monitor_obj(jvms, idx);
   41.46 -          Node* box_node = sfn->monitor_box(jvms, idx);
   41.47 -          if (box_node == this) {
   41.48 -            assert(obj_node->eqv_uncast(obj),"");
   41.49 -          }
   41.50 -        }
   41.51 -      }
   41.52 -    }
   41.53 +    // Don't check monitor info in safepoints since the referenced object could
   41.54 +    // be different from the locked object. It could be Phi node of different
   41.55 +    // cast nodes which point to this locked object.
   41.56 +    // We assume that no other objects could be referenced in monitor info
   41.57 +    // associated with this BoxLock node because all associated locks and
   41.58 +    // unlocks are reference only this one object.
   41.59    }
   41.60  #endif
   41.61    if (unique_lock != NULL && has_one_lock) {
    42.1 --- a/src/share/vm/opto/locknode.hpp	Tue Jan 24 18:00:54 2012 -0500
    42.2 +++ b/src/share/vm/opto/locknode.hpp	Wed Jan 25 19:26:35 2012 -0500
    42.3 @@ -49,9 +49,9 @@
    42.4  
    42.5  //------------------------------BoxLockNode------------------------------------
    42.6  class BoxLockNode : public Node {
    42.7 -  const int _slot;
    42.8 -  RegMask   _inmask;
    42.9 -  bool _is_eliminated;    // indicates this lock was safely eliminated
   42.10 +  const int     _slot; // stack slot
   42.11 +  RegMask     _inmask; // OptoReg corresponding to stack slot
   42.12 +  bool _is_eliminated; // Associated locks were safely eliminated
   42.13  
   42.14  public:
   42.15    BoxLockNode( int lock );
   42.16 @@ -68,7 +68,9 @@
   42.17  
   42.18    static OptoReg::Name reg(Node* box_node);
   42.19    static BoxLockNode* box_node(Node* box_node);
   42.20 -  static bool same_slot(Node* box1, Node* box2);
   42.21 +  static bool same_slot(Node* box1, Node* box2) {
   42.22 +    return box1->as_BoxLock()->_slot == box2->as_BoxLock()->_slot;
   42.23 +  }
   42.24    int stack_slot() const { return _slot; }
   42.25  
   42.26    bool is_eliminated() const { return _is_eliminated; }
    43.1 --- a/src/share/vm/opto/macro.cpp	Tue Jan 24 18:00:54 2012 -0500
    43.2 +++ b/src/share/vm/opto/macro.cpp	Wed Jan 25 19:26:35 2012 -0500
    43.3 @@ -1802,10 +1802,14 @@
    43.4  // Mark all associated (same box and obj) lock and unlock nodes for
    43.5  // elimination if some of them marked already.
    43.6  void PhaseMacroExpand::mark_eliminated_box(Node* oldbox, Node* obj) {
    43.7 -  if (oldbox->is_BoxLock() && oldbox->as_BoxLock()->is_eliminated())
    43.8 -    return;
    43.9 +  if (oldbox->as_BoxLock()->is_eliminated())
   43.10 +    return; // This BoxLock node was processed already.
   43.11  
   43.12 -  if (oldbox->is_BoxLock() &&
   43.13 +  // New implementation (EliminateNestedLocks) has separate BoxLock
   43.14 +  // node for each locked region so mark all associated locks/unlocks as
   43.15 +  // eliminated even if different objects are referenced in one locked region
   43.16 +  // (for example, OSR compilation of nested loop inside locked scope).
   43.17 +  if (EliminateNestedLocks ||
   43.18        oldbox->as_BoxLock()->is_simple_lock_region(NULL, obj)) {
   43.19      // Box is used only in one lock region. Mark this box as eliminated.
   43.20      _igvn.hash_delete(oldbox);
   43.21 @@ -1818,7 +1822,6 @@
   43.22          AbstractLockNode* alock = u->as_AbstractLock();
   43.23          // Check lock's box since box could be referenced by Lock's debug info.
   43.24          if (alock->box_node() == oldbox) {
   43.25 -          assert(alock->obj_node()->eqv_uncast(obj), "");
   43.26            // Mark eliminated all related locks and unlocks.
   43.27            alock->set_non_esc_obj();
   43.28          }
   43.29 @@ -1829,8 +1832,7 @@
   43.30  
   43.31    // Create new "eliminated" BoxLock node and use it in monitor debug info
   43.32    // instead of oldbox for the same object.
   43.33 -  BoxLockNode* box = BoxLockNode::box_node(oldbox);
   43.34 -  BoxLockNode* newbox = box->clone()->as_BoxLock();
   43.35 +  BoxLockNode* newbox = oldbox->clone()->as_BoxLock();
   43.36  
   43.37    // Note: BoxLock node is marked eliminated only here and it is used
   43.38    // to indicate that all associated lock and unlock nodes are marked
   43.39 @@ -2047,7 +2049,7 @@
   43.40    Node* box = lock->box_node();
   43.41    Node* flock = lock->fastlock_node();
   43.42  
   43.43 -  assert(!BoxLockNode::box_node(box)->is_eliminated(), "sanity");
   43.44 +  assert(!box->as_BoxLock()->is_eliminated(), "sanity");
   43.45  
   43.46    // Make the merge point
   43.47    Node *region;
   43.48 @@ -2283,7 +2285,7 @@
   43.49    Node* obj = unlock->obj_node();
   43.50    Node* box = unlock->box_node();
   43.51  
   43.52 -  assert(!BoxLockNode::box_node(box)->is_eliminated(), "sanity");
   43.53 +  assert(!box->as_BoxLock()->is_eliminated(), "sanity");
   43.54  
   43.55    // No need for a null check on unlock
   43.56  
    44.1 --- a/src/share/vm/opto/parse1.cpp	Tue Jan 24 18:00:54 2012 -0500
    44.2 +++ b/src/share/vm/opto/parse1.cpp	Wed Jan 25 19:26:35 2012 -0500
    44.3 @@ -1604,7 +1604,16 @@
    44.4            continue;
    44.5          default:                // All normal stuff
    44.6            if (phi == NULL) {
    44.7 -            if (!check_elide_phi || !target->can_elide_SEL_phi(j)) {
    44.8 +            const JVMState* jvms = map()->jvms();
    44.9 +            if (EliminateNestedLocks &&
   44.10 +                jvms->is_mon(j) && jvms->is_monitor_box(j)) {
   44.11 +              // BoxLock nodes are not commoning.
   44.12 +              // Use old BoxLock node as merged box.
   44.13 +              assert(newin->jvms()->is_monitor_box(j), "sanity");
   44.14 +              // This assert also tests that nodes are BoxLock.
   44.15 +              assert(BoxLockNode::same_slot(n, m), "sanity");
   44.16 +              C->gvn_replace_by(n, m);
   44.17 +            } else if (!check_elide_phi || !target->can_elide_SEL_phi(j)) {
   44.18                phi = ensure_phi(j, nophi);
   44.19              }
   44.20            }
   44.21 @@ -1819,12 +1828,8 @@
   44.22    } else if (jvms->is_stk(idx)) {
   44.23      t = block()->stack_type_at(idx - jvms->stkoff());
   44.24    } else if (jvms->is_mon(idx)) {
   44.25 -    if (EliminateNestedLocks && jvms->is_monitor_box(idx)) {
   44.26 -      // BoxLock nodes are not commoning. Create Phi.
   44.27 -      t = o->bottom_type(); // TypeRawPtr::BOTTOM
   44.28 -    } else {
   44.29 -      t = TypeInstPtr::BOTTOM; // this is sufficient for a lock object
   44.30 -    }
   44.31 +    assert(!jvms->is_monitor_box(idx), "no phis for boxes");
   44.32 +    t = TypeInstPtr::BOTTOM; // this is sufficient for a lock object
   44.33    } else if ((uint)idx < TypeFunc::Parms) {
   44.34      t = o->bottom_type();  // Type::RETURN_ADDRESS or such-like.
   44.35    } else {
    45.1 --- a/src/share/vm/prims/jni.cpp	Tue Jan 24 18:00:54 2012 -0500
    45.2 +++ b/src/share/vm/prims/jni.cpp	Wed Jan 25 19:26:35 2012 -0500
    45.3 @@ -48,6 +48,7 @@
    45.4  #include "oops/typeArrayOop.hpp"
    45.5  #include "prims/jni.h"
    45.6  #include "prims/jniCheck.hpp"
    45.7 +#include "prims/jniExport.hpp"
    45.8  #include "prims/jniFastGetField.hpp"
    45.9  #include "prims/jvm.h"
   45.10  #include "prims/jvm_misc.hpp"
   45.11 @@ -66,6 +67,8 @@
   45.12  #include "runtime/signature.hpp"
   45.13  #include "runtime/vm_operations.hpp"
   45.14  #include "services/runtimeService.hpp"
   45.15 +#include "trace/tracing.hpp"
   45.16 +#include "trace/traceEventTypes.hpp"
   45.17  #include "utilities/defaultStream.hpp"
   45.18  #include "utilities/dtrace.hpp"
   45.19  #include "utilities/events.hpp"
   45.20 @@ -5139,6 +5142,11 @@
   45.21      if (JvmtiExport::should_post_thread_life()) {
   45.22         JvmtiExport::post_thread_start(thread);
   45.23      }
   45.24 +
   45.25 +    EVENT_BEGIN(TraceEventThreadStart, event);
   45.26 +    EVENT_COMMIT(event,
   45.27 +        EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj())));
   45.28 +
   45.29      // Check if we should compile all classes on bootclasspath
   45.30      NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();)
   45.31      // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving.
   45.32 @@ -5337,6 +5345,10 @@
   45.33      JvmtiExport::post_thread_start(thread);
   45.34    }
   45.35  
   45.36 +  EVENT_BEGIN(TraceEventThreadStart, event);
   45.37 +  EVENT_COMMIT(event,
   45.38 +      EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj())));
   45.39 +
   45.40    *(JNIEnv**)penv = thread->jni_environment();
   45.41  
   45.42    // Now leaving the VM, so change thread_state. This is normally automatically taken care
   45.43 @@ -5464,8 +5476,7 @@
   45.44      return ret;
   45.45    }
   45.46  
   45.47 -  if (JvmtiExport::is_jvmti_version(version)) {
   45.48 -    ret = JvmtiExport::get_jvmti_interface(vm, penv, version);
   45.49 +  if (JniExportedInterface::GetExportedInterface(vm, penv, version, &ret)) {
   45.50      return ret;
   45.51    }
   45.52  
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/src/share/vm/prims/jniExport.hpp	Wed Jan 25 19:26:35 2012 -0500
    46.3 @@ -0,0 +1,42 @@
    46.4 +/*
    46.5 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    46.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    46.7 + *
    46.8 + * This code is free software; you can redistribute it and/or modify it
    46.9 + * under the terms of the GNU General Public License version 2 only, as
   46.10 + * published by the Free Software Foundation.
   46.11 + *
   46.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   46.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   46.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   46.15 + * version 2 for more details (a copy is included in the LICENSE file that
   46.16 + * accompanied this code).
   46.17 + *
   46.18 + * You should have received a copy of the GNU General Public License version
   46.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   46.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   46.21 + *
   46.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   46.23 + * or visit www.oracle.com if you need additional information or have any
   46.24 + * questions.
   46.25 + *
   46.26 + */
   46.27 +
   46.28 +#ifndef SHARE_VM_PRIMS_JNI_EXPORT_HPP
   46.29 +#define SHARE_VM_PRIMS_JNI_EXPORT_HPP
   46.30 +
   46.31 +#include "prims/jni.h"
   46.32 +#include "prims/jvmtiExport.hpp"
   46.33 +
   46.34 +class JniExportedInterface {
   46.35 + public:
   46.36 +  static bool GetExportedInterface(JavaVM* vm, void** penv, jint version, jint* iface) {
   46.37 +    if (JvmtiExport::is_jvmti_version(version)) {
   46.38 +      *iface = JvmtiExport::get_jvmti_interface(vm, penv, version);
   46.39 +      return true;
   46.40 +    }
   46.41 +    return false;
   46.42 +  }
   46.43 +};
   46.44 +
   46.45 +#endif // SHARE_VM_PRIMS_JNI_EXPORT_HPP
    47.1 --- a/src/share/vm/prims/methodHandles.cpp	Tue Jan 24 18:00:54 2012 -0500
    47.2 +++ b/src/share/vm/prims/methodHandles.cpp	Wed Jan 25 19:26:35 2012 -0500
    47.3 @@ -194,9 +194,6 @@
    47.4  // MethodHandles::generate_adapters
    47.5  //
    47.6  void MethodHandles::generate_adapters() {
    47.7 -#ifdef TARGET_ARCH_NYI_6939861
    47.8 -  if (FLAG_IS_DEFAULT(UseRicochetFrames))  UseRicochetFrames = false;
    47.9 -#endif
   47.10    if (!EnableInvokeDynamic || SystemDictionary::MethodHandle_klass() == NULL)  return;
   47.11  
   47.12    assert(_adapter_code == NULL, "generate only once");
   47.13 @@ -230,18 +227,6 @@
   47.14  }
   47.15  
   47.16  
   47.17 -#ifdef TARGET_ARCH_NYI_6939861
   47.18 -// these defs belong in methodHandles_<arch>.cpp
   47.19 -frame MethodHandles::ricochet_frame_sender(const frame& fr, RegisterMap *map) {
   47.20 -  ShouldNotCallThis();
   47.21 -  return fr;
   47.22 -}
   47.23 -void MethodHandles::ricochet_frame_oops_do(const frame& fr, OopClosure* f, const RegisterMap* reg_map) {
   47.24 -  ShouldNotCallThis();
   47.25 -}
   47.26 -#endif //TARGET_ARCH_NYI_6939861
   47.27 -
   47.28 -
   47.29  //------------------------------------------------------------------------------
   47.30  // MethodHandles::ek_supported
   47.31  //
   47.32 @@ -251,28 +236,11 @@
   47.33    case _adapter_unused_13:
   47.34      return false;  // not defined yet
   47.35    case _adapter_prim_to_ref:
   47.36 -    return UseRicochetFrames && conv_op_supported(java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF);
   47.37 +    return conv_op_supported(java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF);
   47.38    case _adapter_collect_args:
   47.39 -    return UseRicochetFrames && conv_op_supported(java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS);
   47.40 +    return conv_op_supported(java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS);
   47.41    case _adapter_fold_args:
   47.42 -    return UseRicochetFrames && conv_op_supported(java_lang_invoke_AdapterMethodHandle::OP_FOLD_ARGS);
   47.43 -  case _adapter_opt_return_any:
   47.44 -    return UseRicochetFrames;
   47.45 -#ifdef TARGET_ARCH_NYI_6939861
   47.46 -  // ports before 6939861 supported only three kinds of spread ops
   47.47 -  case _adapter_spread_args:
   47.48 -    // restrict spreads to three kinds:
   47.49 -    switch (ek) {
   47.50 -    case _adapter_opt_spread_0:
   47.51 -    case _adapter_opt_spread_1:
   47.52 -    case _adapter_opt_spread_more:
   47.53 -      break;
   47.54 -    default:
   47.55 -      return false;
   47.56 -      break;
   47.57 -    }
   47.58 -    break;
   47.59 -#endif //TARGET_ARCH_NYI_6939861
   47.60 +    return conv_op_supported(java_lang_invoke_AdapterMethodHandle::OP_FOLD_ARGS);
   47.61    }
   47.62    return true;
   47.63  }
   47.64 @@ -1988,9 +1956,6 @@
   47.65      case _adapter_prim_to_ref:    // boxer MH to use
   47.66      case _adapter_collect_args:   // method handle which collects the args
   47.67      case _adapter_fold_args:      // method handle which collects the args
   47.68 -      if (!UseRicochetFrames) {
   47.69 -        { err = "box/collect/fold operators are not supported"; break; }
   47.70 -      }
   47.71        if (!java_lang_invoke_MethodHandle::is_instance(argument()))
   47.72          { err = "MethodHandle adapter argument required"; break; }
   47.73        arg_mtype = Handle(THREAD, java_lang_invoke_MethodHandle::type(argument()));
   47.74 @@ -2370,7 +2335,6 @@
   47.75  
   47.76    case _adapter_prim_to_ref:
   47.77      {
   47.78 -      assert(UseRicochetFrames, "else don't come here");
   47.79        // vminfo will be the location to insert the return value
   47.80        vminfo = argslot;
   47.81        ek_opt = _adapter_opt_collect_ref;
   47.82 @@ -2436,20 +2400,6 @@
   47.83  
   47.84    case _adapter_spread_args:
   47.85      {
   47.86 -#ifdef TARGET_ARCH_NYI_6939861
   47.87 -      // ports before 6939861 supported only three kinds of spread ops
   47.88 -      if (!UseRicochetFrames) {
   47.89 -        int array_size   = slots_pushed + 1;
   47.90 -        assert(array_size >= 0, "");
   47.91 -        vminfo = array_size;
   47.92 -        switch (array_size) {
   47.93 -        case 0:   ek_opt = _adapter_opt_spread_0;       break;
   47.94 -        case 1:   ek_opt = _adapter_opt_spread_1;       break;
   47.95 -        default:  ek_opt = _adapter_opt_spread_more;    break;
   47.96 -        }
   47.97 -        break;
   47.98 -      }
   47.99 -#endif //TARGET_ARCH_NYI_6939861
  47.100        // vminfo will be the required length of the array
  47.101        int array_size = (slots_pushed + 1) / (type2size[dest] == 2 ? 2 : 1);
  47.102        vminfo = array_size;
  47.103 @@ -2494,7 +2444,6 @@
  47.104  
  47.105    case _adapter_collect_args:
  47.106      {
  47.107 -      assert(UseRicochetFrames, "else don't come here");
  47.108        int elem_slots = argument_slot_count(java_lang_invoke_MethodHandle::type(argument()));
  47.109        // vminfo will be the location to insert the return value
  47.110        vminfo = argslot;
  47.111 @@ -2563,7 +2512,6 @@
  47.112  
  47.113    case _adapter_fold_args:
  47.114      {
  47.115 -      assert(UseRicochetFrames, "else don't come here");
  47.116        int elem_slots = argument_slot_count(java_lang_invoke_MethodHandle::type(argument()));
  47.117        // vminfo will be the location to insert the return value
  47.118        vminfo = argslot + elem_slots;
    48.1 --- a/src/share/vm/prims/methodHandles.hpp	Tue Jan 24 18:00:54 2012 -0500
    48.2 +++ b/src/share/vm/prims/methodHandles.hpp	Wed Jan 25 19:26:35 2012 -0500
    48.3 @@ -738,46 +738,6 @@
    48.4  #ifdef TARGET_ARCH_ppc
    48.5  # include "methodHandles_ppc.hpp"
    48.6  #endif
    48.7 -
    48.8 -#ifdef TARGET_ARCH_NYI_6939861
    48.9 -  // Here are some backward compatible declarations until the 6939861 ports are updated.
   48.10 -  #define _adapter_flyby    (_EK_LIMIT + 10)
   48.11 -  #define _adapter_ricochet (_EK_LIMIT + 11)
   48.12 -  #define _adapter_opt_spread_1    _adapter_opt_spread_1_ref
   48.13 -  #define _adapter_opt_spread_more _adapter_opt_spread_ref
   48.14 -  enum {
   48.15 -    _INSERT_NO_MASK   = -1,
   48.16 -    _INSERT_REF_MASK  = 0,
   48.17 -    _INSERT_INT_MASK  = 1,
   48.18 -    _INSERT_LONG_MASK = 3
   48.19 -  };
   48.20 -  static void get_ek_bound_mh_info(EntryKind ek, BasicType& arg_type, int& arg_mask, int& arg_slots) {
   48.21 -    arg_type = ek_bound_mh_arg_type(ek);
   48.22 -    arg_mask = 0;
   48.23 -    arg_slots = type2size[arg_type];;
   48.24 -  }
   48.25 -  static void get_ek_adapter_opt_swap_rot_info(EntryKind ek, int& swap_bytes, int& rotate) {
   48.26 -    int swap_slots = ek_adapter_opt_swap_slots(ek);
   48.27 -    rotate = ek_adapter_opt_swap_mode(ek);
   48.28 -    swap_bytes = swap_slots * Interpreter::stackElementSize;
   48.29 -  }
   48.30 -  static int get_ek_adapter_opt_spread_info(EntryKind ek) {
   48.31 -    return ek_adapter_opt_spread_count(ek);
   48.32 -  }
   48.33 -
   48.34 -  static void insert_arg_slots(MacroAssembler* _masm,
   48.35 -                               RegisterOrConstant arg_slots,
   48.36 -                               int arg_mask,
   48.37 -                               Register argslot_reg,
   48.38 -                               Register temp_reg, Register temp2_reg, Register temp3_reg = noreg);
   48.39 -
   48.40 -  static void remove_arg_slots(MacroAssembler* _masm,
   48.41 -                               RegisterOrConstant arg_slots,
   48.42 -                               Register argslot_reg,
   48.43 -                               Register temp_reg, Register temp2_reg, Register temp3_reg = noreg);
   48.44 -
   48.45 -  static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN;
   48.46 -#endif //TARGET_ARCH_NYI_6939861
   48.47  };
   48.48  
   48.49  
    49.1 --- a/src/share/vm/runtime/frame.cpp	Tue Jan 24 18:00:54 2012 -0500
    49.2 +++ b/src/share/vm/runtime/frame.cpp	Wed Jan 25 19:26:35 2012 -0500
    49.3 @@ -1,5 +1,5 @@
    49.4  /*
    49.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    49.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    49.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.8   *
    49.9   * This code is free software; you can redistribute it and/or modify it
   49.10 @@ -1334,24 +1334,21 @@
   49.11  
   49.12  
   49.13  void frame::describe(FrameValues& values, int frame_no) {
   49.14 +  intptr_t* frame_pointer = real_fp();
   49.15    if (is_entry_frame() || is_compiled_frame() || is_interpreted_frame() || is_native_frame()) {
   49.16      // Label values common to most frames
   49.17      values.describe(-1, unextended_sp(), err_msg("unextended_sp for #%d", frame_no));
   49.18      values.describe(-1, sp(), err_msg("sp for #%d", frame_no));
   49.19 -    if (is_compiled_frame()) {
   49.20 -      values.describe(-1, sp() + _cb->frame_size(), err_msg("computed fp for #%d", frame_no));
   49.21 -    } else {
   49.22 -      values.describe(-1, fp(), err_msg("fp for #%d", frame_no));
   49.23 -    }
   49.24 +    values.describe(-1, frame_pointer, err_msg("frame pointer for #%d", frame_no));
   49.25    }
   49.26    if (is_interpreted_frame()) {
   49.27      methodOop m = interpreter_frame_method();
   49.28      int bci = interpreter_frame_bci();
   49.29  
   49.30      // Label the method and current bci
   49.31 -    values.describe(-1, MAX2(sp(), fp()),
   49.32 +    values.describe(-1, MAX2(sp(), frame_pointer),
   49.33                      FormatBuffer<1024>("#%d method %s @ %d", frame_no, m->name_and_sig_as_C_string(), bci), 2);
   49.34 -    values.describe(-1, MAX2(sp(), fp()),
   49.35 +    values.describe(-1, MAX2(sp(), frame_pointer),
   49.36                      err_msg("- %d locals %d max stack", m->max_locals(), m->max_stack()), 1);
   49.37      if (m->max_locals() > 0) {
   49.38        intptr_t* l0 = interpreter_frame_local_at(0);
   49.39 @@ -1383,18 +1380,18 @@
   49.40      }
   49.41    } else if (is_entry_frame()) {
   49.42      // For now just label the frame
   49.43 -    values.describe(-1, MAX2(sp(), fp()), err_msg("#%d entry frame", frame_no), 2);
   49.44 +    values.describe(-1, MAX2(sp(), frame_pointer), err_msg("#%d entry frame", frame_no), 2);
   49.45    } else if (is_compiled_frame()) {
   49.46      // For now just label the frame
   49.47      nmethod* nm = cb()->as_nmethod_or_null();
   49.48 -    values.describe(-1, MAX2(sp(), fp()),
   49.49 +    values.describe(-1, MAX2(sp(), frame_pointer),
   49.50                      FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for method %s%s", frame_no,
   49.51                                         nm, nm->method()->name_and_sig_as_C_string(),
   49.52                                         is_deoptimized_frame() ? " (deoptimized" : ""), 2);
   49.53    } else if (is_native_frame()) {
   49.54      // For now just label the frame
   49.55      nmethod* nm = cb()->as_nmethod_or_null();
   49.56 -    values.describe(-1, MAX2(sp(), fp()),
   49.57 +    values.describe(-1, MAX2(sp(), frame_pointer),
   49.58                      FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for native method %s", frame_no,
   49.59                                         nm, nm->method()->name_and_sig_as_C_string()), 2);
   49.60    }
    50.1 --- a/src/share/vm/runtime/frame.hpp	Tue Jan 24 18:00:54 2012 -0500
    50.2 +++ b/src/share/vm/runtime/frame.hpp	Wed Jan 25 19:26:35 2012 -0500
    50.3 @@ -1,5 +1,5 @@
    50.4  /*
    50.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    50.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    50.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.8   *
    50.9   * This code is free software; you can redistribute it and/or modify it
   50.10 @@ -221,6 +221,15 @@
   50.11    // returns the stack pointer of the calling frame
   50.12    intptr_t* sender_sp() const;
   50.13  
   50.14 +  // Returns the real 'frame pointer' for the current frame.
   50.15 +  // This is the value expected by the platform ABI when it defines a
   50.16 +  // frame pointer register. It may differ from the effective value of
   50.17 +  // the FP register when that register is used in the JVM for other
   50.18 +  // purposes (like compiled frames on some platforms).
   50.19 +  // On other platforms, it is defined so that the stack area used by
   50.20 +  // this frame goes from real_fp() to sp().
   50.21 +  intptr_t* real_fp() const;
   50.22 +
   50.23    // Deoptimization info, if needed (platform dependent).
   50.24    // Stored in the initial_info field of the unroll info, to be used by
   50.25    // the platform dependent deoptimization blobs.
    51.1 --- a/src/share/vm/runtime/globals.hpp	Tue Jan 24 18:00:54 2012 -0500
    51.2 +++ b/src/share/vm/runtime/globals.hpp	Wed Jan 25 19:26:35 2012 -0500
    51.3 @@ -3826,10 +3826,6 @@
    51.4    develop(bool, StressMethodHandleWalk, false,                              \
    51.5            "Process all method handles with MethodHandleWalk")               \
    51.6                                                                              \
    51.7 -  diagnostic(bool, UseRicochetFrames, true,                                 \
    51.8 -          "use ricochet stack frames for method handle combination, "       \
    51.9 -          "if the platform supports them")                                  \
   51.10 -                                                                            \
   51.11    experimental(bool, TrustFinalNonStaticFields, false,                      \
   51.12            "trust final non-static declarations for constant folding")       \
   51.13                                                                              \
    52.1 --- a/src/share/vm/runtime/java.cpp	Tue Jan 24 18:00:54 2012 -0500
    52.2 +++ b/src/share/vm/runtime/java.cpp	Wed Jan 25 19:26:35 2012 -0500
    52.3 @@ -57,6 +57,8 @@
    52.4  #include "runtime/task.hpp"
    52.5  #include "runtime/timer.hpp"
    52.6  #include "runtime/vm_operations.hpp"
    52.7 +#include "trace/tracing.hpp"
    52.8 +#include "trace/traceEventTypes.hpp"
    52.9  #include "utilities/dtrace.hpp"
   52.10  #include "utilities/globalDefinitions.hpp"
   52.11  #include "utilities/histogram.hpp"
   52.12 @@ -502,6 +504,11 @@
   52.13    if (JvmtiExport::should_post_thread_life()) {
   52.14      JvmtiExport::post_thread_end(thread);
   52.15    }
   52.16 +
   52.17 +  EVENT_BEGIN(TraceEventThreadEnd, event);
   52.18 +  EVENT_COMMIT(event,
   52.19 +      EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(thread->threadObj())));
   52.20 +
   52.21    // Always call even when there are not JVMTI environments yet, since environments
   52.22    // may be attached late and JVMTI must track phases of VM execution
   52.23    JvmtiExport::post_vm_death();
    53.1 --- a/src/share/vm/runtime/mutexLocker.cpp	Tue Jan 24 18:00:54 2012 -0500
    53.2 +++ b/src/share/vm/runtime/mutexLocker.cpp	Wed Jan 25 19:26:35 2012 -0500
    53.3 @@ -132,7 +132,13 @@
    53.4  Monitor* GCTaskManager_lock           = NULL;
    53.5  
    53.6  Mutex*   Management_lock              = NULL;
    53.7 -Monitor* Service_lock               = NULL;
    53.8 +Monitor* Service_lock                 = NULL;
    53.9 +Mutex*   Stacktrace_lock              = NULL;
   53.10 +
   53.11 +Monitor* JfrQuery_lock                = NULL;
   53.12 +Monitor* JfrMsg_lock                  = NULL;
   53.13 +Mutex*   JfrBuffer_lock               = NULL;
   53.14 +Mutex*   JfrStream_lock               = NULL;
   53.15  
   53.16  #define MAX_NUM_MUTEX 128
   53.17  static Monitor * _mutex_array[MAX_NUM_MUTEX];
   53.18 @@ -207,6 +213,7 @@
   53.19    def(Patching_lock                , Mutex  , special,     true ); // used for safepointing and code patching.
   53.20    def(ObjAllocPost_lock            , Monitor, special,     false);
   53.21    def(Service_lock                 , Monitor, special,     true ); // used for service thread operations
   53.22 +  def(Stacktrace_lock              , Mutex,   special,     true ); // used for JFR stacktrace database
   53.23    def(JmethodIdCreation_lock       , Mutex  , leaf,        true ); // used for creating jmethodIDs.
   53.24  
   53.25    def(SystemDictionary_lock        , Monitor, leaf,        true ); // lookups done by VM thread
   53.26 @@ -271,6 +278,11 @@
   53.27    def(Debug3_lock                  , Mutex  , nonleaf+4,   true );
   53.28    def(ProfileVM_lock               , Monitor, nonleaf+4,   false); // used for profiling of the VMThread
   53.29    def(CompileThread_lock           , Monitor, nonleaf+5,   false );
   53.30 +
   53.31 +  def(JfrQuery_lock                , Monitor, nonleaf,     true);  // JFR locks, keep these in consecutive order
   53.32 +  def(JfrMsg_lock                  , Monitor, nonleaf+2,   true);
   53.33 +  def(JfrBuffer_lock               , Mutex,   nonleaf+3,   true);
   53.34 +  def(JfrStream_lock               , Mutex,   nonleaf+4,   true);
   53.35  }
   53.36  
   53.37  GCMutexLocker::GCMutexLocker(Monitor * mutex) {
    54.1 --- a/src/share/vm/runtime/mutexLocker.hpp	Tue Jan 24 18:00:54 2012 -0500
    54.2 +++ b/src/share/vm/runtime/mutexLocker.hpp	Wed Jan 25 19:26:35 2012 -0500
    54.3 @@ -135,6 +135,12 @@
    54.4  
    54.5  extern Mutex*   Management_lock;                 // a lock used to serialize JVM management
    54.6  extern Monitor* Service_lock;                    // a lock used for service thread operation
    54.7 +extern Mutex*   Stacktrace_lock;                 // used to guard access to the stacktrace table
    54.8 +
    54.9 +extern Monitor* JfrQuery_lock;                   // protects JFR use
   54.10 +extern Monitor* JfrMsg_lock;                     // protects JFR messaging
   54.11 +extern Mutex*   JfrBuffer_lock;                  // protects JFR buffer operations
   54.12 +extern Mutex*   JfrStream_lock;                  // protects JFR stream access
   54.13  
   54.14  // A MutexLocker provides mutual exclusion with respect to a given mutex
   54.15  // for the scope which contains the locker.  The lock is an OS lock, not
    55.1 --- a/src/share/vm/runtime/os.cpp	Tue Jan 24 18:00:54 2012 -0500
    55.2 +++ b/src/share/vm/runtime/os.cpp	Wed Jan 25 19:26:35 2012 -0500
    55.3 @@ -1101,6 +1101,7 @@
    55.4          "%/lib/jsse.jar:"
    55.5          "%/lib/jce.jar:"
    55.6          "%/lib/charsets.jar:"
    55.7 +        "%/lib/jfr.jar:"
    55.8  #ifdef __APPLE__
    55.9          "%/lib/JObjC.jar:"
   55.10  #endif
    56.1 --- a/src/share/vm/runtime/sharedRuntime.cpp	Tue Jan 24 18:00:54 2012 -0500
    56.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp	Wed Jan 25 19:26:35 2012 -0500
    56.3 @@ -121,7 +121,6 @@
    56.4  void SharedRuntime::generate_ricochet_blob() {
    56.5    if (!EnableInvokeDynamic)  return;  // leave it as a null
    56.6  
    56.7 -#ifndef TARGET_ARCH_NYI_6939861
    56.8    // allocate space for the code
    56.9    ResourceMark rm;
   56.10    // setup code generation tools
   56.11 @@ -142,7 +141,6 @@
   56.12    }
   56.13  
   56.14    _ricochet_blob = RicochetBlob::create(&buffer, bounce_offset, exception_offset, frame_size_in_words);
   56.15 -#endif
   56.16  }
   56.17  
   56.18  
    57.1 --- a/src/share/vm/runtime/thread.cpp	Tue Jan 24 18:00:54 2012 -0500
    57.2 +++ b/src/share/vm/runtime/thread.cpp	Wed Jan 25 19:26:35 2012 -0500
    57.3 @@ -73,6 +73,7 @@
    57.4  #include "services/attachListener.hpp"
    57.5  #include "services/management.hpp"
    57.6  #include "services/threadService.hpp"
    57.7 +#include "trace/traceEventTypes.hpp"
    57.8  #include "utilities/defaultStream.hpp"
    57.9  #include "utilities/dtrace.hpp"
   57.10  #include "utilities/events.hpp"
   57.11 @@ -232,6 +233,7 @@
   57.12    CHECK_UNHANDLED_OOPS_ONLY(_gc_locked_out_count = 0;)
   57.13    _jvmti_env_iteration_count = 0;
   57.14    set_allocated_bytes(0);
   57.15 +  set_trace_buffer(NULL);
   57.16    _vm_operation_started_count = 0;
   57.17    _vm_operation_completed_count = 0;
   57.18    _current_pending_monitor = NULL;
   57.19 @@ -1512,6 +1514,10 @@
   57.20      JvmtiExport::post_thread_start(this);
   57.21    }
   57.22  
   57.23 +  EVENT_BEGIN(TraceEventThreadStart, event);
   57.24 +  EVENT_COMMIT(event,
   57.25 +     EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(this->threadObj())));
   57.26 +
   57.27    // We call another function to do the rest so we are sure that the stack addresses used
   57.28    // from there will be lower than the stack base just computed
   57.29    thread_main_inner();
   57.30 @@ -1641,6 +1647,15 @@
   57.31        }
   57.32      }
   57.33  
   57.34 +    // Called before the java thread exit since we want to read info
   57.35 +    // from java_lang_Thread object
   57.36 +    EVENT_BEGIN(TraceEventThreadEnd, event);
   57.37 +    EVENT_COMMIT(event,
   57.38 +        EVENT_SET(event, javalangthread, java_lang_Thread::thread_id(this->threadObj())));
   57.39 +
   57.40 +    // Call after last event on thread
   57.41 +    EVENT_THREAD_EXIT(this);
   57.42 +
   57.43      // Call Thread.exit(). We try 3 times in case we got another Thread.stop during
   57.44      // the execution of the method. If that is not enough, then we don't really care. Thread.stop
   57.45      // is deprecated anyhow.
   57.46 @@ -3186,6 +3201,11 @@
   57.47      return status;
   57.48    }
   57.49  
   57.50 +  // Must be run after init_ft which initializes ft_enabled
   57.51 +  if (TRACE_INITIALIZE() != JNI_OK) {
   57.52 +    vm_exit_during_initialization("Failed to initialize tracing backend");
   57.53 +  }
   57.54 +
   57.55    // Should be done after the heap is fully created
   57.56    main_thread->cache_global_variables();
   57.57  
   57.58 @@ -3423,6 +3443,10 @@
   57.59      create_vm_init_libraries();
   57.60    }
   57.61  
   57.62 +  if (!TRACE_START()) {
   57.63 +    vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
   57.64 +  }
   57.65 +
   57.66    // Notify JVMTI agents that VM initialization is complete - nop if no agents.
   57.67    JvmtiExport::post_vm_initialized();
   57.68  
    58.1 --- a/src/share/vm/runtime/thread.hpp	Tue Jan 24 18:00:54 2012 -0500
    58.2 +++ b/src/share/vm/runtime/thread.hpp	Wed Jan 25 19:26:35 2012 -0500
    58.3 @@ -41,6 +41,7 @@
    58.4  #include "runtime/stubRoutines.hpp"
    58.5  #include "runtime/threadLocalStorage.hpp"
    58.6  #include "runtime/unhandledOops.hpp"
    58.7 +#include "trace/tracing.hpp"
    58.8  #include "utilities/exceptions.hpp"
    58.9  #include "utilities/top.hpp"
   58.10  #ifndef SERIALGC
   58.11 @@ -246,6 +247,8 @@
   58.12    jlong _allocated_bytes;                       // Cumulative number of bytes allocated on
   58.13                                                  // the Java heap
   58.14  
   58.15 +  TRACE_BUFFER _trace_buffer;                   // Thread-local buffer for tracing
   58.16 +
   58.17    int   _vm_operation_started_count;            // VM_Operation support
   58.18    int   _vm_operation_completed_count;          // VM_Operation support
   58.19  
   58.20 @@ -414,6 +417,9 @@
   58.21      return allocated_bytes;
   58.22    }
   58.23  
   58.24 +  TRACE_BUFFER trace_buffer()              { return _trace_buffer; }
   58.25 +  void set_trace_buffer(TRACE_BUFFER buf)  { _trace_buffer = buf; }
   58.26 +
   58.27    // VM operation support
   58.28    int vm_operation_ticket()                      { return ++_vm_operation_started_count; }
   58.29    int vm_operation_completed_count()             { return _vm_operation_completed_count; }
    59.1 --- a/src/share/vm/runtime/vm_operations.hpp	Tue Jan 24 18:00:54 2012 -0500
    59.2 +++ b/src/share/vm/runtime/vm_operations.hpp	Wed Jan 25 19:26:35 2012 -0500
    59.3 @@ -93,6 +93,7 @@
    59.4    template(HeapWalkOperation)                     \
    59.5    template(HeapIterateOperation)                  \
    59.6    template(ReportJavaOutOfMemory)                 \
    59.7 +  template(JFRCheckpoint)                         \
    59.8    template(Exit)                                  \
    59.9  
   59.10  class VM_Operation: public CHeapObj {
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/src/share/vm/trace/traceEventTypes.hpp	Wed Jan 25 19:26:35 2012 -0500
    60.3 @@ -0,0 +1,30 @@
    60.4 +/*
    60.5 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.7 + *
    60.8 + * This code is free software; you can redistribute it and/or modify it
    60.9 + * under the terms of the GNU General Public License version 2 only, as
   60.10 + * published by the Free Software Foundation.
   60.11 + *
   60.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   60.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   60.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   60.15 + * version 2 for more details (a copy is included in the LICENSE file that
   60.16 + * accompanied this code).
   60.17 + *
   60.18 + * You should have received a copy of the GNU General Public License version
   60.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   60.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   60.21 + *
   60.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   60.23 + * or visit www.oracle.com if you need additional information or have any
   60.24 + * questions.
   60.25 + *
   60.26 + */
   60.27 +
   60.28 +#ifndef SHARE_VM_TRACE_TRACE_EVENT_TYPES_HPP
   60.29 +#define SHARE_VM_TRACE_TRACE_EVENT_TYPES_HPP
   60.30 +
   60.31 +/* Empty, just a placeholder for tracing events */
   60.32 +
   60.33 +#endif
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/src/share/vm/trace/traceMacros.hpp	Wed Jan 25 19:26:35 2012 -0500
    61.3 @@ -0,0 +1,43 @@
    61.4 +/*
    61.5 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    61.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    61.7 + *
    61.8 + * This code is free software; you can redistribute it and/or modify it
    61.9 + * under the terms of the GNU General Public License version 2 only, as
   61.10 + * published by the Free Software Foundation.
   61.11 + *
   61.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   61.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   61.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   61.15 + * version 2 for more details (a copy is included in the LICENSE file that
   61.16 + * accompanied this code).
   61.17 + *
   61.18 + * You should have received a copy of the GNU General Public License version
   61.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   61.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   61.21 + *
   61.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   61.23 + * or visit www.oracle.com if you need additional information or have any
   61.24 + * questions.
   61.25 + *
   61.26 + */
   61.27 +
   61.28 +#ifndef SHARE_VM_TRACE_TRACE_MACRO_HPP
   61.29 +#define SHARE_VM_TRACE_TRACE_MACRO_HPP
   61.30 +
   61.31 +#define EVENT_BEGIN(type, name)
   61.32 +#define EVENT_SET(name, field, value)
   61.33 +#define EVENT_COMMIT(name, ...)
   61.34 +#define EVENT_STARTED(name, time)
   61.35 +#define EVENT_ENDED(name, time)
   61.36 +#define EVENT_THREAD_EXIT(thread)
   61.37 +
   61.38 +#define TRACE_ENABLED 0
   61.39 +
   61.40 +#define TRACE_INIT_ID(k)
   61.41 +#define TRACE_BUFFER void*
   61.42 +
   61.43 +#define TRACE_START() true
   61.44 +#define TRACE_INITIALIZE() 0
   61.45 +
   61.46 +#endif
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/src/share/vm/trace/tracing.hpp	Wed Jan 25 19:26:35 2012 -0500
    62.3 @@ -0,0 +1,30 @@
    62.4 +/*
    62.5 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    62.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    62.7 + *
    62.8 + * This code is free software; you can redistribute it and/or modify it
    62.9 + * under the terms of the GNU General Public License version 2 only, as
   62.10 + * published by the Free Software Foundation.
   62.11 + *
   62.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   62.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   62.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   62.15 + * version 2 for more details (a copy is included in the LICENSE file that
   62.16 + * accompanied this code).
   62.17 + *
   62.18 + * You should have received a copy of the GNU General Public License version
   62.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   62.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   62.21 + *
   62.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   62.23 + * or visit www.oracle.com if you need additional information or have any
   62.24 + * questions.
   62.25 + *
   62.26 + */
   62.27 +
   62.28 +#ifndef SHARE_VM_TRACE_TRACING_HPP
   62.29 +#define SHARE_VM_TRACE_TRACING_HPP
   62.30 +
   62.31 +#include "trace/traceMacros.hpp"
   62.32 +
   62.33 +#endif
    63.1 --- a/src/share/vm/utilities/decoder.cpp	Tue Jan 24 18:00:54 2012 -0500
    63.2 +++ b/src/share/vm/utilities/decoder.cpp	Wed Jan 25 19:26:35 2012 -0500
    63.3 @@ -24,80 +24,85 @@
    63.4  
    63.5  #include "precompiled.hpp"
    63.6  #include "prims/jvm.h"
    63.7 +#include "runtime/mutexLocker.hpp"
    63.8  #include "utilities/decoder.hpp"
    63.9  
   63.10 -Decoder::decoder_status  Decoder::_decoder_status = Decoder::no_error;
   63.11 -bool                     Decoder::_initialized = false;
   63.12 +#if defined(_WINDOWS)
   63.13 +  #include "decoder_windows.hpp"
   63.14 +#elif defined(__APPLE__)
   63.15 +  #include "decoder_machO.hpp"
   63.16 +#else
   63.17 +  #include "decoder_elf.hpp"
   63.18 +#endif
   63.19  
   63.20 -#if !defined(_WINDOWS) && !defined(__APPLE__)
   63.21 +NullDecoder*  Decoder::_decoder = NULL;
   63.22 +NullDecoder   Decoder::_do_nothing_decoder;
   63.23 +Mutex*           Decoder::_decoder_lock = new Mutex(Mutex::safepoint,
   63.24 +                                "DecoderLock");
   63.25  
   63.26 -// Implementation of common functionalities among Solaris and Linux
   63.27 -#include "utilities/elfFile.hpp"
   63.28 +// _decoder_lock should already acquired before enter this method
   63.29 +NullDecoder* Decoder::get_decoder() {
   63.30 +  assert(_decoder_lock != NULL && _decoder_lock->owned_by_self(),
   63.31 +    "Require DecoderLock to enter");
   63.32  
   63.33 -ElfFile* Decoder::_opened_elf_files = NULL;
   63.34 +  if (_decoder != NULL) {
   63.35 +    return _decoder;
   63.36 +  }
   63.37 +
   63.38 +  // Decoder is a secondary service. Although, it is good to have,
   63.39 +  // but we can live without it.
   63.40 +#if defined(_WINDOWS)
   63.41 +  _decoder = new (std::nothrow) WindowsDecoder();
   63.42 +#elif defined (__APPLE__)
   63.43 +    _decoder = new (std::nothrow)MachODecoder();
   63.44 +#else
   63.45 +    _decoder = new (std::nothrow)ElfDecoder();
   63.46 +#endif
   63.47 +
   63.48 +  if (_decoder == NULL || _decoder->has_error()) {
   63.49 +    if (_decoder != NULL) {
   63.50 +      delete _decoder;
   63.51 +    }
   63.52 +    _decoder = &_do_nothing_decoder;
   63.53 +  }
   63.54 +  return _decoder;
   63.55 +}
   63.56 +
   63.57 +bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath) {
   63.58 +  assert(_decoder_lock != NULL, "Just check");
   63.59 +  MutexLockerEx locker(_decoder_lock, true);
   63.60 +  NullDecoder* decoder = get_decoder();
   63.61 +  assert(decoder != NULL, "null decoder");
   63.62 +
   63.63 +  return decoder->decode(addr, buf, buflen, offset, modulepath);
   63.64 +}
   63.65 +
   63.66 +bool Decoder::demangle(const char* symbol, char* buf, int buflen) {
   63.67 +  assert(_decoder_lock != NULL, "Just check");
   63.68 +  MutexLockerEx locker(_decoder_lock, true);
   63.69 +  NullDecoder* decoder = get_decoder();
   63.70 +  assert(decoder != NULL, "null decoder");
   63.71 +  return decoder->demangle(symbol, buf, buflen);
   63.72 +}
   63.73  
   63.74  bool Decoder::can_decode_C_frame_in_vm() {
   63.75 -  return true;
   63.76 +  assert(_decoder_lock != NULL, "Just check");
   63.77 +  MutexLockerEx locker(_decoder_lock, true);
   63.78 +  NullDecoder* decoder = get_decoder();
   63.79 +  assert(decoder != NULL, "null decoder");
   63.80 +  return decoder->can_decode_C_frame_in_vm();
   63.81  }
   63.82  
   63.83 -void Decoder::initialize() {
   63.84 -  _initialized = true;
   63.85 +// shutdown real decoder and replace it with
   63.86 +// _do_nothing_decoder
   63.87 +void Decoder::shutdown() {
   63.88 +  assert(_decoder_lock != NULL, "Just check");
   63.89 +  MutexLockerEx locker(_decoder_lock, true);
   63.90 +
   63.91 +  if (_decoder != NULL && _decoder != &_do_nothing_decoder) {
   63.92 +    delete _decoder;
   63.93 +  }
   63.94 +
   63.95 +  _decoder = &_do_nothing_decoder;
   63.96  }
   63.97  
   63.98 -void Decoder::uninitialize() {
   63.99 -  if (_opened_elf_files != NULL) {
  63.100 -    delete _opened_elf_files;
  63.101 -    _opened_elf_files = NULL;
  63.102 -  }
  63.103 -  _initialized = false;
  63.104 -}
  63.105 -
  63.106 -Decoder::decoder_status Decoder::decode(address addr, const char* filepath, char *buf, int buflen, int *offset) {
  63.107 -  if (_decoder_status != no_error) {
  63.108 -    return _decoder_status;
  63.109 -  }
  63.110 -
  63.111 -  ElfFile* file = get_elf_file(filepath);
  63.112 -  if (_decoder_status != no_error) {
  63.113 -    return _decoder_status;
  63.114 -  }
  63.115 -
  63.116 -  const char* symbol = file->decode(addr, offset);
  63.117 -  if (file->get_status() == out_of_memory) {
  63.118 -    _decoder_status = out_of_memory;
  63.119 -    return _decoder_status;
  63.120 -  } else if (symbol != NULL) {
  63.121 -    if (!demangle(symbol, buf, buflen)) {
  63.122 -      jio_snprintf(buf, buflen, "%s", symbol);
  63.123 -    }
  63.124 -    return no_error;
  63.125 -  } else {
  63.126 -    return symbol_not_found;
  63.127 -  }
  63.128 -}
  63.129 -
  63.130 -ElfFile* Decoder::get_elf_file(const char* filepath) {
  63.131 -  if (_decoder_status != no_error) {
  63.132 -    return NULL;
  63.133 -  }
  63.134 -  ElfFile* file = _opened_elf_files;
  63.135 -  while (file != NULL) {
  63.136 -    if (file->same_elf_file(filepath)) {
  63.137 -      return file;
  63.138 -    }
  63.139 -    file = file->m_next;
  63.140 -  }
  63.141 -
  63.142 -  file = new ElfFile(filepath);
  63.143 -  if (file == NULL) {
  63.144 -    _decoder_status = out_of_memory;
  63.145 -  }
  63.146 -  if (_opened_elf_files != NULL) {
  63.147 -    file->m_next = _opened_elf_files;
  63.148 -  }
  63.149 -
  63.150 -  _opened_elf_files = file;
  63.151 -  return file;
  63.152 -}
  63.153 -
  63.154 -#endif
    64.1 --- a/src/share/vm/utilities/decoder.hpp	Tue Jan 24 18:00:54 2012 -0500
    64.2 +++ b/src/share/vm/utilities/decoder.hpp	Wed Jan 25 19:26:35 2012 -0500
    64.3 @@ -1,5 +1,5 @@
    64.4  /*
    64.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    64.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    64.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    64.8   *
    64.9   * This code is free software; you can redistribute it and/or modify it
   64.10 @@ -23,83 +23,78 @@
   64.11   */
   64.12  
   64.13  
   64.14 -#ifndef __DECODER_HPP
   64.15 -#define __DECODER_HPP
   64.16 +#ifndef SHARE_VM_UTILITIES_DECODER_HPP
   64.17 +#define SHARE_VM_UTILITIES_DECODER_HPP
   64.18  
   64.19  #include "memory/allocation.hpp"
   64.20 +#include "runtime/mutex.hpp"
   64.21  
   64.22 -#ifdef _WINDOWS
   64.23 -#include <windows.h>
   64.24 -#include <imagehlp.h>
   64.25 -
   64.26 -// functions needed for decoding symbols
   64.27 -typedef DWORD (WINAPI *pfn_SymSetOptions)(DWORD);
   64.28 -typedef BOOL  (WINAPI *pfn_SymInitialize)(HANDLE, PCTSTR, BOOL);
   64.29 -typedef BOOL  (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
   64.30 -typedef DWORD (WINAPI *pfn_UndecorateSymbolName)(const char*, char*, DWORD, DWORD);
   64.31 -
   64.32 -#elif defined(__APPLE__)
   64.33 -
   64.34 -#else
   64.35 -
   64.36 -class ElfFile;
   64.37 -
   64.38 -#endif // _WINDOWS
   64.39 -
   64.40 -
   64.41 -class Decoder: public StackObj {
   64.42 -
   64.43 - public:
   64.44 +class NullDecoder: public CHeapObj {
   64.45 +public:
   64.46    // status code for decoding native C frame
   64.47    enum decoder_status {
   64.48 -         no_error,             // successfully decoded frames
   64.49 +         not_available = -10,  // real decoder is not available
   64.50 +         no_error = 0,         // successfully decoded frames
   64.51           out_of_memory,        // out of memory
   64.52           file_invalid,         // invalid elf file
   64.53           file_not_found,       // could not found symbol file (on windows), such as jvm.pdb or jvm.map
   64.54           helper_not_found,     // could not load dbghelp.dll (Windows only)
   64.55           helper_func_error,    // decoding functions not found (Windows only)
   64.56 -         helper_init_error,    // SymInitialize failed (Windows only)
   64.57 -         symbol_not_found      // could not find the symbol
   64.58 +         helper_init_error     // SymInitialize failed (Windows only)
   64.59    };
   64.60  
   64.61 - public:
   64.62 -  Decoder() { initialize(); };
   64.63 -  ~Decoder() { uninitialize(); };
   64.64 +  NullDecoder() {
   64.65 +    _decoder_status = not_available;
   64.66 +  }
   64.67  
   64.68 +  ~NullDecoder() {};
   64.69 +
   64.70 +  virtual bool decode(address pc, char* buf, int buflen, int* offset,
   64.71 +    const char* modulepath = NULL) {
   64.72 +    return false;
   64.73 +  }
   64.74 +
   64.75 +  virtual bool demangle(const char* symbol, char* buf, int buflen) {
   64.76 +    return false;
   64.77 +  }
   64.78 +
   64.79 +  virtual bool can_decode_C_frame_in_vm() const {
   64.80 +    return false;
   64.81 +  }
   64.82 +
   64.83 +  virtual decoder_status status() const {
   64.84 +    return _decoder_status;
   64.85 +  }
   64.86 +
   64.87 +  virtual bool has_error() const {
   64.88 +    return is_error(_decoder_status);
   64.89 +  }
   64.90 +
   64.91 +  static bool is_error(decoder_status status) {
   64.92 +    return (status > 0);
   64.93 +  }
   64.94 +
   64.95 +protected:
   64.96 +  decoder_status  _decoder_status;
   64.97 +};
   64.98 +
   64.99 +
  64.100 +class Decoder: AllStatic {
  64.101 +public:
  64.102 +  static bool decode(address pc, char* buf, int buflen, int* offset, const char* modulepath = NULL);
  64.103 +  static bool demangle(const char* symbol, char* buf, int buflen);
  64.104    static bool can_decode_C_frame_in_vm();
  64.105  
  64.106 -  static void initialize();
  64.107 -  static void uninitialize();
  64.108 +  static void shutdown();
  64.109 +protected:
  64.110 +  static NullDecoder* get_decoder();
  64.111  
  64.112 -#ifdef _WINDOWS
  64.113 -  static decoder_status    decode(address addr, char *buf, int buflen, int *offset);
  64.114 -#else
  64.115 -  static decoder_status    decode(address addr, const char* filepath, char *buf, int buflen, int *offset);
  64.116 -#endif
  64.117 +private:
  64.118 +  static NullDecoder*     _decoder;
  64.119 +  static NullDecoder      _do_nothing_decoder;
  64.120  
  64.121 -  static bool              demangle(const char* symbol, char *buf, int buflen);
  64.122 -
  64.123 -  static decoder_status    get_status() { return _decoder_status; };
  64.124 -
  64.125 -#if !defined(_WINDOWS) && !defined(__APPLE__)
  64.126 - private:
  64.127 -  static ElfFile*         get_elf_file(const char* filepath);
  64.128 -#endif // _WINDOWS
  64.129 -
  64.130 -
  64.131 - private:
  64.132 -  static decoder_status     _decoder_status;
  64.133 -  static bool               _initialized;
  64.134 -
  64.135 -#ifdef _WINDOWS
  64.136 -  static HMODULE                   _dbghelp_handle;
  64.137 -  static bool                      _can_decode_in_vm;
  64.138 -  static pfn_SymGetSymFromAddr64   _pfnSymGetSymFromAddr64;
  64.139 -  static pfn_UndecorateSymbolName  _pfnUndecorateSymbolName;
  64.140 -#elif __APPLE__
  64.141 -#else
  64.142 -  static ElfFile*                  _opened_elf_files;
  64.143 -#endif // _WINDOWS
  64.144 +protected:
  64.145 +  static Mutex*       _decoder_lock;
  64.146  };
  64.147  
  64.148 -#endif // __DECODER_HPP
  64.149 +#endif // SHARE_VM_UTILITIES_DECODER_HPP
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/src/share/vm/utilities/decoder_elf.cpp	Wed Jan 25 19:26:35 2012 -0500
    65.3 @@ -0,0 +1,76 @@
    65.4 +/*
    65.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    65.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    65.7 + *
    65.8 + * This code is free software; you can redistribute it and/or modify it
    65.9 + * under the terms of the GNU General Public License version 2 only, as
   65.10 + * published by the Free Software Foundation.
   65.11 + *
   65.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   65.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   65.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   65.15 + * version 2 for more details (a copy is included in the LICENSE file that
   65.16 + * accompanied this code).
   65.17 + *
   65.18 + * You should have received a copy of the GNU General Public License version
   65.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   65.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   65.21 + *
   65.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   65.23 + * or visit www.oracle.com if you need additional information or have any
   65.24 + * questions.
   65.25 + *
   65.26 + */
   65.27 +
   65.28 +#include "precompiled.hpp"
   65.29 +
   65.30 +#if !defined(_WINDOWS) && !defined(__APPLE__)
   65.31 +#include "decoder_elf.hpp"
   65.32 +
   65.33 +ElfDecoder::~ElfDecoder() {
   65.34 +  if (_opened_elf_files != NULL) {
   65.35 +    delete _opened_elf_files;
   65.36 +    _opened_elf_files = NULL;
   65.37 +  }
   65.38 +}
   65.39 +
   65.40 +bool ElfDecoder::decode(address addr, char *buf, int buflen, int* offset, const char* filepath) {
   65.41 +  assert(filepath, "null file path");
   65.42 +  assert(buf != NULL && buflen > 0, "Invalid buffer");
   65.43 +  if (has_error()) return false;
   65.44 +  ElfFile* file = get_elf_file(filepath);
   65.45 +  if (file == NULL) {
   65.46 +    return false;
   65.47 +  }
   65.48 +
   65.49 +  if (!file->decode(addr, buf, buflen, offset)) {
   65.50 +    return false;
   65.51 +  }
   65.52 +  if (buf[0] != '\0') {
   65.53 +    demangle(buf, buf, buflen);
   65.54 +  }
   65.55 +  return true;
   65.56 +}
   65.57 +
   65.58 +ElfFile* ElfDecoder::get_elf_file(const char* filepath) {
   65.59 +  ElfFile* file;
   65.60 +
   65.61 +  file = _opened_elf_files;
   65.62 +  while (file != NULL) {
   65.63 +    if (file->same_elf_file(filepath)) {
   65.64 +      return file;
   65.65 +    }
   65.66 +    file = file->next();
   65.67 +  }
   65.68 +
   65.69 +  file = new (std::nothrow)ElfFile(filepath);
   65.70 +  if (file != NULL) {
   65.71 +    if (_opened_elf_files != NULL) {
   65.72 +      file->set_next(_opened_elf_files);
   65.73 +    }
   65.74 +    _opened_elf_files = file;
   65.75 +  }
   65.76 +
   65.77 +  return file;
   65.78 +}
   65.79 +#endif
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/src/share/vm/utilities/decoder_elf.hpp	Wed Jan 25 19:26:35 2012 -0500
    66.3 @@ -0,0 +1,55 @@
    66.4 +/*
    66.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    66.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    66.7 + *
    66.8 + * This code is free software; you can redistribute it and/or modify it
    66.9 + * under the terms of the GNU General Public License version 2 only, as
   66.10 + * published by the Free Software Foundation.
   66.11 + *
   66.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   66.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   66.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   66.15 + * version 2 for more details (a copy is included in the LICENSE file that
   66.16 + * accompanied this code).
   66.17 + *
   66.18 + * You should have received a copy of the GNU General Public License version
   66.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   66.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   66.21 + *
   66.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   66.23 + * or visit www.oracle.com if you need additional information or have any
   66.24 + * questions.
   66.25 + *
   66.26 + */
   66.27 +
   66.28 +#ifndef SHARE_VM_UTILITIES_DECODER_ELF_HPP
   66.29 +#define SHARE_VM_UTILITIES_DECODER_ELF_HPP
   66.30 +
   66.31 +#if !defined(_WINDOWS) && !defined(__APPLE__)
   66.32 +
   66.33 +#include "utilities/decoder.hpp"
   66.34 +#include "utilities/elfFile.hpp"
   66.35 +
   66.36 +class ElfDecoder: public NullDecoder {
   66.37 +
   66.38 +public:
   66.39 +  ElfDecoder() {
   66.40 +    _opened_elf_files = NULL;
   66.41 +    _decoder_status = no_error;
   66.42 +  }
   66.43 +  ~ElfDecoder();
   66.44 +
   66.45 +  bool can_decode_C_frame_in_vm() const { return true; }
   66.46 +
   66.47 +  bool demangle(const char* symbol, char *buf, int buflen);
   66.48 +  bool decode(address addr, char *buf, int buflen, int* offset, const char* filepath = NULL);
   66.49 +
   66.50 +private:
   66.51 +  ElfFile*         get_elf_file(const char* filepath);
   66.52 +
   66.53 +private:
   66.54 +  ElfFile*         _opened_elf_files;
   66.55 +};
   66.56 +
   66.57 +#endif
   66.58 +#endif // SHARE_VM_UTILITIES_DECODER_ELF_HPP
    67.1 --- a/src/share/vm/utilities/elfFile.cpp	Tue Jan 24 18:00:54 2012 -0500
    67.2 +++ b/src/share/vm/utilities/elfFile.cpp	Wed Jan 25 19:26:35 2012 -0500
    67.3 @@ -44,7 +44,7 @@
    67.4    m_string_tables = NULL;
    67.5    m_symbol_tables = NULL;
    67.6    m_next = NULL;
    67.7 -  m_status = Decoder::no_error;
    67.8 +  m_status = NullDecoder::no_error;
    67.9  
   67.10    int len = strlen(filepath) + 1;
   67.11    m_filepath = (const char*)os::malloc(len * sizeof(char));
   67.12 @@ -54,10 +54,10 @@
   67.13      if (m_file != NULL) {
   67.14        load_tables();
   67.15      } else {
   67.16 -      m_status = Decoder::file_not_found;
   67.17 +      m_status = NullDecoder::file_not_found;
   67.18      }
   67.19    } else {
   67.20 -    m_status = Decoder::out_of_memory;
   67.21 +    m_status = NullDecoder::out_of_memory;
   67.22    }
   67.23  }
   67.24  
   67.25 @@ -96,41 +96,41 @@
   67.26  
   67.27  bool ElfFile::load_tables() {
   67.28    assert(m_file, "file not open");
   67.29 -  assert(m_status == Decoder::no_error, "already in error");
   67.30 +  assert(!NullDecoder::is_error(m_status), "already in error");
   67.31  
   67.32    // read elf file header
   67.33    if (fread(&m_elfHdr, sizeof(m_elfHdr), 1, m_file) != 1) {
   67.34 -    m_status = Decoder::file_invalid;
   67.35 +    m_status = NullDecoder::file_invalid;
   67.36      return false;
   67.37    }
   67.38  
   67.39    if (!is_elf_file(m_elfHdr)) {
   67.40 -    m_status = Decoder::file_invalid;
   67.41 +    m_status = NullDecoder::file_invalid;
   67.42      return false;
   67.43    }
   67.44  
   67.45    // walk elf file's section headers, and load string tables
   67.46    Elf_Shdr shdr;
   67.47    if (!fseek(m_file, m_elfHdr.e_shoff, SEEK_SET)) {
   67.48 -    if (m_status != Decoder::no_error) return false;
   67.49 +    if (NullDecoder::is_error(m_status)) return false;
   67.50  
   67.51      for (int index = 0; index < m_elfHdr.e_shnum; index ++) {
   67.52        if (fread((void*)&shdr, sizeof(Elf_Shdr), 1, m_file) != 1) {
   67.53 -        m_status = Decoder::file_invalid;
   67.54 +        m_status = NullDecoder::file_invalid;
   67.55          return false;
   67.56        }
   67.57        // string table
   67.58        if (shdr.sh_type == SHT_STRTAB) {
   67.59          ElfStringTable* table = new (std::nothrow) ElfStringTable(m_file, shdr, index);
   67.60          if (table == NULL) {
   67.61 -          m_status = Decoder::out_of_memory;
   67.62 +          m_status = NullDecoder::out_of_memory;
   67.63            return false;
   67.64          }
   67.65          add_string_table(table);
   67.66        } else if (shdr.sh_type == SHT_SYMTAB || shdr.sh_type == SHT_DYNSYM) {
   67.67          ElfSymbolTable* table = new (std::nothrow) ElfSymbolTable(m_file, shdr);
   67.68          if (table == NULL) {
   67.69 -          m_status = Decoder::out_of_memory;
   67.70 +          m_status = NullDecoder::out_of_memory;
   67.71            return false;
   67.72          }
   67.73          add_symbol_table(table);
   67.74 @@ -140,32 +140,33 @@
   67.75    return true;
   67.76  }
   67.77  
   67.78 -const char* ElfFile::decode(address addr, int* offset) {
   67.79 +bool ElfFile::decode(address addr, char* buf, int buflen, int* offset) {
   67.80    // something already went wrong, just give up
   67.81 -  if (m_status != Decoder::no_error) {
   67.82 -    return NULL;
   67.83 +  if (NullDecoder::is_error(m_status)) {
   67.84 +    return false;
   67.85    }
   67.86 -
   67.87    ElfSymbolTable* symbol_table = m_symbol_tables;
   67.88    int string_table_index;
   67.89    int pos_in_string_table;
   67.90    int off = INT_MAX;
   67.91    bool found_symbol = false;
   67.92    while (symbol_table != NULL) {
   67.93 -    if (Decoder::no_error == symbol_table->lookup(addr, &string_table_index, &pos_in_string_table, &off)) {
   67.94 +    if (symbol_table->lookup(addr, &string_table_index, &pos_in_string_table, &off)) {
   67.95        found_symbol = true;
   67.96      }
   67.97      symbol_table = symbol_table->m_next;
   67.98    }
   67.99 -  if (!found_symbol) return NULL;
  67.100 +  if (!found_symbol) return false;
  67.101  
  67.102    ElfStringTable* string_table = get_string_table(string_table_index);
  67.103 +
  67.104    if (string_table == NULL) {
  67.105 -    m_status = Decoder::file_invalid;
  67.106 -    return NULL;
  67.107 +    m_status = NullDecoder::file_invalid;
  67.108 +    return false;
  67.109    }
  67.110    if (offset) *offset = off;
  67.111 -  return string_table->string_at(pos_in_string_table);
  67.112 +
  67.113 +  return string_table->string_at(pos_in_string_table, buf, buflen);
  67.114  }
  67.115  
  67.116  
    68.1 --- a/src/share/vm/utilities/elfFile.hpp	Tue Jan 24 18:00:54 2012 -0500
    68.2 +++ b/src/share/vm/utilities/elfFile.hpp	Wed Jan 25 19:26:35 2012 -0500
    68.3 @@ -1,5 +1,5 @@
    68.4  /*
    68.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    68.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    68.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    68.8   *
    68.9   * This code is free software; you can redistribute it and/or modify it
   68.10 @@ -22,8 +22,8 @@
   68.11   *
   68.12   */
   68.13  
   68.14 -#ifndef __ELF_FILE_HPP
   68.15 -#define __ELF_FILE_HPP
   68.16 +#ifndef SHARE_VM_UTILITIES_ELF_FILE_HPP
   68.17 +#define SHARE_VM_UTILITIES_ELF_FILE_HPP
   68.18  
   68.19  #if !defined(_WINDOWS) && !defined(__APPLE__)
   68.20  
   68.21 @@ -83,12 +83,12 @@
   68.22  // part of code to be very defensive, and bait out if anything went wrong.
   68.23  
   68.24  class ElfFile: public CHeapObj {
   68.25 -  friend class Decoder;
   68.26 +  friend class ElfDecoder;
   68.27   public:
   68.28    ElfFile(const char* filepath);
   68.29    ~ElfFile();
   68.30  
   68.31 -  const char* decode(address addr, int* offset);
   68.32 +  bool decode(address addr, char* buf, int buflen, int* offset);
   68.33    const char* filepath() {
   68.34      return m_filepath;
   68.35    }
   68.36 @@ -99,7 +99,7 @@
   68.37      return (m_filepath && !strcmp(filepath, m_filepath));
   68.38    }
   68.39  
   68.40 -  Decoder::decoder_status get_status() {
   68.41 +  NullDecoder::decoder_status get_status() {
   68.42      return m_status;
   68.43    }
   68.44  
   68.45 @@ -119,8 +119,9 @@
   68.46    // return a string table at specified section index
   68.47    ElfStringTable* get_string_table(int index);
   68.48  
   68.49 -  // look up an address and return the nearest symbol
   68.50 -  const char* look_up(Elf_Shdr shdr, address addr, int* offset);
   68.51 +protected:
   68.52 +   ElfFile*  next() const { return m_next; }
   68.53 +   void set_next(ElfFile* file) { m_next = file; }
   68.54  
   68.55   protected:
   68.56      ElfFile*         m_next;
   68.57 @@ -131,17 +132,17 @@
   68.58    FILE* m_file;
   68.59  
   68.60    // Elf header
   68.61 -  Elf_Ehdr            m_elfHdr;
   68.62 +  Elf_Ehdr                     m_elfHdr;
   68.63  
   68.64    // symbol tables
   68.65 -  ElfSymbolTable*     m_symbol_tables;
   68.66 +  ElfSymbolTable*              m_symbol_tables;
   68.67  
   68.68    // string tables
   68.69 -  ElfStringTable*     m_string_tables;
   68.70 +  ElfStringTable*              m_string_tables;
   68.71  
   68.72 -  Decoder::decoder_status  m_status;
   68.73 +  NullDecoder::decoder_status  m_status;
   68.74  };
   68.75  
   68.76  #endif // _WINDOWS
   68.77  
   68.78 -#endif // __ELF_FILE_HPP
   68.79 +#endif // SHARE_VM_UTILITIES_ELF_FILE_HPP
    69.1 --- a/src/share/vm/utilities/elfStringTable.cpp	Tue Jan 24 18:00:54 2012 -0500
    69.2 +++ b/src/share/vm/utilities/elfStringTable.cpp	Wed Jan 25 19:26:35 2012 -0500
    69.3 @@ -38,7 +38,7 @@
    69.4    m_index = index;
    69.5    m_next = NULL;
    69.6    m_file = file;
    69.7 -  m_status = Decoder::no_error;
    69.8 +  m_status = NullDecoder::no_error;
    69.9  
   69.10    // try to load the string table
   69.11    long cur_offset = ftell(file);
   69.12 @@ -48,7 +48,7 @@
   69.13      if (fseek(file, shdr.sh_offset, SEEK_SET) ||
   69.14        fread((void*)m_table, shdr.sh_size, 1, file) != 1 ||
   69.15        fseek(file, cur_offset, SEEK_SET)) {
   69.16 -      m_status = Decoder::file_invalid;
   69.17 +      m_status = NullDecoder::file_invalid;
   69.18        os::free((void*)m_table);
   69.19        m_table = NULL;
   69.20      }
   69.21 @@ -67,22 +67,23 @@
   69.22    }
   69.23  }
   69.24  
   69.25 -const char* ElfStringTable::string_at(int pos) {
   69.26 -  if (m_status != Decoder::no_error) {
   69.27 -    return NULL;
   69.28 +bool ElfStringTable::string_at(int pos, char* buf, int buflen) {
   69.29 +  if (NullDecoder::is_error(m_status)) {
   69.30 +    return false;
   69.31    }
   69.32    if (m_table != NULL) {
   69.33 -    return (const char*)(m_table + pos);
   69.34 +    jio_snprintf(buf, buflen, "%s", (const char*)(m_table + pos));
   69.35 +    return true;
   69.36    } else {
   69.37      long cur_pos = ftell(m_file);
   69.38      if (cur_pos == -1 ||
   69.39        fseek(m_file, m_shdr.sh_offset + pos, SEEK_SET) ||
   69.40 -      fread(m_symbol, 1, MAX_SYMBOL_LEN, m_file) <= 0 ||
   69.41 +      fread(buf, 1, buflen, m_file) <= 0 ||
   69.42        fseek(m_file, cur_pos, SEEK_SET)) {
   69.43 -      m_status = Decoder::file_invalid;
   69.44 -      return NULL;
   69.45 +      m_status = NullDecoder::file_invalid;
   69.46 +      return false;
   69.47      }
   69.48 -    return (const char*)m_symbol;
   69.49 +    return true;
   69.50    }
   69.51  }
   69.52  
    70.1 --- a/src/share/vm/utilities/elfStringTable.hpp	Tue Jan 24 18:00:54 2012 -0500
    70.2 +++ b/src/share/vm/utilities/elfStringTable.hpp	Wed Jan 25 19:26:35 2012 -0500
    70.3 @@ -1,5 +1,5 @@
    70.4  /*
    70.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    70.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    70.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    70.8   *
    70.9   * This code is free software; you can redistribute it and/or modify it
   70.10 @@ -22,8 +22,8 @@
   70.11   *
   70.12   */
   70.13  
   70.14 -#ifndef __ELF_STRING_TABLE_HPP
   70.15 -#define __ELF_STRING_TABLE_HPP
   70.16 +#ifndef SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP
   70.17 +#define SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP
   70.18  
   70.19  #if !defined(_WINDOWS) && !defined(__APPLE__)
   70.20  
   70.21 @@ -35,9 +35,6 @@
   70.22  // The string table represents a string table section in an elf file.
   70.23  // Whenever there is enough memory, it will load whole string table as
   70.24  // one blob. Otherwise, it will load string from file when requested.
   70.25 -
   70.26 -#define MAX_SYMBOL_LEN  256
   70.27 -
   70.28  class ElfStringTable: CHeapObj {
   70.29    friend class ElfFile;
   70.30   public:
   70.31 @@ -48,10 +45,10 @@
   70.32    int index() { return m_index; };
   70.33  
   70.34    // get string at specified offset
   70.35 -  const char* string_at(int offset);
   70.36 +  bool string_at(int offset, char* buf, int buflen);
   70.37  
   70.38    // get status code
   70.39 -  Decoder::decoder_status get_status() { return m_status; };
   70.40 +  NullDecoder::decoder_status get_status() { return m_status; };
   70.41  
   70.42   protected:
   70.43    ElfStringTable*        m_next;
   70.44 @@ -69,13 +66,10 @@
   70.45    // section header
   70.46    Elf_Shdr                 m_shdr;
   70.47  
   70.48 -  // buffer for reading individual string
   70.49 -  char                     m_symbol[MAX_SYMBOL_LEN];
   70.50 -
   70.51    // error code
   70.52 -  Decoder::decoder_status  m_status;
   70.53 +  NullDecoder::decoder_status  m_status;
   70.54  };
   70.55  
   70.56 -#endif // _WINDOWS
   70.57 +#endif // _WINDOWS and _APPLE
   70.58  
   70.59 -#endif // __ELF_STRING_TABLE_HPP
   70.60 +#endif // SHARE_VM_UTILITIES_ELF_STRING_TABLE_HPP
    71.1 --- a/src/share/vm/utilities/elfSymbolTable.cpp	Tue Jan 24 18:00:54 2012 -0500
    71.2 +++ b/src/share/vm/utilities/elfSymbolTable.cpp	Wed Jan 25 19:26:35 2012 -0500
    71.3 @@ -34,7 +34,7 @@
    71.4    m_symbols = NULL;
    71.5    m_next = NULL;
    71.6    m_file = file;
    71.7 -  m_status = Decoder::no_error;
    71.8 +  m_status = NullDecoder::no_error;
    71.9  
   71.10    // try to load the string table
   71.11    long cur_offset = ftell(file);
   71.12 @@ -45,16 +45,16 @@
   71.13        if (fseek(file, shdr.sh_offset, SEEK_SET) ||
   71.14          fread((void*)m_symbols, shdr.sh_size, 1, file) != 1 ||
   71.15          fseek(file, cur_offset, SEEK_SET)) {
   71.16 -        m_status = Decoder::file_invalid;
   71.17 +        m_status = NullDecoder::file_invalid;
   71.18          os::free(m_symbols);
   71.19          m_symbols = NULL;
   71.20        }
   71.21      }
   71.22 -    if (m_status == Decoder::no_error) {
   71.23 +    if (!NullDecoder::is_error(m_status)) {
   71.24        memcpy(&m_shdr, &shdr, sizeof(Elf_Shdr));
   71.25      }
   71.26    } else {
   71.27 -    m_status = Decoder::file_invalid;
   71.28 +    m_status = NullDecoder::file_invalid;
   71.29    }
   71.30  }
   71.31  
   71.32 @@ -68,13 +68,13 @@
   71.33    }
   71.34  }
   71.35  
   71.36 -Decoder::decoder_status ElfSymbolTable::lookup(address addr, int* stringtableIndex, int* posIndex, int* offset) {
   71.37 +bool ElfSymbolTable::lookup(address addr, int* stringtableIndex, int* posIndex, int* offset) {
   71.38    assert(stringtableIndex, "null string table index pointer");
   71.39    assert(posIndex, "null string table offset pointer");
   71.40    assert(offset, "null offset pointer");
   71.41  
   71.42 -  if (m_status != Decoder::no_error) {
   71.43 -    return m_status;
   71.44 +  if (NullDecoder::is_error(m_status)) {
   71.45 +    return false;
   71.46    }
   71.47  
   71.48    address pc = 0;
   71.49 @@ -97,8 +97,8 @@
   71.50      long cur_pos;
   71.51      if ((cur_pos = ftell(m_file)) == -1 ||
   71.52        fseek(m_file, m_shdr.sh_offset, SEEK_SET)) {
   71.53 -      m_status = Decoder::file_invalid;
   71.54 -      return m_status;
   71.55 +      m_status = NullDecoder::file_invalid;
   71.56 +      return false;
   71.57      }
   71.58  
   71.59      Elf_Sym sym;
   71.60 @@ -114,13 +114,13 @@
   71.61            }
   71.62          }
   71.63        } else {
   71.64 -        m_status = Decoder::file_invalid;
   71.65 -        return m_status;
   71.66 +        m_status = NullDecoder::file_invalid;
   71.67 +        return false;
   71.68        }
   71.69      }
   71.70      fseek(m_file, cur_pos, SEEK_SET);
   71.71    }
   71.72 -  return m_status;
   71.73 +  return true;
   71.74  }
   71.75  
   71.76  #endif // _WINDOWS
    72.1 --- a/src/share/vm/utilities/elfSymbolTable.hpp	Tue Jan 24 18:00:54 2012 -0500
    72.2 +++ b/src/share/vm/utilities/elfSymbolTable.hpp	Wed Jan 25 19:26:35 2012 -0500
    72.3 @@ -1,5 +1,5 @@
    72.4  /*
    72.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    72.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    72.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    72.8   *
    72.9   * This code is free software; you can redistribute it and/or modify it
   72.10 @@ -22,8 +22,8 @@
   72.11   *
   72.12   */
   72.13  
   72.14 -#ifndef __ELF_SYMBOL_TABLE_HPP
   72.15 -#define __ELF_SYMBOL_TABLE_HPP
   72.16 +#ifndef SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP
   72.17 +#define SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP
   72.18  
   72.19  #if !defined(_WINDOWS) && !defined(__APPLE__)
   72.20  
   72.21 @@ -45,9 +45,9 @@
   72.22    ~ElfSymbolTable();
   72.23  
   72.24    // search the symbol that is nearest to the specified address.
   72.25 -  Decoder::decoder_status lookup(address addr, int* stringtableIndex, int* posIndex, int* offset);
   72.26 +  bool lookup(address addr, int* stringtableIndex, int* posIndex, int* offset);
   72.27  
   72.28 -  Decoder::decoder_status get_status() { return m_status; };
   72.29 +  NullDecoder::decoder_status get_status() { return m_status; };
   72.30  
   72.31   protected:
   72.32    ElfSymbolTable*  m_next;
   72.33 @@ -62,9 +62,9 @@
   72.34    // section header
   72.35    Elf_Shdr            m_shdr;
   72.36  
   72.37 -  Decoder::decoder_status  m_status;
   72.38 +  NullDecoder::decoder_status  m_status;
   72.39  };
   72.40  
   72.41 -#endif // _WINDOWS
   72.42 +#endif // _WINDOWS and _APPLE
   72.43  
   72.44 -#endif // __ELF_SYMBOL_TABLE_HPP
   72.45 +#endif // SHARE_VM_UTILITIES_ELF_SYMBOL_TABLE_HPP
    73.1 --- a/src/share/vm/utilities/globalDefinitions.hpp	Tue Jan 24 18:00:54 2012 -0500
    73.2 +++ b/src/share/vm/utilities/globalDefinitions.hpp	Wed Jan 25 19:26:35 2012 -0500
    73.3 @@ -298,6 +298,11 @@
    73.4  const juint   max_juint   = (juint)-1;   // 0xFFFFFFFF largest juint
    73.5  const julong  max_julong  = (julong)-1;  // 0xFF....FF largest julong
    73.6  
    73.7 +typedef jbyte  s1;
    73.8 +typedef jshort s2;
    73.9 +typedef jint   s4;
   73.10 +typedef jlong  s8;
   73.11 +
   73.12  //----------------------------------------------------------------------------------------------------
   73.13  // JVM spec restrictions
   73.14  
    74.1 --- a/src/share/vm/utilities/vmError.cpp	Tue Jan 24 18:00:54 2012 -0500
    74.2 +++ b/src/share/vm/utilities/vmError.cpp	Wed Jan 25 19:26:35 2012 -0500
    74.3 @@ -571,8 +571,6 @@
    74.4         if (fr.pc()) {
    74.5            st->print_cr("Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)");
    74.6  
    74.7 -          // initialize decoder to decode C frames
    74.8 -          Decoder decoder;
    74.9  
   74.10            int count = 0;
   74.11            while (count++ < StackPrintLimit) {

mercurial