Skip to content

Commit 49ef8a7

Browse files
Merge pull request #5521 from swiftwasm/main
[pull] swiftwasm from main
2 parents dd991b7 + 7cb1e0d commit 49ef8a7

File tree

64 files changed

+370
-1259
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

+370
-1259
lines changed

docs/HowToGuides/FAQ.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,49 @@ git rebase --continue
133133

134134
### How do I clean up my git history?
135135

136-
TODO: Link to a beginner-friendly external resource, or (less preferably)
137-
describe basic usage of rebase here.
136+
Git's history can sometimes become cluttered with many small commits.
137+
Fortunately, Git has a feature called `rebase` that allows you to clean up your commit history.
138+
If you want to learn more,
139+
[GitHub - About Git rebase](https://docs.github.com/en/get-started/using-git/about-git-rebase)
140+
provides a comprehensive overview of `rebase`.
141+
142+
> **Warning**
143+
We suggest considering to `rebase` only those commits that haven't been pushed to a public branch.
144+
Rebasing existing commits would block merging because we don't allow force pushes to the repository.
145+
If you need to tidy up commits that have already been pushed,
146+
it's generally better to use `git revert` for the sake of avoid causing confusion for other developers.
147+
148+
149+
Here's a small gist that goes through the basics on how to use it:
150+
151+
1. Begin an interactive rebase: Use `git rebase -i HEAD~N`, where `N` is the number of commits
152+
from the latest one you want to edit. This will open a text editor,
153+
listing the last `N` commits with the word "pick" next to each one.
154+
155+
```sh
156+
git rebase -i HEAD~N
157+
```
158+
159+
2. Edit the commits: Replace "pick" with the operation you want to perform on the commit:
160+
161+
- `reword`: Change the commit message.
162+
- `edit`: Amend the commit.
163+
- `squash`: Combine the commit with the previous one.
164+
- `fixup`: Similar to `squash`, but discard this commit's log message.
165+
- `drop`: Remove the commit.
166+
167+
3. Save and exit: After saving and closing the file, git will execute each operation.
168+
If you selected `reword`, `edit`, or `squash`, git will pause and give you a chance
169+
to alter the commit message or the commit itself.
170+
171+
```sh
172+
git commit --amend
173+
```
174+
175+
4. Continue the rebase: Once you're done with each commit, you can continue the rebase
176+
using `git rebase --continue`. If you want to abort the rebase at any point,
177+
you can use `git rebase --abort`.
178+
179+
```sh
180+
git rebase --continue
181+
```

docs/HowToGuides/GettingStarted.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ toolchain as a one-off, there are a couple of differences:
6666
mkdir swift-project
6767
cd swift-project
6868
```
69+
70+
> **Warning**
71+
> Make sure the absolute path to your `swift-project` directory **does not** contain spaces,
72+
since that might cause issues during the build step.
73+
6974
2. Clone the sources:
7075
- Via SSH (recommended):
7176
If you plan on contributing regularly, cloning over SSH provides a better
@@ -121,9 +126,6 @@ toolchain as a one-off, there are a couple of differences:
121126
122127
- If `update-checkout` failed, double-check that the absolute path to your
123128
working directory does not have non-ASCII characters.
124-
- If `update-checkout` failed and the absolute path to your working directory
125-
had spaces in it, please [file a bug report][Swift Issues] and change the path
126-
to work around it.
127129
- Before running `update-checkout`, double-check that `swift` is the only
128130
repository inside the `swift-project` directory. Otherwise,
129131
`update-checkout` may not clone the necessary dependencies.

docs/SIL.rst

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3475,8 +3475,6 @@ A value ``%1`` is said to be *value-dependent* on a value ``%0`` if:
34753475
with ``tuple_extract``, ``struct_extract``, ``unchecked_enum_data``,
34763476
``select_enum``, or ``select_enum_addr``.
34773477

3478-
- ``%1`` is the result of ``select_value`` and ``%0`` is one of the cases.
3479-
34803478
- ``%1`` is a basic block parameter and ``%0`` is the corresponding
34813479
argument from a branch to that block.
34823480

@@ -7949,45 +7947,6 @@ block. If there is a ``default`` basic block, control is transferred to it if
79497947
the value does not match any of the ``case`` values. It is undefined behavior
79507948
if the value does not match any cases and no ``default`` branch is provided.
79517949

7952-
select_value
7953-
````````````
7954-
::
7955-
7956-
sil-instruction ::= 'select_value' sil-operand sil-select-value-case*
7957-
(',' 'default' sil-value)?
7958-
':' sil-type
7959-
sil-select-value-case ::= 'case' sil-value ':' sil-value
7960-
7961-
7962-
%n = select_value %0 : $U, \
7963-
case %c1: %r1, \
7964-
case %c2: %r2, /* ... */ \
7965-
default %r3 : $T
7966-
7967-
// $U must be a builtin type. Only integers types are supported currently.
7968-
// c1, c2, etc must be of type $U
7969-
// %r1, %r2, %r3, etc. must have type $T
7970-
// %n has type $T
7971-
7972-
Selects one of the "case" or "default" operands based on the case of a
7973-
value. This is equivalent to a trivial `switch_value`_ branch sequence::
7974-
7975-
entry:
7976-
switch_value %0 : $U, \
7977-
case %c1: bb1, \
7978-
case %c2: bb2, /* ... */ \
7979-
default bb_default
7980-
bb1:
7981-
br cont(%r1 : $T) // value for %c1
7982-
bb2:
7983-
br cont(%r2 : $T) // value for %c2
7984-
bb_default:
7985-
br cont(%r3 : $T) // value for default
7986-
cont(%n : $T):
7987-
// use argument %n
7988-
7989-
but turns the control flow dependency into a data flow dependency.
7990-
79917950
switch_enum
79927951
```````````
79937952
::

include/swift/AST/DiagnosticsSema.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,6 +1709,11 @@ ERROR(objc_implementation_type_mismatch,none,
17091709
"header",
17101710
(DescriptiveDeclKind, ValueDecl *, Type, Type))
17111711

1712+
ERROR(objc_implementation_required_attr_mismatch,none,
1713+
"%0 %1 %select{should not|should}2 be 'required' to match %0 declared by "
1714+
"the header",
1715+
(DescriptiveDeclKind, ValueDecl *, bool))
1716+
17121717
ERROR(objc_implementation_wrong_objc_name,none,
17131718
"selector %0 for %1 %2 not found in header; did you mean %3?",
17141719
(ObjCSelector, DescriptiveDeclKind, ValueDecl *, ObjCSelector))

include/swift/Runtime/Metadata.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,9 +666,6 @@ void swift_initStructMetadataWithLayoutString(StructMetadata *self,
666666
const uint8_t *fieldTags,
667667
uint32_t *fieldOffsets);
668668

669-
SWIFT_RUNTIME_STDLIB_INTERNAL
670-
size_t _swift_refCountBytesForMetatype(const Metadata *type);
671-
672669
enum LayoutStringFlags : uint64_t {
673670
Empty = 0,
674671
// TODO: Track other useful information tha can be used to optimize layout
@@ -688,6 +685,9 @@ inline LayoutStringFlags &operator|=(LayoutStringFlags &a, LayoutStringFlags b)
688685
return a = (a | b);
689686
}
690687

688+
SWIFT_RUNTIME_STDLIB_INTERNAL
689+
size_t _swift_refCountBytesForMetatype(const Metadata *type);
690+
691691
SWIFT_RUNTIME_STDLIB_INTERNAL
692692
void _swift_addRefCountStringForMetatype(uint8_t *layoutStr,
693693
size_t &layoutStrOffset,

include/swift/SIL/SILBuilder.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,14 +1730,6 @@ class SILBuilder {
17301730
getModule(), CaseCounts, DefaultCount));
17311731
}
17321732

