Skip to content

Commit bd65bc3

Browse files
committed
---
yaml --- r: 278399 b: refs/heads/swift-5.1-old-llvm-branch c: 3199214 h: refs/heads/master i: 278397: d2c11a0 278395: 155e951 278391: 7f28812 278383: ee8397d 278367: 61b75f7 278335: 92b5a4e 278271: 79473d5
1 parent 36e4180 commit bd65bc3

File tree

65 files changed

+578
-1869
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+578
-1869
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-01-24-a: b6f62823aa5010b2ae53f15f72a57
12411241
refs/heads/marcrasi-astverifier-disable: 3fac766a23a77ebd0640296bfd7fc116ea60a4e0
12421242
refs/heads/revert-22227-a-tall-white-fountain-played: adfce60b2eaa54903ea189bed8a783bca609fa53
12431243
refs/heads/revert-22300-revert-22227-a-tall-white-fountain-played: 5f92040224df7dd4e618fdfb367349df64d8acad
1244-
refs/heads/swift-5.1-old-llvm-branch: eb459d5df6d6c513b36d711a9cf04e42441dc01b
1244+
refs/heads/swift-5.1-old-llvm-branch: 31992143ee9317b6ad7c5c9a083424c21e388862
12451245
refs/heads/swift-5.1-branch: 8060872acb4105d9655e020fe047e1ebcd77d0fb
12461246
refs/tags/swift-4.2.2-RELEASE: e429d1f1aaf59e69d38207a96e56265c7f6fccec
12471247
refs/tags/swift-5.0-DEVELOPMENT-SNAPSHOT-2019-02-02-a: 3e5a03d32ff3b1e9af90d6c1198c14f938379a6e

branches/swift-5.1-old-llvm-branch/cmake/modules/SwiftSharedCMakeConfig.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,10 @@ endmacro()
213213
# The product name, e.g. Swift or SourceKit. Used as prefix for some
214214
# cmake variables.
215215
macro(swift_common_unified_build_config product)
216+
set(PATH_TO_LLVM_SOURCE "${CMAKE_SOURCE_DIR}")
217+
set(PATH_TO_LLVM_BUILD "${CMAKE_BINARY_DIR}")
216218
set(${product}_PATH_TO_CLANG_BUILD "${CMAKE_BINARY_DIR}")
219+
set(PATH_TO_CLANG_BUILD "${CMAKE_BINARY_DIR}")
217220
set(CLANG_MAIN_INCLUDE_DIR "${LLVM_EXTERNAL_CLANG_SOURCE_DIR}/include")
218221
set(CLANG_BUILD_INCLUDE_DIR "${CMAKE_BINARY_DIR}/tools/clang/include")
219222
set(${product}_NATIVE_LLVM_TOOLS_PATH "${CMAKE_BINARY_DIR}/bin")

branches/swift-5.1-old-llvm-branch/docs/WindowsBuild.md

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ mkdir "S:\b\swift"
159159
pushd "S:\b\swift"
160160
cmake -G Ninja^
161161
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
162-
-DCMAKE_C_COMPILER=cl^
163-
-DCMAKE_CXX_COMPILER=cl^
162+
-DCMAKE_C_COMPILER=clang-cl^
163+
-DCMAKE_CXX_COMPILER=clang-cl^
164164
-DCMAKE_EXE_LINKER_FLAGS:STRING="/INCREMENTAL:NO"^
165165
-DCMAKE_SHARED_LINKER_FLAGS:STRING="/INCREMENTAL:NO"^
166166
-DSWIFT_INCLUDE_DOCS=OFF^
@@ -220,9 +220,9 @@ Running the testsuite on Windows has additional external dependencies. You must
220220
2. diffutils
221221
3. grep
222222
4. sed
223-
223+
224224
```cmd
225-
path S:\thirdparty\icu4c-63_1-Win64-MSVC2017\bin64;S:\b\swift\bin;S:\b\swift\libdispatch-prefix\bin;%PATH%;%ProgramFiles(x86)%\GnuWin32\bin
225+
path S:\b\swift\bin;S:\b\swift\libdispatch-prefix\bin;%PATH%;%ProgramFiles(x86)%\GnuWin32\bin;S:\thirdparty\icu4c-63_1-Win64-MSVC2017\lib64
226226
ninja -C S:\b\swift check-swift
227227
```
228228

