Skip to content

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Nov 28, 2018

_dynamicCastToAnyHashable assumed that _swift_convertToAnyHashableIndirect takes its argument at +1, but that is no longer the case.

rdar://problem/44686587

_dynamicCastToAnyHashable assumed that _swift_convertToAnyHashableIndirect takes its argument at +1, but that is no longer the case.

rdar://problem/44686587
@mikeash mikeash requested review from gottesmm and rjmccall November 28, 2018 20:26
@mikeash
Copy link
Contributor Author

mikeash commented Nov 28, 2018

@swift-ci please test

do {
let tracked = LifetimeTracked(42)
let anyHashable = AnyHashable(tracked)
let anyObject = anyHashable as AnyObject
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is testing two different cases. Aren't there 3 types of cast consumption? I think you will need a full on address only type to test that, no? Maybe my memory is wrong.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 331f0d2

sourceType->deallocateBufferIn(&buffer);
// Destroy the value if requested.
if (flags & DynamicCastFlags::TakeOnSuccess) {
sourceType->vw_destroy(source);
Copy link
Contributor

@rjmccall rjmccall Nov 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other way of doing this, by the way, would be to mark the intrinsic parameter as __owned. I don't have an opinion about whether TakeOnSuccess or !TakeOnSuccess is more important to optimize.

The call to swift_unboxFromSwiftValueWithType needs to destroy the value on success when requested in the flags.

rdar://problem/44686587
@mikeash
Copy link
Contributor Author

mikeash commented Nov 29, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 331f0d2

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 331f0d2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants