Skip to content

Commit 41f5c8e

Browse files
authored
Merge pull request #1234 from swiftwasm/master
[pull] swiftwasm from master
2 parents e422b29 + 542721b commit 41f5c8e

File tree

64 files changed

+4762
-257
lines changed

Some content is hidden

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

64 files changed

+4762
-257
lines changed

docs/WindowsBuild.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Extract the zip files, ignoring the top level directory, into `S:/Library`. The
9191

9292
```
9393
/Library
94-
┝ icu-64
94+
┝ icu-67
9595
│ ┕ usr/...
9696
├ libcurl-development
9797
│ ┕ usr/...
@@ -138,10 +138,10 @@ cmake -B "S:\b\toolchain" ^
138138
-D LLDB_ENABLE_PYTHON=YES ^
139139
-D LLVM_EXTERNAL_SWIFT_SOURCE_DIR="S:/swift" ^
140140
-D LLVM_EXTERNAL_CMARK_SOURCE_DIR="S:/cmark" ^
141-
-D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-64/usr/include" ^
142-
-D SWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-64/usr/lib/icuuc64.lib" ^
143-
-D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-64/usr/include" ^
144-
-D SWIFT_WINDOWS_x86_64_ICU_I18N="S:/Library/icu-64/usr/lib/icuin64.lib" ^
141+
-D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-67/usr/include" ^
142+
-D SWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-67/usr/lib/icuuc67.lib" ^
143+
-D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-67/usr/include" ^
144+
-D SWIFT_WINDOWS_x86_64_ICU_I18N="S:/Library/icu-67/usr/lib/icuin67.lib" ^
145145
-D CMAKE_INSTALL_PREFIX="C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr" ^
146146
-D PYTHON_EXECUTABLE=C:\Python27\python.exe ^
147147
-D SWIFT_BUILD_DYNAMIC_STDLIB=YES ^
@@ -158,7 +158,7 @@ ninja -C S:\b\toolchain
158158
## Running Swift tests on Windows
159159

160160
```cmd
161-
path S:\Library\icu-64\usr\bin;S:\b\toolchain\bin;S:\b\toolchain\tools\swift\libdispatch-prefix\bin;%PATH%;%ProgramFiles%\Git\usr\bin
161+
path S:\Library\icu-67\usr\bin;S:\b\toolchain\bin;S:\b\toolchain\tools\swift\libdispatch-prefix\bin;%PATH%;%ProgramFiles%\Git\usr\bin
162162
ninja -C S:\b\toolchain check-swift
163163
```
164164

@@ -178,7 +178,7 @@ ninja -C S:\b\libdispatch check
178178
## Build swift-corelibs-foundation
179179

180180
```cmd
181-
cmake -B S:\b\foundation -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=S:/b/toolchain/bin/clang-cl.exe -D CMAKE_Swift_COMPILER=S:/b/toolchain/bin/swiftc.exe -D CURL_LIBRARY="S:/Library/libcurl-development/usr/lib/libcurl.lib" -D CURL_INCLUDE_DIR="S:/Library/libcurl-development/usr/include" -D ICU_ROOT="S:/Library/icu-64" -D ICU_INCLUDE_DIR=S:/Library/icu-64/usr/include -D LIBXML2_LIBRARY="S:/Library/libxml2-development/usr/lib/libxml2s.lib" -D LIBXML2_INCLUDE_DIR="S:/Library/libxml2-development/usr/include/libxml2" -D ENABLE_TESTING=NO -D dispatch_DIR=S:/b/libdispatch/cmake/modules -G Ninja -S S:\swift-corelibs-foundation
181+
cmake -B S:\b\foundation -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=S:/b/toolchain/bin/clang-cl.exe -D CMAKE_Swift_COMPILER=S:/b/toolchain/bin/swiftc.exe -D CURL_LIBRARY="S:/Library/libcurl-development/usr/lib/libcurl.lib" -D CURL_INCLUDE_DIR="S:/Library/libcurl-development/usr/include" -D ICU_ROOT="S:/Library/icu-67" -D ICU_INCLUDE_DIR=S:/Library/icu-67/usr/include -D LIBXML2_LIBRARY="S:/Library/libxml2-development/usr/lib/libxml2s.lib" -D LIBXML2_INCLUDE_DIR="S:/Library/libxml2-development/usr/include/libxml2" -D ENABLE_TESTING=NO -D dispatch_DIR=S:/b/libdispatch/cmake/modules -G Ninja -S S:\swift-corelibs-foundation
182182
ninja -C S:\b\foundation
183183
```
184184

@@ -210,7 +210,7 @@ ninja -C S:\b\xctest check-xctest
210210
## Rebuild Foundation
211211

212212
```cmd
213-
cmake -B S:\b\foundation -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=S:/b/toolchain/bin/clang-cl.exe -D CMAKE_Swift_COMPILER=S:/b/toolchain/bin/swiftc.exe -D CURL_LIBRARY="S:/Library/libcurl-development/usr/lib/libcurl.lib" -D CURL_INCLUDE_DIR="S:/Library/libcurl-development/usr/include" -D ICU_ROOT="S:/Library/icu-64" -D LIBXML2_LIBRARY="S:/Library/libxml2-development/usr/lib/libxml2.lib" -D LIBXML2_INCLUDE_DIR="S:/Library/libxml2-development/usr/include" -D ENABLE_TESTING=YES -D dispatch_DIR=S:/b/libdispatch/cmake/modules -D XCTest_DIR=S:/b/xctest/cmake/modules -G Ninja -S S:\swift-corelibs-foundation
213+
cmake -B S:\b\foundation -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=S:/b/toolchain/bin/clang-cl.exe -D CMAKE_Swift_COMPILER=S:/b/toolchain/bin/swiftc.exe -D CURL_LIBRARY="S:/Library/libcurl-development/usr/lib/libcurl.lib" -D CURL_INCLUDE_DIR="S:/Library/libcurl-development/usr/include" -D ICU_ROOT="S:/Library/icu-67" -D LIBXML2_LIBRARY="S:/Library/libxml2-development/usr/lib/libxml2.lib" -D LIBXML2_INCLUDE_DIR="S:/Library/libxml2-development/usr/include" -D ENABLE_TESTING=YES -D dispatch_DIR=S:/b/libdispatch/cmake/modules -D XCTest_DIR=S:/b/xctest/cmake/modules -G Ninja -S S:\swift-corelibs-foundation
214214
ninja -C S:\b\foundation
215215
```
216216

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,6 +2668,9 @@ ERROR(enum_non_integer_convertible_raw_type_no_value,none,
26682668
"expressible by integer or string literal", ())
26692669
ERROR(enum_raw_value_not_unique,none,
26702670
"raw value for enum case is not unique", ())
2671+
ERROR(enum_raw_value_magic_literal,none,
2672+
"use of '%0' literal as raw value for enum case is not supported",
2673+
(StringRef))
26712674
NOTE(enum_raw_value_used_here,none,
26722675
"raw value previously used here", ())
26732676
NOTE(enum_raw_value_incrementing_from_here,none,

include/swift/Basic/Dwarf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ namespace swift {
2323
/// The DWARF version emitted by the Swift compiler.
2424
const unsigned DWARFVersion = 4;
2525

26-
static const char MachOASTSegmentName[] = "__SWIFT";
27-
static const char MachOASTSectionName[] = "__ast";
26+
static const char MachOASTSegmentName[] = "__DWARF";
27+
static const char MachOASTSectionName[] = "__swift_ast";
2828
static const char ELFASTSectionName[] = ".swift_ast";
2929
static const char COFFASTSectionName[] = "swiftast";
3030
static const char WasmASTSectionName[] = ".swift_ast";

lib/AST/NameLookup.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,12 @@ DirectLookupRequest::evaluate(Evaluator &evaluator,
13311331

13321332
decl->prepareLookupTable();
13331333

1334+
// If we're allowed to load extensions, call prepareExtensions to ensure we
1335+
// properly invalidate the lazily-complete cache for any extensions brought in
1336+
// by modules loaded after-the-fact. This can happen with the LLDB REPL.
1337+
if (!disableAdditionalExtensionLoading)
1338+
decl->prepareExtensions();
1339+
13341340
auto &Table = *decl->LookupTable;
13351341
if (!useNamedLazyMemberLoading) {
13361342
// Make sure we have the complete list of members (in this nominal and in

lib/IRGen/GenDecl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,8 +1105,11 @@ void IRGenerator::emitGlobalTopLevel(llvm::StringSet<> *linkerDirectives) {
11051105
IGM->emitSILDifferentiabilityWitness(&dw);
11061106
}
11071107

1108-
// Emit code coverage mapping data.
1109-
PrimaryIGM->emitCoverageMapping();
1108+
// Emit code coverage mapping data for all modules
1109+
for (auto Iter : *this) {
1110+
IRGenModule *IGM = Iter.second;
1111+
IGM->emitCoverageMapping();
1112+
}
11101113

11111114
for (auto Iter : *this) {
11121115
IRGenModule *IGM = Iter.second;

lib/IRGen/GenProto.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2749,12 +2749,10 @@ static void addAbstractConditionalRequirements(
27492749
auto *proto =
27502750
req.getSecondType()->castTo<ProtocolType>()->getDecl();
27512751
auto ty = req.getFirstType()->getCanonicalType();
2752-
if (!isa<ArchetypeType>(ty))
2752+
auto archetype = dyn_cast<ArchetypeType>(ty);
2753+
if (!archetype)
27532754
continue;
2754-
auto conformance = subMap.lookupConformance(ty, proto);
2755-
if (!conformance.isAbstract())
2756-
continue;
2757-
requirements.insert({ty, conformance.getAbstract()});
2755+
requirements.insert({ty, proto});
27582756
}
27592757
// Recursively add conditional requirements.
27602758
for (auto &conf : subMap.getConformances()) {

lib/IRGen/IRGen.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,6 +1366,10 @@ swift::createSwiftModuleObjectFile(SILModule &SILMod, StringRef Buffer,
13661366
assert(!Ctx.hadError());
13671367

13681368
IRGenOptions Opts;
1369+
// This tool doesn't pass the necessary runtime library path to
1370+
// TypeConverter, because this feature isn't needed.
1371+
Opts.DisableLegacyTypeInfo = true;
1372+
13691373
Opts.OutputKind = IRGenOutputKind::ObjectFile;
13701374
IRGenerator irgen(Opts, SILMod);
13711375

lib/SIL/IR/SILGlobalVariable.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ bool SILGlobalVariable::isValidStaticInitializerInst(const SILInstruction *I,
136136
auto *TE = bi->getSingleUserOfType<TupleExtractInst>();
137137
return TE && getOffsetSubtract(TE, M);
138138
}
139+
case BuiltinValueKind::OnFastPath:
140+
return true;
139141
default:
140142
break;
141143
}

lib/Sema/CSSimplify.cpp

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,20 +1350,53 @@ ConstraintSystem::matchTupleTypes(TupleType *tuple1, TupleType *tuple2,
13501350
return getTypeMatchSuccess();
13511351
}
13521352

1353+
// Determine whether conversion is allowed between two function types
1354+
// based on their representations.
1355+
static bool
1356+
isConversionAllowedBetween(FunctionTypeRepresentation rep1,
1357+
FunctionTypeRepresentation rep2) {
1358+
auto isThin = [](FunctionTypeRepresentation rep) {
1359+
return rep == FunctionTypeRepresentation::CFunctionPointer ||
1360+
rep == FunctionTypeRepresentation::Thin;
1361+
};
1362+
1363+
// Allowing "thin" (c, thin) to "thin" conventions
1364+
if (isThin(rep1) && isThin(rep2))
1365+
return true;
1366+
1367+
// Allowing all to "thick" (swift, block) conventions
1368+
// "thin" (c, thin) to "thick" or "thick" to "thick"
1369+
if (rep2 == FunctionTypeRepresentation::Swift ||
1370+
rep2 == FunctionTypeRepresentation::Block)
1371+
return true;
1372+
1373+
return rep1 == rep2;
1374+
}
1375+
13531376
// Returns 'false' (i.e. no error) if it is legal to match functions with the
13541377
// corresponding function type representations and the given match kind.
13551378
static bool matchFunctionRepresentations(FunctionTypeRepresentation rep1,
13561379
FunctionTypeRepresentation rep2,
1357-
ConstraintKind kind) {
1380+
ConstraintKind kind,
1381+
ConstraintLocatorBuilder locator) {
13581382
switch (kind) {
13591383
case ConstraintKind::Bind:
13601384
case ConstraintKind::BindParam:
13611385
case ConstraintKind::BindToPointerType:
13621386
case ConstraintKind::Equal:
13631387
return rep1 != rep2;
1388+
1389+
case ConstraintKind::Subtype: {
1390+
auto last = locator.last();
1391+
if (!(last && last->is<LocatorPathElt::FunctionArgument>()))
1392+
return false;
1393+
1394+
// Inverting the result because matchFunctionRepresentations
1395+
// returns false in conversions are allowed.
1396+
return !isConversionAllowedBetween(rep1, rep2);
1397+
}
13641398

13651399
case ConstraintKind::OpaqueUnderlyingType:
1366-
case ConstraintKind::Subtype:
13671400
case ConstraintKind::Conversion:
13681401
case ConstraintKind::BridgingConversion:
13691402
case ConstraintKind::ArgumentConversion:
@@ -1658,7 +1691,7 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
16581691

16591692
if (matchFunctionRepresentations(func1->getExtInfo().getRepresentation(),
16601693
func2->getExtInfo().getRepresentation(),
1661-
kind)) {
1694+
kind, locator)) {
16621695
return getTypeMatchFailure(locator);
16631696
}
16641697

lib/Sema/ConstraintSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ class Solution {
10161016
llvm::SmallPtrSet<ConstraintLocator *, 2> DefaultedConstraints;
10171017

10181018
/// The node -> type mappings introduced by this solution.
1019-
llvm::MapVector<ASTNode, Type> nodeTypes;
1019+
llvm::DenseMap<ASTNode, Type> nodeTypes;
10201020

10211021
/// Contextual types introduced by this solution.
10221022
std::vector<std::pair<ASTNode, ContextualTypeInfo>> contextualTypes;

0 commit comments

Comments
 (0)