Commit dd1d0044 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo
Browse files

perf jvmti: Separate jvmti cmlr check



The Compiled Method Load Record (cmlr) is JDK specific interface to
access JVM stack info. This makes the jvmti agent code not compile under
another jdk, which does not support that.

Separating jvmti cmlr check into special feature check, and adding
HAVE_JVMTI_CMLR macro to indicate that.

Mark cmlr code in jvmti/libjvmti.c with HAVE_JVMTI_CMLR, so we can
compile it on system without cmlr support.

This change makes the jvmti compile with java-1.8.0-ibm package. It's
without the line numbers support, but the rest works.

Adding NO_JVMTI_CMLR compile variable for testing.

Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ben Gainey <ben.gainey@arm.com>
Cc: Gustavo Luiz Duarte <gduarte@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20181121154341.21521-1-jolsa@kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent ecd94f1b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ FILES= \
         test-sdt.bin                           \
         test-cxx.bin                           \
         test-jvmti.bin				\
         test-jvmti-cmlr.bin			\
         test-sched_getcpu.bin			\
         test-setns.bin				\
         test-libopencsd.bin			\
@@ -267,6 +268,9 @@ $(OUTPUT)test-cxx.bin:
$(OUTPUT)test-jvmti.bin:
	$(BUILD)

$(OUTPUT)test-jvmti-cmlr.bin:
	$(BUILD)

$(OUTPUT)test-llvm.bin:
	$(BUILDXX) -std=gnu++11 				\
		-I$(shell $(LLVM_CONFIG) --includedir) 		\
+11 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
#include <jvmti.h>
#include <jvmticmlr.h>

int main(void)
{
	jvmtiCompiledMethodLoadInlineRecord	rec __attribute__((unused));
	jvmtiCompiledMethodLoadRecordHeader	hdr __attribute__((unused));
	PCStackInfo				p   __attribute__((unused));
	return 0;
}
+0 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
#include <jvmti.h>
#include <jvmticmlr.h>

int main(void)
{
+7 −0
Original line number Diff line number Diff line
@@ -855,6 +855,13 @@ ifndef NO_JVMTI
  $(call feature_check,jvmti)
  ifeq ($(feature-jvmti), 1)
    $(call detected_var,JDIR)
    ifndef NO_JVMTI_CMLR
      FEATURE_CHECK_CFLAGS-jvmti-cmlr := $(FEATURE_CHECK_CFLAGS-jvmti)
      $(call feature_check,jvmti-cmlr)
      ifeq ($(feature-jvmti-cmlr), 1)
        CFLAGS += -DHAVE_JVMTI_CMLR
      endif
    endif # NO_JVMTI_CMLR
  else
    $(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel)
    NO_JVMTI := 1
+3 −0
Original line number Diff line number Diff line
@@ -95,6 +95,9 @@ include ../scripts/utilities.mak
#
# Define NO_JVMTI if you do not want jvmti agent built
#
# Define NO_JVMTI_CMLR (debug only) if you do not want to process CMLR
# data for java source lines.
#
# Define LIBCLANGLLVM if you DO want builtin clang and llvm support.
# When selected, pass LLVM_CONFIG=/path/to/llvm-config to `make' if
# llvm-config is not in $PATH.
Loading