Also update how the variable is managed in the build system to allow the test to be conditional based on it, and make it more natural to set it on the command line.
- Use SWIFT_RUNTIME_EXPORT instead of SWIFT_RT_ENTRY_VISIBILITY for exposed functions
- Use `_swift_` prefixes on the names of exposed functions
- Make the global counters and per-object counters cache thread-safe by using locks
When building the stdlib for Windows x86_64, we would see the following error:
swift/stdlib/public/core/RuntimeFunctionCounters.swift:95:19: error: '(UnsafeRawPointer, Int64) -> Void' is not representable in Objective-C, so it cannot be used with '@convention(c)'
@convention(c) (_ object: UnsafeRawPointer, _ functionId: Int64) -> Void
^
This is caused by `Int64` not being mapped as on Windows x86_64, `CLong`
is mapped to `Int32` and `CLongLong` is mapped to `Int`. This causes
the `Int64` to fail to be reverse-mapped to a C type causing the FFI
construction failure.
It allows for collecting the state of runtime function counters, which are used to determine how many times a given runtime function was called.
It is possible to get the global counters, which represent the total number of invocations, or per-object counters, which represent the number of runtime functions calls for a specific object.