|
14 | 14 | import com.oracle.truffle.api.TruffleLanguage.ContextReference;
|
15 | 15 | import com.oracle.truffle.api.dsl.CachedContext;
|
16 | 16 | import com.oracle.truffle.api.frame.MaterializedFrame;
|
| 17 | +import com.oracle.truffle.api.nodes.EncapsulatingNodeReference; |
17 | 18 | import com.oracle.truffle.api.nodes.Node;
|
18 | 19 | import com.oracle.truffle.api.nodes.NodeUtil;
|
19 | 20 | import com.oracle.truffle.api.profiles.BranchProfile;
|
@@ -115,27 +116,40 @@ protected Object alwaysInlinedUncached(
|
115 | 116 | self,
|
116 | 117 | block,
|
117 | 118 | args,
|
118 |
| - contextRef); |
| 119 | + contextRef, |
| 120 | + isAdoptable()); |
119 | 121 | }
|
120 | 122 |
|
121 | 123 | @TruffleBoundary // getUncachedAlwaysInlinedMethodNode(method) and arity are not PE constants
|
122 | 124 | private Object alwaysInlinedBoundary(
|
123 | 125 | MaterializedFrame frame, Object callerData, InternalMethod method, Object self, Object block, Object[] args,
|
124 |
| - ContextReference<RubyContext> contextRef) { |
125 |
| - return alwaysInlined( |
126 |
| - frame, |
127 |
| - callerData, |
128 |
| - method, |
129 |
| - self, |
130 |
| - block, |
131 |
| - args, |
132 |
| - method.getCallTarget(), |
133 |
| - method, |
134 |
| - getUncachedAlwaysInlinedMethodNode(method), |
135 |
| - method.getSharedMethodInfo().getArity(), |
136 |
| - BranchProfile.getUncached(), |
137 |
| - BranchProfile.getUncached(), |
138 |
| - contextRef); |
| 126 | + ContextReference<RubyContext> contextRef, boolean cachedToUncached) { |
| 127 | + EncapsulatingNodeReference encapsulating = null; |
| 128 | + Node prev = null; |
| 129 | + if (cachedToUncached) { |
| 130 | + encapsulating = EncapsulatingNodeReference.getCurrent(); |
| 131 | + prev = encapsulating.set(this); |
| 132 | + } |
| 133 | + try { |
| 134 | + return alwaysInlined( |
| 135 | + frame, |
| 136 | + callerData, |
| 137 | + method, |
| 138 | + self, |
| 139 | + block, |
| 140 | + args, |
| 141 | + method.getCallTarget(), |
| 142 | + method, |
| 143 | + getUncachedAlwaysInlinedMethodNode(method), |
| 144 | + method.getSharedMethodInfo().getArity(), |
| 145 | + BranchProfile.getUncached(), |
| 146 | + BranchProfile.getUncached(), |
| 147 | + contextRef); |
| 148 | + } finally { |
| 149 | + if (cachedToUncached) { |
| 150 | + encapsulating.set(prev); |
| 151 | + } |
| 152 | + } |
139 | 153 | }
|
140 | 154 |
|
141 | 155 | protected AlwaysInlinedMethodNode createAlwaysInlinedMethodNode(InternalMethod method) {
|
|
0 commit comments