This commit is contained in:
Coleen Phillimore 2016-04-09 08:34:51 -04:00
commit 6cec4d5047
86 changed files with 3225 additions and 381 deletions

View file

@ -237,19 +237,21 @@ else
$(MAKE_ARGS) $(VM_TARGET) $(MAKE_ARGS) $(VM_TARGET)
endif endif
# NOTE: Changes in this file was just to facilitate comparison when
# developing the new build, and should not be integrated.
generic_buildcore: $(HOTSPOT_SCRIPT) generic_buildcore: $(HOTSPOT_SCRIPT)
ifeq ($(HS_ARCH),ppc) #ifeq ($(HS_ARCH),ppc)
ifeq ($(ARCH_DATA_MODEL),64) # ifeq ($(ARCH_DATA_MODEL),64)
$(MKDIR) -p $(OUTPUTDIR) $(MKDIR) -p $(OUTPUTDIR)
$(CD) $(OUTPUTDIR); \ $(CD) $(OUTPUTDIR); \
$(MAKE) -f $(ABS_OS_MAKEFILE) \ $(MAKE) -f $(ABS_OS_MAKEFILE) \
$(MAKE_ARGS) $(VM_TARGET) $(MAKE_ARGS) $(VM_TARGET)
else # else
@$(ECHO) "No ($(VM_TARGET)) for ppc ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)" # @$(ECHO) "No ($(VM_TARGET)) for ppc ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)"
endif # endif
else #else
@$(ECHO) "No ($(VM_TARGET)) for $(HS_ARCH)" # @$(ECHO) "No ($(VM_TARGET)) for $(HS_ARCH)"
endif #endif
generic_buildzero: $(HOTSPOT_SCRIPT) generic_buildzero: $(HOTSPOT_SCRIPT)
$(MKDIR) -p $(OUTPUTDIR) $(MKDIR) -p $(OUTPUTDIR)

View file

@ -53,13 +53,13 @@ VPATH += $(Src_Dirs_V:%=%:)
TraceGeneratedNames = \ TraceGeneratedNames = \
traceEventClasses.hpp \ traceEventClasses.hpp \
traceEventIds.hpp \ traceEventIds.hpp \
traceTypes.hpp traceTypes.hpp
ifeq ($(HAS_ALT_SRC), true) ifeq ($(HAS_ALT_SRC), true)
TraceGeneratedNames += \ TraceGeneratedNames += \
traceRequestables.hpp \ traceRequestables.hpp \
traceEventControl.hpp traceEventControl.hpp
endif endif
TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%) TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)

View file

@ -53,13 +53,13 @@ VPATH += $(Src_Dirs_V:%=%:)
TraceGeneratedNames = \ TraceGeneratedNames = \
traceEventClasses.hpp \ traceEventClasses.hpp \
traceEventIds.hpp \ traceEventIds.hpp \
traceTypes.hpp traceTypes.hpp
ifeq ($(HAS_ALT_SRC), true) ifeq ($(HAS_ALT_SRC), true)
TraceGeneratedNames += \ TraceGeneratedNames += \
traceRequestables.hpp \ traceRequestables.hpp \
traceEventControl.hpp traceEventControl.hpp
endif endif
TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%) TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)

View file

@ -221,7 +221,7 @@ ifeq ($(USE_CLANG),)
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
# GCC < 4.3 # GCC < 4.3
WARNING_FLAGS += -Wconversion WARNING_FLAGS += -Wconversion
endif endif
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1" ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
# GCC >= 4.8 # GCC >= 4.8
# This flag is only known since GCC 4.3. Gcc 4.8 contains a fix so that with templates no # This flag is only known since GCC 4.3. Gcc 4.8 contains a fix so that with templates no
@ -260,7 +260,7 @@ endif
OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS) OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS)
# Variable tracking size limit exceeded for VMStructs::init() # Variable tracking size limit exceeded for VMStructs::init()
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "1" ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "1"
# GCC >= 4.3 # GCC >= 4.3
# Gcc 4.1.2 does not support this flag, nor does it have problems compiling the file. # Gcc 4.1.2 does not support this flag, nor does it have problems compiling the file.

View file

@ -53,13 +53,13 @@ VPATH += $(Src_Dirs_V:%=%:)
TraceGeneratedNames = \ TraceGeneratedNames = \
traceEventClasses.hpp \ traceEventClasses.hpp \
traceEventIds.hpp \ traceEventIds.hpp \
traceTypes.hpp traceTypes.hpp
ifeq ($(HAS_ALT_SRC), true) ifeq ($(HAS_ALT_SRC), true)
TraceGeneratedNames += \ TraceGeneratedNames += \
traceRequestables.hpp \ traceRequestables.hpp \
traceEventControl.hpp traceEventControl.hpp
endif endif
TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%) TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)

View file

@ -30,3 +30,8 @@ TYPE = ZERO
# Install libjvm.so, etc in in server directory. # Install libjvm.so, etc in in server directory.
VM_SUBDIR = server VM_SUBDIR = server
# Disable trace for zero builds
# NOTE: This is used for simple comparison with the new build system, and
# should not be merged into mainline with build-infra.
INCLUDE_TRACE := false

View file

@ -41,7 +41,6 @@
JVM_DumpAllStacks; JVM_DumpAllStacks;
JVM_DumpThreads; JVM_DumpThreads;
JVM_FillInStackTrace; JVM_FillInStackTrace;
JVM_FillStackFrames;
JVM_FindClassFromCaller; JVM_FindClassFromCaller;
JVM_FindClassFromClass; JVM_FindClassFromClass;
JVM_FindClassFromBootLoader; JVM_FindClassFromBootLoader;
@ -157,13 +156,13 @@
JVM_SetClassSigners; JVM_SetClassSigners;
JVM_SetNativeThreadName; JVM_SetNativeThreadName;
JVM_SetPrimitiveArrayElement; JVM_SetPrimitiveArrayElement;
JVM_SetMethodInfo;
JVM_SetThreadPriority; JVM_SetThreadPriority;
JVM_Sleep; JVM_Sleep;
JVM_StartThread; JVM_StartThread;
JVM_StopThread; JVM_StopThread;
JVM_SuspendThread; JVM_SuspendThread;
JVM_SupportsCX8; JVM_SupportsCX8;
JVM_ToStackTraceElement;
JVM_TotalMemory; JVM_TotalMemory;
JVM_UnloadLibrary; JVM_UnloadLibrary;
JVM_Yield; JVM_Yield;

View file

