Commit Graph

54 Commits

Author SHA1 Message Date
Alexander Shabalin 83a70ddf8b [K/N] Decouple ObjectFactory from concrete ObjectData ^KT-60928
* Use type_layout to declaratively express heap object headers in both
  custom allocator and ObjectFactory.
* Invoke constructor (w/o invoking Kotin constructors) for created
  objects and arrays from both custom allocator and ObjectFactory.
  Previously:
  - custom allocator only checked body for nullability (now this is
    performed in body constructor)
  - ObjectFactory only constructed ObjectData
* In each GC have a AllocatorImpl.hpp and ObjectData.hpp headers
  the first encapsulating allocator-specific types, the second
  containing specific ObjectData implementation.
* In each GC have a separate ObjectFactoryTraits that does not
  actually depend on the specific GC anymore.
* Each GC now expose ObjectData (as undefined type) and its descriptor,
  the latter being used by the custom allocator and ObjectFactory.
* Descriptors for ObjectBody and ArrayBody now live in Memory.h and the
  code calculating size is now shared. Their constructors check that the
  memory is zeroed (Kotlin constructors will expect this).
2023-08-10 07:58:27 +00:00
Mads Ager f0f1dc15c3 [K/N] Reduce frame size by removing unused arena field. 2023-08-03 15:32:08 +00:00
Alexander Shabalin 220ecc4788 [K/N] Track memory in big chunks ^KT-57773
Additionally removed testFixtures{} and test{} in gcScheduler/common runtime module,
because that source set became empty.
2023-07-27 21:27:30 +00:00
Alexander Shabalin 4cd1f2ff82 [K/N] Fix a race in MemorySharedRefs ^KT-56233 2023-04-06 11:40:47 +00:00
Alexander Shabalin 1f1b26f2a5 [K/N] Split Weak and MemorySharedRefs between mm implementations ^KT-56233
* A separate RegularWeakReferenceImpl for the new mm. Name is chosen for
  better consistency with other WeakReferenceImpl implementations.
* KRefSharedHolder and BackRefFromAssociatedObject implementations are
  independent between the legacy and the new mm.
* Better support for WeakReference in runtime unit tests.
2023-04-06 11:40:45 +00:00
Pavel Kunyavskiy 9dea349752 [K/N] Support of @Volatile annotation
^KT-54944
2023-01-16 08:34:20 +00:00
Pavel Kunyavskiy d3adfec2fb [K/N] Rework object and enum classes initialization
Now it works with common logic for all static scope not with custom one.
2022-11-22 13:51:22 +00:00
Alexander Shabalin 98251f42f2 [K/N] Specialize marking call for objects ^KT-54163
Merge-request: KT-MR-7232
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-10-04 09:51:08 +00:00
Pavel Kunyavskiy 7293dd6d65 [K/N] Require small binaries for all watchos targets 2022-09-16 12:24:11 +00:00
Pavel Kunyavskiy de1dd47ab1 [K/N] Rework defines passing to runtime compilation 2022-08-17 08:32:47 +00:00
Pavel Kunyavskiy a082aeb29e [K/N] Make atomic ordering weaker for less performance harm 2022-08-10 08:36:08 +00:00
Pavel Kunyavskiy 18cda8844d [K/N] Fix possible data races found by thread sanitizer 2022-08-10 08:36:07 +00:00
Johan Bay e380d7d495 [K/N] fix minor typos and outdated documentation 2022-06-24 20:27:33 +02:00
Alexander Shabalin 421ad77740 [K/N] Simplify ObjectFactory ^KT-51436
Merge-request: KT-MR-5958
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-03-31 09:43:47 +00:00
Sergey Bogolepov 77c04e7d71 [K/N] Do not inline runtime functions in case of armv7 darwin targets
^KT-51649 fixed
2022-03-21 09:11:13 +00:00
Pavel Kunyavskiy 42a2ce1610 [K/N] Fix currentFrame in smaller scope, to avoid gc while having incorrect shadow stack 2022-03-10 13:22:04 +00:00
Alexander Shabalin 65fdfffeb4 [K/N] Make GC.collect wait for finalizers being run
^KT-50713

Merge-request: KT-MR-5404
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-01-11 11:39:22 +00:00
Elena Lepilkina f67941e244 [K/N] Replaced safe points to prologue 2021-11-02 12:04:45 +00:00
Elena Lepilkina 48e3df5224 [K/N] Small refactoring (review fixes) 2021-11-02 12:04:42 +00:00
Elena Lepilkina 2d72f4d5a9 [K/N] Added checks for tests that current frame after catch is right 2021-11-02 12:04:40 +00:00
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
Ilya Matveev 629ea1036e [K/N][Runtime] Support thread state switching in spin locks
Issue #KT-49013 Fixed
2021-10-18 11:32:16 +00:00
Ilya Matveev 35ff131608 fixup! fixup! [K/N][New MM] Disallow getting thread data for detached threads 2021-09-20 07:28:58 +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
Ilya Matveev 99bd26c2ef [K/N][Runtime] Switch thread states in termination handlers 2021-08-26 14:46:07 +00: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
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 825b77cc82 Remove unused ostream 2021-06-01 07:01:11 +00:00
Ilya Matveev de5dcfcbd8 [K/N][Runtime] Support suspending mutators in the new MM 2021-05-31 09:48:46 +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 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
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
Alexander Shabalin 5b1c30c198 Extract initializing singleton marker
* Extract kInitializingSingleton marker
* Extract isNullOrMarker helper function
2021-03-19 08:19:10 +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
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 3a5c6480a3 Track current exception (#4701) 2021-02-24 11:00:05 +01:00
Alexander Shabalin d875cb39c9 Sketch GC interface (#4682) 2021-02-09 09:00:48 +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 d633b1c545 Mark safe points in code generator (#4640) 2021-01-26 17:38:03 +03:00
Alexander Shabalin d46b2e927c Add ExtraObjectData (#4602) 2020-12-28 22:55:51 +03:00
Ilya Matveev 6fb5e43f62 [runtime] Introduce thread states 2020-12-21 16:18:37 +01:00
Alexander Shabalin 92f8eff958 Cleanup Stubs.cpp (#4593) 2020-12-21 16:15:11 +01:00
Alexander Shabalin 2057e5c8f1 Tracking globals (#4542) 2020-12-14 15:25:36 +01:00
Alexander Shabalin 5fc17ce5fa Tweak TLS init/deinit (#4551)
* Delete the entire TLS in one go
* Put TLS allocation separately
* Keep TLS in a single array
2020-12-14 15:25:36 +01:00