Skip to content

Commit

Permalink
Update to ASM9.
Browse files Browse the repository at this point in the history
Fixes #51
Fixes #52

PiperOrigin-RevId: 532475332
  • Loading branch information
google-noreply authored and cpovirk committed May 16, 2023
1 parent d98c4e4 commit b9f4b37
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package com.google.monitoring.runtime.instrumentation;

import org.objectweb.asm.Opcodes;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.JSRInlinerAdapter;
import org.objectweb.asm.commons.LocalVariablesSorter;

Expand All @@ -32,7 +32,7 @@ class AllocationClassAdapter extends ClassVisitor {
private final String recorderMethod;

public AllocationClassAdapter(ClassVisitor cv, String recorderClass, String recorderMethod) {
super(Opcodes.ASM7, cv);
super(Opcodes.ASM9, cv);
this.recorderClass = recorderClass;
this.recorderMethod = recorderMethod;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.monitoring.runtime.instrumentation;

import org.objectweb.asm.Opcodes;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
Expand Down Expand Up @@ -110,7 +111,7 @@ private List<VariableScope> getLocalScopes() {

/** A new AllocationMethodAdapter is created for each method that gets visited. */
public AllocationMethodAdapter(MethodVisitor mv, String recorderClass, String recorderMethod) {
super(Opcodes.ASM7, mv);
super(Opcodes.ASM9, mv);
this.recorderClass = recorderClass;
this.recorderMethod = recorderMethod;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ java_library(
deps = [
"@google_bazel_common//third_party/java/asm",
"@google_bazel_common//third_party/java/asm:asm-commons",
"@google_bazel_common//third_party/java/asm:asm-tree",
],
)

Expand All @@ -37,6 +36,7 @@ java_library(
":guava.jar",
"@google_bazel_common//third_party/java/asm",
"@google_bazel_common//third_party/java/asm:asm-commons",
# Necessary because of https://github.com/google/bazel-common/issues/169:
"@google_bazel_common//third_party/java/asm:asm-tree",
],
)
Expand All @@ -57,6 +57,8 @@ java_library(
":verifying_class_adapter",
"@google_bazel_common//third_party/java/asm",
"@google_bazel_common//third_party/java/asm:asm-commons",
# Necessary because of https://github.com/google/bazel-common/issues/169:
"@google_bazel_common//third_party/java/asm:asm-tree",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.monitoring.runtime.instrumentation;

import org.objectweb.asm.Opcodes;
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.Instrumentation;
import java.lang.instrument.UnmodifiableClassException;
Expand Down Expand Up @@ -145,7 +146,7 @@ static class ConstructorMethodAdapter extends MethodVisitor {
Class<?> cl;

ConstructorMethodAdapter(MethodVisitor mv, Class<?> cl) {
super(Opcodes.ASM7, mv);
super(Opcodes.ASM9, mv);
this.cl = cl;
}

Expand Down Expand Up @@ -226,7 +227,7 @@ static class ConstructorClassAdapter extends ClassVisitor {
Class<?> cl;

public ConstructorClassAdapter(ClassVisitor cv, Class<?> cl) {
super(Opcodes.ASM7, cv);
super(Opcodes.ASM9, cv);
this.cl = cl;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

package com.google.monitoring.runtime.instrumentation;

import org.objectweb.asm.Opcodes;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.CodeSizeEvaluator;

/**
Expand Down Expand Up @@ -53,7 +53,7 @@ public enum State {
* @param className the name of the class being examined.
*/
public VerifyingClassAdapter(ClassWriter cw, byte[] original, String className) {
super(Opcodes.ASM7, cw);
super(Opcodes.ASM9, cw);
state = State.UNKNOWN;
message = "The class has not finished being examined";
this.cw = cw;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ sh_test(

### End tests of agent integrity / build data stripping.

# TODO(java-platform-team): Move to third_party
java_test(
name = "MetaspaceExhaustionTest",
srcs = ["MetaspaceExhaustionTest.java"],
Expand Down

0 comments on commit b9f4b37

Please sign in to comment.