@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) int get(Object key) { Entry current = first; while (current != null) { if (current.key == key) { return current.value; } current = current.next; } return -1; }
@SuppressWarnings("deprecation") @Override public LoopExplosionKind getLoopExplosionKind(ResolvedJavaMethod method) { ExplodeLoop explodeLoop = getAnnotation(ExplodeLoop.class, method); if (explodeLoop == null) { return LoopExplosionKind.NONE; } // Support for the deprecated Truffle property until it is removed in a future Truffle // release. if (explodeLoop.merge()) { return LoopExplosionKind.MERGE_EXPLODE; } switch (explodeLoop.kind()) { case FULL_UNROLL: return LoopExplosionKind.FULL_UNROLL; case FULL_EXPLODE: return LoopExplosionKind.FULL_EXPLODE; case FULL_EXPLODE_UNTIL_RETURN: return LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN; case MERGE_EXPLODE: return LoopExplosionKind.MERGE_EXPLODE; default: throw new InternalError(String.format("Unknown Truffle LoopExplosionKind %s", explodeLoop.kind())); } }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) int get(Object key) { Entry current = first; while (current != null) { if (current.key == key) { return current.value; } current = current.next; } return -1; }
/** * Retrieves the segment of guest language source code that is represented by this Node, if * present; otherwise retrieves the segment represented by the nearest AST ancestor that has * this information. * * @return an approximation of the source code represented by this Node */ @ExplodeLoop public final SourceSection getEncapsulatingSourceSection() { Node current = this; while (current != null) { if (current.sourceSection != null) { return current.sourceSection; } current = current.parent; } return null; }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public boolean execute(JavaMethodDesc arg0Value, int arg1Value) { int state = state_; if (state != 0 /* is-active doCached(JavaMethodDesc, int, int, boolean) || doUncached(JavaMethodDesc, int) */) { if ((state & 0b1) != 0 /* is-active doCached(JavaMethodDesc, int, int, boolean) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg1Value == s1_.cachedArgsLength_)) { return IsApplicableByArityNode.doCached(arg0Value, arg1Value, s1_.cachedArgsLength_, s1_.applicableByArity_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(JavaMethodDesc, int) */) { return IsApplicableByArityNode.doUncached(arg0Value, arg1Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public int execute(Class<?> arg0Value, String arg1Value, boolean arg2Value) { int state = state_; if (state != 0 /* is-active doCached(Class<>, String, boolean, boolean, Class<>, String, int) || doUncached(Class<>, String, boolean) */) { if ((state & 0b1) != 0 /* is-active doCached(Class<>, String, boolean, boolean, Class<>, String, int) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg2Value == s1_.cachedStatic_) && (arg0Value == s1_.cachedClazz_) && (s1_.cachedName_.equals(arg1Value))) { return KeyInfoCacheNode.doCached(arg0Value, arg1Value, arg2Value, s1_.cachedStatic_, s1_.cachedClazz_, s1_.cachedName_, s1_.cachedKeyInfo_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(Class<>, String, boolean) */) { return KeyInfoCacheNode.doUncached(arg0Value, arg1Value, arg2Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value, arg2Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public HostMethodDesc execute(Class<?> arg0Value) { int state = state_; if (state != 0 /* is-active doCached(Class<>, Class<>, HostMethodDesc) || doUncached(Class<>) */) { if ((state & 0b1) != 0 /* is-active doCached(Class<>, Class<>, HostMethodDesc) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg0Value == s1_.cachedClazz_)) { return LookupConstructorNode.doCached(arg0Value, s1_.cachedClazz_, s1_.cachedMethod_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(Class<>) */) { return LookupConstructorNode.doUncached(arg0Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public Class<?> execute(Class<?> arg0Value, String arg1Value) { int state = state_; if (state != 0 /* is-active doCached(Class<>, String, Class<>, String, Class<>) || doUncached(Class<>, String) */) { if ((state & 0b1) != 0 /* is-active doCached(Class<>, String, Class<>, String, Class<>) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg0Value == s1_.cachedClazz_) && (s1_.cachedName_.equals(arg1Value))) { return LookupInnerClassNode.doCached(arg0Value, arg1Value, s1_.cachedClazz_, s1_.cachedName_, s1_.cachedInnerClass_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(Class<>, String) */) { return LookupInnerClassNode.doUncached(arg0Value, arg1Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public JavaMethodDesc execute(Class<?> arg0Value, String arg1Value, boolean arg2Value) { int state = state_; if (state != 0 /* is-active doCached(Class<>, String, boolean, boolean, Class<>, String, JavaMethodDesc) || doUncached(Class<>, String, boolean) */) { if ((state & 0b1) != 0 /* is-active doCached(Class<>, String, boolean, boolean, Class<>, String, JavaMethodDesc) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg2Value == s1_.cachedStatic_) && (arg0Value == s1_.cachedClazz_) && (s1_.cachedName_.equals(arg1Value))) { return LookupMethodNode.doCached(arg0Value, arg1Value, arg2Value, s1_.cachedStatic_, s1_.cachedClazz_, s1_.cachedName_, s1_.cachedMethod_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(Class<>, String, boolean) */) { return LookupMethodNode.doUncached(arg0Value, arg1Value, arg2Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value, arg2Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public HostMethodDesc execute(Class<?> arg0Value, String arg1Value, boolean arg2Value) { int state = state_; if (state != 0 /* is-active doCached(Class<>, String, boolean, boolean, Class<>, String, HostMethodDesc) || doUncached(Class<>, String, boolean) */) { if ((state & 0b1) != 0 /* is-active doCached(Class<>, String, boolean, boolean, Class<>, String, HostMethodDesc) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg2Value == s1_.cachedStatic_) && (arg0Value == s1_.cachedClazz_) && (s1_.cachedName_.equals(arg1Value))) { return LookupMethodNode.doCached(arg0Value, arg1Value, arg2Value, s1_.cachedStatic_, s1_.cachedClazz_, s1_.cachedName_, s1_.cachedMethod_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(Class<>, String, boolean) */) { return LookupMethodNode.doUncached(arg0Value, arg1Value, arg2Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value, arg2Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public Object execute(JavaFieldDesc arg0Value, JavaObject arg1Value) { int state = state_; if (state != 0 /* is-active doCached(SingleFieldDesc, JavaObject, SingleFieldDesc) || doUncached(SingleFieldDesc, JavaObject) */ && arg0Value instanceof SingleFieldDesc) { SingleFieldDesc arg0Value_ = (SingleFieldDesc) arg0Value; if ((state & 0b1) != 0 /* is-active doCached(SingleFieldDesc, JavaObject, SingleFieldDesc) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg0Value_ == s1_.cachedField_)) { return ReadFieldNode.doCached(arg0Value_, arg1Value, s1_.cachedField_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(SingleFieldDesc, JavaObject) */) { return ReadFieldNode.doUncached(arg0Value_, arg1Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public Object execute(CallTarget arg0Value, Object[] arg1Value) { int state = state_; if (state != 0 /* is-active executeDirect(CallTarget, Object[], CallTarget, DirectCallNode) || executeIndirect(CallTarget, Object[], IndirectCallNode) */) { if ((state & 0b1) != 0 /* is-active executeDirect(CallTarget, Object[], CallTarget, DirectCallNode) */) { ExecuteDirectData s1_ = this.executeDirect_cache; while (s1_ != null) { if ((arg0Value == s1_.cachedTarget_)) { return executeDirect(arg0Value, arg1Value, s1_.cachedTarget_, s1_.callNode_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active executeIndirect(CallTarget, Object[], IndirectCallNode) */) { return executeIndirect(arg0Value, arg1Value, this.executeIndirect_callNode_); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override protected Object executeImpl(TruffleObject arg0Value, Object[] arg1Value) { int state = state_; if (state != 0 /* is-active doCached(TruffleObject, Object[], ForeignAccess, DirectCallNode, DirectCallNode) || doGeneric(TruffleObject, Object[], IndirectCallNode) */) { if ((state & 0b1) != 0 /* is-active doCached(TruffleObject, Object[], ForeignAccess, DirectCallNode, DirectCallNode) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((InteropAccessNode.acceptCached(arg0Value, s1_.foreignAccess_, s1_.canHandleCall_))) { return InteropAccessNode.doCached(arg0Value, arg1Value, s1_.foreignAccess_, s1_.sendMessageCall_, s1_.canHandleCall_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doGeneric(TruffleObject, Object[], IndirectCallNode) */) { return doGeneric(arg0Value, arg1Value, this.generic_indirectCall_); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public JavaMethodDesc execute(Class<?> arg0Value) { int state = state_; if (state != 0 /* is-active doCached(Class<>, Class<>, JavaMethodDesc) || doUncached(Class<>) */) { if ((state & 0b1) != 0 /* is-active doCached(Class<>, Class<>, JavaMethodDesc) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg0Value == s1_.cachedClazz_)) { return LookupConstructorNode.doCached(arg0Value, s1_.cachedClazz_, s1_.cachedMethod_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(Class<>) */) { return LookupConstructorNode.doUncached(arg0Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override protected Object executeImpl(TruffleObject arg0Value, Object[] arg1Value) { int state = state_; if (state != 0 /* is-active doCached(TruffleObject, Object[], ForeignAccess, DirectCallNode, DirectCallNode) || doGeneric(TruffleObject, Object[], IndirectCallNode) */) { if ((state & 0b1) != 0 /* is-active doCached(TruffleObject, Object[], ForeignAccess, DirectCallNode, DirectCallNode) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((InteropAccessNode.acceptCached(arg0Value, s1_.foreignAccess_, s1_.canHandleCall_))) { return InteropAccessNode.doCached(arg0Value, arg1Value, s1_.foreignAccess_, s1_.sendMessageCall_, s1_.canHandleCall_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doGeneric(TruffleObject, Object[], IndirectCallNode) */) { return doGeneric(arg0Value, arg1Value, this.generic_indirectCall_); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public Class<?> execute(Class<?> arg0Value, String arg1Value) { int state = state_; if (state != 0 /* is-active doCached(Class<>, String, Class<>, String, Class<>) || doUncached(Class<>, String) */) { if ((state & 0b1) != 0 /* is-active doCached(Class<>, String, Class<>, String, Class<>) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg0Value == s1_.cachedClazz_) && (s1_.cachedName_.equals(arg1Value))) { return LookupInnerClassNode.doCached(arg0Value, arg1Value, s1_.cachedClazz_, s1_.cachedName_, s1_.cachedInnerClass_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(Class<>, String) */) { return LookupInnerClassNode.doUncached(arg0Value, arg1Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public HostFieldDesc execute(Class<?> arg0Value, String arg1Value, boolean arg2Value) { int state = state_; if (state != 0 /* is-active doCached(Class<>, String, boolean, boolean, Class<>, String, HostFieldDesc) || doUncached(Class<>, String, boolean) */) { if ((state & 0b1) != 0 /* is-active doCached(Class<>, String, boolean, boolean, Class<>, String, HostFieldDesc) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg2Value == s1_.cachedStatic_) && (arg0Value == s1_.cachedClazz_) && (s1_.cachedName_.equals(arg1Value))) { return LookupFieldNode.doCached(arg0Value, arg1Value, arg2Value, s1_.cachedStatic_, s1_.cachedClazz_, s1_.cachedName_, s1_.cachedField_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(Class<>, String, boolean) */) { return LookupFieldNode.doUncached(arg0Value, arg1Value, arg2Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value, arg2Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public int execute(Class<?> arg0Value, String arg1Value, boolean arg2Value) { int state = state_; if (state != 0 /* is-active doCached(Class<>, String, boolean, boolean, Class<>, String, int) || doUncached(Class<>, String, boolean) */) { if ((state & 0b1) != 0 /* is-active doCached(Class<>, String, boolean, boolean, Class<>, String, int) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg2Value == s1_.cachedStatic_) && (arg0Value == s1_.cachedClazz_) && (s1_.cachedName_.equals(arg1Value))) { return KeyInfoCacheNode.doCached(arg0Value, arg1Value, arg2Value, s1_.cachedStatic_, s1_.cachedClazz_, s1_.cachedName_, s1_.cachedKeyInfo_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(Class<>, String, boolean) */) { return KeyInfoCacheNode.doUncached(arg0Value, arg1Value, arg2Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value, arg2Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public JavaMethodDesc execute(Class<?> arg0Value) { int state = state_; if (state != 0 /* is-active doCached(Class<>, Class<>, JavaMethodDesc) || doUncached(Class<>) */) { if ((state & 0b1) != 0 /* is-active doCached(Class<>, Class<>, JavaMethodDesc) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg0Value == s1_.cachedClazz_)) { return LookupFunctionalMethodNode.doCached(arg0Value, s1_.cachedClazz_, s1_.cachedMethod_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(Class<>) */) { return LookupFunctionalMethodNode.doUncached(arg0Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value); }
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN) @Override public JavaFieldDesc execute(Class<?> arg0Value, String arg1Value, boolean arg2Value) { int state = state_; if (state != 0 /* is-active doCached(Class<>, String, boolean, boolean, Class<>, String, JavaFieldDesc) || doUncached(Class<>, String, boolean) */) { if ((state & 0b1) != 0 /* is-active doCached(Class<>, String, boolean, boolean, Class<>, String, JavaFieldDesc) */) { CachedData s1_ = this.cached_cache; while (s1_ != null) { if ((arg2Value == s1_.cachedStatic_) && (arg0Value == s1_.cachedClazz_) && (s1_.cachedName_.equals(arg1Value))) { return LookupFieldNode.doCached(arg0Value, arg1Value, arg2Value, s1_.cachedStatic_, s1_.cachedClazz_, s1_.cachedName_, s1_.cachedField_); } s1_ = s1_.next_; } } if ((state & 0b10) != 0 /* is-active doUncached(Class<>, String, boolean) */) { return LookupFieldNode.doUncached(arg0Value, arg1Value, arg2Value); } } CompilerDirectives.transferToInterpreterAndInvalidate(); return executeAndSpecialize(arg0Value, arg1Value, arg2Value); }