profile
viewpoint
John McCall rjmccall @apple 2008–present @apple: impl. clang++, des. & impl. ObjC, ARC, Swift; ed. @itanium-cxx-abi / 2006–08 MS cs.pdx.edu / 2003–06 gdviz.com / 2000–03 BS math.cmu.edu

itanium-cxx-abi/cxx-abi 274

C++ ABI Summary

rjmccall/glamr 1

Glulx LLVM frontend

rjmccall/rjmccall.github.io 1

Build a Jekyll blog in minutes, without touching the command line.

rjmccall/swift-evolution 1

This maintains proposals for changes and user-visible enhancements to the Swift Programming Language.

rjmccall/clang 0

Stash space for WIP on clang

rjmccall/cxx-abi 0

C++ ABI Summary

rjmccall/swift 0

The Swift Programming Language

rjmccall/swift-lldb 0

This is the version of LLDB that supports the Swift programming language & REPL.

push eventrjmccall/swift

Varun Gandhi

commit sha be109b72a576799a018dba368c8495d5a9f0d6e7

[AST] Add method to check if a function type has a non-trivial Clang type.

view details

Meghana Gupta

commit sha 0044e7dcac6ff176be0945ba0f468967979779d3

[ownership] Move OME past SILMem2Reg

view details

Varun Gandhi

commit sha 987d055b8c69347a4cd8533d7b59c7ceaccee0fe

[Mangler] Handle mangling for Clang types not derivable from Swift types.

view details

Varun Gandhi

commit sha 6cb71c6b457d17b16046d56777fe378b22c8d8bb

[ASTPrinter] Print Clang type only if not derivable from Swift type.

view details

swift-ci

commit sha cb900a6b694778a6576822852512448a22bcdeb6

Merge pull request #34057 from varungandhi-apple/vg-track-isDerivable-update-mangling

view details

Meghana Gupta

commit sha 8145566b7d72834b8e29eebe4f275d1c8d4411c0

Merge pull request #34380 from meg-gupta/moveomepastmem2reg [ownership] Move OME past SILMem2Reg

view details

John McCall

commit sha 9613acbaca428247bed2cb50fe4488342fe0f78e

Implicitly import _Concurrency under -enable-experimental-concurrency

view details

John McCall

commit sha 222894d384ad8c52ca10b0fc99319dea4622a2bf

Move swift_task_alloc/dealloc into the Concurrency library. Also, rename them to follow the general namespacing scheme.

view details

John McCall

commit sha 9c8fb9486e7188b69967b3153946a0bdf2f06a76

Prepare for a more real task-local alloocator implementation.

view details

John McCall

commit sha b79f685848f154a0275f5ad33dc9b1d57ea4c4b2

Add a missing `inline`.

view details

John McCall

commit sha c5fe43ab1689a83dde31f0f80e06e025eac0e896

Make the task allocator verify stack discipline in the laziest possible way.

view details

John McCall

commit sha af9ed04f08318b6fe60c7bc8c754b96dbcee8626

Add API for creating unscheduled tasks. Make all tasks into heap objects.

view details

push time in 2 minutes

pull request commentapple/swift

Implicitly import _Concurrency under -enable-experimental-concurrency

@swift-ci Please test

rjmccall

comment created time in 31 minutes

create barnchrjmccall/swift

branch : import-concurrency

created branch time in 31 minutes

issue commentitanium-cxx-abi/cxx-abi

mangling for placeholders for deduced class template specializations (CTAD)

It would be better if it were a substitution candidate, right? And that would only change mangling for this case, where we already have implementation disagreement?

zygoloid

comment created time in an hour

pull request commentapple/swift

Refine task APIs and introduce an API for task creation

@swift-ci Please test Windows platform

rjmccall

comment created time in 2 hours

pull request commentapple/swift

Refine task APIs and introduce an API for task creation

@swift-ci Please test

rjmccall

comment created time in 2 hours

push eventrjmccall/swift

Martin Boehme

commit sha a5e953b69009b59541420d06496206a26961a976

Add support for calling C++ constructors. Because C++ constructors always take a `this` pointer to the object to be initialized, we mark the SIL function return type with the `@out` attribute. On the IRGen side, we retrofit support for formal indirect return values as well as thin metatypes.

view details

Martin Boehme

commit sha 7ad2eef26508ad92d8d92f2d5546913c0ced3bbd

Only import constructors marked `noexcept`.

view details

Martin Boehme

commit sha 384854810a60a69c8df8a8c0248e209adc28c295

Revert "Only import constructors marked `noexcept`." This reverts commit 29650d8c1f302708a32304d49c703c9ddbf30b75. As discussed here, we want to import all constructors (whether they are marked `noexcept` or not) as non-throwing initializers; https://forums.swift.org/t/handling-c-exceptions/34823/50

view details

Martin Boehme

commit sha fd00bc1f01357ecd264b8216373c23014771c124

Move tests from `CXXInterop` to `Interop/Cxx`. This is the canonical location that we've agreed on.

view details

Martin Boehme

commit sha e6067275a6659cfab8640e68e93a5bba36ddca20

Duplicate changes to GenClangType in ClangTypeConverter. See discussion here: https://github.com/apple/swift/pull/30630#discussion_r398967412

view details

Martin Boehme

commit sha b2c5a3eeed4e0d80c819f98c816481fbedc49526

Add a constructor thunk if required to add additional constructor arguments. Also add more IR tests and make various other changes.

view details

Martin Boehme

commit sha 3066e16c37e26a5fea370877409b4d0bd1c0fea6

Remove redundant "cxx" from test names.

view details

Martin Boehme

commit sha 5644137ea0696164c5b5835179b1ec450d508c88

Eliminate duplication of code for adding empty argument names.

view details

Martin Boehme

commit sha bed26039446c189a82c453126e0a622e43c6256d

Various changes after merging master: - Adapt tests to changes that have happened in the meantime (e.g. `HasVirtualBase` is rightly no longer considered loadable) - Don't import copy or move constructors (noticed this because references are now imported correctly, so copy and move constructors suddenly started showing up in the SIL test) - Don't try to define an implicitly-deleted default constructor (this previously broke loadable-types-silgen.swift)

view details

Martin Boehme

commit sha beaaa742c3e774b6739de26bb1a3f0c8761512a5

Don't put an `sret` attribute on the `this` argument.

view details

Martin Boehme

commit sha 8416ccfa06d05da67af70a8ed57a2f120ea251b2

Rename constructors-ir.swift to constructors-irgen.swift.

view details

Martin Boehme

commit sha 8f6042aa0870a527505262c7dbe89ec7ffe20e12

Add additional IR tests for a class without a virtual base class.

view details

Martin Boehme

commit sha c9405fb7fc338f59db4386488245a3ce82227e00

Add Windows-name-mangled version of symbol to SIL test.

view details

Martin Boehme

commit sha cb4ddda6e2292c584cb83905f3f9df17a4e017f1

Avoid crashing if lldb imports C++ structs without enabling C++ interop.

view details

Martin Boehme

commit sha 33e8c717f2682b913eb04e1c7746c84315be90ef

Update comment in VisitCXXRecordDecl().

view details

Martin Boehme

commit sha 7e8ea120701b33958a1adca9e885a99f5d583607

Respond to review comments.

view details

Martin Boehme

commit sha 1ce3753d08522cefe255f4acf498dba5085aa60a

Another response to review comments.

view details

Martin Boehme

commit sha faca489c6f524096019fd124cba847949972e0db

Add a test that Objective-C types passed to a C++ constructor are bridged correctly.

view details

Martin Boehme

commit sha 83b51b95b534108494de1032bb4e098274fe606b

Add SILGen and IRGen tests for passing Objective-C types to C++ constructors.

view details

Martin Boehme

commit sha cc7564ecd1902901dc93844790a9ea11b3225df5

Rename constructors-sil.swift to constructors-silgen.swift.

view details

push time in 2 hours

create barnchrjmccall/swift

branch : task-creation-api

created branch time in 8 hours

pull request commentapple/swift

Refine task APIs and introduce an API for task creation

