File tree Expand file tree Collapse file tree 4 files changed +49
-0
lines changed Expand file tree Collapse file tree 4 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ include(AddSwiftBenchmarkSuite)
17
17
set (SWIFT_BENCH_MODULES
18
18
single-source/unit-tests/ObjectiveCBridging
19
19
single-source/unit-tests/ObjectiveCBridgingStubs
20
+ single-source/unit-tests/ObjectiveCNoBridgingStubs
20
21
single-source/unit-tests/StackPromo
21
22
single-source/Ackermann
22
23
single-source/AngryPhonebook
Original file line number Diff line number Diff line change @@ -157,6 +157,12 @@ function (swift_benchmark_compile_archopts)
157
157
get_filename_component (module_name "${module_name_path} " NAME )
158
158
159
159
if (module_name )
160
+ set (extra_options "" )
161
+ # For this file we disable automatic bridging between Foundation and swift.
162
+ if ("${module_name} " STREQUAL "ObjectiveCNoBridgingStubs" )
163
+ set (extra_options "-Xfrontend"
164
+ "-disable-swift-bridge-attr" )
165
+ endif ()
160
166
set (objfile "${objdir} /${module_name} .o" )
161
167
set (swiftmodule "${objdir} /${module_name} .swiftmodule" )
162
168
set (source "${srcdir} /${module_name_path} .swift" )
@@ -168,6 +174,7 @@ function (swift_benchmark_compile_archopts)
168
174
"${srcdir} /${module_name_path} .swift"
169
175
COMMAND "${SWIFT_EXEC} "
170
176
${common_options}
177
+ ${extra_options}
171
178
"-parse-as-library"
172
179
${bench_flags}
173
180
"-module-name" "${module_name} "
Original file line number Diff line number Diff line change
1
+ //===--- ObjectiveCNoBridgingStubs.swift ----------------------------------===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
6
+ // Licensed under Apache License v2.0 with Runtime Library Exception
7
+ //
8
+ // See http://swift.org/LICENSE.txt for license information
9
+ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
+ //
11
+ //===----------------------------------------------------------------------===//
12
+ //
13
+ // This file is compiled with -Xfrontend -disable-swift-bridge-attr. No bridging
14
+ // of swift types happens.
15
+ //
16
+ //===----------------------------------------------------------------------===//
17
+
18
+ import TestsUtils
19
+ import Foundation
20
+ import ObjectiveCTests
21
+
22
+ @inline ( never)
23
+ func testObjectiveCBridgeStubFromNSStringRef( ) {
24
+ let b = BridgeTester ( )
25
+ var nsString : NSString = NSString ( )
26
+ for _ in 0 ..< 10_000 {
27
+ nsString = b. testToString ( )
28
+ }
29
+ CheckResults ( nsString. isEqual ( to: " Default string value no tagged pointer " as NSString ) , " Wrong value returned " )
30
+ }
31
+
32
+ @inline ( never)
33
+ public func run_ObjectiveCBridgeStubFromNSStringRef( N: Int ) {
34
+ autoreleasepool {
35
+ for _ in 0 ..< N {
36
+ testObjectiveCBridgeStubFromNSStringRef ( )
37
+ }
38
+ }
39
+ }
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ import NopDeinit
65
65
import ObjectAllocation
66
66
import ObjectiveCBridging
67
67
import ObjectiveCBridgingStubs
68
+ import ObjectiveCNoBridgingStubs
68
69
import OpenClose
69
70
import Phonebook
70
71
import PolymorphicCalls
@@ -171,6 +172,7 @@ precommitTests = [
171
172
" ObjectiveCBridgeStubToNSString " : run_ObjectiveCBridgeStubToNSString,
172
173
" ObjectiveCBridgeStubFromArrayOfNSString " : run_ObjectiveCBridgeStubFromArrayOfNSString,
173
174
" ObjectiveCBridgeStubToArrayOfNSString " : run_ObjectiveCBridgeStubToArrayOfNSString,
175
+ " ObjectiveCBridgeStubFromNSStringRef " : run_ObjectiveCBridgeStubFromNSStringRef,
174
176
" OpenClose " : run_OpenClose,
175
177
" Phonebook " : run_Phonebook,
176
178
" PolymorphicCalls " : run_PolymorphicCalls,
You can’t perform that action at this time.
0 commit comments