-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Improve ARMv7 support #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The compile process must be provided an ABI on ARM, otherwise it doesn't know whether the CPU supports hard float.
unfortunately again this is an API change, the declared types for arm 32 bit and i386 are Int due to the conversion from NSUInteger to Int; the two ways to approach cross arch compatibility here are to either change these to be in the form public let NSXMLNodePromoteSignificantWhitespace = 1 << 28 or #if arch(x86_64) // and other 64 bit arches go here
public var NSXMLNodePreserveCharacterReferences: Int { return 1 << 27 }
#else
public var NSXMLNodePreserveCharacterReferences: Int64 { return 1 << 27 }
#endif I agree that the signed type is inappropriate for these values; but the swift importer changes all access of NSUInteger to Int so either a) we would need to change the declaration in NSXML* on darwin or b) make an exception for 32 bit targets on the open source version. |
It seems like it’s not such a bad thing to define it to 64-bit on 32-bit platforms. It’s a bit wasteful, but if on the off-chance that someone sends these values from one platform to another, at least they’ll match in size.
|
perhaps it might be worthwhile to have a define for 32 bit platforms so that the #if statement can be simple (id guess this won't be the last place we are going to hit with this issue) |
Yes, I suspect that would be useful. For now, though, do you think a typealias would be appropriate here? I would rather not have the entire file be copy & paste. Something along the lines of:
The potential ugliness here (assuming that I understand it well enough that this would work) is that I suspect that alias would start showing up in autocompletes, leading to confusion. |
Type alias would be fine, however until we drop the NS prefix, perhaps this should be NSXMLNodeOptionRawType just for consistency sake when the mass change will be applied. |
This is intended to smooth issues with alternate definitions of Int on 32/64 bit platforms.
…undation Conflicts: Foundation/NSXMLNodeOptions.swift
looks good to me; merging in with one slight addendum to add arm64 checks too |
Thanks so much! Have a great break! |
[diagnostics] Fix caching of diagnostics across files and reopens
[pull] swiftwasm from main
This pull request addresses two issues. The first is that Int is used in NSXMLNodeOptions, but it tries to "set the high 12 bits" to '1'. The problem is that swift (correctly) identifies this as an overflow on a signed Int. If it is necessary for this to be Int, I suppose that an overflow bitwise or could be used (does such an operator exist?).
The second bit is a hard-coding of the ABI on ARM. This is a stopgap until it can either be provided by the swift/utils/build-script, or is correctly detected.