Commit Graph

72 Commits

Author SHA1 Message Date
Artem Kobzar 71486a321c [K/JS] Add support of compilation with ES-classes 2023-01-17 18:14:17 +00:00
Artem Kobzar 73e7053c35 [K/JS] Use only single variant of default arguments function wrapper for exported and not-exported functions 2022-09-19 17:49:04 +00:00
Alexander Udalov f84f3cae97 Decrease operand count in tests on invokedynamic string concat
Otherwise the tests are flaky for some reason; stack overflow is thrown
from psi2ir sometimes. Probably it has something to do with the fact
that the JVM stack which is used by the compiler here is around the
default limit (which is 1M).
2022-01-17 23:59:59 +01:00
Dmitry Petrov 3017397960 JVM_IR fix string concatenation performance issues
KT-50080 KT-50084 KT-50140
2021-12-09 15:32:13 +03:00
Igor Yakovlev 4f9b54da26 [WASM] Remove ignore from wasm std text tests 2021-12-07 21:33:28 +03:00
Sergej Jaskiewicz 060074a9d6 [JS IR] Don't concatenate string template segments with '' when possible
If concatenating with an empty string is a sure no-op, just don't do it.
2021-11-19 11:16:33 +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
Igor Laevsky 50ca86838f [WASM] Fix build 2021-10-14 17:24:07 +03:00
Sergej Jaskiewicz 360c0170be fixup! Mute the test on WASM 2021-10-11 15:57:53 +00:00
Sergej Jaskiewicz 9ee8f1e961 [JS IR] Enable StringTrimLowering for JS IR backend 2021-10-11 15:57:53 +00: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
Svyatoslav Kuzmich 6eb81517a0 [Wasm] Unmute passed Wasm tests 2021-10-02 06:14:35 +00:00
Svyatoslav Kuzmich c88cde2f8b [Wasm] DONT_TARGET_WASM_BACKEND => IGNORE_BACKEND in testdata 2021-10-02 06:14:35 +00:00
Svyatoslav Kuzmich ab9a23cbfa [Wasm][Stdlib] Reuse K/N collections and StringBuilder 2021-10-01 17:18:49 +03:00
Dmitry Petrov 7e86f5dcd9 JVM_IR don't use Intrinsics.stringPlus for 2-argument concatenation 2021-10-01 02:59:52 +03:00
Mikhael Bogdanov 19474ee30f Support large strings in indy-with-constants concatenation
#KT-47917 Fixed
2021-09-01 14:03:56 +00:00
Mikhael Bogdanov 5f62b72c82 Properly process big types 2021-06-26 06:10:16 +02:00
Dmitry Petrov 5d4b0b19d4 JVM_IR KT-13213 split string constants into parts of acceptable length 2020-12-28 16:50:29 +03:00
Mikhail Glukhikh 1c71e64f58 [FIR] Create string interpolating call even for single argument
Before this commit, questionable optimization existed which
unwrapped string interpolating call with single argument to this argument.
However, this led to source element loss and the necessity of sub-hacks.
In this commit we dropped this optimization (anyway user can remove
this single-expression string template in code if needed) to keep
source elements intact.
2020-11-26 08:37:50 +03:00
Svyatoslav Kuzmich fdd7fa5aea [Wasm] Mute codegen box tests 2020-11-09 16:04:43 +03:00
Mikhael Bogdanov eb32a6ddbd Add test for for kt42457 wrong behaviour. Align runtime concatenation with it
#KT-42457
2020-10-06 13:20:40 +02:00
Dmitriy Novozhilov 535898c8a4 [FIR] Fix processing integer operator calls for not integer types 2020-09-14 10:57:10 +03:00
Juan Chen d163853c97 [FIR] add support for implementation by delgation
This commit handles "subclass: super-interface by delegate-expression".

During Psi2Fir, for each delegate, we add to the subclass a synthetic
field (which has type super-interface), and an assignment of the
delegate-expression to the synthetic field in the primary constructor,
so that the delegate-expression can be resolved and transformed along
the way.

During Fir2Ir, we look up delegatable members from the super-interface
and generate corresponding functions/properties for the subclass.

