|
27 | 27 | // pool which might be scoped such that repeatedly placing objects into it |
28 | 28 | // results in unbounded memory growth. |
29 | 29 |
|
30 | | -// On i386 the remove from autorelease pool optimization is foiled by the |
31 | | -// decomposedStringWithCanonicalMapping implementation. Instead, we use a local |
32 | | -// autorelease pool to prevent leaking of the temporary object into the callers |
33 | | -// autorelease pool. |
34 | | -// |
35 | | -// |
36 | | -// FIXME: Right now we force an autoreleasepool here on x86_64 where we really |
37 | | -// do not want to do so. The reason why is that without the autoreleasepool (or |
38 | | -// really something like a defer), we tail call |
39 | | -// objc_retainAutoreleasedReturnValue which blocks the hand shake. Evidently |
40 | | -// this is something that we do not want to do. See: |
41 | | -// b79ff50f1bca97ecfd053372f5f6dc9d017398bc. Until that is resolved, just create |
42 | | -// an autoreleasepool here on x86_64. On arm/arm64 we do not have such an issue |
43 | | -// since we use an assembly marker instead. |
44 | | -#if defined(__i386__) || defined(__x86_64__) |
45 | | -#define AUTORELEASEPOOL @autoreleasepool |
46 | | -#else |
47 | | -// On other platforms we rely on the remove from autorelease pool optimization. |
48 | | -#define AUTORELEASEPOOL |
49 | | -#endif |
50 | | - |
51 | 30 | SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_API |
52 | 31 | size_t swift_stdlib_NSStringHashValue(NSString *str, |
53 | 32 | bool isASCII) { |
54 | | - AUTORELEASEPOOL { |
55 | | - return isASCII ? str.hash : str.decomposedStringWithCanonicalMapping.hash; |
56 | | - } |
| 33 | + return isASCII ? str.hash : str.decomposedStringWithCanonicalMapping.hash; |
57 | 34 | } |
58 | 35 |
|
59 | 36 | SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_API |
60 | 37 | size_t |
61 | 38 | swift_stdlib_NSStringHashValuePointer(void *opaque, bool isASCII) { |
62 | 39 | NSString __unsafe_unretained *str = |
63 | 40 | (__bridge NSString __unsafe_unretained *)opaque; |
64 | | - AUTORELEASEPOOL { |
65 | | - return isASCII ? str.hash : str.decomposedStringWithCanonicalMapping.hash; |
66 | | - } |
| 41 | + return isASCII ? str.hash : str.decomposedStringWithCanonicalMapping.hash; |
67 | 42 | } |
68 | 43 |
|
69 | 44 | #else |
|
0 commit comments