1733-
SelectValueInst *createSelectValue(
1734-
SILLocation Loc, SILValue Operand, SILType Ty, SILValue DefaultResult,
1735-
ArrayRef<std::pair<SILValue, SILValue>> CaseValuesAndResult) {
1736-
return insert(SelectValueInst::create(getSILDebugLocation(Loc), Operand, Ty,
1737-
DefaultResult, CaseValuesAndResult,
1738-
getModule()));
1739-
}
1740-
17411733
TupleExtractInst *createTupleExtract(SILLocation Loc, SILValue Operand,
17421734
unsigned FieldNo, SILType ResultTy) {
17431735
return createTupleExtract(Loc, Operand, FieldNo, ResultTy,

include/swift/SIL/SILCloner.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,24 +3251,6 @@ SILCloner<ImplClass>::visitSelectEnumAddrInst(SelectEnumAddrInst *Inst) {
32513251
CaseResults));
32523252
}
32533253

3254-
template<typename ImplClass>
3255-
void
3256-
SILCloner<ImplClass>::visitSelectValueInst(SelectValueInst *Inst) {
3257-
SILValue DefaultResult;
3258-
if (Inst->hasDefault())
3259-
DefaultResult = getOpValue(Inst->getDefaultResult());
3260-
SmallVector<std::pair<SILValue, SILValue>, 8> CaseResults;
3261-
for (unsigned i = 0, e = Inst->getNumCases(); i != e; ++i)
3262-
CaseResults.push_back(std::make_pair(getOpValue(Inst->getCase(i).first),
3263-
getOpValue(Inst->getCase(i).second)));
3264-
3265-
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
3266-
recordClonedInstruction(
3267-
Inst, getBuilder().createSelectValue(
3268-
getOpLocation(Inst->getLoc()), getOpValue(Inst->getOperand()),
3269-
getOpType(Inst->getType()), DefaultResult, CaseResults));
3270-
}
3271-
32723254
template <typename ImplClass>
32733255
void SILCloner<ImplClass>::visitDynamicMethodBranchInst(
32743256
DynamicMethodBranchInst *Inst) {

include/swift/SIL/SILInstruction.h

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,6 @@ FirstArgOwnershipForwardingSingleValueInst::classof(SILInstructionKind kind) {
13921392
case SILInstructionKind::ObjectInst:
13931393
case SILInstructionKind::EnumInst:
13941394
case SILInstructionKind::UncheckedEnumDataInst:
1395-
case SILInstructionKind::SelectValueInst:
13961395
case SILInstructionKind::OpenExistentialRefInst:
13971396
case SILInstructionKind::InitExistentialRefInst:
13981397
case SILInstructionKind::MarkDependenceInst:
@@ -6659,8 +6658,8 @@ class UncheckedTakeEnumDataAddrInst
66596658
}
66606659
};
66616660

