Commit Graph

8 Commits

Author SHA1 Message Date
Denis Zharkov
ff0736f09e Fix exception after combination of while (true) + stack-spilling
FixStack transformation divides on phases:
- Fixing stack before break/continue
- Fixing stack for inline markers/try-catch blocks

After the first stage all ALWAYS_TRUE markers are replaced
with simple GOTO's and if we're skipping break/continue edges
we won't reach the code after while (true) statement.

At the same time it's fine to not to skip them in the second phase
as the stack for them is already corrected in the first phase

 #KT-19475 Fixed
2017-08-08 18:52:21 +07:00
Dmitry Petrov
e1731373d8 Do not restore stack in default handler for try-finally
It never terminates, so the corresponding value on stack can't be used.
However, if this happens in an inlined lambda argument, the inliner is
unable to remove the corresponding ALOAD instruction (because default
handler never terminates, and thus corresponding ALOAD is not used for
lambda invocation).

KT-17573 try-finally expression in inlined function parameter argument fails with VerifyError
2017-04-26 12:42:33 +03:00
Dmitry Petrov
08fb9c2122 Traverse multiple store-load chains for inlined lambda parameters
When a try-catch expression is passed as an argument to the inline
lambda parameter, lambda variable on stack is spilled and restored in
several different locations (1 for try-block, 1 for each catch-blocks).
So it's possible that lambda to be invoked comes from multiple loads,
all of which should have the same "root" lambda parameter.
2017-04-26 12:42:33 +03:00
Zalim Bashorov
596f3364c6 Automatically mute failed tests 2016-11-09 21:41:12 +03:00
Dmitry Petrov
ccad435850 KT-9644: override default behavior for non-local return in FixStackAnalyzer 2015-10-26 15:56:57 +03:00
Denis Zharkov
17c906658d Transform Throwable members to properties 2015-10-14 20:39:59 +03:00
Dmitry Petrov
a64f1a86c0 Fix KT-8608: Compiler crashes with assertion Restore stack is unavailable
- fix SAVE_STACK_BEFORE_TRY insertion:
  TRYCATCHBLOCK LA, LB, LC
  LA
    NOP
    try_body
  LB
    ...
  LC
    handler_body
should be transformed into:
  LA
    {SAVE_STACK_BEFORE_TRY}
  LA' // new TCB start label
    NOP
    try_body
  LB
    ...
  LC
    handler_body
with all TCBs start labels remapped

- properly wrap exceptions from MandatoryMethodTransformer

 #KT-8608 Fixed
2015-07-27 10:40:14 +03:00
Dmitry Petrov
4e42cc6b81 Save/restore stack in try-expressions (and statements).
Parse TryCatchBlockNode's in generated bytecode, infer stack save/restore points.
Save stack to local variables before 'try'.
Restore stack after the beginning of try-block, catch-block, and default handler.
Integrate before/after inline markers rewriting (otherwise it'll break our stacks).

 #KT-3309 Fixed
2015-07-07 12:16:29 +03:00