@swift-ci Please test

rjmccall

comment created time in 8 hours

PR opened apple/swift

Refine task APIs and introduce an API for task creation
+429 -102

0 comment

14 changed files

pr created time in 8 hours

issue closeditanium-cxx-abi/cxx-abi

cxx-abi

closed time in 2 days

dena21022

Pull request review commentapple/swift

Update function type mangling to use Clang type when applicable.

-// RUN: %target-swift-frontend -typecheck -swift-version 5 -emit-module-interface-path - -enable-library-evolution %s -experimental-print-full-convention | %FileCheck %s+// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -swift-version 5 -emit-module-interface-path - -enable-library-evolution %s -experimental-print-full-convention | %FileCheck %s++import ctypes  public func f(-  // CHECK: g: @convention(c, cType: "void (*)(void)")+  // CHECK: g: @convention(c)   g: @convention(c) () -> (), -  // CHECK: h0: @convention(c, cType: "int (*)(long long)")+  // CHECK: h0: @convention(c)   h0: @convention(c) (Int64) -> Int32,-  // CHECK: h1: @convention(c, cType: "int (*)(long long)")+  // CHECK: h1: @convention(c)   h1: @convention(c, cType: "int (*)(long long)") (Int64) -> Int32, -  // CHECK: i0: @convention(c, cType: "int *(*)(long long, int)")+  // CHECK: h1c: @convention(c, cType: "intptr_t (*)(size_t)")+  h1c: @convention(c, cType: "intptr_t (*)(size_t)") (Int) -> Int,++  // CHECK: i0: @convention(c)   i0: @convention(c) (Int64, Int32) -> Optional<UnsafeMutablePointer<Int32>>,-  // CHECK: i1: @convention(c, cType: "int *(*)(long long, int)")+  // CHECK: i1: @convention(c)   i1: @convention(c, cType: "int *(*)(long long, int)") (Int64, Int32) -> Optional<UnsafeMutablePointer<Int32>>, -  // CHECK: p0: @convention(c, cType: "void (*)(void (*)(int))")-  // CHECK:     @convention(c, cType: "void (*)(int)")+  // CHECK: i1c: @convention(c, cType: "size_t *(*)(intptr_t, ptrdiff_t)")+  i1c: @convention(c, cType: "size_t *(*)(intptr_t, ptrdiff_t)") (Int, Int) -> Optional<UnsafeMutablePointer<Int>>,++  // CHECK: p0: @convention(c)+  // CHECK:     @convention(c)   p0: @convention(c) (@convention(c) (Int32) -> Void) -> Void, -  // CHECK: p1: @convention(c, cType: "void (*)(void (*)(int))")-  // CHECK:     @convention(c, cType: "void (*)(int)")+  // CHECK: p1: @convention(c)+  // CHECK:     @convention(c)   p1: @convention(c, cType: "void (*)(void (*)(int))") (@convention(c) (Int32) -> Void) -> Void, -  // CHECK: p2: @convention(c, cType: "void (*)(void (*)(int))")-  // CHECK:     @convention(c, cType: "void (*)(int)")+  // CHECK: p1c: @convention(c, cType: "void (*)(void (*)(size_t))")+  // CHECK:      @convention(c)+  p1c: @convention(c, cType: "void (*)(void (*)(size_t))") (@convention(c) (Int) -> Void) -> Void,++  // CHECK: p2: @convention(c)+  // CHECK:     @convention(c)   p2: @convention(c) (@convention(c, cType: "void (*)(int)") (Int32) -> Void) -> Void, -  // CHECK: p3: @convention(c, cType: "void (*)(void (*)(int))")-  // CHECK:     @convention(c, cType: "void (*)(int)")-  p3: @convention(c, cType: "void (*)(void (*)(int))") (@convention(c, cType: "void (*)(int)") (Int32) -> Void) -> Void+  // CHECK: p2c: @convention(c)+  // CHECK:      @convention(c, cType: "void (*)(size_t)")+  p2c: @convention(c) (@convention(c, cType: "void (*)(size_t)") (Int) -> Void) -> Void,++  // CHECK: p3: @convention(c)+  // CHECK:     @convention(c)+  p3: @convention(c, cType: "void (*)(void (*)(int))") (@convention(c, cType: "void (*)(int)") (Int32) -> Void) -> Void,++  // CHECK: p3c: @convention(c)+  // CHECK:      @convention(c, cType: "void (*)(size_t)")+  p3c: @convention(c, cType: "void (*)(void (*)(size_t))") (@convention(c, cType: "void (*)(size_t)") (Int) -> Void) -> Void

I wonder what github is trying to tell us about these colons.

varungandhi-apple

comment created time in 2 days

Pull request review commentapple/swift

Update function type mangling to use Clang type when applicable.

 import def_clang_function_types // CHECK-LABEL: sil hidden @$s4main5test1yyF func test1() {   // FIXME: this mangling will have to change-  // CHECK: global_addr @$s24def_clang_function_types11has_fp_types13OpaquePointerVSgyXCSgvp : $*Optional<@convention(c, cType: "struct ForwardInTypedefForFP *(*)(void)") () -> Optional<OpaquePointer>>+  // CHECK: global_addr @$s24def_clang_function_types11has_fp_types13OpaquePointerVSgyXzC32_ZTSPFP21ForwardInTypedefForFPvESgvp : $*Optional<@convention(c, cType: "struct ForwardInTypedefForFP *(*)(void)") () -> Optional<OpaquePointer>>

I think the FIXME is resolved.

varungandhi-apple

comment created time in 2 days

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

pull request commentapple/swift

[IRGen] Call objc_direct methods correctly

@swift-ci Please test

ellishg

comment created time in 2 days

PullRequestReviewEvent

Pull request review commentapple/swift

