Commit Graph

4764 Commits

Author SHA1 Message Date
Mikhael Bogdanov d806320383 Rename tmpDirForReusableLibrary -> tmpDirForReusableFolder 2019-04-10 20:03:09 +02:00
Ilmir Usmanov 00e952ab15 Introduce CHECK_TAIL_CALL_OPTIMIZATION directive
This directive generates TailCallOptimizationChecker in package helpers.
The check for tail call optimization is based on coroutine stack traces
bug (feature?): when tail call optimization hits, the continuation
object is not generated. Thus, there is no debug metadata for this
suspend function. Consequently, the coroutines stack trace does not
contain stack trace element for that function.
This check is performed by TailCallOptimizationChecker.

Since this is runtime check, unlike bytecode tests, it does not require
test data adjustments on each codegen or inliner change.

Since the check is based on debug metadata, which is JVM specific, there
is not support for other backends yet.
2019-04-09 18:01:21 +03:00
Nikolay Krasko bfda9cc57b Fix inspection Integer.toString() -> int.toString() reports 2019-04-09 11:47:30 +03:00
Anton Bannykh 9b5c8bbac9 JS: switch off inlined local declaration deduplication (KT-30877 fixed)
(cherry picked from commit 681e8dd9682afdea822af8e0ad76c9242831e639)
2019-04-08 21:22:43 +03:00
Ilmir Usmanov 2dee506022 Generate suspend markers for inline and crossinline parameters
if they are not inlined, but directly called.
Previously, all inline and crossinline lambda calls were treated by
codegen as if they are always going to be inlined. However, this is not
always the case.

Note, that we cannot generate these markers during codegen, since we
can inline code with no suspension points, but the whole inlined code
will become one giant suspension point. This, of course, breaks
tail-call optimization and, hence, slows down cold streams.

Because of that, we generate these markers, when we are sure, that they
are not going to be inlined. The only place, in which we know that, is
the inliner. During inlining of the inline function, we check, whether
the parameter is inline or crossinline and whether it is not an inline
lambda. If these checks pass, we generate the markers. Noinline
parameters are already covered by the codegen.
 #KT-30706 Fixed
 #KT-26925 Fixed
 #KT-26418 Fixed
2019-04-08 17:28:37 +03:00
Dmitry Petrov bbeb65905e KT-30780 Fix erased inline class context in class context hierarchy
In SourceCompilerForInline we could enter ERASED_INLINE_CLASS context
from containing declaration context. That broke codegen context
hierarchy invariants assumed in accessor generation.
2019-04-05 17:27:04 +03:00
Anton Bannykh b7ffdb9fde JS IR: support kotlin.test 2019-04-05 12:30:21 +03:00
Anton Bannykh 8174d6c035 JS IR: eliminate quickIrTest 2019-04-05 12:30:21 +03:00
Anton Bannykh ad4c2144a7 JS IR: moved klib creation to the serialization_test module 2019-04-05 12:30:20 +03:00
Anton Bannykh 0f183ed662 JS IR: split compilation and deserialization 2019-04-05 12:30:20 +03:00
Mark Punzalan dd65e0876f Simplify loop building by encoding open/closed bound information in the
HeaderInfo object, and modifying the operator in the loop condition.

The "additional emptiness condition" is no longer necessary with this.
The open/closed property was removed from HeaderInfo in an earlier
commit, but bringing it back in to simplify the loop building makes
more sense.

