Commit Graph

5879 Commits

Author SHA1 Message Date
Dmitry Petrov fbcb07e3a2 JVM don't siplify CFG in TemporaryVariablesEliminationTransformer 2021-08-24 18:56:16 +03:00
Dmitry Petrov 7e943ab757 JVM don't optimize out starting ASTORE of TCB handler 2021-08-24 18:56:14 +03:00
Dmitry Petrov dcbc2ea2b3 JVM infer temporary vals from bytecode 2021-08-24 18:56:13 +03:00
Dmitry Petrov 041773fd25 JVM optimize out temporary variables in bytecode 2021-08-24 18:56:11 +03:00
Dmitry Petrov bddfd086f6 JVM minor reuse updateMaxStack in CoroutineTransformerMethodVisitor 2021-08-24 18:56:10 +03:00
Dmitry Petrov 7b3d5b7863 JVM minor: extract base class from FixStackInterpreter 2021-08-24 18:56:09 +03:00
Steven Schäfer 3ffe495346 jvm-abi-gen: Mark all anonymous objects in inline function scope as public
Anonymous objects inside of a private inline function nested in a public
inline function can still escape.
2021-08-23 18:25:33 +02:00
Steven Schäfer 1b5214a2dc JVM: Fix usage of ClassBuilder API in AnonymousObjectTransformer 2021-08-23 18:25:33 +02:00
Steven Schäfer c9b0cc5b32 JVM: Only produce inline SAM wrappers in public inline scope 2021-08-23 18:25:33 +02:00
Steven Schäfer a54503cede JVM: Add an extension point for file output 2021-08-23 18:25:33 +02:00
Steven Schäfer de9d2919a8 JVM Metadata: Add a bit to mark anonymous objects in inline functions
Anonymous objects in the scope of an inline functions are copied to
all call-sites. This makes them part of the public ABI of a Kotlin
library.

We introduce a flag to mark all classes in the scope of an inline
function. When compiling with assertions enabled, we check that
this flag is set whenever we inline an anonymous object from another
module.
2021-08-23 18:25:33 +02:00
Ilmir Usmanov c01c356817 Do not extend LVT ranges during inplace arguments inlining
Otherwise, R8 does not transform kotlin-reflect, failing bootstrap.
Leaving end label the same is safe, since we do not remove labels during
transformation.
2021-08-23 11:51:30 +00:00
Mikhail Glukhikh 255eb87375 Provide more clear API around AnnotationChecker.applicableTargetSet 2021-08-23 14:18:38 +03:00
Ilmir Usmanov b5fa129540 Loosen tail-call optimization check for functions returning Unit
Do not check, that all Unit predecessors are POPs. This is safe for the
same reason, as it is safe to allow some of ARETURN sources not be
suspension point results.
To elaborate, before Unit, the stack is empty. This is because if there
are multiple paths to Unit and at least one of them comes from POP after
suspension point (we are interested in this case only - otherwise, the
call is not tail-call), in path from said POP the stack is empty, since
after suspension point the stack contains only one element. Thus, the
stack in other paths leading to Unit has to be empty, otherwise, merge
operation is not possible and ASM will report error during analysis.
Since the stack is empty in all paths, we can hoist Unit and following
ARETURN to predecessors, effectively turning path from suspension point
to tail-call.
2021-08-19 16:05:21 +00:00
pyos ff6de0fe6a JVM: remove InlineCodegen.expressionMap
#KT-48180 Fixed
2021-08-18 16:55:44 +02:00
Ilmir Usmanov 486c6b3c15 Remove obsolete experimental coroutines support
in compiler.
2021-08-13 22:31:30 +02:00
Ilmir Usmanov ebb340fe68 Do not just merge consequent LVT ranges, but also extend them 2021-08-13 23:12:10 +03:00
Dmitry Petrov 55663a0fb1 JVM_IR KT-47984 allow only limited list of GETSTATICs in arg loading 2021-08-13 18:08:54 +03:00
Dmitry Petrov edd2ca775b JVM_IR KT-47984 use stack size calculator from ASM 2021-08-13 18:08:52 +03:00
Dmitry Petrov 5096e8c5c4 JVM_IR KT-47984 transform inplace arguments before inlining 2021-08-13 18:08:49 +03:00
Dmitry Petrov 9be941def2 JVM_IR KT-47984 don't move inplace arguments with suspension points 2021-08-13 18:08:47 +03:00
Dmitry Petrov 9acdcc7590 JVM_IR KT-47984 minor cleanup 2021-08-13 18:08:47 +03:00
Dmitry Petrov bf362abb57 JVM_IR KT-47984 update LVT entries for transformed instructions 2021-08-13 18:08:46 +03:00
Dmitry Petrov 6b18f33f92 JVM_IR KT-47984 don't transform calls with non-local jumps in arguments 2021-08-13 18:08:45 +03:00
Dmitry Petrov b01c13a4df JVM_IR KT-47984 inplace arguments inlining for @InlineOnly functions 2021-08-13 18:08:44 +03:00
Tianyu Geng 684ef871ee FIR: unify common special names scattered around the code base 2021-08-06 22:57:17 +03:00
Dmitry Petrov bd71fbe982 JVM_IR KT-34594 strip fake variable initialization during inlining 2021-08-03 20:41:31 +03:00
Ilmir Usmanov cbe0de6111 Extend local variable ranges
when it is safe. Otherwise, they will not be visible in
debugger as soon as they become dead.
 #KT-47749 Fixed
