Commit Graph

13 Commits

Author SHA1 Message Date
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