@ -270,7 +270,7 @@ $(DTRACE.o): $(DTRACE).d $(DTraced_Files)
@echo $(LOG_INFO) Compiling $(DTRACE).d @echo $(LOG_INFO) Compiling $(DTRACE).d
$(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \ $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \
$(DTraced_Files) ||\ $(sort $(DTraced_Files)) ||\
STATUS=$$?;\ STATUS=$$?;\
if [ x"$$STATUS" = x"1" ]; then \ if [ x"$$STATUS" = x"1" ]; then \
if [ x`uname -r` = x"5.10" -a \ if [ x`uname -r` = x"5.10" -a \

View file

@ -53,13 +53,13 @@ VPATH += $(Src_Dirs_V:%=%:)
TraceGeneratedNames = \ TraceGeneratedNames = \
traceEventClasses.hpp \ traceEventClasses.hpp \
traceEventIds.hpp \ traceEventIds.hpp \
traceTypes.hpp traceTypes.hpp
ifeq ($(HAS_ALT_SRC), true) ifeq ($(HAS_ALT_SRC), true)
TraceGeneratedNames += \ TraceGeneratedNames += \
traceRequestables.hpp \ traceRequestables.hpp \
traceEventControl.hpp traceEventControl.hpp
endif endif
TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%) TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)

View file

@ -48,10 +48,10 @@ HS_BUILD_ID=$(HOTSPOT_VERSION_STRING)-debug
# Force resources to be rebuilt every time # Force resources to be rebuilt every time
$(Res_Files): FORCE $(Res_Files): FORCE
# NOTE: Changes in this file was just to give a proper command line when linking
# for use when developing the new build, and should not be integrated.
$(AOUT): $(Res_Files) $(Obj_Files) vm.def $(AOUT): $(Res_Files) $(Obj_Files) vm.def
$(LD) @<< $(LD) $(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
$(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
<<
!if "$(MT)" != "" !if "$(MT)" != ""
# The previous link command created a .manifest file that we want to # The previous link command created a .manifest file that we want to
# insert into the linked artifact so we do not need to track it # insert into the linked artifact so we do not need to track it

View file

@ -47,10 +47,10 @@ HS_BUILD_ID=$(HOTSPOT_VERSION_STRING)-fastdebug
# Force resources to be rebuilt every time # Force resources to be rebuilt every time
$(Res_Files): FORCE $(Res_Files): FORCE
# NOTE: Changes in this file was just to give a proper command line when linking
# for use when developing the new build, and should not be integrated.
$(AOUT): $(Res_Files) $(Obj_Files) vm.def $(AOUT): $(Res_Files) $(Obj_Files) vm.def
$(LD) @<< $(LD) $(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
$(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
<<
!if "$(MT)" != "" !if "$(MT)" != ""
# The previous link command created a .manifest file that we want to # The previous link command created a .manifest file that we want to
# insert into the linked artifact so we do not need to track it # insert into the linked artifact so we do not need to track it

View file

@ -51,10 +51,11 @@ HS_BUILD_ID=$(HOTSPOT_VERSION_STRING)
# Force resources to be rebuilt every time # Force resources to be rebuilt every time
$(Res_Files): FORCE $(Res_Files): FORCE
# NOTE: Changes in this file was just to give a proper command line when linking
# for use when developing the new build, and should not be integrated.
$(AOUT): $(Res_Files) $(Obj_Files) vm.def $(AOUT): $(Res_Files) $(Obj_Files) vm.def
$(LD) @<< $(LD) $(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
$(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
<<
!if "$(MT)" != "" !if "$(MT)" != ""
# The previous link command created a .manifest file that we want to # The previous link command created a .manifest file that we want to
# insert into the linked artifact so we do not need to track it # insert into the linked artifact so we do not need to track it

View file

@ -41,6 +41,12 @@ HAS_ALT_SRC = true
!endif !endif
!endif !endif
!ifndef OPENJDK
!if EXISTS($(TraceAltSrcDir))
HAS_ALT_SRC = true
!endif
!endif
TraceGeneratedNames = \ TraceGeneratedNames = \
traceEventClasses.hpp \ traceEventClasses.hpp \
traceEventIds.hpp \ traceEventIds.hpp \

View file

@ -305,8 +305,10 @@ bytecodeInterpreterWithChecks.obj: ..\generated\jvmtifiles\bytecodeInterpreterWi
# This guy should remain a single colon rule because # This guy should remain a single colon rule because
# otherwise we can't specify the output filename. # otherwise we can't specify the output filename.
# NOTE: Changes in this file was just to give a proper command line when linking
# for use when developing the new build, and should not be integrated.
{$(COMMONSRC)\os\windows\vm}.rc.res: {$(COMMONSRC)\os\windows\vm}.rc.res:
@$(RC) $(RC_FLAGS) /fo"$@" $< $(RC) $(RC_FLAGS) /fo"$@" $<
{$(COMMONSRC)\cpu\$(Platform_arch)\vm}.cpp.obj:: {$(COMMONSRC)\cpu\$(Platform_arch)\vm}.cpp.obj::
$(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $<

View file

@ -0,0 +1,54 @@
#
# Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# This must be the first rule
default: all
include $(SPEC)
include MakeBase.gmk
VARIANT_TARGETS := $(foreach v, $(JVM_VARIANTS), variant-$v)
VARIANT_GENSRC_TARGETS := $(addsuffix -gensrc, $(VARIANT_TARGETS))
VARIANT_LIBS_TARGETS := $(addsuffix -libs, $(VARIANT_TARGETS))
$(VARIANT_GENSRC_TARGETS): variant-%-gensrc:
$(call LogWarn, Building JVM variant '$*' with features '$(JVM_FEATURES_$*)')
+$(MAKE) -f gensrc/GenerateSources.gmk JVM_VARIANT=$*
$(VARIANT_LIBS_TARGETS): variant-%-libs: variant-%-gensrc
+$(MAKE) -f lib/CompileLibraries.gmk JVM_VARIANT=$*
$(VARIANT_TARGETS): variant-%: variant-%-gensrc variant-%-libs
jsig:
+$(MAKE) -f lib/CompileLibjsig.gmk
dist: $(VARIANT_TARGETS) jsig
+$(MAKE) -f Dist.gmk
all: dist
.PHONY: $(VARIANT_TARGETS) $(VARIANT_GENSRC_TARGETS) $(VARIANT_LIBS_TARGETS) \
jsig dist all

239
hotspot/makefiles/Dist.gmk Normal file
View file

@ -0,0 +1,239 @@
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
# Copy the generated output into well-defined places in the dist directory.
# This must be the first rule
default: all
include $(SPEC)
include MakeBase.gmk
$(eval $(call IncludeCustomExtension, hotspot, Dist.gmk))
DIST_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/dist
# Unfortunately, all platforms have different target subdirs.
ifeq ($(OPENJDK_TARGET_OS), windows)
LIB_SUBDIR := bin
else ifeq ($(OPENJDK_TARGET_OS), macosx)
LIB_SUBDIR := lib
else
LIB_SUBDIR := lib$(OPENJDK_TARGET_CPU_LIBDIR)
endif
################################################################################
# Functions to setup copying of files for variants
# Support macro for SetupDistLibFile
define macosx_universalize
$(MKDIR) -p $(@D)
$(LIPO) -create -output $@ $<
endef
################################################################################
# Setup make rules to copy a native library and associated data.
#
# Parameter 1 is the name of the rule. This name is used as variable prefix,
# and the targets generated are listed in a variable by that name.
#
# Remaining parameters are named arguments. These include:
# NAME -- The base name of the native library (e.g. 'jvm')
# VARIANT -- The variant to copy from
# VARIANT_TARGET_DIR -- The variant target sub dir, with trailing slash, optional
SetupDistLibFile = $(NamedParamsMacroTemplate)
define SetupDistLibFileBody
ifneq ($$($1_VARIANT), )
$1_SRC_DIR := $$(HOTSPOT_OUTPUTDIR)/variant-$$($1_VARIANT)/lib$$($1_NAME)
else
$1_SRC_DIR := $$(HOTSPOT_OUTPUTDIR)/lib$$($1_NAME)
endif
$1_LIB_NAME := $(LIBRARY_PREFIX)$$($1_NAME)
$1_TARGET_DIR := $$(DIST_OUTPUTDIR)/$$(LIB_SUBDIR)/$$($1_VARIANT_TARGET_DIR)
ifeq ($(OPENJDK_TARGET_OS), macosx)
# We must use the 'universalize' macro to run lipo on shared libraries, at
# least until JDK-8069540 is fixed.
$1_MACRO := macosx_universalize
endif
# Copy the the native library.
$$(eval $$(call SetupCopyFiles, $1_COPY_LIB, \
DEST := $$($1_TARGET_DIR), \
MACRO := $$($1_MACRO), \
FILES := $$(wildcard \
$$($1_SRC_DIR)/$$($1_LIB_NAME)$(SHARED_LIBRARY_SUFFIX)), \
))
TARGETS += $$($1_COPY_LIB)
# Copy related data (debug symbols, static-build symbols file etc)
$$(eval $$(call SetupCopyFiles, $1_COPY_FILES, \
DEST := $$($1_TARGET_DIR), \
FILES := $$(wildcard \
$$(addprefix $$($1_SRC_DIR)/$$($1_LIB_NAME), \
.diz .debuginfo .pdb .map .symbols)), \
))
TARGETS += $$($1_COPY_FILES)
ifeq ($(OPENJDK_TARGET_OS), macosx)
# Debug symbols on macosx is a directory, not a single file, per library.
$1_DSYM_SRC := $$($1_SRC_DIR)/$$($1_LIB_NAME)$(SHARED_LIBRARY_SUFFIX).dSYM)
ifneq ($$(wildcard $$($1_DSYM_SRC)), )
$$(eval $$(call SetupCopyFiles, $1_COPY_DSYM_DIR, \
DEST := $$($1_TARGET_DIR), \
SRC := $$($1_SRC_DIR), \
FILES := $$(shell $(FIND) $$($1_DSYM_SRC) -type f), \
))
TARGETS += $$($1_COPY_DSYM_DIR)
endif
endif
endef
################################################################################
# Copy common files, which are independent on the jvm variant(s) being built.
# For files that were generated during the build, we assume all versions of
# these files are identical, and just pick one arbitrarily to use as source.
ANY_JVM_VARIANT := $(firstword $(JVM_VARIANTS))
JVM_VARIANT_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/variant-$(ANY_JVM_VARIANT)
### Copy platform-independent .h files
INCLUDE_FILES_SRC_DIR := $(HOTSPOT_TOPDIR)/src/share/vm
$(eval $(call SetupCopyFiles, COPY_INCLUDE, \
SRC := $(INCLUDE_FILES_SRC_DIR), \
DEST := $(DIST_OUTPUTDIR)/include, \
FLATTEN := true, \
FILES := $(INCLUDE_FILES_SRC_DIR)/prims/jni.h \
$(INCLUDE_FILES_SRC_DIR)/code/jvmticmlr.h \
$(INCLUDE_FILES_SRC_DIR)/services/jmm.h))
TARGETS += $(COPY_INCLUDE)
### Copy jni_md.h
# This might have been defined in a custom extension
ifeq ($(JNI_MD_H_SRC), )
JNI_MD_H_SRC := $(HOTSPOT_TOPDIR)/src/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/vm/jni_$(HOTSPOT_TARGET_CPU_ARCH).h
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
# NOTE: This should most likely be darwin, but the old hotspot build uses bsd
JNI_MD_SUBDIR := bsd
else ifeq ($(OPENJDK_TARGET_OS), windows)
JNI_MD_SUBDIR := win32
else
JNI_MD_SUBDIR := $(OPENJDK_TARGET_OS)
endif
# SetupCopyFiles is not used here since it's non-trivial to copy a single
# file with a different target name.
$(DIST_OUTPUTDIR)/include/$(JNI_MD_SUBDIR)/jni_md.h: $(JNI_MD_H_SRC)
$(call LogInfo, Copying hotspot/dist/include/$(JNI_MD_SUBDIR)/jni_md.h)
$(install-file)
TARGETS += $(DIST_OUTPUTDIR)/include/$(JNI_MD_SUBDIR)/jni_md.h
$(eval $(call SetupCopyFiles, COPY_JVMTI_H, \
DEST := $(DIST_OUTPUTDIR)/include, \
FLATTEN := true, \
FILES := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles/jvmti.h))
TARGETS += $(COPY_JVMTI_H)
# NOTE: In the old build, this file was not copied on Windows.
ifneq ($(OPENJDK_TARGET_OS), windows)
$(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \
DEST := $(DIST_OUTPUTDIR)/docs/platform/jvmti, \
FILES := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles/jvmti.html))
endif
TARGETS += $(COPY_JVMTI_HTML)
ifeq ($(OPENJDK_TARGET_OS), windows)
$(eval $(call SetupCopyFiles, COPY_JVM_LIB, \
DEST := $(DIST_OUTPUTDIR)/lib, \
FILES :=$(JVM_VARIANT_OUTPUTDIR)/libjvm/objs/jvm.lib))
TARGETS += $(COPY_JVM_LIB)
endif
# Copy libjsig, if it exists
$(eval $(call SetupDistLibFile, DIST_jsig, \
NAME := jsig, \
))
################################################################################
# Copy variant-specific files
# Setup make rules to copy a single variant to dist.
# $1: The name of the variant
define SetupDistForVariant
ifneq ($$(filter client minimal, $1), )
VARIANT_TARGET_DIR := $1
else
# Use 'server' as default target directory name for all other variants.
VARIANT_TARGET_DIR := server
endif
$$(eval $$(call SetupDistLibFile, DIST_$(strip $1)_jvm, \
NAME := jvm, \
VARIANT := $1, \
VARIANT_TARGET_DIR := $$(VARIANT_TARGET_DIR)/, \
))
# Copy the dtrace libraries, if they exist
$$(eval $$(call SetupDistLibFile, DIST_$(strip $1)_jvm_db, \
NAME := jvm_db, \
VARIANT := $1, \
VARIANT_TARGET_DIR := $$(VARIANT_TARGET_DIR)/, \
))
$$(eval $$(call SetupDistLibFile, DIST_$(strip $1)_jvm_dtrace, \
NAME := jvm_dtrace, \
VARIANT := $1, \
VARIANT_TARGET_DIR := $$(VARIANT_TARGET_DIR)/, \
))
# Copy the Xusage.txt file
$$(eval $$(call SetupCopyFiles, DIST_$(strip $1)_Xusage, \
DEST := $$(DIST_OUTPUTDIR)/$$(LIB_SUBDIR)/$(strip $1), \
FILES := $$(HOTSPOT_OUTPUTDIR)/variant-$(strip $1)/support/misc/Xusage.txt, \
))
TARGETS += $$(DIST_$(strip $1)_Xusage)
endef
$(foreach variant, $(JVM_VARIANTS), \
$(eval $(call SetupDistForVariant, $(variant))) \
)
################################################################################
all: $(TARGETS)
.PHONY: all

View file

@ -0,0 +1,45 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
ifeq ($(JVM_VARIANT), )
$(error This makefile must be called with JVM_VARIANT set)
endif
JVM_VARIANT_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/variant-$(JVM_VARIANT)
JVM_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm
JVM_SUPPORT_DIR := $(JVM_VARIANT_OUTPUTDIR)/support
DTRACE_SUPPORT_DIR := $(JVM_SUPPORT_DIR)/dtrace
################################################################################
# Test if a feature is available in the present build of JVM_VARIANT. Will return
# 'true' or 'false'.
# $1 - the feature to test for
check-jvm-feature = \
$(strip \
$(if $(filter-out $(VALID_JVM_FEATURES), $1), \
$(error Internal error: Invalid feature tested: $1)) \
$(if $(filter $1, $(JVM_FEATURES_$(JVM_VARIANT))), true, false))

View file

@ -0,0 +1,75 @@
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include NativeCompilation.gmk
include TextFileProcessing.gmk
include HotspotCommon.gmk
# The real work is done in these files
include gensrc/GensrcAdlc.gmk
include gensrc/GensrcDtrace.gmk
include gensrc/GensrcJvmti.gmk
$(eval $(call IncludeCustomExtension, hotspot, gensrc/GenerateSources.gmk))
# While technically the rules below are "gendata" which can be done in parallel
# with native compilation, let's keep it here for simplicity.
# The Xusage.txt file needs to have platform specific path separator
$(eval $(call SetupTextFileProcessing, CREATE_XUSAGE, \
SOURCE_FILES := $(HOTSPOT_TOPDIR)/src/share/vm/Xusage.txt, \
OUTPUT_FILE := $(JVM_SUPPORT_DIR)/misc/Xusage.txt, \
REPLACEMENTS := separated by ;> => separated by $(PATH_SEP)> ; , \
))
TARGETS += $(CREATE_XUSAGE)
# Setup the hotspot launcher script for developer use
$(eval $(call SetupTextFileProcessing, CREATE_HOTSPOT_LAUNCHER, \
SOURCE_FILES := $(HOTSPOT_TOPDIR)/make/hotspot.script, \
OUTPUT_FILE := $(JVM_OUTPUTDIR)/hotspot, \
REPLACEMENTS := \
@@LIBARCH@@ => $(OPENJDK_TARGET_CPU_LEGACY_LIB) ; \
@@JDK_IMPORT_PATH@@ => $(JDK_OUTPUTDIR) ; , \
))
CHMOD_HOTSPOT_LAUNCHER := $(JVM_VARIANT_OUTPUTDIR)/libjvm/_hotspot-script-chmod.marker
$(CHMOD_HOTSPOT_LAUNCHER): $(CREATE_HOTSPOT_LAUNCHER)
$(CHMOD) +x $<
$(TOUCH) $@
TARGETS += $(CREATE_HOTSPOT_LAUNCHER) $(CHMOD_HOTSPOT_LAUNCHER)
all: $(TARGETS)
.PHONY: all

View file

@ -0,0 +1,192 @@
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
$(eval $(call IncludeCustomExtension, hotspot, gensrc/GensrcAdlc.gmk))
ifeq ($(call check-jvm-feature, compiler2), true)
ADLC_SUPPORT_DIR := $(JVM_SUPPORT_DIR)/adlc
##############################################################################
# Build the ad compiler (the adlc build tool)
# Flags depending on the build platform/tool chain
# NOTE: No optimization or debug flags set here
ifeq ($(OPENJDK_BUILD_OS), linux)
ADLC_CFLAGS := -fno-exceptions -DLINUX
else ifeq ($(OPENJDK_BUILD_OS), solaris)
ADLC_LDFLAGS := -m64
ADLC_CFLAGS := -m64
ADLC_CFLAGS_WARNINGS := +w
else ifeq ($(OPENJDK_BUILD_OS), aix)
# FIXME: Not implemented. These flags are likely, however
# ADLC_LDFLAGS := -q64
# ADLC_CFLAGS := -qnortti -qnoeh -q64
else ifeq ($(OPENJDK_BUILD_OS), windows)
ADLC_LDFLAGS := -nologo
ADLC_CFLAGS := -nologo -EHsc
# NOTE: The old build also have -D_CRT_SECURE_NO_DEPRECATE but it doesn't
# seem needed any more.
ADLC_CFLAGS_WARNINGS := -W3 -D_CRT_SECURE_NO_WARNINGS
endif
# NOTE: The old build didn't set -DASSERT for windows but it doesn't seem to
# hurt.
ADLC_CFLAGS += -DASSERT
ADLC_CFLAGS += -D$(HOTSPOT_TARGET_CPU_DEFINE)
ADLC_CFLAGS += -I$(HOTSPOT_TOPDIR)/src/share/vm
$(eval $(call SetupNativeCompilation, BUILD_ADLC, \
TOOLCHAIN := TOOLCHAIN_BUILD_LINK_CXX, \
SRC := $(HOTSPOT_TOPDIR)/src/share/vm/adlc, \
EXTRA_FILES := $(HOTSPOT_TOPDIR)/src/share/vm/opto/opcodes.cpp, \
CFLAGS := $(ADLC_CFLAGS) $(ADLC_CFLAGS_WARNINGS), \
LDFLAGS := $(ADLC_LDFLAGS), \
LIBS := $(ADLC_LIBS), \
OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/adlc/objs, \
OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/adlc, \
PROGRAM := adlc, \
DEBUG_SYMBOLS := false, \
DISABLED_WARNINGS_clang := parentheses tautological-compare, \
DISABLED_WARNINGS_solstudio := notemsource, \
))
ADLC_TOOL := $(BUILD_ADLC_TARGET)
##############################################################################
# Transform the ad source files into C++ source files using adlc
# Setup flags for the adlc build tool (ADLCFLAGS).
ADLCFLAGS += -q -T
# ADLC flags depending on target OS
ifeq ($(OPENJDK_TARGET_OS), linux)
ADLCFLAGS += -DLINUX=1 -D_GNU_SOURCE=1
else ifeq ($(OPENJDK_TARGET_OS), solaris)
ADLCFLAGS += -DSOLARIS=1 -DSPARC_WORKS=1
else ifeq ($(OPENJDK_TARGET_OS), aix)
# FIXME: Not implemented
else ifeq ($(OPENJDK_TARGET_OS), macosx)
ADLCFLAGS += -D_ALLBSD_SOURCE=1 -D_GNU_SOURCE=1
endif
ifneq ($(OPENJDK_TARGET_OS), windows)
# NOTE: Windows adlc flags was different in the old build. Is this really
# correct?
# -g makes #line directives in the generated C++ files.
ADLCFLAGS += -g
ADLCFLAGS += -D$(HOTSPOT_TARGET_CPU_DEFINE)=1
endif
# This generates checks in the generated C++ files that _LP64 is correctly
# (un)defined when compiling them.
ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
ADLCFLAGS += -D_LP64=1
else
ADLCFLAGS += -U_LP64
endif
##############################################################################
# Concatenate all ad source files into a single file, which will be fed to
# adlc. Also include a #line directive at the start of every included file
# (after the initial header block), stating the original source file name.
#
# Normally, debugging is done directly on the ad_<arch>*.cpp files, but the
# #line directives in those files will be pointing back to <arch>.ad.
# AD_SRC_ROOTS might have been added to by a custom extension
AD_SRC_ROOTS += $(HOTSPOT_TOPDIR)/src
AD_SRC_FILES := $(call uniq, $(wildcard $(foreach d, $(AD_SRC_ROOTS), \
$d/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/vm/$(HOTSPOT_TARGET_CPU).ad \
$d/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/vm/$(HOTSPOT_TARGET_CPU_ARCH).ad \
$d/os_cpu/$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH)/vm/$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH).ad \
)))
SINGLE_AD_SRCFILE := $(ADLC_SUPPORT_DIR)/all-ad-src.ad
INSERT_FILENAME_AWK_SCRIPT := \
'{ \
if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \
if (need_lineno && $$0 !~ /\/\//) \
{ print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \
print \
}'
$(SINGLE_AD_SRCFILE): $(AD_SRC_FILES)
$(call LogInfo, Preprocessing adlc files $(^F))
$(call MakeDir, $(@D))
$(NAWK) $(INSERT_FILENAME_AWK_SCRIPT) $^ > $@
##############################################################################
# Run the adlc tool on the single concatenated ad source file, and store the
# output in support/adlc for further processing.
ADLC_RUN_MARKER := $(ADLC_SUPPORT_DIR)/_adlc_run.marker
$(ADLC_RUN_MARKER): $(BUILD_ADLC) $(SINGLE_AD_SRCFILE)
$(call LogInfo, Generating adlc files)
$(call MakeDir, $(@D))
$(call ExecuteWithLog, $(ADLC_SUPPORT_DIR)/adlc_run, \
$(FIXPATH) $(ADLC_TOOL) $(ADLCFLAGS) $(SINGLE_AD_SRCFILE) \
-c$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU).cpp \
-h$(ADLC_SUPPORT_DIR)/ad_$(HOTSPOT_TARGET_CPU).hpp \
-a$(ADLC_SUPPORT_DIR)/dfa_$(HOTSPOT_TARGET_CPU).cpp \
-v$(ADLC_SUPPORT_DIR)/adGlobals_$(HOTSPOT_TARGET_CPU).hpp)
$(TOUCH) $@
##############################################################################
# Finally copy the generated files from support/adlc into gensrc/adfiles,
# and postprocess them by fixing dummy #line directives.
ADLC_GENERATED_FILES := $(addprefix $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/, \
ad_$(HOTSPOT_TARGET_CPU).cpp \
ad_$(HOTSPOT_TARGET_CPU).hpp \
ad_$(HOTSPOT_TARGET_CPU)_clone.cpp \
ad_$(HOTSPOT_TARGET_CPU)_expand.cpp \
ad_$(HOTSPOT_TARGET_CPU)_format.cpp \
ad_$(HOTSPOT_TARGET_CPU)_gen.cpp \
ad_$(HOTSPOT_TARGET_CPU)_misc.cpp \
ad_$(HOTSPOT_TARGET_CPU)_peephole.cpp \
ad_$(HOTSPOT_TARGET_CPU)_pipeline.cpp \
adGlobals_$(HOTSPOT_TARGET_CPU).hpp \
dfa_$(HOTSPOT_TARGET_CPU).cpp \
)
$(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles/%: $(ADLC_RUN_MARKER)
$(call LogInfo, Postprocessing adlc file $*)
$(call MakeDir, $(@D))
$(NAWK) \
'BEGIN { print "#line 1 \"$*\""; } \
/^#line 999999$$/ {print "#line " (NR+1) " \"$*\""; next} \
{print}' \
< $(ADLC_SUPPORT_DIR)/$* > $@
TARGETS := $(ADLC_GENERATED_FILES)
endif

View file

@ -0,0 +1,56 @@
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
# Gensrc support for dtrace. The files generated here are included by dtrace.hpp
ifeq ($(call check-jvm-feature, dtrace), true)
ifeq ($(OPENJDK_TARGET_OS), solaris)
DTRACE_FLAGS := -64
DTRACE_CPP_FLAGS := -D_LP64
else ifeq ($(OPENJDK_TARGET_OS), macosx)
DTRACE_CPP_FLAGS := -D_LP64 -x c
else ifeq ($(OPENJDK_TARGET_OS), linux)
DTRACE_CPP_FLAGS := -x c
endif
DTRACE_SOURCE_DIR := $(HOTSPOT_TOPDIR)/src/os/posix/dtrace
DTRACE_GENSRC_DIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/dtracefiles
# Make sure we run our selected compiler for preprocessing instead of letting
# the dtrace tool pick it on it's own.
$(DTRACE_GENSRC_DIR)/%.h: $(DTRACE_SOURCE_DIR)/%.d
$(call LogInfo, Generating dtrace header file $(@F))
$(call MakeDir, $(@D) $(DTRACE_SUPPORT_DIR))
$(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, $(CC) -E $(DTRACE_CPP_FLAGS) $< > $(DTRACE_SUPPORT_DIR)/$(@F).d)
$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -h -o $@ -s $(DTRACE_SUPPORT_DIR)/$(@F).d)
# Process all .d files in DTRACE_SOURCE_DIR. They are:
# hotspot_jni.d hotspot.d hs_private.d
TARGETS += $(patsubst $(DTRACE_SOURCE_DIR)/%.d, \
$(DTRACE_GENSRC_DIR)/%.h, $(wildcard $(DTRACE_SOURCE_DIR)/*.d))
endif

View file

@ -0,0 +1,174 @@
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
$(eval $(call IncludeCustomExtension, hotspot, gensrc/GensrcJvmti.gmk))
################################################################################
# Build tools needed for the JVMTI source code generation
JVMTI_TOOLS_SRCDIR := $(HOTSPOT_TOPDIR)/src/share/vm/prims
JVMTI_TOOLS_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/tools/jvmti
$(eval $(call SetupJavaCompiler, GENERATE_OLDBYTECODE, \
JAVAC := $(JAVAC), \
FLAGS := $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA), \
DISABLE_SJAVAC := true, \
))
$(eval $(call SetupJavaCompilation, BUILD_JVMTI_TOOLS, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(JVMTI_TOOLS_SRCDIR), \
INCLUDE_FILES := jvmtiGen.java jvmtiEnvFill.java, \
BIN := $(JVMTI_TOOLS_OUTPUTDIR), \
))
TOOL_JVMTI_GEN := $(JAVA_SMALL) -cp $(JVMTI_TOOLS_OUTPUTDIR) jvmtiGen
TOOL_JVMTI_ENV_FILL := $(JAVA_SMALL) -cp $(JVMTI_TOOLS_OUTPUTDIR) jvmtiEnvFill
################################################################################
# Setup make rules for an xml transform for jvmti/trace file generation.
#
# Parameter 1 is the name of the rule. This name is used as variable prefix,
# and the targets generated are listed in a variable by that name. This name is
# also used as the name of the output file.
#
# Remaining parameters are named arguments. These include:
# XML_FILE -- The input source file to use
# XSL_FILE -- The xsl file to use
# OUTPUT_DIR -- The directory to put the generated file in
# ARGS -- Additional arguments to the jvmtiGen tool
# DEPS -- Additional dependencies
SetupXslTransform = $(NamedParamsMacroTemplate)
define SetupXslTransformBody
$$($1_OUTPUT_DIR)/$1: $$($1_XML_FILE) $$($1_XSL_FILE) $$($1_DEPS) $$(BUILD_JVMTI_TOOLS)
$$(call LogInfo, Generating $$(@F))
$$(call MakeDir, $$(@D))
$$(call ExecuteWithLog, $$@, $$(TOOL_JVMTI_GEN) -IN $$($1_XML_FILE) -XSL $$($1_XSL_FILE) -OUT $$@ $$($1_ARGS))
# jvmtiGen does not return error code properly on fail.
# NOTE: We should really fix jvmtiGen.java instead.
test -f $$@
TARGETS += $$($1_OUTPUT_DIR)/$1
endef
################################################################################
# Create JVMTI files in gensrc/jvmtifiles
JVMTI_SRCDIR := $(HOTSPOT_TOPDIR)/src/share/vm/prims
JVMTI_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles
# Setup rule for generating a jvmti file
#
# $1 is generated source file name in $(JVMTI_OUTPUTDIR)
# $2 is XSL file to use in $(JVMTI_SRCDIR)
# $3 is optional extra arguments to jvmtiGen
define SetupJvmtiGeneration
$$(eval $$(call SetupXslTransform, $1, \
XML_FILE := $$(JVMTI_SRCDIR)/jvmti.xml, \
XSL_FILE := $$(JVMTI_SRCDIR)/$(strip $2), \
OUTPUT_DIR := $$(JVMTI_OUTPUTDIR), \
ARGS := $3, \
DEPS := $$(JVMTI_SRCDIR)/jvmtiLib.xsl, \
))
endef
$(eval $(call SetupJvmtiGeneration, jvmtiEnter.cpp, jvmtiEnter.xsl, \
-PARAM interface jvmti))
$(eval $(call SetupJvmtiGeneration, jvmtiEnterTrace.cpp, jvmtiEnter.xsl, \
-PARAM interface jvmti -PARAM trace Trace))
$(eval $(call SetupJvmtiGeneration, jvmtiEnv.hpp, jvmtiHpp.xsl))
$(eval $(call SetupJvmtiGeneration, jvmti.h, jvmtiH.xsl))
$(eval $(call SetupJvmtiGeneration, jvmti.html, jvmti.xsl))
$(eval $(call SetupJvmtiGeneration, jvmtiEnvStub.cpp, jvmtiEnv.xsl))
JVMTI_BC_SRCDIR := $(HOTSPOT_TOPDIR)/src/share/vm/interpreter
$(eval $(call SetupXslTransform, bytecodeInterpreterWithChecks.cpp, \
XML_FILE := $(JVMTI_BC_SRCDIR)/bytecodeInterpreterWithChecks.xml, \
XSL_FILE := $(JVMTI_BC_SRCDIR)/bytecodeInterpreterWithChecks.xsl, \
OUTPUT_DIR := $(JVMTI_OUTPUTDIR), \
DEPS := $(JVMTI_BC_SRCDIR)/bytecodeInterpreter.cpp, \
))
# We need $(JVMTI_OUTPUTDIR)/jvmtiEnvStub.cpp (generated above) as input
$(JVMTI_OUTPUTDIR)/jvmtiEnvRecommended.cpp: $(JVMTI_SRCDIR)/jvmtiEnv.cpp \
$(JVMTI_OUTPUTDIR)/jvmtiEnvStub.cpp $(BUILD_JVMTI_TOOLS)
$(call LogInfo, Generating $(@F))
$(call MakeDir, $(@D))
$(call ExecuteWithLog, $@, $(TOOL_JVMTI_ENV_FILL) $(JVMTI_SRCDIR)/jvmtiEnv.cpp \
$(JVMTI_OUTPUTDIR)/jvmtiEnvStub.cpp \
$(JVMTI_OUTPUTDIR)/jvmtiEnvRecommended.cpp)
# jvmtiEnvFill does not necessarily return an error code on failure.
# NOTE: We should really fix jvmtiEnvFill.java instead.
test -f $@
TARGETS += $(JVMTI_OUTPUTDIR)/jvmtiEnvRecommended.cpp
################################################################################
# Create trace files in gensrc/tracefiles
TRACE_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/tracefiles
TRACE_SRCDIR := $(HOTSPOT_TOPDIR)/src/share/vm/trace
# Append directories to search (might have been set by custom extensions)
TRACE_SEARCH_DIRS += $(TRACE_SRCDIR)
TRACE_XML ?= $(TRACE_SRCDIR)/trace.xml
# Changing these will trigger a rebuild of generated trace files.
TRACE_DEPS += \
$(TRACE_XML) \
$(TRACE_SRCDIR)/tracetypes.xml \
$(TRACE_SRCDIR)/tracerelationdecls.xml \
$(TRACE_SRCDIR)/traceevents.xml \
$(TRACE_SRCDIR)/trace.dtd \
$(TRACE_SRCDIR)/xinclude.mod \
#
# Setup rule for generating a trace file
#
# $1 is generated source file name in $(TRACE_OUTPUTDIR)
define SetupTraceGeneration
$$(eval $$(call SetupXslTransform, $1, \
XML_FILE := $$(TRACE_XML), \
XSL_FILE := $$(firstword $$(wildcard $$(addsuffix /$$(basename $1).xsl, $$(TRACE_SEARCH_DIRS)))), \
OUTPUT_DIR := $$(TRACE_OUTPUTDIR), \
DEPS := $$(TRACE_DEPS), \
))
endef
# Append files to generated (might have been set by custom extensions)
TRACE_GENSRC_FILES += \
traceEventClasses.hpp \
traceEventIds.hpp \
traceTypes.hpp \
#
# Call SetupTraceGeneration for all trace gensrc files
$(foreach tracefile, $(TRACE_GENSRC_FILES), \
$(eval $(call SetupTraceGeneration, $(tracefile))) \
)

View file

@ -0,0 +1,153 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# This must be the first rule
default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include SetupJavaCompilers.gmk
ifeq ($(OPENJDK_TARGET_OS), windows)
# The next part is a bit hacky. We include the CompileJvm.gmk to be
# able to extact flags, but we do not wish to execute the rules.
# Use client as base for defines and includes
JVM_VARIANT=client
include HotspotCommon.gmk
include lib/CompileJvm.gmk
# Reset targets so we don't build libjvm.
TARGETS :=
# Helper macro to convert a unix path to a Windows path, suitable for
# inclusion in a command line.
FixPath = \
$(strip $(subst \,\\,$(shell $(CYGPATH) -w $1)))
JVM_DEFINES_client := $(patsubst -D%,%, $(filter -D%, $(JVM_CFLAGS)))
EXTRACTED_DEFINES_client := $(addprefix -define , $(JVM_DEFINES_client))
JVM_INCLUDES_client := $(patsubst -I%,%, $(filter -I%, $(JVM_CFLAGS)))
EXTRACTED_INCLUDES_client := $(foreach path, $(JVM_INCLUDES_client), -absoluteInclude $(call FixPath, $(path)))
# Hand-code variant-specific arguments, based on the fact that we use
# client for general arguments. Not optimal but other solutions require
# major changes in ProjectCreator.
ADDITIONAL_VARIANT_ARGS := \
-define_server COMPILER2 \
-ignorePath_client adfiles \
-ignorePath_client c2_ \
-ignorePath_client runtime_ \
-ignorePath_client libadt \
-ignorePath_client opto \
#
IGNORED_PLATFORMS_ARGS := \
-ignorePath aarch64 \
-ignorePath aix \
-ignorePath arm \
-ignorePath bsd \
-ignorePath linux \
-ignorePath posix \
-ignorePath ppc \
-ignorePath shark \
-ignorePath solaris \
-ignorePath sparc \
-ignorePath x86_32 \
-ignorePath zero \
#
################################################################################
# Build the ProjectCreator java tool.
TOOLS_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/support/tools_classes
$(eval $(call SetupJavaCompilation, BUILD_PROJECT_CREATOR, \
SETUP := GENERATE_OLDBYTECODE, \
ADD_JAVAC_FLAGS := -Xlint:-auxiliaryclass, \
SRC := $(HOTSPOT_TOPDIR)/makefiles/src/classes, \
BIN := $(TOOLS_OUTPUTDIR), \
))
TARGETS += $(BUILD_PROJECT_CREATOR)
# Run the ProjectCreator tool
PROJECT_CREATOR_TOOL := $(JAVA_SMALL) -cp $(TOOLS_OUTPUTDIR) build.tools.projectcreator.ProjectCreator
IDE_OUTPUTDIR := $(BUILD_OUTPUT)/ide/hotspot-visualstudio
VCPROJ_FILE := $(IDE_OUTPUTDIR)/jvm.vcxproj
PROJECT_CREATOR_CLASS := build.tools.projectcreator.WinGammaPlatformVC10
# We hard-code gensrc dir to server (since this includes adfiles)
PROJECT_CREATOR_ARGS := \
-sourceBase $(call FixPath, $(HOTSPOT_TOPDIR)) \
-startAt src \
-relativeSrcInclude src \
-hidePath .hg \
-hidePath .jcheck \
-hidePath jdk.hotspot.agent \
-hidePath jdk.vm.ci \
-hidePath jdk.jfr \
-compiler VC10 \
-jdkTargetRoot $(call FixPath, $(JDK_OUTPUTDIR)) \
-platformName x64 \
-buildBase $(call FixPath, $(IDE_OUTPUTDIR)/vs-output) \
-buildSpace $(call FixPath, $(IDE_OUTPUTDIR)) \
-makeBinary $(call FixPath, $(MAKE)) \
-makeOutput $(call FixPath, $(HOTSPOT_OUTPUTDIR)/variant-%f/libjvm) \
-absoluteInclude $(call FixPath, $(HOTSPOT_OUTPUTDIR)/variant-server/gensrc) \
-absoluteSrcInclude $(call FixPath, $(HOTSPOT_OUTPUTDIR)/variant-server/gensrc) \
$(EXTRACTED_DEFINES_client) \
$(EXTRACTED_INCLUDES_client) \
$(ADDITIONAL_VARIANT_ARGS) \
$(IGNORED_PLATFORMS_ARGS) \
#
VCPROJ_VARDEPS := $(PROJECT_CREATOR_CLASS) $(PROJECT_CREATOR_ARGS)
VCPROJ_VARDEPS_FILE := $(call DependOnVariable, VCPROJ_VARDEPS, \
$(VCPROJ_FILE).vardeps)
$(VCPROJ_FILE): $(BUILD_PROJECT_CREATOR) $(VCPROJ_VARDEPS_FILE)
$(call MakeDir, $(@D))
$(call ExecuteWithLog, $@, \
$(PROJECT_CREATOR_TOOL) $(PROJECT_CREATOR_CLASS) \
$(PROJECT_CREATOR_ARGS) -projectFileName $(call FixPath, $@)) \
$(LOG_INFO)
TARGETS += $(VCPROJ_FILE)
all: $(TARGETS)
else
all:
$(info Hotspot Visual Studio generation only supported on Windows)
endif
.PHONY: all

View file

@ -0,0 +1,217 @@
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
# Support for dtrace integration with libjvm, and stand-alone dtrace library
# compilation.
ifeq ($(call check-jvm-feature, dtrace), true)
##############################################################################
ifeq ($(OPENJDK_TARGET_OS), solaris)
############################################################################
# Integrate with libjvm. Here we generate three object files which are
# linked with libjvm.so. This step is complicated from a dependency
# perspective, since it needs the rest of the compiled object files from the
# libjvm compilation, but the output is object files that are to be included
# when linking libjvm.so. So this generation must happen as a part of the
# libjvm compilation.
# First we need to generate the dtraceGenOffsets tool. When run, this will
# produce more header files and a C++ file.
# Note that generateJvmOffsets.cpp must be compiled as if it were a file
# in the libjvm.so, using JVM_CFLAGS as setup in CompileJvm.gmk. Otherwise
# this would preferrably have been done as a part of GensrcDtrace.gmk.
$(eval $(call SetupNativeCompilation, BUILD_DTRACE_GEN_OFFSETS, \
SRC := $(HOTSPOT_TOPDIR)/src/os/$(OPENJDK_TARGET_OS)/dtrace, \
INCLUDE_FILES := generateJvmOffsets.cpp generateJvmOffsetsMain.c, \
CC := $(BUILD_CXX), \
CXX := $(BUILD_CXX), \
LDEXE := $(BUILD_CXX), \
generateJvmOffsets.cpp_CXXFLAGS := $(JVM_CFLAGS) -mt -xnolib -norunpath, \
generateJvmOffsetsMain.c_CFLAGS := -library=%none -mt -m64 -norunpath -z nodefs, \
LDFLAGS := -m64, \
LIBS := -lc, \
OBJECT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets/objs, \
OUTPUT_DIR := $(JVM_VARIANT_OUTPUTDIR)/tools/dtrace-gen-offsets, \
PROGRAM := dtraceGenOffsets, \
))
DTRACE_GEN_OFFSETS_TOOL := $(BUILD_DTRACE_GEN_OFFSETS_TARGET)
# Argument 1: Output filename
# Argument 2: dtrace-gen-offset tool command line option
define SetupDtraceOffsetsGeneration
$1: $$(BUILD_DTRACE_GEN_OFFSETS)
$$(call LogInfo, Generating dtrace $2 file $$(@F))
$$(call MakeDir, $$(@D))
$$(call ExecuteWithLog, $$@, $$(DTRACE_GEN_OFFSETS_TOOL) -$$(strip $2) > $$@)
TARGETS += $1
endef
JVM_OFFSETS_H := $(DTRACE_SUPPORT_DIR)/JvmOffsets.h
JVM_OFFSETS_CPP := $(DTRACE_SUPPORT_DIR)/JvmOffsets.cpp
JVM_OFFSETS_INDEX_H := $(DTRACE_SUPPORT_DIR)/JvmOffsetsIndex.h
# Run the dtrace-gen-offset tool to generate these three files.
$(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_H), header))
$(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_INDEX_H), index))
$(eval $(call SetupDtraceOffsetsGeneration, $(JVM_OFFSETS_CPP), table))
############################################################################
# Compile JVM_OFFSETS_OBJ which is linked with libjvm.so.
# JvmOffsets.cpp is compiled without the common JVM_CFLAGS. Otherwise, the
# natural way would have been to included this source code in BUILD_LIBJVM.
JVM_OFFSETS_CFLAGS := -m64
ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
JVM_OFFSETS_CFLAGS += -xarch=sparc
endif
$(JVM_OFFSETS_OBJ): $(JVM_OFFSETS_CPP) $(JVM_OFFSETS_H)
$(call LogInfo, Compiling dtrace file JvmOffsets.cpp (for libjvm.so))
$(call ExecuteWithLog, $@, $(CXX) -c -I$(<D) -o $@ $(JVM_OFFSETS_CFLAGS) $<)
############################################################################
# Generate DTRACE_OBJ which is linked with libjvm.so.
# Concatenate all *.d files into a single file
DTRACE_SOURCE_FILES := $(addprefix $(HOTSPOT_TOPDIR)/src/os/posix/dtrace/, \
hotspot_jni.d \
hotspot.d \
hs_private.d \
)
$(JVM_OUTPUTDIR)/objs/dtrace.d: $(DTRACE_SOURCE_FILES)
$(call LogInfo, Generating $(@F))
$(call MakeDir, $(@D))
$(CAT) $^ > $@
DTRACE_INSTRUMENTED_OBJS := $(addprefix $(JVM_OUTPUTDIR)/objs/, \
ciEnv.o \
classLoadingService.o \
compileBroker.o \
hashtable.o \
instanceKlass.o \
java.o \
jni.o \
jvm.o \
memoryManager.o \
nmethod.o \
objectMonitor.o \
runtimeService.o \
sharedRuntime.o \
synchronizer.o \
thread.o \
unsafe.o \
vmThread.o \
vmGCOperations.o \
)
ifeq ($(call check-jvm-feature, all-gcs), true)
DTRACE_INSTRUMENTED_OBJS += $(addprefix $(JVM_OUTPUTDIR)/objs/, \
vmCMSOperations.o \
vmPSOperations.o \
)
endif
DTRACE_FLAGS := -64 -G
DTRACE_CPP_FLAGS := -D_LP64
# Make sure we run our selected compiler for preprocessing instead of letting
# the dtrace tool pick it on it's own.
$(DTRACE_OBJ): $(JVM_OUTPUTDIR)/objs/dtrace.d $(DTRACE_INSTRUMENTED_OBJS)
$(call LogInfo, Generating $(@F) from $(<F) and object files)
$(call MakeDir, $(DTRACE_SUPPORT_DIR))
$(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, $(CC) -E \
$(DTRACE_CPP_FLAGS) $< > $(DTRACE_SUPPORT_DIR)/$(@F).d)
$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -xlazyload -o $@ \
-s $(DTRACE_SUPPORT_DIR)/$(@F).d $(sort $(DTRACE_INSTRUMENTED_OBJS)))
############################################################################
# Generate DTRACE_JHELPER_OBJ which is linked with libjvm.so.
# Unfortunately dtrace generates incorrect types for some symbols in
# dtrace_jhelper.o, resulting in "warning: symbol X has differing types"
# This is tracked in JDK-6890703.
$(DTRACE_JHELPER_OBJ): $(HOTSPOT_TOPDIR)/src/os/solaris/dtrace/jhelper.d \
$(JVM_OFFSETS_INDEX_H)
$(call LogInfo, Running dtrace for $(<F))
$(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) $(DTRACE_CPP_FLAGS) -C \
-I$(DTRACE_SUPPORT_DIR) -o $@ -s $<)
# NOTE: We should really do something like this, but unfortunately this
# results in a compilation error. :-(
# $(call MakeDir, $(DTRACE_SUPPORT_DIR))
# $(call ExecuteWithLog, $(DTRACE_SUPPORT_DIR)/$(@F).d, $(CC) -E \
# $(DTRACE_CPP_FLAGS) -I$(DTRACE_SUPPORT_DIR) $^ \
# > $(DTRACE_SUPPORT_DIR)/$(@F).d)
# $(call ExecuteWithLog, $@, $(DTRACE) $(DTRACE_FLAGS) -o $@ \
# -s $(DTRACE_SUPPORT_DIR)/$(@F).d)
############################################################################
# Build the stand-alone dtrace libraries
LIBJVM_DTRACE_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_dtrace
$(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DTRACE, \
LIBRARY := jvm_dtrace, \
OUTPUT_DIR := $(LIBJVM_DTRACE_OUTPUTDIR), \
SRC := $(HOTSPOT_TOPDIR)/src/os/solaris/dtrace, \
INCLUDE_FILES := jvm_dtrace.c, \
CFLAGS := -m64 -G -mt -KPIC, \
LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
LIBS := $(LIBDL) -lc -lthread -ldoor, \
MAPFILE := $(HOTSPOT_TOPDIR)/makefiles/mapfiles/libjvm_dtrace/mapfile-vers, \
OBJECT_DIR := $(LIBJVM_DTRACE_OUTPUTDIR)/objs, \
STRIP_SYMBOLS := true, \
))
LIBJVM_DB_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm_db
# Note that libjvm_db.c has tests for COMPILER2, but this was never set by
# the old build.
$(eval $(call SetupNativeCompilation, BUILD_LIBJVM_DB, \
LIBRARY := jvm_db, \
OUTPUT_DIR := $(LIBJVM_DB_OUTPUTDIR), \
SRC := $(HOTSPOT_TOPDIR)/src/os/solaris/dtrace, \
INCLUDE_FILES := libjvm_db.c, \
CFLAGS := -I$(JVM_VARIANT_OUTPUTDIR)/gensrc -I$(DTRACE_SUPPORT_DIR) \
-m64 -G -mt -KPIC, \
LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
LIBS := -lc, \
MAPFILE := $(HOTSPOT_TOPDIR)/makefiles/mapfiles/libjvm_db/mapfile-vers, \
OBJECT_DIR := $(LIBJVM_DB_OUTPUTDIR)/objs, \
STRIP_SYMBOLS := true, \
))
# We need the generated JvmOffsets.h before we can compile the libjvm_db source code.
$(BUILD_LIBJVM_DB_ALL_OBJS): $(JVM_OFFSETS_H)
TARGETS += $(BUILD_LIBJVM_DTRACE) $(BUILD_LIBJVM_DB)
endif
endif

View file

@ -0,0 +1,36 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
ifeq ($(call check-jvm-feature, dtrace), true)
ifeq ($(OPENJDK_TARGET_OS), solaris)
# These files are are generated by CompileDtrace.gmk but consumed by
# CompileJvm.gmk
DTRACE_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace.o
DTRACE_JHELPER_OBJ := $(JVM_OUTPUTDIR)/objs/dtrace_jhelper.o
JVM_OFFSETS_OBJ := $(JVM_OUTPUTDIR)/objs/JvmOffsets.o
DTRACE_EXTRA_OBJECT_FILES := $(DTRACE_OBJ) $(DTRACE_JHELPER_OBJ) $(JVM_OFFSETS_OBJ)
endif
endif

View file

@ -0,0 +1,242 @@
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Include support files that will setup compiler flags due to the selected
# jvm feature set, and specific file overrides.
include lib/JvmFeatures.gmk
include lib/JvmOverrideFiles.gmk
$(eval $(call IncludeCustomExtension, hotspot, lib/CompileJvm.gmk))
################################################################################
# Setup compilation of the main Hotspot native library (libjvm).
JVM_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/libjvm
JVM_MAPFILE := $(JVM_OUTPUTDIR)/mapfile
################################################################################
# Platform independent setup
# This variable may be added to by a custom extension
JVM_SRC_ROOTS += $(HOTSPOT_TOPDIR)/src
JVM_SRC_DIRS += $(call uniq, $(wildcard $(foreach d, $(JVM_SRC_ROOTS), \
$d/share/vm \
$d/os/$(HOTSPOT_TARGET_OS)/vm \
$d/os/$(HOTSPOT_TARGET_OS_TYPE)/vm \
$d/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/vm \
$d/os_cpu/$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH)/vm \
))) \
$(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles \
$(JVM_VARIANT_OUTPUTDIR)/gensrc/tracefiles \
#
JVM_CFLAGS_INCLUDES += \
$(patsubst %,-I%,$(filter-out $(JVM_VARIANT_OUTPUTDIR)/gensrc/%, $(JVM_SRC_DIRS))) \
-I$(JVM_VARIANT_OUTPUTDIR)/gensrc \
-I$(HOTSPOT_TOPDIR)/src/share/vm/precompiled \
-I$(HOTSPOT_TOPDIR)/src/share/vm/prims \
#
JVM_CFLAGS_TARGET_DEFINES += \
-DTARGET_OS_FAMILY_$(HOTSPOT_TARGET_OS) \
-DTARGET_ARCH_MODEL_$(HOTSPOT_TARGET_CPU) \
-DTARGET_ARCH_$(HOTSPOT_TARGET_CPU_ARCH) \
-DTARGET_OS_ARCH_MODEL_$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU) \
-DTARGET_OS_ARCH_$(HOTSPOT_TARGET_OS)_$(HOTSPOT_TARGET_CPU_ARCH) \
-DTARGET_COMPILER_$(HOTSPOT_TOOLCHAIN_TYPE) \
-D$(HOTSPOT_TARGET_CPU_DEFINE) \
-DHOTSPOT_LIB_ARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' \
#
ifeq ($(DEBUG_LEVEL), release)
# For hotspot, release builds differ internally between "optimized" and "product"
# in that "optimize" does not define PRODUCT.
ifneq ($(HOTSPOT_DEBUG_LEVEL), optimized)
JVM_CFLAGS_DEBUGLEVEL := -DPRODUCT
endif
else ifeq ($(DEBUG_LEVEL), fastdebug)
JVM_CFLAGS_DEBUGLEVEL := -DASSERT
ifeq ($(filter $(OPENJDK_TARGET_OS), windows aix), )
# NOTE: Old build did not define CHECK_UNHANDLED_OOPS on Windows and AIX.
JVM_CFLAGS_DEBUGLEVEL += -DCHECK_UNHANDLED_OOPS
endif
else ifeq ($(DEBUG_LEVEL), slowdebug)
# _NMT_NOINLINE_ informs NMT that no inlining is done by the compiler
JVM_CFLAGS_DEBUGLEVEL := -DASSERT -D_NMT_NOINLINE_
endif
JVM_CFLAGS += \
$(JVM_CFLAGS_DEBUGLEVEL) \
$(JVM_CFLAGS_TARGET_DEFINES) \
$(JVM_CFLAGS_FEATURES) \
$(JVM_CFLAGS_INCLUDES) \
$(EXTRA_CFLAGS) \
#
JVM_LDFLAGS += \
$(SHARED_LIBRARY_FLAGS) \
$(JVM_LDFLAGS_FEATURES) \
$(EXTRA_LDFLAGS) \
#
JVM_LIBS += \
$(JVM_LIBS_FEATURES) \
#
# These files and directories are always excluded
JVM_EXCLUDE_FILES += jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp args.cc
JVM_EXCLUDES += adlc
# Needed by vm_version.cpp
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
OPENJDK_TARGET_CPU_VM_VERSION := amd64
else ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
OPENJDK_TARGET_CPU_VM_VERSION := sparc
else
OPENJDK_TARGET_CPU_VM_VERSION := $(OPENJDK_TARGET_CPU)
endif
CFLAGS_VM_VERSION := \
$(VERSION_CFLAGS) \
-DHOTSPOT_VERSION_STRING='"$(VERSION_STRING)"' \
-DDEBUG_LEVEL='"$(DEBUG_LEVEL)"' \
-DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
-DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
-DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
#
# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
ifeq ($(USE_PRECOMPILED_HEADER), 0)
JVM_CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
endif
################################################################################
# Platform specific setup
ifneq ($(filter $(OPENJDK_TARGET_OS), linux macosx windows), )
JVM_PRECOMPILED_HEADER := $(HOTSPOT_TOPDIR)/src/share/vm/precompiled/precompiled.hpp
endif
ifneq ($(filter $(OPENJDK_TARGET_OS), macosx aix solaris), )
# On macosx, aix and solaris we have to link with the C++ compiler
JVM_TOOLCHAIN := TOOLCHAIN_LINK_CXX
else
JVM_TOOLCHAIN := TOOLCHAIN_DEFAULT
endif
ifeq ($(OPENJDK_TARGET_CPU), x86)
JVM_EXCLUDE_PATTERNS += x86_64
else ifeq ($(OPENJDK_TARGET_CPU), x86_64)
JVM_EXCLUDE_PATTERNS += x86_32
endif
# Inline assembly for solaris
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
JVM_CFLAGS += $(HOTSPOT_TOPDIR)/src/os_cpu/solaris_x86/vm/solaris_x86_64.il
else ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
JVM_CFLAGS += $(HOTSPOT_TOPDIR)/src/os_cpu/solaris_sparc/vm/solaris_sparc.il
endif
endif
ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-sparcv9)
ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), false)
# NOTE: In the old build, we weirdly enough set -g/-g0 always, regardless
# of if debug symbols were needed. Without it, compilation fails on
# sparc! :-(
JVM_CFLAGS += -g0
endif
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
RC_DESC := 64-Bit$(SPACE)
endif
JVM_RCFLAGS += -D"HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(RC_DESC)$(JVM_VARIANT) VM"
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
# NOTE: The old build did not strip binaries on macosx.
JVM_STRIP_SYMBOLS := false
else
JVM_STRIP_SYMBOLS := true
endif
JVM_OPTIMIZATION ?= HIGHEST_JVM
################################################################################
# Now set up the actual compilation of the main hotspot native library
$(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
TOOLCHAIN := $(JVM_TOOLCHAIN), \
LIBRARY := jvm, \
OUTPUT_DIR := $(JVM_OUTPUTDIR), \
SRC := $(JVM_SRC_DIRS), \
EXCLUDES := $(JVM_EXCLUDES), \
EXCLUDE_FILES := $(JVM_EXCLUDE_FILES), \
EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \
EXTRA_OBJECT_FILES := $(DTRACE_EXTRA_OBJECT_FILES), \
CFLAGS := $(JVM_CFLAGS), \
CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
DISABLED_WARNINGS_clang := delete-non-virtual-dtor dynamic-class-memaccess \
empty-body format logical-op-parentheses parentheses \
parentheses-equality switch tautological-compare, \
DISABLED_WARNINGS_xlc := 1540-0216 1540-0198 1540-1090 1540-1639 \
1540-1088 1500-010, \
ASFLAGS := $(JVM_ASFLAGS), \
LDFLAGS := $(JVM_LDFLAGS), \
LIBS := $(JVM_LIBS), \
OPTIMIZATION := $(JVM_OPTIMIZATION), \
OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \
MAPFILE := $(JVM_MAPFILE), \
USE_MAPFILE_FOR_SYMBOLS := true, \
STRIP_SYMBOLS := $(JVM_STRIP_SYMBOLS), \
EMBED_MANIFEST := true, \
RC_FLAGS := $(JVM_RCFLAGS), \
VERSIONINFO_RESOURCE := $(HOTSPOT_TOPDIR)/src/os/windows/vm/version.rc, \
PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \
PRECOMPILED_HEADER_EXCLUDE := $(JVM_PRECOMPILED_HEADER_EXCLUDE), \
))
# AIX warning explanation:
# 1500-010 : (W) WARNING in ...: Infinite loop. Program may not stop.
# There are several infinite loops in the vm, so better suppress.
# 1540-0198 : (W) The omitted keyword "private" is assumed for base class "...".
# 1540-0216 : (W) An expression of type .. cannot be converted to type ..
# In hotspot this fires for functionpointer to pointer conversions
# 1540-1088 : (W) The exception specification is being ignored.
# In hotspot this is caused by throw() in declaration of new() in nmethod.hpp.
# 1540-1090 : (I) The destructor of "..." might not be called.
# 1540-1639 : (I) The behavior of long type bit fields has changed ...
# Include mapfile generation. It relies on BUILD_LIBJVM_ALL_OBJS which is only
# defined after the above call to BUILD_LIBJVM. Mapfile will be generated
# after all object files are built, but before the jvm library is linked.
include lib/JvmMapfile.gmk
TARGETS += $(BUILD_LIBJVM)

View file

@ -0,0 +1,106 @@
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
# Create the libjsig.so shared library
default: all
include $(SPEC)
include MakeBase.gmk
include NativeCompilation.gmk
ifneq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(STATIC_BUILD), false)
LIBJSIG_STRIP_SYMBOLS := true
ifeq ($(OPENJDK_TARGET_OS), linux)
LIBJSIG_CFLAGS := -fPIC -D_GNU_SOURCE -D_REENTRANT $(EXTRA_CFLAGS)
LIBJSIG_LDFLAGS := $(LDFLAGS_HASH_STYLE) $(EXTRA_CFLAGS)
LIBJSIG_LIBS := $(LIBDL)
# NOTE: The old build compiled this library without -soname.
# To emulate this, we need to clear out SET_SHARED_LIBRARY_NAME.
SET_SHARED_LIBRARY_NAME :=
# Flags for other CPUs can be provided in EXTRA_CFLAGS
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
LIBJSIG_CPU_FLAGS := -m64
else ifeq ($(OPENJDK_TARGET_CPU), x86)
LIBJSIG_CPU_FLAGS := -m32 -march=i586
endif
else ifeq ($(OPENJDK_TARGET_OS), solaris)
LIBJSIG_CFLAGS := -m64 -KPIC -mt
LIBJSIG_LDFLAGS := -m64 -mt -xnolib
LIBJSIG_LIBS := $(LIBDL)
# NOTE: The old build compiled this library without -soname.
# To emulate this, we need to clear out SET_SHARED_LIBRARY_NAME.
SET_SHARED_LIBRARY_NAME :=
else ifeq ($(OPENJDK_TARGET_OS), aix)
LIBJSIG_CFLAGS := -q64 -D_GNU_SOURCE -D_REENTRANT -qpic=large
LIBJSIG_LDFLAGS := -b64 -bexpall -G -bnoentry -qmkshrobj -brtl -bnolibpath -bernotok
LIBJSIG_LIBS := $(LIBDL)
# NOTE: The old build compiled this library without -soname.
# To emulate this, we need to clear out SET_SHARED_LIBRARY_NAME.
SET_SHARED_LIBRARY_NAME :=
else ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBJSIG_CFLAGS := -m64 -D_GNU_SOURCE -pthread -mno-omit-leaf-frame-pointer -mstack-alignment=16 -fPIC
LIBJSIG_LDFLAGS := $(LDFLAGS_HASH_STYLE)
# NOTE: This lib is not stripped on macosx in old build. Looks like a mistake.
LIBJSIG_STRIP_SYMBOLS := false
else
$(error Unknown target OS $(OPENJDK_TARGET_OS) in CompileLibjsig.gmk)
endif
LIBJSIG_SRC_FILE := $(HOTSPOT_TOPDIR)/src/os/$(HOTSPOT_TARGET_OS)/vm/jsig.c
LIBJSIG_MAPFILE := $(wildcard $(HOTSPOT_TOPDIR)/makefiles/mapfiles/libjsig/mapfile-vers-$(OPENJDK_TARGET_OS))
LIBJSIG_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/libjsig
LIBJSIG_LDFLAGS += $(SHARED_LIBRARY_FLAGS)
$(eval $(call SetupNativeCompilation, BUILD_LIBJSIG, \
LIBRARY := jsig, \
EXTRA_FILES := $(LIBJSIG_SRC_FILE), \
OUTPUT_DIR := $(LIBJSIG_OUTPUTDIR), \
LANG := C, \
CFLAGS := $(LIBJSIG_CFLAGS) $(LIBJSIG_CPU_FLAGS), \
LDFLAGS := $(LIBJSIG_LDFLAGS) $(LIBJSIG_CPU_FLAGS), \
LIBS := $(LIBJSIG_LIBS), \
MAPFILE := $(LIBJSIG_MAPFILE), \
OBJECT_DIR := $(LIBJSIG_OUTPUTDIR)/objs, \
STRIP_SYMBOLS := $(LIBJSIG_STRIP_SYMBOLS), \
))
TARGETS += $(BUILD_LIBJSIG)
endif
endif
all: $(TARGETS)
.PHONY: all

View file

@ -0,0 +1,42 @@
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
include NativeCompilation.gmk
include HotspotCommon.gmk
# The dtrace setup must be done both before and after CompileJvm.gmk, due to
# intricate dependencies.
include lib/CompileDtracePreJvm.gmk
include lib/CompileJvm.gmk
include lib/CompileDtracePostJvm.gmk
all: $(TARGETS)
.PHONY: all

View file

@ -0,0 +1,144 @@
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
$(eval $(call IncludeCustomExtension, hotspot, lib/JvmFeatures.gmk))
################################################################################
# Setup CFLAGS and EXCLUDES for the libjvm compilation, depending on which
# jvm features are selected for this jvm variant.
ifeq ($(call check-jvm-feature, compiler1), true)
JVM_CFLAGS_FEATURES += -DCOMPILER1
else
JVM_EXCLUDE_PATTERNS += c1_
endif
ifeq ($(call check-jvm-feature, compiler2), true)
JVM_CFLAGS_FEATURES += -DCOMPILER2
JVM_SRC_DIRS += $(JVM_VARIANT_OUTPUTDIR)/gensrc/adfiles
else
JVM_EXCLUDES += opto libadt
JVM_EXCLUDE_FILES += bcEscapeAnalyzer.cpp ciTypeFlow.cpp
JVM_EXCLUDE_PATTERNS += c2_ runtime_
endif
ifeq ($(call check-jvm-feature, zero), true)
JVM_CFLAGS_FEATURES += -DZERO -DCC_INTERP -DZERO_LIBARCH='"$(OPENJDK_TARGET_CPU_LEGACY_LIB)"' $(LIBFFI_CFLAGS)
JVM_LIBS_FEATURES += $(LIBFFI_LIBS)
endif
ifeq ($(call check-jvm-feature, shark), true)
JVM_CFLAGS_FEATURES += -DSHARK $(LLVM_CFLAGS)
JVM_LDFLAGS_FEATURES += $(LLVM_LDFLAGS)
JVM_LIBS_FEATURES += $(LLVM_LIBS)
else
JVM_EXCLUDES += shark
endif
ifeq ($(call check-jvm-feature, minimal), true)
JVM_CFLAGS_FEATURES += -DMINIMAL_JVM -DVMTYPE=\"Minimal\"
endif
ifeq ($(call check-jvm-feature, dtrace), true)
JVM_CFLAGS_FEATURES += -DDTRACE_ENABLED
endif
ifeq ($(call check-jvm-feature, static-build), true)
JVM_CFLAGS_FEATURES += -DSTATIC_BUILD=1
endif
ifneq ($(call check-jvm-feature, jvmti), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_JVMTI=0
JVM_EXCLUDE_FILES += jvmtiGetLoadedClasses.cpp jvmtiThreadState.cpp jvmtiExtensions.cpp \
jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \
jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \
jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp \
jvmtiClassFileReconstituter.cpp
endif
ifneq ($(call check-jvm-feature, jvmci), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_JVMCI=0
JVM_EXCLUDES += jvmci
JVM_EXCLUDE_FILES += jvmciCodeInstaller_$(HOTSPOT_TARGET_CPU_ARCH).cpp
endif
ifneq ($(call check-jvm-feature, fprof), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_FPROF=0
JVM_EXCLUDE_FILES += fprofiler.cpp
endif
ifneq ($(call check-jvm-feature, vm-structs), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_VM_STRUCTS=0
JVM_EXCLUDE_FILES += vmStructs.cpp
endif
ifneq ($(call check-jvm-feature, jni-check), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_JNI_CHECK=0
JVM_EXCLUDE_FILES += jniCheck.cpp
endif
ifneq ($(call check-jvm-feature, services), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_SERVICES=0
JVM_EXCLUDE_FILES += heapDumper.cpp heapInspection.cpp \
attachListener_$(HOTSPOT_TARGET_OS).cpp attachListener.cpp
endif
ifneq ($(call check-jvm-feature, management), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_MANAGEMENT=0
endif
ifneq ($(call check-jvm-feature, cds), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_CDS=0
JVM_EXCLUDE_FILES += \
classListParser.cpp \
classLoaderExt.cpp \
filemap.cpp \
metaspaceShared.cpp \
metaspaceShared_$(HOTSPOT_TARGET_CPU).cpp \
metaspaceShared_$(HOTSPOT_TARGET_CPU_ARCH).cpp \
sharedClassUtil.cpp \
sharedPathsMiscInfo.cpp \
systemDictionaryShared.cpp \
#
endif
ifneq ($(call check-jvm-feature, all-gcs), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_ALL_GCS=0
JVM_EXCLUDE_PATTERNS += \
cms/ g1/ parallel/
JVM_EXCLUDE_FILES += \
concurrentGCThread.cpp \
plab.cpp
JVM_EXCLUDE_FILES += \
g1MemoryPool.cpp \
psMemoryPool.cpp
endif
ifneq ($(call check-jvm-feature, nmt), true)
JVM_CFLAGS_FEATURES += -DINCLUDE_NMT=0
JVM_EXCLUDE_FILES += \
memBaseline.cpp memReporter.cpp mallocTracker.cpp virtualMemoryTracker.cpp nmtCommon.cpp \
memTracker.cpp nmtDCmd.cpp mallocSiteTable.cpp
endif

View file

@ -0,0 +1,172 @@
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
$(eval $(call IncludeCustomExtension, hotspot, lib/JvmMapfile.gmk))
################################################################################
# Combine a list of static symbols
ifneq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), windows-x86_64)
# On Windows x86_64, we should not have any symbols at all, since that
# results in duplicate warnings from the linker (JDK-8043491).
SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-shared
endif
ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-unix
endif
ifneq ($(wildcard $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-$(OPENJDK_TARGET_OS)), )
SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-$(OPENJDK_TARGET_OS)
endif
ifneq ($(findstring debug, $(DEBUG_LEVEL)), )
ifneq ($(wildcard $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-$(OPENJDK_TARGET_OS)-debug), )
SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-$(OPENJDK_TARGET_OS)-debug
endif
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifeq ($(call check-jvm-feature, dtrace), true)
# Additional mapfiles that are only used when dtrace is enabled
ifeq ($(call check-jvm-feature, compiler2), true)
# This also covers the case of compiler1+compiler2.
SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-solaris-dtrace-compiler2
else ifeq ($(call check-jvm-feature, compiler1), true)
SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-solaris-dtrace-compiler1
endif
endif
endif
################################################################################
# Create a dynamic list of symbols from the built object files. This is highly
# platform dependent.
ifeq ($(OPENJDK_TARGET_OS), linux)
DUMP_SYMBOLS_CMD := $(NM) --defined-only *.o
ifneq ($(FILTER_SYMBOLS_PATTERN), )
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|
endif
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)^_ZTV|^gHotSpotVM|^UseSharedSpaces$$
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|^_ZN9Arguments17SharedArchivePathE$$
FILTER_SYMBOLS_AWK_SCRIPT := \
'{ \
if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \
}'
else ifeq ($(OPENJDK_TARGET_OS), solaris)
DUMP_SYMBOLS_CMD := $(NM) -p *.o
ifneq ($(FILTER_SYMBOLS_PATTERN), )
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|
endif
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)^__1c.*__vtbl_$$|^gHotSpotVM
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|^UseSharedSpaces$$
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|^__1cJArgumentsRSharedArchivePath_$$
FILTER_SYMBOLS_AWK_SCRIPT := \
'{ \
if ($$2 == "U") next; \
if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \
}'
else ifeq ($(OPENJDK_TARGET_OS), macosx)
# nm on macosx prints out "warning: nm: no name list" to stderr for
# files without symbols. Hide this, even at the expense of hiding real errors.
DUMP_SYMBOLS_CMD := $(NM) -Uj *.o 2> /dev/null
ifneq ($(FILTER_SYMBOLS_PATTERN), )
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)|
endif
FILTER_SYMBOLS_PATTERN := $(FILTER_SYMBOLS_PATTERN)^_ZTV|^gHotSpotVM
FILTER_SYMBOLS_AWK_SCRIPT := \
'{ \
if ($$3 ~ /$(FILTER_SYMBOLS_PATTERN)/) print $$3; \
}'
# NOTE: The script is from the old build. It is broken and finds no symbols.
# The script below might be what was intended, but it failes to link with tons
# of 'cannot export hidden symbol vtable for X'.
# '{ if ($$1 ~ /^__ZTV/ || $$1 ~ /^_gHotSpotVM/) print substr($$1, 2) }'
else ifeq ($(OPENJDK_TARGET_OS), aix)
# NOTE: The old build had the solution below. This should to be fixed in
# configure instead.
# On AIX we have to prevent that we pick up the 'nm' version from the GNU binutils
# which may be installed under /opt/freeware/bin. So better use an absolute path here!
# NM=/usr/bin/nm
DUMP_SYMBOLS_CMD := $(NM) -X64 -B -C *.o
FILTER_SYMBOLS_AWK_SCRIPT := \
'{ \
if (($$2="d" || $$2="D") && ($$3 ~ /^__vft/ || $$3 ~ /^gHotSpotVM/)) print $$3; \
if ($$3 ~ /^UseSharedSpaces$$/) print $$3; \
if ($$3 ~ /^SharedArchivePath__9Arguments$$/) print $$3; \
}'
else ifeq ($(OPENJDK_TARGET_OS), windows)
DUMP_SYMBOLS_CMD := $(DUMPBIN) -symbols *.obj
FILTER_SYMBOLS_AWK_SCRIPT := \
'{ \
if ($$7 ~ /??_7.*@@6B@/ && $$7 !~ /type_info/) print $$7; \
}'
else
$(error Unknown target OS $(OPENJDK_TARGET_OS) in JvmMapfile.gmk)
endif
# A more correct solution would be to send BUILD_LIBJVM_ALL_OBJS instead of
# cd && *.o, but this will result in very long command lines, which is
# problematic on some platforms.
$(JVM_OUTPUTDIR)/symbols-objects: $(BUILD_LIBJVM_ALL_OBJS)
$(call LogInfo, Generating symbol list from object files)
$(CD) $(JVM_OUTPUTDIR)/objs && \
$(DUMP_SYMBOLS_CMD) | $(NAWK) $(FILTER_SYMBOLS_AWK_SCRIPT) | $(SORT) -u > $@
SYMBOLS_SRC += $(JVM_OUTPUTDIR)/symbols-objects
################################################################################
# Now concatenate all symbol lists into a single file and remove comments.
$(JVM_OUTPUTDIR)/symbols: $(SYMBOLS_SRC)
$(SED) -e '/^#/d' $^ > $@
################################################################################
# Finally convert the symbol list into a platform-specific mapfile
$(JVM_MAPFILE): $(JVM_OUTPUTDIR)/symbols
$(call LogInfo, Creating mapfile)
$(RM) $@
ifeq ($(OPENJDK_TARGET_OS), macosx)
# On macosx, we need to add a leading underscore
$(AWK) '{ if ($$0 ~ ".") { print " _" $$0 } }' < $^ > $@.tmp
else ifeq ($(OPENJDK_TARGET_OS), windows)
# On windows, add an 'EXPORTS' header
$(ECHO) "EXPORTS" > $@.tmp
$(AWK) '{ if ($$0 ~ ".") { print " " $$0 } }' < $^ >> $@.tmp
else
# Assume standard linker script
$(PRINTF) "SUNWprivate_1.1 { \n global: \n" > $@.tmp
$(AWK) '{ if ($$0 ~ ".") { print " " $$0 ";" } }' < $^ >> $@.tmp
$(PRINTF) " local: \n *; \n }; \n" >> $@.tmp
endif
$(MV) $@.tmp $@

View file

@ -0,0 +1,168 @@
#
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
$(eval $(call IncludeCustomExtension, hotspot, lib/JvmOverrideFiles.gmk))
################################################################################
# This file contains explicit overrides of CFLAGS and/or precompiled header
# status for individual files on specific platforms.
ifeq ($(TOOLCHAIN_TYPE), gcc)
BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments -O0
endif
ifeq ($(OPENJDK_TARGET_OS), linux)
BUILD_LIBJVM_ostream.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64
ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(CXX_O_FLAG_NONE)
BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := -DNO_PCH $(CXX_O_FLAG_NONE)
ifeq ($(TOOLCHAIN_TYPE), clang)
JVM_PRECOMPILED_HEADER_EXCLUDE := \
sharedRuntimeTrig.cpp \
sharedRuntimeTrans.cpp \
#
endif
endif
ifeq ($(OPENJDK_TARGET_CPU), x86)
# Performance measurements show that by compiling GC related code, we could
# significantly reduce the GC pause time on 32 bit Linux/Unix platforms by
# compiling without the PIC flag (-fPIC on linux).
# See 6454213 for more details.
ALL_SRC := $(filter %.cpp, $(call CacheFind, $(HOTSPOT_TOPDIR)/src/share/vm))
NONPIC_FILTER := $(addsuffix %, $(addprefix $(HOTSPOT_TOPDIR)/src/share/vm/, \
memory oops gc))
# Due to what looks like a bug in the old build implementation of this, add a
# couple of more files that were accidentally matched as substrings of GC related
# files.
NONPIC_SRC := $(filter $(NONPIC_FILTER), $(ALL_SRC)) globals.cpp location.cpp
# Declare variables for each source file that needs the pic flag like this:
# BUILD_JVM_<srcfile>_CXXFLAGS := -fno-PIC
# This will get implicitly picked up by SetupNativeCompilation below.
$(foreach s, $(NONPIC_SRC), $(eval BUILD_LIBJVM_$(notdir $s)_CXXFLAGS := -fno-PIC))
endif
else ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(DEBUG_LEVEL), slowdebug)
# Workaround for a bug in dtrace. If ciEnv::post_compiled_method_load_event()
# is inlined, the resulting dtrace object file needs a reference to this
# function, whose symbol name is too long for dtrace. So disable inlining
# for this method for now. (fix this when dtrace bug 6258412 is fixed)
BUILD_LIBJVM_ciEnv.cpp_CXXFLAGS := \
-xinline=no%__1cFciEnvbFpost_compiled_method_load_event6MpnHnmethod__v_
# dtrace cannot handle tail call optimization (6672627, 6693876)
BUILD_LIBJVM_jni.cpp_CXXFLAGS := -Qoption ube -O~yz
BUILD_LIBJVM_stubGenerator_$(HOTSPOT_TARGET_CPU).cpp_CXXFLAGS := -xspace
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
# Temporary until SS10 C++ compiler is fixed
BUILD_LIBJVM_generateOptoStub.cpp_CXXFLAGS := -xO2
# Temporary util SS12u1 C++ compiler is fixed
BUILD_LIBJVM_c1_LinearScan.cpp_CXXFLAGS := -xO2
endif
endif
# Need extra inlining to get oop_ps_push_contents functions to perform well enough.
ifeq ($(DEBUG_LEVEL),release)
BUILD_LIBJVM_psPromotionManager.cpp_CXXFLAGS := -W2,-Ainline:inc=1000
endif
ifeq ($(DEBUG_LEVEL), fastdebug)
# this hangs in iropt now (7113504)
BUILD_LIBJVM_compileBroker.cpp_CXXFLAGS := -xO2
# Frame size > 100k if we allow inlining via -g0!
BUILD_LIBJVM_bytecodeInterpreter.cpp_CXXFLAGS := +d
BUILD_LIBJVM_bytecodeInterpreterWithChecks.cpp_CXXFLAGS := +d
ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
# ube explodes on x86
BUILD_LIBJVM_bytecodeInterpreter.cpp_CXXFLAGS += -xO1
BUILD_LIBJVM_bytecodeInterpreterWithChecks.cpp_CXXFLAGS += -xO1
endif
endif
else ifeq ($(OPENJDK_TARGET_OS), macosx)
# The copied fdlibm routines in these files must not be optimized
BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
ifeq ($(TOOLCHAIN_TYPE), clang)
# NOTE: The old build tested clang version to make sure this workaround
# for the clang bug was still needed.
BUILD_LIBJVM_loopTransform.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
ifneq ($(DEBUG_LEVEL), slowdebug)
BUILD_LIBJVM_unsafe.cpp_CXXFLAGS := -O1
endif
# The following files are compiled at various optimization
# levels due to optimization issues encountered at the
# default level. The Clang compiler issues a compile
# time error if there is an optimization level specification
# skew between the PCH file and the C++ file. Especially if the
# PCH file is compiled at a higher optimization level than
# the C++ file. One solution might be to prepare extra optimization
# level specific PCH files for the opt build and use them here, but
# it's probably not worth the effort as long as only a few files
# need this special handling.
JVM_PRECOMPILED_HEADER_EXCLUDE := \
sharedRuntimeTrig.cpp \
sharedRuntimeTrans.cpp \
loopTransform.cpp \
unsafe.cpp \
jvmciCompilerToVM.cpp \
#
endif
else ifeq ($(OPENJDK_TARGET_OS), aix)
BUILD_LIBJVM_synchronizer.cpp_CXXFLAGS := -qnoinline
BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
# Disable aggressive optimizations for functions in sharedRuntimeTrig.cpp
# and sharedRuntimeTrans.cpp on ppc64.
# -qstrict turns off the following optimizations:
# * Performing code motion and scheduling on computations such as loads
# and floating-point computations that may trigger an exception.
# * Relaxing conformance to IEEE rules.
# * Reassociating floating-point expressions.
# When using '-qstrict' there still remains one problem
# in javasoft.sqe.tests.api.java.lang.Math.sin5Tests when run in compile-all
# mode, so don't optimize sharedRuntimeTrig.cpp at all.
BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
# Disable ELF decoder on AIX (AIX uses XCOFF).
JVM_EXCLUDE_PATTERNS += elf
else ifeq ($(OPENJDK_TARGET_OS), windows)
JVM_PRECOMPILED_HEADER_EXCLUDE := \
bytecodeInterpreter.cpp \
bytecodeInterpreterWithChecks.cpp \
opcodes.cpp \
os_windows.cpp \
os_windows_x86.cpp \
osThread_windows.cpp \
#
endif

View file

@ -0,0 +1,38 @@
#
# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Define library interface.
SUNWprivate_1.1 {
global:
JVM_begin_signal_setting;
JVM_end_signal_setting;
JVM_get_libjsig_version;
JVM_get_signal_action;
sigaction;
signal;
sigset;
local:
*;
};

View file

@ -0,0 +1,38 @@
#
#
# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Define library interface.
SUNWprivate_1.1 {
global:
Jagent_create;
Jagent_destroy;
Jframe_iter;
#Jget_vframe;
#Jlookup_by_regs;
local:
*;
};

View file

@ -0,0 +1,37 @@
#
#
# Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Define library interface for JVM-DTrace interface
SUNWprivate_1.1 {
global:
jvm_attach;
jvm_get_last_error;
jvm_enable_dtprobes;
jvm_detach;
local:
*;
};

View file

@ -0,0 +1,27 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
JVM_handle_linux_signal
numa_error
numa_warn
sysThreadAvailableStackWithSlack

View file

@ -0,0 +1,26 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
JVM_AccessVMBooleanFlag
JVM_AccessVMIntFlag
JVM_VMBreakPoint

View file

@ -0,0 +1,27 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
JVM_handle_linux_signal
numa_error
numa_warn
sysThreadAvailableStackWithSlack

View file

@ -0,0 +1,24 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
JVM_handle_bsd_signal

View file

@ -0,0 +1,35 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
AsyncGetCallTrace
jio_fprintf
jio_printf
jio_snprintf
jio_vfprintf
jio_vsnprintf
JNI_CreateJavaVM
JNI_GetCreatedJavaVMs
JNI_GetDefaultJavaVMInitArgs
JVM_FindClassFromBootLoader
JVM_GetVersionInfo
JVM_InitAgentProperties

View file

@ -0,0 +1,25 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
JVM_handle_solaris_signal
sysThreadAvailableStackWithSlack

View file

@ -0,0 +1,34 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
__1cGMethodG__vtbl_
__1cHnmethodG__vtbl_
__1cICodeBlobG__vtbl_
__1cIUniverseO_collectedHeap_
__1cJCodeCacheG_heaps_
__1cKBufferBlobG__vtbl_
__1cLRuntimeStubG__vtbl_
__1cNSafepointBlobG__vtbl_
__1cSDeoptimizationBlobG__vtbl_
__JvmOffsets

View file

@ -0,0 +1,36 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
__1cGMethodG__vtbl_
__1cHnmethodG__vtbl_
__1cICodeBlobG__vtbl_
__1cIUniverseO_collectedHeap_
__1cJCodeCacheG_heaps_
__1cKBufferBlobG__vtbl_
__1cLRuntimeStubG__vtbl_
__1cNSafepointBlobG__vtbl_
__1cSDeoptimizationBlobG__vtbl_
__1cNExceptionBlobG__vtbl_
__1cQUncommonTrapBlobG__vtbl_
__JvmOffsets

View file

@ -0,0 +1,194 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
JVM_ActiveProcessorCount
JVM_ArrayCopy
JVM_AssertionStatusDirectives
JVM_CallStackWalk
JVM_ClassDepth
JVM_ClassLoaderDepth
JVM_Clone
JVM_ConstantPoolGetClassAt
JVM_ConstantPoolGetClassAtIfLoaded
JVM_ConstantPoolGetClassRefIndexAt
JVM_ConstantPoolGetDoubleAt
JVM_ConstantPoolGetFieldAt
JVM_ConstantPoolGetFieldAtIfLoaded
JVM_ConstantPoolGetFloatAt
JVM_ConstantPoolGetIntAt
JVM_ConstantPoolGetLongAt
JVM_ConstantPoolGetMemberRefInfoAt
JVM_ConstantPoolGetMethodAt
JVM_ConstantPoolGetMethodAtIfLoaded
JVM_ConstantPoolGetNameAndTypeRefIndexAt
JVM_ConstantPoolGetNameAndTypeRefInfoAt
JVM_ConstantPoolGetSize
JVM_ConstantPoolGetStringAt
JVM_ConstantPoolGetTagAt
JVM_ConstantPoolGetUTF8At
JVM_CountStackFrames
JVM_CurrentClassLoader
JVM_CurrentLoadedClass
JVM_CurrentThread
JVM_CurrentTimeMillis
JVM_DefineClass
JVM_DefineClassWithSource
JVM_DesiredAssertionStatus
JVM_DoPrivileged
JVM_DumpAllStacks
JVM_DumpThreads
JVM_FillInStackTrace
JVM_FindClassFromCaller
JVM_FindClassFromClass
JVM_FindLibraryEntry
JVM_FindLoadedClass
JVM_FindPrimitiveClass
JVM_FindSignal
JVM_FreeMemory
JVM_GC
JVM_GetAllThreads
JVM_GetArrayElement
JVM_GetArrayLength
JVM_GetCallerClass
JVM_GetClassAccessFlags
JVM_GetClassAnnotations
JVM_GetClassConstantPool
JVM_GetClassContext
JVM_GetClassCPEntriesCount
JVM_GetClassCPTypes
JVM_GetClassDeclaredConstructors
JVM_GetClassDeclaredFields
JVM_GetClassDeclaredMethods
JVM_GetClassFieldsCount
JVM_GetClassInterfaces
JVM_GetClassMethodsCount
JVM_GetClassModifiers
JVM_GetClassName
JVM_GetClassNameUTF
JVM_GetClassSignature
JVM_GetClassSigners
JVM_GetClassTypeAnnotations
JVM_GetCPClassNameUTF
JVM_GetCPFieldClassNameUTF
JVM_GetCPFieldModifiers
JVM_GetCPFieldNameUTF
JVM_GetCPFieldSignatureUTF
JVM_GetCPMethodClassNameUTF
JVM_GetCPMethodModifiers
JVM_GetCPMethodNameUTF
JVM_GetCPMethodSignatureUTF
JVM_GetDeclaredClasses
JVM_GetDeclaringClass
JVM_GetEnclosingMethodInfo
JVM_GetFieldIxModifiers
JVM_GetFieldTypeAnnotations
JVM_GetInheritedAccessControlContext
JVM_GetInterfaceVersion
JVM_GetManagement
JVM_GetMethodIxArgsSize
JVM_GetMethodIxByteCode
JVM_GetMethodIxByteCodeLength
JVM_GetMethodIxExceptionIndexes
JVM_GetMethodIxExceptionsCount
JVM_GetMethodIxExceptionTableEntry
JVM_GetMethodIxExceptionTableLength
JVM_GetMethodIxLocalsCount
JVM_GetMethodIxMaxStack
JVM_GetMethodIxModifiers
JVM_GetMethodIxNameUTF
JVM_GetMethodIxSignatureUTF
JVM_GetMethodParameters
JVM_GetMethodTypeAnnotations
JVM_GetNanoTimeAdjustment
JVM_GetPrimitiveArrayElement
JVM_GetProtectionDomain
JVM_GetSimpleBinaryName
JVM_GetStackAccessControlContext
JVM_GetStackTraceElements
JVM_GetSystemPackage
JVM_GetSystemPackages
JVM_GetTemporaryDirectory
JVM_GetVmArguments
JVM_Halt
JVM_HoldsLock
JVM_IHashCode
JVM_InitProperties
JVM_InternString
JVM_Interrupt
JVM_InvokeMethod
JVM_IsArrayClass
JVM_IsConstructorIx
JVM_IsInterface
JVM_IsInterrupted
JVM_IsPrimitiveClass
JVM_IsSameClassPackage
JVM_IsSupportedJNIVersion
JVM_IsThreadAlive
JVM_IsVMGeneratedMethodIx
JVM_LatestUserDefinedLoader
JVM_LoadLibrary
JVM_MaxMemory
JVM_MaxObjectInspectionAge
JVM_MonitorNotify
JVM_MonitorNotifyAll
JVM_MonitorWait
JVM_MoreStackWalk
JVM_NanoTime
JVM_NativePath
JVM_NewArray
JVM_NewInstanceFromConstructor
JVM_NewMultiArray
JVM_RaiseSignal
JVM_RawMonitorCreate
JVM_RawMonitorDestroy
JVM_RawMonitorEnter
JVM_RawMonitorExit
JVM_RegisterSignal
JVM_ReleaseUTF
JVM_ResumeThread
JVM_SetArrayElement
JVM_SetClassSigners
JVM_SetNativeThreadName
JVM_SetPrimitiveArrayElement
JVM_SetThreadPriority
JVM_Sleep
JVM_StartThread
JVM_StopThread
JVM_SupportsCX8
JVM_SuspendThread
JVM_ToStackTraceElement
JVM_TotalMemory
JVM_UnloadLibrary
JVM_Yield
# Module related API's
JVM_AddModuleExports
JVM_AddModuleExportsToAll
JVM_AddModuleExportsToAllUnnamed
JVM_AddModulePackage
JVM_AddReadsModule
JVM_CanReadModule
JVM_DefineModule
JVM_IsExportedToModule
JVM_SetBootLoaderUnnamedModule
JVM_GetModuleByPackageName

View file

@ -198,6 +198,16 @@ void RegisterSaver::restore_result_registers(MacroAssembler* masm) {
bool SharedRuntime::is_wide_vector(int size) { bool SharedRuntime::is_wide_vector(int size) {
return size > 8; return size > 8;
} }
size_t SharedRuntime::trampoline_size() {
return 16;
}
void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
__ mov(rscratch1, destination);
__ br(rscratch1);
}
// The java_calling_convention describes stack locations as ideal slots on // The java_calling_convention describes stack locations as ideal slots on
// a frame with no abi restrictions. Since we must observe abi restrictions // a frame with no abi restrictions. Since we must observe abi restrictions
// (like the placement of the register window) the slots must be biased by // (like the placement of the register window) the slots must be biased by

View file

@ -483,6 +483,18 @@ bool SharedRuntime::is_wide_vector(int size) {
assert(size <= 8, "%d bytes vectors are not supported", size); assert(size <= 8, "%d bytes vectors are not supported", size);
return size > 8; return size > 8;
} }
size_t SharedRuntime::trampoline_size() {
return Assembler::load_const_size + 8;
}
void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
Register Rtemp = R12;
__ load_const(Rtemp, destination);
__ mtctr(Rtemp);
__ bctr();
}
#ifdef COMPILER2 #ifdef COMPILER2
static int reg2slot(VMReg r) { static int reg2slot(VMReg r) {
return r->reg2stack() + SharedRuntime::out_preserve_stack_slots(); return r->reg2stack() + SharedRuntime::out_preserve_stack_slots();

View file

@ -65,8 +65,6 @@ void MetaspaceShared::generate_vtable_methods(void** vtbl_list,
*vtable = dummy_vtable; *vtable = dummy_vtable;
*md_top += vtable_bytes; *md_top += vtable_bytes;
guarantee(*md_top <= md_end, "Insufficient space for vtables.");
// Get ready to generate dummy methods. // Get ready to generate dummy methods.
CodeBuffer cb((unsigned char*)*mc_top, mc_end - *mc_top); CodeBuffer cb((unsigned char*)*mc_top, mc_end - *mc_top);

View file

@ -324,6 +324,16 @@ bool SharedRuntime::is_wide_vector(int size) {
return size > 8; return size > 8;
} }
size_t SharedRuntime::trampoline_size() {
return 40;
}
void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
__ set((intptr_t)destination, G3_scratch);
__ JMP(G3_scratch, 0);
__ delayed()->nop();
}
// The java_calling_convention describes stack locations as ideal slots on // The java_calling_convention describes stack locations as ideal slots on
// a frame with no abi restrictions. Since we must observe abi restrictions // a frame with no abi restrictions. Since we must observe abi restrictions
// (like the placement of the register window) the slots must be biased by // (like the placement of the register window) the slots must be biased by

View file

@ -616,7 +616,7 @@ void TemplateInterpreterGenerator::generate_stack_overflow_check(Register Rframe
// compute the beginning of the protected zone minus the requested frame size // compute the beginning of the protected zone minus the requested frame size
__ sub( Rscratch, Rscratch2, Rscratch ); __ sub( Rscratch, Rscratch2, Rscratch );
__ set( JavaThread::stack_red_zone_size() + JavaThread::stack_yellow_zone_size(), Rscratch2 ); __ set(MAX2(JavaThread::stack_shadow_zone_size(), JavaThread::stack_guard_zone_size()), Rscratch2 );
__ add( Rscratch, Rscratch2, Rscratch ); __ add( Rscratch, Rscratch2, Rscratch );
// Add in the size of the frame (which is the same as subtracting it from the // Add in the size of the frame (which is the same as subtracting it from the

View file

@ -355,6 +355,14 @@ bool SharedRuntime::is_wide_vector(int size) {
return size > 16; return size > 16;
} }
size_t SharedRuntime::trampoline_size() {
return 16;
}
void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
__ jump(RuntimeAddress(destination));
}
// The java_calling_convention describes stack locations as ideal slots on // The java_calling_convention describes stack locations as ideal slots on
// a frame with no abi restrictions. Since we must observe abi restrictions // a frame with no abi restrictions. Since we must observe abi restrictions
// (like the placement of the register window) the slots must be biased by // (like the placement of the register window) the slots must be biased by

View file

@ -391,6 +391,14 @@ bool SharedRuntime::is_wide_vector(int size) {
return size > 16; return size > 16;
} }
size_t SharedRuntime::trampoline_size() {
return 16;
}
void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
__ jump(RuntimeAddress(destination));
}
// The java_calling_convention describes stack locations as ideal slots on // The java_calling_convention describes stack locations as ideal slots on
// a frame with no abi restrictions. Since we must observe abi restrictions // a frame with no abi restrictions. Since we must observe abi restrictions
// (like the placement of the register window) the slots must be biased by // (like the placement of the register window) the slots must be biased by

View file

@ -132,6 +132,15 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
return generate_empty_runtime_stub("resolve_blob"); return generate_empty_runtime_stub("resolve_blob");
} }
size_t SharedRuntime::trampoline_size() {
ShouldNotCallThis();
return 0;
}
void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
ShouldNotCallThis();
return;
}
int SharedRuntime::c_calling_convention(const BasicType *sig_bt, int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
VMRegPair *regs, VMRegPair *regs,

View file

@ -23,6 +23,7 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "memory/metaspaceShared.hpp"
#include "runtime/frame.inline.hpp" #include "runtime/frame.inline.hpp"
#include "runtime/thread.inline.hpp" #include "runtime/thread.inline.hpp"
@ -64,6 +65,14 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
return false; return false;
} }
#if INCLUDE_CDS
if (UseSharedSpaces && MetaspaceShared::is_in_shared_region(addr.pc(), MetaspaceShared::md)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}
#endif
frame ret_frame(ret_sp, ret_fp, addr.pc()); frame ret_frame(ret_sp, ret_fp, addr.pc());
if (!ret_frame.safe_for_sender(jt)) { if (!ret_frame.safe_for_sender(jt)) {
#if defined(COMPILER2) || INCLUDE_JVMCI #if defined(COMPILER2) || INCLUDE_JVMCI

View file

@ -24,6 +24,7 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "memory/metaspaceShared.hpp"
#include "runtime/frame.inline.hpp" #include "runtime/frame.inline.hpp"
#include "runtime/thread.inline.hpp" #include "runtime/thread.inline.hpp"
@ -66,6 +67,14 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
return false; return false;
} }
#if INCLUDE_CDS
if (UseSharedSpaces && MetaspaceShared::is_in_shared_region(addr.pc(), MetaspaceShared::md)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}
#endif
frame ret_frame(ret_sp, ret_fp, addr.pc()); frame ret_frame(ret_sp, ret_fp, addr.pc());
if (!ret_frame.safe_for_sender(jt)) { if (!ret_frame.safe_for_sender(jt)) {
#ifdef COMPILER2 #ifdef COMPILER2

View file

@ -23,6 +23,7 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "memory/metaspaceShared.hpp"
#include "runtime/frame.inline.hpp" #include "runtime/frame.inline.hpp"
#include "runtime/thread.inline.hpp" #include "runtime/thread.inline.hpp"
@ -64,6 +65,14 @@ bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr,
return false; return false;
} }
#if INCLUDE_CDS
if (UseSharedSpaces && MetaspaceShared::is_in_shared_region(addr.pc(), MetaspaceShared::md)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}
#endif
// we were running Java code when SIGPROF came in // we were running Java code when SIGPROF came in
if (isInJava) { if (isInJava) {
// If we have a last_Java_sp, then the SIGPROF signal caught us // If we have a last_Java_sp, then the SIGPROF signal caught us

View file

@ -23,6 +23,7 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "memory/metaspaceShared.hpp"
#include "runtime/frame.inline.hpp" #include "runtime/frame.inline.hpp"
#include "runtime/thread.inline.hpp" #include "runtime/thread.inline.hpp"
@ -65,6 +66,14 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
return false; return false;
} }
#if INCLUDE_CDS
if (UseSharedSpaces && MetaspaceShared::is_in_shared_region(addr.pc(), MetaspaceShared::md)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}
#endif
frame ret_frame(ret_sp, ret_fp, addr.pc()); frame ret_frame(ret_sp, ret_fp, addr.pc());
if (!ret_frame.safe_for_sender(jt)) { if (!ret_frame.safe_for_sender(jt)) {
#if defined(COMPILER2) || INCLUDE_JVMCI #if defined(COMPILER2) || INCLUDE_JVMCI

View file

@ -23,6 +23,7 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "memory/metaspaceShared.hpp"
#include "runtime/frame.inline.hpp" #include "runtime/frame.inline.hpp"
#include "runtime/thread.inline.hpp" #include "runtime/thread.inline.hpp"
@ -77,6 +78,14 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr,
return false; return false;
} }
#if INCLUDE_CDS
if (UseSharedSpaces && MetaspaceShared::is_in_shared_region(addr.pc(), MetaspaceShared::md)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}
#endif
frame ret_frame(ret_sp, frame::unpatchable, addr.pc()); frame ret_frame(ret_sp, frame::unpatchable, addr.pc());
// we were running Java code when SIGPROF came in // we were running Java code when SIGPROF came in

View file

@ -23,6 +23,7 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "memory/metaspaceShared.hpp"
#include "runtime/frame.inline.hpp" #include "runtime/frame.inline.hpp"
#include "runtime/thread.inline.hpp" #include "runtime/thread.inline.hpp"
@ -70,6 +71,14 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr,
return false; return false;
} }
#if INCLUDE_CDS
if (UseSharedSpaces && MetaspaceShared::is_in_shared_region(addr.pc(), MetaspaceShared::md)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}
#endif
// If sp and fp are nonsense just leave them out // If sp and fp are nonsense just leave them out
if (!jt->on_local_stack((address)ret_sp)) { if (!jt->on_local_stack((address)ret_sp)) {

View file

@ -23,6 +23,7 @@
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "memory/metaspaceShared.hpp"
#include "runtime/frame.inline.hpp" #include "runtime/frame.inline.hpp"
#include "runtime/thread.inline.hpp" #include "runtime/thread.inline.hpp"
@ -72,6 +73,14 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
return false; return false;
} }
#if INCLUDE_CDS
if (UseSharedSpaces && MetaspaceShared::is_in_shared_region(addr.pc(), MetaspaceShared::md)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}
#endif
frame ret_frame(ret_sp, ret_fp, addr.pc()); frame ret_frame(ret_sp, ret_fp, addr.pc());
if (!ret_frame.safe_for_sender(jt)) { if (!ret_frame.safe_for_sender(jt)) {
#if defined(COMPILER2) || INCLUDE_JVMCI #if defined(COMPILER2) || INCLUDE_JVMCI

View file

@ -2187,43 +2187,19 @@ void java_lang_StackTraceElement::fill_in(Handle element,
} }
Method* java_lang_StackFrameInfo::get_method(Handle stackFrame, InstanceKlass* holder, TRAPS) { Method* java_lang_StackFrameInfo::get_method(Handle stackFrame, InstanceKlass* holder, TRAPS) {
if (MemberNameInStackFrame) { Handle mname(THREAD, stackFrame->obj_field(_memberName_offset));
Handle mname(THREAD, stackFrame->obj_field(_memberName_offset)); Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mname());
Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mname()); // we should expand MemberName::name when Throwable uses StackTrace
// we should expand MemberName::name when Throwable uses StackTrace // MethodHandles::expand_MemberName(mname, MethodHandles::_suppress_defc|MethodHandles::_suppress_type, CHECK_NULL);
// MethodHandles::expand_MemberName(mname, MethodHandles::_suppress_defc|MethodHandles::_suppress_type, CHECK_NULL); return method;
return method;
} else {
short mid = stackFrame->short_field(_mid_offset);
short version = stackFrame->short_field(_version_offset);
return holder->method_with_orig_idnum(mid, version);
}
}
Symbol* java_lang_StackFrameInfo::get_file_name(Handle stackFrame, InstanceKlass* holder) {
if (MemberNameInStackFrame) {
return holder->source_file_name();
} else {
short version = stackFrame->short_field(_version_offset);
return Backtrace::get_source_file_name(holder, version);
}
} }
void java_lang_StackFrameInfo::set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci) { void java_lang_StackFrameInfo::set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci) {
// set Method* or mid/cpref // set Method* or mid/cpref
if (MemberNameInStackFrame) { oop mname = stackFrame->obj_field(_memberName_offset);
oop mname = stackFrame->obj_field(_memberName_offset); InstanceKlass* ik = method->method_holder();
InstanceKlass* ik = method->method_holder(); CallInfo info(method(), ik);
CallInfo info(method(), ik); MethodHandles::init_method_MemberName(mname, info);
MethodHandles::init_method_MemberName(mname, info);
} else {
int mid = method->orig_method_idnum();
int cpref = method->name_index();
assert((jushort)mid == mid, "mid should be short");
assert((jushort)cpref == cpref, "cpref should be short");
java_lang_StackFrameInfo::set_mid(stackFrame(), (short)mid);
java_lang_StackFrameInfo::set_cpref(stackFrame(), (short)cpref);
}
// set bci // set bci
java_lang_StackFrameInfo::set_bci(stackFrame(), bci); java_lang_StackFrameInfo::set_bci(stackFrame(), bci);
// method may be redefined; store the version // method may be redefined; store the version
@ -2232,52 +2208,23 @@ void java_lang_StackFrameInfo::set_method_and_bci(Handle stackFrame, const metho
java_lang_StackFrameInfo::set_version(stackFrame(), (short)version); java_lang_StackFrameInfo::set_version(stackFrame(), (short)version);
} }
void java_lang_StackFrameInfo::fill_methodInfo(Handle stackFrame, TRAPS) { void java_lang_StackFrameInfo::to_stack_trace_element(Handle stackFrame, Handle stack_trace_element, TRAPS) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
oop k = stackFrame->obj_field(_declaringClass_offset); Handle k (THREAD, stackFrame->obj_field(_declaringClass_offset));
InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(k)); InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(k()));
Method* method = java_lang_StackFrameInfo::get_method(stackFrame, holder, CHECK); Method* method = java_lang_StackFrameInfo::get_method(stackFrame, holder, CHECK);
int bci = stackFrame->int_field(_bci_offset);
// The method can be NULL if the requested class version is gone
Symbol* sym = (method != NULL) ? method->name() : NULL;
if (MemberNameInStackFrame) {
assert(sym != NULL, "MemberName must have method name");
} else {
// The method can be NULL if the requested class version is gone
if (sym == NULL) {
short cpref = stackFrame->short_field(_cpref_offset);
sym = holder->constants()->symbol_at(cpref);
}
}
// set method name
oop methodname = StringTable::intern(sym, CHECK);
java_lang_StackFrameInfo::set_methodName(stackFrame(), methodname);
// set file name and line number
Symbol* source = get_file_name(stackFrame, holder);
if (source != NULL) {
oop filename = StringTable::intern(source, CHECK);
java_lang_StackFrameInfo::set_fileName(stackFrame(), filename);
}
// if the method has been redefined, the bci is no longer applicable
short version = stackFrame->short_field(_version_offset); short version = stackFrame->short_field(_version_offset);
if (version_matches(method, version)) { short bci = stackFrame->short_field(_bci_offset);
int line_number = Backtrace::get_line_number(method, bci); int cpref = method->name_index();
java_lang_StackFrameInfo::set_lineNumber(stackFrame(), line_number); java_lang_StackTraceElement::fill_in(stack_trace_element, holder, method, version, bci, cpref, CHECK);
}
} }
void java_lang_StackFrameInfo::compute_offsets() { void java_lang_StackFrameInfo::compute_offsets() {
Klass* k = SystemDictionary::StackFrameInfo_klass(); Klass* k = SystemDictionary::StackFrameInfo_klass();
compute_offset(_declaringClass_offset, k, vmSymbols::declaringClass_name(), vmSymbols::class_signature()); compute_offset(_declaringClass_offset, k, vmSymbols::declaringClass_name(), vmSymbols::class_signature());
compute_offset(_memberName_offset, k, vmSymbols::memberName_name(), vmSymbols::object_signature()); compute_offset(_memberName_offset, k, vmSymbols::memberName_name(), vmSymbols::object_signature());
compute_offset(_bci_offset, k, vmSymbols::bci_name(), vmSymbols::int_signature()); compute_offset(_bci_offset, k, vmSymbols::bci_name(), vmSymbols::short_signature());
compute_offset(_methodName_offset, k, vmSymbols::methodName_name(), vmSymbols::string_signature());
compute_offset(_fileName_offset, k, vmSymbols::fileName_name(), vmSymbols::string_signature());
compute_offset(_lineNumber_offset, k, vmSymbols::lineNumber_name(), vmSymbols::int_signature());
STACKFRAMEINFO_INJECTED_FIELDS(INJECTED_FIELD_COMPUTE_OFFSET); STACKFRAMEINFO_INJECTED_FIELDS(INJECTED_FIELD_COMPUTE_OFFSET);
} }
@ -3690,12 +3637,7 @@ int java_lang_StackTraceElement::moduleVersion_offset;
int java_lang_StackFrameInfo::_declaringClass_offset; int java_lang_StackFrameInfo::_declaringClass_offset;
int java_lang_StackFrameInfo::_memberName_offset; int java_lang_StackFrameInfo::_memberName_offset;
int java_lang_StackFrameInfo::_bci_offset; int java_lang_StackFrameInfo::_bci_offset;
int java_lang_StackFrameInfo::_methodName_offset;
int java_lang_StackFrameInfo::_fileName_offset;
int java_lang_StackFrameInfo::_lineNumber_offset;
int java_lang_StackFrameInfo::_mid_offset;
int java_lang_StackFrameInfo::_version_offset; int java_lang_StackFrameInfo::_version_offset;
int java_lang_StackFrameInfo::_cpref_offset;
int java_lang_LiveStackFrameInfo::_monitors_offset; int java_lang_LiveStackFrameInfo::_monitors_offset;
int java_lang_LiveStackFrameInfo::_locals_offset; int java_lang_LiveStackFrameInfo::_locals_offset;
int java_lang_LiveStackFrameInfo::_operands_offset; int java_lang_LiveStackFrameInfo::_operands_offset;
@ -3741,34 +3683,14 @@ void java_lang_StackFrameInfo::set_declaringClass(oop element, oop value) {
element->obj_field_put(_declaringClass_offset, value); element->obj_field_put(_declaringClass_offset, value);
} }
void java_lang_StackFrameInfo::set_mid(oop element, short value) {
element->short_field_put(_mid_offset, value);
}
void java_lang_StackFrameInfo::set_version(oop element, short value) { void java_lang_StackFrameInfo::set_version(oop element, short value) {
element->short_field_put(_version_offset, value); element->short_field_put(_version_offset, value);
} }
void java_lang_StackFrameInfo::set_cpref(oop element, short value) {
element->short_field_put(_cpref_offset, value);
}
void java_lang_StackFrameInfo::set_bci(oop element, int value) { void java_lang_StackFrameInfo::set_bci(oop element, int value) {
element->int_field_put(_bci_offset, value); element->int_field_put(_bci_offset, value);
} }
void java_lang_StackFrameInfo::set_fileName(oop element, oop value) {
element->obj_field_put(_fileName_offset, value);
}
void java_lang_StackFrameInfo::set_methodName(oop element, oop value) {
element->obj_field_put(_methodName_offset, value);
}
void java_lang_StackFrameInfo::set_lineNumber(oop element, int value) {
element->int_field_put(_lineNumber_offset, value);
}
void java_lang_LiveStackFrameInfo::set_monitors(oop element, oop value) { void java_lang_LiveStackFrameInfo::set_monitors(oop element, oop value) {
element->obj_field_put(_monitors_offset, value); element->obj_field_put(_monitors_offset, value);
} }

View file

@ -1364,25 +1364,16 @@ class Backtrace: AllStatic {
// Interface to java.lang.StackFrameInfo objects // Interface to java.lang.StackFrameInfo objects
#define STACKFRAMEINFO_INJECTED_FIELDS(macro) \ #define STACKFRAMEINFO_INJECTED_FIELDS(macro) \
macro(java_lang_StackFrameInfo, mid, short_signature, false) \ macro(java_lang_StackFrameInfo, version, short_signature, false)
macro(java_lang_StackFrameInfo, version, short_signature, false) \
macro(java_lang_StackFrameInfo, cpref, short_signature, false)
class java_lang_StackFrameInfo: AllStatic { class java_lang_StackFrameInfo: AllStatic {
private: private:
static int _declaringClass_offset; static int _declaringClass_offset;
static int _memberName_offset; static int _memberName_offset;
static int _bci_offset; static int _bci_offset;
static int _methodName_offset;
static int _fileName_offset;
static int _lineNumber_offset;
static int _mid_offset;
static int _version_offset; static int _version_offset;
static int _cpref_offset;
static Method* get_method(Handle stackFrame, InstanceKlass* holder, TRAPS); static Method* get_method(Handle stackFrame, InstanceKlass* holder, TRAPS);
static Symbol* get_file_name(Handle stackFrame, InstanceKlass* holder);
public: public:
// Setters // Setters
@ -1390,19 +1381,12 @@ public:
static void set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci); static void set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci);
static void set_bci(oop info, int value); static void set_bci(oop info, int value);
// set method info in an instance of StackFrameInfo
static void fill_methodInfo(Handle info, TRAPS);
static void set_methodName(oop info, oop value);
static void set_fileName(oop info, oop value);
static void set_lineNumber(oop info, int value);
// these injected fields are only used if -XX:-MemberNameInStackFrame set
static void set_mid(oop info, short value);
static void set_version(oop info, short value); static void set_version(oop info, short value);
static void set_cpref(oop info, short value);
static void compute_offsets(); static void compute_offsets();
static void to_stack_trace_element(Handle stackFrame, Handle stack_trace_element, TRAPS);
// Debugging // Debugging
friend class JavaClasses; friend class JavaClasses;
}; };

View file

@ -25,6 +25,7 @@
#include "precompiled.hpp" #include "precompiled.hpp"
#include "asm/macroAssembler.hpp" #include "asm/macroAssembler.hpp"
#include "asm/macroAssembler.inline.hpp" #include "asm/macroAssembler.inline.hpp"
#include "compiler/disassembler.hpp"
#include "interpreter/bytecodeHistogram.hpp" #include "interpreter/bytecodeHistogram.hpp"
#include "interpreter/bytecodeInterpreter.hpp" #include "interpreter/bytecodeInterpreter.hpp"
#include "interpreter/interpreter.hpp" #include "interpreter/interpreter.hpp"
@ -32,6 +33,7 @@
#include "interpreter/interp_masm.hpp" #include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp" #include "interpreter/templateTable.hpp"
#include "memory/allocation.inline.hpp" #include "memory/allocation.inline.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "oops/arrayOop.hpp" #include "oops/arrayOop.hpp"
#include "oops/methodData.hpp" #include "oops/methodData.hpp"
@ -93,6 +95,7 @@ address AbstractInterpreter::_native_entry_begin = NU
address AbstractInterpreter::_native_entry_end = NULL; address AbstractInterpreter::_native_entry_end = NULL;
address AbstractInterpreter::_slow_signature_handler; address AbstractInterpreter::_slow_signature_handler;
address AbstractInterpreter::_entry_table [AbstractInterpreter::number_of_method_entries]; address AbstractInterpreter::_entry_table [AbstractInterpreter::number_of_method_entries];
address AbstractInterpreter::_cds_entry_table [AbstractInterpreter::number_of_method_entries];
address AbstractInterpreter::_native_abi_to_tosca [AbstractInterpreter::number_of_result_handlers]; address AbstractInterpreter::_native_abi_to_tosca [AbstractInterpreter::number_of_result_handlers];
//------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------
@ -204,14 +207,41 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(methodHandle m)
return zerolocals; return zerolocals;
} }
#if INCLUDE_CDS
address AbstractInterpreter::get_trampoline_code_buffer(AbstractInterpreter::MethodKind kind) {
const size_t trampoline_size = SharedRuntime::trampoline_size();
address addr = MetaspaceShared::cds_i2i_entry_code_buffers((size_t)(AbstractInterpreter::number_of_method_entries) * trampoline_size);
addr += (size_t)(kind) * trampoline_size;
return addr;
}
void AbstractInterpreter::update_cds_entry_table(AbstractInterpreter::MethodKind kind) {
if (DumpSharedSpaces || UseSharedSpaces) {
address trampoline = get_trampoline_code_buffer(kind);
_cds_entry_table[kind] = trampoline;
CodeBuffer buffer(trampoline, (int)(SharedRuntime::trampoline_size()));
MacroAssembler _masm(&buffer);
SharedRuntime::generate_trampoline(&_masm, _entry_table[kind]);
if (PrintInterpreter) {
Disassembler::decode(buffer.insts_begin(), buffer.insts_end());
}
}
}
#endif
void AbstractInterpreter::set_entry_for_kind(AbstractInterpreter::MethodKind kind, address entry) { void AbstractInterpreter::set_entry_for_kind(AbstractInterpreter::MethodKind kind, address entry) {
assert(kind >= method_handle_invoke_FIRST && assert(kind >= method_handle_invoke_FIRST &&
kind <= method_handle_invoke_LAST, "late initialization only for MH entry points"); kind <= method_handle_invoke_LAST, "late initialization only for MH entry points");
assert(_entry_table[kind] == _entry_table[abstract], "previous value must be AME entry"); assert(_entry_table[kind] == _entry_table[abstract], "previous value must be AME entry");
_entry_table[kind] = entry; _entry_table[kind] = entry;
}
update_cds_entry_table(kind);
}
// Return true if the interpreter can prove that the given bytecode has // Return true if the interpreter can prove that the given bytecode has
// not yet been executed (in Java semantics, not in actual operation). // not yet been executed (in Java semantics, not in actual operation).
@ -416,5 +446,6 @@ void AbstractInterpreter::initialize_method_handle_entries() {
for (int i = method_handle_invoke_FIRST; i <= method_handle_invoke_LAST; i++) { for (int i = method_handle_invoke_FIRST; i <= method_handle_invoke_LAST; i++) {
MethodKind kind = (MethodKind) i; MethodKind kind = (MethodKind) i;
_entry_table[kind] = _entry_table[Interpreter::abstract]; _entry_table[kind] = _entry_table[Interpreter::abstract];
Interpreter::update_cds_entry_table(kind);
} }
} }

View file

@ -113,6 +113,7 @@ class AbstractInterpreter: AllStatic {
// method entry points // method entry points
static address _entry_table[number_of_method_entries]; // entry points for a given method static address _entry_table[number_of_method_entries]; // entry points for a given method
static address _cds_entry_table[number_of_method_entries]; // entry points for methods in the CDS archive
static address _native_abi_to_tosca[number_of_result_handlers]; // for native method result handlers static address _native_abi_to_tosca[number_of_result_handlers]; // for native method result handlers
static address _slow_signature_handler; // the native method generic (slow) signature handler static address _slow_signature_handler; // the native method generic (slow) signature handler
@ -132,6 +133,17 @@ class AbstractInterpreter: AllStatic {
static address entry_for_kind(MethodKind k) { assert(0 <= k && k < number_of_method_entries, "illegal kind"); return _entry_table[k]; } static address entry_for_kind(MethodKind k) { assert(0 <= k && k < number_of_method_entries, "illegal kind"); return _entry_table[k]; }
static address entry_for_method(methodHandle m) { return entry_for_kind(method_kind(m)); } static address entry_for_method(methodHandle m) { return entry_for_kind(method_kind(m)); }
static address entry_for_cds_method(methodHandle m) {
MethodKind k = method_kind(m);
assert(0 <= k && k < number_of_method_entries, "illegal kind");
return _cds_entry_table[k];
}
// used by class data sharing
static void update_cds_entry_table(MethodKind kind) NOT_CDS_RETURN;
static address get_trampoline_code_buffer(AbstractInterpreter::MethodKind kind) NOT_CDS_RETURN_(0);
// used for bootstrapping method handles: // used for bootstrapping method handles:
static void set_entry_for_kind(MethodKind k, address e); static void set_entry_for_kind(MethodKind k, address e);

View file

@ -313,18 +313,7 @@ IRT_ENTRY(void, InterpreterRuntime::throw_StackOverflowError(JavaThread* thread)
THROW_HANDLE(exception); THROW_HANDLE(exception);
IRT_END IRT_END
IRT_ENTRY(address, InterpreterRuntime::check_ReservedStackAccess_annotated_methods(JavaThread* thread)) IRT_ENTRY(void, InterpreterRuntime::throw_delayed_StackOverflowError(JavaThread* thread))
frame fr = thread->last_frame();
assert(fr.is_java_frame(), "Must be a Java frame");
frame activation = SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr);
if (activation.sp() != NULL) {
thread->disable_stack_reserved_zone();
thread->set_reserved_stack_activation((address)activation.unextended_sp());
}
return (address)activation.sp();
IRT_END
IRT_ENTRY(void, InterpreterRuntime::throw_delayed_StackOverflowError(JavaThread* thread))
Handle exception = get_preinitialized_exception( Handle exception = get_preinitialized_exception(
SystemDictionary::StackOverflowError_klass(), SystemDictionary::StackOverflowError_klass(),
CHECK); CHECK);

View file

@ -91,8 +91,6 @@ class InterpreterRuntime: AllStatic {
// Quicken instance-of and check-cast bytecodes // Quicken instance-of and check-cast bytecodes
static void quicken_io_cc(JavaThread* thread); static void quicken_io_cc(JavaThread* thread);
static address check_ReservedStackAccess_annotated_methods(JavaThread* thread);
// Exceptions thrown by the interpreter // Exceptions thrown by the interpreter
static void throw_AbstractMethodError(JavaThread* thread); static void throw_AbstractMethodError(JavaThread* thread);
static void throw_IncompatibleClassChangeError(JavaThread* thread); static void throw_IncompatibleClassChangeError(JavaThread* thread);

View file

@ -212,6 +212,7 @@ void TemplateInterpreterGenerator::generate_all() {
#define method_entry(kind) \ #define method_entry(kind) \
{ CodeletMark cm(_masm, "method entry point (kind = " #kind ")"); \ { CodeletMark cm(_masm, "method entry point (kind = " #kind ")"); \
Interpreter::_entry_table[Interpreter::kind] = generate_method_entry(Interpreter::kind); \ Interpreter::_entry_table[Interpreter::kind] = generate_method_entry(Interpreter::kind); \
Interpreter::update_cds_entry_table(Interpreter::kind); \
} }
// all non-native method kinds // all non-native method kinds

View file

@ -959,6 +959,16 @@ bool FileMapInfo::is_in_shared_space(const void* p) {
return false; return false;
} }
// Check if a given address is within one of the shared regions (ro, rw, md, mc)
bool FileMapInfo::is_in_shared_region(const void* p, int idx) {
assert((idx >= MetaspaceShared::ro) && (idx <= MetaspaceShared::mc), "invalid region index");
char* base = _header->region_addr(idx);
if (p >= base && p < base + _header->_space[idx]._used) {
return true;
}
return false;
}
void FileMapInfo::print_shared_spaces() { void FileMapInfo::print_shared_spaces() {
tty->print_cr("Shared Spaces:"); tty->print_cr("Shared Spaces:");
for (int i = 0; i < MetaspaceShared::n_regions; i++) { for (int i = 0; i < MetaspaceShared::n_regions; i++) {

View file

@ -107,6 +107,8 @@ public:
int _narrow_klass_shift; // save narrow klass base and shift int _narrow_klass_shift; // save narrow klass base and shift
address _narrow_klass_base; address _narrow_klass_base;
char* _misc_data_patching_start; char* _misc_data_patching_start;
address _cds_i2i_entry_code_buffers;
size_t _cds_i2i_entry_code_buffers_size;
struct space_info { struct space_info {
int _crc; // crc checksum of the current space int _crc; // crc checksum of the current space
@ -195,6 +197,19 @@ public:
char* misc_data_patching_start() { return _header->_misc_data_patching_start; } char* misc_data_patching_start() { return _header->_misc_data_patching_start; }
void set_misc_data_patching_start(char* p) { _header->_misc_data_patching_start = p; } void set_misc_data_patching_start(char* p) { _header->_misc_data_patching_start = p; }
address cds_i2i_entry_code_buffers() {
return _header->_cds_i2i_entry_code_buffers;
}
void set_cds_i2i_entry_code_buffers(address addr) {
_header->_cds_i2i_entry_code_buffers = addr;
}
size_t cds_i2i_entry_code_buffers_size() {
return _header->_cds_i2i_entry_code_buffers_size;
}
void set_cds_i2i_entry_code_buffers_size(size_t s) {
_header->_cds_i2i_entry_code_buffers_size = s;
}
static FileMapInfo* current_info() { static FileMapInfo* current_info() {
CDS_ONLY(return _current_info;) CDS_ONLY(return _current_info;)
NOT_CDS(return NULL;) NOT_CDS(return NULL;)
@ -234,6 +249,7 @@ public:
// Return true if given address is in the mapped shared space. // Return true if given address is in the mapped shared space.
bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false);
bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false);
void print_shared_spaces() NOT_CDS_RETURN; void print_shared_spaces() NOT_CDS_RETURN;
static size_t shared_spaces_size() { static size_t shared_spaces_size() {

View file

@ -59,6 +59,8 @@ bool MetaspaceShared::_link_classes_made_progress;
bool MetaspaceShared::_check_classes_made_progress; bool MetaspaceShared::_check_classes_made_progress;
bool MetaspaceShared::_has_error_classes; bool MetaspaceShared::_has_error_classes;
bool MetaspaceShared::_archive_loading_failed = false; bool MetaspaceShared::_archive_loading_failed = false;
address MetaspaceShared::_cds_i2i_entry_code_buffers = NULL;
size_t MetaspaceShared::_cds_i2i_entry_code_buffers_size = 0;
SharedMiscRegion MetaspaceShared::_mc; SharedMiscRegion MetaspaceShared::_mc;
SharedMiscRegion MetaspaceShared::_md; SharedMiscRegion MetaspaceShared::_md;
@ -129,6 +131,21 @@ void MetaspaceShared::serialize(SerializeClosure* soc) {
soc->do_tag(666); soc->do_tag(666);
} }
address MetaspaceShared::cds_i2i_entry_code_buffers(size_t total_size) {
if (DumpSharedSpaces) {
if (_cds_i2i_entry_code_buffers == NULL) {
_cds_i2i_entry_code_buffers = (address)misc_data_space_alloc(total_size);
_cds_i2i_entry_code_buffers_size = total_size;
}
} else if (UseSharedSpaces) {
assert(_cds_i2i_entry_code_buffers != NULL, "must already been initialized");
} else {
return NULL;
}
assert(_cds_i2i_entry_code_buffers_size == total_size, "must not change");
return _cds_i2i_entry_code_buffers;
}
// CDS code for dumping shared archive. // CDS code for dumping shared archive.
@ -576,6 +593,8 @@ void VM_PopulateDumpSharedSpace::doit() {
&md_top, md_end, &md_top, md_end,
&mc_top, mc_end); &mc_top, mc_end);
guarantee(md_top <= md_end, "Insufficient space for vtables.");
// Reorder the system dictionary. (Moving the symbols affects // Reorder the system dictionary. (Moving the symbols affects
// how the hash table indices are calculated.) // how the hash table indices are calculated.)
// Not doing this either. // Not doing this either.
@ -668,6 +687,8 @@ void VM_PopulateDumpSharedSpace::doit() {
FileMapInfo* mapinfo = new FileMapInfo(); FileMapInfo* mapinfo = new FileMapInfo();
mapinfo->populate_header(MetaspaceShared::max_alignment()); mapinfo->populate_header(MetaspaceShared::max_alignment());
mapinfo->set_misc_data_patching_start((char*)vtbl_list); mapinfo->set_misc_data_patching_start((char*)vtbl_list);
mapinfo->set_cds_i2i_entry_code_buffers(MetaspaceShared::cds_i2i_entry_code_buffers());
mapinfo->set_cds_i2i_entry_code_buffers_size(MetaspaceShared::cds_i2i_entry_code_buffers_size());
for (int pass=1; pass<=2; pass++) { for (int pass=1; pass<=2; pass++) {
if (pass == 1) { if (pass == 1) {
@ -686,7 +707,7 @@ void VM_PopulateDumpSharedSpace::doit() {
mapinfo->write_region(MetaspaceShared::md, _md_vs.low(), mapinfo->write_region(MetaspaceShared::md, _md_vs.low(),
pointer_delta(md_top, _md_vs.low(), sizeof(char)), pointer_delta(md_top, _md_vs.low(), sizeof(char)),
SharedMiscDataSize, SharedMiscDataSize,
false, false); false, true);
mapinfo->write_region(MetaspaceShared::mc, _mc_vs.low(), mapinfo->write_region(MetaspaceShared::mc, _mc_vs.low(),
pointer_delta(mc_top, _mc_vs.low(), sizeof(char)), pointer_delta(mc_top, _mc_vs.low(), sizeof(char)),
SharedMiscCodeSize, SharedMiscCodeSize,
@ -980,6 +1001,11 @@ bool MetaspaceShared::is_in_shared_space(const void* p) {
return UseSharedSpaces && FileMapInfo::current_info()->is_in_shared_space(p); return UseSharedSpaces && FileMapInfo::current_info()->is_in_shared_space(p);
} }
// Return true if given address is in the misc data region
bool MetaspaceShared::is_in_shared_region(const void* p, int idx) {
return UseSharedSpaces && FileMapInfo::current_info()->is_in_shared_region(p, idx);
}
bool MetaspaceShared::is_string_region(int idx) { bool MetaspaceShared::is_string_region(int idx) {
return (idx >= MetaspaceShared::first_string && return (idx >= MetaspaceShared::first_string &&
idx < MetaspaceShared::first_string + MetaspaceShared::max_strings); idx < MetaspaceShared::first_string + MetaspaceShared::max_strings);
@ -1053,6 +1079,8 @@ bool MetaspaceShared::map_shared_spaces(FileMapInfo* mapinfo) {
void MetaspaceShared::initialize_shared_spaces() { void MetaspaceShared::initialize_shared_spaces() {
FileMapInfo *mapinfo = FileMapInfo::current_info(); FileMapInfo *mapinfo = FileMapInfo::current_info();
_cds_i2i_entry_code_buffers = mapinfo->cds_i2i_entry_code_buffers();
_cds_i2i_entry_code_buffers_size = mapinfo->cds_i2i_entry_code_buffers_size();
char* buffer = mapinfo->misc_data_patching_start(); char* buffer = mapinfo->misc_data_patching_start();
// Skip over (reserve space for) a list of addresses of C++ vtables // Skip over (reserve space for) a list of addresses of C++ vtables

View file

@ -50,17 +50,14 @@
#define MIN_SHARED_READ_ONLY_SIZE (NOT_LP64(8*M) LP64_ONLY(9*M)) #define MIN_SHARED_READ_ONLY_SIZE (NOT_LP64(8*M) LP64_ONLY(9*M))
// the MIN_SHARED_MISC_DATA_SIZE and MIN_SHARED_MISC_CODE_SIZE estimates are based on // the MIN_SHARED_MISC_DATA_SIZE and MIN_SHARED_MISC_CODE_SIZE estimates are based on
// MetaspaceShared::generate_vtable_methods(). // the sizes required for dumping the archive using the default classlist. The sizes
// The minimum size only accounts for the vtable methods. Any size less than the // are multiplied by 1.5 for a safety margin.
// minimum required size would cause vm crash when allocating the vtable methods.
#define SHARED_MISC_SIZE_FOR(size) (DEFAULT_VTBL_VIRTUALS_COUNT*DEFAULT_VTBL_LIST_SIZE*size)
#define DEFAULT_SHARED_MISC_DATA_SIZE (NOT_LP64(2*M) LP64_ONLY(4*M)) #define DEFAULT_SHARED_MISC_DATA_SIZE (NOT_LP64(2*M) LP64_ONLY(4*M))
#define MIN_SHARED_MISC_DATA_SIZE (SHARED_MISC_SIZE_FOR(sizeof(void*))) #define MIN_SHARED_MISC_DATA_SIZE (NOT_LP64(1*M) LP64_ONLY(1200*K))
#define DEFAULT_SHARED_MISC_CODE_SIZE (120*K) #define DEFAULT_SHARED_MISC_CODE_SIZE (120*K)
#define MIN_SHARED_MISC_CODE_SIZE (SHARED_MISC_SIZE_FOR(sizeof(void*))+SHARED_MISC_SIZE_FOR(DEFAULT_VTBL_METHOD_SIZE)+DEFAULT_VTBL_COMMON_CODE_SIZE) #define MIN_SHARED_MISC_CODE_SIZE (NOT_LP64(63*K) LP64_ONLY(69*K))
#define DEFAULT_COMBINED_SIZE (DEFAULT_SHARED_READ_WRITE_SIZE+DEFAULT_SHARED_READ_ONLY_SIZE+DEFAULT_SHARED_MISC_DATA_SIZE+DEFAULT_SHARED_MISC_CODE_SIZE) #define DEFAULT_COMBINED_SIZE (DEFAULT_SHARED_READ_WRITE_SIZE+DEFAULT_SHARED_READ_ONLY_SIZE+DEFAULT_SHARED_MISC_DATA_SIZE+DEFAULT_SHARED_MISC_CODE_SIZE)
// the max size is the MAX size (ie. 0x7FFFFFFF) - the total size of // the max size is the MAX size (ie. 0x7FFFFFFF) - the total size of
@ -128,6 +125,8 @@ class MetaspaceShared : AllStatic {
static bool _check_classes_made_progress; static bool _check_classes_made_progress;
static bool _has_error_classes; static bool _has_error_classes;
static bool _archive_loading_failed; static bool _archive_loading_failed;
static address _cds_i2i_entry_code_buffers;
static size_t _cds_i2i_entry_code_buffers_size;
// Used only during dumping. // Used only during dumping.
static SharedMiscRegion _md; static SharedMiscRegion _md;
@ -185,6 +184,9 @@ class MetaspaceShared : AllStatic {
// Return true if given address is in the mapped shared space. // Return true if given address is in the mapped shared space.
static bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); static bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false);
// Return true if given address is in the shared region corresponding to the idx
static bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false);
static bool is_string_region(int idx) NOT_CDS_RETURN_(false); static bool is_string_region(int idx) NOT_CDS_RETURN_(false);
static void generate_vtable_methods(void** vtbl_list, static void generate_vtable_methods(void** vtbl_list,
@ -218,6 +220,15 @@ class MetaspaceShared : AllStatic {
static char* misc_code_space_alloc(size_t num_bytes) { return _mc.alloc(num_bytes); } static char* misc_code_space_alloc(size_t num_bytes) { return _mc.alloc(num_bytes); }
static char* misc_data_space_alloc(size_t num_bytes) { return _md.alloc(num_bytes); } static char* misc_data_space_alloc(size_t num_bytes) { return _md.alloc(num_bytes); }
static address cds_i2i_entry_code_buffers(size_t total_size);
static address cds_i2i_entry_code_buffers() {
return _cds_i2i_entry_code_buffers;
}
static size_t cds_i2i_entry_code_buffers_size() {
return _cds_i2i_entry_code_buffers_size;
}
static SharedMiscRegion* misc_code_region() { static SharedMiscRegion* misc_code_region() {
assert(DumpSharedSpaces, "used during dumping only"); assert(DumpSharedSpaces, "used during dumping only");
return &_mc; return &_mc;

View file

@ -121,6 +121,7 @@ class MethodParametersElement VALUE_OBJ_CLASS_SPEC {
}; };
class KlassSizeStats; class KlassSizeStats;
class AdapterHandlerEntry;
// Class to collect the sizes of ConstMethod inline tables // Class to collect the sizes of ConstMethod inline tables
#define INLINE_TABLES_DO(do_element) \ #define INLINE_TABLES_DO(do_element) \
@ -201,6 +202,12 @@ private:
// Raw stackmap data for the method // Raw stackmap data for the method
Array<u1>* _stackmap_data; Array<u1>* _stackmap_data;
// Adapter blob (i2c/c2i) for this Method*. Set once when method is linked.
union {
AdapterHandlerEntry* _adapter;
AdapterHandlerEntry** _adapter_trampoline;
};
int _constMethod_size; int _constMethod_size;
u2 _flags; u2 _flags;
@ -276,6 +283,29 @@ public:
void copy_stackmap_data(ClassLoaderData* loader_data, u1* sd, int length, TRAPS); void copy_stackmap_data(ClassLoaderData* loader_data, u1* sd, int length, TRAPS);
bool has_stackmap_table() const { return _stackmap_data != NULL; } bool has_stackmap_table() const { return _stackmap_data != NULL; }
// adapter
void set_adapter_entry(AdapterHandlerEntry* adapter) {
assert(!is_shared(), "shared methods have fixed adapter_trampoline");
_adapter = adapter;
}
void set_adapter_trampoline(AdapterHandlerEntry** trampoline) {
assert(DumpSharedSpaces, "must be");
assert(*trampoline == NULL, "must be NULL during dump time, to be initialized at run time");
_adapter_trampoline = trampoline;
}
void update_adapter_trampoline(AdapterHandlerEntry* adapter) {
assert(is_shared(), "must be");
*_adapter_trampoline = adapter;
assert(this->adapter() == adapter, "must be");
}
AdapterHandlerEntry* adapter() {
if (is_shared()) {
return *_adapter_trampoline;
} else {
return _adapter;
}
}
void init_fingerprint() { void init_fingerprint() {
const uint64_t initval = UCONST64(0x8000000000000000); const uint64_t initval = UCONST64(0x8000000000000000);
_fingerprint = initval; _fingerprint = initval;

View file

@ -38,6 +38,7 @@
#include "interpreter/oopMapCache.hpp" #include "interpreter/oopMapCache.hpp"
#include "memory/heapInspection.hpp" #include "memory/heapInspection.hpp"
#include "memory/metadataFactory.hpp" #include "memory/metadataFactory.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/oopFactory.hpp" #include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "oops/constMethod.hpp" #include "oops/constMethod.hpp"
@ -123,18 +124,18 @@ void Method::deallocate_contents(ClassLoaderData* loader_data) {
} }
address Method::get_i2c_entry() { address Method::get_i2c_entry() {
assert(_adapter != NULL, "must have"); assert(adapter() != NULL, "must have");
return _adapter->get_i2c_entry(); return adapter()->get_i2c_entry();
} }
address Method::get_c2i_entry() { address Method::get_c2i_entry() {
assert(_adapter != NULL, "must have"); assert(adapter() != NULL, "must have");
return _adapter->get_c2i_entry(); return adapter()->get_c2i_entry();
} }
address Method::get_c2i_unverified_entry() { address Method::get_c2i_unverified_entry() {
assert(_adapter != NULL, "must have"); assert(adapter() != NULL, "must have");
return _adapter->get_c2i_unverified_entry(); return adapter()->get_c2i_unverified_entry();
} }
char* Method::name_and_sig_as_C_string() const { char* Method::name_and_sig_as_C_string() const {
@ -892,10 +893,10 @@ void Method::clear_code() {
// this may be NULL if c2i adapters have not been made yet // this may be NULL if c2i adapters have not been made yet
// Only should happen at allocate time. // Only should happen at allocate time.
if (_adapter == NULL) { if (adapter() == NULL) {
_from_compiled_entry = NULL; _from_compiled_entry = NULL;
} else { } else {
_from_compiled_entry = _adapter->get_c2i_entry(); _from_compiled_entry = adapter()->get_c2i_entry();
} }
OrderAccess::storestore(); OrderAccess::storestore();
_from_interpreted_entry = _i2i_entry; _from_interpreted_entry = _i2i_entry;
@ -903,47 +904,68 @@ void Method::clear_code() {
_code = NULL; _code = NULL;
} }
#if INCLUDE_CDS
// Called by class data sharing to remove any entry points (which are not shared) // Called by class data sharing to remove any entry points (which are not shared)
void Method::unlink_method() { void Method::unlink_method() {
_code = NULL; _code = NULL;
_i2i_entry = NULL;
_from_interpreted_entry = NULL; assert(DumpSharedSpaces, "dump time only");
// Set the values to what they should be at run time. Note that
// this Method can no longer be executed during dump time.
_i2i_entry = Interpreter::entry_for_cds_method(this);
_from_interpreted_entry = _i2i_entry;
if (is_native()) { if (is_native()) {
*native_function_addr() = NULL; *native_function_addr() = NULL;
set_signature_handler(NULL); set_signature_handler(NULL);
} }
NOT_PRODUCT(set_compiled_invocation_count(0);) NOT_PRODUCT(set_compiled_invocation_count(0);)
_adapter = NULL;
_from_compiled_entry = NULL; CDSAdapterHandlerEntry* cds_adapter = (CDSAdapterHandlerEntry*)adapter();
constMethod()->set_adapter_trampoline(cds_adapter->get_adapter_trampoline());
_from_compiled_entry = cds_adapter->get_c2i_entry_trampoline();
assert(*((int*)_from_compiled_entry) == 0, "must be NULL during dump time, to be initialized at run time");
// In case of DumpSharedSpaces, _method_data should always be NULL. // In case of DumpSharedSpaces, _method_data should always be NULL.
// assert(_method_data == NULL, "unexpected method data?");
// During runtime (!DumpSharedSpaces), when we are cleaning a
// shared class that failed to load, this->link_method() may
// have already been called (before an exception happened), so
// this->_method_data may not be NULL.
assert(!DumpSharedSpaces || _method_data == NULL, "unexpected method data?");
set_method_data(NULL); set_method_data(NULL);
clear_method_counters(); clear_method_counters();
} }
#endif
// Called when the method_holder is getting linked. Setup entrypoints so the method // Called when the method_holder is getting linked. Setup entrypoints so the method
// is ready to be called from interpreter, compiler, and vtables. // is ready to be called from interpreter, compiler, and vtables.
void Method::link_method(const methodHandle& h_method, TRAPS) { void Method::link_method(const methodHandle& h_method, TRAPS) {
// If the code cache is full, we may reenter this function for the // If the code cache is full, we may reenter this function for the
// leftover methods that weren't linked. // leftover methods that weren't linked.
if (_i2i_entry != NULL) return; if (is_shared()) {
if (adapter() != NULL) return;
} else {
if (_i2i_entry != NULL) return;
assert(_adapter == NULL, "init'd to NULL" ); assert(adapter() == NULL, "init'd to NULL" );
}
assert( _code == NULL, "nothing compiled yet" ); assert( _code == NULL, "nothing compiled yet" );
// Setup interpreter entrypoint // Setup interpreter entrypoint
assert(this == h_method(), "wrong h_method()" ); assert(this == h_method(), "wrong h_method()" );
address entry = Interpreter::entry_for_method(h_method); address entry;
if (this->is_shared()) {
entry = Interpreter::entry_for_cds_method(h_method);
} else {
entry = Interpreter::entry_for_method(h_method);
}
assert(entry != NULL, "interpreter entry must be non-null"); assert(entry != NULL, "interpreter entry must be non-null");
// Sets both _i2i_entry and _from_interpreted_entry if (is_shared()) {
set_interpreter_entry(entry); assert(entry == _i2i_entry && entry == _from_interpreted_entry,
"should be correctly set during dump time");
} else {
// Sets both _i2i_entry and _from_interpreted_entry
set_interpreter_entry(entry);
}
// Don't overwrite already registered native entries. // Don't overwrite already registered native entries.
if (is_native() && !has_native_function()) { if (is_native() && !has_native_function()) {
@ -975,8 +997,13 @@ address Method::make_adapters(methodHandle mh, TRAPS) {
THROW_MSG_NULL(vmSymbols::java_lang_VirtualMachineError(), "Out of space in CodeCache for adapters"); THROW_MSG_NULL(vmSymbols::java_lang_VirtualMachineError(), "Out of space in CodeCache for adapters");
} }
mh->set_adapter_entry(adapter); if (mh->is_shared()) {
mh->_from_compiled_entry = adapter->get_c2i_entry(); assert(mh->adapter() == adapter, "must be");
assert(mh->_from_compiled_entry != NULL, "must be"); // FIXME, the instructions also not NULL
} else {
mh->set_adapter_entry(adapter);
mh->_from_compiled_entry = adapter->get_c2i_entry();
}
return adapter->get_c2i_entry(); return adapter->get_c2i_entry();
} }
@ -992,6 +1019,14 @@ void Method::restore_unshareable_info(TRAPS) {
} }
} }
volatile address Method::from_compiled_entry_no_trampoline() const {
nmethod *code = (nmethod *)OrderAccess::load_ptr_acquire(&_code);
if (code) {
return code->verified_entry_point();
} else {
return adapter()->get_c2i_entry();
}
}
// The verified_code_entry() must be called when a invoke is resolved // The verified_code_entry() must be called when a invoke is resolved
// on this method. // on this method.

View file

@ -93,8 +93,6 @@ class Method : public Metadata {
#endif #endif
// Entry point for calling both from and to the interpreter. // Entry point for calling both from and to the interpreter.
address _i2i_entry; // All-args-on-stack calling convention address _i2i_entry; // All-args-on-stack calling convention
// Adapter blob (i2c/c2i) for this Method*. Set once when method is linked.
AdapterHandlerEntry* _adapter;
// Entry point for calling from compiled code, to compiled code if it exists // Entry point for calling from compiled code, to compiled code if it exists
// or else the interpreter. // or else the interpreter.
volatile address _from_compiled_entry; // Cache of: _code ? _code->entry_point() : _adapter->c2i_entry() volatile address _from_compiled_entry; // Cache of: _code ? _code->entry_point() : _adapter->c2i_entry()
@ -137,6 +135,7 @@ class Method : public Metadata {
static address make_adapters(methodHandle mh, TRAPS); static address make_adapters(methodHandle mh, TRAPS);
volatile address from_compiled_entry() const { return (address)OrderAccess::load_ptr_acquire(&_from_compiled_entry); } volatile address from_compiled_entry() const { return (address)OrderAccess::load_ptr_acquire(&_from_compiled_entry); }
volatile address from_compiled_entry_no_trampoline() const;
volatile address from_interpreted_entry() const{ return (address)OrderAccess::load_ptr_acquire(&_from_interpreted_entry); } volatile address from_interpreted_entry() const{ return (address)OrderAccess::load_ptr_acquire(&_from_interpreted_entry); }
// access flag // access flag
@ -431,15 +430,23 @@ class Method : public Metadata {
nmethod* volatile code() const { assert( check_code(), "" ); return (nmethod *)OrderAccess::load_ptr_acquire(&_code); } nmethod* volatile code() const { assert( check_code(), "" ); return (nmethod *)OrderAccess::load_ptr_acquire(&_code); }
void clear_code(); // Clear out any compiled code void clear_code(); // Clear out any compiled code
static void set_code(methodHandle mh, nmethod* code); static void set_code(methodHandle mh, nmethod* code);
void set_adapter_entry(AdapterHandlerEntry* adapter) { _adapter = adapter; } void set_adapter_entry(AdapterHandlerEntry* adapter) {
constMethod()->set_adapter_entry(adapter);
}
void update_adapter_trampoline(AdapterHandlerEntry* adapter) {
constMethod()->update_adapter_trampoline(adapter);
}
address get_i2c_entry(); address get_i2c_entry();
address get_c2i_entry(); address get_c2i_entry();
address get_c2i_unverified_entry(); address get_c2i_unverified_entry();
AdapterHandlerEntry* adapter() { return _adapter; } AdapterHandlerEntry* adapter() const {
return constMethod()->adapter();
}
// setup entry points // setup entry points
void link_method(const methodHandle& method, TRAPS); void link_method(const methodHandle& method, TRAPS);
// clear entry points. Used by sharing code // clear entry points. Used by sharing code during dump time
void unlink_method(); void unlink_method() NOT_CDS_RETURN;
// vtable index // vtable index
enum VtableIndexFlag { enum VtableIndexFlag {
@ -465,7 +472,15 @@ class Method : public Metadata {
// interpreter entry // interpreter entry
address interpreter_entry() const { return _i2i_entry; } address interpreter_entry() const { return _i2i_entry; }
// Only used when first initialize so we can set _i2i_entry and _from_interpreted_entry // Only used when first initialize so we can set _i2i_entry and _from_interpreted_entry
void set_interpreter_entry(address entry) { _i2i_entry = entry; _from_interpreted_entry = entry; } void set_interpreter_entry(address entry) {
assert(!is_shared(), "shared method's interpreter entry should not be changed at run time");
if (_i2i_entry != entry) {
_i2i_entry = entry;
}
if (_from_interpreted_entry != entry) {
_from_interpreted_entry = entry;
}
}
// native function (used for native methods only) // native function (used for native methods only)
enum { enum {

View file

@ -534,7 +534,6 @@ JVM_END
JVM_ENTRY(jobject, JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mode, JVM_ENTRY(jobject, JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mode,
jint skip_frames, jint frame_count, jint start_index, jint skip_frames, jint frame_count, jint start_index,
jobjectArray classes,
jobjectArray frames)) jobjectArray frames))
JVMWrapper("JVM_CallStackWalk"); JVMWrapper("JVM_CallStackWalk");
JavaThread* jt = (JavaThread*) THREAD; JavaThread* jt = (JavaThread*) THREAD;
@ -543,78 +542,51 @@ JVM_ENTRY(jobject, JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mod
} }
Handle stackStream_h(THREAD, JNIHandles::resolve_non_null(stackStream)); Handle stackStream_h(THREAD, JNIHandles::resolve_non_null(stackStream));
objArrayOop ca = objArrayOop(JNIHandles::resolve_non_null(classes));
objArrayHandle classes_array_h(THREAD, ca);
// frames array is null when only getting caller reference // frames array is a Class<?>[] array when only getting caller reference,
objArrayOop fa = objArrayOop(JNIHandles::resolve(frames)); // and a StackFrameInfo[] array (or derivative) otherwise. It should never
// be null.
objArrayOop fa = objArrayOop(JNIHandles::resolve_non_null(frames));
objArrayHandle frames_array_h(THREAD, fa); objArrayHandle frames_array_h(THREAD, fa);
int limit = start_index + frame_count; int limit = start_index + frame_count;
if (classes_array_h->length() < limit) { if (frames_array_h->length() < limit) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), "not enough space in buffers", NULL); THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), "not enough space in buffers", NULL);
} }
Handle result = StackWalk::walk(stackStream_h, mode, skip_frames, frame_count, Handle result = StackWalk::walk(stackStream_h, mode, skip_frames, frame_count,
start_index, classes_array_h, start_index, frames_array_h, CHECK_NULL);
frames_array_h, CHECK_NULL);
return JNIHandles::make_local(env, result()); return JNIHandles::make_local(env, result());
JVM_END JVM_END
JVM_ENTRY(jint, JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor, JVM_ENTRY(jint, JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor,
jint frame_count, jint start_index, jint frame_count, jint start_index,
jobjectArray classes,
jobjectArray frames)) jobjectArray frames))
JVMWrapper("JVM_MoreStackWalk"); JVMWrapper("JVM_MoreStackWalk");
JavaThread* jt = (JavaThread*) THREAD; JavaThread* jt = (JavaThread*) THREAD;
objArrayOop ca = objArrayOop(JNIHandles::resolve_non_null(classes));
objArrayHandle classes_array_h(THREAD, ca);
// frames array is null when only getting caller reference // frames array is a Class<?>[] array when only getting caller reference,
objArrayOop fa = objArrayOop(JNIHandles::resolve(frames)); // and a StackFrameInfo[] array (or derivative) otherwise. It should never
// be null.
objArrayOop fa = objArrayOop(JNIHandles::resolve_non_null(frames));
objArrayHandle frames_array_h(THREAD, fa); objArrayHandle frames_array_h(THREAD, fa);
int limit = start_index+frame_count; int limit = start_index+frame_count;
if (classes_array_h->length() < limit) { if (frames_array_h->length() < limit) {
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "not enough space in buffers"); THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "not enough space in buffers");
} }
Handle stackStream_h(THREAD, JNIHandles::resolve_non_null(stackStream)); Handle stackStream_h(THREAD, JNIHandles::resolve_non_null(stackStream));
return StackWalk::moreFrames(stackStream_h, mode, anchor, frame_count, return StackWalk::moreFrames(stackStream_h, mode, anchor, frame_count,
start_index, classes_array_h, start_index, frames_array_h, THREAD);
frames_array_h, THREAD);
JVM_END JVM_END
JVM_ENTRY(void, JVM_FillStackFrames(JNIEnv *env, jclass stackStream, JVM_ENTRY(void, JVM_ToStackTraceElement(JNIEnv *env, jobject frame, jobject stack))
jint start_index, JVMWrapper("JVM_ToStackTraceElement");
jobjectArray frames, Handle stack_frame_info(THREAD, JNIHandles::resolve_non_null(frame));
jint from_index, jint to_index)) Handle stack_trace_element(THREAD, JNIHandles::resolve_non_null(stack));
JVMWrapper("JVM_FillStackFrames"); java_lang_StackFrameInfo::to_stack_trace_element(stack_frame_info, stack_trace_element, THREAD);
if (TraceStackWalk) {
tty->print("JVM_FillStackFrames() start_index=%d from_index=%d to_index=%d\n",
start_index, from_index, to_index);
}
JavaThread* jt = (JavaThread*) THREAD;
objArrayOop fa = objArrayOop(JNIHandles::resolve_non_null(frames));
objArrayHandle frames_array_h(THREAD, fa);
if (frames_array_h->length() < to_index) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "array length not matched");
}
for (int i = from_index; i < to_index; i++) {
Handle stackFrame(THREAD, frames_array_h->obj_at(i));
java_lang_StackFrameInfo::fill_methodInfo(stackFrame, CHECK);
}
JVM_END
JVM_ENTRY(void, JVM_SetMethodInfo(JNIEnv *env, jobject frame))
JVMWrapper("JVM_SetMethodInfo");
Handle stackFrame(THREAD, JNIHandles::resolve(frame));
java_lang_StackFrameInfo::fill_methodInfo(stackFrame, THREAD);
JVM_END JVM_END
// java.lang.Object /////////////////////////////////////////////// // java.lang.Object ///////////////////////////////////////////////

View file

@ -209,7 +209,6 @@ JVM_GetStackTraceElements(JNIEnv *env, jobject throwable, jobjectArray elements)
*/ */
enum { enum {
JVM_STACKWALK_FILL_CLASS_REFS_ONLY = 0x2, JVM_STACKWALK_FILL_CLASS_REFS_ONLY = 0x2,
JVM_STACKWALK_FILTER_FILL_IN_STACK_TRACE = 0x10,
JVM_STACKWALK_SHOW_HIDDEN_FRAMES = 0x20, JVM_STACKWALK_SHOW_HIDDEN_FRAMES = 0x20,
JVM_STACKWALK_FILL_LIVE_STACK_FRAMES = 0x100 JVM_STACKWALK_FILL_LIVE_STACK_FRAMES = 0x100
}; };
@ -217,23 +216,15 @@ enum {
JNIEXPORT jobject JNICALL JNIEXPORT jobject JNICALL
JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mode, JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mode,
jint skip_frames, jint frame_count, jint start_index, jint skip_frames, jint frame_count, jint start_index,
jobjectArray classes,
jobjectArray frames); jobjectArray frames);
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor, JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor,
jint frame_count, jint start_index, jint frame_count, jint start_index,
jobjectArray classes,
jobjectArray frames); jobjectArray frames);
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
JVM_FillStackFrames(JNIEnv* env, jclass cls, JVM_ToStackTraceElement(JNIEnv* env, jobject frame, jobject stackElement);
jint start_index,
jobjectArray frames,
jint from_index, jint toIndex);
JNIEXPORT void JNICALL
JVM_SetMethodInfo(JNIEnv* env, jobject frame);
/* /*
* java.lang.Thread * java.lang.Thread

View file

@ -37,22 +37,22 @@
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
// setup and cleanup actions // setup and cleanup actions
void StackWalkAnchor::setup_magic_on_entry(objArrayHandle classes_array) { void StackWalkAnchor::setup_magic_on_entry(objArrayHandle frames_array) {
classes_array->obj_at_put(magic_pos, _thread->threadObj()); frames_array->obj_at_put(magic_pos, _thread->threadObj());
_anchor = address_value(); _anchor = address_value();
assert(check_magic(classes_array), "invalid magic"); assert(check_magic(frames_array), "invalid magic");
} }
bool StackWalkAnchor::check_magic(objArrayHandle classes_array) { bool StackWalkAnchor::check_magic(objArrayHandle frames_array) {
oop m1 = classes_array->obj_at(magic_pos); oop m1 = frames_array->obj_at(magic_pos);
jlong m2 = _anchor; jlong m2 = _anchor;
if (m1 == _thread->threadObj() && m2 == address_value()) return true; if (m1 == _thread->threadObj() && m2 == address_value()) return true;
return false; return false;
} }
bool StackWalkAnchor::cleanup_magic_on_exit(objArrayHandle classes_array) { bool StackWalkAnchor::cleanup_magic_on_exit(objArrayHandle frames_array) {
bool ok = check_magic(classes_array); bool ok = check_magic(frames_array);
classes_array->obj_at_put(magic_pos, NULL); frames_array->obj_at_put(magic_pos, NULL);
_anchor = 0L; _anchor = 0L;
return ok; return ok;
} }
@ -62,18 +62,18 @@ bool StackWalkAnchor::cleanup_magic_on_exit(objArrayHandle classes_array) {
// Parameters: // Parameters:
// thread Current Java thread. // thread Current Java thread.
// magic Magic value used for each stack walking // magic Magic value used for each stack walking
// classes_array User-supplied buffers. The 0th element is reserved // frames_array User-supplied buffers. The 0th element is reserved
// to this StackWalkAnchor to use // to this StackWalkAnchor to use
// //
StackWalkAnchor* StackWalkAnchor::from_current(JavaThread* thread, jlong magic, StackWalkAnchor* StackWalkAnchor::from_current(JavaThread* thread, jlong magic,
objArrayHandle classes_array) objArrayHandle frames_array)
{ {
assert(thread != NULL && thread->is_Java_thread(), ""); assert(thread != NULL && thread->is_Java_thread(), "");
oop m1 = classes_array->obj_at(magic_pos); oop m1 = frames_array->obj_at(magic_pos);
if (m1 != thread->threadObj()) return NULL; if (m1 != thread->threadObj()) return NULL;
if (magic == 0L) return NULL; if (magic == 0L) return NULL;
StackWalkAnchor* anchor = (StackWalkAnchor*) (intptr_t) magic; StackWalkAnchor* anchor = (StackWalkAnchor*) (intptr_t) magic;
if (!anchor->is_valid_in(thread, classes_array)) return NULL; if (!anchor->is_valid_in(thread, frames_array)) return NULL;
return anchor; return anchor;
} }
@ -88,24 +88,24 @@ StackWalkAnchor* StackWalkAnchor::from_current(JavaThread* thread, jlong magic,
// vfst vFrameStream. // vfst vFrameStream.
// max_nframes Maximum number of frames to be filled. // max_nframes Maximum number of frames to be filled.
// start_index Start index to the user-supplied buffers. // start_index Start index to the user-supplied buffers.
// classes_array Buffer to store classes in, starting at start_index. // frames_array Buffer to store Class or StackFrame in, starting at start_index.
// frames_array Buffer to store StackFrame in, starting at start_index. // frames array is a Class<?>[] array when only getting caller
// NULL if not used. // reference, and a StackFrameInfo[] array (or derivative)
// otherwise. It should never be null.
// end_index End index to the user-supplied buffers with unpacked frames. // end_index End index to the user-supplied buffers with unpacked frames.
// //
// Returns the number of frames whose information was transferred into the buffers. // Returns the number of frames whose information was transferred into the buffers.
// //
int StackWalk::fill_in_frames(jlong mode, vframeStream& vfst, int StackWalk::fill_in_frames(jlong mode, vframeStream& vfst,
int max_nframes, int start_index, int max_nframes, int start_index,
objArrayHandle classes_array,
objArrayHandle frames_array, objArrayHandle frames_array,
int& end_index, TRAPS) { int& end_index, TRAPS) {
if (TraceStackWalk) { if (TraceStackWalk) {
tty->print_cr("fill_in_frames limit=%d start=%d frames length=%d", tty->print_cr("fill_in_frames limit=%d start=%d frames length=%d",
max_nframes, start_index, classes_array->length()); max_nframes, start_index, frames_array->length());
} }
assert(max_nframes > 0, "invalid max_nframes"); assert(max_nframes > 0, "invalid max_nframes");
assert(start_index + max_nframes <= classes_array->length(), "oob"); assert(start_index + max_nframes <= frames_array->length(), "oob");
int frames_decoded = 0; int frames_decoded = 0;
for (; !vfst.at_end(); vfst.next()) { for (; !vfst.at_end(); vfst.next()) {
@ -129,14 +129,18 @@ int StackWalk::fill_in_frames(jlong mode, vframeStream& vfst,
tty->print_cr(" bci=%d", bci); tty->print_cr(" bci=%d", bci);
} }
classes_array->obj_at_put(index, method->method_holder()->java_mirror());
// fill in StackFrameInfo and initialize MemberName // fill in StackFrameInfo and initialize MemberName
if (live_frame_info(mode)) { if (live_frame_info(mode)) {
assert (use_frames_array(mode), "Bad mode for get live frame");
Handle stackFrame(frames_array->obj_at(index)); Handle stackFrame(frames_array->obj_at(index));
fill_live_stackframe(stackFrame, method, bci, vfst.java_frame(), CHECK_0); fill_live_stackframe(stackFrame, method, bci, vfst.java_frame(), CHECK_0);
} else if (need_method_info(mode)) { } else if (need_method_info(mode)) {
assert (use_frames_array(mode), "Bad mode for get stack frame");
Handle stackFrame(frames_array->obj_at(index)); Handle stackFrame(frames_array->obj_at(index));
fill_stackframe(stackFrame, method, bci); fill_stackframe(stackFrame, method, bci);
} else {
assert (use_frames_array(mode) == false, "Bad mode for get caller class");
frames_array->obj_at_put(index, method->method_holder()->java_mirror());
} }
if (++frames_decoded >= max_nframes) break; if (++frames_decoded >= max_nframes) break;
} }
@ -279,15 +283,15 @@ void StackWalk::fill_live_stackframe(Handle stackFrame, const methodHandle& meth
// skip_frames Number of frames to be skipped. // skip_frames Number of frames to be skipped.
// frame_count Number of frames to be traversed. // frame_count Number of frames to be traversed.
// start_index Start index to the user-supplied buffers. // start_index Start index to the user-supplied buffers.
// classes_array Buffer to store classes in, starting at start_index.
// frames_array Buffer to store StackFrame in, starting at start_index. // frames_array Buffer to store StackFrame in, starting at start_index.
// NULL if not used. // frames array is a Class<?>[] array when only getting caller
// reference, and a StackFrameInfo[] array (or derivative)
// otherwise. It should never be null.
// //
// Returns Object returned from AbstractStackWalker::doStackWalk call. // Returns Object returned from AbstractStackWalker::doStackWalk call.
// //
oop StackWalk::walk(Handle stackStream, jlong mode, oop StackWalk::walk(Handle stackStream, jlong mode,
int skip_frames, int frame_count, int start_index, int skip_frames, int frame_count, int start_index,
objArrayHandle classes_array,
objArrayHandle frames_array, objArrayHandle frames_array,
TRAPS) { TRAPS) {
JavaThread* jt = (JavaThread*)THREAD; JavaThread* jt = (JavaThread*)THREAD;
@ -296,10 +300,8 @@ oop StackWalk::walk(Handle stackStream, jlong mode,
mode, skip_frames, frame_count); mode, skip_frames, frame_count);
} }
if (need_method_info(mode)) { if (frames_array.is_null()) {
if (frames_array.is_null()) { THROW_MSG_(vmSymbols::java_lang_NullPointerException(), "frames_array is NULL", NULL);
THROW_MSG_(vmSymbols::java_lang_NullPointerException(), "frames_array is NULL", NULL);
}
} }
Klass* stackWalker_klass = SystemDictionary::StackWalker_klass(); Klass* stackWalker_klass = SystemDictionary::StackWalker_klass();
@ -313,48 +315,17 @@ oop StackWalk::walk(Handle stackStream, jlong mode,
vframeStream& vfst = anchor.vframe_stream(); vframeStream& vfst = anchor.vframe_stream();
{ {
// Skip all methods from AbstractStackWalker and StackWalk (enclosing method) while (!vfst.at_end()) {
if (!fill_in_stacktrace(mode)) { InstanceKlass* ik = vfst.method()->method_holder();
while (!vfst.at_end()) { if (ik != stackWalker_klass &&
InstanceKlass* ik = vfst.method()->method_holder(); ik != abstractStackWalker_klass && ik->super() != abstractStackWalker_klass) {
if (ik != stackWalker_klass && break;
ik != abstractStackWalker_klass && ik->super() != abstractStackWalker_klass) {
break;
}
if (TraceStackWalk) {
tty->print(" skip "); vfst.method()->print_short_name(); tty->print("\n");
}
vfst.next();
} }
}
// For exceptions, skip Throwable::fillInStackTrace and <init> methods if (TraceStackWalk) {
// of the exception class and superclasses tty->print(" skip "); vfst.method()->print_short_name(); tty->print("\n");
if (fill_in_stacktrace(mode)) {
bool skip_to_fillInStackTrace = false;
bool skip_throwableInit_check = false;
while (!vfst.at_end() && !skip_throwableInit_check) {
InstanceKlass* ik = vfst.method()->method_holder();
Method* method = vfst.method();
if (!skip_to_fillInStackTrace) {
if (ik == SystemDictionary::Throwable_klass() &&
method->name() == vmSymbols::fillInStackTrace_name()) {
// this frame will be skipped
skip_to_fillInStackTrace = true;
}
} else if (!(ik->is_subclass_of(SystemDictionary::Throwable_klass()) &&
method->name() == vmSymbols::object_initializer_name())) {
// there are none or we've seen them all - either way stop checking
skip_throwableInit_check = true;
break;
}
if (TraceStackWalk) {
tty->print("stack walk: skip "); vfst.method()->print_short_name(); tty->print("\n");
}
vfst.next();
} }
vfst.next();
} }
// stack frame has been traversed individually and resume stack walk // stack frame has been traversed individually and resume stack walk
@ -372,7 +343,7 @@ oop StackWalk::walk(Handle stackStream, jlong mode,
int end_index = start_index; int end_index = start_index;
int numFrames = 0; int numFrames = 0;
if (!vfst.at_end()) { if (!vfst.at_end()) {
numFrames = fill_in_frames(mode, vfst, frame_count, start_index, classes_array, numFrames = fill_in_frames(mode, vfst, frame_count, start_index,
frames_array, end_index, CHECK_NULL); frames_array, end_index, CHECK_NULL);
if (numFrames < 1) { if (numFrames < 1) {
THROW_MSG_(vmSymbols::java_lang_InternalError(), "stack walk: decode failed", NULL); THROW_MSG_(vmSymbols::java_lang_InternalError(), "stack walk: decode failed", NULL);
@ -392,12 +363,12 @@ oop StackWalk::walk(Handle stackStream, jlong mode,
args.push_int(end_index); args.push_int(end_index);
// Link the thread and vframe stream into the callee-visible object // Link the thread and vframe stream into the callee-visible object
anchor.setup_magic_on_entry(classes_array); anchor.setup_magic_on_entry(frames_array);
JavaCalls::call(&result, m_doStackWalk, &args, THREAD); JavaCalls::call(&result, m_doStackWalk, &args, THREAD);
// Do this before anything else happens, to disable any lingering stream objects // Do this before anything else happens, to disable any lingering stream objects
bool ok = anchor.cleanup_magic_on_exit(classes_array); bool ok = anchor.cleanup_magic_on_exit(frames_array);
// Throw pending exception if we must // Throw pending exception if we must
(void) (CHECK_NULL); (void) (CHECK_NULL);
@ -419,31 +390,28 @@ oop StackWalk::walk(Handle stackStream, jlong mode,
// magic Must be valid value to continue the stack walk // magic Must be valid value to continue the stack walk
// frame_count Number of frames to be decoded. // frame_count Number of frames to be decoded.
// start_index Start index to the user-supplied buffers. // start_index Start index to the user-supplied buffers.
// classes_array Buffer to store classes in, starting at start_index.
// frames_array Buffer to store StackFrame in, starting at start_index. // frames_array Buffer to store StackFrame in, starting at start_index.
// NULL if not used.
// //
// Returns the end index of frame filled in the buffer. // Returns the end index of frame filled in the buffer.
// //
jint StackWalk::moreFrames(Handle stackStream, jlong mode, jlong magic, jint StackWalk::moreFrames(Handle stackStream, jlong mode, jlong magic,
int frame_count, int start_index, int frame_count, int start_index,
objArrayHandle classes_array,
objArrayHandle frames_array, objArrayHandle frames_array,
TRAPS) TRAPS)
{ {
JavaThread* jt = (JavaThread*)THREAD; JavaThread* jt = (JavaThread*)THREAD;
StackWalkAnchor* existing_anchor = StackWalkAnchor::from_current(jt, magic, classes_array); StackWalkAnchor* existing_anchor = StackWalkAnchor::from_current(jt, magic, frames_array);
if (existing_anchor == NULL) { if (existing_anchor == NULL) {
THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: corrupted buffers", 0L); THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: corrupted buffers", 0L);
} }
if ((need_method_info(mode) || live_frame_info(mode)) && frames_array.is_null()) { if (frames_array.is_null()) {
THROW_MSG_(vmSymbols::java_lang_NullPointerException(), "frames_array is NULL", 0L); THROW_MSG_(vmSymbols::java_lang_NullPointerException(), "frames_array is NULL", 0L);
} }
if (TraceStackWalk) { if (TraceStackWalk) {
tty->print_cr("StackWalk::moreFrames frame_count %d existing_anchor " PTR_FORMAT " start %d frames %d", tty->print_cr("StackWalk::moreFrames frame_count %d existing_anchor " PTR_FORMAT " start %d frames %d",
frame_count, p2i(existing_anchor), start_index, classes_array->length()); frame_count, p2i(existing_anchor), start_index, frames_array->length());
} }
int end_index = start_index; int end_index = start_index;
if (frame_count <= 0) { if (frame_count <= 0) {
@ -451,14 +419,14 @@ jint StackWalk::moreFrames(Handle stackStream, jlong mode, jlong magic,
} }
int count = frame_count + start_index; int count = frame_count + start_index;
assert (classes_array->length() >= count, "not enough space in buffers"); assert (frames_array->length() >= count, "not enough space in buffers");
StackWalkAnchor& anchor = (*existing_anchor); StackWalkAnchor& anchor = (*existing_anchor);
vframeStream& vfst = anchor.vframe_stream(); vframeStream& vfst = anchor.vframe_stream();
if (!vfst.at_end()) { if (!vfst.at_end()) {
vfst.next(); // this was the last frame decoded in the previous batch vfst.next(); // this was the last frame decoded in the previous batch
if (!vfst.at_end()) { if (!vfst.at_end()) {
int n = fill_in_frames(mode, vfst, frame_count, start_index, classes_array, int n = fill_in_frames(mode, vfst, frame_count, start_index,
frames_array, end_index, CHECK_0); frames_array, end_index, CHECK_0);
if (n < 1) { if (n < 1) {
THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: later decode failed", 0L); THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: later decode failed", 0L);

View file

@ -45,12 +45,12 @@ public:
vframeStream& vframe_stream() { return _vfst; } vframeStream& vframe_stream() { return _vfst; }
JavaThread* thread() { return _thread; } JavaThread* thread() { return _thread; }
void setup_magic_on_entry(objArrayHandle classes_array); void setup_magic_on_entry(objArrayHandle frames_array);
bool check_magic(objArrayHandle classes_array); bool check_magic(objArrayHandle frames_array);
bool cleanup_magic_on_exit(objArrayHandle classes_array); bool cleanup_magic_on_exit(objArrayHandle frames_array);
bool is_valid_in(Thread* thread, objArrayHandle classes_array) { bool is_valid_in(Thread* thread, objArrayHandle frames_array) {
return (_thread == thread && check_magic(classes_array)); return (_thread == thread && check_magic(frames_array));
} }
jlong address_value() { jlong address_value() {
@ -64,7 +64,6 @@ class StackWalk : public AllStatic {
private: private:
static int fill_in_frames(jlong mode, vframeStream& vfst, static int fill_in_frames(jlong mode, vframeStream& vfst,
int max_nframes, int start_index, int max_nframes, int start_index,
objArrayHandle classes_array,
objArrayHandle frames_array, objArrayHandle frames_array,
int& end_index, TRAPS); int& end_index, TRAPS);
@ -82,20 +81,18 @@ private:
static inline bool live_frame_info(int mode) { static inline bool live_frame_info(int mode) {
return (mode & JVM_STACKWALK_FILL_LIVE_STACK_FRAMES) != 0; return (mode & JVM_STACKWALK_FILL_LIVE_STACK_FRAMES) != 0;
} }
static inline bool fill_in_stacktrace(int mode) {
return (mode & JVM_STACKWALK_FILTER_FILL_IN_STACK_TRACE) != 0;
}
public: public:
static inline bool use_frames_array(int mode) {
return (mode & JVM_STACKWALK_FILL_CLASS_REFS_ONLY) == 0;
}
static oop walk(Handle stackStream, jlong mode, static oop walk(Handle stackStream, jlong mode,
int skip_frames, int frame_count, int start_index, int skip_frames, int frame_count, int start_index,
objArrayHandle classes_array,
objArrayHandle frames_array, objArrayHandle frames_array,
TRAPS); TRAPS);
static jint moreFrames(Handle stackStream, jlong mode, jlong magic, static jint moreFrames(Handle stackStream, jlong mode, jlong magic,
int frame_count, int start_index, int frame_count, int start_index,
objArrayHandle classes_array,
objArrayHandle frames_array, objArrayHandle frames_array,
TRAPS); TRAPS);
}; };

View file

@ -2958,9 +2958,6 @@ public:
develop(bool, TraceStackWalk, false, \ develop(bool, TraceStackWalk, false, \
"Trace stack walking") \ "Trace stack walking") \
\ \
product(bool, MemberNameInStackFrame, true, \
"Use MemberName in StackFrame") \
\
/* notice: the max range value here is max_jint, not max_intx */ \ /* notice: the max range value here is max_jint, not max_intx */ \
/* because of overflow issue */ \ /* because of overflow issue */ \
NOT_EMBEDDED(diagnostic(intx, GuaranteedSafepointInterval, 1000, \ NOT_EMBEDDED(diagnostic(intx, GuaranteedSafepointInterval, 1000, \

View file

@ -38,6 +38,7 @@
#include "interpreter/interpreter.hpp" #include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp" #include "interpreter/interpreterRuntime.hpp"
#include "logging/log.hpp" #include "logging/log.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "memory/universe.inline.hpp" #include "memory/universe.inline.hpp"
#include "oops/klass.hpp" #include "oops/klass.hpp"
@ -1788,7 +1789,7 @@ void SharedRuntime::check_member_name_argument_is_last_argument(const methodHand
IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address caller_pc)) IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address caller_pc))
Method* moop(method); Method* moop(method);
address entry_point = moop->from_compiled_entry(); address entry_point = moop->from_compiled_entry_no_trampoline();
// It's possible that deoptimization can occur at a call site which hasn't // It's possible that deoptimization can occur at a call site which hasn't
// been resolved yet, in which case this function will be called from // been resolved yet, in which case this function will be called from
@ -2351,12 +2352,15 @@ class AdapterHandlerTable : public BasicHashtable<mtCode> {
public: public:
AdapterHandlerTable() AdapterHandlerTable()
: BasicHashtable<mtCode>(293, sizeof(AdapterHandlerEntry)) { } : BasicHashtable<mtCode>(293, (DumpSharedSpaces ? sizeof(CDSAdapterHandlerEntry) : sizeof(AdapterHandlerEntry))) { }
// Create a new entry suitable for insertion in the table // Create a new entry suitable for insertion in the table
AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry, address c2i_unverified_entry) { AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint, address i2c_entry, address c2i_entry, address c2i_unverified_entry) {
AdapterHandlerEntry* entry = (AdapterHandlerEntry*)BasicHashtable<mtCode>::new_entry(fingerprint->compute_hash()); AdapterHandlerEntry* entry = (AdapterHandlerEntry*)BasicHashtable<mtCode>::new_entry(fingerprint->compute_hash());
entry->init(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry); entry->init(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry);
if (DumpSharedSpaces) {
((CDSAdapterHandlerEntry*)entry)->init();
}
return entry; return entry;
} }
@ -2519,6 +2523,28 @@ AdapterHandlerEntry* AdapterHandlerLibrary::new_entry(AdapterFingerPrint* finger
} }
AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(const methodHandle& method) { AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(const methodHandle& method) {
AdapterHandlerEntry* entry = get_adapter0(method);
if (method->is_shared()) {
MutexLocker mu(AdapterHandlerLibrary_lock);
if (method->adapter() == NULL) {
method->update_adapter_trampoline(entry);
}
address trampoline = method->from_compiled_entry();
if (*(int*)trampoline == 0) {
CodeBuffer buffer(trampoline, (int)SharedRuntime::trampoline_size());
MacroAssembler _masm(&buffer);
SharedRuntime::generate_trampoline(&_masm, entry->get_c2i_entry());
if (PrintInterpreter) {
Disassembler::decode(buffer.insts_begin(), buffer.insts_end());
}
}
}
return entry;
}
AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter0(const methodHandle& method) {
// Use customized signature handler. Need to lock around updates to // Use customized signature handler. Need to lock around updates to
// the AdapterHandlerTable (it is not safe for concurrent readers // the AdapterHandlerTable (it is not safe for concurrent readers
// and a single writer: this could be fixed if it becomes a // and a single writer: this could be fixed if it becomes a
@ -2535,7 +2561,9 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(const methodHandle& meth
// make sure data structure is initialized // make sure data structure is initialized
initialize(); initialize();
if (CodeCacheExtensions::skip_compiler_support()) { // during dump time, always generate adapters, even if the
// compiler has been turned off.
if (!DumpSharedSpaces && CodeCacheExtensions::skip_compiler_support()) {
// adapters are useless and should not be used, including the // adapters are useless and should not be used, including the
// abstract_method_handler. However, some callers check that // abstract_method_handler. However, some callers check that
// an adapter was installed. // an adapter was installed.
@ -3017,6 +3045,17 @@ void AdapterHandlerEntry::print_adapter_on(outputStream* st) const {
} }
#if INCLUDE_CDS
void CDSAdapterHandlerEntry::init() {
assert(DumpSharedSpaces, "used during dump time only");
_c2i_entry_trampoline = (address)MetaspaceShared::misc_data_space_alloc(SharedRuntime::trampoline_size());
_adapter_trampoline = (AdapterHandlerEntry**)MetaspaceShared::misc_data_space_alloc(sizeof(AdapterHandlerEntry*));
};
#endif // INCLUDE_CDS
#ifndef PRODUCT #ifndef PRODUCT
void AdapterHandlerLibrary::print_statistics() { void AdapterHandlerLibrary::print_statistics() {

View file

@ -398,6 +398,10 @@ class SharedRuntime: AllStatic {
static void convert_ints_to_longints(int i2l_argcnt, int& in_args_count, static void convert_ints_to_longints(int i2l_argcnt, int& in_args_count,
BasicType*& in_sig_bt, VMRegPair*& in_regs); BasicType*& in_sig_bt, VMRegPair*& in_regs);
static size_t trampoline_size();
static void generate_trampoline(MacroAssembler *masm, address destination);
// Generate I2C and C2I adapters. These adapters are simple argument marshalling // Generate I2C and C2I adapters. These adapters are simple argument marshalling
// blobs. Unlike adapters in the tiger and earlier releases the code in these // blobs. Unlike adapters in the tiger and earlier releases the code in these
// blobs does not create a new frame and are therefore virtually invisible // blobs does not create a new frame and are therefore virtually invisible
@ -680,6 +684,17 @@ class AdapterHandlerEntry : public BasicHashtableEntry<mtCode> {
void print_adapter_on(outputStream* st) const; void print_adapter_on(outputStream* st) const;
}; };
class CDSAdapterHandlerEntry: public AdapterHandlerEntry {
address _c2i_entry_trampoline; // allocated from shared spaces "MC" region
AdapterHandlerEntry** _adapter_trampoline; // allocated from shared spaces "MD" region
public:
address get_c2i_entry_trampoline() const { return _c2i_entry_trampoline; }
AdapterHandlerEntry** get_adapter_trampoline() const { return _adapter_trampoline; }
void init() NOT_CDS_RETURN;
};
class AdapterHandlerLibrary: public AllStatic { class AdapterHandlerLibrary: public AllStatic {
private: private:
static BufferBlob* _buffer; // the temporary code buffer in CodeCache static BufferBlob* _buffer; // the temporary code buffer in CodeCache
@ -687,6 +702,7 @@ class AdapterHandlerLibrary: public AllStatic {
static AdapterHandlerEntry* _abstract_method_handler; static AdapterHandlerEntry* _abstract_method_handler;
static BufferBlob* buffer_blob(); static BufferBlob* buffer_blob();
static void initialize(); static void initialize();
static AdapterHandlerEntry* get_adapter0(const methodHandle& method);
public: public:

View file

@ -400,7 +400,6 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
nonproduct_nonstatic_field(Method, _compiled_invocation_count, int) \ nonproduct_nonstatic_field(Method, _compiled_invocation_count, int) \
volatile_nonstatic_field(Method, _code, nmethod*) \ volatile_nonstatic_field(Method, _code, nmethod*) \
nonstatic_field(Method, _i2i_entry, address) \ nonstatic_field(Method, _i2i_entry, address) \
nonstatic_field(Method, _adapter, AdapterHandlerEntry*) \
volatile_nonstatic_field(Method, _from_compiled_entry, address) \ volatile_nonstatic_field(Method, _from_compiled_entry, address) \
volatile_nonstatic_field(Method, _from_interpreted_entry, address) \ volatile_nonstatic_field(Method, _from_interpreted_entry, address) \
volatile_nonstatic_field(ConstMethod, _fingerprint, uint64_t) \ volatile_nonstatic_field(ConstMethod, _fingerprint, uint64_t) \

View file

@ -27,13 +27,13 @@ import utils.*;
* @test * @test
* @summary Test checks the consistency of the output * @summary Test checks the consistency of the output
* displayed with jstat -gccapacity. * displayed with jstat -gccapacity.
* @ignore 8149778
* @library /test/lib/share/classes * @library /test/lib/share/classes
* @library ../share * @library ../share
* @requires vm.opt.ExplicitGCInvokesConcurrent != true * @requires vm.opt.ExplicitGCInvokesConcurrent != true
* @build common.* * @build common.*
* @build utils.* * @build utils.*
* @run main/othervm -XX:+UsePerfData GcCapacityTest * @ignore 8149778
* @run main/othervm -XX:+UsePerfData -Xmx128M GcCapacityTest
*/ */
public class GcCapacityTest { public class GcCapacityTest {

View file

@ -34,7 +34,7 @@
* @build common.* * @build common.*
* @build utils.* * @build utils.*
* *
* @run main/othervm -XX:+UsePerfData GcCauseTest01 * @run main/othervm -XX:+UsePerfData -Xmx128M GcCauseTest01
*/ */
import utils.*; import utils.*;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@
* @build common.* * @build common.*
* @build utils.* * @build utils.*
* *
* @run main/othervm -XX:+UsePerfData -Xms128M -XX:MaxMetaspaceSize=128M GcCauseTest02 * @run main/othervm -XX:+UsePerfData -Xmx128M -XX:MaxMetaspaceSize=128M GcCauseTest02
*/ */
import utils.*; import utils.*;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@
* @build common.* * @build common.*
* @build utils.* * @build utils.*
* *
* @run main/othervm -XX:+UsePerfData -Xms128M -XX:MaxMetaspaceSize=128M GcCauseTest03 * @run main/othervm -XX:+UsePerfData -Xmx128M -XX:MaxMetaspaceSize=128M GcCauseTest03
*/ */
import utils.*; import utils.*;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,7 @@ import utils.*;
* @library ../share * @library ../share
* @build common.* * @build common.*
* @build utils.* * @build utils.*
* @run main/othervm -XX:+UsePerfData GcNewTest * @run main/othervm -XX:+UsePerfData -Xmx128M GcNewTest
*/ */
public class GcNewTest { public class GcNewTest {

View file

@ -37,7 +37,7 @@
* @build common.* * @build common.*
* @build utils.* * @build utils.*
* *
* @run main/othervm -XX:+UsePerfData GcTest01 * @run main/othervm -XX:+UsePerfData -Xmx128M GcTest01
*/ */
import utils.*; import utils.*;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ import utils.*;
* @library ../share * @library ../share
* @build common.* * @build common.*
* @build utils.* * @build utils.*
* @run main/othervm -XX:+UsePerfData -Xms128M -XX:MaxMetaspaceSize=128M GcTest02 * @run main/othervm -XX:+UsePerfData -Xmx128M -XX:MaxMetaspaceSize=128M GcTest02
*/ */
public class GcTest02 { public class GcTest02 {
@ -58,10 +58,4 @@ public class GcTest02 {
// Assert that space has been utilized acordingly // Assert that space has been utilized acordingly
JstatResults.assertSpaceUtilization(measurement2, targetMemoryUsagePercent); JstatResults.assertSpaceUtilization(measurement2, targetMemoryUsagePercent);
} }
private static void assertThat(boolean result, String message) {
if (!result) {
throw new RuntimeException(message);
};
}
} }