-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed issue with get/putObject not being native post Java 1
- Loading branch information
1 parent
efd20e6
commit 0333b8b
Showing
4 changed files
with
48 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Phosphor/src/main/java/edu/columbia/cs/psl/phosphor/agent/JdkUnsafeAdapterPatchingCV.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package edu.columbia.cs.psl.phosphor.agent; | ||
|
||
import edu.columbia.cs.psl.phosphor.Configuration; | ||
import edu.columbia.cs.psl.phosphor.runtime.mask.JdkUnsafeAdapter; | ||
import org.objectweb.asm.ClassVisitor; | ||
import org.objectweb.asm.MethodVisitor; | ||
import org.objectweb.asm.Type; | ||
|
||
public class JdkUnsafeAdapterPatchingCV extends ClassVisitor { | ||
private final String UNSAFE_INTERNAL_NAME = "jdk/internal/misc/Unsafe"; | ||
|
||
public JdkUnsafeAdapterPatchingCV(ClassVisitor cv) { | ||
super(Configuration.ASM_VERSION, cv); | ||
} | ||
|
||
public static boolean isApplicable(String className, boolean patchUnsafeNames) { | ||
return Type.getInternalName(JdkUnsafeAdapter.class).equals(className) && !patchUnsafeNames; | ||
} | ||
|
||
@Override | ||
public MethodVisitor visitMethod( | ||
int access, String name, String descriptor, String signature, String[] exceptions) { | ||
MethodVisitor mv = super.visitMethod(access, name, descriptor, signature, exceptions); | ||
return new MethodVisitor(api, mv) { | ||
@Override | ||
public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) { | ||
if (UNSAFE_INTERNAL_NAME.equals(owner)) { | ||
name = name.replace("Object", "Reference"); | ||
} | ||
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface); | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters