Commit Graph

63 Commits

Author SHA1 Message Date
Zhuowei Zhang
7c502b6344 Port to Android
This adds an Android target for the stdlib. It is also the first
example of cross-compiling outside of Darwin.

Mailing list discussions:

1. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151207/000171.html
2. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000492.html

The Android variant of Swift may be built using the following `build-script`
invocation:

```
$ utils/build-script \
  -R \                                           # Build in ReleaseAssert mode.
  --android \                                    # Build for Android.
  --android-ndk ~/android-ndk-r10e \             # Path to an Android NDK.
  --android-ndk-version 21 \
  --android-icu-uc ~/libicu-android/armeabi-v7a/libicuuc.so \
  --android-icu-uc-include ~/libicu-android/armeabi-v7a/icu/source/common \
  --android-icu-i18n ~/libicu-android/armeabi-v7a/libicui18n.so \
  --android-icu-i18n-include ~/libicu-android/armeabi-v7a/icu/source/i18n/
```

Android builds have the following dependencies, as can be seen in
the build script invocation:

1. An Android NDK of version 21 or greater, available to download
   here: http://developer.android.com/ndk/downloads/index.html.
2. A libicu compatible with android-armv7.
2016-04-12 19:26:21 -04:00
Dmitri Gribenko
9ee833a594 Eliminate a global constructor from the runtime 2016-03-31 09:56:01 -07:00
swift-ci
1221562e8e Merge pull request #1970 from apple/deterministic-PRNG-in-SwiftPrivate 2016-03-30 22:37:23 -07:00
Dmitri Gribenko
c5a11b0dc0 stdlib testing: make PRNG from SwiftPrivate deterministic 2016-03-30 19:35:23 -07:00
Dmitri Gribenko
495cade645 Drop the libbsd dependency
We were only using arc4random, and now we use C++ <random> instead.  See
also PR #1939.
2016-03-30 17:37:21 -06:00
Han Sangjin
5c1854bfcf stdlib: Portable random function
Changed rand32() implementation using a random engine in C++11 <random>.
2016-03-31 04:39:46 +09:00
Ian Partridge
fbf11ce054 [stdlib] Fix indentation 2016-03-01 20:49:53 +00:00
Ian Partridge
259d57bbe7 [stdlib] Use fwrite(3) in print() 2016-03-01 15:55:52 +00:00
Han Sangjin
e06c7136cb Porting to Cygwin. rebased and squashed 2016-02-22 13:20:21 +09:00
Kevin Ballard
ac1996000e [Stdlib] Remove all redundant stdout locking when printing
* Switch to calling `putchar_unlocked()` instead of `putchar()` for
  actual printing. We're already locking stdout with `flockfile()`, so
  there's no need for the redundant lock that `putchar()` uses.
* Add an explicit lock to the output stream in `dump()`. This means the
  entire dump is printed with the lock held, which will prevent the
  output of `dump()` from mixing with prints on other threads.
* Use `_debugPrint_unlocked()` instead of `debugPrint()` in
  `_adHocPrint()`. The output stream is already locked while this
  function is executing. Rename the function to `_adHocPrint_unlocked()`
  to make this explicit.
* Use `targetStream.write()` and `_print_unlocked()` instead of
  `print()` in `_dumpObject()`. This removes the redundant locking, and
  also eliminates the creation of intermediate strings. Rename the
  function to `_dumpObject_unlocked()` to make this explicit.
* Use `targetStream.write()`, `_print_unlocked()`, and
  `_debugPrint_unlocked()` in `_dumpSuperclass()`. This removes the
  redundant locking, and also eliminates the creation of intermediate
  strings. Rename the function to `_dumpSuperclass_unlocked()` to make
  this explicit.
* Use `_debugPrint_unlocked()` instead of `debugPrint()` in
  `String.init(reflecting:)`. This shouldn't really make much of a
  difference but it matches the usage of `_print_unlocked()` in
  `String.init(_:)`.

The net result is that all printing is still covered under locks like
before, but stdout is never recursively locked. This should result in
slightly faster printing. In addition, `dump()` is now covered under a
single lock so it can't mix its output with prints from other threads.
2016-02-02 13:40:55 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Landon Fuller
d206dcba34 Define malloc_size() support for FreeBSD. 2015-12-04 12:26:06 -07:00
Joe Groff
69a206229d Runtime: Start splitting out stubs only needed by the standard library.
Set up a separate libSwiftStubs.a archive for C++ stub functionality that's needed by the standard library but not part of the core runtime interface. Seed it with the Stubs.cpp and LibcShims.cpp files, which consist only of stubs, though a few stubs are still strewn across the runtime code base.
2015-11-11 17:28:57 -08:00