Commit Graph

675 Commits

Author SHA1 Message Date
Dmitriy Novozhilov d1fd1da56f Rename Visibility to DescriptorVisibility 2020-09-04 11:07:42 +03:00
Mark Punzalan 16ab11289c [JS_IR] Enable RangeContainsLowering optimizations. 2020-09-03 18:42:35 +03:00
Roman Artemev fd88914cf9 [IR] Remove some descriptor usage from Common/JS/JVM backends
- replace descriptor-based builders with pure IR ones
 - fix matchers
 - fix Ir2Js
 - rewrite some inliner-helpers to pure-IR implementations
2020-09-01 17:08:11 +03:00
Roman Artemev e592b3af1d [JS IR] Fix CallsLowering's*
- need to fix dev mode since some methods are not handled
 with intrinsic lowering
2020-09-01 14:53:08 +03:00
Roman Artemev 7a6415dc53 [JS IR] Enable IrError element's lowerings in JS 2020-09-01 14:53:08 +03:00
Roman Artemev 4dca3715fa [JS IR | IR] Implement error element lowering to support compilation with errors 2020-09-01 14:53:08 +03:00
Roman Artemev 14b5424583 [JS IR] Support translation of IrError* elements 2020-09-01 14:53:08 +03:00
Igor Chevdar ab54e43b00 [IR] Commonized SAM equals/hashCode builder 2020-08-31 12:01:29 +05:00
Zalim Bashorov 606232a584 [JS IR] Don't generate "import" statements for external interfaces
#KT-40964 fixed
2020-08-28 13:14:22 +03:00
Zalim Bashorov ba846830c9 [JS IR] Support nativeGetter, nativeSetter and nativeInvoke
#KT-41081 fixed
2020-08-28 13:04:18 +03:00
Anton Bannykh 136d86e552 [JS IR] Fix cross-module import/export in case per-module splitting 2020-08-20 22:13:39 +03:00
Alexander Udalov a810dbb41b IR: fix compiler warnings 2020-08-18 10:33:25 +02:00
Alexander Udalov 9961bd1fe1 IR: remove unneeded casts after making IrCall's symbol a simple function 2020-08-17 21:18:17 +02:00
Alexander Udalov 6db5ad7310 IR: remove cast to IrStatement in IrDeclarationBase.transform
Default implementation of `IrStatement.transform` contained a cast to
`IrStatement`. Since almost all IR elements inherit from IrStatement,
this implementation was used in many subclasses. However, checkcast to
interface is slow and this place was indeed noticeable in the profiler
snapshot. Since not that many places really expected to get IrStatement
out of IrStatement.transform, introduce a new method
`transformStatement` that does this cast, and use it in all those
places. Meanwhile, most implementations will use the IrElement's
implementation of `transform` which merely invokes `accept` without
casts.
2020-08-14 21:55:37 +02:00
Alexander Udalov fb8e39a621 IR: optimize transformation of declarations/statements lists in-place
Also, inherit IrDeclarationBase from IrElementBase to be able to use a
cast to IrElementBase, which is faster than a cast to IrElement or
IrDeclaration.
2020-08-14 21:55:36 +02:00
Alexander Udalov 4f0585950e IR: inline some transformChildren calls in IrElementTransformer{,Void}
IrElementTransformer.visitDeclaration/visitExpression are very prominent
hotspots, and it seems that HotSpot doesn't optimize the inlined Kotlin
bytecode there well enough. Reduce the bytecode in these and similar
methods by inlining calls to also/apply/transformChildrenVoid.
2020-08-14 21:55:36 +02:00
Georgy Bronnikov 18ae665d41 IR: make IrCall take IrSimpleFunctionSymbol 2020-08-12 16:31:31 +03:00
Alexander Udalov 4351f5235b IR: make IrExpression and subtypes classes 2020-08-11 14:41:56 +02:00
Alexander Udalov fde7314aaf IR: do not inherit IrExpressionWithCopy from IrExpression 2020-08-11 14:41:55 +02:00
Alexander Udalov e3dfd5fb49 IR: push down implementations of startOffset/endOffset/type/...
Do not store these as properties in IrElementBase, IrExpressionBase and
similar classes. This helps to reduce boilerplate in implementations
(just "override val" in the constructor, instead of taking a parameter
and passing it to the superclass), and also slightly optimizes memory in
cases where the value is trivial (UNDEFINED_OFFSET, 0, etc) and thus
does not need to be stored.
2020-08-11 14:41:54 +02:00
Georgy Bronnikov 7f4df19dd1 JVM_IR: reorganize throw... functions in Symbols 2020-08-11 10:54:29 +03:00
Georgy Bronnikov 04d93dfbce IR: move containerSource from descriptor to IrFunction, IrProperty 2020-08-10 10:16:23 +03:00
Alexander Udalov 8db1c3611b IR: introduce abstract class IrDeclarationBase
The main purpose of this class is to improve performance of IR visitors
and transformers. `IrElementVisitor.visitDeclaration` now takes
IrDeclarationBase as a parameter, and therefore the call to `accept`
there is now a virtual class call, instead of an interface call.
2020-08-06 17:08:04 +02:00
Georgy Bronnikov a2e9521ad5 Make DescriptorlessExternalPackageFragmentSymbol public 2020-07-30 11:24:07 +03:00
Alexander Udalov 687d13a320 IR: cleanup expression implementations
Remove unused constructors with descriptors, minimize usages of
secondary constructors and make some properties non-lateinit, fix some
inspections.
2020-07-28 20:05:58 +02:00
Alexander Udalov 77247deb23 IR: add module ir.tree.persistent, copy PIR implementation there
Use PersistentIrFactory in JS IR compiler entry points.
2020-07-28 19:04:43 +02:00
Alexander Udalov 12d2a02d22 JS IR: drop JsIrDeclarationBuilder
Move buildValueParameter back to JsIrBuilder, and use common IR builders
directly where buildFunction was called.
2020-07-28 12:05:24 +02:00
Alexander Udalov 0d605a6b7f IR: create IrBlockBody via IrFactory 2020-07-28 12:05:24 +02:00
Alexander Udalov 9ad4a754ce IR: create IrExpressionBody via IrFactory 2020-07-28 12:05:24 +02:00
Alexander Udalov d1dc938a5d IR: use IrFactory in IR builders 2020-07-28 12:05:24 +02:00
Alexander Udalov db4cbe7103 IR: use IrFactory in SymbolTable 2020-07-28 12:05:23 +02:00
Alexander Udalov c6a127e87e IR: introduce IrFactory
This is needed to refactor IrPersistingElementBase-based implementations
into another module, to use it in JS IR.
2020-07-28 12:05:23 +02:00
Svyatoslav Kuzmich 4a803e9d2f [JS IR] Support object declaration export
Fixes KT-39117 and KT-39367
2020-07-23 08:21:59 +03:00
Alexander Udalov 65d3ae6253 JS IR: move declaration creation from IrBuilder to JsIrDeclarationBuilder
This is a temporary class until IrDeclarationFactory is there.
2020-07-22 22:40:08 +02:00
Alexander Udalov ca5eb40fa5 IR: minor, avoid usages of IrBlockBodyImpl/IrExpressionBodyImpl 2020-07-22 22:38:20 +02:00
Anton Bannykh cb15570d75 [JS IR BE] Fix validation errors (duplicate nodes and incorrect parent) 2020-07-21 18:25:17 +03:00
Alexander Udalov c7f9dc1c40 IR: rename DeclarationFactory to InnerClassesSupport, move out of context
Methods of the common interface DeclarationFactory were only used in
lowerings in InnerClassesLowering, which were used in JVM and JS, not
Native. Therefore, it makes sense to have this as a separate interface
and pass its implementation to these lowerings directly, instead of
declaring it in the common context (which is not going to be implemented
in Native).
2020-07-20 22:26:11 +02:00
Alexander Udalov cf884fb048 IR: remove JVM-specific methods from DeclarationFactory 2020-07-20 22:26:11 +02:00
Georgy Bronnikov c901e82a55 IR: add IrSimpleFunction.isInfix 2020-07-18 11:03:33 +03:00
Alexander Udalov c9fdef8233 IR: use buildField where possible 2020-07-16 16:09:31 +02:00
Alexander Udalov 2d723f1c51 IR: use buildClass where possible 2020-07-16 16:09:31 +02:00
Alexander Udalov 5b1193407a IR: use buildConstructor where possible 2020-07-16 16:09:31 +02:00
Alexander Udalov 6aa09f61d4 IR: use buildFun where possible 2020-07-16 16:09:30 +02:00
Alexander Udalov 39e38c7049 IR: introduce buildVariable, use where possible 2020-07-16 16:09:30 +02:00
Alexander Udalov c3560e5854 IR: use buildTypeParameter, minor cleanup 2020-07-16 16:09:30 +02:00
Alexander Udalov 4b5464c6cc IR: introduce buildReceiverParameter, use where possible 2020-07-16 16:09:30 +02:00
Alexander Udalov b36a6114aa IR: use buildValueParameter where possible 2020-07-16 16:09:29 +02:00
Svyatoslav Kuzmich 609f0ca9bc [JS IR] .d.ts generation for module systems
Support .d.ts generation for UMD, AMD, CommonJS module kinds in
addition to existing "plain" module kind.
2020-07-16 14:02:06 +03:00
Zalim Bashorov 340512e27a [KJS] Throw exception on recursive types provided to typeOf and provide proper support later within KT-40173
#KT-38140 fixed
2020-07-14 14:14:13 +03:00
Alexander Udalov e674226a3b IR: do not use Ir*Impl elements where it's not necessary 2020-07-10 16:17:06 +02:00