Commit Graph

240 Commits

Author SHA1 Message Date
Svyatoslav Kuzmich b6ad1584c9 [Wasm] Improve interface method dispatch
- Use typed Wasm tables for each interface method to avoid runtime
  function type check

- Use linear search by implemented interface rather than by individual
  virtual function signature
2020-12-30 19:29:10 +03:00
Dmitry Petrov 3f7a776fb8 JVM box tests for KT-21092 2020-12-23 21:50:07 +03:00
Dmitry Petrov 9f908cdf7c JVM box tests for KT-16752 2020-12-23 21:50:05 +03:00
Dmitry Petrov 632f5af442 Minor: kt21014.kt - add JVM_TARGET 1.8 2020-12-23 11:25:36 +03:00
Dmitry Petrov 3ae8521f12 Minor: drop kt21014.kt (SIGSEGV on HotSpot 6.0_45-b06) 2020-12-22 19:56:54 +03:00
Dmitry Petrov 443cd0fc2c Tests for issues fixed in JVM_IR 2020-12-22 16:07:06 +03:00
Dmitry Petrov ee1e05fedd KT-42151 fix type arguments in local class constructor reference types 2020-11-26 18:40:49 +03:00
Jinseong Jeon 463d53ee5c FIR: handle reference to property with invisible setter 2020-11-20 10:48:13 +03:00
Denis Zharkov 14305d1eba FIR: Simplify callable references resolution
Also that fixes some bugs
2020-11-16 15:50:39 +03:00
Denis Zharkov d4c7d4fc7c FIR: Fix callable references resolution with stub receivers
Use stubReceiver as a receiver for fake calls

See issues KT-43358 KT-43359 KT-43378
2020-11-16 15:50:39 +03:00
Svyatoslav Kuzmich fdd7fa5aea [Wasm] Mute codegen box tests 2020-11-09 16:04:43 +03:00
Jinseong Jeon 5f64d6ec76 FIR2IR: add support for callable reference to Java field
#KT-42656 Fixed
2020-10-15 08:47:46 +03:00
Jinseong Jeon 65545a10c4 FIR: reproduce KT-42656 2020-10-15 08:47:46 +03:00
Alexander Udalov 2f003bdcb5 Minor, add regression test
#KT-42527
2020-10-07 21:31:43 +02:00
pyos a6d5c02d9b JVM_IR: add a transformChildren call to PropertyReferenceLowering
#KT-42354 Fixed
2020-10-06 17:06:34 +02:00
Denis Zharkov 3dfbd36f15 FIR: Unmute passing blackbox tests 2020-10-01 17:49:02 +03:00
Jinseong Jeon b4ac2f5b55 FIR serializer: special handling of Continuation 2020-09-30 12:21:57 +03:00
pyos 0e8a664c9b JVM_IR: fix bound suspend-converted references
Note: inlining of adapted callable references is still suboptimal.

 #KT-42021 Fixed
2020-09-29 19:49:46 +02:00
Roman Artemev 6670e4b21d [JS IR] Fix callable reference to generic constructor
- add tests
 - fix KT-42025
2020-09-24 12:50:47 +03:00
Ilmir Usmanov 9ecf5dc9af Support is/as operations on suspend callable reference conversion 2020-09-17 16:14:04 +02:00
Jinseong Jeon 72dea05854 FIR2IR: approximate type argument if reified 2020-09-17 09:43:46 +03:00
Dmitriy Novozhilov 7f692be11e [FIR] Properly detect callable reference type according conversions 2020-09-11 12:13:33 +03:00
Jinseong Jeon 04af6846a7 FIR2IR: handle more vararg spreads for adapted callable references 2020-08-31 14:31:58 +03:00
Igor Chevdar 527de030fc [box-tests] Turned on some tests for K/N 2020-08-31 12:01:31 +05:00
Dmitriy Novozhilov b21a0213df [NI] Get rid of FE 1.0 types in AbstractTypeApproximator 2020-08-28 10:59:51 +03:00
Jinseong Jeon 553ae68c96 FIR2IR: convert adapted callable reference with vararg 2020-08-26 14:26:19 +03:00
Jinseong Jeon 1b6c4329d2 FIR2IR: handle unbound reference with adapted arguments 2020-08-18 21:53:07 +03:00
Jinseong Jeon 7ef1c74bbf FIR2IR: apply adapted reference conversion to coercion-to-unit 2020-08-05 17:07:27 +03:00
Jinseong Jeon 0e54f98b79 FIR: support adapted callable reference with vararg 2020-08-03 16:37:36 +03:00
Jinseong Jeon bff36e0199 FIR2IR: convert annotations on FirTypeRef 2020-07-30 11:25:36 +03:00
Jinseong Jeon 5a3367e09c FIR: initial support of suspend conversion for function reference 2020-07-28 13:37:05 +03:00
Jinseong Jeon 4e14f9500f FIR: account for vararg when creating KFunction type for callable reference 2020-07-20 09:39:34 +03:00
Mikhail Zarechenskiy c2c139ef4f Fix adaptation for references with default values after varargs
After vararg argument it's possible to pass values only by name, so
 here we modulate this behavior

 #KT-37721 Fixed
