@Retention(value=CLASS) @Target(value=TYPE) public @interface GenerateUncached
getUncached()
on the generated node.
GenerateUncached is inherited to subclasses if GenerateUncached.inherit()
is set to true
(default false
).
The generated code for the uncached version is based on the specialization closure. The
specialization closure only includes specializations that were are not replaced by others. This,
for example, automatically excludes inline caches from the closure. Uses of the Cached
annotation will automatically use getUncached instead of a cached
version to initialize the cache.
A node subclass must fullfill the following requirements in order to be uncachable:
Cached
parameters provide valid uncached
initializers.
NodeChild
or NodeField
annotations then they will return constant
null
or the primitive equivalent for the uncached node.
Example:
@GenerateUncached abstract static class UncachableNode extends Node { abstract Object execute(Object arg); @Specialization(guards = "v == cachedV") static Object doCached(int v, @Cached("v") int cachedV) { // do cached } @Specialization(replaces = "doCached") static String doGeneric(int v) { // do uncached } }This node produces the following uncached version of the execute method:
@Override Object execute(Object arg0Value) { if (arg0Value instanceof Integer) { int arg0Value_ = (int) arg0Value; return UncachableNode.doGeneric(arg0Value_); } throw new UnsupportedSpecializationException(this, new Node[]{null}, arg0Value); }
Cached
Modifier and Type | Optional Element and Description |
---|---|
boolean |
inherit
Inherits the semantics of the annotation to subclasses.
|
boolean |
value
If
true enables the generation of an uncached version of this
specializing node. |
public abstract boolean value
true
enables the generation of an uncached version of this
specializing
node. It is disabled by default.