mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
34 lines
838 B
Swift
34 lines
838 B
Swift
//===--- GlobalClass.swift ------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Test inline cache with a global class. Make sure the retain|release pair
|
|
// for the fast path is removed in the loop.
|
|
import TestsUtils
|
|
|
|
class A
|
|
{
|
|
func f(a : Int) -> Int
|
|
{
|
|
return a + 1
|
|
}
|
|
}
|
|
|
|
var x = 0
|
|
var a = A()
|
|
@inline(never)
|
|
public func run_GlobalClass(N: Int) {
|
|
for _ in 0..<N
|
|
{
|
|
x = a.f(x)
|
|
}
|
|
}
|