Also expanded tests for evaluation order of range bounds.
2019-04-04 09:07:19 +02:00
Mikhail Zarechenskiy a4cbec64b7 [NI] Remove failing codegen tests and add similar diagnostic one
These tests were added for suspend-conversions, it worked only
 with new inference, but implementation was incorrect and had other
 bugs, which were fixed in 1ac25259.
 Support of suspend-conversions will be addressed later with a different
 implementation (#KT-30703)
2019-04-01 01:36:15 +03:00
Dmitriy Novozhilov f5ca69c324 [NI] Add codegen test for IntegerLiteralType for js backend 2019-03-29 17:38:55 +03:00
Roman Artemev 6b7eba485b [JS] Run all js tests in v8 2019-03-29 13:38:08 +03:00
Mikhael Bogdanov 9c21c71c63 Fix IDE related test problems after adding ability to run test in parallel in compiler configuration 2019-03-28 13:51:28 +01:00
Mikhael Bogdanov 0c60ff0e80 Revert "Revert "Allow tests to be run in parallel.""
This reverts commit bdad3cac
2019-03-28 13:17:37 +01:00
Ilmir Usmanov 0fec3470dd Regenerate anonymous object if call site of non-inlineable
functional argument is suspend
Split LambdaInfo into inlineable and non-inlineable
 #KT-26925
2019-03-27 17:44:37 +03:00
Ilmir Usmanov 1c2b8e6fad Fix wrong state-machine generation if inner object is retransformed
during inlining.
 #KT-29492 Fixed
2019-03-27 17:44:35 +03:00
Zalim Bashorov bdad3cace9 Revert "Allow tests to be run in parallel."
This reverts commit 21d81f35
2019-03-26 15:22:40 +03:00
Steven Schäfer 9cd005fbae Create temporary library directories for J2V8.
Workaround for https://github.com/eclipsesource/J2V8/issues/39
2019-03-25 19:50:37 +01:00
Steven Schäfer 21d81f353c Allow tests to be run in parallel. 2019-03-25 19:50:37 +01:00
Svyatoslav Kuzmich 70ef0e9431 Add '-ProperIeee754Comparisons' to some tests and disable them in JS_IR 2019-03-25 12:57:26 +03:00
Georgy Bronnikov 451cda79de Rewrite AnnotationCodegen for IR, removing descriptors 2019-03-23 19:04:36 +03:00
Svyatoslav Kuzmich 8429734a67 [JS IR BE] Disable -ProperIeee754Comparisons tests 2019-03-22 13:49:37 +03:00
Georgy Bronnikov fae003866b Use CLI compiler arguments directly in PhaseConfig creation 2019-03-21 23:32:25 +03:00
Alexander Udalov 0fb444a5d1 Move createPhaseConfig to module cli
To use things like MessageCollector to report errors/warnings related to
incorrect phase configuration flags
2019-03-21 23:32:25 +03:00
Alexander Udalov 2995be8bd2 Move usages of createPhaseConfig up to cli & test modules 2019-03-21 23:32:25 +03:00
Ting-Yuan Huang 79fcaae991 Implement constant folding in the IR backend for JVM
The newly added pass folds the set of constant functions of the
current backend, plus IrBuiltIns.
2019-03-20 21:02:55 +01:00
Ting-Yuan Huang f6cf434650 when: emit switch for String if possible
Effectively, the following when structure:

  when (s) {
    s1, s2 -> e1,
    s3 -> e2,
    s4 -> e3,
    ...
    else -> e
  }

is implemented as:

  when (s.hashCode()) {
    h1 -> {
      if (s == s1)
        e1
      else if (s == s2)
        e1
      else if (s == s3)
        e2
      else
        e
    }
    h2 -> if (s == s3) e2 else e,
    ...
    else -> e
  }

where s1.hashCode() == s2.hashCode() == s3.hashCode() == h1,
      s4.hashCode() == h2.

A tableswitch or lookupswitch is used for the hash code lookup.

Change-Id: I087bf623dbb4a41d3cc64399a1b42342a50757a6
2019-03-20 09:13:51 +01:00
Svyatoslav Kuzmich 1d6cd90043 [JS IR BE] Clean up compiler driver api
This is a preparation step for JS-IR CLI:
- CompiledModule was overused. Split it into KlibModuleRef and TranslationResult
- Deserialize klib dependencies from klibs itself
2019-03-18 14:13:28 +03:00
Ilmir Usmanov 7956ef18b2 Generate RETURN instead of ARETURN if (cross)inline suspend lambda returns Unit
#KT-30073 Fixed
2019-03-18 14:04:02 +03:00
Anton Bannykh bb1660c688 JS: better error reporting for V8 runner
In case of stack overflow both the code and the memory release
caused an exception. Only the latter was shown, and it did
not contain much useful information.
2019-03-15 14:55:10 +03:00
Anton Bannykh b61a520da9 [JS IR BE] unmute tests 2019-03-15 14:07:53 +03:00
Svyatoslav Kuzmich 41a45d98e7 [JS IR BE] Regenerate & unmute tests 2019-03-15 13:53:23 +03:00
Svyatoslav Kuzmich 0f07209490 [JS IR BE] Remove unnecesary println from tests 2019-03-15 13:53:21 +03:00
Svyatoslav Kuzmich d203e062bb [JS IR BE] Remove package from operators.kt 2019-03-15 13:53:21 +03:00
Svyatoslav Kuzmich 7b3416c99f [JS IR BE] Disable @library test for JS IR
@library is an internal annotation used in legacy stdlib to expose
declarations written in JS.

IR BE based stdlib will not include JS code thus annotation will not
be supported.
2019-03-15 13:53:21 +03:00
Svyatoslav Kuzmich 41bbd4d2d6 [JS IR BE] Support property accessors with @JsName 2019-03-15 13:53:21 +03:00
Svyatoslav Kuzmich c7f1238a07 [JS IR BE] Add @JsName to inheritanceInNativeClass.kt test to avoid relying on mangling 2019-03-15 13:53:21 +03:00
Svyatoslav Kuzmich 94dc6ff24a [JS IR BE] Disable legacy test 2019-03-15 13:53:20 +03:00
Anton Bannykh 826b9d935d JS/JS IR: split testing tasks for the two backends
Run jsTest for current backend, and jsIrTest for the JS-IR backend tests
2019-03-15 12:19:33 +03:00
Steven Schäfer 3f4c5c8d53 Resolve type aliases when looking for default arguments to actual methods.
Change-Id: I059093c1af32fcd7a2de36c25160c352d6f03a3c
2019-03-14 14:59:34 +01:00
Ting-Yuan Huang 013ad4b8e4 JVM_IR: defer some branch optimizations to codegen.
Specifically, defer the removal of hand-written "if (true|false)" from
JvmBuiltinOptimizationLowering into codegen so that appropriate debug
info (and a NOP) can be inserted.

Change-Id: Ia11af05ad8b4251946bd3e685fb7c3319f0f433f
2019-03-13 08:48:20 +01:00
Alexander Udalov 584137121b Do not write version requirements in metadata for lambdas
#KT-29790 Fixed
2019-03-12 18:53:08 +01:00
Alexander Udalov 0ccf7345e3 Move JsAnalyzerFacade from ide-common to js.frontend
To be used in diagnostic tests now, and as a replacement for
TopDownAnalyzerFacadeForJS in the future
2019-03-11 18:31:59 +01:00
Mikhail Zarechenskiy 1594c1fc6b [NI] Don't consider Nothing-constraint as proper to complete call
Follow-up of 9b3e17f0. There we decided to complete call if a type
 variable from a return type has proper lower constraints, now we refine
 this rule wrt `Nothing`-like constraints to avoid inferring type variables
 to Nothing, which is quite useless

 #KT-30370 Fixed
2019-03-11 19:14:29 +03:00
Abduqodiri Qurbonzoda be6c2d8c7d Implement min max minOf maxOf functions for unsigned types (KT-30035) 2019-03-08 23:34:36 +03:00
Abduqodiri Qurbonzoda 7695b5e575 Implement sum extension function for UArrays (KT-28779) 2019-03-08 23:34:34 +03:00
Abduqodiri Qurbonzoda 299fac8e2d Implement conversion from typed array and collection to UArrays 2019-03-08 23:34:34 +03:00
Roman Artemev e3e3fcded1 Fix windows j2v8 artifact 2019-03-05 22:56:48 +03:00