Commit Graph

46 Commits

Author SHA1 Message Date
Evan Wilde
41d59b215a Update Triple.h location
Triple moved from ADT to TargetParser. Updating includes to reflect
that.
2023-07-17 10:53:42 -07:00
Yuta Saito
594d3adabd Merge pull request #39300 from kateinoigakukun/katei/wasm-least-valid-addr
[Wasm] Specify the least valid pointer for wasm32
2022-05-25 14:31:38 +09:00
Yuta Saito
6fd3ae7812 [Wasm] Specify the least valid pointer for wasm32
WebAssembly doesn't reserve low addresses but without "extra inhabitants" of
the pointer representation, runtime performance and memory footprint are
worse. So assume that compiler driver uses wasm-ld and --global-base=1024 to
reserve low 1KB.
2022-04-03 07:00:32 +00:00
Butta
7b2256f97b [android] Move the string and other tags in pointers to the second byte because Android enabled memory tagging
Starting with Android 11, AArch64 placed a tag in the top byte of pointers to
allocations, which has been slowly rolling out to more devices and collides
with Swift's tags. Moving these tags to the second byte works around this
problem.
2022-04-02 08:50:54 +05:30
Alsey Coleman Miller
0ab3eec987 Added PowerPC 32-bit support 2022-03-03 22:21:33 -05:00
Robert Widmann
0149ccd0ca Add arm64_32 support for Swift
Commit the platform definition and build script work necessary to
cross-compile for arm64_32.

arm64_32 is a variant of AARCH64 that supports an ILP32 architecture.
2021-04-20 14:59:04 -07:00
Andrew Trick
e7cbf1d8ba Add SWIFT_ABI_DEFAULT_REFERENCE_POISON_DEBUG_VALUE
Poison sentinel value recognized by LLDB as a former reference to a
potentially deinitialized object. It uses no spare bits and cannot point to
readable memory.

This is not ABI per-se but does stay in-sync with LLDB. If it becomes
out-of-sync, then users won't see a friendly diagnostic when
inspecting references past their lifetime.
2021-03-12 19:32:55 -08:00
Arnold Schwaighofer
ba901ad2ad IRGen: Enable update of extended frame pointer entry on x86_64 2021-03-05 07:39:52 -08:00
Arnold Schwaighofer
daa72d3cc5 Add llvm::Attribute::SwiftAsync to the context parameter
* Adds support for generating code that uses swiftasync parameter lowering.

* Currently only arm64's llvm lowering supports the swift_async_context_addr intrinsic.

* Add arm64e pointer signing of updated swift_async_context_addr.

This commit needs the PR llvm-project#2291.

* [runtime] unittests should use just-built compiler if the runtime did

This will start to matter with the introduction of usage of swiftasync parameters which only very recent compilers support.

rdar://71499498
2021-01-22 10:01:55 -08:00
Doug Gregor
2e3b220d44 [Basic] Remove swift::tripleIsAnySimulator().
It's just Triple::isSimulatorEnvironment() now.
2020-04-20 08:50:34 -07:00
Saleem Abdulrasool
fbbf61f297 Revert "[Darwin] Further restrict inference of the simulator environment" 2020-04-19 16:43:22 -07:00
Doug Gregor
992ca5651a [Basic] Remove swift::tripleIsAnySimulator().
It's just Triple::isSimulatorEnvironment() now.
2020-04-16 11:42:07 -07:00
rposts
12be5b598c ConfigureSystemZ changes 2018-11-09 17:27:58 -05:00
Mike Ash
fa4178c5e8 [IRGen][Runtime] Adjust the ObjC reserved bits on x86-64 to exactly match what the target uses.
Previously we had a single mask for all x86-64 targets which included both the top and bottom bits. This accommodated simulators, which use the top bit, while macOS uses the bottom bit, but reserved one bit more than necessary on each. This change breaks out x86-64 simulators from non-simulators and reserves only the one bit used on each.

