@Override protected Object executeImpl(int keyInfo) { return KeyInfo.isExisting(keyInfo); }
@Override protected Object executeImpl(Object receiver, Object[] args) { String key = (String) args[1]; int keyInfo = ForeignAccess.sendKeyInfo(keyInfoNode, (TruffleObject) receiver, key); return KeyInfo.isExisting(keyInfo); }
@Override Object execute(TruffleObject[] scopes, int length, Object[] arguments, int offset) throws InteropException { String identifier = expectIdentifier(arguments, offset, Message.KEY_INFO); int keyInfo = KeyInfo.NONE; for (int i = 0; i < length; i++) { TruffleObject scopeObject = scopes[i]; int currentInfo = ForeignAccess.sendKeyInfo(keyInfoNode, scopeObject, identifier); if (KeyInfo.isExisting(currentInfo)) { keyInfo = currentInfo; break; } else if (KeyInfo.isInsertable(currentInfo)) { keyInfo = currentInfo; } } return keyInfo; }
@Override Object execute(TruffleObject[] scopes, int length, Object[] arguments, int offset) throws InteropException { String identifier = expectIdentifier(arguments, offset, Message.KEY_INFO); int keyInfo = KeyInfo.NONE; for (int i = 0; i < length; i++) { TruffleObject scopeObject = scopes[i]; int currentInfo = ForeignAccess.sendKeyInfo(keyInfoNode, scopeObject, identifier); if (KeyInfo.isExisting(currentInfo)) { keyInfo = currentInfo; break; } else if (KeyInfo.isInsertable(currentInfo)) { keyInfo = currentInfo; } } return keyInfo; }
@Override public boolean contains(Object o) { if (!(o instanceof String)) { return false; } Object prev = languageContext.enter(); try { int keyInfo = ForeignAccess.sendKeyInfo(keyInfoNode, receiver, o); return KeyInfo.isExisting(keyInfo); } catch (Throwable e) { throw wrapGuestException(languageContext, e); } finally { languageContext.leave(prev); } }
@Override public boolean contains(Object o) { if (!(o instanceof String)) { return false; } Object prev = languageContext.context.enterIfNeeded(); try { int keyInfo = ForeignAccess.sendKeyInfo(cache.keyInfoNode, receiver, o); return KeyInfo.isExisting(keyInfo); } catch (Throwable e) { throw PolyglotImpl.wrapGuestException(languageContext, e); } finally { languageContext.context.leaveIfNeeded(prev); } }
Object lookupGuest(String symbolName) { ensureInitialized(null); Iterable<?> topScopes = VMAccessor.instrumentAccess().findTopScopes(env); for (Object topScope : topScopes) { Scope scope = (Scope) topScope; TruffleObject variables = (TruffleObject) scope.getVariables(); int symbolInfo = ForeignAccess.sendKeyInfo(keyInfoNode, variables, symbolName); if (KeyInfo.isExisting(symbolInfo) && KeyInfo.isReadable(symbolInfo)) { try { return ForeignAccess.sendRead(readNode, variables, symbolName); } catch (InteropException ex) { throw new AssertionError(symbolName, ex); } } } return null; }
assertFalse("An unknown property", KeyInfo.isExisting(keyInfo)); int ro = object.ro(); if (KeyInfo.isExisting(ro)) { assertTrue(KeyInfo.isReadable(ro)); assertFalse(KeyInfo.isWritable(ro)); if (KeyInfo.isExisting(wo)) { assertFalse(KeyInfo.isReadable(wo)); assertTrue(KeyInfo.isWritable(wo)); if (KeyInfo.isExisting(rw)) { assertTrue(KeyInfo.isReadable(rw)); assertTrue(KeyInfo.isWritable(rw)); if (KeyInfo.isExisting(rm)) { assertTrue(KeyInfo.isRemovable(rm)); numKeys++; if (KeyInfo.isExisting(invocable)) { assertTrue(KeyInfo.isInvocable(invocable)); assertFalse(KeyInfo.isInternal(invocable)); if (KeyInfo.isExisting(intern)) { assertTrue(KeyInfo.isInternal(intern)); if (KeyInfo.isExisting(ro)) { assertTrue(map.containsKey("ro")); if (KeyInfo.isExisting(wo)) {
Object value = args[offset + 1]; int info = sendKeyInfo(keyInfo, receiver, key); if (!KeyInfo.isExisting(info) || (KeyInfo.isWritable(info) && KeyInfo.isReadable(info))) { if (KeyInfo.isExisting(info)) { try { result = toHost.execute(sendRead(read, receiver, key), cache.valueClass, cache.valueType, languageContext);
return ForeignAccess.sendRemove(removeMemberNode, truffleReceiver, key); } else { if (KeyInfo.isExisting(keyInfo) || !ForeignAccess.sendHasKeys(hasKeysNode, truffleReceiver)) { CompilerDirectives.transferToInterpreter(); return getMemberUnsupported(context, receiver, key); if (KeyInfo.isExisting(keyInfo) || !ForeignAccess.sendHasKeys(hasKeysNode, truffleReceiver)) { removeMemberUnsupported(context, receiver);
return ForeignAccess.sendRemove(removeMemberNode, truffleReceiver, key); } else { if (KeyInfo.isExisting(keyInfo) || !ForeignAccess.sendHasKeys(hasKeysNode, truffleReceiver)) { CompilerDirectives.transferToInterpreter(); return polyglot.getMemberUnsupported(receiver, key); if (KeyInfo.isExisting(keyInfo) || !ForeignAccess.sendHasKeys(hasKeysNode, truffleReceiver)) { polyglot.removeMemberUnsupported(receiver);
Object value = args[ARGUMENT_OFFSET + 1]; int info = sendKeyInfo(keyInfo, receiver, key); if (!KeyInfo.isExisting(info) || (KeyInfo.isWritable(info) && KeyInfo.isReadable(info))) { if (KeyInfo.isExisting(info)) { try { result = toHost.execute(sendRead(read, receiver, key), cache.valueClass, cache.valueType, languageContext);
return ForeignAccess.sendRemove(removeArrayNode, (TruffleObject) receiver, index); } else { if (KeyInfo.isExisting(keyInfo) || !ForeignAccess.sendHasSize(hasSizeNode, truffleReceiver)) { CompilerDirectives.transferToInterpreter(); removeArrayElementUnsupported(context, receiver); if (KeyInfo.isExisting(keyInfo) || !ForeignAccess.sendHasSize(hasSizeNode, truffleReceiver)) { removeArrayElementUnsupported(context, receiver);
return ForeignAccess.sendRemove(removeArrayNode, (TruffleObject) receiver, index); } else { if (KeyInfo.isExisting(keyInfo) || !ForeignAccess.sendHasSize(hasSizeNode, truffleReceiver)) { CompilerDirectives.transferToInterpreter(); polyglot.removeArrayElementUnsupported(receiver); if (KeyInfo.isExisting(keyInfo) || !ForeignAccess.sendHasSize(hasSizeNode, truffleReceiver)) { polyglot.removeArrayElementUnsupported(receiver);
value = toHostValue.execute(ForeignAccess.sendRead(readMemberNode, truffleReceiver, key)); } else { if (KeyInfo.isExisting(keyInfo) || !ForeignAccess.sendHasKeys(hasKeysNode, truffleReceiver)) { CompilerDirectives.transferToInterpreter(); return polyglot.getMemberUnsupported(receiver, key); if (KeyInfo.isExisting(keyInfo) || !ForeignAccess.sendHasKeys(hasKeysNode, truffleReceiver)) { return polyglot.getMemberUnsupported(receiver, key);
value = toHostValue.execute(context, ForeignAccess.sendRead(readMemberNode, truffleReceiver, key)); } else { if (KeyInfo.isExisting(keyInfo) || !ForeignAccess.sendHasKeys(hasKeysNode, truffleReceiver)) { CompilerDirectives.transferToInterpreter(); return getMemberUnsupported(context, receiver, key); if (KeyInfo.isExisting(keyInfo) || !ForeignAccess.sendHasKeys(hasKeysNode, truffleReceiver)) { return getMemberUnsupported(context, receiver, key);
@Override Object execute(TruffleObject[] scopes, int length, Object[] arguments, int offset) throws InteropException { String identifier = expectIdentifier(arguments, offset, Message.REMOVE); if (isConstantSingleLength()) { return ForeignAccess.sendRemove(removeNode, scopes[0], identifier); } else if (length > 0) { for (int i = 0; i < length; i++) { TruffleObject scopeObject = scopes[i]; int keyInfo = ForeignAccess.sendKeyInfo(keyInfoNode, scopeObject, identifier); if (KeyInfo.isRemovable(keyInfo)) { return ForeignAccess.sendRemove(removeNode, scopeObject, identifier); } else if (KeyInfo.isExisting(keyInfo)) { CompilerDirectives.transferToInterpreter(); throw UnsupportedMessageException.raise(Message.REMOVE); } } } CompilerDirectives.transferToInterpreter(); throw UnknownIdentifierException.raise(identifier); }
@Override Object execute(TruffleObject[] scopes, int length, Object[] arguments, int offset) throws InteropException { String identifier = expectIdentifier(arguments, offset, Message.REMOVE); if (isConstantSingleLength()) { return ForeignAccess.sendRemove(removeNode, scopes[0], identifier); } else if (length > 0) { for (int i = 0; i < length; i++) { TruffleObject scopeObject = scopes[i]; int keyInfo = ForeignAccess.sendKeyInfo(keyInfoNode, scopeObject, identifier); if (KeyInfo.isRemovable(keyInfo)) { return ForeignAccess.sendRemove(removeNode, scopeObject, identifier); } else if (KeyInfo.isExisting(keyInfo)) { CompilerDirectives.transferToInterpreter(); throw UnsupportedMessageException.raise(Message.REMOVE); } } } CompilerDirectives.transferToInterpreter(); throw UnknownIdentifierException.raise(identifier); }
try { int keyInfo = ForeignAccess.sendKeyInfo(getDebugger().getMessageNodes().keyInfo, object, name); if (!KeyInfo.isExisting(keyInfo)) { return null; } else {