221 Commits

Author SHA1 Message Date
Pavel Kunyavskiy
d88a665fa8 [K/N] Implement Lazy for new mm 2021-08-13 13:20:59 +00:00
Pavel Kunyavskiy
7bddc2a815 [K/N] Add new exception for CallsChecker 2021-08-13 13:12:21 +00:00
Pavel Punegov
d7f5015faa [Native] wasm: use JS pow method
Replace usage of C pow() function with JS to fix the issue
with stack overflow caused by invocation of missing pow function
2021-08-11 13:56:47 +00:00
Alexander Shabalin
7e04bb4bf1 [K/N] Refactor unhandled exception handling API
* Do not reset unhandled exception hook
* Add processUnhandledException to perform default unhandled exception
  processing
* Add terminateWithUnhandledException to report the unhandled exception
  and terminate the program
* Use the default unhandled exception processing in entrypoint, interop
  boundaries and in Worker.executeAfter
* Add -Xworker-exception-handling to control exception processing of
  Worker.executeAfter. By default its the old behaviour with the old MM,
  and new behaviour with the new MM.
2021-08-10 08:22:55 +00:00
Abduqodiri Qurbonzoda
d7b10f31b4 Add Regex splitToSequence samples 2021-08-05 10:32:32 +00:00
Sergey Bogolepov
8803a69c9d [K/N] Add ARM Neon intrinsic to CallsChecker whitelist 2021-08-03 05:42:07 +00:00
Sergey Bogolepov
601465fa81 [K/N] Change how common polyhash function are included
Recent versions of LLVM complain when caller and callee have
different vector attributes: https://reviews.llvm.org/D82562.