rdar://problem/34805348 rdar://problem/29765919
2018-10-04 12:34:08 -04:00
David Zarzycki
bebbd27855 [IRGen] Fix 32-bit ARM extra inhabitant logic
This reverts:
89768cb3a3
06b566f269
2018-07-25 16:54:27 -04:00
David Zarzycki
057bbb366a [IRGen] Adopt reference storage type meta-programming macros
This commit also fixes reference storage extra inhabitant bugs.
2018-06-30 11:48:47 -04:00
swift-ci
ed1cf3bc48 Merge remote-tracking branch 'origin/master' into master-next 2018-01-02 15:29:18 -08:00
Chris Lattner
415cd50ba2 Reduce array abstraction on apple platforms dealing with literals (#13665)
* Reduce array abstraction on apple platforms dealing with literals

Part of the ongoing quest to reduce swift array literal abstraction
penalties: make the SIL optimizer able to eliminate bridging overhead
 when dealing with array literals.

Introduce a new classify_bridge_object SIL instruction to handle the
logic of extracting platform specific bits from a Builtin.BridgeObject
value that indicate whether it contains a ObjC tagged pointer object,
or a normal ObjC object. This allows the SIL optimizer to eliminate
these, which allows constant folding a ton of code. On the example
added to test/SILOptimizer/static_arrays.swift, this results in 4x
less SIL code, and also leads to a lot more commonality between linux
and apple platform codegen when passing an array literal.

This also introduces a couple of SIL combines for patterns that occur
in the array literal passing case.
2018-01-02 15:23:48 -08:00
Bob Wilson
5b61cb85ac master-next: Update comment style in inline asm to match clang r311325.
LLVM no longer accepts hash markers for comments.
2017-08-22 13:00:58 -07:00
Saleem Abdulrasool
0f48f11eb6 IRGen: treat thumb as ARM
Targets may be canonicalised to thumb* rather than arm*.  The target is
an overlapping ISA, and should be treated similarly.
2017-02-27 16:54:23 -08:00
Joe Groff
24367fa5d9 Runtime: Have native refcounting entry points ignore negative pointer values on x86-64 and arm64.
The high half of the address space is used by the kernel in these architectures, and it would be useful for us to be able to pack small values into places the ABI otherwise requires a refcountable pointer, such as closures and maybe refcounted existentials.
2017-02-24 16:02:11 -08:00
Saleem Abdulrasool
ee7b4e589e IRGen: use a more portable comment leader
MachO uses ;, other targets use #.  This would result in a rather
cryptic error message when building libdispatch for Linux AArch64:

    <inline asm>:1:27: error: unexpected token in argument list
            mov     fp, fp          ; marker for objc_retainAutoreleaseReturnValue
                                                 ^
    LLVM ERROR: Error parsing inline asm
2017-02-11 15:01:09 -08:00
Greg Parker
ea94be6f90 [runtime] Clean up documentation of the swift_once() implementation. 2017-01-27 19:37:47 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Bryan Chan
85fde8b1fb Add support for Linux s390x. LLVM's Swift calling convention support is used to ensure correct operations of C++ code in the runtime. This patch also includes some (incomplete) changes to enum handling to make enums work in most common cases. 2016-05-24 20:03:28 -04:00
Peter Cooper
7ec0e7348f Add more calls to the objc runtime for getting an object’s ISA.
Be more conservative in terms of masking ISAs.  This reduces tight coupling with the objc runtime.  This commit adds the required calls to IRGen and the runtime, and a test case to make sure IRGen is correct.
2016-03-10 15:07:20 -08:00
Anton Blanchard
b1827d8a8f Add powerpc64le Linux support
This patch adds powerpc64le Linux support. While the patch also adds
the matching powerpc64 bits, there are endian issues that need to be
sorted out.

The PowerPC LLVM changes for the swift ABI (eg returning three element
non-homogeneous aggregates) are still in the works, but a simple LLVM
fix to allow those aggregates results in swift passing all but 8
test cases.
2016-01-15 06:48:31 +00:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Joe Groff
b94a0e49b9 IRGen: Prepopulate class ObjC metadata with a null pointer instead of &_objc_empty_vtable.
The absolute symbol reference isn't needed on OS X >=10.9 or any iOS/watchOS, which are the only Darwin platforms Swift targets. Fixes rdar://problem/22339638.

Swift SVN r31367
2015-08-20 21:25:25 +00:00
Jordan Rose
57b341acd3 [IRGen] Eliminate ObjCBoolTypeSize.
We can get this information from Clang, and should.

Swift SVN r29123
2015-05-29 00:05:09 +00:00
Joe Groff
30200dd777 IRGen: Remove stale "MaxScalarsForDirectResult" hack for arm64.
We now let Clang handle C calling conventions, so we don't need a special value for this to kludge CG types into working. No reason for this to vary across archs for now.

Swift SVN r28397
2015-05-10 17:25:59 +00:00
Joe Groff
7b2a6e5e8d IRGen: Emit the "done" check for Builtin.once inline.
This matches how dispatch_once works in C, dramatically cutting the cost of a global accessor by avoiding the runtime call in the hot path and giving the global a unique branch for the CPU to predict away. For now, only do this for Darwin; non-ObjC platforms don't necessarily expose their "done" value as ABI like ours do.

While we're here, change "once" to take a thin function pointer. We don't ever emit global initializers with context dependencies, and this simplifies the runtime glue between swift_once and dispatch_once/std::call_once a bit.

Swift SVN r28166
2015-05-05 15:35:57 +00:00
Jordan Rose
a3a6c2695b Put the current target into LangOptions.
This has been long in coming. We always had it in IRGenOpts (in string form).
We had the version number in LangOpts for availability purposes. We had to
pass IRGenOpts to the ClangImporter to actually create the right target.
Some of our semantic checks tested the current OS by looking at the "os"
target configuration! And we're about to need to serialize the target for
debugging purposes.

Swift SVN r24468
2015-01-16 02:48:54 +00:00
John McCall
275ef489d4 Switch IRGen to use ClusteredBitVector.
IRGen uses a typedef, SpareBitVector, for its principal
purpose of tracking spare bits.  Other uses should not
use this typedef, and I've tried to follow that, but I
did this rewrite mostly with sed and may have missed
some fixups.

This should be almost completely NFC.  There may be
some subtle changes in spare bits for witness tables
and other off-beat pointer types.  I also fixed a bug
where IRGen thought that thin functions were two
pointers wide, but this wouldn't have affected anything
because we never store thin functions anyway, since
they're not a valid AST type.

This commit repplies r24305 with two fixes:

  - It fixes the computation of spare bits for unusual
    integer types to use the already-agreed-upon type
    size instead of recomputing it.  This fixes the
    i386 stdlib build.  Joe and I agreed that we should
    also change the size to use the LLVM alloc size
    instead of the next power of 2, but this patch
    does not do that yet.

  - It changes the spare bits in function types back
    to the empty set.  I'll be changing this in a
    follow-up, but it needs to be tied to runtime
    changes.  This fixes the regression test failures.

Swift SVN r24324
2015-01-09 21:06:37 +00:00
Dmitri Hrybenko
4caca5d098 Revert "Switch IRGen to use ClusteredBitVector."
This reverts commit r24305.  It broke the standard library build.

Swift SVN r24318
2015-01-09 18:25:21 +00:00
John McCall
6e41b3c742 Switch IRGen to use ClusteredBitVector.
IRGen uses a typedef, SpareBitVector, for its principal
purpose of tracking spare bits.  Other uses should not
use this typedef, and I've tried to follow that, but I
did this rewrite mostly with sed and may have missed
some fixups.

This should be almost completely NFC.  There may be
some subtle changes in spare bits for witness tables
and other off-beat pointer types.  I also fixed a bug
where IRGen thought that thin functions were two
pointers wide, but this wouldn't have affected anything
because we never store thin functions anyway, since
they're not a valid AST type.

Swift SVN r24305
2015-01-09 10:05:51 +00:00
Joe Groff
b5b860ad39 IRGen: Properly create ObjC protocols using the runtime in JIT mode.
Just injecting a new protocol descriptor into an already-running ObjC runtime isn't a good idea, since the runtime might have already canonized the protocol somewhere else, and it won't recognize that classes conform to protocols it doesn't know about.

Swift SVN r23313
2014-11-14 01:01:02 +00:00
Graham Batty
7fbf68fa1c Add target object format to swift target info.
Swift SVN r23306
2014-11-13 19:35:11 +00:00
Joe Groff
df13cab7a8 IRGen: Stop marking witness table symbols as dynamically referenced.
This should no longer be necessary now that we no longer directly dlsym their symbol names.

Swift SVN r23085
2014-11-03 17:34:37 +00:00
Dmitri Hrybenko
1bc0053a6c Only emit used markers for witness tables on Darwin
The inline assembly we emit is only valid for Mach-O.

Swift SVN r22511
2014-10-03 23:53:30 +00:00
John McCall
590c25479d Use isa-masking to read the class object pointer from
instances of Swift subclasses of ObjC classes.

We were already doing this in the runtime.  This patch
unhides the runtime's mask word (swift_isaMask) and makes
IR-gen take advantage of it when it can.

Swift SVN r21592
2014-08-29 21:36:53 +00:00
Dmitri Hrybenko
fe326db2f5 Update for upstream LLVM changes
Swift SVN r20409
2014-07-23 16:15:20 +00:00
Joe Groff
ac903bf943 IRGen: Make our use of spare bits in heap objects tagged-pointer-safe.
Don't use spare bits on platforms that use ObjC tagged pointers when an enum payload involves a class-constrained existential, archetype, or ObjC-defined class type. If a payload is of a Swift-defined class type, we can still assume it's a real pointer and use its spare bits. Add an @unsafe_no_objc_tagged_pointer attribute that can be applied to protocols to denote that existentials bounded by that protocol can use spare bits; this is necessary to preserve the layout of bridged Array and Dictionary types, which should not be bound to tagged pointer types in practice (fingers crossed). Fixes <rdar://problem/16270219>.

Swift SVN r18781
2014-06-10 17:07:47 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Joe Groff
c3d1f0d661 IRGen: Sketch out a SwiftTargetInfo class with fun facts about pointers.
Start out with pointer spare bits, heap object alignment, null page size, and ObjC reserved bits, and provide static values for X86-64 and for a worst-case generic platform.

Swift SVN r7833
2013-08-31 17:01:02 +00:00