| Modifier and Type | Field and Description |
|---|---|
| private T |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addUsedVariables(List<Variable> l)
Implements abstract org. Append the list of variables used in this operand to the input list -- force every operand to implement this because a missing implementation can cause bad failures. |
| public T | |
| public boolean | canCopyPropagate()
Overrides org. Can we replace every use of a variable 'v' that contains the value of this operand with the operand itself? |
| public Operand | |
| public abstract T | createCacheObject(ThreadContext context)
Implementing class is responsible for constructing the cached value. |
| public boolean | hasKnownValue()
Overrides org. Do we know the value of this operand at compile-time? |
| public boolean | |
| public T | retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp)
Overrides org. retrieve the live value represented by this immutable literal. |
| cachedObject | back to summary |
|---|---|
| private T cachedObject | |
| ImmutableLiteral | back to summary |
|---|---|
| public ImmutableLiteral() | |
| addUsedVariables | back to summary |
|---|---|
| public void addUsedVariables(List<Variable> l) Implements abstract org. Doc from org. Append the list of variables used in this operand to the input list -- force every operand to implement this because a missing implementation can cause bad failures.
| |
| cachedObject | back to summary |
|---|---|
| public T cachedObject(ThreadContext context) Returns the cached object. If not then it asks class to create an object to cache. | |
| canCopyPropagate | back to summary |
|---|---|
| public boolean canCopyPropagate() Overrides org. Doc from org. Can we replace every use of a variable 'v' that contains the value of this operand with the operand itself? This takes importance when there are at least two uses of 'v' within this scope. Ex: v = [1,2,3]; x = v; y = v In this case, we cannot replace the occurrences of 'v' because we would then get x = [1,2,3]; y = [1,2,3] which would then result in two different array objects being constructed instead of a single one.
| |
| cloneForInlining | back to summary |
|---|---|
| public Operand cloneForInlining(CloneInfo ii) Implements abstract org.
| |
| createCacheObject | back to summary |
|---|---|
| public abstract T createCacheObject(ThreadContext context) Implementing class is responsible for constructing the cached value. | |
| hasKnownValue | back to summary |
|---|---|
| public boolean hasKnownValue() Overrides org. Doc from org. Do we know the value of this operand at compile-time? If we do then it may be possible to constant propagate (one case: We also know it is also an ImmutableLiteral).
| |
| isCached | back to summary |
|---|---|
| public boolean isCached() Has this object already been cached? | |
| retrieve | back to summary |
|---|---|
| public T retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) Overrides org. retrieve the live value represented by this immutable literal. An interesting property of knowing something cannot change at compile time is that all information necessary to construct it is also known at compile time. We don't pre-create these since we don't want to assume the cost of constructing literals which may never be used.
| |