2020-06-26 14:03:48 +03:00
Ilya Gorbunov 2fe222e8e7 Add SKIP_DCE_DRIVEN directive in JS-IR tests
Otherwise they fail with a compiler exception:
"An operation is not implemented: SAM conversion"
2020-06-17 19:45:15 +03:00
Mikhail Zarechenskiy 718f23b34f Compatibility warning for references to companion via name (KT-13934) 2020-06-05 13:24:18 +03:00
simon.ogorodnik 8afbb4542b [FIR2IR] Fix check if interface is SAM 2020-05-29 21:10:56 +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
Denis Zharkov e1e149a062 FIR: Support coercion-to-unit semantics for callable references 2020-05-18 11:17:45 +03:00
Anton Bannykh 86b5c63891 JS IR: fix origin for callable references with bound reciever
In case of IrFunctionReference with type SuspendFunction (no K!) there
was a misalignment between the base class (Any) and the
origin (LAMBDA..). As a result the SuspendFunctionLowering was
getting confused and produced hanging code.
2020-05-14 14:33:12 +03:00
Anton Bannykh bdca4b45bd JS: inliner supports extra argument caused by suspend conversions 2020-05-14 14:33:12 +03:00
Mikhail Glukhikh e7e80be34a [FIR2IR] Populate overridden symbols even for !isOverride
Before this commit we considered !isOverride as a sign that
function / field / accessor has no overridden symbols.
However, it's false for deserialized, because isOverride
is always false there.

This commit fixes 68 BB tests but breaks 25 BB tests (not yet muted)
2020-05-14 13:40:36 +03:00
Alexander Udalov 91ef053fbc IR: keep local scope with counter maps across LDL invocations
Since LocalDeclarationsLowering is a BodyLoweringPass, local
functions inside one declaration are handled independently of local
functions in the other declaration. This can lead to name clashes, in
case a local function with the same name and signature is declared in
overloads in the same container, which results in a signature clash
error in JVM IR.

The issue became more common with the introduction of adapted function
references, where psi2ir generates a local adapter-function with a
predefined name, which can easily clash with another reference to the
same target in an overload. This led to a compilation error when
bootstrapping Kotlin with JVM IR, for example in GradleIRBuilder.kt
where there are a lot of references to the same function.
2020-05-08 14:33:34 +02:00
Alexander Udalov 54f9f130e2 Do not generate references as adapted with -Xno-optimized-callable-references
The reason for this is that this flag is used right now in 'cli-common'
to workaround the problem that this module is compiled with API version
1.4, but runs with stdlib of version 1.3 (bundled to Gradle). The same
problem would appear with adapted function references, since we use
kotlin/jvm/internal/AdaptedFunctionReference in the bytecode, only
available since 1.4.

The fix is to generate adapted references in this case as subclasses of
the already existing kotlin/jvm/internal/FunctionReference. This can
change behavior in some extreme corner cases (because such references
can now be observed to have reflection capabilities), but it's an -X
argument anyway.

Another option would be to introduce another compiler argument
specifically for this, but it looks like it would only complicate things
without much benefit.
2020-05-04 13:24:53 +02:00
simon.ogorodnik a11866ab5a [FIR2IR] Fix labeled this references 2020-04-30 13:15:43 +03:00
Dmitry Petrov f9bb07e128 JVM_IR: generate flags for adapted function references 2020-04-29 00:55:52 +03:00
Dmitry Petrov 878e838f0b JVM: Suspend converted references inherit AdaptedFunctionReference 2020-04-28 18:56:37 +03:00
Mikhail Glukhikh c6c848f929 Introduce & use FirJvmSerializerExtension & FirBasedClassCodegen
#KT-38156 In Process
2020-04-28 07:34:56 +03:00
Dmitry Petrov c7a96810bf JVM: Suspend conversion for function references 2020-04-27 21:02:37 +03:00
Alexander Udalov 025d1ca64d psi2ir: rework representation of bound adapted function references
This fixes the problem in JVM IR backend which didn't pass bound
receiver value of an adapted function reference to the superclass
(kotlin/jvm/internal/AdaptedFunctionReference), which caused equals to
work incorrectly on such references (see changes in box tests).

Previously, bound adapted function reference was represented as
IrFunctionExpression to an adapter function which calls the callee. The
value of the bound receiver in that case could only be found in the body
of that adapter function. This is not very convenient, so this change
makes psi2ir produce a block of the adapter function + reference to it.
The bound receiver value is then found in the reference. This is
basically similar to what ProvisionalFunctionExpressionLowering is doing
for all function expressions. And since this IR structure is already
supported in FunctionReferenceLowering, the problem in the JVM IR is
fixed without any additional modifications.

However, inliners do not support this IR structure yet, see KT-38535 and
KT-38536.
2020-04-23 16:47:23 +02:00
Mark Punzalan b74652aa5b [FIR] Use ieee754equals for floating-point equality operations 2020-04-23 11:50:54 +03:00