|
13 | 13 | // This file defines x-macros used for metaprogramming with the set of
|
14 | 14 | // runtime functions.
|
15 | 15 | //
|
| 16 | +// Runtime functions that read from object arguments cannot be marked |
| 17 | +// ReadNone. Otherwise the objects may be freed before the runtime call. |
| 18 | +// |
16 | 19 | //===----------------------------------------------------------------------===//
|
17 | 20 |
|
18 | 21 | /// FUNCTION(Id, Name, CC, Availability, ReturnTys, ArgTys, Attrs)
|
@@ -56,10 +59,11 @@ FUNCTION(DeallocBox, swift_deallocBox, C_CC, AlwaysAvailable,
|
56 | 59 | ARGS(RefCountedPtrTy),
|
57 | 60 | ATTRS(NoUnwind))
|
58 | 61 |
|
| 62 | +// swift_projectBox reads object metadata so cannot be marked ReadNone. |
59 | 63 | FUNCTION(ProjectBox, swift_projectBox, C_CC, AlwaysAvailable,
|
60 | 64 | RETURNS(OpaquePtrTy),
|
61 | 65 | ARGS(RefCountedPtrTy),
|
62 |
| - ATTRS(NoUnwind, ReadNone)) |
| 66 | + ATTRS(NoUnwind, ReadOnly, ArgMemOnly)) |
63 | 67 |
|
64 | 68 | FUNCTION(AllocEmptyBox, swift_allocEmptyBox, C_CC, AlwaysAvailable,
|
65 | 69 | RETURNS(RefCountedPtrTy),
|
@@ -795,11 +799,12 @@ FUNCTION(GetObjCClassFromMetadata, swift_getObjCClassFromMetadata,
|
795 | 799 | ATTRS(NoUnwind, ReadNone))
|
796 | 800 |
|
797 | 801 | // Metadata *swift_getObjCClassFromObject(id object);
|
| 802 | +// This reads object metadata so cannot be marked ReadNone. |
798 | 803 | FUNCTION(GetObjCClassFromObject, swift_getObjCClassFromObject,
|
799 | 804 | C_CC, AlwaysAvailable,
|
800 | 805 | RETURNS(ObjCClassPtrTy),
|
801 | 806 | ARGS(ObjCPtrTy),
|
802 |
| - ATTRS(NoUnwind, ReadNone)) |
| 807 | + ATTRS(NoUnwind, ReadOnly, ArgMemOnly)) |
803 | 808 |
|
804 | 809 | // MetadataResponse swift_getTupleTypeMetadata(MetadataRequest request,
|
805 | 810 | // TupleTypeFlags flags,
|
|
0 commit comments