[IRGen] Call objc_direct methods correctly

 Callee LoweredValue::getCallee(IRGenFunction &IGF,   switch (kind) {   case Kind::FunctionPointer: {     auto &fn = getFunctionPointer();+    if (calleeInfo.OrigFnType->getRepresentation() ==+        SILFunctionTypeRepresentation::ObjCMethod) {+      return getObjCDirectMethodCallee(std::move(calleeInfo), fn, selfValue);+    }

Thanks, that's exactly what I wanted.

ellishg

comment created time in 2 days

PullRequestReviewEvent

pull request commentapple/swift

Add support for calling C++ constructors

It looks like (on Windows only?) it's possible for a function template to have a CXXConstructorName if it wraps a CXXConstructorDecl.

Oh, yes, that's right. I don't think that's Windows only — any constructor template should have that characteristic.

martinboehme

comment created time in 2 days

PullRequestReviewEvent

pull request commentapple/swift

[Runtime] Switch MetadataCache to ConcurrentReadableHashMap.

The entries store a pointer:

It might be an interior pointer. It is for TupleCacheEntry, at least, and I think it is for some of the others as well. And I'm not sure you can safely copy a MetadataCacheEntryBase — you'll need to do serious surgery, at least.

mikeash

comment created time in 6 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentapple/swift

[Runtime] Switch MetadataCache to ConcurrentReadableHashMap.

So the actual entry in the hashtable now is an EntryType*, right? Or is it indirected an extra step for some reason?

That's right. The wrapper forwards key matching operations, but it's ultimately just a pointer, so there's just one level of indirection. As I mention in the PR description, I'd like to even get rid of that, but it's a bigger job.

I think the entries usually have the metadata inline, and the metadata address isn't allowed to change, so I'm not sure how you could do that.

mikeash

comment created time in 6 days

Pull request review commentapple/swift

[Runtime] Switch MetadataCache to ConcurrentReadableHashMap.

 struct ConcurrencyControl {   ConcurrencyControl() = default; }; -template <class EntryType, uint16_t Tag, bool ProvideDestructor = true>+template <class EntryType, uint16_t Tag>

Mostly I was reluctant to write a class that might be useless in other contexts.

mikeash

comment created time in 6 days

PullRequestReviewEvent

delete branch rjmccall/swift

delete branch : task-library

delete time in 6 days

push eventapple/swift

John McCall

commit sha 8ac43627540483dfb8c7bd0562a37cfd59ed8388

Implement a simple library for task cancellation and status management. There are things about this that I'm far from sold on. In particular, I'm concerned that in order to implement escalation correctly, we're going to have to add a status record for the fact that the task is being executed, which means we're going to have to potentially wait to acquire the status lock; overall, that means making an extra runtime function call and doing some atomics whenever we resume or suspend a task, which is an uncomfortable amount of overhead. The testing here is pretty grossly inadequate, but I wanted to lay down the groundwork here.

view details

John McCall

commit sha 7bc019e5da3817f2fe99c7b7b9a6b67bd2fd2ae1

Merge pull request #34198 from rjmccall/task-library Implement a simple library for task cancellation and status management

view details

push time in 6 days

PR merged apple/swift

Implement a simple library for task cancellation and status management

There are things about this that I'm far from sold on. In particular, I'm concerned that in order to implement escalation correctly, we're going to have to add a status record for the fact that the task is being executed, which means we're going to have to potentially wait to acquire the status lock; overall, that means making an extra runtime function call and doing some atomics whenever we resume or suspend a task, which is an uncomfortable amount of overhead.

The testing here is pretty grossly inadequate, but I wanted to lay down the groundwork.

+1803 -0

23 comments

14 changed files

rjmccall

pr closed time in 6 days

delete branch rjmccall/swift

delete branch : runtime-unittests-install-name

delete time in 6 days

push eventapple/swift

John McCall

commit sha 1cc3a57e9107f0b788c382739ea845f192f1546e

Test the just-built dylibs when building unittests on Darwin

view details

John McCall

commit sha 01672f59c14271a1efe9f488ee9c6a8a52b8c98c

Merge pull request #34302 from rjmccall/runtime-unittests-install-name Test the just-built libraries when building unittests on Darwin

view details

push time in 6 days

Pull request review commentapple/swift

Test the just-built libraries when building unittests on Darwin

+#!/usr/bin/env python++# On Darwin, dynamic libraries have an install name.  At link time, the+# linker can work with a dylib anywhere in the filesystem, but it will+# write the dylib's install name into the resulting image, and at load+# time that dylib will normally be expected to be found at exactly that+# path.  However, if the install name in an image begins with `@rpath`,+# it will instead be searched for in the image's runtime search path+# list.  That list may contain absolute paths, but it may also contain+# paths beginning with `@executable_path` or `@loader_path`, meaning the+# path containing the running executable or the image being loaded,+# respectively.+#+# Many of Swift's dylibs are meant to be installed on the system, which+# means they have install names like this:+#   /usr/lib/swift/libswiftFoo.dylib+# To support back-deployment, they also provide magic override symbols+# ($ld$install_name) for all the OS versions preceding the addition of+# of the library.  When the linker finds a dylib with a matching override+# for the OS deployment target, it ignores the normal install name and+# uses the override path in the linked image's load command.  Swift's+# libraries use override paths that begin with `@rpath`, and Swift+# builds images with a runtime search path list that starts with+# /usr/lib/swift but then falls back on a path relative to the image;+# thus, apps will use the system libraries if available but will+# otherwise use fallback libraries.+#+# When we're working on Swift, we usually want to test the libraries+# we just built rather than the system libraries.  There are two ways+# to achieve that.  The first is to override dyld's runtime search path+# with DYLD_LIBRARY_PATH; this will take precedence over even an+# absolute install name.  The second is to make sure the dylibs are+# loaded via an @rpath install name and then link the program with an+# rpath that will use the just-built libraries.  Unfortunately, the+# toolchain will ordinarily use an absolute install name instead of+# an @rpath if the deployment target is old enough, subverting testing.+#+# This script looks for dependent dylibs with an absolute path in+# /usr/lib/swift and changes them to use @rpath.++import argparse+import re+import subprocess+import sys+++def main(arguments):+    parser = argparse.ArgumentParser(+        description='Change absolute install names to use @rpath')+    parser.add_argument('bin', help='the binary')++    args = parser.parse_args(arguments)+    rpathize(args.bin)+++def rpathize(filename):+    dylibsOutput = subprocess.check_output(+        ['xcrun', 'dyldinfo', '-dylibs', filename])++    # The output from dyldinfo -dylibs is a line of header followed by one+    # install name per line, indented with spaces.+    dylib_regex = re.compile(+        r"^\s*(?P<path>/usr/lib/swift/(?P<filename>.*\.dylib))\s*$")

Hmm, yeah, I don't want to accidentally start missing this if we ever put attributes on these imports. Not sure what those attributes could actually be, though. I'll harden the regex in a follow-up ; it should be sufficient to look for (^|\s)/usr/lib/swift/.*.dylib\s*$ and ignore the start of the line.

rjmccall

comment created time in 6 days

PullRequestReviewEvent

Pull request review commentapple/swift

Test the just-built libraries when building unittests on Darwin

+#!/usr/bin/env python++# On Darwin, dynamic libraries have an install name.  At link time, the+# linker can work with a dylib anywhere in the filesystem, but it will+# write the dylib's install name into the resulting image, and at load+# time that dylib will normally be expected to be found at exactly that+# path.  However, if the install name in an image begins with `@rpath`,+# it will instead be searched for in the image's runtime search path+# list.  That list may contain absolute paths, but it may also contain+# paths beginning with `@executable_path` or `@loader_path`, meaning the+# path containing the running executable or the image being loaded,+# respectively.+#+# Many of Swift's dylibs are meant to be installed on the system, which+# means they have install names like this:+#   /usr/lib/swift/libswiftFoo.dylib+# To support back-deployment, they also provide magic override symbols+# ($ld$install_name) for all the OS versions preceding the addition of+# of the library.  When the linker finds a dylib with a matching override+# for the OS deployment target, it ignores the normal install name and+# uses the override path in the linked image's load command.  Swift's+# libraries use override paths that begin with `@rpath`, and Swift+# builds images with a runtime search path list that starts with+# /usr/lib/swift but then falls back on a path relative to the image;+# thus, apps will use the system libraries if available but will+# otherwise use fallback libraries.+#+# When we're working on Swift, we usually want to test the libraries+# we just built rather than the system libraries.  There are two ways+# to achieve that.  The first is to override dyld's runtime search path+# with DYLD_LIBRARY_PATH; this will take precedence over even an+# absolute install name.  The second is to make sure the dylibs are+# loaded via an @rpath install name and then link the program with an+# rpath that will use the just-built libraries.  Unfortunately, the+# toolchain will ordinarily use an absolute install name instead of+# an @rpath if the deployment target is old enough, subverting testing.+#+# This script looks for dependent dylibs with an absolute path in+# /usr/lib/swift and changes them to use @rpath.++import argparse+import re+import subprocess+import sys+++def main(arguments):+    parser = argparse.ArgumentParser(+        description='Change absolute install names to use @rpath')+    parser.add_argument('bin', help='the binary')++    args = parser.parse_args(arguments)+    rpathize(args.bin)+++def rpathize(filename):+    dylibsOutput = subprocess.check_output(+        ['xcrun', 'dyldinfo', '-dylibs', filename])++    # The output from dyldinfo -dylibs is a line of header followed by one+    # install name per line, indented with spaces.+    dylib_regex = re.compile(+        r"^\s*(?P<path>/usr/lib/swift/(?P<filename>.*\.dylib))\s*$")++    # Build a command to invoke install_name_tool.+    command = ['install_name_tool']+    for line in dylibsOutput.splitlines():+        match = dylib_regex.match(line)+        if match:+            command.append('-change')+            command.append(match.group('path'))+            command.append('@rpath/' + match.group('filename'))+            continue++    # Don't run the command if we didn't find any dylibs to change:+    # it's invalid to invoke install_name_tool without any operations.+    if len(command) == 1:

The example that hit this during PR testing was just a unit test that didn't link any Swift runtime libraries at all — I think it was testing something in Sema. But I think in principle you could also get it on the right deployment target, where the libraries declare an @rpath override for their install name.

rjmccall

comment created time in 6 days

PullRequestReviewEvent

Pull request review commentapple/swift

[IRGen] Call objc_direct methods correctly

 std::string SILDeclRef::mangle(ManglingKind MKind) const {             return SS.str();           }           return namedClangDecl->getName().str();+        } else if (auto objcDecl = dyn_cast<clang::ObjCMethodDecl>(clangDecl)) {+          if (objcDecl->isDirectMethod()) {+            // FIXME: Copied from `clang::CGObjCCommonMac:GetNameForMethod()`.

This has been committed to trunk; you might need to shepherd it into the stable branch.

ellishg

comment created time in 7 days

PullRequestReviewEvent

Pull request review commentapple/swift

[IRGen] Call objc_direct methods correctly

 Callee LoweredValue::getCallee(IRGenFunction &IGF,   switch (kind) {   case Kind::FunctionPointer: {     auto &fn = getFunctionPointer();+    if (calleeInfo.OrigFnType->getRepresentation() ==+        SILFunctionTypeRepresentation::ObjCMethod) {+      return getObjCDirectMethodCallee(std::move(calleeInfo), fn, selfValue);+    }

I just mean that you should have an IRGen test that checks for the exact sequence of materialization for the class argument, and you should leave a comment saying that we need to continue to do this for direct calls even if we stop doing it normally.

ellishg

comment created time in 7 days

PullRequestReviewEvent

Pull request review commentapple/swift

Add support for calling C++ constructors

 llvm::Function *IRGenModule::getAddrOfSILFunction(   if (auto clangDecl = f->getClangDecl()) {     auto globalDecl = getClangGlobalDeclForFunction(clangDecl);     clangAddr = getAddrOfClangGlobalDecl(globalDecl, forDefinition);++    if (auto ctor = dyn_cast<clang::CXXConstructorDecl>(clangDecl)) {+      clangAddr =+          emitCXXConstructorThunkIfNeeded(*this, f, ctor, entity, clangAddr);

No, it's fine, I don't think there's any reason for us to do extra work to try to always do a direct call.

martinboehme

comment created time in 7 days

PullRequestReviewEvent

pull request commentapple/swift

Implement a simple library for task cancellation and status management

Note that this includes a change that I'm landing separately as #34302.

rjmccall

comment created time in 7 days

pull request commentapple/swift

Implement a simple library for task cancellation and status management

@swift-ci Please test.

rjmccall

comment created time in 7 days

push eventrjmccall/swift

John McCall

commit sha 1cc3a57e9107f0b788c382739ea845f192f1546e

Test the just-built dylibs when building unittests on Darwin

view details

John McCall

commit sha 8ac43627540483dfb8c7bd0562a37cfd59ed8388

Implement a simple library for task cancellation and status management. There are things about this that I'm far from sold on. In particular, I'm concerned that in order to implement escalation correctly, we're going to have to add a status record for the fact that the task is being executed, which means we're going to have to potentially wait to acquire the status lock; overall, that means making an extra runtime function call and doing some atomics whenever we resume or suspend a task, which is an uncomfortable amount of overhead. The testing here is pretty grossly inadequate, but I wanted to lay down the groundwork here.

view details

push time in 7 days

pull request commentapple/swift

Test the just-built libraries when building unittests on Darwin

@swift-ci Please smoke test

rjmccall

comment created time in 7 days

pull request commentapple/swift

Test the just-built libraries when building unittests on Darwin

Everything passing but the Python linter, so switching to a smoke test.

rjmccall

comment created time in 7 days

push eventrjmccall/swift

John McCall

commit sha 1cc3a57e9107f0b788c382739ea845f192f1546e

Test the just-built dylibs when building unittests on Darwin

view details

push time in 7 days

Pull request review commentapple/swift

[Runtime] Switch MetadataCache to ConcurrentReadableHashMap.

 struct ConcurrencyControl {   ConcurrencyControl() = default; }; -template <class EntryType, uint16_t Tag, bool ProvideDestructor = true>+template <class EntryType, uint16_t Tag>

Is there just never a situation where we care about destructors for these?

mikeash

comment created time in 7 days

Pull request review commentapple/swift

[Runtime] Switch MetadataCache to ConcurrentReadableHashMap.

 class TupleCacheEntry     return 0; // No single meaningful value   } -  int compareWithKey(const Key &key) const {-    // Order by the cheaper comparisons first:+  friend llvm::hash_code hash_value(const TupleCacheEntry &value) {+    llvm::SmallVector<const Metadata *, 16> elements;+    elements.reserve(value.Data.NumElements);+    for (size_t i = 0, e = value.Data.NumElements; i != e; ++i) {+      elements.push_back(value.Data.getElement(i).Type);+    }++    Key key{value.Data.NumElements, elements.data(), value.Data.Labels};+    return hash_value(key);

Surely there's a way to do this without having to copy the elements into a local array. You could use a TransformRange to project out the Metadata* for hash_value().

mikeash

comment created time in 7 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentapple/swift

Add support for calling C++ constructors

+// Target-specific tests for C++ constructor call code generation.++// RUN: %swift -module-name Swift -target x86_64-apple-macosx10.9 -dump-clang-diagnostics -I %S/Inputs -enable-cxx-interop -emit-ir %s -parse-stdlib -parse-as-library -disable-legacy-type-info | %FileCheck %s -check-prefix=ITANIUM_X64+// RUN: %swift -module-name Swift -target armv7-none-linux-androideabi -dump-clang-diagnostics -I %S/Inputs -enable-cxx-interop -emit-ir %s -parse-stdlib -parse-as-library -disable-legacy-type-info | %FileCheck %s -check-prefix=ITANIUM_ARM+// RUN: %swift -module-name Swift -target x86_64-unknown-windows-msvc -dump-clang-diagnostics -I %S/Inputs -enable-cxx-interop -emit-ir %s -parse-stdlib -parse-as-library -disable-legacy-type-info | %FileCheck %s -check-prefix=MICROSOFT_X64++import Constructors+import TypeClassification++typealias Void = ()+struct UnsafePointer<T> { }+struct UnsafeMutablePointer<T> { }++public func createHasVirtualBase() -> HasVirtualBase {

I'd drop them.

martinboehme

comment created time in 7 days

PullRequestReviewEvent

Pull request review commentapple/swift

Add support for calling C++ constructors

 llvm::CallingConv::ID irgen::expandCallingConv(IRGenModule &IGM,  static void addIndirectResultAttributes(IRGenModule &IGM,                                         llvm::AttributeList &attrs,-                                        unsigned paramIndex, bool allowSRet) {+                                        unsigned paramIndex, bool allowSRet,+                                        bool noCapture = true) {

Yeah, I'm not quite sure. Swift doesn't currently expose the ability to rely on an escaped pointer into a value, at least in user code — it can happen in hidden ways, though, like in weak references.

martinboehme

comment created time in 7 days

PullRequestReviewEvent

Pull request review commentapple/swift

Add support for calling C++ constructors

 llvm::Function *IRGenModule::getAddrOfSILFunction(   if (auto clangDecl = f->getClangDecl()) {     auto globalDecl = getClangGlobalDeclForFunction(clangDecl);     clangAddr = getAddrOfClangGlobalDecl(globalDecl, forDefinition);++    if (auto ctor = dyn_cast<clang::CXXConstructorDecl>(clangDecl)) {+      clangAddr =+          emitCXXConstructorThunkIfNeeded(*this, f, ctor, entity, clangAddr);

Sure, that's not quite what I meant but it's okay.

martinboehme

comment created time in 7 days

PullRequestReviewEvent

pull request commentapple/swift

Implement a simple library for task cancellation and status management

@swift-ci Please test

rjmccall

comment created time in 7 days

push eventrjmccall/swift

John McCall

commit sha beb39b370c5a80f01c4af6c6a7419428e7b54938

Test the just-built dylibs when building unittests on Darwin

view details

John McCall

commit sha 2a92ba844fbceaaa60d3cd5770c41adab3bbb6fd

Implement a simple library for task cancellation and status management. There are things about this that I'm far from sold on. In particular, I'm concerned that in order to implement escalation correctly, we're going to have to add a status record for the fact that the task is being executed, which means we're going to have to potentially wait to acquire the status lock; overall, that means making an extra runtime function call and doing some atomics whenever we resume or suspend a task, which is an uncomfortable amount of overhead. The testing here is pretty grossly inadequate, but I wanted to lay down the groundwork here.

view details

push time in 7 days

pull request commentapple/swift

Test the just-built libraries when building unittests on Darwin

@swift-ci Please test

rjmccall

comment created time in 7 days

push eventrjmccall/swift

John McCall

commit sha beb39b370c5a80f01c4af6c6a7419428e7b54938

Test the just-built dylibs when building unittests on Darwin

view details

push time in 7 days

pull request commentapple/swift

Implement a simple library for task cancellation and status management

@swift-ci Please test

rjmccall

comment created time in 7 days

push eventrjmccall/swift

Dave Lee

commit sha 27330f169df5d2dcb018ab2c6615d66be91d04e2

[build] Remove unused lldb cmake

view details

Pavel Yaskevich

commit sha 9239692d00eb7a5362fe18f42dfcd9ddc687f45c

[unittests] Add a fixture for Sema unit tests

view details

Pavel Yaskevich

commit sha 0b22d91c9416e57a37829a6c471770e53f96fee2

[unittests] Extend Sema testing fixture to load stdlib (+ shims) Setup module importers, load stdlib, establish separate testing module and load a single main file there which imports standard library.

view details

Pavel Yaskevich

commit sha b2c31c394b02c0b2ae97f61e57daeeef8c770087

[unittests/Sema] Add an ability to retrieve stdlib types by name

view details

Pavel Yaskevich

commit sha dc7c9c2bfa0167180ec19f7a26029e16ef03dd60

[unittests/Sema] Add a simple integer literal type inference test

view details

Pavel Yaskevich

commit sha 6e470f5fcd55e94d5010e4621bec225314327f50

[unittest/Sema] NFC: Switch to use `AttributedImport` instead of deprecated `ImportedModuleDesc`

view details

Pavel Yaskevich

commit sha fde1af756d336cb4c22067c99fe2c83a3b026012

[unittest/Sema] Use default target triple to fix Windows build

view details

Alexis Laferrière

commit sha 8307a8d58e7ec6c5396b8e27ee4170a2f9fb844e

[Sema] Don't require availability for implicit decls Suppress warnings in synthesized code. The parent decls should already show a warning. require_explicit_availability.StructWithImplicitMembers:2:16: warning: public declarations should have an availability attribute when building with -require-explicit-availability public var hashValue: Int { get } ^

view details

Doug Gregor

commit sha f089ba9464fc164f6dc4ce01dafb1ec2f545912c

[Concurrency] Propagation of actor constraints. Implement propagation rules for global actor constraints, which can come from: * Enclosing extension or type * Superclass of a class * Overridden declaration * Requirement witnessed by a declaration * Storage declaration for an accessor

view details

Brent Royal-Gordon

commit sha a79417f48daeaa985100cafc30667a35015374b1

Tweak formatting of _Concurrency module CMakeLists.txt Helps fix rdar://66414410.

view details

swift-ci

commit sha 2c3a6e06f4edc2ed64a638e30379bbcc83479768

Merge pull request #34298 from brentdax/a-catalyst-for-nothing

view details

Dave Lee

commit sha b02dc2b25bc2c9c258370265c54d744c178a101c

LLDB_PATH_TO_SWIFT_SOURCE too

view details

Doug Gregor

commit sha 2f7ff6aa398dfe65f09fb2e44bc5969fdebbc11b

[Concurrency] Allow ActorIsolation in diagnostic messages. ActorIsolation is rendered as a descriptive phrase before an entity, e.g, "actor-independent" or "global actor 'UIActor'-isolated" when used in diagnostics.

view details

Doug Gregor

commit sha 18fd4be17a6a4307e46eeeae5d5220e3b9179c23

[Concurrency] Check actor isolation consistency for overrides & subclasses. Both overriding declarations and subclasses must have the actor isolation as their overridden declarations or superclasses, respectively. Enforce this, ensuring that we're also doing the appropriate substitutions.

view details

Doug Gregor

commit sha 11cf3ceffe20ea7d32678c5d83347735cea94341

[Concurrency] Eliminate actor isolation checking for subclasses. Subclasses inherit the global actor from their superclass by default, but it's okay to change it---it's just a default that can be overridden on a per-member basis anyway.

view details

Doug Gregor

commit sha a5b15ed6309ce9c893204bec9ba8e9a2d19d9b66

[Concurrency] Substitute into superclass global actors when inheriting them.

view details

Doug Gregor

commit sha 3a651a61b7868c6b13a0cb90eaf1a5be92762a7c

[Concurrency] Fix circular reference on isolation propagation.

view details

Alexis Laferrière

commit sha 5d21200fdfc5b863869e6aa7aa285a3a69fd3ef2

Merge pull request #34295 from xymus/require-explicit-avail-ignore-implicit [Sema] Don't require explicit availability for implicit decls

view details

Pavel Yaskevich

commit sha 6a19d371663a4cb27975ab47c3653625862f21e5

Merge pull request #34286 from xedin/add-sema-unittest-fixture [unittests] Add a fixture for Sema unit tests

view details

Doug Gregor

commit sha db8402f998117b65a74ef34df16717526f0b6a36

Merge pull request #34301 from DougGregor/concurrency-actor-constraint-inference [Concurrency] Propagation and consistency checking for actor constraints.

view details

push time in 7 days

pull request commentapple/swift

Test the just-built runtime when building the runtime unittests on Darwin

@swift-ci Please test

rjmccall

comment created time in 7 days

push eventrjmccall/swift

John McCall

commit sha b0aa9ac6675171fb3dac55289d072e3943d333ae

Test the just-built runtime when building the runtime unittests on Darwin

view details

push time in 7 days

pull request commentapple/swift

Test the just-built runtime when building the runtime unittests on Darwin

Does this also require changing SwiftRuntimeLongTests install name as well?

I've changed the patch to instead unconditionally rpath-ize all libraries of all unittests.

@mikeash Could you take another look?

rjmccall

comment created time in 7 days

push eventrjmccall/swift

Dave Lee

commit sha 27330f169df5d2dcb018ab2c6615d66be91d04e2

[build] Remove unused lldb cmake

view details

Pavel Yaskevich

commit sha 9239692d00eb7a5362fe18f42dfcd9ddc687f45c

[unittests] Add a fixture for Sema unit tests

view details

Pavel Yaskevich

commit sha 0b22d91c9416e57a37829a6c471770e53f96fee2

[unittests] Extend Sema testing fixture to load stdlib (+ shims) Setup module importers, load stdlib, establish separate testing module and load a single main file there which imports standard library.

view details

Pavel Yaskevich

commit sha b2c31c394b02c0b2ae97f61e57daeeef8c770087

[unittests/Sema] Add an ability to retrieve stdlib types by name

view details

Pavel Yaskevich

commit sha dc7c9c2bfa0167180ec19f7a26029e16ef03dd60

[unittests/Sema] Add a simple integer literal type inference test

view details

Pavel Yaskevich

commit sha 6e470f5fcd55e94d5010e4621bec225314327f50

[unittest/Sema] NFC: Switch to use `AttributedImport` instead of deprecated `ImportedModuleDesc`

view details

Pavel Yaskevich

commit sha fde1af756d336cb4c22067c99fe2c83a3b026012

[unittest/Sema] Use default target triple to fix Windows build

view details

Doug Gregor

commit sha f089ba9464fc164f6dc4ce01dafb1ec2f545912c

[Concurrency] Propagation of actor constraints. Implement propagation rules for global actor constraints, which can come from: * Enclosing extension or type * Superclass of a class * Overridden declaration * Requirement witnessed by a declaration * Storage declaration for an accessor

view details

Dave Lee

commit sha b02dc2b25bc2c9c258370265c54d744c178a101c

LLDB_PATH_TO_SWIFT_SOURCE too

view details

Doug Gregor

commit sha 2f7ff6aa398dfe65f09fb2e44bc5969fdebbc11b

[Concurrency] Allow ActorIsolation in diagnostic messages. ActorIsolation is rendered as a descriptive phrase before an entity, e.g, "actor-independent" or "global actor 'UIActor'-isolated" when used in diagnostics.

view details

Doug Gregor

commit sha 18fd4be17a6a4307e46eeeae5d5220e3b9179c23

[Concurrency] Check actor isolation consistency for overrides & subclasses. Both overriding declarations and subclasses must have the actor isolation as their overridden declarations or superclasses, respectively. Enforce this, ensuring that we're also doing the appropriate substitutions.

view details

Doug Gregor

commit sha 11cf3ceffe20ea7d32678c5d83347735cea94341

[Concurrency] Eliminate actor isolation checking for subclasses. Subclasses inherit the global actor from their superclass by default, but it's okay to change it---it's just a default that can be overridden on a per-member basis anyway.

view details

Doug Gregor

commit sha a5b15ed6309ce9c893204bec9ba8e9a2d19d9b66

[Concurrency] Substitute into superclass global actors when inheriting them.

view details

Doug Gregor

commit sha 3a651a61b7868c6b13a0cb90eaf1a5be92762a7c

[Concurrency] Fix circular reference on isolation propagation.

view details

Pavel Yaskevich

commit sha 6a19d371663a4cb27975ab47c3653625862f21e5

Merge pull request #34286 from xedin/add-sema-unittest-fixture [unittests] Add a fixture for Sema unit tests

view details

Doug Gregor

commit sha db8402f998117b65a74ef34df16717526f0b6a36

Merge pull request #34301 from DougGregor/concurrency-actor-constraint-inference [Concurrency] Propagation and consistency checking for actor constraints.

view details

Zoe Carver

commit sha 722cc755f8ee5bd74eb8f6c4e7f0a6514838fd50

[cxx-interop] Cast data to the correct type. (#34266) The implicit conversions are OK in C but C++ will error. To make this header valid in both C and C++ we should just always cast.

view details

Alexis Laferrière

commit sha e509d6883a068334df96f34ade141d8c38dfd1f0

Revert "[Sema] Fix availability checking in inlinable code"

view details

Dave Lee

commit sha 804459df815793cc3781addd3f14b0ee1a983abf

Merge pull request #34212 from apple/build-Remove-unused-lldb-cmake [build] Remove unused lldb cmake

view details

Robert Widmann

commit sha 6125d25cb4f5059f455b3c6f4bde70f6aa79f59e

[NFC] Silence Non-Exhaustive Switch Warnings on Windows

view details

push time in 7 days

pull request commentapple/swift

Test the just-built runtime when building the runtime unittests on Darwin

@swift-ci Please test

rjmccall

comment created time in 8 days

create barnchrjmccall/swift

branch : runtime-unittests-install-name

created branch time in 8 days

pull request commentapple/swift

Implement a simple library for task cancellation and status management

@swift-ci Please test.

rjmccall

comment created time in 8 days

push eventrjmccall/swift

Michael Gottesman

commit sha d3e6ffdbad9ed2af857508891a4530b7f11d4c6e

[lldb-toolbox] Add the ability to disassemble-to-file a specific function from a target without running the target. The routine already supports dumping the assembly to file if we are at a breakpoint using the current frame. This adds a -n option so one can without running just dump the assembly to a file of a specific function in a binary.

view details

Mike Ash

commit sha 630aff7b19b80f29445b645424e20fd1bb6bd551

[Runtime] Change SimpleGlobalCache to use ConcurrentReadableHashMap instead of ConcurrentMap. This gives us faster lookups and a small advantage in memory usage. Most of these maps need stable addresses for their entries, so we add a level of indirection to ConcurrentReadableHashMap for these cases to accommodate that. This costs some extra memory, but it's still a net win. A new StableAddressConcurrentReadableHashMap type handles this indirection and adds a convenience getOrInsert to take advantage of it. ConcurrentReadableHashMap is tweaked to avoid any global constructors or destructors when using it as a global variable. ForeignWitnessTables does not need stable addresses and it now uses ConcurrentReadableHashMap directly. rdar://problem/70056398

view details

Alexis Laferrière

commit sha e61ffea42c943044fe4fc8c35d5040bc8815e420

[Sema] Check availability in inlinable code using the explicit version Inlinable functions can be inlined in clients with a lower OS target version than the framework defining the function. For this reason, the availability in inlinable functions should always be checked using the explicit introduction OS version as lower bound and not the minimum deployment version. rdar://problem/67975153

view details

Alexis Laferrière

commit sha 53e04cb39db86d890ff674b775a5dbda47e9d599

[Sema] Test explicit versions in TypeRefinementContext

view details

Alexis Laferrière

commit sha 2f182c2b785f5f7b68ee756d1474f21f3050ba67

[Sema] Consider unavailable functions as being unreachable This has the effect of rejecting unavailable overrides to available methods in a similar way as overrides that are less available than the introduction are rejected.

view details

Alexis Laferrière

commit sha 39ee5916bd656cf56c75ddf45a47e628d0ff1db1

[SIL] Don't print availability for unreachable/unavailable functions

view details

Alexis Laferrière

commit sha c79d5cfbd6952c5dc141a24db10a87d548bc5f4f

[Sema] Still use the current minimum deployment target as fallback

view details

Alexis Laferrière

commit sha 25c9ddd7c817d4dee5a1643cc0fc32f3cf833af2

[Sema] Prioritize unavailability check for protocol witnesses The errors on explicit unavailability are more precise than those on availablity version. Make sure we prioritize the unavailability ones first.

view details

Alexis Laferrière

commit sha f536a581082633e33ea8849b7f1d2f9b0d816c6c

[Sema] Silence an inconsistent availability error for the stdlib Don't raise the error availability_decl_more_than_enclosing in the context is unavailable and if read in a swiftinterface file. This error was present in the stdlib in 5.3 without side effects so we still want to accept it.

view details

Alexis Laferrière

commit sha 429017fc7acc303d70c6251eec7c59c97255fa96

[ClangImporter] Import unavailable decls as unavailable

view details

Alexis Laferrière

commit sha d2343f23a4d14b37f1f603ae13e3421fb5455df4

[Sema] Create a new TypeRefinementContext only for explicit inlinables

view details

Alexis Laferrière

commit sha 1ca852e77a00bf8323494d7445d054ea28466b99

[Sema] Accept unavailable constructors override in unavailable types Preserve the old behavior of accepted unavailable override of constructors as this change would be source breaking.

view details

Alexis Laferrière

commit sha fca7d36cb42b044b1179254d6e38f2b8a263eeed

[Sema] Use the deployment target as minimum OS version in swiftinterfaces Preserve the previous behavior when parsing swiftinterfaces as the Swift stdlib for Swift 5.3 and a few other swiftinterfaces in Xcode 12.0 had issues that would now be reported as errors.

view details

Anthony Latsis

commit sha 826f17e53422d284edeeaf7ed6f13a122cd10f27

Decouple detection of «Self ==» constraints from SelfReferenceKind

view details

Anthony Latsis

commit sha 4ee517f65cded3bcfc707ed277113165db486167

AST: Refactor SelfReferenceKind in preparation for #33767 This will enable us to allow members containing references to Self or associated types only in covariant position to be used on an existential

view details

Erik Eckstein

commit sha 77f16471951fbcdf0bba9929b8e6d5d9228e32f6

RCIdentityAnalysis: some refactoring to improve clarity. NFC.

view details

Arnold Schwaighofer

commit sha b994bf319177ed07ab84402ec6e89590cbfdd5cd

Add support for `_specialize(exported: true, ...)` This attribute allows to define a pre-specialized entry point of a generic function in a library. The following definition provides a pre-specialized entry point for `genericFunc(_:)` for the parameter type `Int` that clients of the library can call. ``` @_specialize(exported: true, where T == Int) public func genericFunc<T>(_ t: T) { ... } ``` Pre-specializations of internal `@inlinable` functions are allowed. ``` @usableFromInline internal struct GenericThing<T> { @_specialize(exported: true, where T == Int) @inlinable internal func genericMethod(_ t: T) { } } ``` There is syntax to pre-specialize a method from a different module. ``` import ModuleDefiningGenericFunc @_specialize(exported: true, target: genericFunc(_:), where T == Double) func prespecialize_genericFunc(_ t: T) { fatalError("dont call") } ``` Specially marked extensions allow for pre-specialization of internal methods accross module boundries (respecting `@inlinable` and `@usableFromInline`). ``` import ModuleDefiningGenericThing public struct Something {} @_specializeExtension extension GenericThing { @_specialize(exported: true, target: genericMethod(_:), where T == Something) func prespecialize_genericMethod(_ t: T) { fatalError("dont call") } } ``` rdar://64993425

view details

Arnold Schwaighofer

commit sha 2a2cf91dcdf3fd5e50624eebfd3a0dc57b50ae0a

Add support for marking a _specialize attribute as SPI ``` @_specialize(exported: true, spi: SPIGroupName, where T == Int) public func myFunc() { } ``` The specialized entry point is only visible for modules that import using `_spi(SPIGroupName) import ModuleDefiningMyFunc `. rdar://64993425

view details

Arnold Schwaighofer

commit sha d6d79c66aa9bfa484547fa3be568d09bf21054bf

Merge two fields into a PointerUnion in SILDeclRef to save space

view details

Nathan Hawes

commit sha 90418612f400b3e2c58c4f42c635b55840ffeed8

[CodeCompletion] Reuse CompletionContextFinder for fallback completion when no typeCheckExpression call is made ...and adjust the fallback context it choses now that ErrorExprs no longer cause constraint generation to fail. Also fix some issues with the fallback logic in typeCheckForCodeCompletion: 1) For completion expressions in multi-statement closures, we were assuming a separate typeCheckExpression call would be made when the outer expression produced a single solution that had a resolved type for the closure. If the solution contained other fixes unrelated to the closure however, it wasn't applied and a separate call for the body was never made. 2) typeCheckForCodeComplation sometimes falls back to regular expression type checking but didn't update the passed-in target's expression after santizing and prechecking it, which may have modified it and its sub-expressions. This triggered assertion failures in certain cases due to the mix of the stale top-level expression pointer being used with updated subexpressions.

view details

push time in 8 days

Pull request review commentapple/swift

Add support for calling C++ constructors

 void SignatureExpansion::expandExternalSignatureTypes() {     }   } +  if (formalIndirectResult) {+    // If the result is a formal indirect result in SIL, that means that the+    // Clang function has an explicit output parameter (e.g. it's a C+++    // constructor). This means:+    // - Don't mark it `sret`, as this should only be used for C++ return+    //   values.+    // - The Clang function might capture the pointer, so don't specify+    //   `nocapture`.+    addIndirectResultAttributes(IGM, Attrs, 0, /* allowSRet = */ false,+                                /* noCapture = */ false);

Also, general question: have you tested this on an ARM target, e.g. Apple ARM64? Because the ARM C++ ABI actually gives constructors and destructors a return value (they return this), so we need to make sure we don't have unexpected mismatches.

martinboehme

comment created time in 8 days

Pull request review commentapple/swift

Add support for calling C++ constructors

 ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,   ArrayRef<const clang::ParmVarDecl *> params;   switch (D->getDeclName().getNameKind()) {   case clang::DeclarationName::CXXConstructorName:+    isInitializer = true;+    isFunction = true;+    result.info.initKind = CtorInitializerKind::Designated;+    baseName = "init";+    if (auto ctor = dyn_cast<clang::CXXConstructorDecl>(D))

Yeah, that's odd and needs investigation.

martinboehme

comment created time in 8 days

Pull request review commentapple/swift

Add support for calling C++ constructors

 void SignatureExpansion::expandExternalSignatureTypes() {     }   } +  if (formalIndirectResult) {+    // If the result is a formal indirect result in SIL, that means that the+    // Clang function has an explicit output parameter (e.g. it's a C+++    // constructor). This means:+    // - Don't mark it `sret`, as this should only be used for C++ return+    //   values.+    // - The Clang function might capture the pointer, so don't specify+    //   `nocapture`.+    addIndirectResultAttributes(IGM, Attrs, 0, /* allowSRet = */ false,+                                /* noCapture = */ false);

So, technically, the "i.e." doesn't hold here — we can have a semantically-indirect result that really isn't allowed to be captured this way. That would only happen with an aggregate that wasn't a non-trivial C++ type, though: for example, a struct with an ObjC __weak field or a field with an address-diversified __ptrauth type. So there are other reasons to maybe just let Clang handle these attributes.

martinboehme

comment created time in 8 days

Pull request review commentapple/swift

Add support for calling C++ constructors

 llvm::Function *IRGenModule::getAddrOfSILFunction(   if (auto clangDecl = f->getClangDecl()) {     auto globalDecl = getClangGlobalDeclForFunction(clangDecl);     clangAddr = getAddrOfClangGlobalDecl(globalDecl, forDefinition);++    if (auto ctor = dyn_cast<clang::CXXConstructorDecl>(clangDecl)) {+      clangAddr =+          emitCXXConstructorThunkIfNeeded(*this, f, ctor, entity, clangAddr);

Hmm, so we're always going through the thunk? Alright, I guess this is okay.

martinboehme

comment created time in 8 days

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

pull request commentapple/swift

Implement a simple library for task cancellation and status management

@swift-ci Please test Windows platform.

rjmccall

comment created time in 8 days

pull request commentapple/swift

Implement a simple library for task cancellation and status management

@swift-ci Please test.

rjmccall

comment created time in 8 days

push eventrjmccall/swift

John McCall

commit sha 0e71ef364325cd1a1be50678741ebec548372f5f

Implement a simple library for task cancellation and status management. There are things about this that I'm far from sold on. In particular, I'm concerned that in order to implement escalation correctly, we're going to have to add a status record for the fact that the task is being executed, which means we're going to have to potentially wait to acquire the status lock; overall, that means making an extra runtime function call and doing some atomics whenever we resume or suspend a task, which is an uncomfortable amount of overhead. The testing here is pretty grossly inadequate, but I wanted to lay down the groundwork here.

view details

push time in 8 days

push eventrjmccall/swift

John McCall

commit sha 4429bcb380bc56b1dd377177a7a3c4f98f3280fb

Implement a simple library for task cancellation and status management. There are things about this that I'm far from sold on. In particular, I'm concerned that in order to implement escalation correctly, we're going to have to add a status record for the fact that the task is being executed, which means we're going to have to potentially wait to acquire the status lock; overall, that means making an extra runtime function call and doing some atomics whenever we resume or suspend a task, which is an uncomfortable amount of overhead. The testing here is pretty grossly inadequate, but I wanted to lay down the groundwork here.

view details

push time in 8 days

PullRequestReviewEvent

Pull request review commentapple/swift

Update function type mangling to use Clang type when applicable.

  import ctypes -// CHECK: f1: (@convention(c, cType: "int (*)(int)") (Swift.Int32) -> Swift.Int32)?+// CHECK: f1: (@convention(c, cType: "size_t (*)(size_t)") (Swift.Int) -> Swift.Int)?

Conversely, size_t is reliably not the natural export of Swift.Int because it's an unsigned type.

varungandhi-apple

comment created time in 9 days

PullRequestReviewEvent

Pull request review commentapple/swift

Update function type mangling to use Clang type when applicable.

  import ctypes -// CHECK: f1: (@convention(c, cType: "int (*)(int)") (Swift.Int32) -> Swift.Int32)?+// CHECK: f1: (@convention(c, cType: "size_t (*)(size_t)") (Swift.Int) -> Swift.Int)?

Swift.Int is always pointer-sized.

varungandhi-apple

comment created time in 9 days

PullRequestReviewEvent

Pull request review commentapple/swift

Update function type mangling to use Clang type when applicable.

 void ASTMangler::appendFunctionType(AnyFunctionType *fn, bool isAutoClosure,     return appendOperator("c");    case AnyFunctionType::Representation::CFunctionPointer:+    if (mangleClangType) {+      appendOperator("XzC");+      return appendClangType(fn);+    }     return appendOperator("XC");   } } +template <typename FnType>+void ASTMangler::appendClangType(FnType *fn, llvm::raw_svector_ostream &out) {+  auto clangType = fn->getClangTypeInfo().getType();+  SmallString<64> scratch;+  llvm::raw_svector_ostream scratchOS(scratch);+  clang::ASTContext &clangCtx = fn->getASTContext()+      .getClangModuleLoader()+      ->getClangASTContext();+  std::unique_ptr<clang::ItaniumMangleContext> mangler{+      clang::ItaniumMangleContext::create(clangCtx, clangCtx.getDiagnostics())};

Yeah, this doesn't affect interoperation, and we're going to appreciate using a unified mangling for both testing and (if we ever need it) dynamic-demangling purposes.

MSVC's mangling is also missing a fair amount of the complexity of the C type system supported by Clang. It's also, in my opinion, pretty awful to try to read because the density of @s.

varungandhi-apple

comment created time in 9 days

PullRequestReviewEvent

pull request commentapple/swift

Implement a simple library for task cancellation and status management

@swift-ci Please test Windows platform

rjmccall

comment created time in 9 days

pull request commentapple/swift

Implement a simple library for task cancellation and status management

@swift-ci Please test

rjmccall

comment created time in 9 days

push eventrjmccall/swift

Mike Ash

commit sha ece0399d601eec1069131f465bdbe7e16f4c6a50

[Runtime] Have ConcurrentReadableHashMap use 1-byte or 2-byte indices when possible.

view details

Alexey Komnin

commit sha 4fa17bf59774ae6543a33b1a29f01320705f4dfe

SR-12022: refactor LiteralExpr to combine common initializer code

view details

Simon Evans

commit sha 960d0e30ee2b70ba3bb7ec076c16045afab01589

Linux: Fix -static-executable and remove swiftImageInspectionShared - Remove references to swiftImageInspectionShared on Linux and dont have split libraries between static/non-static linked executables. - -static-executable now links correctly Linux. Note: swift::lookupSymbol() will not work on statically linked executables but this can be worked around by using the https://github.com/swift-server/swift-backtrace package.

view details

Alexis Laferrière

commit sha c6fc53e844ac4fd542adb0669ac7038c2919d283

[Sema] Define availability via compiler flag Introduce availability macros defined by a frontend flag. This feature makes it possible to set the availability versions at the moment of compilation instead of having it hard coded in the sources. It can be used by projects with a need to change the availability depending on the compilation context while using the same sources. The availability macro is defined with the `-define-availability` flag: swift MyLib.swift -define-availability "_iOS8Aligned:macOS 10.10, iOS 8.0" .. The macro can be used in code instead of a platform name and version: @available(_iOS8Aligned, *) public func foo() {} rdar://problem/65612624

view details

Alexis Laferrière

commit sha 5ed261683d5973ef4dd45922b5ac77ba7cefcf43

[Sema] Report availability macros in inlinable code Availability macros can’t be used in inlinable code as inlinable is copied textually in the generated swiftinterface files. Further would could lift this limitation.

view details

Anthony Latsis

commit sha 8f43d888b8fd88540c5ba3d770a857928ac0b3a7

Sema: Disallow usage of settable Self-returning storage requirements on existential base

view details

Holly Borla

commit sha 456a50527c5948d0acfb2a155c6be3e414a8bfd0

[Sema] Adjust mutability in buildStorageRef appropriately for accessors on local variables.

view details

Holly Borla

commit sha 0c6ef5838e171ad6a79d76e1905ce01ef3cf909d

[DeclChecker] Explicitly compute captures for local functions in the decl checker.

view details

Robert Widmann

commit sha 703eece10df887222fd081574e8b4d4f6d93d365

[NFC] Extract ModuleInputs as a Separate Utility The driver will eventually use this to compute the input status of a merge-modules job.

view details

Robert Widmann

commit sha 25978e1ac955a7de888b405c7bf72e85b425f81d

[NFC] Add InputInfo::makeNeedsCascadingRebuild

view details

Robert Widmann

commit sha 83f5162f9ed3867fdb352612ad9930de3fa239fc

[NFC] Reorder InputInfo::Status In Terms of Impact on the Incremental Build

view details

Robert Widmann

commit sha d29dcf89011b8e94fbb841d6a1f2a2709df9bd87

[NFC] Upgrade CompileJobAction::InputInfo::Status to an enum class

view details

Robert Widmann

commit sha 84f9ba300420d5fc44c46dce675dea77942e80ab

Use ModuleInputs instead of a Vector to build MergeModules

view details

Robert Widmann

commit sha a81cf936ee1a0d77faf3881d17bf87eb683820b0

[NFC] Promote MergeModuleJobAction to an IncrementalJobAction

view details

Robert Widmann

commit sha cecb7c8313bea26583bed64b621871d4d3d20dc4

Schedule MergeModules Incrementally Plumb the logic necessary to schedule merge-modules incrementally. This means that if any inputs jobs to merge-modules run, merge-modules is run. But, if they are all skipped, merge-modules will be skipped as well. This requires some light special-casing of the legacy driver's incremental job handling because it assumes in a few places it can always extract a swiftdeps file. This invariant will be further broken when the precompile step for bridging headers is skipped as well. rdar://65893400

view details

Slava Pestov

commit sha 5e892b3dc950761697a5f2672dbb47c6e8bd1ce3

Sema: Eagerly expand scopes in TypeCheckASTNodeAtLocRequest

view details

Slava Pestov

commit sha 0c11fad5bd8018e18124f3e3cd4333cf99040c5b

ASTScope: Don't silently drop duplicate AST nodes Instead, let's rely on the existing source range assertions. They will fire if we add two nodes with overlapping or equal source ranges.

view details

Slava Pestov

commit sha ee0d008178d6046e12acaeaa9aad4f5d8647814c

Parse: Preserve source order when code completion adds delayed declarations

view details

Slava Pestov

commit sha 14620a34db8a92020daec4e09748e491bbfd0eca

ASTScope: Remove source range sorting

view details

Doug Gregor

commit sha 63dcd4e5605eb0944f0ecc74c38e3d0d45c48445

[Concurrency] Fix parsing bug async function types and labeled parameters.

view details

push time in 9 days

push eventllvm/llvm-project

John McCall

commit sha cec49a583693752b3984e49f9c193de07c2a7698

Revert "[SYCL] Implement __builtin_unique_stable_name." This reverts commit b5a034e771d0e4d7d8e71fc545b230d98e5a1f42. This feature was added without following the proper process.

view details

push time in 10 days

Pull request review commentapple/swift

Update function type mangling to use Clang type when applicable.

 class OldDemangler {     return true;   } -  void addImplFunctionAttribute(NodePointer parent, StringRef attr,-                         Node::Kind kind = Node::Kind::ImplFunctionAttribute) {-    parent->addChild(Factory.createNode(kind, attr), Factory);+  void addImplFunctionAttribute(+      NodePointer parent, StringRef attr, bool forConvention = false,+      Node::Kind kind = Node::Kind::ImplFunctionAttribute) {+    if (!forConvention) {+      parent->addChild(Factory.createNode(kind, attr), Factory);+      return;+    }+    auto attrNode = Factory.createNode(Node::Kind::ImplFunctionAttribute);+    attrNode->addChild(+        Factory.createNode(Node::Kind::ImplFunctionConventionName, attr),+        Factory);+    parent->addChild(attrNode, Factory);

If you're going to do this, seems to me that you ought to add a new ImplFunctionConvention node kind instead of reusing ImplFunctionAttribute with essentially a totally different structure. That would simplify some of the gnarly logic in remangling / printing these.

varungandhi-apple

comment created time in 10 days

PullRequestReviewEvent
more