Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
64f8bca
[Runtime] Add a NULL check to MetadataAllocator.
mikeash Nov 11, 2021
2e4a869
IRGen: Annotate runtime calls with `willreturn` attribute
aschwaighofer Nov 8, 2021
4343227
[Diagnostics] Determine affected elements early in collection element…
xedin Nov 12, 2021
c8c3f9b
[ClangImporter] Don't expect unmodularized structs to appear in 2 mod…
xymus Nov 8, 2021
0b4ec1c
[ConstraintSystem] Add accessor to check whether target represents `a…
xedin Nov 10, 2021
920669d
[Concurrency] Extract the check for async context to the namespace
xedin Nov 10, 2021
3cebfdd
[Distributed] Add a way to determine if particular reference is to di…
xedin Nov 10, 2021
115af99
[CSApply] Mark call to distributed thunks as implicitly throwing
xedin Nov 10, 2021
2c66b20
[Distributed] NFC: Add a test-case for different `async let` configur…
xedin Nov 10, 2021
ad42a9f
[AST] Associated `isActorSelf` with `VarDecl`
xedin Nov 13, 2021
fc0f05f
[TypeChecker] Implement distributed thunk identification in expr rewr…
xedin Nov 13, 2021
70360eb
[TypeCheckConcurrency] Stop exposing `isAsynchronousContext` as no lo…
xedin Nov 13, 2021
fcd93a5
[Distributed] Improve error messages for protocol conformances
ktoso Nov 14, 2021
f58b133
[Distributed] adjust conformance error messages a bit
ktoso Nov 15, 2021
17fef2f
Give bind_memory a token result.
atrick Nov 12, 2021
90c0c8b
Add rebind_memory SIL instruction.
atrick Nov 12, 2021
b548a6e
Enable RLE tests for TBAA and add rebind_memory test.
atrick Nov 15, 2021
dd1e6cd
[SwiftSyntax] Replace ExpressibleAs protocols by ExpressibleBy protocols
ahoppen Nov 15, 2021
a50b4a9
[build-presets] Don't install sk-stress-test and swift-evolve into th…
ahoppen Nov 8, 2021
15098e2
[AST] Rename resolveComponents -> setComponents
hamishknight Nov 15, 2021
d6ac93e
[CS] Don't set parsed paths for dynamic member key paths
hamishknight Nov 15, 2021
76c6254
[AST] Refactor KeyPathExpr constructors
hamishknight Nov 15, 2021
86ea061
Merge pull request #40182 from ahoppen/pr/expressible-by
ahoppen Nov 15, 2021
83bfa1b
cmake: export the libswift target and the LIBSWIFT_BUILD_MODE that th…
eeckstein Nov 11, 2021
f9ea748
[PrintAsObjC] Import/fwd-declare types used in `@_cdecl` functions.
allevato May 14, 2021
008317b
Merge pull request #40091 from xymus/twice-the-imported-struct
xymus Nov 15, 2021
3a5ba2a
Merge pull request #40156 from atrick/rawrebound
atrick Nov 15, 2021
c63a93c
Add SWIFT_STDLIB_EXTRA_SWIFT_COMPILE_FLAGS and SWIFT_STDLIB_EXTRA_C_C…
kubamracek Nov 15, 2021
9a2f449
Merge pull request #40139 from mikeash/metadataallocator-null-check
mikeash Nov 15, 2021
21350a9
Merge pull request #40130 from xedin/rdar-83610106-with-locals
xedin Nov 15, 2021
9218ca0
Merge pull request #40159 from xedin/rdar-85021348
xedin Nov 15, 2021
72eb5e2
[move-operator] Specify if LexicalLifetimes is enabled using an enum …
gottesmm Nov 15, 2021
c5c78c5
Add an insertAtFront method to the list merger.
rjmccall Nov 15, 2021
abf6a30
Revert "[Index] Apply RelationContainedBy role to references containe…
bnbarham Nov 15, 2021
4c8983b
Add a convenience tri-valued descending comparison for job priorities.
rjmccall Nov 15, 2021
5d34f5b
Merge pull request #40190 from apple/revert-38883-SR-13766
lorentey Nov 15, 2021
dcffbc0
Merge pull request #37436 from allevato/lost-in-a-c-of-decls
allevato Nov 15, 2021
3b402f0
[stdlib] Implement native Unicode.Scalar binary properties (#39597)
Azoy Nov 15, 2021
0bd0f77
NFC: move the global executor implementations into their own files
rjmccall Nov 15, 2021
66bd5e6
Add ASTMangler.AllowStandardSubstitutions to allow using a stripped-d…
kubamracek Nov 15, 2021
6ba7a1e
[cxx-interop] Fix two issues with extending nested types across modules.
zoecarver Nov 9, 2021
5a99ae4
Make (Unsafe|Checked)Continuation's Sendable conformance conditional.
DougGregor Nov 16, 2021
3eba144
Merge pull request #40189 from gottesmm/pr-aeffd0309402b8c9a744770c71…
gottesmm Nov 16, 2021
3d08df9
Avoid including unistd.h and replace write(STDERR) with fputs(stderr)…
kubamracek Nov 16, 2021
4ca4625
Enable the IRGen/hermetic-seal-exec.swift test (#40085)
kubamracek Nov 16, 2021
0b5081d
Merge pull request #40191 from rjmccall/job-priority-sorting-prep
swift-ci Nov 16, 2021
4fbf7a5
Merge pull request #40192 from DougGregor/unchecked-continuation-cond…
swift-ci Nov 16, 2021
a78d1bc
Merge pull request #40179 from ktoso/wip-dist-func-protos
ktoso Nov 16, 2021
2f2ee1b
ModuleInterface: print @_originallyDefinedIn attributes for synthesiz…
nkcsgexi Nov 16, 2021
67cb7b7
Merge pull request #40185 from eeckstein/libswift-lldb
eeckstein Nov 16, 2021
c45f2c4
[NFC] Introduce a typedef for job delay in nanoseconds.
rjmccall Nov 16, 2021
26ea1fe
Miscellaneous improvements to the cooperative executor:
rjmccall Nov 16, 2021
551604a
Merge pull request #40183 from hamishknight/the-path-less-traveled
hamishknight Nov 16, 2021
17cba71
Merge pull request #40196 from nkcsgexi/85426499
nkcsgexi Nov 16, 2021
b90732c
Merge pull request #40089 from aschwaighofer/irgen_annotate_runtime_f…
aschwaighofer Nov 16, 2021
893bb06
Merge pull request #40084 from ahoppen/pr/dont-install-stress-tester
ahoppen Nov 16, 2021
8980b8b
Merge pull request #40165 from zoecarver/fix-extensions-across-modules
zoecarver Nov 16, 2021
7880972
Merge pull request #40198 from rjmccall/coop-global-executor-improvem…
rjmccall Nov 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ function(add_libswift name)
# Create a static libswift library containing all module object files.
add_library(${name} STATIC ${all_obj_files})
set_target_properties(${name} PROPERTIES LINKER_LANGUAGE CXX)
set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${name})
endfunction()

macro(add_swift_tool_subdirectory name)
Expand Down
2 changes: 2 additions & 0 deletions cmake/modules/SwiftConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ set(SWIFT_LIBRARY_DIR "@SWIFT_LIBRARY_DIRS@")
set(SWIFT_CMAKE_DIR "@SWIFT_CMAKE_DIR@")
set(SWIFT_BINARY_DIR "@SWIFT_BINARY_DIR@")

set(LIBSWIFT_BUILD_MODE "@LIBSWIFT_BUILD_MODE@")

set(CMARK_TARGETS_FILE @SWIFT_PATH_TO_CMARK_BUILD@/src/cmarkTargets.cmake)
if(NOT TARGET libcmark_static AND EXISTS ${CMARK_TARGETS_FILE})
include(${CMARK_TARGETS_FILE})
Expand Down
30 changes: 29 additions & 1 deletion docs/SIL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3985,13 +3985,41 @@ bind_memory

sil-instruction ::= 'bind_memory' sil-operand ',' sil-operand 'to' sil-type

bind_memory %0 : $Builtin.RawPointer, %1 : $Builtin.Word to $T
%token = bind_memory %0 : $Builtin.RawPointer, %1 : $Builtin.Word to $T
// %0 must be of $Builtin.RawPointer type
// %1 must be of $Builtin.Word type
// %token is an opaque $Builtin.Word representing the previously bound types
// for this memory region.

Binds memory at ``Builtin.RawPointer`` value ``%0`` to type ``$T`` with enough
capacity to hold ``%1`` values. See SE-0107: UnsafeRawPointer.

Produces a opaque token representing the previous memory state. For
memory binding semantics, this state includes the type that the memory
was previously bound to. The token cannot, however, be used to
retrieve a metatype. It's value is only meaningful to the Swift
runtime for typed pointer verification.

rebind_memory
`````````````

