Skip to content

Commit

Permalink
* Fixed RetentionPolicy for mask annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
katherine-hough committed Nov 29, 2023
1 parent 5469584 commit 82e03dc
Show file tree
Hide file tree
Showing 9 changed files with 222 additions and 231 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ public static Map<String, MaskRegistry.MaskInfo> readMasks() {
}

private static String createKey(MethodRecordImpl record, Mask mask) {
String className = Type.getInternalName(mask.owner());
String descriptor = mask.isStatic() ? record.getDescriptor() : removeFirstParameter(record.getDescriptor());
return MaskRegistry.getKey(className, record.getName(), descriptor);
return MaskRegistry.getKey(mask.owner(), record.getName(), descriptor);
}

private static String removeFirstParameter(String descriptor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import edu.columbia.cs.psl.phosphor.instrumenter.LocalVariableManager;
import edu.columbia.cs.psl.phosphor.mask.MaskRegistry.MaskInfo;
import edu.columbia.cs.psl.phosphor.runtime.*;
import edu.columbia.cs.psl.phosphor.runtime.mask.RuntimeJDKInternalUnsafePropagator;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* the first parameter removed.
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.CLASS)
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(Masks.class)
public @interface Mask {
Class<?> owner();
String owner();

boolean isStatic() default false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.lang.annotation.Target;

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.CLASS)
@Retention(RetentionPolicy.RUNTIME)
public @interface Masks {
Mask[] value();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package edu.columbia.cs.psl.phosphor.runtime.mask;

@SuppressWarnings("unused")

public class OffsetPair {

public final long origFieldOffset;
public final long wrappedFieldOffset;
public final long tagFieldOffset;
public final boolean isStatic;

public OffsetPair(boolean isStatic, long origFieldOffset, long wrappedFieldOffset, long tagFieldOffset) {
this.isStatic = isStatic;
this.origFieldOffset = origFieldOffset;
this.tagFieldOffset = tagFieldOffset;
this.wrappedFieldOffset = wrappedFieldOffset;
}

@Override
public boolean equals(Object other) {
return other instanceof OffsetPair && this.origFieldOffset == ((OffsetPair) other).origFieldOffset && this.isStatic == ((OffsetPair) other).isStatic;
}

@Override
public int hashCode() {
return (int) (origFieldOffset ^ (origFieldOffset >>> 32));
}

@Override
public String toString() {
return String.format("{field @ %d -> tag @ %d, wrapper @ %d}", origFieldOffset, tagFieldOffset, wrappedFieldOffset);
}
}

Large diffs are not rendered by default.

Loading

0 comments on commit 82e03dc

Please sign in to comment.