mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
swift_allocObject should be exposed as a visible runtime entry.
This commit is contained in:
@@ -60,6 +60,12 @@ HeapObject *swift_allocObject(HeapMetadata const *metadata,
|
|||||||
size_t requiredAlignmentMask)
|
size_t requiredAlignmentMask)
|
||||||
SWIFT_CC(RegisterPreservingCC);
|
SWIFT_CC(RegisterPreservingCC);
|
||||||
|
|
||||||
|
SWIFT_RUNTIME_EXPORT
|
||||||
|
extern "C"
|
||||||
|
HeapObject *(*SWIFT_CC(RegisterPreservingCC) _swift_allocObject)(
|
||||||
|
HeapMetadata const *metadata,
|
||||||
|
size_t requiredSize,
|
||||||
|
size_t requiredAlignmentMask);
|
||||||
|
|
||||||
/// Initializes the object header of a stack allocated object.
|
/// Initializes the object header of a stack allocated object.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ FUNCTION(ProjectBox, swift_projectBox, DefaultCC,
|
|||||||
|
|
||||||
// RefCounted *swift_allocObject(Metadata *type, size_t size, size_t alignMask);
|
// RefCounted *swift_allocObject(Metadata *type, size_t size, size_t alignMask);
|
||||||
FUNCTION_WITH_GLOBAL_SYMBOL_AND_IMPL(AllocObject, swift_allocObject,
|
FUNCTION_WITH_GLOBAL_SYMBOL_AND_IMPL(AllocObject, swift_allocObject,
|
||||||
_swift_allocObject, swift_allocObject, RegisterPreservingCC,
|
_swift_allocObject, _swift_allocObject_, RegisterPreservingCC,
|
||||||
RETURNS(RefCountedPtrTy),
|
RETURNS(RefCountedPtrTy),
|
||||||
ARGS(TypeMetadataPtrTy, SizeTy, SizeTy),
|
ARGS(TypeMetadataPtrTy, SizeTy, SizeTy),
|
||||||
ATTRS(NoUnwind))
|
ATTRS(NoUnwind))
|
||||||
|
|||||||
@@ -42,11 +42,23 @@
|
|||||||
using namespace swift;
|
using namespace swift;
|
||||||
|
|
||||||
SWIFT_RT_ENTRY_VISIBILITY
|
SWIFT_RT_ENTRY_VISIBILITY
|
||||||
|
extern "C"
|
||||||
HeapObject *
|
HeapObject *
|
||||||
swift::swift_allocObject(HeapMetadata const *metadata,
|
swift::swift_allocObject(HeapMetadata const *metadata,
|
||||||
size_t requiredSize,
|
size_t requiredSize,
|
||||||
size_t requiredAlignmentMask)
|
size_t requiredAlignmentMask)
|
||||||
SWIFT_CC(RegisterPreservingCC_IMPL) {
|
SWIFT_CC(RegisterPreservingCC_IMPL) {
|
||||||
|
return SWIFT_RT_ENTRY_REF(swift_allocObject)(metadata, requiredSize,
|
||||||
|
requiredAlignmentMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
SWIFT_RT_ENTRY_IMPL_VISIBILITY
|
||||||
|
extern "C"
|
||||||
|
HeapObject *
|
||||||
|
SWIFT_RT_ENTRY_IMPL(swift_allocObject)(HeapMetadata const *metadata,
|
||||||
|
size_t requiredSize,
|
||||||
|
size_t requiredAlignmentMask)
|
||||||
|
SWIFT_CC(RegisterPreservingCC_IMPL) {
|
||||||
assert(isAlignmentMask(requiredAlignmentMask));
|
assert(isAlignmentMask(requiredAlignmentMask));
|
||||||
auto object = reinterpret_cast<HeapObject *>(
|
auto object = reinterpret_cast<HeapObject *>(
|
||||||
SWIFT_RT_ENTRY_CALL(swift_slowAlloc)(requiredSize,
|
SWIFT_RT_ENTRY_CALL(swift_slowAlloc)(requiredSize,
|
||||||
|
|||||||
Reference in New Issue
Block a user