Skip to content

Commit 0b3c038

Browse files
committed
Rely on solely on numCacheNodes for node cost
Signed-off-by: Stefan Marr <[email protected]>
1 parent 93a7284 commit 0b3c038

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/trufflesom/interpreter/nodes/MessageSendNode.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,6 @@ public NodeCost getCost() {
182182
return NodeCost.UNINITIALIZED;
183183
}
184184

185-
GuardedDispatchNode cache = dispatchCache;
186-
187-
if (cache instanceof GenericDispatchNode) {
188-
return NodeCost.MEGAMORPHIC;
189-
}
190-
191185
int cacheSize = numCacheNodes;
192186

193187
if (cacheSize == 0) {
@@ -198,7 +192,10 @@ public NodeCost getCost() {
198192
return NodeCost.MONOMORPHIC;
199193
}
200194

201-
return NodeCost.POLYMORPHIC;
195+
if (cacheSize < AbstractDispatchNode.INLINE_CACHE_SIZE) {
196+
return NodeCost.POLYMORPHIC;
197+
}
198+
return NodeCost.MEGAMORPHIC;
202199
}
203200

204201
private PreevaluatedExpression specialize(final Object[] arguments) {

0 commit comments

Comments
 (0)