Commit Graph

24 Commits

Author SHA1 Message Date
vladislav.grechko 8b1d87848d [FIR2IR] Fix unwrapping of single-statement blocks
Unwrapping should be done with respect to `forceUnitType` parameter.

^KT-65019: Fixed
2024-01-30 14:26:10 +00:00
Pavel Kunyavskiy c1ec1d9d4c [K/N] Handle Unit? and Nothing? correctly in finally transformation
^KT-52985
2022-07-05 06:54:29 +00:00
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00
Svyatoslav Kuzmich aa5f98f919 [JS] Remove KJS_WITH_FULL_RUNTIME for tests that already have WITH_RUNTIME 2021-10-07 22:36:18 +03:00
Igor Laevsky 00f61978b8 WASM: Enable exception handling tests 2021-09-08 19:56:38 +03:00
pyos 82899e6243 JVM_IR: reuse MethodNodes for inline functions in same module
This fixes the weird cases when a class gets overwritten by an imperfect
copy, reduces the number of classes in the output if an inline function
contains an inline call that causes it to have regenerated anonymous
objects, and makes inlining of same module functions a bit faster in
general. On the other hand, this may increase memory footprint a bit
because classes cannot be flushed to the output jar, as the inliner
would not be able to locate classes for anonymous objects if they have
already been unloaded from memory.
2020-04-08 07:04:16 +02:00
Mikhail Glukhikh d7460d47de [FIR] Generate dispatch & extension receivers for variable assignments 2020-04-03 17:21:21 +03:00
Mikhail Glukhikh 8c21f04bf4 FIR2IR: determine type parameters before value parameters
Type parameters can be referred from value parameters,
so we should determine them earlier to be able to set their indexes
2020-02-20 18:34:51 +03:00
Juan Chen 3dc58bc995 [FIR2IR] Fix translating primitive array types
This commit fixes two issues in the existing implementation of translating primitive array types:

 * IrType.getArrayElementType throws an exception when the receiver is a primitive array type, because IR expects primitive array types use symbols defined in IrBuiltIns, but fir2ir translation doesn't;
 * IteratorNext.toCallable assumes all element types are boxed.

The first issue is fixed by changing the fir2ir type translation to use symbols in IrBuiltIns for primitive array types, and the second by not unboxing primitive types.
2019-12-27 15:32:18 +03:00
Mikhael Bogdanov c335015c05 Generate proper exception table
Don't forget to split nested try blocks without finally block
 on generating finally blocks from outer ones.

 #KT-31923 InProgress
2019-12-12 13:33:39 +01:00
Mark Punzalan 9df2f69f09 [FIR] Disable failing blackbox codegen tests for FIR. 2019-11-19 11:00:09 +03:00
Mads Ager fb6eafddf1 JVM_IR: Generate better code for null checks.
Simplify ifs when branches have condition true/false.

Simplify blocks containing only a variable declaration
and a variable get of the same variable. Simplify to
just the condition.

Do not introduce temporary variables for constants for
null checks. Constants have no side-effects and can be
reloaded freely instead of going through a local.

This simplifies code such as "42.toLong()!!" so that the
resulting code has no branches and uses no locals. The
simplifications happen as follows:

```
block
  temp = 42.toLong()
  when
    (temp == null) throw NPE
    (true) load temp

---> null test simplification

block
  temp = 42.toLong()
  when
    (false) throw NPE
    (true) load temp

---> when simplification

block
  temp = 42.toLong()
  load temp

---> block simplification

42.toLong()
```
2019-01-23 15:11:14 +01:00
Mikhael Bogdanov 357359b1dd Unmute ir-tests after CR support 2018-08-09 14:22:50 +03:00
Svyatoslav Kuzmich 1abb4f42ac [JS IR BE] Add ranges to runtime, rangeTo for primitive numbers 2018-07-17 20:18:29 +03:00
Svyatoslav Kuzmich 77ad97a39e [JS IR BE] Bridges construction 2018-07-10 14:11:09 +03:00
Mikhael Bogdanov e149cbe852 Mute failed jvm ir tests 2018-06-28 12:26:41 +02:00
Roman Artemev f69bd54d6c [JS IR BE] Update test data 2018-06-19 17:09:31 +03:00
Anton Bannykh 96355e2732 JS IR: mute codegen box tests automatically 2018-06-09 19:15:38 +03:00
Yan Zhulanow 9d1af5a17e Fix tests: "infix modifier required" and "operator modifier required" errors 2015-11-27 15:51:11 +03:00
Yan Zhulanow e14c9645dc Error on 'if' without an 'else' branch when used as an expression 2015-10-19 03:56:15 +03:00
Alexander Udalov 3dcd85bdb4 Add toString() to Any, fix all tests
#KT-4517 Fixed
2014-03-02 19:54:49 +04:00
Mikhael Bogdanov e0ca1abe4b KT-3706 Inconsistent stack height in try catch finally in function
KT-4134 Incorrect bytecode is generated for

 #KT-3706 Fixed
 #KT-4134 Fixed
2014-02-07 13:45:22 +04:00
Mikhael Bogdanov 185b5013fe Properly process nested try and loop blocks
KT-3894: Loops and finally: finally block executed twice when break and return exists in try/finally block
KT-3874: Compilation error on try catch block contains break and continue
KT-3869: Loops and finally: outer finally block not run

 #KT-3869 Fixed
 #KT-3894 Fixed
 #KT-3874 Fixed
2013-08-19 16:06:56 +04:00
Mikhael Bogdanov d0f042ba93 Properly generate exception table for try/catch block
KT-3549 'Finally' block not run when re-throwing exception
KT-3867 When catched exception occurs in finnaly block it invokes additional catch and itself

  #KT-3549 Fixed
  #KT-3867 Fixed
2013-08-19 16:06:56 +04:00