Skip to content

Commit

Permalink
[Truffle] Fixes to .dup.freeze in Hash#[]=
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Oct 6, 2015
1 parent e5e7eb9 commit 8c52582
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -213,13 +213,13 @@ public Object setBucketsNotByIdentity(VirtualFrame frame, DynamicObject hash, Dy
return setBuckets(frame, hash, freezeAndDupIfNeeded(frame, key), value, byIdentity);
}

private DynamicObject freezeAndDupIfNeeded(VirtualFrame frame, DynamicObject key) {
private Object freezeAndDupIfNeeded(VirtualFrame frame, DynamicObject key) {
if (isFrozenNode == null) {
CompilerDirectives.transferToInterpreter();
isFrozenNode = insert(IsFrozenNodeGen.create(getContext(), getSourceSection(), null));
}

if (frozenProfile.profile(isFrozenNode.executeIsFrozen(key))) {
if (!frozenProfile.profile(isFrozenNode.executeIsFrozen(key))) {
if (dupNode == null) {
CompilerDirectives.transferToInterpreter();
dupNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
Expand All @@ -230,8 +230,7 @@ private DynamicObject freezeAndDupIfNeeded(VirtualFrame frame, DynamicObject key
freezeNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

final Object dupped = dupNode.call(frame, key, "dup", null);
return (DynamicObject) freezeNode.call(frame, dupped, "freeze", null);
return freezeNode.call(frame, dupNode.call(frame, key, "dup", null), "freeze", null);
} else {
return key;
}
Expand Down

0 comments on commit 8c52582

Please sign in to comment.