Commit Graph

1181 Commits

Author SHA1 Message Date
Mikhael Bogdanov b0b6728c7e KT-3118 NoSuchFieldError on private property without backing field &&
KT-3551 Wrong synthetic accessor implementation
2013-04-30 15:28:02 +04:00
Mikhael Bogdanov b1c2d9035a Removed JvmPropertyAccessorSignature.getJvmMethodSignature() method 2013-04-30 15:17:03 +04:00
Mikhael Bogdanov 83d8930c02 Primary constructor generation via FunctionCodegen Strategy, local variable table generation via JvmMethodSignature and FunctionDescriptor 2013-04-30 15:17:03 +04:00
Mikhael Bogdanov 5fe6e32882 Make JvmPropertyAccessorSignature extends JvmMethodSignature 2013-04-30 15:17:03 +04:00
Mikhael Bogdanov ffed25f48c Fixed wrong JvmMethodParameterKind for captured local function 2013-04-30 15:17:03 +04:00
Mikhael Bogdanov b6fc0c5c13 KT-3538: Super call to trait implemetation invokes method from base class 2013-04-24 15:52:09 +04:00
Mikhael Bogdanov aa2db75266 KT-3389: Local class construction results in CompilationException && KT-2873 && KT-3210
KT-2873: VerifyError on instantiating a local class inside a closure
KT-3210 Inline Class: CompilationException: Back-end (JVM) Internal error: wrong code generated java.lang.ArrayIndexOutOfBoundsException null

 #KT-3389 Fixed
2013-04-24 13:49:47 +04:00
Mikhael Bogdanov 9682b72643 Inner class generation now performed on visiting appropriate declaration 2013-04-23 16:08:02 +04:00
Alexander Udalov 56f8f021f9 Generate proper generic signature for closure classes 2013-04-22 17:59:32 +04:00
Alexander Udalov ace7bd9bc8 Fix StackValue.coerce void to Object
We can only put Unit.VALUE on stack if we're requested an instance of Object or
Unit. In other cases (arbitrary objects / arrays) we put null instead
2013-04-22 17:59:32 +04:00
Alexander Udalov 36ddfaa24b Minor refactoring in CodegenAnnotatingVisitor
Create a private helper method
2013-04-22 17:59:32 +04:00
Alexander Udalov 054e5fb5e7 Codegen for callable reference expressions
#KT-1183 In Progress
2013-04-22 17:59:32 +04:00
Alexander Udalov 1eeaaad05d Refactor method/constructor calls in codegen
- use ResolvedCall where possible
- 'call' parameter to invokeMethodWithArguments was used only to generate
  callee, e.g. in "A()" where A is an expression which can be invoke()'d.
  In case of constructors and enum entry delegation specifiers there's no need
  to generate callee, so 'call' is made Nullable with a subsequent assert
- remove generateJavaConstructorCall() method, since it did no useful work.
  Java constructor invocation is broken anyway and needs to be fixed (KT-3532)
- minor code style / formatting issues fixed, several methods renamed to better
  reflect semantics
2013-04-22 17:59:32 +04:00
Alexander Udalov db65237989 Refactor ClosureCodegen
- make several commonly used parameters ClosureCodegen's fields
- take an arbitrary strategy for closure function body codegen
- don't make extra binding context lookups
2013-04-22 17:59:31 +04:00
Alexander Udalov 80b78f0f6d invokeinterface FunctionN.invoke()
Instead of invokevirtual on FunctionImpl class, do invokeinterface on a
Function trait. This will allow to invoke functions on classes which don't
inherit from FunctionImpl classes.

Also rename the method to the more sensible name
2013-04-22 17:59:31 +04:00
Alexander Udalov 141b996709 Minor refactoring in ExpressionCodegen
Inline useless method, factor out resolveToCallableMethod logic from
resolveToCallable
2013-04-22 17:59:31 +04:00
Alexander Udalov f509407852 Extract static helpers to FunctionTypesUtil
Also move 'getInternalClassName' method from CodegenUtil to FunctionTypesUtil,
since it's related to function types
2013-04-22 17:59:31 +04:00
Alexander Udalov 121cb13883 Minor refactoring in CodegenBinding
- CLASS_FOR_FUNCTION slice was used for two purposes: to record closure classes
  for functions and for scripts. Separate this slice into two slices:
  CLASS_FOR_FUNCTION and CLASS_FOR_SCRIPT
- add classNameForAnonymousClass() overloaded method to CodegenBinding, taking
  a function descriptor (not a PSI element)
