Skip to content

runtime: add missing SWIFT_CC(swift) for matching function signatures #67644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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 stdlib/public/runtime/Demangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ swift::_swift_buildDemanglingForMetadata(const Metadata *type,
/// \returns the demangled name. Returns nullptr if the input String is not a
/// Swift mangled name.
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
char *swift_demangle(const char *mangledName,
size_t mangledNameLength,
char *outputBuffer,
Expand Down
1 change: 1 addition & 0 deletions stdlib/public/runtime/EnvironmentVariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ void swift::runtime::environment::initialize(void *context) {
#endif

SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
bool swift_COWChecksEnabled() {
return runtime::environment::SWIFT_DEBUG_ENABLE_COW_CHECKS();
}
Expand Down
9 changes: 9 additions & 0 deletions stdlib/public/runtime/RuntimeInvocationsTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ static std::uint16_t RuntimeFunctionCountersOffsets[] = {
/// Public APIs

/// Get the runtime object state associated with an object.
SWIFT_CC(swift)
void _swift_getObjectRuntimeFunctionCounters(
HeapObject *object, RuntimeFunctionCountersState *result) {
auto &theSentinel = RuntimeObjectStateCache.get();
Expand All @@ -139,6 +140,7 @@ void _swift_getObjectRuntimeFunctionCounters(

/// Set the runtime object state associated with an object from a provided
/// state.
SWIFT_CC(swift)
void _swift_setObjectRuntimeFunctionCounters(
HeapObject *object, RuntimeFunctionCountersState *state) {
auto &theSentinel = RuntimeObjectStateCache.get();
Expand All @@ -148,13 +150,15 @@ void _swift_setObjectRuntimeFunctionCounters(

/// Get the global runtime state containing the total numbers of invocations for
/// each runtime function of interest.
SWIFT_CC(swift)
void _swift_getGlobalRuntimeFunctionCounters(
RuntimeFunctionCountersState *result) {
LazyMutex::ScopedLock lock(RuntimeGlobalFunctionCountersState.Lock);
*result = RuntimeGlobalFunctionCountersState.State;
}

/// Set the global runtime state of function pointers from a provided state.
SWIFT_CC(swift)
void _swift_setGlobalRuntimeFunctionCounters(
RuntimeFunctionCountersState *state) {
LazyMutex::ScopedLock lock(RuntimeGlobalFunctionCountersState.Lock);
Expand All @@ -164,18 +168,21 @@ void _swift_setGlobalRuntimeFunctionCounters(
/// Return the names of the runtime functions being tracked.
/// Their order is the same as the order of the counters in the
/// RuntimeObjectState structure. All these strings are null terminated.
SWIFT_CC(swift)
const char **_swift_getRuntimeFunctionNames() {
return RuntimeFunctionNames;
}

/// Return the offsets of the runtime function counters being tracked.
/// Their order is the same as the order of the counters in the
/// RuntimeObjectState structure.
SWIFT_CC(swift)
const std::uint16_t *_swift_getRuntimeFunctionCountersOffsets() {
return RuntimeFunctionCountersOffsets;
}

/// Return the number of runtime functions being tracked.
SWIFT_CC(swift)
std::uint64_t _swift_getNumRuntimeFunctionCounters() {
return ID_LastRuntimeFunctionName;
}
Expand Down Expand Up @@ -204,6 +211,7 @@ void _swift_dumpObjectsRuntimeFunctionPointers() {

/// Set mode for global runtime function counters.
/// Return the old value of this flag.
SWIFT_CC(swift)
int _swift_setGlobalRuntimeFunctionCountersMode(int mode) {
int oldMode = UpdateGlobalRuntimeFunctionCounters;
UpdateGlobalRuntimeFunctionCounters = mode ? 1 : 0;
Expand All @@ -212,6 +220,7 @@ int _swift_setGlobalRuntimeFunctionCountersMode(int mode) {

/// Set mode for per object runtime function counters.
/// Return the old value of this flag.
SWIFT_CC(swift)
int _swift_setPerObjectRuntimeFunctionCountersMode(int mode) {
int oldMode = UpdatePerObjectRuntimeFunctionCounters;
UpdatePerObjectRuntimeFunctionCounters = mode ? 1 : 0;
Expand Down
43 changes: 29 additions & 14 deletions stdlib/public/runtime/RuntimeInvocationsTracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,49 +61,64 @@ using RuntimeFunctionCountersUpdateHandler =

/// Get the runtime object state associated with an object and store it
/// into the result.
SWIFT_RUNTIME_EXPORT void
_swift_getObjectRuntimeFunctionCounters(HeapObject *object,
RuntimeFunctionCountersState *result);
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
void _swift_getObjectRuntimeFunctionCounters(HeapObject *object,
RuntimeFunctionCountersState *result);

/// Get the global runtime state containing the total numbers of invocations for
/// each runtime function of interest and store it into the result.
SWIFT_RUNTIME_EXPORT void _swift_getGlobalRuntimeFunctionCounters(
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
void _swift_getGlobalRuntimeFunctionCounters(
swift::RuntimeFunctionCountersState *result);

/// Return the names of the runtime functions being tracked.
/// Their order is the same as the order of the counters in the
/// RuntimeObjectState structure.
SWIFT_RUNTIME_EXPORT const char **_swift_getRuntimeFunctionNames();
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
const char **_swift_getRuntimeFunctionNames();

/// Return the offsets of the runtime function counters being tracked.
/// Their order is the same as the order of the counters in the
/// RuntimeFunctionCountersState structure.
SWIFT_RUNTIME_EXPORT const uint16_t *_swift_getRuntimeFunctionCountersOffsets();
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
const uint16_t *_swift_getRuntimeFunctionCountersOffsets();

/// Return the number of runtime functions being tracked.
SWIFT_RUNTIME_EXPORT uint64_t _swift_getNumRuntimeFunctionCounters();
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
uint64_t _swift_getNumRuntimeFunctionCounters();

/// Dump all per-object runtime function pointers.
SWIFT_RUNTIME_EXPORT void _swift_dumpObjectsRuntimeFunctionPointers();

/// Set mode for global runtime function counters.
/// Return the old value of this flag.
SWIFT_RUNTIME_EXPORT int
_swift_setPerObjectRuntimeFunctionCountersMode(int mode);
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
int _swift_setPerObjectRuntimeFunctionCountersMode(int mode);

/// Set mode for per object runtime function counters.
/// Return the old value of this flag.
SWIFT_RUNTIME_EXPORT int _swift_setGlobalRuntimeFunctionCountersMode(int mode);
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
int _swift_setGlobalRuntimeFunctionCountersMode(int mode);

/// Set the global runtime state of function pointers from a provided state.
SWIFT_RUNTIME_EXPORT void _swift_setGlobalRuntimeFunctionCounters(
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
void _swift_setGlobalRuntimeFunctionCounters(
swift::RuntimeFunctionCountersState *state);

/// Set the runtime object state associated with an object from a provided
/// state.
SWIFT_RUNTIME_EXPORT void
_swift_setObjectRuntimeFunctionCounters(HeapObject *object,
RuntimeFunctionCountersState *state);
SWIFT_RUNTIME_EXPORT
SWIFT_CC(swift)
void _swift_setObjectRuntimeFunctionCounters(HeapObject *object,
RuntimeFunctionCountersState *state);

/// Set the global runtime function counters update handler.
SWIFT_RUNTIME_EXPORT RuntimeFunctionCountersUpdateHandler
Expand Down