Skip to content

Commit

Permalink
Merge pull request #12 from apple/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
JacobMao authored Jun 12, 2018
2 parents a3fbb5f + f65000a commit a72b451
Show file tree
Hide file tree
Showing 605 changed files with 19,186 additions and 5,188 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,14 @@ endforeach()
#
# User-configurable Darwin-specific options.
#

option(SWIFT_EMBED_BITCODE_SECTION
"If non-empty, embeds LLVM bitcode binary sections in the standard library and overlay binaries for supported platforms"
FALSE)

option(SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS
"If non-empty, when embedding the LLVM bitcode binary sections into the relevant binaries, pass in -bitcode_hide_symbols. Does nothing if SWIFT_EMBED_BITCODE_SECTION is set to false."
FALSE)

option(SWIFT_RUNTIME_CRASH_REPORTER_CLIENT
"Whether to enable CrashReporter integration"
FALSE)
Expand Down Expand Up @@ -893,6 +896,8 @@ if(HAVE_EL_WGETS)
endif()
cmake_pop_check_state()

check_symbol_exists(wait4 "sys/wait.h" HAVE_WAIT4)

if (LLVM_ENABLE_DOXYGEN)
message(STATUS "Doxygen: enabled")
endif()
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ supported host development operating systems.

#### macOS

