Skip to content

Commit

Permalink
Introduce Interop class
Browse files Browse the repository at this point in the history
This decouples the interoperability API from TruffleObject. More importantly, it is now possible to send interop messages to Smalltalk objects.
  • Loading branch information
fniephaus committed Nov 13, 2019
1 parent 40cc6c4 commit 0991b90
Show file tree
Hide file tree
Showing 101 changed files with 319 additions and 286 deletions.
1 change: 1 addition & 0 deletions src/GraalSqueak-Core.package/Interop.class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This class provides access to GraalVM's interoperability API.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
primitives
primitiveAsBoolean
asBoolean: anObject
<primitive: 'primitiveAsBoolean' module: 'PolyglotPlugin'>
self primitiveIsBoolean
(self isBoolean: anObject)
ifFalse: [ self error: 'Object cannot be converted to boolean' ]
ifTrue: [ self error: 'Unexpected error' ]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
primitives
primitiveAsDouble
asDouble: anObject
<primitive: 'primitiveAsDouble' module: 'PolyglotPlugin'>
self primitiveFitsInDouble
(self fitsInDouble: anObject)
ifFalse: [ self error: 'Object does not fit in double' ]
ifTrue: [ self error: 'Unexpected error' ]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
primitives
primitiveAsLong
asLong: anObject
<primitive: 'primitiveAsLong' module: 'PolyglotPlugin'>
self primitiveFitsInLong
(self fitsInLong: anObject)
ifFalse: [ self error: 'Object does not fit in long' ]
ifTrue: [ self error: 'Unexpected error' ]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
primitives
primitiveAsPointer
asPointer: anObject
<primitive: 'primitiveAsPointer' module: 'PolyglotPlugin'>
self primitiveIsPointer
(self isPointer: self)
ifFalse: [ self error: 'Object cannot be converted to a pointer' ]
ifTrue: [ self error: 'Unexpected error' ]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
primitives
primitiveAsString
asString: anObject
<primitive: 'primitiveAsString' module: 'PolyglotPlugin'>
self primitiveIsString
(self isString: self)
ifFalse: [ self error: 'Object cannot be converted to string' ]
ifTrue: [ self error: 'Unexpected error' ]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveExecuteWithArguments: arguments
execute: anObject with: arguments
<primitive: 'primitiveExecute' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveFitsInDouble
fitsInDouble: anObject
<primitive: 'primitiveFitsInDouble' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveFitsInLong
fitsInLong: anObject
<primitive: 'primitiveFitsInLong' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveGetArraySize
getArraySize: anObject
<primitive: 'primitiveGetArraySize' module: 'PolyglotPlugin'>
^ 0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveGetMemberSize
getMemberSize: anObject
<primitive: 'primitiveGetMemberSize' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveGetMembers
getMembers: anObject
<primitive: 'primitiveGetMembers' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveHasArrayElements
hasArrayElements: anObject
<primitive: 'primitiveHasArrayElements' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveHasMemberReadSideEffects: aMember
hasMemberReadSideEffects: andObject member: aMember
<primitive: 'primitiveHasMemberReadSideEffects' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveHasMemberWriteSideEffects: aMember
hasMemberWriteSideEffects: anObject member: aMember
<primitive: 'primitiveHasMemberWriteSideEffects' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveHasMembers
hasMembers: anObject
<primitive: 'primitiveHasMembers' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIdentityHash
identityHash: anObject
<primitive: 'primitiveIdentityHash' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveInstantiate: anArray
instantiate: anObject with: anArray
<primitive: 'primitiveInstantiate' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveInvokeMember: anIdentifier arguments: arguments
invokeMember: anObject member: anIdentifier arguments: arguments
<primitive: 'primitiveInvokeMember' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
primitives
isArrayElementExisting: anObject index: anIndex
<primitive: 'primitiveIsArrayElementExisting' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsArrayElementInsertable: anIndex
isArrayElementInsertable: anObject index: anIndex
<primitive: 'primitiveIsArrayElementInsertable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsArrayElementModifiable: anIndex
isArrayElementModifiable: anObject index: anIndex
<primitive: 'primitiveIsArrayElementModifiable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsArrayElementReadable: anIndex
isArrayElementReadable: anObject index: anIndex
<primitive: 'primitiveIsArrayElementReadable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsArrayElementRemovable: anIndex
isArrayElementRemovable: anObject index: anIndex
<primitive: 'primitiveIsArrayElementRemovable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsArrayElementWritable: anIndex
isArrayElementWritable: anObject index: anIndex
<primitive: 'primitiveIsArrayElementWritable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsBoolean
isBoolean: anObject
<primitive: 'primitiveIsBoolean' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsExecutable
isExecutable: anObject
<primitive: 'primitiveIsExecutable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsHostFunction
isHostFunction: anObject
<primitive: 'primitiveIsHostFunction' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsHostObject
isHostObject: anObject
<primitive: 'primitiveIsHostObject' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsHostSymbol
isHostSymbol: anObject
<primitive: 'primitiveIsHostSymbol' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsInstantiable
isInstantiable: anObject
<primitive: 'primitiveIsInstantiable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsMemberExisting: aMember
isMemberExisting: anObject member: aMember
<primitive: 'primitiveIsMemberExisting' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsMemberInsertable: aMember
isMemberInsertable: anObject member: aMember
<primitive: 'primitiveIsMemberInsertable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsMemberInternal: aMember
isMemberInternal: anObject member: aMember
<primitive: 'primitiveIsMemberInternal' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsMemberInvocable: aMember
isMemberInvocable: anObject member: aMember
<primitive: 'primitiveIsMemberInvocable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsMemberModifiable: aMember
isMemberModifiable: anObject member: aMember
<primitive: 'primitiveIsMemberModifiable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsMemberReadable: aMember
isMemberReadable: anObject member: aMember
<primitive: 'primitiveIsMemberReadable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsMemberRemovable: aMember
isMemberRemovable: anObject member: aMember
<primitive: 'primitiveIsMemberRemovable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
primitives
isMemberWritable: anObject member: aMember
<primitive: 'primitiveIsMemberWritable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsNull
isNull: anObject
<primitive: 'primitiveIsNull' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsPointer
isPointer: anObject
<primitive: 'primitiveIsPointer' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsString
isString: anObject
<primitive: 'primitiveIsString' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveReadArrayElement: anIndex
readArrayElement: anObject index: anIndex
<primitive: 'primitiveReadArrayElement' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveReadMember: anIdentifier
readMember: anObject member: aMember
<primitive: 'primitiveReadMember' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveRemoveArrayElement: anIndex
removeArrayElement: anObject index: anIndex
<primitive: 'primitiveRemoveArrayElement' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveRemoveMember: anIdentifier
removeMember: anObject member: aMember
<primitive: 'primitiveRemoveMember' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsArrayElementExisting: anIndex
sArrayElementExisting: anObject index: anIndex
<primitive: 'primitiveIsArrayElementExisting' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveIsMemberWritable: aMember
sMemberWritable: anObject member: aMember
<primitive: 'primitiveIsMemberWritable' module: 'PolyglotPlugin'>
self primitiveFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveStringRepresentation
stringRepresentation: anObject
<primitive: 'primitiveStringRepresentation' module: 'PolyglotPlugin'>
^ nil
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveWriteArrayElement: anIndex value: anObject
writeArrayElement: anObject index: anIndex value: aValue
<primitive: 'primitiveWriteArrayElement' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
primitives
primitiveWriteMember: anIdentifier value: anObject
writeMember: anObject member: aMember value: aValue
<primitive: 'primitiveWriteMember' module: 'PolyglotPlugin'>
Polyglot signalPolyglotError
Loading

0 comments on commit 0991b90

Please sign in to comment.