diff --git a/.classpath b/.classpath index 3a4499b6c0e577280ce69894d82da68ea8e60566..bb6aceea6281577bb2a5c8947edc243ca629ab74 100644 --- a/.classpath +++ b/.classpath @@ -15,6 +15,6 @@ - + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3517df8c6ed508289a58ad98a389470d52c5cade..190f8f3c47e4e7757c8b75e788c25bfed08d06f9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,15 +1,53 @@ -image: gitlab.ow2.org:4567/disl/disl/disl-ci +image: &image-java-8 gitlab.ow2.org:4567/disl/disl/disl-ci +image: &image-java-9 mbasso/disl-ci:openjdk-9 +image: &image-java-10 mbasso/disl-ci:openjdk-10 +image: &image-java-11 mbasso/disl-ci:openjdk-11 +image: &image-java-12 mbasso/disl-ci:openjdk-12 +image: &image-java-13 mbasso/disl-ci:openjdk-13 +image: &image-java-14 mbasso/disl-ci:openjdk-14 +image: &image-java-15 mbasso/disl-ci:openjdk-15 # Setup cache to prevent downloading deps and compiling sources in each stage cache: &cache - # Cache is branch-local - key: "${CI_COMMIT_REF_SLUG}" # Cache deps and compiled classes paths: - 'output/' - 'lib/' - 'src-disl-agent/linux-x86_64' # Specific architecture of used container +# Caches for different Java versions +cache: &cache-8 + <<: *cache + key: "${CI_COMMIT_REF_SLUG}-oraclejdk-8" + +cache: &cache-9 + <<: *cache + key: "${CI_COMMIT_REF_SLUG}-openjdk-9" + +cache: &cache-10 + <<: *cache + key: "${CI_COMMIT_REF_SLUG}-openjdk-10" + +cache: &cache-11 + <<: *cache + key: "${CI_COMMIT_REF_SLUG}-openjdk-11" + +cache: &cache-12 + <<: *cache + key: "${CI_COMMIT_REF_SLUG}-openjdk-12" + +cache: &cache-13 + <<: *cache + key: "${CI_COMMIT_REF_SLUG}-openjdk-13" + +cache: &cache-14 + <<: *cache + key: "${CI_COMMIT_REF_SLUG}-openjdk-14" + +cache: &cache-15 + <<: *cache + key: "${CI_COMMIT_REF_SLUG}-openjdk-15" + # Adjust modification date to prevent recompiling sources in different stages. before_script: - find . -exec touch -t 200001010000 {} \; @@ -22,20 +60,133 @@ stages: # The YAML Anchors are used because of Gitlab Issue#2838 # Check whether the build task succeeded -build: +.build: stage: build + script: + - ant build + +build-8: + image: *image-java-8 + extends: .build cache: - <<: *cache + <<: *cache-8 + policy: + push + +build-9: + image: *image-java-9 + extends: .build + cache: + <<: *cache-9 + policy: + push + +build-10: + image: *image-java-10 + extends: .build + cache: + <<: *cache-10 + policy: + push + +build-11: + image: *image-java-11 + extends: .build + cache: + <<: *cache-11 + policy: + push + +build-12: + image: *image-java-12 + extends: .build + cache: + <<: *cache-12 + policy: + push + +build-13: + image: *image-java-13 + extends: .build + cache: + <<: *cache-13 + policy: + push + +build-14: + image: *image-java-14 + extends: .build + cache: + <<: *cache-14 + policy: + push + +build-15: + image: *image-java-15 + extends: .build + cache: + <<: *cache-15 policy: push - script: - - ant build # Run tests -test: +.test: stage: test - cache: - <<: *cache - policy: pull script: - ant test + +test-8: + image: *image-java-8 + extends: .test + cache: + <<: *cache-8 + policy: pull + +test-9: + image: *image-java-9 + extends: .test + cache: + <<: *cache-9 + policy: pull + +test-10: + image: *image-java-10 + extends: .test + cache: + <<: *cache-10 + policy: pull + +test-11: + image: *image-java-11 + extends: .test + cache: + <<: *cache-11 + policy: pull + +test-12: + image: *image-java-12 + extends: .test + cache: + <<: *cache-12 + policy: pull + +test-13: + image: *image-java-13 + extends: .test + cache: + <<: *cache-13 + policy: pull + +test-14: + image: *image-java-14 + extends: .test + cache: + <<: *cache-14 + policy: pull + +test-15: + image: *image-java-15 + extends: .test + cache: + <<: *cache-15 + policy: pull diff --git a/USER_ERRORS b/USER_ERRORS index 2cee490162a0a2fdce336af1315fc5c50b32d6bf..555aa166deab2cd8fb504eed1eda4cb03d754924 100644 --- a/USER_ERRORS +++ b/USER_ERRORS @@ -9,8 +9,3 @@ Java process ends with SEGFAULT - HOW TO FIX: Fix the instrumentation or exclude the class causing the problem in the exclusion list (-Ddisl.exclusionList=exclusion.lst command line option of DiSL server). - -Build failure: java.lang.UnsupportedClassVersionError: ch/usi/dag/disl/utilinstr/tlvinserter/ExtendThread : Unsupported major.minor version 51.0 - - CAUSE: A version 1.7.x JRE is used; this version is not yet supported - - HOW TO FIX: Use a version 1.6.x JRE instead. - diff --git a/bin/disl.py b/bin/disl.py index 6e6947494a5c811ca310bb82cac52399513f01e6..5afbf0b5d68abda2adac2e1e81cdfa64f5426664 100755 --- a/bin/disl.py +++ b/bin/disl.py @@ -5,6 +5,7 @@ import itertools import os import platform import time +import re from subprocess import * @@ -494,6 +495,17 @@ def run_client(args, parser): else: c_cmd+= ["-Xbootclasspath/a:"+bypass+":"+args.instrumentation] + # provide options needed only for Java 9+ + java_version = check_output(["java", '-version'], stderr=STDOUT).decode('utf-8') + version_match = re.search('"(\d+)(?:\.(\d+))?', java_version, re.IGNORECASE) + if version_match: + version = version_match.group(1) + if version == "1": + version = version_match.group(2) + if int(version) >= 9: + c_cmd+= ["--patch-module", "java.base="+args.disl_home+"/lib/java.base:"+bypass] + c_cmd+= ["--add-exports", "java.base/ch.usi.dag.disl.dynamicbypass=ALL-UNNAMED"] + c_cmd+= args.c_app #print c_cmd diff --git a/build.properties b/build.properties index b4ee42fea91a5a420547862ad6090d851595386d..9d6a53504dd7941b429e632d31f8a925a6c03601 100644 --- a/build.properties +++ b/build.properties @@ -38,7 +38,7 @@ build.doc.intro=${build.dir}/intro build.disl.native=${build.dir}/native # Build system libraries -build.ivy.url = https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.rev}/ivy-${ivy.rev}.jar +build.ivy.url = https://repo.maven.apache.org/maven2/org/apache/ivy/ivy/${ivy.rev}/ivy-${ivy.rev}.jar build.ivy.path = ${lib.ant.dir}/ivy.jar build.ivy.file = dependencies.xml @@ -81,10 +81,3 @@ release.bin.zip=${release}/disl-${disl.version}-bin.zip release.bin.tar=${release}/disl-${disl.version}-bin.tar.bz2 release.src.zip=${release}/disl-${disl.version}-src.zip release.src.tar=${release}/disl-${disl.version}-src.tar.bz2 - -# Java versions for specific components -target.disl.bypass=1.6 -target.shvm.dispatch=1.6 - -# Default Java target -ant.build.javac.target=1.8 diff --git a/build.xml b/build.xml index edc241459a6098b09e9486a2bc0b152dbe732069..fa7fa7eb14c6c3bb6c03672fd986c5926c7bc66f 100644 --- a/build.xml +++ b/build.xml @@ -14,6 +14,9 @@ + + + @@ -416,8 +419,8 @@ - - + + @@ -651,7 +654,7 @@ - + @@ -863,6 +866,7 @@ + diff --git a/dependencies.properties b/dependencies.properties index bbff0284ff324a9aa05e2bf877635aae81a919ec..3d84f9494e8987f4932a4b52f6e0a921cab8f84a 100644 --- a/dependencies.properties +++ b/dependencies.properties @@ -6,7 +6,7 @@ ant-contrib.org=ant-contrib junit.rev=4.12 junit.org=junit -asm.rev=7.2 +asm.rev=9.0 asm.org=org.ow2.asm log4j.rev=1.2.17 @@ -14,4 +14,4 @@ log4j.org=log4j protobuf.rev=3.11.0 protobuf.org=com.google.protobuf -protobuf.lib=protobuf-javalite +protobuf.lib=protobuf-java diff --git a/docker/openjdk-10.Dockerfile b/docker/openjdk-10.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ff669a8f3bf3b7ed26f28c2b6c430584edfcb9f2 --- /dev/null +++ b/docker/openjdk-10.Dockerfile @@ -0,0 +1,29 @@ +FROM openjdk:10 + +ENV ANT_VERSION=1.10.7 +ENV ANT_HOME=/opt/ant + +WORKDIR /tmp + +# https://github.com/frekele/docker-ant/blob/master/Dockerfile +# MIT License +# Copyright (c) 2016-2018 @frekele + +# Download, extract apache ant to opt folder and add executables to path +RUN wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && \ + wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + echo "$(cat apache-ant-${ANT_VERSION}-bin.tar.gz.sha512) apache-ant-${ANT_VERSION}-bin.tar.gz" | sha512sum -c && \ + tar -zvxf apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt/ && \ + ln -s /opt/apache-ant-${ANT_VERSION} /opt/ant && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + update-alternatives --install "/usr/bin/ant" "ant" "/opt/ant/bin/ant" 1 && \ + update-alternatives --set "ant" "/opt/ant/bin/ant" + +WORKDIR /root + +# Install make and gcc (cc respectively) +RUN apt-get update && \ + DEBIAN_FRONTEND='noninteractive' apt-get install -yq make gcc && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* diff --git a/docker/openjdk-11.Dockerfile b/docker/openjdk-11.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ca29e107a91d08884ea8af592611844ce30a0e35 --- /dev/null +++ b/docker/openjdk-11.Dockerfile @@ -0,0 +1,29 @@ +FROM openjdk:11 + +ENV ANT_VERSION=1.10.7 +ENV ANT_HOME=/opt/ant + +WORKDIR /tmp + +# https://github.com/frekele/docker-ant/blob/master/Dockerfile +# MIT License +# Copyright (c) 2016-2018 @frekele + +# Download, extract apache ant to opt folder and add executables to path +RUN wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && \ + wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + echo "$(cat apache-ant-${ANT_VERSION}-bin.tar.gz.sha512) apache-ant-${ANT_VERSION}-bin.tar.gz" | sha512sum -c && \ + tar -zvxf apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt/ && \ + ln -s /opt/apache-ant-${ANT_VERSION} /opt/ant && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + update-alternatives --install "/usr/bin/ant" "ant" "/opt/ant/bin/ant" 1 && \ + update-alternatives --set "ant" "/opt/ant/bin/ant" + +WORKDIR /root + +# Install make and gcc (cc respectively) +RUN apt-get update && \ + DEBIAN_FRONTEND='noninteractive' apt-get install -yq make gcc && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* diff --git a/docker/openjdk-12.Dockerfile b/docker/openjdk-12.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b6b891989d5792d8de77f9c77a52a28509cac262 --- /dev/null +++ b/docker/openjdk-12.Dockerfile @@ -0,0 +1,31 @@ +FROM adoptopenjdk/openjdk12:x86_64-debian-jdk-12.0.2_10 + +ENV ANT_VERSION=1.10.7 +ENV ANT_HOME=/opt/ant + +WORKDIR /tmp + +RUN apt-get update && \ + apt-get install wget + +# https://github.com/frekele/docker-ant/blob/master/Dockerfile +# MIT License +# Copyright (c) 2016-2018 @frekele + +# Download, extract apache ant to opt folder and add executables to path +RUN wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && \ + wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + echo "$(cat apache-ant-${ANT_VERSION}-bin.tar.gz.sha512) apache-ant-${ANT_VERSION}-bin.tar.gz" | sha512sum -c && \ + tar -zvxf apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt/ && \ + ln -s /opt/apache-ant-${ANT_VERSION} /opt/ant && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + update-alternatives --install "/usr/bin/ant" "ant" "/opt/ant/bin/ant" 1 && \ + update-alternatives --set "ant" "/opt/ant/bin/ant" + +WORKDIR /root + +# Install make and gcc (cc respectively) +RUN DEBIAN_FRONTEND='noninteractive' apt-get install -yq make gcc && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* diff --git a/docker/openjdk-13.Dockerfile b/docker/openjdk-13.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a7f1ef62cedd27da8673d6417e393d262e4adaad --- /dev/null +++ b/docker/openjdk-13.Dockerfile @@ -0,0 +1,33 @@ +FROM adoptopenjdk/openjdk13:x86_64-debian-jdk-13.0.2_8 + +ENV ANT_VERSION=1.10.7 +ENV ANT_HOME=/opt/ant + +WORKDIR /tmp + +RUN chmod o+r /etc/resolv.conf + +RUN apt-get -yq update && \ + apt-get -yq install wget + +# https://github.com/frekele/docker-ant/blob/master/Dockerfile +# MIT License +# Copyright (c) 2016-2018 @frekele + +# Download, extract apache ant to opt folder and add executables to path +RUN wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && \ + wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + echo "$(cat apache-ant-${ANT_VERSION}-bin.tar.gz.sha512) apache-ant-${ANT_VERSION}-bin.tar.gz" | sha512sum -c && \ + tar -zvxf apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt/ && \ + ln -s /opt/apache-ant-${ANT_VERSION} /opt/ant && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + update-alternatives --install "/usr/bin/ant" "ant" "/opt/ant/bin/ant" 1 && \ + update-alternatives --set "ant" "/opt/ant/bin/ant" + +WORKDIR /root + +# Install make and gcc (cc respectively) +RUN DEBIAN_FRONTEND='noninteractive' apt-get install -yq make gcc && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* diff --git a/docker/openjdk-14.Dockerfile b/docker/openjdk-14.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4d613039ba7d839c548ac1d305285168f2938dbc --- /dev/null +++ b/docker/openjdk-14.Dockerfile @@ -0,0 +1,33 @@ +FROM adoptopenjdk/openjdk14:x86_64-debian-jdk-14.0.2_12 + +ENV ANT_VERSION=1.10.7 +ENV ANT_HOME=/opt/ant + +WORKDIR /tmp + +RUN chmod o+r /etc/resolv.conf + +RUN apt-get -yq update && \ + apt-get -yq install wget + +# https://github.com/frekele/docker-ant/blob/master/Dockerfile +# MIT License +# Copyright (c) 2016-2018 @frekele + +# Download, extract apache ant to opt folder and add executables to path +RUN wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && \ + wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + echo "$(cat apache-ant-${ANT_VERSION}-bin.tar.gz.sha512) apache-ant-${ANT_VERSION}-bin.tar.gz" | sha512sum -c && \ + tar -zvxf apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt/ && \ + ln -s /opt/apache-ant-${ANT_VERSION} /opt/ant && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + update-alternatives --install "/usr/bin/ant" "ant" "/opt/ant/bin/ant" 1 && \ + update-alternatives --set "ant" "/opt/ant/bin/ant" + +WORKDIR /root + +# Install make and gcc (cc respectively) +RUN DEBIAN_FRONTEND='noninteractive' apt-get install -yq make gcc && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* diff --git a/docker/openjdk-15.Dockerfile b/docker/openjdk-15.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9e3957eeae1319b721824c43262f1568aa6225b9 --- /dev/null +++ b/docker/openjdk-15.Dockerfile @@ -0,0 +1,33 @@ +FROM adoptopenjdk/openjdk15:x86_64-debian-jdk-15_36 + +ENV ANT_VERSION=1.10.7 +ENV ANT_HOME=/opt/ant + +WORKDIR /tmp + +RUN chmod o+r /etc/resolv.conf + +RUN apt-get -yq update && \ + apt-get -yq install wget + +# https://github.com/frekele/docker-ant/blob/master/Dockerfile +# MIT License +# Copyright (c) 2016-2018 @frekele + +# Download, extract apache ant to opt folder and add executables to path +RUN wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && \ + wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + echo "$(cat apache-ant-${ANT_VERSION}-bin.tar.gz.sha512) apache-ant-${ANT_VERSION}-bin.tar.gz" | sha512sum -c && \ + tar -zvxf apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt/ && \ + ln -s /opt/apache-ant-${ANT_VERSION} /opt/ant && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + update-alternatives --install "/usr/bin/ant" "ant" "/opt/ant/bin/ant" 1 && \ + update-alternatives --set "ant" "/opt/ant/bin/ant" + +WORKDIR /root + +# Install make and gcc (cc respectively) +RUN DEBIAN_FRONTEND='noninteractive' apt-get install -yq make gcc && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* diff --git a/docker/openjdk-9.Dockerfile b/docker/openjdk-9.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b776a158d998fc69cec6edc2d582e18814609a15 --- /dev/null +++ b/docker/openjdk-9.Dockerfile @@ -0,0 +1,29 @@ +FROM openjdk:9 + +ENV ANT_VERSION=1.10.7 +ENV ANT_HOME=/opt/ant + +WORKDIR /tmp + +# https://github.com/frekele/docker-ant/blob/master/Dockerfile +# MIT License +# Copyright (c) 2016-2018 @frekele + +# Download, extract apache ant to opt folder and add executables to path +RUN wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && \ + wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + echo "$(cat apache-ant-${ANT_VERSION}-bin.tar.gz.sha512) apache-ant-${ANT_VERSION}-bin.tar.gz" | sha512sum -c && \ + tar -zvxf apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt/ && \ + ln -s /opt/apache-ant-${ANT_VERSION} /opt/ant && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz && \ + rm -f apache-ant-${ANT_VERSION}-bin.tar.gz.sha512 && \ + update-alternatives --install "/usr/bin/ant" "ant" "/opt/ant/bin/ant" 1 && \ + update-alternatives --set "ant" "/opt/ant/bin/ant" + +WORKDIR /root + +# Install make and gcc (cc respectively) +RUN apt-get update && \ + DEBIAN_FRONTEND='noninteractive' apt-get install -yq make gcc && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* diff --git a/Dockerfile b/docker/oraclejdk-8.Dockerfile similarity index 100% rename from Dockerfile rename to docker/oraclejdk-8.Dockerfile diff --git a/examples/build-example.xml b/examples/build-example.xml index c0d82a350421df88fabfc84e152656bfe4cbc8ee..077a5226aa391aeb8b3a1f577b8f3878cc9ed980 100644 --- a/examples/build-example.xml +++ b/examples/build-example.xml @@ -50,6 +50,7 @@ + diff --git a/lib/artifacts.lst b/lib/artifacts.lst index 3b5770977441fb818fa550497c8ea70d8b1bbef1..e5c8918edd156a4b0b6018fe0e0c04a64e3aa50e 100644 --- a/lib/artifacts.lst +++ b/lib/artifacts.lst @@ -6,6 +6,6 @@ lib/disl/asm-tree.jar lib/disl/asm-util.jar lib/disl/asm.jar lib/disl/log4j.jar -lib/disl/protobuf-javalite.jar +lib/disl/protobuf-java.jar lib/test/hamcrest-core.jar lib/test/junit.jar diff --git a/src-disl-agent/dislagent.c b/src-disl-agent/dislagent.c index 27e8015231ce002f7be1af0f5d8ee2faf7da40d5..2ffc6d68cf4e1ce4ebf3f7d50bafe736314a04e0 100644 --- a/src-disl-agent/dislagent.c +++ b/src-disl-agent/dislagent.c @@ -126,6 +126,13 @@ static volatile bool jvm_is_started; static volatile bool jvm_is_initialized; +/** + * Flag indicating that the VM is using Java 9 or above, + * which allows calling JNI module system functions. + */ +static volatile bool java_is_9_or_above; + + /** * Runtime debuging output macros. */ @@ -518,6 +525,31 @@ jvmti_callback_class_file_load ( ); if (class_changed) { + // + // Enable module to read bypass check class. + // + if (java_is_9_or_above && jvm_is_initialized && strstr(class_name, "/") != NULL) { + char* class_wt_package = strrchr (class_name, '/'); + int package_name_length = strlen(class_name) - strlen(class_wt_package); + char package_name[package_name_length + 1]; + strncpy (package_name, class_name, package_name_length); + package_name[package_name_length] = '\0'; + + jvmtiError error; + jobject bypass_module = NULL; + error = (*jvmti)->GetNamedModule (jvmti, NULL, "ch/usi/dag/disl/dynamicbypass", &bypass_module); + check_jvmti_error (jvmti, error, "failed to get bypass module"); + + jobject class_module = NULL; + error = (*jvmti)->GetNamedModule (jvmti, loader, package_name, &class_module); + check_jvmti_error (jvmti, error, "failed to get logger module"); + + if (class_module != NULL) { + error = (*jvmti)->AddModuleExports (jvmti, bypass_module, "ch.usi.dag.disl.dynamicbypass", class_module); + check_jvmti_error (jvmti, error, "failed to export bypass package to module"); + } + } + unsigned char * jvm_class_bytes = jvmti_alloc_copy ( jvmti, class_def.class_bytes, class_def.class_byte_count ); @@ -746,7 +778,21 @@ Agent_OnLoad (JavaVM * jvm, char * options, void * reserved) { .can_generate_all_class_hook_events = 1, }; - jvmtiError error = (*jvmti)->AddCapabilities (jvmti, &caps); + // + // Add class events in primordial phase only if available + // i.e. in Java9+ + // + jvmtiError error; + jvmtiCapabilities potentialCapabilities; + error = (*jvmti)->GetPotentialCapabilities(jvmti, &potentialCapabilities); + check_jvmti_error(jvmti, error, + "Unable to get potential JVMTI capabilities."); + + if(potentialCapabilities.can_generate_early_class_hook_events) { + caps.can_generate_early_class_hook_events = 1; + } + + error = (*jvmti)->AddCapabilities (jvmti, &caps); check_jvmti_error (jvmti, error, "failed to add capabilities"); @@ -754,6 +800,16 @@ Agent_OnLoad (JavaVM * jvm, char * options, void * reserved) { __configure_from_options (options, &agent_config); __configure_from_properties (jvmti, &agent_config); + char * java_version; + error = (*jvmti)->GetSystemProperty (jvmti, "java.vm.specification.version", &java_version); + check_jvmti_error (jvmti, error, "failed to get java version"); + + // Java specification version contains a dot until version 9 + // eg. Java 8 = 1.8 + // Java 9 = 9 + java_is_9_or_above = strstr(java_version, ".") == NULL; + (* jvmti)->Deallocate (jvmti, (unsigned char *) java_version); + jvm_is_started = false; jvm_is_initialized = false; agent_code_flags = __calc_code_flags (&agent_config, true); diff --git a/src-disl/ch/usi/dag/disl/DiSL.java b/src-disl/ch/usi/dag/disl/DiSL.java index 7db0de810818545116f331459aab8b26103f5772..f6cb66799e4a8a917a892f3714ad9f724f4d2b88 100644 --- a/src-disl/ch/usi/dag/disl/DiSL.java +++ b/src-disl/ch/usi/dag/disl/DiSL.java @@ -430,7 +430,7 @@ public final class DiSL { if (!tlvs.isEmpty ()) { // instrument fields - final ClassNode cnWithFields = new ClassNode (Opcodes.ASM7); + final ClassNode cnWithFields = new ClassNode (Opcodes.ASM9); classNode.accept (new TLVInserter (cnWithFields, tlvs)); // replace original code with instrumented one diff --git a/src-disl/ch/usi/dag/disl/TLVInserter.java b/src-disl/ch/usi/dag/disl/TLVInserter.java index b37ebe7fadccd7f63915ab7ab92a6683373e6428..b0add069e47be9c667204a56d55edf2367104f10 100644 --- a/src-disl/ch/usi/dag/disl/TLVInserter.java +++ b/src-disl/ch/usi/dag/disl/TLVInserter.java @@ -30,7 +30,7 @@ final class TLVInserter extends ClassVisitor { // public TLVInserter (final ClassVisitor cv, final Set tlvs) { - super (Opcodes.ASM7, cv); + super (Opcodes.ASM9, cv); __threadLocals = tlvs; } @@ -97,7 +97,7 @@ final class TLVInserter extends ClassVisitor { final MethodVisitor mv, final int access, final String name, final String desc ) { - super (Opcodes.ASM7, mv, access, name, desc); + super (Opcodes.ASM9, mv, access, name, desc); assert JavaNames.isConstructorName (name); } diff --git a/src-disl/ch/usi/dag/disl/classparser/AnnotationMapper.java b/src-disl/ch/usi/dag/disl/classparser/AnnotationMapper.java index 2aedfa8a25e03d947eea0a748fa660750df215bc..2c27516609bca22d2ce3afb7a88a9d48d47fc0d8 100644 --- a/src-disl/ch/usi/dag/disl/classparser/AnnotationMapper.java +++ b/src-disl/ch/usi/dag/disl/classparser/AnnotationMapper.java @@ -110,7 +110,7 @@ final class AnnotationMapper { Predicate , BiConsumer > consumers = __findConsumers (ac); - an.accept (new AnnotationVisitor (Opcodes.ASM7) { + an.accept (new AnnotationVisitor (Opcodes.ASM9) { @Override public void visit (final String name, final Object value) { __getConsumer (consumers, name).accept (name, value); @@ -149,7 +149,7 @@ final class AnnotationMapper { final BiConsumer __consumer; ListCollector (final String name, final BiConsumer consumer) { - super (Opcodes.ASM7); + super (Opcodes.ASM9); __name = name; __consumer = consumer; diff --git a/src-disl/ch/usi/dag/disl/marker/AfterInitBodyMarker.java b/src-disl/ch/usi/dag/disl/marker/AfterInitBodyMarker.java index 0a4554153f9eb9641f989b9ab2fe8b3b412d877d..1ba41dfd09d855fd21336a82d9d765b29c681edd 100644 --- a/src-disl/ch/usi/dag/disl/marker/AfterInitBodyMarker.java +++ b/src-disl/ch/usi/dag/disl/marker/AfterInitBodyMarker.java @@ -76,7 +76,7 @@ public class AfterInitBodyMarker extends AbstractMarker { // final AtomicBoolean superInitialized = new AtomicBoolean (false); final AdviceAdapter adapter = new AdviceAdapter ( - Opcodes.ASM7, new MethodVisitor (Opcodes.ASM7) { /* empty */ }, + Opcodes.ASM9, new MethodVisitor (Opcodes.ASM9) { /* empty */ }, method.access, method.name, method.desc ) { @Override diff --git a/src-disl/ch/usi/dag/disl/util/AsmHelper.java b/src-disl/ch/usi/dag/disl/util/AsmHelper.java index 4a234530f661d8c7d0ef0088bc96d814fbaea50e..58c504f45f5431452385ea64d1cbe8be1b9435b5 100644 --- a/src-disl/ch/usi/dag/disl/util/AsmHelper.java +++ b/src-disl/ch/usi/dag/disl/util/AsmHelper.java @@ -470,7 +470,7 @@ public abstract class AsmHelper { */ public static MethodNode cloneMethod (final MethodNode method) { final MethodNode result = new MethodNode ( - Opcodes.ASM7, method.access, method.name, method.desc, + Opcodes.ASM9, method.access, method.name, method.desc, method.signature, method.exceptions.toArray ( new String [method.exceptions.size ()] ) diff --git a/src-disl/ch/usi/dag/disl/weaver/pe/ConstInterpreter.java b/src-disl/ch/usi/dag/disl/weaver/pe/ConstInterpreter.java index 28bbdd756ebe5e2674fcd5103d1afb4fdcd0bee2..e7e5d8a4a5b4884f8485d8a09d67f0db3fbfed80 100644 --- a/src-disl/ch/usi/dag/disl/weaver/pe/ConstInterpreter.java +++ b/src-disl/ch/usi/dag/disl/weaver/pe/ConstInterpreter.java @@ -17,7 +17,7 @@ import org.objectweb.asm.tree.analysis.Interpreter; public class ConstInterpreter extends Interpreter { protected ConstInterpreter() { - super(Opcodes.ASM7); + super(Opcodes.ASM9); } @Override diff --git a/src-disl/ch/usi/dag/dislserver/Protocol.java b/src-disl/ch/usi/dag/dislserver/Protocol.java index 04decac77b64172cf684aca56a32e3551cf835d0..02ef7c2288dd4e419c3d761125eaa65351e1d171 100644 --- a/src-disl/ch/usi/dag/dislserver/Protocol.java +++ b/src-disl/ch/usi/dag/dislserver/Protocol.java @@ -8,11 +8,17 @@ public final class Protocol { public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } /** * Protobuf enum {@code InstrumentClassResult} */ public enum InstrumentClassResult - implements com.google.protobuf.Internal.EnumLite { + implements com.google.protobuf.ProtocolMessageEnum { /** * CLASS_UNMODIFIED = 0; */ @@ -42,7 +48,6 @@ public final class Protocol { public static final int ERROR_VALUE = 3; - @java.lang.Override public final int getNumber() { if (this == UNRECOGNIZED) { throw new java.lang.IllegalArgumentException( @@ -52,8 +57,8 @@ public final class Protocol { } /** - * @param value The number of the enum to look for. - * @return The enum associated with the given number. + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated @@ -61,6 +66,10 @@ public final class Protocol { return forNumber(value); } + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ public static InstrumentClassResult forNumber(int value) { switch (value) { case 0: return CLASS_UNMODIFIED; @@ -77,25 +86,37 @@ public final class Protocol { private static final com.google.protobuf.Internal.EnumLiteMap< InstrumentClassResult> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { - @java.lang.Override public InstrumentClassResult findValueByNumber(int number) { return InstrumentClassResult.forNumber(number); } }; - public static com.google.protobuf.Internal.EnumVerifier - internalGetVerifier() { - return InstrumentClassResultVerifier.INSTANCE; + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return ch.usi.dag.dislserver.Protocol.getDescriptor().getEnumTypes().get(0); } - private static final class InstrumentClassResultVerifier implements - com.google.protobuf.Internal.EnumVerifier { - static final com.google.protobuf.Internal.EnumVerifier INSTANCE = new InstrumentClassResultVerifier(); - @java.lang.Override - public boolean isInRange(int number) { - return InstrumentClassResult.forNumber(number) != null; - } - }; + private static final InstrumentClassResult[] VALUES = values(); + + public static InstrumentClassResult valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } private final int value; @@ -108,7 +129,7 @@ public final class Protocol { public interface InstrumentClassRequestOrBuilder extends // @@protoc_insertion_point(interface_extends:InstrumentClassRequest) - com.google.protobuf.MessageLiteOrBuilder { + com.google.protobuf.MessageOrBuilder { /** * int32 flags = 1; @@ -138,90 +159,141 @@ public final class Protocol { * Protobuf type {@code InstrumentClassRequest} */ public static final class InstrumentClassRequest extends - com.google.protobuf.GeneratedMessageLite< - InstrumentClassRequest, InstrumentClassRequest.Builder> implements + com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:InstrumentClassRequest) InstrumentClassRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use InstrumentClassRequest.newBuilder() to construct. + private InstrumentClassRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } private InstrumentClassRequest() { className_ = ""; classBytes_ = com.google.protobuf.ByteString.EMPTY; } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new InstrumentClassRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private InstrumentClassRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + flags_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + className_ = s; + break; + } + case 26: { + + classBytes_ = input.readBytes(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return ch.usi.dag.dislserver.Protocol.internal_static_InstrumentClassRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return ch.usi.dag.dislserver.Protocol.internal_static_InstrumentClassRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + ch.usi.dag.dislserver.Protocol.InstrumentClassRequest.class, ch.usi.dag.dislserver.Protocol.InstrumentClassRequest.Builder.class); + } + public static final int FLAGS_FIELD_NUMBER = 1; private int flags_; /** * int32 flags = 1; * @return The flags. */ - @java.lang.Override public int getFlags() { return flags_; } - /** - * int32 flags = 1; - * @param value The flags to set. - */ - private void setFlags(int value) { - - flags_ = value; - } - /** - * int32 flags = 1; - */ - private void clearFlags() { - - flags_ = 0; - } public static final int CLASSNAME_FIELD_NUMBER = 2; - private java.lang.String className_; + private volatile java.lang.Object className_; /** * string className = 2; * @return The className. */ - @java.lang.Override public java.lang.String getClassName() { - return className_; + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } } /** * string className = 2; * @return The bytes for className. */ - @java.lang.Override public com.google.protobuf.ByteString getClassNameBytes() { - return com.google.protobuf.ByteString.copyFromUtf8(className_); - } - /** - * string className = 2; - * @param value The className to set. - */ - private void setClassName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - className_ = value; - } - /** - * string className = 2; - */ - private void clearClassName() { - - className_ = getDefaultInstance().getClassName(); - } - /** - * string className = 2; - * @param value The bytes for className to set. - */ - private void setClassNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - className_ = value.toStringUtf8(); + java.lang.Object ref = className_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } } public static final int CLASSBYTES_FIELD_NUMBER = 3; @@ -230,131 +302,353 @@ public final class Protocol { * bytes classBytes = 3; * @return The classBytes. */ - @java.lang.Override public com.google.protobuf.ByteString getClassBytes() { return classBytes_; } - /** - * bytes classBytes = 3; - * @param value The classBytes to set. - */ - private void setClassBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - - classBytes_ = value; + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; } - /** - * bytes classBytes = 3; - */ - private void clearClassBytes() { - - classBytes_ = getDefaultInstance().getClassBytes(); + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (flags_ != 0) { + output.writeInt32(1, flags_); + } + if (!getClassNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, className_); + } + if (!classBytes_.isEmpty()) { + output.writeBytes(3, classBytes_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (flags_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, flags_); + } + if (!getClassNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, className_); + } + if (!classBytes_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, classBytes_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof ch.usi.dag.dislserver.Protocol.InstrumentClassRequest)) { + return super.equals(obj); + } + ch.usi.dag.dislserver.Protocol.InstrumentClassRequest other = (ch.usi.dag.dislserver.Protocol.InstrumentClassRequest) obj; + + if (getFlags() + != other.getFlags()) return false; + if (!getClassName() + .equals(other.getClassName())) return false; + if (!getClassBytes() + .equals(other.getClassBytes())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + FLAGS_FIELD_NUMBER; + hash = (53 * hash) + getFlags(); + hash = (37 * hash) + CLASSNAME_FIELD_NUMBER; + hash = (53 * hash) + getClassName().hashCode(); + hash = (37 * hash) + CLASSBYTES_FIELD_NUMBER; + hash = (53 * hash) + getClassBytes().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data); + return PARSER.parseFrom(data); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data, extensionRegistry); + return PARSER.parseFrom(data, extensionRegistry); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data); + return PARSER.parseFrom(data); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data, extensionRegistry); + return PARSER.parseFrom(data, extensionRegistry); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data); + return PARSER.parseFrom(data); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data, extensionRegistry); + return PARSER.parseFrom(data, extensionRegistry); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, input); + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, input, extensionRegistry); + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return parseDelimitedFrom(DEFAULT_INSTANCE, input); + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, input); + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, input, extensionRegistry); + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { - return (Builder) DEFAULT_INSTANCE.createBuilder(); + return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(ch.usi.dag.dislserver.Protocol.InstrumentClassRequest prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); } + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } /** * Protobuf type {@code InstrumentClassRequest} */ public static final class Builder extends - com.google.protobuf.GeneratedMessageLite.Builder< - ch.usi.dag.dislserver.Protocol.InstrumentClassRequest, Builder> implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:InstrumentClassRequest) ch.usi.dag.dislserver.Protocol.InstrumentClassRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return ch.usi.dag.dislserver.Protocol.internal_static_InstrumentClassRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return ch.usi.dag.dislserver.Protocol.internal_static_InstrumentClassRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + ch.usi.dag.dislserver.Protocol.InstrumentClassRequest.class, ch.usi.dag.dislserver.Protocol.InstrumentClassRequest.Builder.class); + } + // Construct using ch.usi.dag.dislserver.Protocol.InstrumentClassRequest.newBuilder() private Builder() { - super(DEFAULT_INSTANCE); + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + flags_ = 0; + + className_ = ""; + + classBytes_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return ch.usi.dag.dislserver.Protocol.internal_static_InstrumentClassRequest_descriptor; } + @java.lang.Override + public ch.usi.dag.dislserver.Protocol.InstrumentClassRequest getDefaultInstanceForType() { + return ch.usi.dag.dislserver.Protocol.InstrumentClassRequest.getDefaultInstance(); + } + @java.lang.Override + public ch.usi.dag.dislserver.Protocol.InstrumentClassRequest build() { + ch.usi.dag.dislserver.Protocol.InstrumentClassRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public ch.usi.dag.dislserver.Protocol.InstrumentClassRequest buildPartial() { + ch.usi.dag.dislserver.Protocol.InstrumentClassRequest result = new ch.usi.dag.dislserver.Protocol.InstrumentClassRequest(this); + result.flags_ = flags_; + result.className_ = className_; + result.classBytes_ = classBytes_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof ch.usi.dag.dislserver.Protocol.InstrumentClassRequest) { + return mergeFrom((ch.usi.dag.dislserver.Protocol.InstrumentClassRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(ch.usi.dag.dislserver.Protocol.InstrumentClassRequest other) { + if (other == ch.usi.dag.dislserver.Protocol.InstrumentClassRequest.getDefaultInstance()) return this; + if (other.getFlags() != 0) { + setFlags(other.getFlags()); + } + if (!other.getClassName().isEmpty()) { + className_ = other.className_; + onChanged(); + } + if (other.getClassBytes() != com.google.protobuf.ByteString.EMPTY) { + setClassBytes(other.getClassBytes()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + ch.usi.dag.dislserver.Protocol.InstrumentClassRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (ch.usi.dag.dislserver.Protocol.InstrumentClassRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int flags_ ; /** * int32 flags = 1; * @return The flags. */ - @java.lang.Override public int getFlags() { - return instance.getFlags(); + return flags_; } /** * int32 flags = 1; @@ -362,8 +656,9 @@ public final class Protocol { * @return This builder for chaining. */ public Builder setFlags(int value) { - copyOnWrite(); - instance.setFlags(value); + + flags_ = value; + onChanged(); return this; } /** @@ -371,27 +666,45 @@ public final class Protocol { * @return This builder for chaining. */ public Builder clearFlags() { - copyOnWrite(); - instance.clearFlags(); + + flags_ = 0; + onChanged(); return this; } + private java.lang.Object className_ = ""; /** * string className = 2; * @return The className. */ - @java.lang.Override public java.lang.String getClassName() { - return instance.getClassName(); + java.lang.Object ref = className_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + className_ = s; + return s; + } else { + return (java.lang.String) ref; + } } /** * string className = 2; * @return The bytes for className. */ - @java.lang.Override public com.google.protobuf.ByteString getClassNameBytes() { - return instance.getClassNameBytes(); + java.lang.Object ref = className_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + className_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } } /** * string className = 2; @@ -400,8 +713,12 @@ public final class Protocol { */ public Builder setClassName( java.lang.String value) { - copyOnWrite(); - instance.setClassName(value); + if (value == null) { + throw new NullPointerException(); + } + + className_ = value; + onChanged(); return this; } /** @@ -409,8 +726,9 @@ public final class Protocol { * @return This builder for chaining. */ public Builder clearClassName() { - copyOnWrite(); - instance.clearClassName(); + + className_ = getDefaultInstance().getClassName(); + onChanged(); return this; } /** @@ -420,18 +738,23 @@ public final class Protocol { */ public Builder setClassNameBytes( com.google.protobuf.ByteString value) { - copyOnWrite(); - instance.setClassNameBytes(value); + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + className_ = value; + onChanged(); return this; } + private com.google.protobuf.ByteString classBytes_ = com.google.protobuf.ByteString.EMPTY; /** * bytes classBytes = 3; * @return The classBytes. */ - @java.lang.Override public com.google.protobuf.ByteString getClassBytes() { - return instance.getClassBytes(); + return classBytes_; } /** * bytes classBytes = 3; @@ -439,8 +762,12 @@ public final class Protocol { * @return This builder for chaining. */ public Builder setClassBytes(com.google.protobuf.ByteString value) { - copyOnWrite(); - instance.setClassBytes(value); + if (value == null) { + throw new NullPointerException(); + } + + classBytes_ = value; + onChanged(); return this; } /** @@ -448,91 +775,67 @@ public final class Protocol { * @return This builder for chaining. */ public Builder clearClassBytes() { - copyOnWrite(); - instance.clearClassBytes(); + + classBytes_ = getDefaultInstance().getClassBytes(); + onChanged(); return this; } - - // @@protoc_insertion_point(builder_scope:InstrumentClassRequest) - } - @java.lang.Override - @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) - protected final java.lang.Object dynamicMethod( - com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, - java.lang.Object arg0, java.lang.Object arg1) { - switch (method) { - case NEW_MUTABLE_INSTANCE: { - return new ch.usi.dag.dislserver.Protocol.InstrumentClassRequest(); - } - case NEW_BUILDER: { - return new Builder(); - } - case BUILD_MESSAGE_INFO: { - java.lang.Object[] objects = new java.lang.Object[] { - "flags_", - "className_", - "classBytes_", - }; - java.lang.String info = - "\u0000\u0003\u0000\u0000\u0001\u0003\u0003\u0000\u0000\u0000\u0001\u0004\u0002\u0208" + - "\u0003\n"; - return newMessageInfo(DEFAULT_INSTANCE, info, objects); - } - // fall through - case GET_DEFAULT_INSTANCE: { - return DEFAULT_INSTANCE; - } - case GET_PARSER: { - com.google.protobuf.Parser parser = PARSER; - if (parser == null) { - synchronized (ch.usi.dag.dislserver.Protocol.InstrumentClassRequest.class) { - parser = PARSER; - if (parser == null) { - parser = - new DefaultInstanceBasedParser( - DEFAULT_INSTANCE); - PARSER = parser; - } - } - } - return parser; - } - case GET_MEMOIZED_IS_INITIALIZED: { - return (byte) 1; - } - case SET_MEMOIZED_IS_INITIALIZED: { - return null; + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); } - throw new UnsupportedOperationException(); - } + // @@protoc_insertion_point(builder_scope:InstrumentClassRequest) + } + // @@protoc_insertion_point(class_scope:InstrumentClassRequest) private static final ch.usi.dag.dislserver.Protocol.InstrumentClassRequest DEFAULT_INSTANCE; static { - InstrumentClassRequest defaultInstance = new InstrumentClassRequest(); - // New instances are implicitly immutable so no need to make - // immutable. - DEFAULT_INSTANCE = defaultInstance; - com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( - InstrumentClassRequest.class, defaultInstance); + DEFAULT_INSTANCE = new ch.usi.dag.dislserver.Protocol.InstrumentClassRequest(); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassRequest getDefaultInstance() { return DEFAULT_INSTANCE; } - private static volatile com.google.protobuf.Parser PARSER; + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public InstrumentClassRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new InstrumentClassRequest(input, extensionRegistry); + } + }; public static com.google.protobuf.Parser parser() { - return DEFAULT_INSTANCE.getParserForType(); + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; } + + @java.lang.Override + public ch.usi.dag.dislserver.Protocol.InstrumentClassRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } public interface InstrumentClassResponseOrBuilder extends // @@protoc_insertion_point(interface_extends:InstrumentClassResponse) - com.google.protobuf.MessageLiteOrBuilder { + com.google.protobuf.MessageOrBuilder { /** * .InstrumentClassResult result = 1; @@ -567,21 +870,105 @@ public final class Protocol { * Protobuf type {@code InstrumentClassResponse} */ public static final class InstrumentClassResponse extends - com.google.protobuf.GeneratedMessageLite< - InstrumentClassResponse, InstrumentClassResponse.Builder> implements + com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:InstrumentClassResponse) InstrumentClassResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use InstrumentClassResponse.newBuilder() to construct. + private InstrumentClassResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } private InstrumentClassResponse() { + result_ = 0; errorMessage_ = ""; classBytes_ = com.google.protobuf.ByteString.EMPTY; } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new InstrumentClassResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private InstrumentClassResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + int rawValue = input.readEnum(); + + result_ = rawValue; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + errorMessage_ = s; + break; + } + case 26: { + + classBytes_ = input.readBytes(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return ch.usi.dag.dislserver.Protocol.internal_static_InstrumentClassResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return ch.usi.dag.dislserver.Protocol.internal_static_InstrumentClassResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + ch.usi.dag.dislserver.Protocol.InstrumentClassResponse.class, ch.usi.dag.dislserver.Protocol.InstrumentClassResponse.Builder.class); + } + public static final int RESULT_FIELD_NUMBER = 1; private int result_; /** * .InstrumentClassResult result = 1; * @return The enum numeric value on the wire for result. */ - @java.lang.Override public int getResultValue() { return result_; } @@ -589,87 +976,46 @@ public final class Protocol { * .InstrumentClassResult result = 1; * @return The result. */ - @java.lang.Override public ch.usi.dag.dislserver.Protocol.InstrumentClassResult getResult() { - ch.usi.dag.dislserver.Protocol.InstrumentClassResult result = ch.usi.dag.dislserver.Protocol.InstrumentClassResult.forNumber(result_); + @SuppressWarnings("deprecation") + ch.usi.dag.dislserver.Protocol.InstrumentClassResult result = ch.usi.dag.dislserver.Protocol.InstrumentClassResult.valueOf(result_); return result == null ? ch.usi.dag.dislserver.Protocol.InstrumentClassResult.UNRECOGNIZED : result; } - /** - * .InstrumentClassResult result = 1; - * @param value The enum numeric value on the wire for result to set. - */ - private void setResultValue(int value) { - result_ = value; - } - /** - * .InstrumentClassResult result = 1; - * @param value The result to set. - */ - private void setResult(ch.usi.dag.dislserver.Protocol.InstrumentClassResult value) { - if (value == null) { - throw new NullPointerException(); - } - - result_ = value.getNumber(); - } - /** - * .InstrumentClassResult result = 1; - */ - private void clearResult() { - - result_ = 0; - } public static final int ERRORMESSAGE_FIELD_NUMBER = 2; - private java.lang.String errorMessage_; + private volatile java.lang.Object errorMessage_; /** * string errorMessage = 2; * @return The errorMessage. */ - @java.lang.Override public java.lang.String getErrorMessage() { - return errorMessage_; + java.lang.Object ref = errorMessage_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + errorMessage_ = s; + return s; + } } /** * string errorMessage = 2; * @return The bytes for errorMessage. */ - @java.lang.Override public com.google.protobuf.ByteString getErrorMessageBytes() { - return com.google.protobuf.ByteString.copyFromUtf8(errorMessage_); - } - /** - * string errorMessage = 2; - * @param value The errorMessage to set. - */ - private void setErrorMessage( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - errorMessage_ = value; - } - /** - * string errorMessage = 2; - */ - private void clearErrorMessage() { - - errorMessage_ = getDefaultInstance().getErrorMessage(); - } - /** - * string errorMessage = 2; - * @param value The bytes for errorMessage to set. - */ - private void setErrorMessageBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - errorMessage_ = value.toStringUtf8(); + java.lang.Object ref = errorMessage_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + errorMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } } public static final int CLASSBYTES_FIELD_NUMBER = 3; @@ -678,158 +1024,384 @@ public final class Protocol { * bytes classBytes = 3; * @return The classBytes. */ - @java.lang.Override public com.google.protobuf.ByteString getClassBytes() { return classBytes_; } - /** - * bytes classBytes = 3; - * @param value The classBytes to set. - */ - private void setClassBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - - classBytes_ = value; + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; } - /** - * bytes classBytes = 3; - */ - private void clearClassBytes() { - - classBytes_ = getDefaultInstance().getClassBytes(); + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (result_ != ch.usi.dag.dislserver.Protocol.InstrumentClassResult.CLASS_UNMODIFIED.getNumber()) { + output.writeEnum(1, result_); + } + if (!getErrorMessageBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, errorMessage_); + } + if (!classBytes_.isEmpty()) { + output.writeBytes(3, classBytes_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (result_ != ch.usi.dag.dislserver.Protocol.InstrumentClassResult.CLASS_UNMODIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, result_); + } + if (!getErrorMessageBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, errorMessage_); + } + if (!classBytes_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, classBytes_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof ch.usi.dag.dislserver.Protocol.InstrumentClassResponse)) { + return super.equals(obj); + } + ch.usi.dag.dislserver.Protocol.InstrumentClassResponse other = (ch.usi.dag.dislserver.Protocol.InstrumentClassResponse) obj; + + if (result_ != other.result_) return false; + if (!getErrorMessage() + .equals(other.getErrorMessage())) return false; + if (!getClassBytes() + .equals(other.getClassBytes())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + RESULT_FIELD_NUMBER; + hash = (53 * hash) + result_; + hash = (37 * hash) + ERRORMESSAGE_FIELD_NUMBER; + hash = (53 * hash) + getErrorMessage().hashCode(); + hash = (37 * hash) + CLASSBYTES_FIELD_NUMBER; + hash = (53 * hash) + getClassBytes().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data); + return PARSER.parseFrom(data); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data, extensionRegistry); + return PARSER.parseFrom(data, extensionRegistry); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data); + return PARSER.parseFrom(data); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data, extensionRegistry); + return PARSER.parseFrom(data, extensionRegistry); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data); + return PARSER.parseFrom(data); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, data, extensionRegistry); + return PARSER.parseFrom(data, extensionRegistry); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, input); + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, input, extensionRegistry); + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return parseDelimitedFrom(DEFAULT_INSTANCE, input); + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, input); + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageLite.parseFrom( - DEFAULT_INSTANCE, input, extensionRegistry); + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { - return (Builder) DEFAULT_INSTANCE.createBuilder(); + return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(ch.usi.dag.dislserver.Protocol.InstrumentClassResponse prototype) { - return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); } + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } /** * Protobuf type {@code InstrumentClassResponse} */ public static final class Builder extends - com.google.protobuf.GeneratedMessageLite.Builder< - ch.usi.dag.dislserver.Protocol.InstrumentClassResponse, Builder> implements + com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:InstrumentClassResponse) ch.usi.dag.dislserver.Protocol.InstrumentClassResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return ch.usi.dag.dislserver.Protocol.internal_static_InstrumentClassResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return ch.usi.dag.dislserver.Protocol.internal_static_InstrumentClassResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + ch.usi.dag.dislserver.Protocol.InstrumentClassResponse.class, ch.usi.dag.dislserver.Protocol.InstrumentClassResponse.Builder.class); + } + // Construct using ch.usi.dag.dislserver.Protocol.InstrumentClassResponse.newBuilder() private Builder() { - super(DEFAULT_INSTANCE); + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + result_ = 0; + + errorMessage_ = ""; + + classBytes_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return ch.usi.dag.dislserver.Protocol.internal_static_InstrumentClassResponse_descriptor; + } + + @java.lang.Override + public ch.usi.dag.dislserver.Protocol.InstrumentClassResponse getDefaultInstanceForType() { + return ch.usi.dag.dislserver.Protocol.InstrumentClassResponse.getDefaultInstance(); + } + + @java.lang.Override + public ch.usi.dag.dislserver.Protocol.InstrumentClassResponse build() { + ch.usi.dag.dislserver.Protocol.InstrumentClassResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; } + @java.lang.Override + public ch.usi.dag.dislserver.Protocol.InstrumentClassResponse buildPartial() { + ch.usi.dag.dislserver.Protocol.InstrumentClassResponse result = new ch.usi.dag.dislserver.Protocol.InstrumentClassResponse(this); + result.result_ = result_; + result.errorMessage_ = errorMessage_; + result.classBytes_ = classBytes_; + onBuilt(); + return result; + } + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof ch.usi.dag.dislserver.Protocol.InstrumentClassResponse) { + return mergeFrom((ch.usi.dag.dislserver.Protocol.InstrumentClassResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(ch.usi.dag.dislserver.Protocol.InstrumentClassResponse other) { + if (other == ch.usi.dag.dislserver.Protocol.InstrumentClassResponse.getDefaultInstance()) return this; + if (other.result_ != 0) { + setResultValue(other.getResultValue()); + } + if (!other.getErrorMessage().isEmpty()) { + errorMessage_ = other.errorMessage_; + onChanged(); + } + if (other.getClassBytes() != com.google.protobuf.ByteString.EMPTY) { + setClassBytes(other.getClassBytes()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + ch.usi.dag.dislserver.Protocol.InstrumentClassResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (ch.usi.dag.dislserver.Protocol.InstrumentClassResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int result_ = 0; /** * .InstrumentClassResult result = 1; * @return The enum numeric value on the wire for result. */ - @java.lang.Override public int getResultValue() { - return instance.getResultValue(); + return result_; } /** * .InstrumentClassResult result = 1; - * @param value The result to set. + * @param value The enum numeric value on the wire for result to set. * @return This builder for chaining. */ public Builder setResultValue(int value) { - copyOnWrite(); - instance.setResultValue(value); + result_ = value; + onChanged(); return this; } /** * .InstrumentClassResult result = 1; * @return The result. */ - @java.lang.Override public ch.usi.dag.dislserver.Protocol.InstrumentClassResult getResult() { - return instance.getResult(); + @SuppressWarnings("deprecation") + ch.usi.dag.dislserver.Protocol.InstrumentClassResult result = ch.usi.dag.dislserver.Protocol.InstrumentClassResult.valueOf(result_); + return result == null ? ch.usi.dag.dislserver.Protocol.InstrumentClassResult.UNRECOGNIZED : result; } /** * .InstrumentClassResult result = 1; - * @param value The enum numeric value on the wire for result to set. + * @param value The result to set. * @return This builder for chaining. */ public Builder setResult(ch.usi.dag.dislserver.Protocol.InstrumentClassResult value) { - copyOnWrite(); - instance.setResult(value); + if (value == null) { + throw new NullPointerException(); + } + + result_ = value.getNumber(); + onChanged(); return this; } /** @@ -837,27 +1409,45 @@ public final class Protocol { * @return This builder for chaining. */ public Builder clearResult() { - copyOnWrite(); - instance.clearResult(); + + result_ = 0; + onChanged(); return this; } + private java.lang.Object errorMessage_ = ""; /** * string errorMessage = 2; * @return The errorMessage. */ - @java.lang.Override public java.lang.String getErrorMessage() { - return instance.getErrorMessage(); + java.lang.Object ref = errorMessage_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + errorMessage_ = s; + return s; + } else { + return (java.lang.String) ref; + } } /** * string errorMessage = 2; * @return The bytes for errorMessage. */ - @java.lang.Override public com.google.protobuf.ByteString getErrorMessageBytes() { - return instance.getErrorMessageBytes(); + java.lang.Object ref = errorMessage_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + errorMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } } /** * string errorMessage = 2; @@ -866,8 +1456,12 @@ public final class Protocol { */ public Builder setErrorMessage( java.lang.String value) { - copyOnWrite(); - instance.setErrorMessage(value); + if (value == null) { + throw new NullPointerException(); + } + + errorMessage_ = value; + onChanged(); return this; } /** @@ -875,8 +1469,9 @@ public final class Protocol { * @return This builder for chaining. */ public Builder clearErrorMessage() { - copyOnWrite(); - instance.clearErrorMessage(); + + errorMessage_ = getDefaultInstance().getErrorMessage(); + onChanged(); return this; } /** @@ -886,18 +1481,23 @@ public final class Protocol { */ public Builder setErrorMessageBytes( com.google.protobuf.ByteString value) { - copyOnWrite(); - instance.setErrorMessageBytes(value); + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + errorMessage_ = value; + onChanged(); return this; } + private com.google.protobuf.ByteString classBytes_ = com.google.protobuf.ByteString.EMPTY; /** * bytes classBytes = 3; * @return The classBytes. */ - @java.lang.Override public com.google.protobuf.ByteString getClassBytes() { - return instance.getClassBytes(); + return classBytes_; } /** * bytes classBytes = 3; @@ -905,8 +1505,12 @@ public final class Protocol { * @return This builder for chaining. */ public Builder setClassBytes(com.google.protobuf.ByteString value) { - copyOnWrite(); - instance.setClassBytes(value); + if (value == null) { + throw new NullPointerException(); + } + + classBytes_ = value; + onChanged(); return this; } /** @@ -914,90 +1518,109 @@ public final class Protocol { * @return This builder for chaining. */ public Builder clearClassBytes() { - copyOnWrite(); - instance.clearClassBytes(); + + classBytes_ = getDefaultInstance().getClassBytes(); + onChanged(); return this; } - - // @@protoc_insertion_point(builder_scope:InstrumentClassResponse) - } - @java.lang.Override - @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) - protected final java.lang.Object dynamicMethod( - com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, - java.lang.Object arg0, java.lang.Object arg1) { - switch (method) { - case NEW_MUTABLE_INSTANCE: { - return new ch.usi.dag.dislserver.Protocol.InstrumentClassResponse(); - } - case NEW_BUILDER: { - return new Builder(); - } - case BUILD_MESSAGE_INFO: { - java.lang.Object[] objects = new java.lang.Object[] { - "result_", - "errorMessage_", - "classBytes_", - }; - java.lang.String info = - "\u0000\u0003\u0000\u0000\u0001\u0003\u0003\u0000\u0000\u0000\u0001\f\u0002\u0208" + - "\u0003\n"; - return newMessageInfo(DEFAULT_INSTANCE, info, objects); - } - // fall through - case GET_DEFAULT_INSTANCE: { - return DEFAULT_INSTANCE; - } - case GET_PARSER: { - com.google.protobuf.Parser parser = PARSER; - if (parser == null) { - synchronized (ch.usi.dag.dislserver.Protocol.InstrumentClassResponse.class) { - parser = PARSER; - if (parser == null) { - parser = - new DefaultInstanceBasedParser( - DEFAULT_INSTANCE); - PARSER = parser; - } - } - } - return parser; - } - case GET_MEMOIZED_IS_INITIALIZED: { - return (byte) 1; - } - case SET_MEMOIZED_IS_INITIALIZED: { - return null; + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); } - throw new UnsupportedOperationException(); - } + // @@protoc_insertion_point(builder_scope:InstrumentClassResponse) + } + // @@protoc_insertion_point(class_scope:InstrumentClassResponse) private static final ch.usi.dag.dislserver.Protocol.InstrumentClassResponse DEFAULT_INSTANCE; static { - InstrumentClassResponse defaultInstance = new InstrumentClassResponse(); - // New instances are implicitly immutable so no need to make - // immutable. - DEFAULT_INSTANCE = defaultInstance; - com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( - InstrumentClassResponse.class, defaultInstance); + DEFAULT_INSTANCE = new ch.usi.dag.dislserver.Protocol.InstrumentClassResponse(); } public static ch.usi.dag.dislserver.Protocol.InstrumentClassResponse getDefaultInstance() { return DEFAULT_INSTANCE; } - private static volatile com.google.protobuf.Parser PARSER; + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public InstrumentClassResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new InstrumentClassResponse(input, extensionRegistry); + } + }; public static com.google.protobuf.Parser parser() { - return DEFAULT_INSTANCE.getParserForType(); + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; } + + @java.lang.Override + public ch.usi.dag.dislserver.Protocol.InstrumentClassResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_InstrumentClassRequest_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_InstrumentClassRequest_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_InstrumentClassResponse_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_InstrumentClassResponse_fieldAccessorTable; + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; static { + java.lang.String[] descriptorData = { + "\n\020dislserver.proto\"N\n\026InstrumentClassReq" + + "uest\022\r\n\005flags\030\001 \001(\005\022\021\n\tclassName\030\002 \001(\t\022\022" + + "\n\nclassBytes\030\003 \001(\014\"k\n\027InstrumentClassRes" + + "ponse\022&\n\006result\030\001 \001(\0162\026.InstrumentClassR" + + "esult\022\024\n\014errorMessage\030\002 \001(\t\022\022\n\nclassByte" + + "s\030\003 \001(\014*L\n\025InstrumentClassResult\022\024\n\020CLAS" + + "S_UNMODIFIED\020\000\022\022\n\016CLASS_MODIFIED\020\001\022\t\n\005ER" + + "ROR\020\003B#\n\025ch.usi.dag.dislserverB\010Protocol" + + "H\003b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_InstrumentClassRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_InstrumentClassRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_InstrumentClassRequest_descriptor, + new java.lang.String[] { "Flags", "ClassName", "ClassBytes", }); + internal_static_InstrumentClassResponse_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_InstrumentClassResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_InstrumentClassResponse_descriptor, + new java.lang.String[] { "Result", "ErrorMessage", "ClassBytes", }); } // @@protoc_insertion_point(outer_class_scope) diff --git a/src-jdk-include/jni.h b/src-jdk-include/jni.h index 2e83cb7e06e5942225418395a044852eb5449588..e29bf04b4ccc138c23321e9f22d7231ad688170f 100644 --- a/src-jdk-include/jni.h +++ b/src-jdk-include/jni.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -765,6 +765,11 @@ struct JNINativeInterface_ { jobjectRefType (JNICALL *GetObjectRefType) (JNIEnv* env, jobject obj); + + /* Module Features */ + + jobject (JNICALL *GetModule) + (JNIEnv* env, jclass clazz); }; /* @@ -1857,6 +1862,12 @@ struct JNIEnv_ { return functions->GetObjectRefType(this, obj); } + /* Module Features */ + + jobject GetModule(jclass clazz) { + return functions->GetModule(this, clazz); + } + #endif /* __cplusplus */ }; @@ -1952,6 +1963,7 @@ JNI_OnUnload(JavaVM *vm, void *reserved); #define JNI_VERSION_1_4 0x00010004 #define JNI_VERSION_1_6 0x00010006 #define JNI_VERSION_1_8 0x00010008 +#define JNI_VERSION_9 0x00090000 #ifdef __cplusplus } /* extern "C" */ diff --git a/src-jdk-include/jvmti.h b/src-jdk-include/jvmti.h index ee708cb193ba135a28adc3a1048ffe1e3544b5e1..eb0ec927617fc9257ccd6a909852c3dc8e1f7c71 100644 --- a/src-jdk-include/jvmti.h +++ b/src-jdk-include/jvmti.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,8 +23,7 @@ * questions. */ - /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */ - + /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */ /* Include file for the Java(tm) Virtual Machine Tool Interface */ @@ -42,8 +41,9 @@ enum { JVMTI_VERSION_1_0 = 0x30010000, JVMTI_VERSION_1_1 = 0x30010100, JVMTI_VERSION_1_2 = 0x30010200, + JVMTI_VERSION_9 = 0x30090000, - JVMTI_VERSION = 0x30000000 + (1 * 0x10000) + (2 * 0x100) + 1 /* version: 1.2.1 */ + JVMTI_VERSION = 0x30000000 + (9 * 0x10000) + (0 * 0x100) + 0 /* version: 9.0.0 */ }; JNIEXPORT jint JNICALL @@ -348,6 +348,7 @@ typedef enum { JVMTI_ERROR_INVALID_METHODID = 23, JVMTI_ERROR_INVALID_LOCATION = 24, JVMTI_ERROR_INVALID_FIELDID = 25, + JVMTI_ERROR_INVALID_MODULE = 26, JVMTI_ERROR_NO_MORE_FRAMES = 31, JVMTI_ERROR_OPAQUE_FRAME = 32, JVMTI_ERROR_TYPE_MISMATCH = 34, @@ -370,6 +371,7 @@ typedef enum { JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED = 70, JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED = 71, JVMTI_ERROR_UNMODIFIABLE_CLASS = 79, + JVMTI_ERROR_UNMODIFIABLE_MODULE = 80, JVMTI_ERROR_NOT_AVAILABLE = 98, JVMTI_ERROR_MUST_POSSESS_CAPABILITY = 99, JVMTI_ERROR_NULL_POINTER = 100, @@ -703,7 +705,9 @@ typedef struct { unsigned int can_retransform_any_class : 1; unsigned int can_generate_resource_exhaustion_heap_events : 1; unsigned int can_generate_resource_exhaustion_threads_events : 1; - unsigned int : 7; + unsigned int can_generate_early_vmstart : 1; + unsigned int can_generate_early_class_hook_events : 1; + unsigned int : 5; unsigned int : 16; unsigned int : 16; unsigned int : 16; @@ -1011,8 +1015,10 @@ typedef struct jvmtiInterface_1_ { jthread event_thread, ...); - /* 3 : RESERVED */ - void *reserved3; + /* 3 : Get All Modules */ + jvmtiError (JNICALL *GetAllModules) (jvmtiEnv* env, + jint* module_count_ptr, + jobject** modules_ptr); /* 4 : Get All Threads */ jvmtiError (JNICALL *GetAllThreads) (jvmtiEnv* env, @@ -1213,8 +1219,11 @@ typedef struct jvmtiInterface_1_ { jmethodID method, jlocation location); - /* 40 : RESERVED */ - void *reserved40; + /* 40 : Get Named Module */ + jvmtiError (JNICALL *GetNamedModule) (jvmtiEnv* env, + jobject class_loader, + const char* package_name, + jobject* module_ptr); /* 41 : Set Field Access Watch */ jvmtiError (JNICALL *SetFieldAccessWatch) (jvmtiEnv* env, @@ -1492,23 +1501,38 @@ typedef struct jvmtiInterface_1_ { const jthread* request_list, jvmtiError* results); - /* 94 : RESERVED */ - void *reserved94; - - /* 95 : RESERVED */ - void *reserved95; - - /* 96 : RESERVED */ - void *reserved96; - - /* 97 : RESERVED */ - void *reserved97; - - /* 98 : RESERVED */ - void *reserved98; - - /* 99 : RESERVED */ - void *reserved99; + /* 94 : Add Module Reads */ + jvmtiError (JNICALL *AddModuleReads) (jvmtiEnv* env, + jobject module, + jobject to_module); + + /* 95 : Add Module Exports */ + jvmtiError (JNICALL *AddModuleExports) (jvmtiEnv* env, + jobject module, + const char* pkg_name, + jobject to_module); + + /* 96 : Add Module Opens */ + jvmtiError (JNICALL *AddModuleOpens) (jvmtiEnv* env, + jobject module, + const char* pkg_name, + jobject to_module); + + /* 97 : Add Module Uses */ + jvmtiError (JNICALL *AddModuleUses) (jvmtiEnv* env, + jobject module, + jclass service); + + /* 98 : Add Module Provides */ + jvmtiError (JNICALL *AddModuleProvides) (jvmtiEnv* env, + jobject module, + jclass service, + jclass impl_class); + + /* 99 : Is Modifiable Module */ + jvmtiError (JNICALL *IsModifiableModule) (jvmtiEnv* env, + jobject module, + jboolean* is_modifiable_module_ptr); /* 100 : Get All Stack Traces */ jvmtiError (JNICALL *GetAllStackTraces) (jvmtiEnv* env, @@ -1675,7 +1699,7 @@ typedef struct jvmtiInterface_1_ { /* 132 : Set System Property */ jvmtiError (JNICALL *SetSystemProperty) (jvmtiEnv* env, const char* property, - const char* value); + const char* value_ptr); /* 133 : Get Phase */ jvmtiError (JNICALL *GetPhase) (jvmtiEnv* env, @@ -2137,6 +2161,50 @@ struct _jvmtiEnv { return functions->ClearFieldModificationWatch(this, klass, field); } + jvmtiError GetAllModules(jint* module_count_ptr, + jobject** modules_ptr) { + return functions->GetAllModules(this, module_count_ptr, modules_ptr); + } + + jvmtiError GetNamedModule(jobject class_loader, + const char* package_name, + jobject* module_ptr) { + return functions->GetNamedModule(this, class_loader, package_name, module_ptr); + } + + jvmtiError AddModuleReads(jobject module, + jobject to_module) { + return functions->AddModuleReads(this, module, to_module); + } + + jvmtiError AddModuleExports(jobject module, + const char* pkg_name, + jobject to_module) { + return functions->AddModuleExports(this, module, pkg_name, to_module); + } + + jvmtiError AddModuleOpens(jobject module, + const char* pkg_name, + jobject to_module) { + return functions->AddModuleOpens(this, module, pkg_name, to_module); + } + + jvmtiError AddModuleUses(jobject module, + jclass service) { + return functions->AddModuleUses(this, module, service); + } + + jvmtiError AddModuleProvides(jobject module, + jclass service, + jclass impl_class) { + return functions->AddModuleProvides(this, module, service, impl_class); + } + + jvmtiError IsModifiableModule(jobject module, + jboolean* is_modifiable_module_ptr) { + return functions->IsModifiableModule(this, module, is_modifiable_module_ptr); + } + jvmtiError GetLoadedClasses(jint* class_count_ptr, jclass** classes_ptr) { return functions->GetLoadedClasses(this, class_count_ptr, classes_ptr); @@ -2484,8 +2552,8 @@ struct _jvmtiEnv { } jvmtiError SetSystemProperty(const char* property, - const char* value) { - return functions->SetSystemProperty(this, property, value); + const char* value_ptr) { + return functions->SetSystemProperty(this, property, value_ptr); } jvmtiError GetPhase(jvmtiPhase* phase_ptr) { @@ -2531,4 +2599,3 @@ struct _jvmtiEnv { #endif /* __cplusplus */ #endif /* !_JAVA_JVMTI_H_ */ - diff --git a/src-shvm-agent/dislreagent.c b/src-shvm-agent/dislreagent.c index a370d905740d0aade95aa99af061451e04189c6e..e7776f8c870a5e0889f4399691abc350c1a680b8 100644 --- a/src-shvm-agent/dislreagent.c +++ b/src-shvm-agent/dislreagent.c @@ -1806,7 +1806,20 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { cap.can_tag_objects = TRUE; cap.can_generate_object_free_events = TRUE; + // + // Add class events in primordial phase only if available + // i.e. in Java9+ + // jvmtiError error; + jvmtiCapabilities potentialCapabilities; + error = (*jvmti_env)->GetPotentialCapabilities(jvmti_env, &potentialCapabilities); + check_jvmti_error(jvmti_env, error, + "Unable to get potential JVMTI capabilities."); + + if(potentialCapabilities.can_generate_early_class_hook_events) { + cap.can_generate_early_class_hook_events = TRUE; + } + error = (*jvmti_env)->AddCapabilities(jvmti_env, &cap); check_jvmti_error(jvmti_env, error, "Unable to get necessary JVMTI capabilities."); diff --git a/src-shvm/ch/usi/dag/dislreserver/shadow/LambdaShadowClass.java b/src-shvm/ch/usi/dag/dislreserver/shadow/LambdaShadowClass.java index b2df7124d96742b9f4d547f3bd76913ef6cf2563..201941fe0ce6801ea2f23ac8b48111c289be9ee5 100644 --- a/src-shvm/ch/usi/dag/dislreserver/shadow/LambdaShadowClass.java +++ b/src-shvm/ch/usi/dag/dislreserver/shadow/LambdaShadowClass.java @@ -5,6 +5,8 @@ import java.util.stream.Stream; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; +import ch.usi.dag.dislreserver.util.Env; + final class LambdaShadowClass extends ShadowClass { @@ -37,6 +39,13 @@ final class LambdaShadowClass extends ShadowClass { @Override public String getCanonicalName () { + // + // From Java 15, lambdas are treated as Hidden Classes + // + if (Env.getJavaVersion() > 14) { + return null; + } + return __canonicalName (); } diff --git a/src-shvm/ch/usi/dag/dislreserver/util/Env.java b/src-shvm/ch/usi/dag/dislreserver/util/Env.java new file mode 100644 index 0000000000000000000000000000000000000000..1c1edd6c9299c3cfa4e3e3a44b29ec46d68ca949 --- /dev/null +++ b/src-shvm/ch/usi/dag/dislreserver/util/Env.java @@ -0,0 +1,29 @@ +package ch.usi.dag.dislreserver.util; + + +public final class Env { + + /** + * Java version of the running JVM. + */ + private static final int javaVersion; + + static { + String version = System.getProperty("java.version"); + if(version.startsWith("1.")) { + version = version.substring(2, 3); + } else { + final int dot = version.indexOf("."); + if(dot != -1) { + version = version.substring(0, dot); + } + } + + javaVersion = Integer.parseInt(version); + } + + public static int getJavaVersion() { + return javaVersion; + } + +} diff --git a/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/app/TargetClass.java b/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/app/TargetClass.java new file mode 100644 index 0000000000000000000000000000000000000000..4d2fce6b3924cda73553d12fd80533b6eb31c5ad --- /dev/null +++ b/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/app/TargetClass.java @@ -0,0 +1,15 @@ +package ch.usi.dag.disl.test.suite.bypassmodulevisibility.app; + +import java.util.logging.Logger; + +public class TargetClass { + + public static void main(String[] args) { + // + // try to instrument a class in another module + // BypassCheck should be visible to it + // + final Logger LOGGER = Logger.getGlobal(); + } + +} diff --git a/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/instr/DiSLClass.java b/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/instr/DiSLClass.java new file mode 100644 index 0000000000000000000000000000000000000000..b21d1fc292bd9a890761c87176026cf5c4e9e6ac --- /dev/null +++ b/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/instr/DiSLClass.java @@ -0,0 +1,19 @@ +package ch.usi.dag.disl.test.suite.bypassmodulevisibility.instr; + +import ch.usi.dag.disl.annotation.Before; +import ch.usi.dag.disl.annotation.After; +import ch.usi.dag.disl.marker.BodyMarker; + +public class DiSLClass { + + @Before(marker = BodyMarker.class, order = 1, scope = "java.util.logging.Logger.getGlobal(..)") + public static void beforeEvent() { + Profiler.before(); + } + + @After(marker = BodyMarker.class, order = 1, scope = "java.util.logging.Logger.getGlobal(..)") + public static void afterEvent() { + Profiler.after(); + } + +} diff --git a/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/instr/Profiler.java b/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/instr/Profiler.java new file mode 100644 index 0000000000000000000000000000000000000000..e689c0417801de4cc091743c1208cafedf3bbf84 --- /dev/null +++ b/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/instr/Profiler.java @@ -0,0 +1,13 @@ +package ch.usi.dag.disl.test.suite.bypassmodulevisibility.instr; + +public class Profiler { + + public static void before() { + System.out.println("disl: before"); + } + + public static void after() { + System.out.println("disl: after"); + } + +} diff --git a/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/junit/BypassModuleVisibilityTest.java b/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/junit/BypassModuleVisibilityTest.java new file mode 100644 index 0000000000000000000000000000000000000000..da5cdf0955528ac52fe9a2083d371d23c8eba959 --- /dev/null +++ b/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/junit/BypassModuleVisibilityTest.java @@ -0,0 +1,12 @@ +package ch.usi.dag.disl.test.suite.bypassmodulevisibility.junit; + +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import ch.usi.dag.disl.test.suite.DislOnlyTest; + + +@RunWith (JUnit4.class) +public class BypassModuleVisibilityTest extends DislOnlyTest { + +} diff --git a/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/junit/client.out.resource b/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/junit/client.out.resource new file mode 100644 index 0000000000000000000000000000000000000000..d8e210d32d1c8c70a217ba930d2d0c2e55c25089 --- /dev/null +++ b/src-test/ch/usi/dag/disl/test/suite/bypassmodulevisibility/junit/client.out.resource @@ -0,0 +1,2 @@ +disl: before +disl: after diff --git a/src-test/ch/usi/dag/disl/test/suite/dispatchlambda/instr/Analysis.java b/src-test/ch/usi/dag/disl/test/suite/dispatchlambda/instr/Analysis.java index 864bee89bed91a2275837f9c8ac30fdde0445d87..f6d0e6d40c998f28eac1b7c144406f165ae39670 100644 --- a/src-test/ch/usi/dag/disl/test/suite/dispatchlambda/instr/Analysis.java +++ b/src-test/ch/usi/dag/disl/test/suite/dispatchlambda/instr/Analysis.java @@ -14,7 +14,16 @@ public class Analysis extends RemoteAnalysis { public void lambdaEvent (final int index, final ShadowObject object) { final String name = object.getShadowClass ().getName (); - System.out.println (index +": "+ name.substring (0, name.lastIndexOf ("/"))); + + // + // In Java 1, slash has been replaced by dot + // + int lastIndex = name.lastIndexOf ("/"); + if (lastIndex == -1) { + lastIndex = name.lastIndexOf ("."); + } + + System.out.println (index +": "+ name.substring (0, lastIndex)); __lambdaEventsTotal.incrementAndGet (); } diff --git a/src-test/ch/usi/dag/disl/test/utils/ClientEvaluationRunner.java b/src-test/ch/usi/dag/disl/test/utils/ClientEvaluationRunner.java index a3fb262add81c4c94594a429fa2500a160d09f34..35ad8f14fd477cc26348eb0f42e6567a61f0b296 100644 --- a/src-test/ch/usi/dag/disl/test/utils/ClientEvaluationRunner.java +++ b/src-test/ch/usi/dag/disl/test/utils/ClientEvaluationRunner.java @@ -83,7 +83,7 @@ public class ClientEvaluationRunner extends Runner { final File instJar, final File appJar ) throws IOException { final List command = new LinkedList <> (Arrays.asList ( - __CLIENT_JAVA_COMMAND__, "-noverify", + __CLIENT_JAVA_COMMAND__, "-XX:-PrintWarnings", "-noverify", String.format ("-agentpath:%s", _SHVM_AGENT_LIB_), String.format ("-Xbootclasspath/a:%s", Runner.classPath ( _SHVM_DISPATCH_JAR_, instJar diff --git a/src-test/ch/usi/dag/disl/test/utils/ClientServerEvaluationRunner.java b/src-test/ch/usi/dag/disl/test/utils/ClientServerEvaluationRunner.java index 9d60b9bb776bffbe637c68c15f7ff0c63d36f497..5ea421d36f3b0871570f16e99c990334cd2aa358 100644 --- a/src-test/ch/usi/dag/disl/test/utils/ClientServerEvaluationRunner.java +++ b/src-test/ch/usi/dag/disl/test/utils/ClientServerEvaluationRunner.java @@ -120,7 +120,7 @@ public class ClientServerEvaluationRunner extends Runner { final File instJar, final File appJar ) throws IOException { final List command = new LinkedList <> (Arrays.asList ( - __CLIENT_JAVA_COMMAND__, "-noverify", + __CLIENT_JAVA_COMMAND__, "-XX:-PrintWarnings", "-noverify", String.format ("-agentpath:%s", _DISL_AGENT_LIB_), String.format ("-agentpath:%s", _SHVM_AGENT_LIB_), String.format ("-Xbootclasspath/a:%s", Runner.classPath ( @@ -128,6 +128,18 @@ public class ClientServerEvaluationRunner extends Runner { )) )); + int javaVersion = _getJavaVersion(__CLIENT_JAVA_COMMAND__); + if (javaVersion >= 9) { + command.addAll (Arrays.asList ( + "--patch-module", String.format ( + "java.base=%s:%s", _DISL_THREAD_DIR_, _DISL_BYPASS_JAR_ + ) + )); + command.addAll (Arrays.asList ( + "--add-exports", "java.base/ch.usi.dag.disl.dynamicbypass=ALL-UNNAMED" + )); + } + command.addAll (propertiesStartingWith ("disl.")); command.addAll (Arrays.asList ( "-jar", appJar.toString () diff --git a/src-test/ch/usi/dag/disl/test/utils/ClientServerRunner.java b/src-test/ch/usi/dag/disl/test/utils/ClientServerRunner.java index 9b53b342d8ed8ab09d71adb9488acb10e1986e07..7c3a1c691a6b0af5f960f0937f0980a20ebc3b4e 100644 --- a/src-test/ch/usi/dag/disl/test/utils/ClientServerRunner.java +++ b/src-test/ch/usi/dag/disl/test/utils/ClientServerRunner.java @@ -85,13 +85,25 @@ public class ClientServerRunner extends Runner { final File testInstJar, final File testAppJar ) throws IOException { final List command = new LinkedList <> (Arrays.asList ( - __CLIENT_JAVA_COMMAND__, "-noverify", + __CLIENT_JAVA_COMMAND__, "-XX:-PrintWarnings", "-noverify", String.format ("-agentpath:%s", _DISL_AGENT_LIB_), String.format ("-Xbootclasspath/a:%s", Runner.classPath ( _DISL_BYPASS_JAR_, testInstJar )) )); + int javaVersion = _getJavaVersion(__CLIENT_JAVA_COMMAND__); + if (javaVersion >= 9) { + command.addAll (Arrays.asList ( + "--patch-module", String.format ( + "java.base=%s:%s", _DISL_THREAD_DIR_, _DISL_BYPASS_JAR_ + ) + )); + command.addAll (Arrays.asList ( + "--add-exports", "java.base/ch.usi.dag.disl.dynamicbypass=ALL-UNNAMED" + )); + } + command.addAll (propertiesStartingWith ("disl.")); command.addAll (Arrays.asList ( "-jar", testAppJar.toString () diff --git a/src-test/ch/usi/dag/disl/test/utils/Runner.java b/src-test/ch/usi/dag/disl/test/utils/Runner.java index 5ef1e1e8fc3cf34ce947d44703190f9d4b927f70..ca8296a828412fa30831e6c3d74a7890baa14f5c 100644 --- a/src-test/ch/usi/dag/disl/test/utils/Runner.java +++ b/src-test/ch/usi/dag/disl/test/utils/Runner.java @@ -3,11 +3,16 @@ package ch.usi.dag.disl.test.utils; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; +import java.io.BufferedReader; import java.io.File; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import ch.usi.dag.dislreserver.DiSLREServer; import ch.usi.dag.dislserver.DiSLServer; @@ -24,6 +29,7 @@ public abstract class Runner { protected static final String _ENV_JAVA_HOME_ = "JAVA_HOME"; protected static final File _DISL_LIB_DIR_ = new File (System.getProperty ("runner.disl.lib.dir", "lib")); + protected static final File _DISL_THREAD_DIR_ = new File (System.getProperty ("runner.disl.thread.dir", "disl-thread")); protected static final File _DISL_AGENT_LIB_ = __libPath ("runner.disl.agent.lib", "libdislagent.so"); protected static final File _DISL_BYPASS_JAR_ = __libPath ("runner.disl.bypass.jar", "disl-bypass.jar"); @@ -69,6 +75,32 @@ public abstract class Runner { } } + protected static int _getJavaVersion (final String javaCommand) throws IOException { + final ProcessBuilder builder = new ProcessBuilder(javaCommand, "-version"); + builder.redirectErrorStream(true); + final Process process = builder.start(); + final InputStream is = process.getInputStream(); + final BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + + String line = null; + final StringBuilder output = new StringBuilder(); + while ((line = reader.readLine()) != null) { + output.append(line); + } + + final Pattern pattern = Pattern.compile("\\\"(\\d+)(?:\\.(\\d+))?"); + final Matcher matcher = pattern.matcher(output); + if (!matcher.find()) { + throw new RunnerException ("failed to get java version"); + } + + String version = matcher.group(1); + if (version.equals("1")) { + version = matcher.group(2); + } + + return Integer.parseInt(version); + } private static String __extractTestName (final Class testClass) { final String [] packages = testClass.getPackage ().getName ().split ("\\."); diff --git a/src-tools/ch/usi/dag/disl/tools/ExtendThread.java b/src-tools/ch/usi/dag/disl/tools/ExtendThread.java index 0209304f6cdbc027cf57779a4de35940bf77a9d9..856b3975a615280df1268889399879832d4081b6 100644 --- a/src-tools/ch/usi/dag/disl/tools/ExtendThread.java +++ b/src-tools/ch/usi/dag/disl/tools/ExtendThread.java @@ -60,7 +60,7 @@ public final class ExtendThread { private Type __owner; public FieldExtender (final FieldDefinition fd, final ClassWriter cw) { - super (Opcodes.ASM7, cw); + super (Opcodes.ASM9, cw); __fd = fd; } @@ -86,7 +86,7 @@ public final class ExtendThread { if ("".equals (name)) { // Initialize the field. - return new AdviceAdapter (Opcodes.ASM7, mv, access, name, desc) { + return new AdviceAdapter (Opcodes.ASM9, mv, access, name, desc) { @Override protected void onMethodEnter () { __fd.initialize (__owner, this); diff --git a/src-util/ch/usi/dag/util/asm/ClassNodeHelper.java b/src-util/ch/usi/dag/util/asm/ClassNodeHelper.java index bc35173b7057971bbda6a19152a22601d5007096..18f08ba130812513ba8d580e9efc8f8e2ef97bff 100644 --- a/src-util/ch/usi/dag/util/asm/ClassNodeHelper.java +++ b/src-util/ch/usi/dag/util/asm/ClassNodeHelper.java @@ -52,7 +52,7 @@ public enum ClassNodeHelper { * from the given array. */ public ClassNode unmarshal (final byte [] bytes) { - final ClassNode result = new ClassNode (Opcodes.ASM7); + final ClassNode result = new ClassNode (Opcodes.ASM9); new ClassReader (bytes).accept (result, __flags); return result; } @@ -63,7 +63,7 @@ public enum ClassNodeHelper { * from the given input stream. */ public ClassNode unmarshal (final InputStream is) throws IOException { - final ClassNode result = new ClassNode (Opcodes.ASM7); + final ClassNode result = new ClassNode (Opcodes.ASM9); new ClassReader (is).accept (result, __flags); return result; } @@ -74,7 +74,7 @@ public enum ClassNodeHelper { * as a resource using the system class loader. */ public ClassNode load (final String className) throws IOException { - final ClassNode result = new ClassNode (Opcodes.ASM7); + final ClassNode result = new ClassNode (Opcodes.ASM9); new ClassReader (className).accept (result, __flags); return result; } @@ -89,7 +89,7 @@ public enum ClassNodeHelper { * @return a new {@link ClassNode} instance */ public static ClassNode duplicate (final ClassNode source) { - final ClassNode result = new ClassNode (Opcodes.ASM7); + final ClassNode result = new ClassNode (Opcodes.ASM9); source.accept (result); return result; }