Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for running with OpenJ9 #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions PlayOutAgent/rtlib/de/bodden/tamiflex/playout/rt/ReflLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,24 +160,17 @@ public static void constructorMethodInvoke(Constructor<?> c, Kind constructorMet
try {
StackTraceElement frame = getInvokingFrame();
String[] paramTypes = classesToTypeNames(c.getParameterTypes());
String className = c.getDeclaringClass().getName();
// If this is a lambda proxy class the className comes out in the form:
// "<dotted package>.<class>$$Lambda$<count>/<hash code>",
// however, when we take its byte code to generate the class name (as happens when we
// dump the classes to disk) the name does not contain the "/<hash code>".
// This logic below is to remove the hash code so the reflection log entries match
// the classes that are dumped and soot can process them.
if (className.contains("$$Lambda$"))
String declareClassName = c.getDeclaringClass().getName();
// Lambda's declaring class name comes out as: "<dotted package>.<class>$$Lambda$<count>/<number>",
// however we write out the lambda class as "<dotted package>.<class>$$Lambda$<count>.class"
// We need to remove "/<number>" so the reflection log entry matches the class file name.
if (declareClassName.contains("$$Lambda$"))
{
String slashHashCode = "/" + c.getDeclaringClass().hashCode();
if (!className.endsWith(slashHashCode)) {
System.err.println("unexpected lambda proxy class: " + className);
}
else {
className = className.substring(0, className.length() - slashHashCode.length());
}
int ignoreStart = declareClassName.lastIndexOf('/');
if (ignoreStart != -1)
declareClassName = declareClassName.substring(0, ignoreStart);
}
logAndIncrementTargetMethodEntry(frame.getClassName()+"."+frame.getMethodName(),frame.getLineNumber(),constructorMethodKind,className,"void","<init>", c.isAccessible(), paramTypes);
logAndIncrementTargetMethodEntry(frame.getClassName()+"."+frame.getMethodName(),frame.getLineNumber(),constructorMethodKind,declareClassName,"void","<init>", c.isAccessible(), paramTypes);

} finally {
leavingReflectionAPI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public byte[] transform(ClassLoader loader, String className,

try {
final ClassReader creader = new ClassReader(classfileBuffer);
final ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
final ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
ClassVisitor visitor = writer;

for (AbstractTransformation transformation : transformations)
Expand Down