2021-08-03 08:00:51 +00:00
Dmitriy Novozhilov 199ec60742 [JVM] Reduce number of param slots for string concatenation
With paramSlot = 200 those tests fails on JDKs which are newer than JDK 9
- testConcatDynamic200Long
- testConcatDynamicIndy200Long()
2021-08-01 22:23:48 +03:00
Dmitry Petrov ebf837c135 JVM_IR disable IR and bytecode validation by default 2021-07-30 20:21:41 +03:00
Mikhael Bogdanov a919aab3ab Update metadata related logic after switch to 1.6 2021-07-29 19:45:53 +02:00
Dmitry Petrov ce79fc77c9 JVM minor cleanup in bytecode analyzers 2021-07-28 19:53:39 +03:00
Dmitry Petrov 4267852030 JVM cleanup bytecode analyzers 2021-07-28 08:04:55 +03:00
Mads Ager c0f5d09759 Copy locals in addition to instructions when inlining finally blocks
^KT-46448 Fixed
2021-07-23 09:11:48 +02:00
Dmitry Petrov 6c734289be JVM skip methods without NEW insns in UninitializedStoresProcessor 2021-07-22 21:29:41 +03:00
Dmitry Petrov eff7c375ce Minor HackedFixStackMethodAnalyzerBase -> FastStackAnalyzer 2021-07-22 21:29:41 +03:00
Dmitry Petrov aef9701661 JVM use new stack state analyzer in non-local returns preprocessing 2021-07-22 21:29:40 +03:00
Dmitry Petrov cf2b4dd277 JVM don't use SPBs in FixStack method analyzer (we don't merge) 2021-07-22 21:29:40 +03:00
Dmitry Petrov ca84aa4f2c JVM don't optimize if there are too many data on exception edges 2021-07-22 21:29:39 +03:00
Dmitry Petrov c1a5ce6e61 JVM skip redundant boxing optimization in methods without boxing 2021-07-22 21:29:38 +03:00
Alexander Udalov 9ebd665c96 Report error on annotated type inside typeOf on JVM
Since it's not feasible to support annotated types in 1.6, we're making
this an explicit error in 1.6, so that typeOf can become stable and this
feature can be supported in the future without breaking changes to the
existing code.

Note that extension function types are a special case of annotated
types. A separate error is created for them just because the message
"annotated types are not supported" would be confusing, since such types
don't have explicit annotations in the source code.

 #KT-29919
2021-07-22 15:54:48 +02:00
Dmitry Petrov 46d2e52543 JVM Minor: move uninitialized value check to stack recovery 2021-07-20 19:51:04 +03:00
Dmitry Petrov e72d24960d JVM we don't merge frames in stack normalization 2021-07-20 19:51:03 +03:00
Dmitry Petrov 91afa3335c JVM represent uninitialized values explicitly in stack normalization 2021-07-20 19:51:02 +03:00
Dmitry Petrov 35b4a9d4cc JVM treat all variable loads as "initialized" in stack normalization 2021-07-20 19:51:00 +03:00
Dmitry Petrov c8b705fd2d JVM update license for HackedFixStackMethodAnalyzerBase.kt 2021-07-20 19:50:59 +03:00
Dmitry Petrov 8763235053 JVM specially hacked method analyzer for FixStack 2021-07-20 19:50:58 +03:00
Dmitry Petrov 3ecd612ce7 JVM FixStackValue & FixStackInterpreter 2021-07-20 19:50:57 +03:00
Dmitriy Novozhilov 85c7f386eb Add Kotlin 1.7 language version 2021-07-20 13:33:41 +03:00
Ilmir Usmanov e870a200c4 Merge consequent LVT records
that is, if LVT record starts where previous one ends, merge them.
 #KT-47749 Fixed
2021-07-19 22:07:16 +00:00