Skip to content

Commit

Permalink
[GR-15318] Add new interop identity APIs.
Browse files Browse the repository at this point in the history
PullRequest: graal/5921
  • Loading branch information
chumer committed Apr 23, 2020
2 parents 2706967 + 2383aac commit 991e9f4
Show file tree
Hide file tree
Showing 29 changed files with 1,136 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1508,5 +1508,6 @@ public Context build() {
private boolean orAllAccess(Boolean optionalBoolean) {
return optionalBoolean != null ? optionalBoolean : allowAllAccess;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,9 @@ public Context getContext() {
}

/**
* Compares the identity of the underlying polyglot objects. This method does not do any
* structural comparisons.
*
* {@inheritDoc}
*
* @since 20.1
Expand All @@ -1340,6 +1343,9 @@ public boolean equals(Object obj) {
}

/**
* Returns the identity hash code of the underlying object. This method does not compute the
* hash code depending on the contents of the value.
*
* {@inheritDoc}
*
* @since 20.1
Expand Down
11 changes: 10 additions & 1 deletion truffle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

This changelog summarizes major changes between Truffle versions relevant to languages implementors building upon the Truffle framework. The main focus is on APIs exported by Truffle.

## Version 20.2.0
* Added new identity APIs to `InteropLibrary`:
* `hasIdentity(Object receiver)` to find out whether an object specifies identity
* `isIdentical(Object receiver, Object other, InteropLibrary otherLib)` to compare the identity of two object
* `isIdenticalOrUndefined(Object receiver, Object other)` export to specify the identity of an object.
* `identityHashCode(Object receiver)` useful to implement maps that depend on identity.
* Added `TriState` utility class represents three states TRUE, FALSE and UNDEFINED.
* Added `InteropLibrary.getUncached()` and `InteropLibrary.getUncached(Object)` short-cut methods for convenience.


## Version 20.1.0
* Added `@GenerateLibrary(dynamicDispatchEnabled = false)` that allows to disable dynamic dispatch semantics for a library. The default is `true`.
* Added ability to load external default exports for libraries using a service provider. See `GenerateLibrary(defaultExportLookupEnabled = true)`.
Expand Down Expand Up @@ -43,7 +53,6 @@ This changelog summarizes major changes between Truffle versions relevant to lan
* Values of `NAME` properties of [ReadVariableTag](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/instrumentation/StandardTags.ReadVariableTag.html#NAME) and [WriteVariableTag](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/instrumentation/StandardTags.WriteVariableTag.html#NAME) extended to allow an object or an array of objects with name and source location.
* Added support for asynchronous stack traces: [TruffleLanguage.Env.getAsynchronousStackDepth()](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleLanguage.Env.html#getAsynchronousStackDepth--), [RootNode.findAsynchronousFrames()](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/nodes/RootNode.html#findAsynchronousFrames-com.oracle.truffle.api.frame.Frame-), [TruffleInstrument.Env.setAsynchronousStackDepth()](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/instrumentation/TruffleInstrument.Env.html#setAsynchronousStackDepth-int-), [TruffleStackTrace.getAsynchronousStackTrace()](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleStackTrace.html#getAsynchronousStackTrace-com.oracle.truffle.api.CallTarget-com.oracle.truffle.api.frame.Frame-), [DebuggerSession.setAsynchronousStackDepth()](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/debug/DebuggerSession.html#setAsynchronousStackDepth-int-), [SuspendedEvent.getAsynchronousStacks()](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/debug/SuspendedEvent.html#getAsynchronousStacks--), [DebugException.getDebugAsynchronousStacks()](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/debug/DebugException.html#getDebugAsynchronousStacks--).


## Version 20.0.0
* Add [Layout#dispatch()](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/object/dsl/Layout.html#dispatch--) to be able to generate override of `ObjectType#dispatch()` method in the generated inner \*Type class.
* Deprecated engine options engine.InvalidationReprofileCount and engine.ReplaceReprofileCount. They no longer have any effect. There is no longer reprofiling after compilation.
Expand Down
8 changes: 7 additions & 1 deletion truffle/src/com.oracle.truffle.api.interop/snapshot.sigtest
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ hfds serialVersionUID

CLSS public abstract com.oracle.truffle.api.interop.InteropLibrary
cons protected init()
meth protected com.oracle.truffle.api.utilities.TriState isIdenticalOrUndefined(java.lang.Object,java.lang.Object)
meth protected final boolean assertAdopted()
meth public !varargs java.lang.Object execute(java.lang.Object,java.lang.Object[]) throws com.oracle.truffle.api.interop.ArityException,com.oracle.truffle.api.interop.UnsupportedMessageException,com.oracle.truffle.api.interop.UnsupportedTypeException
meth public !varargs java.lang.Object instantiate(java.lang.Object,java.lang.Object[]) throws com.oracle.truffle.api.interop.ArityException,com.oracle.truffle.api.interop.UnsupportedMessageException,com.oracle.truffle.api.interop.UnsupportedTypeException
Expand Down Expand Up @@ -54,12 +55,14 @@ meth public boolean isMetaObject(java.lang.Object)
meth public boolean isNull(java.lang.Object)
meth public boolean isNumber(java.lang.Object)
meth public boolean isPointer(java.lang.Object)
meth public boolean isIdentical(java.lang.Object,java.lang.Object,com.oracle.truffle.api.interop.InteropLibrary)
meth public boolean isString(java.lang.Object)
meth public boolean isTime(java.lang.Object)
meth public boolean isTimeZone(java.lang.Object)
meth public byte asByte(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
meth public com.oracle.truffle.api.source.SourceSection getSourceLocation(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
meth public double asDouble(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
meth public final boolean hasIdentity(java.lang.Object)
meth public final boolean isArrayElementExisting(java.lang.Object,long)
meth public final boolean isArrayElementWritable(java.lang.Object,long)
meth public final boolean isInstant(java.lang.Object)
Expand All @@ -69,6 +72,7 @@ meth public final java.lang.Object getMembers(java.lang.Object) throws com.oracl
meth public final java.lang.Object toDisplayString(java.lang.Object)
meth public float asFloat(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
meth public int asInt(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
meth public int identityHashCode(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
meth public java.lang.Class<? extends com.oracle.truffle.api.TruffleLanguage<?>> getLanguage(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
meth public java.lang.Object getMembers(java.lang.Object,boolean) throws com.oracle.truffle.api.interop.UnsupportedMessageException
meth public java.lang.Object getMetaObject(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
Expand All @@ -88,14 +92,16 @@ meth public long asLong(java.lang.Object) throws com.oracle.truffle.api.interop.
meth public long asPointer(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
meth public long getArraySize(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
meth public short asShort(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
meth public static com.oracle.truffle.api.interop.InteropLibrary getUncached()
meth public static com.oracle.truffle.api.interop.InteropLibrary getUncached(java.lang.Object)
meth public static com.oracle.truffle.api.library.LibraryFactory<com.oracle.truffle.api.interop.InteropLibrary> getFactory()
meth public void removeArrayElement(java.lang.Object,long) throws com.oracle.truffle.api.interop.InvalidArrayIndexException,com.oracle.truffle.api.interop.UnsupportedMessageException
meth public void removeMember(java.lang.Object,java.lang.String) throws com.oracle.truffle.api.interop.UnknownIdentifierException,com.oracle.truffle.api.interop.UnsupportedMessageException
meth public void toNative(java.lang.Object)
meth public void writeArrayElement(java.lang.Object,long,java.lang.Object) throws com.oracle.truffle.api.interop.InvalidArrayIndexException,com.oracle.truffle.api.interop.UnsupportedMessageException,com.oracle.truffle.api.interop.UnsupportedTypeException
meth public void writeMember(java.lang.Object,java.lang.String,java.lang.Object) throws com.oracle.truffle.api.interop.UnknownIdentifierException,com.oracle.truffle.api.interop.UnsupportedMessageException,com.oracle.truffle.api.interop.UnsupportedTypeException
supr com.oracle.truffle.api.library.Library
hfds FACTORY
hfds FACTORY,UNCACHED
hcls Asserts

CLSS public final com.oracle.truffle.api.interop.InvalidArrayIndexException
Expand Down
Loading

0 comments on commit 991e9f4

Please sign in to comment.