Skip to content

Commit

Permalink
espresso suppress warnings of member interop.
Browse files Browse the repository at this point in the history
  • Loading branch information
entlicher committed Oct 18, 2024
1 parent 3f5b06f commit 28c6426
Show file tree
Hide file tree
Showing 26 changed files with 76 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public RootNode getRootNode() {
return rootNode;
}

@SuppressWarnings("deprecation") // GR-58181
public Object getThisValue() {
Object theScope = getScope();
if (theScope == null) {
Expand All @@ -131,11 +132,13 @@ public Object getThisValue() {
}
}

@SuppressWarnings("deprecation") // GR-58181
public Object getVariable(String identifier) throws InteropException {
Object theScope = getScope();
return theScope != null ? INTEROP.readMember(theScope, identifier) : null;
}

@SuppressWarnings("deprecation") // GR-58181
public void setVariable(Object value, String identifier) {
Object theScope = getScope();
if (theScope == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ public boolean onFieldAccess(FieldRef field, Object receiver) {

@Override
@TruffleBoundary
@SuppressWarnings("deprecation") // GR-58181
public boolean onMethodEntry(MethodRef method, Object scope) {
boolean active = false;
// collect variable information from scope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
*
* <p>
* Classes cannot be enumerated; and in this implementation, not even the ones already loaded. e.g.
* {@link InteropLibrary#getMembers(Object) Peeking all memebers} will return an empty interop
* {@link InteropLibrary#getMemberObjects(Object) Peeking all memebers} will return an empty interop
* collection. <br>
* {@link InteropLibrary#readMember(Object, String) Reading a member} will trigger class loading; it
* {@link InteropLibrary#readMember(Object, Object) Reading a member} will trigger class loading; it
* is equivalent to calling {@link Class#forName(String, boolean, ClassLoader)} with the provided
* guest class loader. <br>
* {@link ClassNotFoundException} is translated into interop's {@link UnknownIdentifierException
Expand All @@ -64,6 +64,7 @@
* {@link InteropLibrary#isString(Object) interop string} as argument, the path to add.
*/
@ExportLibrary(InteropLibrary.class)
@SuppressWarnings({"truffle-abstract-export", "deprecation"}) // GR-58181
public final class EspressoBindings implements TruffleObject {
public static final String JAVA_VM = "<JavaVM>";
public static final String ADD_PATH = "addPath";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public static Object createVariables(Local[] liveLocals, Frame frame, Symbol<Sym
// variable names through the Interop API. Clients which are bytecode based, e.g. JDWP that use
// slot numbers as identifiers must operate directly by using read/write member methods.
@ExportLibrary(InteropLibrary.class)
@SuppressWarnings({"truffle-abstract-export", "deprecation"}) // GR-58181
static final class VariablesMapObject implements TruffleObject {

final Map<String, FrameSlotInfo> slots;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ private TruffleObject rtldDefault() {
}

@ExportLibrary(InteropLibrary.class)
@SuppressWarnings({"truffle-abstract-export", "deprecation"}) // GR-58181
static class DefaultLibrary implements TruffleObject {

final @Pointer TruffleObject dlsym;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public void unloadLibrary(@Pointer TruffleObject library) {
}

@Override
@SuppressWarnings("deprecation") // GR-58181
public @Pointer TruffleObject lookupSymbol(@Pointer TruffleObject library, String symbolName) {
try {
TruffleObject symbol = (TruffleObject) uncachedInterop.readMember(library, symbolName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
import com.oracle.truffle.espresso.vm.VM;

@ExportLibrary(InteropLibrary.class)
@SuppressWarnings({"truffle-abstract-export", "deprecation"}) // GR-58181
public abstract class Klass extends ContextAccessImpl implements ModifiersProvider, KlassRef, TruffleObject {

// region Interop
Expand Down Expand Up @@ -1216,6 +1217,7 @@ public Klass[] getImplementedInterfaces() {
/**
* Returns {@code true} if the type is a member type.
*/
@ExportMessage.Ignore // GR-58181
public abstract boolean isMember();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.oracle.truffle.espresso.impl.Method;

@ExportLibrary(InteropLibrary.class)
@SuppressWarnings({"truffle-abstract-export", "deprecation"}) // GR-58181
final class SubstitutionScope implements TruffleObject {
@CompilationFinal(dimensions = 1) private final Object[] args;
private final Method method;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public static AbstractGetFieldNode create(Field f) {
// @formatter:on
}

@SuppressWarnings("deprecation") // GR-58181
protected Object getForeignField(StaticObject receiver, InteropLibrary interopLibrary, EspressoLanguage language, Meta meta, BranchProfile error) {
assert getField().getDeclaringKlass().isAssignableFrom(receiver.getKlass());
assert !getField().isStatic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public static AbstractSetFieldNode create(Field f) {
// @formatter:on
}

@SuppressWarnings("deprecation") // GR-58181
protected void setForeignField(StaticObject receiver, Object fieldValue, InteropLibrary interopLibrary, EspressoLanguage language, EspressoContext context, BranchProfile error) {
assert field.getDeclaringKlass().isAssignableFrom(receiver.getKlass());
assert receiver.isForeignObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ public Object convert(StaticObject foreign) {
public static final class OptionalTypeConverter implements InternalTypeConverter {

@Override
@SuppressWarnings("deprecation") // GR-58181
public StaticObject convertInternal(InteropLibrary interop, Object value, Meta meta, ToReference.DynamicToReference toEspresso) throws UnsupportedTypeException {
try {
Object result = interop.invokeMember(value, "orElse", StaticObject.NULL);
Expand All @@ -356,6 +357,7 @@ public StaticObject convertInternal(InteropLibrary interop, Object value, Meta m
public static final class BigDecimalTypeConverter implements InternalTypeConverter {

@Override
@SuppressWarnings("deprecation") // GR-58181
public StaticObject convertInternal(InteropLibrary interop, Object value, Meta meta, ToReference.DynamicToReference toEspresso) throws UnsupportedTypeException {
try {
// state required to reconstruct in guest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ public static String getMetaName(Object metaObject, InteropLibrary interop) {
}

@TruffleBoundary
@SuppressWarnings("deprecation") // GR-58181
public static void checkHasAllFieldsOrThrow(Object value, ObjectKlass klass, InteropLibrary interopLibrary, Meta meta) throws UnsupportedTypeException {
CompilerAsserts.partialEvaluationConstant(klass);
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ private ExternalPluginHandler(StaticObject handler, InteropLibrary library) {
this.interopLibrary = library;
}

@SuppressWarnings("deprecation") // GR-58181
public static ExternalPluginHandler create(StaticObject guestHandler) throws IllegalArgumentException {
InteropLibrary library = InteropLibrary.getUncached(guestHandler);

Expand All @@ -57,6 +58,7 @@ public static ExternalPluginHandler create(StaticObject guestHandler) throws Ill
return new ExternalPluginHandler(guestHandler, library);
}

@SuppressWarnings("deprecation") // GR-58181
public boolean shouldRerunClassInitializer(Klass klass, boolean changed, DebuggerController controller) {
try {
return (boolean) interopLibrary.invokeMember(guestHandler, RERUN_CLINIT, klass.mirror(), changed);
Expand All @@ -66,6 +68,7 @@ public boolean shouldRerunClassInitializer(Klass klass, boolean changed, Debugge
return false;
}

@SuppressWarnings("deprecation") // GR-58181
public void postHotSwap(Klass[] changedKlasses, DebuggerController controller) {
try {
StaticObject[] guestClasses = new StaticObject[changedKlasses.length];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

@GenerateInteropNodes
@ExportLibrary(value = InteropLibrary.class, receiverType = StaticObject.class)
@SuppressWarnings("truffle-abstract-export") // GR-58181
public class ByteBufferInterop extends EspressoInterop {

@ExportMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
@GenerateInteropNodes
@ExportLibrary(value = InteropLibrary.class, receiverType = StaticObject.class)
@Shareable
@SuppressWarnings({"truffle-abstract-export", "deprecation"}) // GR-58181
public class EspressoInterop extends BaseInterop {
// region ### is/as checks/conversions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
@GenerateInteropNodes
@Shareable
@ExportLibrary(value = InteropLibrary.class, receiverType = StaticObject.class)
@SuppressWarnings({"truffle-abstract-export"}) // GR-58181
public class ForeignExceptionInterop extends ThrowableInterop {

private static Object getRawForeignObject(StaticObject object) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@GenerateInteropNodes
@Shareable
@ExportLibrary(value = InteropLibrary.class, receiverType = StaticObject.class)
@SuppressWarnings({"truffle-abstract-export"}) // GR-58181
public class InterruptedExceptionInterop extends ThrowableInterop {
@ExportMessage
public static ExceptionType getExceptionType(@SuppressWarnings("unused") StaticObject receiver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

@GenerateInteropNodes
@ExportLibrary(value = InteropLibrary.class, receiverType = StaticObject.class)
@SuppressWarnings({"truffle-abstract-export"}) // GR-58181
public class IterableInterop extends EspressoInterop {
// region ### Iterable

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

@GenerateInteropNodes
@ExportLibrary(value = InteropLibrary.class, receiverType = StaticObject.class)
@SuppressWarnings({"truffle-abstract-export"}) // GR-58181
public class IteratorInterop extends EspressoInterop {
@ExportMessage
@Shareable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

@GenerateInteropNodes
@ExportLibrary(value = InteropLibrary.class, receiverType = StaticObject.class)
@SuppressWarnings({"truffle-abstract-export"}) // GR-58181
public final class ListInterop extends IterableInterop {

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

@GenerateInteropNodes
@ExportLibrary(value = InteropLibrary.class, receiverType = StaticObject.class)
@SuppressWarnings({"truffle-abstract-export"}) // GR-58181
public class MapEntryInterop extends EspressoInterop {
@ExportMessage
@Shareable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
*/
@GenerateInteropNodes
@ExportLibrary(value = InteropLibrary.class, receiverType = StaticObject.class)
@SuppressWarnings({"truffle-abstract-export"}) // GR-58181
public class MapInterop extends EspressoInterop {
// region ### Hashes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
* @see InteropMessageFactories
*/
@ExportLibrary(value = InteropLibrary.class, receiverType = StaticObject.class)
@SuppressWarnings({"truffle-abstract-export", "deprecation"}) // GR-58181
public class SharedInterop {
@GenerateUncached
abstract static class CallSharedInteropMessage extends EspressoNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
@GenerateInteropNodes
@Shareable
@ExportLibrary(value = InteropLibrary.class, receiverType = StaticObject.class)
@SuppressWarnings({"truffle-abstract-export", "deprecation"}) // GR-58181
public class ThrowableInterop extends EspressoInterop {

@ExportMessage
Expand Down
Loading

0 comments on commit 28c6426

Please sign in to comment.