Commit Graph

41 Commits

Author SHA1 Message Date
Elena Lepilkina cde51ecc3a [K/N] Added function SetCurrentFrame to use in unwind block 2021-11-02 12:04:37 +00:00
Pavel Kunyavskiy ae64af09fb [K/N] Add ability to get base object from extra data
^KT-49325
2021-10-27 12:11:16 +00:00
Alexander Shabalin 84e7b53926 [K/N] Rework GCScheduler to schedule GC on its own. 2021-09-27 08:03:55 +00:00
Ilya Matveev bfc4ff6343 [K/N][New MM] Disallow getting thread data for detached threads
This patch fixes a performance degradation introduced by
99bd26c2ef (Switch thread states
in termination handlers).
2021-09-20 07:28:57 +00:00
Alexander Shabalin d03a7993ed [K/N] Implement GCScheduler 2021-09-14 13:53:36 +00:00
Ilya Matveev 99bd26c2ef [K/N][Runtime] Switch thread states in termination handlers 2021-08-26 14:46:07 +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
Alexander Shabalin 28b6427d3e Make FreezableAtomicReference atomic when unfrozen for the new MM. 2021-06-25 21:18:37 +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
Svyatoslav Scherbina 85ab4f68df Native: support reentrant mode for CalledFromNativeGuard 2021-06-11 07:35:48 +00:00
Svyatoslav Scherbina fa36ccedeb Native: improve ObjCExport thread state switching 2021-06-04 16:58:26 +00:00
Alexander Shabalin af1f57007a https://channel9.msdn.com/Shows/Going+Deep/Cpp-and-Beyond-2012-Herb-Sutter-atomic-Weapons-2-of-2 2021-05-27 17:18:55 +00:00
Alexander Shabalin 73533e4b19 Make NoOp GC support multiple mutators 2021-05-21 06:31:09 +00:00
Alexander Shabalin eac3f507b6 Make Kotlin_initRuntimeIfNeeded switch to native state 2021-05-20 13:48:49 +00:00
Alexander Shabalin 3388ca2536 Support ObjC blocks in the new MM 2021-05-19 07:31:12 +00:00
Alexander Shabalin 94076300ec Implement a bit more of GC object interface 2021-05-19 07:29:27 +00:00
Ilya Matveev 4d346d3735 [K/N][New MM] Support thread state switching
Including

* Support thread state switching in codegen
* Introduce and use GCUnsafeCall annotation
* Switch thread state in C++ runtime code

Also

* Register current thread in Mark&Sweep tests
* Store MemoryState in Worker instance
* Set worker tid in WorkerInit
2021-05-06 14:10:21 +00:00
Ilya Matveev 0b46ed3cde [K/N][New MM] Add thread state asserts to reference updates 2021-05-06 14:10:20 +00:00
Alexander Shabalin 71397a06fb Add Stop-the-World Mark & Sweep GC for single-threaded programs.
GC implementation for testing purposes

* Only works for a single mutator
* Runs on the same thread as the mutator
* Runs every nth checkpoint and after every m bytes are allocated
* Runs finalizers after sweeping on the mutator thread.
2021-04-02 12:13:44 +00:00
Alexander Shabalin 770401801b Implement freezing in the new MM
Currently, it uses suboptimal storage for the freeze bit. This'll be revised later when we finalize stack objects handling in the new MM.
2021-03-26 15:00:14 +00:00
Ilya Matveev 6643119f08 [K/N][New MM] Move ThreadStateGuard to the main Memory.h
Integrating the stdlib with the thread states machinery requires
accessing to some parts of the new MM. This patch provides this
access by moving these parts to the main Memory.h header.
2021-03-16 17:04:26 +03:00
Ilya Matveev 482305cfb2 [K/N][New MM] Move RunInNewThread to the main ThreadSupport.hpp
Some of unit-tests for the C++ part of the stdlib will require
thread state switching. In the new MM, we already have a helper
function that allows us to scopely initialize the memory subsystem
for a separate thread. This patch makes this helper available
for tests in the main runtime module by moving it to the main
ThreadSupport.hpp.
2021-03-16 17:04:25 +03:00
Ilya Matveev fc43fbf578 [K/N][New MM] Move MemoryState conversions to separate header 2021-03-16 17:04:23 +03:00
Alexander Shabalin f51c85a63f Add test support for types and objects creation
* test_support::TypeInfoHolder to create TypeInfo given payload description
* test_support::Object<Payload> to create objects with Payload and to get them from ObjHeader* after checking that their type_info are layout compatible.
* test_support::*Array<Count> to create various arrays with given length and similarly get them from ArrayHeader*.
2021-03-15 11:25:04 +00:00
LepilkinaElena fcbb921194 [LEGACY MM] Escape making extra increments and decrements during coping to the same array (#4731)
(cherry picked from commit 8b601d8e2c6bc772386ebd88d303a032a6f54237)
2021-03-09 20:19:34 +00:00
Alexander Shabalin 97262c273f Misc changes for GC in new MM (#4699) 2021-02-15 10:16:10 +01:00
Alexander Shabalin d875cb39c9 Sketch GC interface (#4682) 2021-02-09 09:00:48 +01:00
Alexander Shabalin 2b69a0d03a Fix InitAndRegisterGlobal in new MM (#4673) 2021-02-09 09:00:46 +01:00
Alexander Shabalin 3bf1f55990 Handle nullptr in StablePointer API (#4671) 2021-02-09 09:00:46 +01:00
Alexander Shabalin 5b6a8a3bdb Make freezing stuff non-terminating TODO 2021-02-09 09:00:46 +01:00
Alexander Shabalin 04ee3e37e7 Implement ref updates in new MM (#4653) 2021-02-01 16:54:15 +01:00
Alexander Shabalin e2280ce855 Add a bunch of symbols required by Kotlin runtime part (#4655) 2021-02-01 16:54:14 +01:00
Alexander Shabalin 687cf20d7d Deal with FrameOverlay in the new mm (#4646) 2021-01-26 17:38:03 +03:00
Alexander Shabalin d46b2e927c Add ExtraObjectData (#4602) 2020-12-28 22:55:51 +03:00
Alexander Shabalin 72fc5f5aee Sketch mm::ObjectFactory (#4583) 2020-12-28 22:55:50 +03:00
Alexander Shabalin 92f8eff958 Cleanup Stubs.cpp (#4593) 2020-12-21 16:15:11 +01:00
Alexander Shabalin 658530e820 StableRef registry (#4567) 2020-12-14 15:25:37 +01:00
Alexander Shabalin 211c160558 TLS registry (#4554) 2020-12-14 15:25:36 +01:00
Alexander Shabalin 2057e5c8f1 Tracking globals (#4542) 2020-12-14 15:25:36 +01:00
Alexander Shabalin 83de4e174a Keep MemoryState empty. (#4544) 2020-11-28 21:13:48 +01:00
Alexander Shabalin e548bde89f Thread registry (#4518) 2020-11-28 21:13:46 +01:00