Previous implementation of startCoroutineUninterceptedOrReturn expected
that the receiver (i.e. the suspend function object to start) of type
SuspendFunctionN (i.e. suspend function type with arity = N) is also an
instance of FunctionN+1 (i.e. regular function type with arity = N + 1)
with proper convention.
While compiler tries to achieve that (for better compatibility with
Kotlin/JVM, by generating additional supertypes and methods for classes
implementing suspend function types), this doesn't work e.g. for
implementations defined in Swift.
Fix this by adding fallbacks for cases when the receiver is not
a FunctionN+1, while keeping the fastpath for default FunctionN+1
cases.
^KT-51043 Fixed
Make `createCoroutineUnintercepted` invoke
`startCoroutineUninterceptedOrReturn` when suspend function object is
not a `BaseContinuationImpl` (e.g. for a custom suspend function type
subclass), instead of using the copy of its implementation.
This change parallelizes marking by making each non-native Kotlin thread
mark its own view of the heap. To make this safe, we make flipping the
marking bit atomic which ensures that threads do not try to trace the
same objects.
Co-authored-by: Johan Bay <jobay@google.com>
Merge-request: KOTLIN-MR-423
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
A lot of calls to Objective-C runtime are potentially blocking. This
commit adds a number of thread state switches to ensure these Obj-C
runtime calls happen in "Native" thread state.
Also, remove a bunch of such functions from CallsChecker exclude list.
The test engine renames packages in test files to allow group many tests
into single compilation for performance reasons.
As a result, reflection APIs return different package names. To deal
with this, the test engine uses certain heuristics to detect tests using
reflection APIs, and disables grouping (and thus package renaming) for
them.
This commit provides an alternative solution for the same problem --
now the test engine instructs the compiler to use original package names
for reflection information, by means of the introduced
`ReflectionPackageName` annotation.
But still cherry-pick them when serializing builtins because they are
used in builtins signatures.
Merge-request: KT-MR-6488
Merged-by: Ilya Gorbunov <Ilya.Gorbunov@jetbrains.com>
cbrt() is the standard cubic root function that provides several advantages over pow(x, 1.0/3.0):
- Better precision
- Faster
- Behaves better with negative values