::

sil-instruction ::= 'rebind_memory' sil-operand ' 'to' sil-value

%out_token = rebind_memory %0 : $Builtin.RawPointer to %in_token
// %0 must be of $Builtin.RawPointer type
// %in_token represents a cached set of bound types from a prior memory state.
// %out_token is an opaque $Builtin.Word representing the previously bound
// types for this memory region.

This instruction's semantics are identical to ``bind_memory``, except
that the types to which memory will be bound, and the extent of the
memory region is unknown at compile time. Instead, the bound-types are
represented by a token that was produced by a prior memory binding
operation. ``%in_token`` must be the result of bind_memory or
rebind_memory.

begin_access
````````````

Expand Down
6 changes: 6 additions & 0 deletions include/swift/ABI/MetadataValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -2022,6 +2022,12 @@ enum class JobPriority : size_t {
Unspecified = 0x00,
};

/// A tri-valued comparator which orders higher priorities first.
inline int descendingPriorityOrder(JobPriority lhs,
JobPriority rhs) {
return (lhs == rhs ? 0 : lhs > rhs ? -1 : 1);
}

/// Flags for task creation.
class TaskCreateFlags : public FlagSet<size_t> {
public:
Expand Down
4 changes: 4 additions & 0 deletions include/swift/AST/ASTMangler.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ class ASTMangler : public Mangler {
/// to fill these in.
bool AllowSymbolicReferences = false;

/// If enabled, allows the use of standard substitutions for types in the
/// standard library.
bool AllowStandardSubstitutions = true;

/// If enabled, allows the use of standard substitutions for types in the
/// concurrency library.
bool AllowConcurrencyStandardSubstitutions = true;
Expand Down
11 changes: 10 additions & 1 deletion include/swift/AST/Builtins.def
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,18 @@ BUILTIN_SIL_OPERATION(BeginCOWMutation_native, "beginCOWMutation_native", Specia
/// inout argument. After calling this builtin, the buffer must not be mutated.
BUILTIN_SIL_OPERATION(EndCOWMutation, "endCOWMutation", Special)

/// bindMemory : <T> (Builtin.RawPointer, Builtin.Word, T.Type) -> ()
/// bindMemory : <T> (Builtin.RawPointer, Builtin.Word, T.Type) -> Builtin.Word
///
/// Binds memory to a statically known type. Returns an opaque token
/// representing the memory region's previously bound types.
BUILTIN_SIL_OPERATION(BindMemory, "bindMemory", Special)

/// rebindMemory : (Builtin.RawPointer, Builtin.Word) -> Builtin.Word
///
/// Binds memory to the types represented by an opaque token operand. Returns an
/// opaque token representing the memory region's previously bound types.
BUILTIN_SIL_OPERATION(RebindMemory, "rebindMemory", Special)

/// allocWithTailElems_<n>(C.Type,
/// Builtin.Word, E1.Type, ... , Builtin.Word, En.Type) -> C\
///
Expand Down
4 changes: 4 additions & 0 deletions include/swift/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ enum class DescriptiveDeclKind : uint8_t {
Method,
StaticMethod,
ClassMethod,
DistributedMethod,
Getter,
Setter,
Addressor,
Expand Down Expand Up @@ -5300,6 +5301,9 @@ class VarDecl : public AbstractStorageDecl {
/// Returns true if the name is the self identifier and is implicit.
bool isSelfParameter() const;

/// Check whether the variable is the "self" of an actor method.
bool isActorSelf() const;

/// Determine whether this property will be part of the implicit memberwise
/// initializer.
///
Expand Down
15 changes: 9 additions & 6 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -4363,7 +4363,7 @@ NOTE(note_add_distributed_to_decl,none,
"add 'distributed' to %0 to make this %1 witness the protocol requirement",
(DeclName, DescriptiveDeclKind))
NOTE(note_distributed_requirement_defined_here,none,
"distributed function requirement %0 declared here",
"distributed instance method requirement %0 declared here",
(DeclName))
NOTE(note_add_globalactor_to_function,none,
"add '@%0' to make %1 %2 part of global actor %3",
Expand Down Expand Up @@ -4502,13 +4502,13 @@ NOTE(note_distributed_actor_isolated_method,none,
"distributed actor-isolated %0 %1 declared here",
(DescriptiveDeclKind, DeclName))
ERROR(distributed_actor_isolated_method,none,
"only 'distributed' functions can be called on a potentially remote distributed actor",
"only 'distributed' instance methods can be called on a potentially remote distributed actor",
())
ERROR(distributed_actor_func_param_not_codable,none,
"distributed function parameter '%0' of type %1 does not conform to 'Codable'",
"distributed instance method parameter '%0' of type %1 does not conform to 'Codable'",
(StringRef, Type))
ERROR(distributed_actor_func_result_not_codable,none,
"distributed function result type %0 does not conform to 'Codable'",
"distributed instance method result type %0 does not conform to 'Codable'",
(Type))
ERROR(distributed_actor_remote_func_implemented_manually,none,
"distributed function's %0 remote counterpart %1 cannot not be implemented manually.",
Expand All @@ -4519,6 +4519,9 @@ ERROR(nonisolated_distributed_actor_storage,none,
ERROR(distributed_actor_func_nonisolated, none,
"function %0 cannot be both 'nonisolated' and 'distributed'",
(DeclName))
ERROR(distributed_actor_func_private, none,
"%0 %1 cannot be 'private'",
(DescriptiveDeclKind, DeclName))
ERROR(distributed_actor_remote_func_is_not_static,none,
"remote function %0 must be static.",
(DeclName))
Expand Down Expand Up @@ -4628,7 +4631,7 @@ ERROR(actor_instance_property_wrapper,none,
(Identifier, Identifier))

ERROR(distributed_actor_func_defined_outside_of_distributed_actor,none,
"distributed function %0 is declared outside of an distributed actor",
"distributed instance method %0 is declared outside of an distributed actor",
(DeclName))
ERROR(distributed_actor_local_var,none,
"'distributed' can not be applied to local variables",
Expand All @@ -4648,7 +4651,7 @@ ERROR(distributed_actor_not_actor_func,none,
"'distributed' can only be applied to distributed actor async functions",
())
ERROR(distributed_actor_func_static,none,
"'distributed' functions cannot be 'static'",
"'distributed' method cannot be 'static'",
())
ERROR(distributed_actor_func_not_in_distributed_actor,none,
"'distributed' function can only be declared within 'distributed actor'",
Expand Down
60 changes: 39 additions & 21 deletions include/swift/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -4367,7 +4367,7 @@ class ApplyExpr : public Expr {
/// Is this application _implicitly_ required to be a throwing call?
/// This can happen if the function is actually a proxy function invocation,
/// which may throw, regardless of the target function throwing, e.g.
/// a distributed function call on a 'remote' actor, may throw due to network
/// a distributed instance method call on a 'remote' actor, may throw due to network
/// issues reported by the transport, regardless if the actual target function
/// can throw.
bool implicitlyThrows() const {
Expand Down Expand Up @@ -5562,24 +5562,43 @@ class KeyPathExpr : public Expr {
private:
llvm::MutableArrayRef<Component> Components;

public:
/// Create a new #keyPath expression.
KeyPathExpr(ASTContext &C,
SourceLoc keywordLoc, SourceLoc lParenLoc,
ArrayRef<Component> components,
SourceLoc rParenLoc,
bool isImplicit = false);
KeyPathExpr(SourceLoc startLoc, Expr *parsedRoot, Expr *parsedPath,
SourceLoc endLoc, bool hasLeadingDot, bool isObjC,
bool isImplicit);

/// Create a key path with unresolved root and path expressions.
KeyPathExpr(SourceLoc backslashLoc, Expr *parsedRoot, Expr *parsedPath,
bool hasLeadingDot, bool isImplicit = false)
: Expr(ExprKind::KeyPath, isImplicit), StartLoc(backslashLoc),
EndLoc(parsedPath ? parsedPath->getEndLoc() : parsedRoot->getEndLoc()),
ParsedRoot(parsedRoot), ParsedPath(parsedPath),
HasLeadingDot(hasLeadingDot) {
assert((parsedRoot || parsedPath) &&
"keypath must have either root or path");
Bits.KeyPathExpr.IsObjC = false;
}
bool hasLeadingDot, bool isImplicit);

/// Create a key path with components.
KeyPathExpr(ASTContext &ctx, SourceLoc startLoc,
ArrayRef<Component> components, SourceLoc endLoc, bool isObjC,
bool isImplicit);

public:
/// Create a new parsed Swift key path expression.
static KeyPathExpr *createParsed(ASTContext &ctx, SourceLoc backslashLoc,
Expr *parsedRoot, Expr *parsedPath,
bool hasLeadingDot);

/// Create a new parsed #keyPath expression.
static KeyPathExpr *createParsedPoundKeyPath(ASTContext &ctx,
SourceLoc keywordLoc,
SourceLoc lParenLoc,
ArrayRef<Component> components,
SourceLoc rParenLoc);

/// Create an implicit Swift key path expression with a set of resolved
/// components.
static KeyPathExpr *createImplicit(ASTContext &ctx, SourceLoc backslashLoc,
ArrayRef<Component> components,
SourceLoc endLoc);

/// Create an implicit Swift key path expression with a root and path
/// expression to be resolved.
static KeyPathExpr *createImplicit(ASTContext &ctx, SourceLoc backslashLoc,
Expr *parsedRoot, Expr *parsedPath,
bool hasLeadingDot);

SourceLoc getLoc() const { return StartLoc; }
SourceRange getSourceRange() const { return SourceRange(StartLoc, EndLoc); }
Expand All @@ -5592,10 +5611,9 @@ class KeyPathExpr : public Expr {
return Components;
}

/// Resolve the components of an un-type-checked expr. This copies over the
/// components from the argument array.
void resolveComponents(ASTContext &C,
ArrayRef<Component> resolvedComponents);
/// Set the key path components. This copies over the components from the
/// argument array.
void setComponents(ASTContext &C, ArrayRef<Component> newComponents);

/// Indicates if the key path expression is composed by a single invalid
/// component. e.g. missing component `\Root`
Expand Down
5 changes: 5 additions & 0 deletions include/swift/AST/IRGenOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ class IRGenOptions {
/// Whether to disable using mangled names for accessing concrete type metadata.
unsigned DisableConcreteTypeMetadataMangledNameAccessors : 1;

/// Whether to disable referencing stdlib symbols via mangled names in
/// reflection mangling.
unsigned DisableStandardSubstitutionsInReflectionMangling : 1;

unsigned EnableGlobalISel : 1;

unsigned VirtualFunctionElimination : 1;
Expand Down Expand Up @@ -425,6 +429,7 @@ class IRGenOptions {
GenerateProfile(false), EnableDynamicReplacementChaining(false),
DisableRoundTripDebugTypes(false), DisableDebuggerShadowCopies(false),
DisableConcreteTypeMetadataMangledNameAccessors(false),
DisableStandardSubstitutionsInReflectionMangling(false),
EnableGlobalISel(false), VirtualFunctionElimination(false),
WitnessMethodElimination(false), ConditionalRuntimeRecords(false),
InternalizeAtLink(false),
Expand Down
19 changes: 18 additions & 1 deletion include/swift/AST/SILOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@

namespace swift {

enum class LexicalLifetimesOption : uint8_t {
// Do not insert any lexical lifetimes.
Off = 0,

// Insert lexical lifetimes and do not remove them until OSSA is lowered. This
// is experimental.
ExperimentalLate,
};

class SILModule;

class SILOptions {
public:
/// Controls the aggressiveness of the performance inliner.
Expand All @@ -45,7 +56,7 @@ class SILOptions {
bool RemoveRuntimeAsserts = false;

/// Enable experimental support for emitting defined borrow scopes.
bool EnableExperimentalLexicalLifetimes = false;
LexicalLifetimesOption LexicalLifetimes = LexicalLifetimesOption::Off;

/// Force-run SIL copy propagation to shorten object lifetime in whatever
/// optimization pipeline is currently used.
Expand Down Expand Up @@ -226,6 +237,12 @@ class SILOptions {
bool shouldOptimize() const {
return OptMode > OptimizationMode::NoOptimization;
}

/// Returns true if we support inserting lexical lifetimes given the current
/// SIL stage.
///
/// Defined in SILModule.h.
bool supportsLexicalLifetimes(const SILModule &mod) const;
};

} // end namespace swift
Expand Down
Loading