2013-04-22 17:59:31 +04:00
Alexander Udalov f907d008e7 Refactor ClosureCodegen
Extract some methods, replace types with more generic (ExpressionCodegen ->
LocalLookup), make more stuff fields instead of parameters passed to every
method, annotate with Nullable/NotNull
2013-04-22 17:59:31 +04:00
Alexander Udalov 76fa9642f0 toString() for FunctionN classes
It's implemented as if the types were reified: getting the real type parameters
of the corresponding FunctionN class
2013-04-22 17:59:29 +04:00
Alexander Udalov 0ec1f20140 Write generic signature for closure FunctionN superclass
ClosureCodegen.appendType() now appends any Type as a type parameter correctly
2013-04-22 17:59:29 +04:00
Alexander Udalov 974df0ed8e Use FunctionImplN instead of FunctionN in codegen
Superclass of closures should now be FunctionImplN instead of FunctionN. Since
these -Impl classes are needed only in JVM, the corresponding descriptors and
types are created in the back-end only.
2013-04-22 17:59:29 +04:00
Wojciech Lopata 3e76fc2902 Rename method 2013-04-19 08:21:00 +02:00
Evgeny Gerashchenko 7bd11718de Supported simplest cases of SAM adapter in backend. 2013-04-18 22:01:26 +04:00
Evgeny Gerashchenko c5b9c6a7dc Minor. Removed index counter. Renamed variable. 2013-04-18 21:59:49 +04:00
Mikhael Bogdanov 82d7f07cb3 Fixed bug in fix for KT 3492: Bug in bytecode generation for labeled super call from inner class & Property generation refactoring 2013-04-18 18:33:25 +04:00
Mikhael Bogdanov c69e7f059d Duplicated JetTypeMapper.mapSignature removed 2013-04-18 15:03:43 +04:00
Mikhael Bogdanov a1d295638a ExpressionCOdegen.visitSimpleNameExpression simplification 2013-04-18 14:05:15 +04:00
Andrey Breslav edbbc6ec7b Unused method removed 2013-04-17 17:11:21 +04:00
Natalia.Ukhorskaya f2b3be7416 Unify properties initialization for init and clinit 2013-04-17 16:18:10 +04:00
Mikhael Bogdanov 57b161b08a KT-3500: ClassFormatError: Duplicate method name&signature in class file && KT-3429: Traits override bug 2013-04-17 15:23:33 +04:00
Mikhael Bogdanov 3da3f94b4e KT 3492: Bug in bytecode generation for labeled super call from inner class & Property generation refactoring 2013-04-17 15:23:33 +04:00
Mikhael Bogdanov 8a14087c91 Refactoring: property processing generalization 2013-04-17 15:23:33 +04:00
Mikhael Bogdanov 0ba38b9f09 Removed code duplication and unnecessary branch 2013-04-17 15:23:33 +04:00
Mikhael Bogdanov 48d153e8b2 General class for Field, Property, FieldForSharedVar extracted 2013-04-17 15:23:33 +04:00
Andrey Breslav df9f4ea6d6 Better diagnostics in CompilationException 2013-04-12 21:06:54 +04:00
Andrey Breslav 8c967e0c73 Unused parameters removed from injectors 2013-04-12 21:06:52 +04:00
Alexander Udalov 57f6870e68 Remove useless parameter from FunctionGenerationStrategy 2013-04-10 20:25:16 +04:00
Alexander Udalov 330efd3967 Remove useless methods from codegen utils 2013-04-10 20:25:16 +04:00
Alexander Udalov 306e4bdbd7 Get rid of FunctionCodegen.MethodInfo
generateMethodBody() is now responsible for generating the local variable
table, therefore the data class MethodInfo is not needed anymore to return
multiple values from it
2013-04-10 20:25:15 +04:00
Alexander Udalov a67866823e Refactor FunctionCodegen.genJetAnnotations()
Always map descriptor to the callable method and take the signature from there,
since this way the signature appears to be more accurate. The whole
"mapSignature vs mapToCallableMethod.getSignature" story needs some
investigation though.

Also make the method non-static, remove useless checks, etc
2013-04-10 20:25:14 +04:00
Alexander Udalov 9187116055 Refactor componentN() function generation
Adopt to the new FunctionGenerationStrategy
2013-04-10 20:25:14 +04:00
Alexander Udalov 34009a2134 Refactor copy() function generation for data classes
Use FunctionCodegen and the newly created FunctionGenerationStrategy to
generate the needed instructions. Make some methods in FunctionCodegen private
since they're not used anymore outside of the class
2013-04-10 20:25:13 +04:00
Alexander Udalov 9bb3663b54 Extract generation logic from FunctionCodegen
Create a new class FunctionGenerationStrategy, which is used to specify exactly
how the body of a function will be generated. This is made primarily to factor
out the hard dependency on PSI in FunctionCodegen.generateMethod(). The PSI
element is now optional and is only used for debug information (as an argument
to newMethod() and endVisit()). This also helps to refactor the confusing logic
about generating default property accessors.

Assert for whether we generate code now for the declared member is now useless,
since generateMethod() will be used also for generating any possible members.

Also surround with "if ( != null)" some method call in genJetAnnotations(), as
null is possible here
2013-04-10 20:25:12 +04:00
Alexander Udalov 98688eed66 Simplify FrameMap construction in FunctionCodegen 2013-04-10 20:25:12 +04:00
Alexander Udalov b2e389d90b Minor refactoring in FunctionCodegen
Combine two nested classes, MethodBounds and LocalVariablesInfo, into one
MethodInfo. Rename some methods. No logic has changed
2013-04-10 20:25:11 +04:00
Alexander Udalov 099fa6c11e Minor refactoring in Function/PropertyCodegen
Check if we need to generate code before calling generateMethod()
There were 4 such checks, 2 of them in PropertyCodegen, one in
FunctionCodegen.gen() and one in ClosureCodegen. Every usage except the last
was prepended with the check
2013-04-10 20:25:10 +04:00
Evgeny Gerashchenko d502d45772 Disabled highlighting for variables which are captured in inlined closure. 2013-04-10 20:10:49 +04:00
Natalia.Ukhorskaya 1dce3b5da4 Invoke top level function with default argument using src class 2013-04-09 17:11:25 +04:00
Evgeny Gerashchenko 72284c36d4 Added examples in code. 2013-03-29 20:36:48 +04:00