To mitigate this problem this commit changes how we include
polyHashUnroll* and polyHashTail into Traits: we duplicate them
inside each trait with correct attributes by using
```
#pragma clang attribute push(ATTRIBUTE, apply_to = function)
```
This solution is not pretty for sure, but Clang is not complaining
anymore.
2021-08-03 05:42:02 +00:00
Alexander Shabalin
4c3fb8697b Add FormatToSpan 2021-08-02 16:07:50 +00:00
Igor Chevdar
da4113af88 [K/N][runtime] Lazy initialization fix for wasm 2021-08-02 19:20:33 +05:00
Igor Chevdar
b11201be81 [K/N][IR][runtime] Implemented lazy per-file initialization strategy 2021-07-31 01:39:59 +05:00
Ilya Matveev
e45b13d582 [K/N][New MM] Check if asserts are enabled in thread state asserts 2021-07-30 10:30:50 +00:00
Alexander Shabalin
d9483ccb08 Enable stacktraces for RuntimeAssert, TODO 2021-07-30 08:22:32 +00:00
Ilya Matveev
3e823d62a9 [K/N][kotlin.test] Make GeneratedSuites public
Issue #KT-47915 fixed
2021-07-29 08:44:32 +00:00
Alexander Shabalin
48a2b23b3a Add a separate compiler switch for runtime asserts 2021-07-28 07:43:08 +00:00
Pavel Kunyavskiy
be0a0a7784 [K/N] Support escape analysis with new mm 2021-07-27 08:22:02 +00:00
Alexander Shabalin
a24eab9745 Fix STMS tests 2021-07-26 15:09:59 +00:00
Sergey Bogolepov
ed44497a9b [K/N] Prepare CallsChecker for LLVM 11.1.0
LLVM 11.1.0 adds a bit more "good" external functions and intrinsics.
2021-07-23 04:52:16 +00:00
Abduqodiri Qurbonzoda
b65c477e68 Regex.splitToSequence, CharSequence.splitToSequence(Regex) #KT-23351 2021-07-20 14:09:24 +00:00
Igor Chevdar
bea82ba2cd [K/N][stdlib] Added @EagerInitialization annotation
It is needed in the lazy top level properties initialization strategy to
revert to the previous strategy at least for the transition period
2021-07-19 17:23:35 +05:00
Andrey Kuleshov
26a71af6b3 [Native, All platforms] HotFix of the incorrect parsing of long strings to Float and Double (#4492)
### What's done:
- Fixed incorrect logic of String.toFloat() and String.toDouble().
  Long string without any digits were treated as Float or Double:
  "this string does not look as float isn't it?".toFloat() == "Infinity".

- Fixed incorrect parsing of floating point constants "NaN" and "Infinity":
  String values like "NaNPICEZy" or "InfinityN" were treated as valid numbers.

- Merged parsing logic for Double and Float:
  Removed the code duplication, unified methods, made the code more Kotlin-like, not C++-like.

- Updated tests:
  Removed useless tests that checked nothing, updated tests with regression scenarios.
2021-07-15 14:47:55 +07:00
Pavel Kunyavskiy
92789984e0 [K/N] Make SafeContinuation thread-safe 2021-07-14 09:03:31 +00:00
Ilya Matveev
922aad6865 [K/N] Add exp10 and exp10f to good function list for call checker
Clang may replace a call to `pow (10.0, x)` with a call to `exp10(x)`
(or `__exp10` on MacOS).

We use this function in float parsing logic, so this function should
be added to the good function list.
2021-07-14 04:49:04 +00:00
Elena Lepilkina
9503627864 Changed an order of processing loops in ForLoopsLowering 2021-07-13 09:22:11 +00:00
Elena Lepilkina
3cabfb6a85 [K/N][New MM] Rare GC calls to optimize swiftinterop benchmarks 2021-07-12 12:27:05 +00:00
Alexander Shabalin
274dabb61d Collect stacktraces without allocating kotlin objects. 2021-07-12 08:49:33 +00:00
Alexander Shabalin
fca89c2118 Backport span from C++20
Does not support ranges and construction from arbitrary contiguous iterators as both need C++20 concepts for an adequate implementation.
2021-07-12 08:48:20 +00:00
Ilya Gorbunov
3f6e2be687 Duration: do not use scientific format for large values
The largest duration value formatted in ns with maximal decimals
would fit in 40 chars.
2021-07-12 04:39:25 +00:00
Ilya Gorbunov
28a0698463 Regex.matchAt/matchesAt #KT-34021 2021-07-10 21:31:19 +03:00
Pavel Kunyavskiy
eec8fdf16a [K/N] Implement isExperimentalMM intrinsic 2021-07-09 08:53:07 +00:00
Svyatoslav Scherbina
2d0dbf9729 Native: improve ObjCExport thread state switching 2021-07-07 13:53:27 +00:00
Pavel Kunyavskiy
70ca222806 [K/N] Disable external calls checker for wasm target 2021-07-05 18:49:09 +00:00
Pavel Kunyavskiy
fc75486611 [K/N] Debug tool for checking state at call points of unknown functions
After linking runtime, llvm-ir is modified to add checker function
call at all points where unknown function, which can possibly run long
is called. This function checks Native state is set, to avoid long locks
at gc.
2021-07-05 08:35:23 +00:00
Pavel Kunyavskiy
271fc35082 [K/N] Minor debug info fix 2021-07-05 08:35:22 +00:00
Pavel Kunyavskiy
4c2d518cf5 [K/N] Move ClearCurrentThreadData() out of TestSupport 2021-07-05 08:35:21 +00:00
Pavel Kunyavskiy
65bebd3058 [K/N] Support AddressToSymbol using dladdr, if availible 2021-07-05 08:35:20 +00:00
Pavel Kunyavskiy
1db2903e4f [K/N] Add utilities to check if thread is registered now 2021-07-05 08:35:19 +00:00
Alexander Shabalin
c286a9d8c6 Extract StackTrace from Exceptions 2021-07-01 07:23:47 +00:00
Alexander Shabalin
092750e215 Fix race in Lazy for the new MM 2021-06-29 06:29:57 +00:00
Alexander Shabalin
455625bcee Use FreezableAtomicReference in unhandled exception hook 2021-06-29 06:29:57 +00:00
Alexander Shabalin
28b6427d3e Make FreezableAtomicReference atomic when unfrozen for the new MM. 2021-06-25 21:18:37 +00:00
Alexander Shabalin
cc71069a3a Do not require freezing for Worker.executeAfter on experimental MM 2021-06-24 07:57:23 +00:00
Svyatoslav Scherbina
5d5628f56e Native: apply ObjCExport virtual adapters from interfaces of supers
Previously they were skipped, and this was an incorrect optimization:
even if super class implements the interface too, this doesn't mean
that virtual adapters provided by that interface are inherited
by non-exported subclass that needs them;
for example, this doesn't happen when the super class is exported
(i.e. Obj-C class is not created at runtime).

Remove incorrect optimization instead of making it more sophisticated,
because it is useless anyway.

^KT-46431 Fixed
2021-06-22 09:29:29 +00:00
Alexander Shabalin
b7fbe09ef4 Fix Experimental MM tests on mingw 2021-06-22 08:58:00 +00:00
Alexander Shabalin
7079ad49bc Add a test on attaching new threads while collecting 2021-06-21 12:26:01 +00:00
Svyatoslav Scherbina
b961812efd Native: fix thread state when calling ObjC completion for Kotlin suspend 2021-06-21 09:37:25 +00:00
Svyatoslav Scherbina
2a54f1c610 Improve exception messages for kotlin.native.concurrent.* operations 2021-06-18 13:51:21 +00:00
Ilya Matveev
94384ce2ca [K/N][Runtime] Add a lock method to thread registry 2021-06-18 12:20:04 +00:00
Ilya Matveev
cece652412 [K/N][Runtime] Separate thread registering and making it 'Runnable'
The new GC will require threads to suspend right after registering
if Stop-The-World is requested. This patch changes the initial
thread state to kNative and adds a separate state switch right
after thread registering. This switch suspends if it is necessary.
2021-06-18 12:20:03 +00:00
Alexander Shabalin
e240b8a8ee Add a separate aggressive GC mode 2021-06-18 12:03:02 +00:00
Alexander Shabalin
91a852d3fd Fix integer conversion on 32-bit 2021-06-17 14:16:16 +00:00