6662-
// Abstract base class of all select instructions like select_enum,
6663-
// select_value, etc. The template parameter represents a type of case values
6661+
// Abstract base class of all select instructions like select_enum.
6662+
// The template parameter represents a type of case values
66646663
// to be compared with the operand of a select instruction.
66656664
//
66666665
// Subclasses must provide tail allocated storage.
@@ -6878,50 +6877,6 @@ class SelectEnumAddrInst final
68786877
ProfileCounter DefaultCount);
68796878
};
68806879

6881-
/// Select on a value of a builtin integer type.
6882-
///
6883-
/// There is 'the' operand, followed by pairs of operands for each case,
6884-
/// followed by an optional default operand.
6885-
class SelectValueInst final
6886-
: public InstructionBaseWithTrailingOperands<
6887-
SILInstructionKind::SelectValueInst, SelectValueInst,
6888-
SelectInstBase<SelectValueInst, SILValue, SingleValueInstruction>> {
6889-
friend SILBuilder;
6890-
6891-
SelectValueInst(SILDebugLocation DebugLoc, SILValue Operand, SILType Type,
6892-
SILValue DefaultResult,
6893-
ArrayRef<SILValue> CaseValuesAndResults);
6894-
6895-
static SelectValueInst *
6896-
create(SILDebugLocation DebugLoc, SILValue Operand, SILType Type,
6897-
SILValue DefaultValue,
6898-
ArrayRef<std::pair<SILValue, SILValue>> CaseValues, SILModule &M);
6899-
6900-
public:
6901-
std::pair<SILValue, SILValue>
6902-
getCase(unsigned i) const {
6903-
auto cases = getAllOperands().slice(1);
6904-
return {cases[i*2].get(), cases[i*2+1].get()};
6905-
}
6906-
6907-
unsigned getNumCases() const {
6908-
// Ignore the first non-case operand.
6909-
auto count = getAllOperands().size() - 1;
6910-
// This implicitly ignore the optional default operand.
6911-
return count / 2;
6912-
}
6913-
6914-
bool hasDefault() const {
6915-
// If the operand count is even, then we have a default value.
6916-
return (getAllOperands().size() & 1) == 0;
6917-
}
6918-
6919-
SILValue getDefaultResult() const {
6920-
assert(hasDefault() && "doesn't have a default");
6921-
return getAllOperands().back().get();
6922-
}
6923-
};
6924-
69256880
/// MetatypeInst - Represents the production of an instance of a given metatype
69266881
/// named statically.
69276882
class MetatypeInst final

