diff --git a/make/aix/makefiles/buildtree.make b/make/aix/makefiles/buildtree.make index 07747c0d1fa7f73020a2bce018a40b84bf7137b0..08cabd8d0f4d24acc18c87a44ef3853170b42049 100644 --- a/make/aix/makefiles/buildtree.make +++ b/make/aix/makefiles/buildtree.make @@ -1,6 +1,6 @@ # # Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. -# Copyright 2012, 2013 SAP AG. All rights reserved. +# Copyright (c) 2012, 2020 SAP SE. All rights reserved. # Copyright 2019 Red Hat, Inc. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -49,7 +49,7 @@ # flags.make - with macro settings # vm.make - to support making "$(MAKE) -v vm.make" in makefiles # adlc.make - -# trace.make - generate tracing event and type definitions +# jfr.make - generate jfr event and type definitions # jvmti.make - generate JVMTI bindings from the spec (JSR-163) # sa.make - generate SA jar file and natives # @@ -111,6 +111,10 @@ TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name opto -o -n endif endif +ifeq ($(ENABLE_JFR),false) +ALWAYS_EXCLUDE_DIRS += -o -name jfr +endif + # Get things from the platform file. COMPILER = $(shell sed -n 's/^compiler[ ]*=[ ]*//p' $(PLATFORM_FILE)) @@ -118,7 +122,7 @@ SIMPLE_DIRS = \ $(PLATFORM_DIR)/generated/dependencies \ $(PLATFORM_DIR)/generated/adfiles \ $(PLATFORM_DIR)/generated/jvmtifiles \ - $(PLATFORM_DIR)/generated/tracefiles + $(PLATFORM_DIR)/generated/jfrfiles TARGETS = debug fastdebug optimized product SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS)) @@ -126,7 +130,7 @@ SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS)) # For dependencies and recursive makes. BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make -BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make sa.make +BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make jfr.make sa.make BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \ SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT) @@ -195,6 +199,12 @@ DATA_MODE/ppc64 = 64 DATA_MODE = $(DATA_MODE/$(BUILDARCH)) +ifeq ($(ENABLE_JFR), true) + INCLUDE_JFR = 1 +else + INCLUDE_JFR = 0 +endif + flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst @echo Creating $@ ... $(QUIETLY) ( \ @@ -274,8 +284,7 @@ flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst echo && \ echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \ echo "SYSDEFS += \$$(HOTSPOT_EXTRA_SYSDEFS)"; \ - [ -n "$(INCLUDE_TRACE)" ] && \ - echo && echo "INCLUDE_TRACE = $(INCLUDE_TRACE)"; \ + echo && echo "CFLAGS += -DINCLUDE_JFR=$(INCLUDE_JFR)"; \ echo; \ [ -n "$(SPEC)" ] && \ echo "include $(SPEC)"; \ @@ -344,7 +353,7 @@ jvmti.make: $(BUILDTREE_MAKE) echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ ) > $@ -trace.make: $(BUILDTREE_MAKE) +jfr.make: $(BUILDTREE_MAKE) @echo Creating $@ ... $(QUIETLY) ( \ $(BUILDTREE_COMMENT); \ diff --git a/make/aix/makefiles/jfr.make b/make/aix/makefiles/jfr.make new file mode 100644 index 0000000000000000000000000000000000000000..a74f8772212c017c6c4a7e29d0d435b50e051d44 --- /dev/null +++ b/make/aix/makefiles/jfr.make @@ -0,0 +1,92 @@ +# +# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020 SAP SE. 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. +# +# + +# This makefile (jfr.make) is included from the jfr.make in the +# build directories. +# +# It knows how to build and run the tools to generate jfr. + +include $(GAMMADIR)/make/linux/makefiles/rules.make + +# ######################################################################### +# Build tools needed for the Jfr source code generation + +TOPDIR = $(shell echo `pwd`) +GENERATED = $(TOPDIR)/../generated + +JFR_TOOLS_SRCDIR := $(GAMMADIR)/src/share/vm/jfr +JFR_TOOLS_OUTPUTDIR := $(GENERATED)/tools/jfr + +JFR_OUTPUTDIR := $(GENERATED)/jfrfiles +JFR_SRCDIR := $(GAMMADIR)/src/share/vm/jfr/metadata + +METADATA_XML ?= $(JFR_SRCDIR)/metadata.xml +METADATA_XSD ?= $(JFR_SRCDIR)/metadata.xsd + +# Changing these will trigger a rebuild of generated jfr files. +JFR_DEPS += \ + $(METADATA_XML) \ + $(METADATA_XSD) \ + # + +JfrGeneratedNames = \ + jfrEventClasses.hpp \ + jfrEventControl.hpp \ + jfrEventIds.hpp \ + jfrPeriodic.hpp \ + jfrTypes.hpp + +JfrGenSource = $(JFR_TOOLS_SRCDIR)/GenerateJfrFiles.java +JfrGenClass = $(JFR_TOOLS_OUTPUTDIR)/build/tools/jfr/GenerateJfrFiles.class + +JfrGeneratedFiles = $(JfrGeneratedNames:%=$(JFR_OUTPUTDIR/%) + +.PHONY: all clean cleanall + +# ######################################################################### + +all: $(JfrGeneratedFiles) + +$(JfrGenClass): $(JfrGenSource) + mkdir -p $(@D) + $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JFR_TOOLS_OUTPUTDIR) $(JfrGenSource) + +$(JFR_OUTPUTDIR)/jfrEventClasses.hpp: $(METADATA_XML) $(METADATA_XSD) $(JfrGenClass) + $(QUIETLY) echo Generating $(@F) + mkdir -p $(@D) + $(QUIETLY) $(REMOTE) $(RUN.JAVA) -cp $(JFR_TOOLS_OUTPUTDIR) build.tools.jfr.GenerateJfrFiles $(METADATA_XML) $(METADATA_XSD) $(JFR_OUTPUTDIR) + test -f $@ + +$(filter-out $(JFR_OUTPUTDIR)/jfrEventClasses.hpp, $(JfrGeneratedFiles)): $(JFR_OUTPUTDIR)/jfrEventClasses.hpp + +TARGETS += $(JFR_OUTPUTDIR)/jfrEventClasses.hpp + +# ######################################################################### + +clean cleanall : + rm $(JfrGenClass) $(JfrGeneratedFiles) + +# ######################################################################### + diff --git a/make/aix/makefiles/top.make b/make/aix/makefiles/top.make index 95e6e6856e81a13eea2aef8a9398902cd3dd5803..b09a4e4561668205a80bb772fd9d739ccf2db7cc 100644 --- a/make/aix/makefiles/top.make +++ b/make/aix/makefiles/top.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2020, 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 @@ -80,7 +80,7 @@ default: vm_build_preliminaries the_vm @echo All done. # This is an explicit dependency for the sake of parallel makes. -vm_build_preliminaries: checks $(Cached_plat) $(AD_Files_If_Required) trace_stuff jvmti_stuff sa_stuff +vm_build_preliminaries: checks $(Cached_plat) $(AD_Files_If_Required) jfr_stuff jvmti_stuff sa_stuff @# We need a null action here, so implicit rules don't get consulted. $(Cached_plat): $(Plat_File) @@ -94,9 +94,9 @@ ad_stuff: $(Cached_plat) $(adjust-mflags) jvmti_stuff: $(Cached_plat) $(adjust-mflags) @$(MAKE) -f jvmti.make $(MFLAGS-adjusted) -# generate trace files -trace_stuff: jvmti_stuff $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f trace.make $(MFLAGS-adjusted) +# generate JFR files +jfr_stuff: $(Cached_plat) $(adjust-mflags) + @$(MAKE) -f jfr.make $(MFLAGS-adjusted) # generate SA jar files and native header sa_stuff: diff --git a/make/aix/makefiles/vm.make b/make/aix/makefiles/vm.make index d2902bd4a1289bcc20e1d0325a9c8ee08320eb97..2e565231f469e256495efb33efade2c13b74b549 100644 --- a/make/aix/makefiles/vm.make +++ b/make/aix/makefiles/vm.make @@ -1,6 +1,6 @@ # # Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. -# Copyright 2012, 2013 SAP AG. All rights reserved. +# Copyright (c) 2012, 2020 SAP SE. 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 @@ -53,7 +53,7 @@ endif # Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm # The adfiles directory contains ad_.[ch]pp. # The jvmtifiles directory contains jvmti*.[ch]pp -Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles $(GENERATED)/tracefiles +Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles $(GENERATED)/jfrfiles VPATH += $(Src_Dirs_V:%=%:) # set INCLUDES for C preprocessor. @@ -147,24 +147,22 @@ CFLAGS += -DALLOW_OPERATOR_NEW_USAGE LIBJVM_DEBUGINFO = lib$(JVM).debuginfo LIBJVM_DIZ = lib$(JVM).diz +ifeq ($(ENABLE_JFR),false) +EXCLUDE_JFR_PATHS:= -o -name jfr -prune +endif + SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt SOURCE_PATHS=\ $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \ - \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \)) + \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) $(EXCLUDE_JFR_PATHS) \)) SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(SRCARCH)/vm SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_family)_$(SRCARCH)/vm CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path)) -CORE_PATHS+=$(GENERATED)/jvmtifiles $(GENERATED)/tracefiles - -ifneq ($(INCLUDE_TRACE), false) -CORE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \ - find $(HS_ALT_SRC)/share/vm/jfr -type d; \ - fi) -endif +CORE_PATHS+=$(GENERATED)/jvmtifiles $(GENERATED)/jfrfiles COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1) COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1 diff --git a/src/os/aix/vm/os_perf_aix.cpp b/src/os/aix/vm/os_perf_aix.cpp index 6c296c5915a792093118e8547bb42cd100a52272..bfdc16c2e0e65743fedfd4ece6b0a27f699f752c 100644 --- a/src/os/aix/vm/os_perf_aix.cpp +++ b/src/os/aix/vm/os_perf_aix.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020 SAP SE. 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 @@ -28,8 +29,7 @@ #include "os_aix.inline.hpp" #include "runtime/os.hpp" #include "runtime/os_perf.hpp" - -#include CPU_HEADER(vm_version_ext) +#include "vm_version_ext_ppc.hpp" #include #include @@ -179,32 +179,6 @@ format: %d %s %c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %l */ -/** - * For platforms that have them, when declaring - * a printf-style function, - * formatSpec is the parameter number (starting at 1) - * that is the format argument ("%d pid %s") - * params is the parameter number where the actual args to - * the format starts. If the args are in a va_list, this - * should be 0. - */ -#ifndef PRINTF_ARGS -# define PRINTF_ARGS(formatSpec, params) ATTRIBUTE_PRINTF(formatSpec, params) -#endif - -#ifndef SCANF_ARGS -# define SCANF_ARGS(formatSpec, params) ATTRIBUTE_SCANF(formatSpec, params) -#endif - -#ifndef _PRINTFMT_ -# define _PRINTFMT_ -#endif - -#ifndef _SCANFMT_ -# define _SCANFMT_ -#endif - - struct CPUPerfTicks { uint64_t used; uint64_t usedKernel; @@ -234,7 +208,7 @@ static double get_cpu_load(int which_logical_cpu, CPUPerfCounters* counters, dou /** reads /proc//stat data, with some checks and some skips. * Ensure that 'fmt' does _NOT_ contain the first two "%d %s" */ -static int SCANF_ARGS(2, 0) vread_statdata(const char* procfile, _SCANFMT_ const char* fmt, va_list args) { +static int vread_statdata(const char* procfile, const char* fmt, va_list args) { FILE*f; int n; char buf[2048]; @@ -263,7 +237,7 @@ static int SCANF_ARGS(2, 0) vread_statdata(const char* procfile, _SCANFMT_ const return n; } -static int SCANF_ARGS(2, 3) read_statdata(const char* procfile, _SCANFMT_ const char* fmt, ...) { +static int read_statdata(const char* procfile, const char* fmt, ...) { int n; va_list args; @@ -472,7 +446,7 @@ static double get_cpu_load(int which_logical_cpu, CPUPerfCounters* counters, dou return user_load; } -static int SCANF_ARGS(1, 2) parse_stat(_SCANFMT_ const char* fmt, ...) { +static int parse_stat(const char* fmt, ...) { FILE *f; va_list args; @@ -609,7 +583,7 @@ bool CPUPerformanceInterface::CPUPerformance::initialize() { CPUPerformanceInterface::CPUPerformance::~CPUPerformance() { if (_counters.cpus != NULL) { - FREE_C_HEAP_ARRAY(char, _counters.cpus); + FREE_C_HEAP_ARRAY(char, _counters.cpus, mtInternal); } } @@ -886,7 +860,7 @@ int SystemProcessInterface::SystemProcesses::ProcessIterator::current(SystemProc cmdline = get_cmdline(); if (cmdline != NULL) { process_info->set_command_line(allocate_string(cmdline)); - FREE_C_HEAP_ARRAY(char, cmdline); + FREE_C_HEAP_ARRAY(char, cmdline, mtInternal); } return OS_OK; @@ -1011,12 +985,12 @@ CPUInformationInterface::~CPUInformationInterface() { if (_cpu_info != NULL) { if (_cpu_info->cpu_name() != NULL) { const char* cpu_name = _cpu_info->cpu_name(); - FREE_C_HEAP_ARRAY(char, cpu_name); + FREE_C_HEAP_ARRAY(char, cpu_name, mtInternal); _cpu_info->set_cpu_name(NULL); } if (_cpu_info->cpu_description() != NULL) { const char* cpu_desc = _cpu_info->cpu_description(); - FREE_C_HEAP_ARRAY(char, cpu_desc); + FREE_C_HEAP_ARRAY(char, cpu_desc, mtInternal); _cpu_info->set_cpu_description(NULL); } delete _cpu_info;