TODO: support for generic delegatable members and generic
super-interface.
2020-07-08 09:42:24 +03:00
Vitaly fe047f9b47 [JS BE] mutes tests for JS_IR_ES6, which muted for JS_IR 2020-05-27 00:32:56 +03:00
Steven Schäfer 58685be4e2 IR: Don't use IrStringConcatenation for ordinary toString calls
We can only use IrStrinConcatentation to represent calls to Any?.toString
and toString calls on primitive types. Otherwise, x.toString() and "$x"
are observably different when x is a non-null type with null value
(e.g., an @NotNull value coming from Java).
2020-03-27 17:31:48 +03:00
Mikhail Glukhikh 03143bc788 [FIR2IR] Implement mapping of FIR & IR built-in class members 2020-03-24 12:15:18 +03:00
Mikhail Glukhikh a4c7619c89 [FIR2IR] Introduce & use FirBuiltInsPackageFragment
Without this commit, JVM name mapping logic in BE does not work for FIR,
because FIR cannot use old BuiltInsPackageFragmentImpl descriptor.
In this commit we add our own implementation thus fixing
a pack of FIR black box tests.
2020-03-24 10:37:53 +03:00
Juan Chen 9dd8eda1c9 [FIR]: fix library methods in packages
Library methods such as 'listOf' are resolved
to have the package fragments as their parents,
but JVM expects their containing file classes as parents.
This fix generates those file classes and
uses them as parent replacements for such library methods.
2020-02-20 14:24:02 +03:00
Mikhail Glukhikh 56c819f06e FIR2IR: add two-statements block with iterator + while for 'for' loops
Before this commit we had two statements blocks for 'for' loops:
range variable declaration + iterator variable declaration + while loop.
However, BE requires a bit different loop structure to make lowerings
properly so in this commit iterator declaration & while loop were
extracted to separate block.
2020-02-17 20:35:17 +03:00
Mark Punzalan 89cf32eccc Clarify comments about KT-36625 that it is pending design decision. 2020-02-12 23:38:12 +03:00
Mark Punzalan ba606147c9 [JVM IR] Maintain KT-36625 bug compatibility between non-IR and IR
backends by removing IMPLICIT_NOTNULL casts from IrStringConcatenation
arguments.

Also fixed an issue where IrStringConcatenation can be lowered into
a null String instead of a literal "null" String if the lone argument
was a platform type String or String with enhanced nullability and the
value was null (e.g., "${FromJava.nullPlatformString()}").
2020-02-12 22:57:15 +03:00
Juan Chen 8e35545e10 FIR2IR: provide type arguments for class 'this' receiver 2020-02-11 22:50:06 +03:00
Juan Chen 573188bdc4 [FIR2IR]: fix translation of this references in instance methods
Currently FirThisReceiverExpression of instance methods are translated
to references of the class' thisReceiver,
not the method's dispatch receiver,
which causes problems with IrFrameMap::typeOf,
as the class' thisReceiver is not in the typeMap.

This commit translates non-qualified "this" references of
instance methods to references of the methods' dispatch receiver.
2020-01-10 10:43:07 +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
Roman Artemev fb3bd8a9ac [JS BE] Implement accessor inlining optimization (WIP)
- enable constant folding
2019-12-24 19:26:05 +03:00
Dmitriy Novozhilov b76c984b26 [FIR] Support IntegerLiteralTypes 2019-12-09 17:24:26 +03:00
Dmitriy Novozhilov 43a8c1282f [FIR] Add toString() call to expressions in string templates 2019-11-19 13:04:49 +03:00
Mark Punzalan 9df2f69f09 [FIR] Disable failing blackbox codegen tests for FIR. 2019-11-19 11:00:09 +03:00
Steven Schäfer f2392a6a28 Remove Concat and StringPlus intrinsics in favor of IrStringConcatenation. 2019-04-24 12:04:12 +02:00
Mark Punzalan d4d5a6011c Flatten nested string concatenation expressions into a single IrStringConcatenation, in a separate lowering phase.
Consolidating these into IrStringConcatenations allows the backend to produce efficient code for string concatenations (e.g., using StringBuilder for JVM).
2019-02-27 08:36:35 +01:00
Svyatoslav Kuzmich 8fbf1ed683 [JS IR BE] Unmute tests 2019-01-24 23:05:56 +03:00
Svyatoslav Kuzmich aa811dcfb3 [JS IR BE] Add KJS_WITH_FULL_RUNTIME directive to compiler tests 2019-01-24 16:14:40 +03:00
Roman Artemev 91ea377622 [JS IR BE] Fix translation for float literals 2018-10-25 15:48:42 +03:00
Anton Bannykh beaf6df8c5 [JS IR BE] support CharSequence and String methods 2018-09-21 18:16:03 +03:00
Anton Bannykh 2e709a81fa [JS IR BE] Arrays, varargs 2018-09-18 14:36:20 +03:00
Roman Artemev 8a871b3f0c Update tests 2018-08-31 15:34:18 +03:00
Roman Artemev c62e4b4fcf [JS IR BE] Support coroutines
* Move FinallyBlockLowering to common part
* Fix catching of dynamic exception
* Fix bridges for suspend functions
* Disable explicit cast to Unit
* Run lowering per module
* Update some test data
2018-08-08 18:33:39 +03:00
Anton Bannykh ac1a97ad83 JS IR: unmute tests 2018-07-11 14:49:36 +03:00
Anton Bannykh 96355e2732 JS IR: mute codegen box tests automatically 2018-06-09 19:15:38 +03:00
Dmitry Petrov a84c2a6f31 Improve string concatentation & string templates code generation
Reuse StringBuilder instances for nested subexpressions.
(NB StringBuilder instance for string template with a string
concatenation inside an expression entry, such as `"${"a" + "b"}"`,
will not be reused, although that doesn't seem to be a real-life issue).

 #KT-18558 Fixed Target versions 1.1.4
 #KT-13682 Fixed Target versions 1.1.4

Join adjacent strings literals, escaped strings, and constant values
(in a language version that supports const val inlining).
Use StringBuilder#append(char) for single-character constants
(e.g., " " in "$a $b").

 #KT-17280 Fixed Target versions 1.1.4
 #KT-15235 Fixed Target versions 1.1.4
2017-06-27 14:28:42 +03:00