Commit Graph

1214 Commits

Author SHA1 Message Date
Evgeny Gerashchenko 0f067f042f Using more specific class. 2013-06-25 20:16:21 +04:00
Evgeny Gerashchenko fe77c3edb9 Replaced signed decimal with hex. Eliminated querying canonical path. 2013-06-25 20:16:21 +04:00
Evgeny Gerashchenko e8d0022406 Typo. 2013-06-25 20:16:20 +04:00
Evgeny Gerashchenko 4980dacd33 Supported calls of SAM adapters for constructors. 2013-06-25 20:16:20 +04:00
Evgeny Gerashchenko 5e2c3fcb50 Loading SAM adapters for constructors. 2013-06-25 20:16:20 +04:00
Alexander Udalov fea85476b7 Cast int to byte/short/char in for loop generation
Similar to the previous commit, don't use iinc or iadd+istore where the value
can overflow the byte/short/char limits. This fixes Android tests
2013-06-25 18:48:28 +04:00
Alexander Udalov 356c32893b Don't use 'iinc' instruction on byte/short/char variables
Android run-time verifier complains when there's any possibility that a
byte/short/char local variable could contain a value not fitting into the
type's limits.
2013-06-25 18:48:28 +04:00
Alexander Udalov 9a6979aa6c Minor, rename method 2013-06-20 22:23:02 +04:00
Alexander Udalov 53cc582040 Minor, use incrementType in for-progression codegen
This doesn't fix anything, just makes it easier to figure out values of what
types are used where. Progression increment is of its own type, which may be
different from asmElementType in case of Byte, Char, Short progressions
2013-06-20 22:23:02 +04:00
Alexander Udalov d85ca47184 Generate optimized bytecode for 'for' in progression
Instead of checking for overflow at the end of each iteration, calculate the
actual final loop parameter value before the loop, save it to the local
variable and at the end of the iteration check if the loop parameter is exactly
equal to this final value.

ProgressionUtil.getProgressionFinalElement() credits go to @geevee
2013-06-20 20:19:54 +04:00
Alexander Udalov 8a14b62a23 KT-3574 Assertion error when using ?: in for range
#KT-3574 Fixed

Do not assert that resolvedCall is non-null, since getRangeAsBinaryCall can
return a BinaryCall that doesn't represent a range at all (as specified by the
comment in getRangeAsBinaryCall)
2013-06-20 16:03:00 +04:00
Alexander Udalov e22947281c Minor, cut down unnecessary 'load' in for-progression codegen 2013-06-20 16:03:00 +04:00
Alexander Udalov ee80e0b8ca Fix loops over progressions near to MAX_VALUE/MIN_VALUE
#KT-492 Fixed

For Byte, Char and Short ranges, promote the type of the loop parameter to int
to avoid overflows. For Int and Long ranges at the end of the loop over a
progression we now check if the new (incremented) value of the loop parameter
is greater than the old value iff increment > 0
2013-06-20 16:03:00 +04:00
Alexander Udalov 33d6347876 Fix loop over a range literal up to MAX_VALUE
#KT-492 In Progress

For Byte, Char and Short explicit casting from Int is removed -- loop parameter
is already stored in an Int anyway. For Int and Long comparison "i < end" at
the beginning of the loop is replaced to "i != end" at the end of the loop + a
special check for an empty loop
2013-06-20 16:02:59 +04:00
Mikhael Bogdanov 132d74200b Partial fix for KT-3698: properly write field initializer 2013-06-19 17:02:28 +04:00
Mikhael Bogdanov 79cf02ffb9 Fix for KT-3546: Exception when delegating to ArrayList
#KT-3546 Fixed
2013-06-18 13:23:54 +04:00
Mikhael Bogdanov aec6deae9f Rename fields on name clashing
#KT-3663 Fixed
 #KT-3664 Fixed
2013-06-17 15:20:42 +04:00
Mikhael Bogdanov 406f90badf CodegenContext replaced with MethodContext in ExpressionCodegen 2013-06-17 15:20:42 +04:00
Mikhael Bogdanov be72e096ef Realization of class object fields as static fields of outer class
#KT-2213 Fixed
2013-06-17 15:20:41 +04:00
Mikhael Bogdanov 47fe81471a Synthetic accessors for class object private members
#KT-3338 Fixed
2013-06-17 15:20:34 +04:00
Mikhael Bogdanov e96cf045dd KT-3652: Char is converted to Int when used inside string interpolation
#KT-3652 Fixed
2013-05-27 19:33:49 +04:00
Evgeny Gerashchenko 43b9a9d434 Renamed Name.getName() and FqName.getFqName() to asString() 2013-05-21 17:56:05 +04:00
Andrey Breslav a2b82095da Using the version of ASM that has debug information in it
No more need for extra ASM jars (analysis and util)
2013-05-21 13:56:34 +04:00
Natalia.Ukhorskaya a5f1a8b3f8 TypeCastException when casting null to T with nullable upper-bound
#KT-3637 Fixed
2013-05-21 13:21:52 +04:00
Alexey Sedunov 033e82666d Extract method for else branch check in when expression 2013-05-15 12:57:32 +04:00
Natalia.Ukhorskaya 32c5f5f59d EA-46019 - assert: PropertyCodegen.generatePropertyDelegateAccess: delegate type can be null when delegate expression is unresolved and back-end called from light class generation 2013-05-14 15:38:49 +04:00
Natalia.Ukhorskaya 9e584ded11 ClassFormatError because of initializing variable with Any type with primitive value
#KT-3524 Fixed
2013-05-14 15:38:42 +04:00
Mikhael Bogdanov 6da8ba3fec Default function generation refactoring 2013-05-08 16:13:53 +04:00
Mikhael Bogdanov 702dadccf4 CodegenContext replaced by more specific MethodContext in method generation, mapToCallableMethod call replaced by mapSignature for method header generation 2013-05-08 16:11:17 +04:00
Evgeny Gerashchenko 516a5b76e8 Fixed calling inherited SAM adapter. 2013-05-06 16:45:36 +04:00
Mikhael Bogdanov 22ddd05e09 KT-3576 Getters for float constants in objects always return 0.0 when constants are less than 1.0
#KT-3576 Fixed
2013-05-06 10:41:48 +04:00
Natalia.Ukhorskaya 6e2584d0de Generate bytecode for delegated properties 2013-04-30 21:47:22 +04:00
Mikhael Bogdanov e72b177adc KT-3561 Bad RuntimeInvisibleParameterAnnotations on attempt to annotate enum constructor hidden parametrs - name and ordinal 2013-04-30 18:46:07 +04:00
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