To build for macOS, you need [Xcode 9.3](https://developer.apple.com/xcode/downloads/).
To build for macOS, you need [Xcode 10 beta](https://developer.apple.com/xcode/downloads/).
The required version of Xcode changes frequently, and is often a beta release.
Check this document or the host information on <https://ci.swift.org> for the
current required version.
Expand Down Expand Up @@ -208,7 +208,7 @@ then run the build product in Terminal.
Make sure you are using the [correct release](#macos) of Xcode.

If you have changed Xcode versions but still encounter errors that appear to
be related to the Xcode version, try passing `--rebuild` to `build-script`.
be related to the Xcode version, try passing `--clean` to `build-script`.

When a new version of Xcode is released, you can update your build without
recompiling the entire project by passing the `--reconfigure` option.
Expand Down
25 changes: 25 additions & 0 deletions apinotes/os.apinotes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Typedefs:
Availability: nonswift
- Name: os_log_t
Availability: nonswift
- Name: os_signpost_type_t
SwiftName: OSSignpostType
Classes:
- Name: OS_os_log
SwiftName: OSLog
Expand All @@ -20,10 +22,22 @@ Enumerators:
SwiftPrivate: true
- Name: OS_LOG_TYPE_FAULT
SwiftPrivate: true
- Name: OS_SIGNPOST_INTERVAL_BEGIN
SwiftPrivate: true
- Name: OS_SIGNPOST_INTERVAL_END
SwiftPrivate: true
- Name: OS_SIGNPOST_EVENT
SwiftPrivate: true
Functions:
- Name: _os_log_impl
Availability: nonswift
AvailabilityMsg: 'Use os_log'
- Name: _os_log_error_impl
Availability: nonswift
AvailabilityMsg: 'Use os_log'
- Name: _os_log_fault_impl
Availability: nonswift
AvailabilityMsg: 'Use os_log'
- Name: _os_log_sensitive_deprecated
Availability: nonswift
- Name: _os_trace_with_buffer
Expand All @@ -40,3 +54,14 @@ Functions:
NullabilityOfRet: N
- Name: os_log_is_debug_enabled
Availability: nonswift
- Name: os_signpost_enabled
SwiftPrivate: true
- Name: os_signpost_id_generate
SwiftPrivate: true
NullabilityOfRet: O
- Name: os_signpost_id_make_with_pointer
SwiftPrivate: true
NullabilityOfRet: O
- Name: _os_signpost_emit_with_name_impl
Availability: nonswift
AvailabilityMsg: 'Use os_signpost'
93 changes: 27 additions & 66 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# -*- mode: cmake -*-
################################################################################
# WARNING: This file is automatically generated from templates and should not
# be directly modified. Instead, make changes to CMakeLists.text.gyb and run
# scripts/generate_harness/generate_harness.py to regenerate this file.
################################################################################

cmake_minimum_required(VERSION 2.8.12)

Expand All @@ -20,12 +15,16 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
endif()

if(SWIFT_BENCHMARK_SUBCMAKE_BUILD)
precondition(SWIFT_BENCHMARK_BUILD_STANDALONE
precondition(SWIFT_BENCHMARK_BUILT_STANDALONE
MESSAGE "If we are a subcmake build, we must be built standalone")
endif()

include(AddSwiftBenchmarkSuite)

#===-----------------------------------------------------------------------===#
# Declarative Description of Benchmarks
#===-----------------------------------------------------------------------===#

set(SWIFT_BENCH_MODULES
single-source/Ackermann
single-source/AngryPhonebook
Expand All @@ -45,6 +44,7 @@ set(SWIFT_BENCH_MODULES
single-source/BitCount
single-source/ByteSwap
single-source/COWTree
single-source/COWArrayGuaranteedParameterOverhead
single-source/CString
single-source/CSVParsing
single-source/Calculator
Expand Down Expand Up @@ -109,6 +109,7 @@ set(SWIFT_BENCH_MODULES
single-source/ObserverForwarderStruct
single-source/ObserverPartiallyAppliedMethod
single-source/ObserverUnappliedMethod
single-source/OpaqueConsumingUsers
single-source/OpenClose
single-source/PartialApplyDynamicType
single-source/Phonebook
Expand All @@ -124,6 +125,7 @@ set(SWIFT_BENCH_MODULES
single-source/Queue
single-source/RC4
single-source/RGBHistogram
single-source/Radix2CooleyTukey
single-source/RandomShuffle
single-source/RandomValues
single-source/RangeAssignment
Expand Down Expand Up @@ -171,7 +173,7 @@ set(SWIFT_MULTISOURCE_SWIFT3_BENCHES

set(PrimsSplit_sources
multi-source/PrimsSplit/Prims.swift
multi-source/PrimsSplit/main.swift)
multi-source/PrimsSplit/Prims_main.swift)

set(SWIFT_MULTISOURCE_SWIFT4_BENCHES
)
Expand All @@ -189,37 +191,9 @@ set(BENCH_DRIVER_LIBRARY_MODULES
utils/DriverUtils
)

add_definitions(-DSWIFT_EXEC -DSWIFT_LIBRARY_PATH -DONLY_PLATFORMS
-DSWIFT_OPTIMIZATION_LEVELS -DSWIFT_BENCHMARK_EMIT_SIB)

if(NOT ONLY_PLATFORMS)
set(ONLY_PLATFORMS "macosx" "iphoneos" "appletvos" "watchos")
endif()

if(NOT SWIFT_EXEC)
runcmd(COMMAND "xcrun" "-f" "swiftc"
VARIABLE SWIFT_EXEC
ERROR "Unable to find Swift driver")
endif()

if(NOT SWIFT_LIBRARY_PATH)
get_filename_component(tmp_dir "${SWIFT_EXEC}" DIRECTORY)
get_filename_component(tmp_dir "${tmp_dir}" DIRECTORY)
set(SWIFT_LIBRARY_PATH "${tmp_dir}/lib/swift")
endif()

# If the CMAKE_C_COMPILER is already clang, don't find it again,
# thus allowing the --host-cc build-script argument to work here.
get_filename_component(c_compiler ${CMAKE_C_COMPILER} NAME)

if(${c_compiler} STREQUAL "clang")
set(CLANG_EXEC ${CMAKE_C_COMPILER})
else()
runcmd(COMMAND "xcrun" "-toolchain" "${SWIFT_DARWIN_XCRUN_TOOLCHAIN}" "-f" "clang"
VARIABLE CLANG_EXEC
ERROR "Unable to find Clang driver")
endif()

#===-----------------------------------------------------------------------===#
# Build Configuration
#===-----------------------------------------------------------------------===#

# You have to delete CMakeCache.txt in the swift build to force a
# reconfiguration.
Expand Down Expand Up @@ -276,34 +250,17 @@ set(BENCHOPTS_MULTITHREADED
"-whole-module-optimization" "-num-threads" "4")
set(BENCHOPTS_SINGLEFILE "")

set(macosx_arch "x86_64")
set(iphoneos_arch "arm64" "armv7")
set(appletvos_arch "arm64")
set(watchos_arch "armv7k")

set(macosx_ver "10.9")
set(iphoneos_ver "8.0")
set(appletvos_ver "9.1")
set(watchos_ver "2.0")

set(macosx_triple_platform "macosx")
set(iphoneos_triple_platform "ios")
set(appletvos_triple_platform "tvos")
set(watchos_triple_platform "watchos")

set(sdks)
set(platforms)
foreach(platform ${ONLY_PLATFORMS})
execute_process(
COMMAND "xcrun" "--sdk" "${platform}" "--show-sdk-path"
OUTPUT_VARIABLE ${platform}_sdk
RESULT_VARIABLE result
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if("${result}" MATCHES "0")
list(APPEND sdks "${${platform}_sdk}")
list(APPEND platforms ${platform})
endif()
endforeach()
configure_build()

#===-----------------------------------------------------------------------===#
# SDK Configuration
#===-----------------------------------------------------------------------===#

configure_sdks()

#===---------------------------------------------------------------------===#
# Statement of Configuration for Build Users
#===---------------------------------------------------------------------===#

message("--")
message("-- Swift Benchmark Suite:")
Expand All @@ -321,6 +278,10 @@ foreach(sdk ${sdks})
message("-- ${sdk}")
endforeach()

#===---------------------------------------------------------------------===#
# Build Rule Generation
#===---------------------------------------------------------------------===#

set(executable_targets)

set(srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
Expand Down
88 changes: 88 additions & 0 deletions benchmark/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// swift-tools-version:4.0

import PackageDescription
import Foundation

// This is a stop gap hack so we can edit benchmarks in Xcode.
let singleSourceLibraries: [String] = {
let f = FileManager.`default`
let dirURL = URL(fileURLWithPath: "single-source").absoluteURL
let fileURLs = try! f.contentsOfDirectory(at: dirURL,
includingPropertiesForKeys: nil)
return fileURLs.flatMap { (path: URL) -> String? in
let c = path.lastPathComponent.split(separator: ".")
// Too many components. Must be a gyb file.
if c.count > 2 {
return nil
}
if c[1] != "swift" {
return nil
}

// We do not support this test.
if c[0] == "ObjectiveCNoBridgingStubs" {
return nil
}

assert(c[0] != "PrimsSplit")
return String(c[0])
}
}()

let multiSourceLibraries: [String] = {
let f = FileManager.`default`
let dirURL = URL(fileURLWithPath: "multi-source").absoluteURL
let fileURLs = try! f.contentsOfDirectory(at: dirURL,
includingPropertiesForKeys: nil)
return fileURLs.map { (path: URL) -> String in
return path.lastPathComponent
}
}()

let p = Package(
name: "swiftbench",
products: [
.library(name: "TestsUtils", type: .static, targets: ["TestsUtils"]),
.library(name: "DriverUtils", type: .static, targets: ["DriverUtils"]),
.library(name: "ObjectiveCTests", type: .static, targets: ["ObjectiveCTests"]),
.executable(name: "SwiftBench", targets: ["SwiftBench"]),
.library(name: "PrimsSplit", type: .static, targets: ["PrimsSplit"])
] + singleSourceLibraries.map { .library(name: $0, type: .static, targets: [$0]) }
+ multiSourceLibraries.map { .library(name: $0, type: .static, targets: [$0]) },
targets: [
.target(name: "TestsUtils",
path: "utils",
sources: ["TestsUtils.swift"]),
.target(name: "DriverUtils",
dependencies: [.target(name: "TestsUtils")],
path: "utils",
sources: ["DriverUtils.swift", "ArgParse.swift"]),
.target(name: "SwiftBench",
dependencies: [
.target(name: "TestsUtils"),
.target(name: "ObjectiveCTests"),
.target(name: "DriverUtils"),
] + singleSourceLibraries.map { .target(name: $0) }
+ multiSourceLibraries.map { .target(name: $0) },
path: "utils",
sources: ["main.swift"]),
.target(name: "ObjectiveCTests",
path: "utils/ObjectiveCTests",
publicHeadersPath: "."),
] + singleSourceLibraries.map { x in
return .target(name: x,
dependencies: [
.target(name: "TestsUtils"),
.target(name: "ObjectiveCTests"),
],
path: "single-source",
sources: ["\(x).swift"])
} + multiSourceLibraries.map { x in
return .target(name: x,
dependencies: [
.target(name: "TestsUtils")
],
path: "multi-source/\(x)")
},
swiftLanguageVersions: [4]
)
Loading

0 comments on commit a72b451

Please sign in to comment.