Commit Graph

189 Commits

Author SHA1 Message Date
Ivan Kylchik 4e740e91f2 Safely unfold callable reference instruction in interpreter
There was an assumption that if receiver exists then parameter will
also exist. This is not true for references marked with `JvmStatic`.
Later in `JvmStaticInObjectLowering` dispatch receiver may be dropped.
2022-08-18 16:50:05 +00:00
Ivan Kylchik 45b89de9f4 Optimize ir interpretation of Enum.name
There is no need to create honest object in case of such simple
calculation. Furthermore, it can be harmful if enum class has
non-constant initializer or property.

#KT-53480 Fixed
2022-08-11 18:55:30 +03:00
Dmitry Gridin 4ceb170917 regenerate tests 2022-08-05 14:12:41 +02:00
Ivan Kylchik b9e2173288 Rewrite interpretation of enum entries to avoid IR data corruption
There was a bug here if during enum creation there will be an
exception. Then function `cleanEnumSuperCall` will never be called
and ir will be corrupted.
2022-07-23 18:32:53 +00:00
Ivan Kylchik 008a5f02e5 Make enum entries to be interpreted in right order
#KT-53727 Fixed
2022-07-23 18:32:52 +00:00
Mikhail Glukhikh 8b4ae3bd70 IR interpreter: fix f/o delegation from primitive classes 2022-06-21 07:39:04 +00:00
Mikhael Bogdanov 41d6f0dca4 Remove ir.tree.impl from build 2022-06-20 11:42:52 +00:00
Ivan Kylchik 07ba9be2e0 Fix error with interpreting name of java property 2022-05-24 08:25:17 +00:00
Ivan Kylchik 73a571ef7f Report warning from backend if constant expression cannot be evaluated 2022-05-18 21:20:04 +03:00
Ivan Kylchik f3252334b2 Move most of ir utils from backend.common to ir.tree 2022-05-18 21:20:03 +03:00
Ivan Kylchik 40d224d5fe Change error message of EXCEPTION_IN_CONST_VAL_INITIALIZER 2022-05-18 21:20:03 +03:00
Ivan Kylchik 0f0b48f87b Move reporting of interpreter's backend errors tests to fir module 2022-05-18 21:20:01 +03:00
Ivan Kylchik 592baf134e Change ir const checker to match new rules of IntrinsicConstEvaluation 2022-05-18 21:20:00 +03:00
Ivan Kylchik 1431d4b356 Add jvm diagnostic tests to check report of exceptions from interpreter 2022-05-18 21:20:00 +03:00
Ivan Kylchik df7be06558 Add tests to check constant evaluation for intrinsic const declarations 2022-05-18 21:19:58 +03:00
Ivan Kylchik 23f9e97a5f Create getInnerDeclarations function to extract statements from parent
This function is needed to be able to work with files and scripts
2022-05-18 21:19:58 +03:00
Ivan Kylchik d0ab01ad24 Add lowering that will evaluate all intrinsic const expressions 2022-05-18 21:19:56 +03:00
Ivan Kylchik 6a0802a1be Allow interpreting code extension property 2022-05-18 21:19:56 +03:00
Ivan Kylchik 7113523e34 Support interpretation of trimMargin and trimIndent 2022-05-18 21:19:56 +03:00
Ivan Kylchik 3bf678a011 Add ONLY_INTRINSIC_CONST evaluation mode 2022-05-18 21:19:55 +03:00
Pavel Kunyavskiy 7ba4d9e1f0 Rework nullability in IR 2022-03-30 06:27:59 +00:00
Junmin Kim c7d4b97fe1 Fix typo in KFunctionProxy.kt
Replace `eqaulsByAdapteeCall` with `equalsByAdapteeCall`
2022-03-18 19:48:19 +03:00
Ivan Kylchik a1b45755f1 Evaluate range classes in interpreter if constructor's body is missing 2022-01-28 18:44:46 +00:00
Ivan Kylchik ae9914afe0 Move Instruction interface to separate file 2022-01-28 18:44:46 +00:00
Ivan Kylchik a0b5eda0ae Interpret getter with null body separately from common function 2022-01-28 18:44:45 +00:00
Alexander Udalov 6445a29893 IR: remove type parameter in visitConst
Co-authored-by: mcpiroman <mcpiroman@gmail.com>
2022-01-19 17:50:35 +01:00
Evgeniy.Zhelenskiy e97ca2ada4 [Psi2Ir, Fir2Ir] Generate toString, hashCode, equals methods for MF VC 2022-01-14 13:51:57 +00:00
Anastasiya Shadrina 4caf42804a [IR] Revert changes to KFunctionProxy, put TODO
Context receivers are not yet available in FIR
2021-12-02 20:24:35 +03:00
Anastasiya Shadrina 155e7b211b [PSI2IR, IR] Support functional types and literals for IR 2021-12-02 20:24:17 +03:00
Ivan Kylchik 2f2e608502 Expand the possibilities of object's interpretation
It is possible to create object in interpreter even if its
receiver symbol came from function parameter instead of object's class.
#KT-48174 Fixed
2021-08-13 16:18:36 +03:00
Ivan Kylchik 492b8acf93 Rename some methods in interpreter's stack to make their purpose clearer 2021-08-13 16:18:34 +03:00
Ivan Kylchik 69fe7e66a5 Introduce some helpful type aliases in interpreter 2021-08-13 16:18:32 +03:00
Ivan Kylchik 1808f14677 Switch from using of MutableList to ArrayDeque in interpreter's stack 2021-08-13 16:18:32 +03:00
Ivan Kylchik ac2dffa74e Speed up interpreter's stack by using map of variables instead of list 2021-08-13 16:18:31 +03:00
Ivan Kylchik a630273af2 Speed up interpreter's intrinsic check by introducing map of handlers 2021-08-13 16:18:30 +03:00
Ivan Kylchik 23b315446f Support sam conversion in ir interpreter 2021-08-13 16:18:28 +03:00
Ivan Kylchik b85a796492 Support interpretation for floorDiv and mod functions 2021-08-13 16:18:28 +03:00
Ivan Kylchik f9607292b5 Add additional useful ir classes into IrInterpreterEnvironment 2021-08-13 16:18:26 +03:00
Ivan Kylchik b46a42be33 Drop toIrConst function with IrBuiltIns parameter 2021-08-13 16:18:25 +03:00
Tianyu Geng 684ef871ee FIR: unify common special names scattered around the code base 2021-08-06 22:57:17 +03:00
Ivan Kylchik 44e1b61e6c Move static cache from Wrapper into non-static container in environment
By this change it is possible to run multiple test in parallel
without running out of memory.
2021-08-06 13:33:32 +03:00
Ivan Kylchik 3932acf843 Fix interpretation of default varargs 2021-08-06 13:33:30 +03:00
Ivan Kylchik 0ce3dd117e Drop unnecessary check for not static initializer in interpreter
Apparently initializers can become static only in lowering
2021-08-06 13:33:30 +03:00
Ivan Kylchik 0af918be4f Use IrFactory to create IrFunction in interpreter 2021-08-06 13:33:29 +03:00
Ivan Kylchik 1002d076b3 Use StandardNames whenever it is possible in Wrapper 2021-08-06 13:33:28 +03:00
Ivan Kylchik 3cf4b8b108 Combine two caches from interpreter environment into single one 2021-08-06 13:33:28 +03:00
Ivan Kylchik 3fc5405d57 Implement simple cache for dynamically created wrapper for defaults 2021-08-06 13:33:27 +03:00
Ivan Kylchik 09c31b0900 Implement simple cache for dynamically created wrapper for lambda 2021-08-06 13:33:25 +03:00
Ivan Kylchik 524189132b Introduce new property fqName to make it easier to take element's name 2021-08-06 13:33:24 +03:00
Ivan Kylchik 295638b26e Allow to interpret non const properties of compile time object 2021-08-06 13:33:22 +03:00