include/swift/SIL/SILNodes.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,6 @@ ABSTRACT_VALUE_AND_INST(SingleValueInstruction, ValueBase, SILInstruction)
609609
SingleValueInstruction, None, DoesNotRelease)
610610
SINGLE_VALUE_INST(SelectEnumAddrInst, select_enum_addr,
611611
SingleValueInstruction, MayRead, DoesNotRelease)
612-
SINGLE_VALUE_INST(SelectValueInst, select_value,
613-
SingleValueInstruction, None, DoesNotRelease)
614612

615613
// Protocol and Protocol Composition Types
616614
SINGLE_VALUE_INST(InitExistentialAddrInst, init_existential_addr,

lib/IRGen/IRGenSIL.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,6 @@ class IRGenSILFunction :
13001300
void visitInitEnumDataAddrInst(InitEnumDataAddrInst *i);
13011301
void visitSelectEnumInst(SelectEnumInst *i);
13021302
void visitSelectEnumAddrInst(SelectEnumAddrInst *i);
1303-
void visitSelectValueInst(SelectValueInst *i);
13041303
void visitUncheckedEnumDataInst(UncheckedEnumDataInst *i);
13051304
void visitUncheckedTakeEnumDataAddrInst(UncheckedTakeEnumDataAddrInst *i);
13061305
void visitInjectEnumAddrInst(InjectEnumAddrInst *i);
@@ -4658,27 +4657,6 @@ void IRGenSILFunction::visitSelectEnumAddrInst(SelectEnumAddrInst *inst) {
46584657
// emitBBMapForSelectEnum set up a phi node to receive the result.
46594658
Builder.SetInsertPoint(contBB);
46604659
}
4661-
4662-
setLoweredValue(inst,
4663-
getLoweredValueForSelect(*this, result, inst));
4664-
}
4665-
4666-
void IRGenSILFunction::visitSelectValueInst(SelectValueInst *inst) {
4667-
Explosion value = getLoweredExplosion(inst->getOperand());
4668-
4669-
// Map the SIL dest bbs to their LLVM bbs.
4670-
SmallVector<std::pair<SILValue, llvm::BasicBlock*>, 4> dests;
4671-
llvm::BasicBlock *defaultDest;
4672-
Explosion result;
4673-
auto *contBB = emitBBMapForSelect(*this, result, dests, defaultDest, inst);
4674-
4675-
// Emit the dispatch.
4676-
emitSwitchValueDispatch(*this, inst->getOperand()->getType(), value, dests,
4677-
defaultDest);
4678-
4679-
// emitBBMapForSelectEnum set up a continuation block and phi nodes to
4680-
// receive the result.
4681-
Builder.SetInsertPoint(contBB);
46824660

46834661
setLoweredValue(inst,
46844662
getLoweredValueForSelect(*this, result, inst));

lib/SIL/IR/OperandOwnership.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ OPERAND_OWNERSHIP(TrivialUse, PointerToAddress)
188188
OPERAND_OWNERSHIP(TrivialUse, ProjectBlockStorage)
189189
OPERAND_OWNERSHIP(TrivialUse, RawPointerToRef)
190190
OPERAND_OWNERSHIP(TrivialUse, SelectEnumAddr)
191-
// select_value is only supported for integer types currently.
192-
OPERAND_OWNERSHIP(TrivialUse, SelectValue)
193191
OPERAND_OWNERSHIP(TrivialUse, StructElementAddr)
194192
OPERAND_OWNERSHIP(TrivialUse, SwitchEnumAddr)
195193
OPERAND_OWNERSHIP(TrivialUse, SwitchValue)

lib/SIL/IR/SILInstruction.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -688,25 +688,6 @@ namespace {
688688
return visitSelectEnumInstBase(RHS);
689689
}
690690

691-
bool visitSelectValueInst(const SelectValueInst *RHS) {
692-
// Check that the instructions match cases in the same order.
693-
auto *X = cast<SelectValueInst>(LHS);
694-
695-
if (X->getNumCases() != RHS->getNumCases())
696-
return false;
697-
if (X->hasDefault() != RHS->hasDefault())
698-
return false;
699-
700-
for (unsigned i = 0, e = X->getNumCases(); i < e; ++i) {
701-
if (X->getCase(i).first != RHS->getCase(i).first)
702-
return false;
703-
if (X->getCase(i).second != RHS->getCase(i).second)
704-
return false;
705-
}
706-
707-
return true;
708-
}
709-
710691
// Conversion instructions.
711692
// All of these just return true as they have already had their
712693
// operands and types checked

lib/SIL/IR/SILInstructions.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,35 +1975,6 @@ SwitchValueInst *SwitchValueInst::create(
19751975
return ::new (buf) SwitchValueInst(Loc, Operand, DefaultBB, Cases, BBs);
19761976
}
19771977

1978-
SelectValueInst::SelectValueInst(SILDebugLocation DebugLoc, SILValue Operand,
1979-
SILType Type, SILValue DefaultResult,
1980-
ArrayRef<SILValue> CaseValuesAndResults)
1981-
: InstructionBaseWithTrailingOperands(Operand, CaseValuesAndResults,
1982-
DebugLoc, Type) {}
1983-
1984-
SelectValueInst *
1985-
SelectValueInst::create(SILDebugLocation Loc, SILValue Operand, SILType Type,
1986-
SILValue DefaultResult,
1987-
ArrayRef<std::pair<SILValue, SILValue>> CaseValues,
1988-
SILModule &M) {
1989-
// Allocate enough room for the instruction with tail-allocated data for all
1990-
// the case values and the SILSuccessor arrays. There are `CaseBBs.size()`
1991-
// SILValues and `CaseBBs.size() + (DefaultBB ? 1 : 0)` successors.
1992-
SmallVector<SILValue, 8> CaseValuesAndResults;
1993-
for (auto pair : CaseValues) {
1994-
CaseValuesAndResults.push_back(pair.first);
1995-
CaseValuesAndResults.push_back(pair.second);
1996-
}
1997-
1998-
if ((bool)DefaultResult)
1999-
CaseValuesAndResults.push_back(DefaultResult);
2000-
2001-
auto Size = totalSizeToAlloc<swift::Operand>(CaseValuesAndResults.size() + 1);
2002-
auto Buf = M.allocateInst(Size, alignof(SelectValueInst));
2003-
return ::new (Buf)
2004-
SelectValueInst(Loc, Operand, Type, DefaultResult, CaseValuesAndResults);
2005-
}
2006-
20071978
template <typename SELECT_ENUM_INST>
20081979
SELECT_ENUM_INST *SelectEnumInstBase::createSelectEnum(
20091980
SILDebugLocation Loc, SILValue Operand, SILType Ty, SILValue DefaultValue,

0 commit comments

Comments
 (0)