Files
swift-mirror/include/swift/Runtime/InstrumentsSupport.h
Arnold Schwaighofer 3ae6d7cb4d runtime/IRGen: return the argument from swift_retain family of functions
On architectures where the calling convention uses the same argument register as
return register this allows the argument register to be live through the calls.

We use LLVM's 'returned' attribute on the parameter to facilitate this.

We used to perform this optimization via an optimization pass. This was ripped
out some time ago around commit 955e4ed652.
By using LLVM's 'returned' attribute on swift_*retain, we get the same
optimization from the LLVM backend.
2017-09-19 07:16:37 -07:00

72 lines
2.5 KiB
C++

//===--- InstrumentsSupport.h - Support for Instruments.app -----*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// Swift runtime support for instruments.app
// In the long run, they plan to use dyld to make this indirection go away.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_RUNTIME_INSTRUMENTS_SUPPORT_H
#define SWIFT_RUNTIME_INSTRUMENTS_SUPPORT_H
namespace swift {
SWIFT_RUNTIME_EXPORT
HeapObject *(*_swift_allocObject)(HeapMetadata const *metadata,
size_t requiredSize,
size_t requiredAlignmentMask);
SWIFT_RUNTIME_EXPORT
BoxPair::Return (*_swift_allocBox)(Metadata const *type);
SWIFT_RUNTIME_EXPORT
HeapObject *(*_swift_retain)(HeapObject *object);
SWIFT_RUNTIME_EXPORT
HeapObject *(*_swift_retain_n)(HeapObject *object, uint32_t n);
SWIFT_RUNTIME_EXPORT
HeapObject *(*_swift_nonatomic_retain)(HeapObject *object);
SWIFT_RUNTIME_EXPORT
HeapObject *(*_swift_tryRetain)(HeapObject *object);
SWIFT_RUNTIME_EXPORT
bool (*_swift_isDeallocating)(HeapObject *object);
SWIFT_RUNTIME_EXPORT
void (*_swift_release)(HeapObject *object);
SWIFT_RUNTIME_EXPORT
void (*_swift_release_n)(HeapObject *object, uint32_t n);
SWIFT_RUNTIME_EXPORT
void (*_swift_nonatomic_release)(HeapObject *object);
// liboainject on iOS 8 patches the function pointers below if present.
// Do not reuse these names unless you do what oainject expects you to do.
typedef size_t AllocIndex;
SWIFT_RUNTIME_EXPORT
void *(*_swift_alloc)(AllocIndex idx);
SWIFT_RUNTIME_EXPORT
void *(*_swift_tryAlloc)(AllocIndex idx);
SWIFT_RUNTIME_EXPORT
void *(*_swift_slowAlloc)(size_t bytes, size_t alignMask,
uintptr_t flags);
SWIFT_RUNTIME_EXPORT
void (*_swift_dealloc)(void *ptr, AllocIndex idx);
SWIFT_RUNTIME_EXPORT
void (*_swift_slowDealloc)(void *ptr, size_t bytes, size_t alignMask);
SWIFT_RUNTIME_EXPORT
size_t _swift_indexToSize(AllocIndex idx);
SWIFT_RUNTIME_EXPORT
int _swift_sizeToIndex(size_t size);
SWIFT_RUNTIME_EXPORT
void _swift_zone_init(void);
};
#endif