@@ -236,18 +236,14 @@ cmake -G Ninja^
236236
-DCMAKE_C_COMPILER=clang-cl^
237237
-DCMAKE_CXX_COMPILER=clang-cl^
238238
-DCMAKE_SWIFT_COMPILER=S:\b\swift\bin\swiftc.exe^
239+
-DSwift_DIR=S:\b\swift\lib\cmake\swift^
239240
-DENABLE_SWIFT=ON^
240241
-DENABLE_TESTING=OFF^
241242
S:\swift-corelibs-libdispatch
242243
popd
243244
cmake --build S:\b\libdispatch
244245
```
245246

246-
- Add libdispatch to your path:
247-
```cmd
248-
path S:\b\libdispatch;S:\b\libdispatch\src;%PATH%
249-
```
250-
251247
### 11. Build libxml2
252248

253249
```cmd
@@ -283,36 +279,23 @@ cmake -G Ninja^
283279
284280
```
285281

286-
- Add Foundation to your path:
287-
```cmd
288-
path S:\b\foundation;%PATH%
289-
```
290-
291282
### 13. Build swift-corelibs-xctest
292283

293284
```cmd
294285
mkdir "S:\b\xctest"
295286
pushd "S:\b\xctest"
296-
cmake -G Ninja^
297-
-DBUILD_SHARED_LIBS=YES^
287+
cmke -G Ninja^
298288
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
299289
-DCMAKE_SWIFT_COMPILER=S:\b\swift\bin\swiftc.exe^
300290
-DXCTEST_PATH_TO_COREFOUNDATION_BUILD=S:\b\foundation\CoreFoundation-prefix^
301291
-DXCTEST_PATH_TO_FOUNDATION_BUILD=S:\b\foundation^
302-
-DXCTEST_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch^
292+
-DXCTEST_PATH_TO_LIBDPATCH_SOURCE=S:\b\swift-corelibs-libdispatch^
303293
-DXCTEST_PATH_TO_LIBDISPATCH_BUILD=S:\b\libdispatch^
304-
-DLIT_COMMAND=S:\llvm\utils\lit\lit.py^
305-
-DPYTHON_EXECUTABLE=C:\Python27\python.exe^
306294
S:\swift-corelibs-xctest
307295
popd
308296
cmake --build S:\b\xctest
309297
```
310298

311-
- Add XCTest to your path:
312-
```cmd
313-
path S:\b\xctest;%PATH%
314-
```
315-
316299
### 14. Install Swift on Windows
317300

318301
- Run ninja install:

branches/swift-5.1-old-llvm-branch/include/swift/AST/Types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,8 +2762,6 @@ class AnyFunctionType : public TypeBase {
27622762
bool operator!=(Param const &b) const { return !(*this == b); }
27632763

27642764
Param getWithoutLabel() const { return Param(Ty, Identifier(), Flags); }
2765-
2766-
Param withType(Type newType) const { return Param(newType, Label, Flags); }
27672765
};
27682766

27692767
class CanParam : public Param {

branches/swift-5.1-old-llvm-branch/include/swift/Reflection/ReflectionContext.h

Lines changed: 8 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818
#ifndef SWIFT_REFLECTION_REFLECTIONCONTEXT_H
1919
#define SWIFT_REFLECTION_REFLECTIONCONTEXT_H
2020

21-
#include "llvm/BinaryFormat/COFF.h"
2221
#include "llvm/BinaryFormat/MachO.h"
2322
#include "llvm/BinaryFormat/ELF.h"
24-
#include "llvm/Object/COFF.h"
2523

2624
#include "swift/Remote/MemoryReader.h"
2725
#include "swift/Remote/MetadataReader.h"
@@ -62,6 +60,7 @@ template <> struct ELFTraits<llvm::ELF::ELFCLASS32> {
6260
using Section = const struct llvm::ELF::Elf32_Shdr;
6361
using Offset = llvm::ELF::Elf32_Off;
6462
using Size = llvm::ELF::Elf32_Word;
63+
using Address = llvm::ELF::Elf32_Addr;
6564
static constexpr unsigned char ELFClass = llvm::ELF::ELFCLASS32;
6665
};
6766

@@ -70,6 +69,7 @@ template <> struct ELFTraits<llvm::ELF::ELFCLASS64> {
7069
using Section = const struct llvm::ELF::Elf64_Shdr;
7170
using Offset = llvm::ELF::Elf64_Off;
7271
using Size = llvm::ELF::Elf64_Xword;
72+
using Address = llvm::ELF::Elf64_Addr;
7373
static constexpr unsigned char ELFClass = llvm::ELF::ELFCLASS64;
7474
};
7575

@@ -202,7 +202,7 @@ class ReflectionContext
202202
RangeEnd - RangeStart);
203203

204204
auto findMachOSectionByName = [&](std::string Name)
205-
-> std::pair<std::pair<const char *, const char *>, uint64_t> {
205+
-> std::pair<std::pair<const char *, const char *>, uint32_t> {
206206
for (unsigned I = 0; I < NumSect; ++I) {
207207
auto S = reinterpret_cast<typename T::Section *>(
208208
SectionsBuf + (I * sizeof(typename T::Section)));
@@ -233,8 +233,8 @@ class ReflectionContext
233233
ReflStrMdSec.first.first == nullptr)
234234
return false;
235235

236-
auto LocalStartAddress = reinterpret_cast<uint64_t>(SectBuf.get());
237-
auto RemoteStartAddress = static_cast<uint64_t>(RangeStart);
236+
auto LocalStartAddress = reinterpret_cast<uintptr_t>(SectBuf.get());
237+
auto RemoteStartAddress = static_cast<uintptr_t>(RangeStart);
238238

239239
ReflectionInfo info = {
240240
{{FieldMdSec.first.first, FieldMdSec.first.second}, 0},
@@ -286,100 +286,6 @@ class ReflectionContext
286286
return readMachOSections<MachOTraits<8>>(ImageStart);
287287
return false;
288288
}
289-
290-
#elif defined(_WIN32)
291-
bool addImage(RemoteAddress ImageStart) {
292-
auto DOSHdrBuf = this->getReader().readBytes(
293-
ImageStart, sizeof(llvm::object::dos_header));
294-
auto DOSHdr =
295-
reinterpret_cast<const llvm::object::dos_header *>(DOSHdrBuf.get());
296-
auto COFFFileHdrAddr = ImageStart.getAddressData() +
297-
DOSHdr->AddressOfNewExeHeader +
298-
sizeof(llvm::COFF::PEMagic);
299-
300-
auto COFFFileHdrBuf = this->getReader().readBytes(
301-
RemoteAddress(COFFFileHdrAddr), sizeof(llvm::object::coff_file_header));
302-
auto COFFFileHdr = reinterpret_cast<const llvm::object::coff_file_header *>(
303-
COFFFileHdrBuf.get());
304-
305-
auto SectionTableAddr = COFFFileHdrAddr +
306-
sizeof(llvm::object::coff_file_header) +
307-
COFFFileHdr->SizeOfOptionalHeader;
308-
auto SectionTableBuf = this->getReader().readBytes(
309-
RemoteAddress(SectionTableAddr),
310-
sizeof(llvm::object::coff_section) * COFFFileHdr->NumberOfSections);
311-
312-
auto findCOFFSectionByName = [&](llvm::StringRef Name)
313-
-> std::pair<std::pair<const char *, const char *>, uint32_t> {
314-
for (size_t i = 0; i < COFFFileHdr->NumberOfSections; ++i) {
315-
const llvm::object::coff_section *COFFSec =
316-
reinterpret_cast<const llvm::object::coff_section *>(
317-
SectionTableBuf.get()) +
318-
i;
319-
llvm::StringRef SectionName =
320-
(COFFSec->Name[llvm::COFF::NameSize - 1] == 0)
321-
? COFFSec->Name
322-
: llvm::StringRef(COFFSec->Name, llvm::COFF::NameSize);
323-
if (SectionName != Name)
324-
continue;
325-
auto Addr = ImageStart.getAddressData() + COFFSec->PointerToRawData;
326-
auto Buf = this->getReader().readBytes(RemoteAddress(Addr),
327-
COFFSec->VirtualSize);
328-
const char *Begin = reinterpret_cast<const char *>(Buf.get());
329-
const char *End = Begin + COFFSec->VirtualSize;
330-
savedBuffers.push_back(std::move(Buf));
331-
return {{Begin, End},
332-
COFFSec->VirtualAddress - COFFSec->PointerToRawData};
333-
}
334-
return {{nullptr, nullptr}, 0};
335-
};
336-
337-
std::pair<std::pair<const char *, const char *>, uint32_t> CaptureSec =
338-
findCOFFSectionByName(".sw5cptr");
339-
std::pair<std::pair<const char *, const char *>, uint32_t> TypeRefMdSec =
340-
findCOFFSectionByName(".sw5tyrf");
341-
342-
// FIXME: Make use of .sw5flmd section (the section content appears to be
343-
// incorrect on Windows at the moment).
344-
std::pair<std::pair<const char *, const char *>, uint32_t> FieldMdSec = {
345-
{nullptr, nullptr}, 0};
346-
// FIXME: Make use of .sw5asty.
347-
std::pair<std::pair<const char *, const char *>, uint32_t> AssocTySec = {
348-
{nullptr, nullptr}, 0};
349-
// FIXME: Make use of .sw5bltn.
350-
std::pair<std::pair<const char *, const char *>, uint32_t> BuiltinTySec = {
351-
{nullptr, nullptr}, 0};
352-
// FIXME: Make use of .sw5repl.
353-
std::pair<std::pair<const char *, const char *>, uint32_t> ReflStrMdSec = {
354-
{nullptr, nullptr}, 0};
355-
356-
if (FieldMdSec.first.first == nullptr &&
357-
AssocTySec.first.first == nullptr &&
358-
BuiltinTySec.first.first == nullptr &&
359-
CaptureSec.first.first == nullptr &&
360-
TypeRefMdSec.first.first == nullptr &&
361-
ReflStrMdSec.first.first == nullptr)
362-
return false;
363-
auto LocalStartAddress = reinterpret_cast<uintptr_t>(DOSHdrBuf.get());
364-
auto RemoteStartAddress =
365-
static_cast<uintptr_t>(ImageStart.getAddressData());
366-
367-
ReflectionInfo Info = {
368-
{{FieldMdSec.first.first, FieldMdSec.first.second}, FieldMdSec.second},
369-
{{AssocTySec.first.first, AssocTySec.first.second}, AssocTySec.second},
370-
{{BuiltinTySec.first.first, BuiltinTySec.first.second},
371-
BuiltinTySec.second},
372-
{{CaptureSec.first.first, CaptureSec.first.second}, CaptureSec.second},
373-
{{TypeRefMdSec.first.first, TypeRefMdSec.first.second},
374-
TypeRefMdSec.second},
375-
{{ReflStrMdSec.first.first, ReflStrMdSec.first.second},
376-
ReflStrMdSec.second},
377-
LocalStartAddress,
378-
RemoteStartAddress};
379-
this->addReflectionInfo(Info);
380-
return true;
381-
}
382-
383289
#else // ELF platforms.
384290
template <typename T> bool readELFSections(RemoteAddress ImageStart) {
385291
auto Buf =
@@ -426,7 +332,7 @@ class ReflectionContext
426332
auto StrTab = reinterpret_cast<const char *>(StrTabBuf.get());
427333

428334
auto findELFSectionByName = [&](std::string Name)
429-
-> std::pair<std::pair<const char *, const char *>, uint64_t> {
335+
-> std::pair<std::pair<const char *, const char *>, typename T::Address> {
430336
// Now for all the sections, find their name.
431337
for (const typename T::Section *Hdr : SecHdrVec) {
432338
uint32_t Offset = Hdr->sh_name;
@@ -461,9 +367,9 @@ class ReflectionContext
461367
ReflStrMdSec.first.first == nullptr)
462368
return false;
463369

464-
auto LocalStartAddress = reinterpret_cast<uint64_t>(Buf.get());
370+
auto LocalStartAddress = reinterpret_cast<uintptr_t>(Buf.get());
465371
auto RemoteStartAddress =
466-
static_cast<uint64_t>(ImageStart.getAddressData());
372+
static_cast<uintptr_t>(ImageStart.getAddressData());
467373

468374
ReflectionInfo info = {
469375
{{FieldMdSec.first.first, FieldMdSec.first.second}, FieldMdSec.second},

branches/swift-5.1-old-llvm-branch/include/swift/Reflection/TypeRefBuilder.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,36 +82,36 @@ using GenericSection = ReflectionSection<const void *>;
8282
struct ReflectionInfo {
8383
struct {
8484
FieldSection Metadata;
85-
uint64_t SectionOffset;
85+
uintptr_t SectionOffset;
8686
} Field;
8787

8888
struct {
8989
AssociatedTypeSection Metadata;
90-
uint64_t SectionOffset;
90+
uintptr_t SectionOffset;
9191
} AssociatedType;
9292

9393
struct {
9494
BuiltinTypeSection Metadata;
95-
uint64_t SectionOffset;
95+
uintptr_t SectionOffset;
9696
} Builtin;
9797

9898
struct {
9999
CaptureSection Metadata;
100-
uint64_t SectionOffset;
100+
uintptr_t SectionOffset;
101101
} Capture;
102102

103103
struct {
104104
GenericSection Metadata;
105-
uint64_t SectionOffset;
105+
uintptr_t SectionOffset;
106106
} TypeReference;
107107

108108
struct {
109109
GenericSection Metadata;
110-
uint64_t SectionOffset;
110+
uintptr_t SectionOffset;
111111
} ReflectionString;
112112

113-
uint64_t LocalStartAddress;
114-
uint64_t RemoteStartAddress;
113+
uintptr_t LocalStartAddress;
114+
uintptr_t RemoteStartAddress;
115115
};
116116

117117
struct ClosureContextInfo {
@@ -506,11 +506,11 @@ class TypeRefBuilder {
506506

507507
/// Get the raw capture descriptor for a remote capture descriptor
508508
/// address.
509-
const CaptureDescriptor *getCaptureDescriptor(uint64_t RemoteAddress);
509+
const CaptureDescriptor *getCaptureDescriptor(uintptr_t RemoteAddress);
510510

511511
/// Get the unsubstituted capture types for a closure context.
512512
ClosureContextInfo getClosureContextInfo(const CaptureDescriptor &CD,
513-
uint64_t Offset);
513+
uintptr_t Offset);
514514

515515
///
516516
/// Dumping typerefs, field declarations, associated types

branches/swift-5.1-old-llvm-branch/include/swift/Remote/MetadataReader.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,15 @@ class MetadataReader {
410410
StoredPointer InstanceAddress =
411411
InstanceMetadataAddressAddress + 2 * sizeof(StoredPointer);
412412

413+
// When built with Objective-C interop, the runtime also stores a conformance
414+
// to Hashable and the base type introducing the Hashable conformance.
415+
if (isObjC)
416+
InstanceAddress += 2 * sizeof(StoredPointer);
417+
413418
// Round up to alignment, and we have the start address of the
414419
// instance payload.
415420
auto AlignmentMask = VWT->getAlignmentMask();
416-
auto Offset = (sizeof(HeapObject) + AlignmentMask) & ~AlignmentMask;
417-
InstanceAddress += Offset;
421+
InstanceAddress = (InstanceAddress + AlignmentMask) & ~AlignmentMask;
418422

419423
return RemoteExistential(
420424
RemoteAddress(*InstanceMetadataAddress),
@@ -2472,13 +2476,8 @@ class MetadataReader {
24722476
TaggedPointerExtendedClasses =
24732477
TaggedPointerExtendedClassesAddr.getAddressData();
24742478

2475-
// The tagged pointer obfuscator is not present on older OSes, in
2476-
// which case we can treat it as zero.
2477-
TaggedPointerObfuscator = 0;
2478-
auto TaggedPointerObfuscatorAddr = Reader->getSymbolAddress(
2479-
"objc_debug_taggedpointer_obfuscator");
2480-
if (TaggedPointerObfuscatorAddr)
2481-
tryReadSymbol(TaggedPointerObfuscatorAddr, TaggedPointerObfuscator);
2479+
tryFindAndReadSymbol(TaggedPointerObfuscator,
2480+
"objc_debug_taggedpointer_obfuscator");
24822481

24832482
# undef tryFindSymbol
24842483
# undef tryReadSymbol

0 commit comments

Comments
 (0)