Svyatoslav Scherbina
71a8886856
backend: add minor code improvements
...
Including:
* Introduce parameter scope.
* Use more appropriate descriptor types.
* Use words 'parameter' and 'arguments' more correctly.
2016-12-01 13:20:05 +07:00
Svyatoslav Scherbina
a65aef0198
backend: rework variables
...
* use descriptor instead of name to refer to variables
* bind variables to scopes
* begin refactoring mapping between LLVM and IR parameters
2016-12-01 13:20:05 +07:00
Nikolay Igotti
e131622ef7
Use memmove() for potentially overlapping ranges.
2016-11-22 13:10:25 +03:00
Nikolay Igotti
bb6da99feb
Fix ArrayList tests.
2016-11-30 17:39:50 +03:00
Alexander Gorshenev
95433e8a82
Moved a couple more Konan specific annotations to "konan" package
2016-11-30 17:45:07 +04:00
Alexander Gorshenev
b2983850b6
Moved Konan specific annotation "@Used" to "konan" package.
2016-11-30 17:45:07 +04:00
Alexander Gorshenev
bd5b4b2f52
Annotation used
2016-11-30 17:45:07 +04:00
KonstantinAnisimov
90b6a12a5c
Canonical name ( #99 )
...
* TEST: enabled testRetainAll
* Method resolution spared of annotations and generics
* TEST: test for canonical names "interface+generic" added
* Methods' canonical names support:
- Recursive iteration of method argument types
- Arguments in question are delivered from topmost overriden ancestor of this method
2016-11-30 16:19:28 +03:00
Nikolay Igotti
e9b0ebb95e
Ranges support. ( #73 )
2016-11-30 15:38:47 +03:00
Vasily Levchenko
b38a76e910
CODEGEN: AllocArrayInstance and AllocInstance return ArrayHeader * and ObjHeader * respectively
2016-11-30 14:49:23 +03:00
Vasily Levchenko
b62536f807
RUNTIME: AllocArrayInstance and AllocInstance return ArrayHeader * and ObjHeader * respectively
2016-11-30 14:49:23 +03:00
Nikolay Igotti
d4fda3bfe2
String <-> CharArray conversion, ArrayBuilder by @elizarov ( #98 )
2016-11-30 13:06:36 +03:00
Svyatoslav Scherbina
badecf8210
Interop, backend: remove code avoiding zero-length C arrays
2016-11-30 15:00:55 +07:00
Svyatoslav Scherbina
8dc42bbe35
Interop: support allocating zero bytes
2016-11-30 15:00:55 +07:00
Svyatoslav Scherbina
0e43e0d0d8
backend: add test for empty string literal
...
also restore removed disabled test
2016-11-30 15:00:55 +07:00
Nikolay Igotti
51d6dfe713
Append all variable allocations to prologue. ( #97 )
2016-11-29 16:14:29 +03:00
SvyatoslavScherbina
075562f46b
Merge pull request #93 from JetBrains/try-catch-finally
...
Implement throw and try-catch-finally in backend
add corresponding tests
2016-11-29 15:01:23 +07:00
Svyatoslav Scherbina
0c81cfdb24
Review feedback, part 2:
...
implement return to any target from FinalizingScope
2016-11-29 14:01:07 +07:00
Svyatoslav Scherbina
d44b79fa51
Review feedback, part 1
2016-11-29 13:06:02 +07:00
Konstantin Anisimov
5ae4e3372b
CODEGEN: support for safe cast type operator added
2016-11-28 21:48:01 +03:00
Konstantin Anisimov
837ae60eaf
TEST: tests for safe cast added
2016-11-28 21:48:01 +03:00
Vasily Levchenko
c35af302b0
TEST: coercion test enchancement from @olonho
2016-11-28 19:32:37 +03:00
Vasily Levchenko
835ab152f3
CODEGEN: fix evaluateBlock()
...
- we shouldn't ignore variable name to return
2016-11-28 19:32:37 +03:00
Vasily Levchenko
de06d069b1
STDLIB: return original ++ operations
2016-11-28 19:32:37 +03:00
Vasily Levchenko
0887dfabae
CODEGEN: coercion fixed
...
- do not let evaluateWhen ignore case when there're no result expected.
2016-11-28 19:32:37 +03:00
Vasily Levchenko
90d705aae2
kotlin-compiler: 1.1-20161128.112645-274
2016-11-28 19:24:18 +03:00
Alexander Gorshenev
5627688390
A million element byte array segfaults
2016-11-28 20:15:15 +04:00
Svyatoslav Scherbina
9848091186
backend: implement try-catch-finally
...
also add some hacks to handle unreachable code
2016-11-28 20:47:21 +07:00
Svyatoslav Scherbina
e2dbeae85e
backend: add tests for try-catch-finally and throwing exceptions
...
also add some tests for bugs with unreachable code handling and variables
2016-11-28 20:24:27 +07:00
Svyatoslav Scherbina
70fa3ba56a
backend/tests: build with C++
...
because runtime is written in C++
2016-11-28 20:24:27 +07:00
Konstantin Anisimov
725512ad96
CODEGEN: enable interfaces in translator
2016-11-28 16:14:04 +03:00
Konstantin Anisimov
bb665ccc70
TEST: enable interface test
2016-11-28 16:14:04 +03:00
Nikolay Igotti
e800e8acd6
Use primary constructor in ArrayList.
2016-11-28 15:41:03 +03:00
Nikolay Igotti
3d2166410c
TEST: Coercion to Unit and ++/-- tests. ( #87 )
2016-11-27 11:22:54 +03:00
Nikolay Igotti
29c0eda720
Array list, implementation by @elizarov ( #84 )
2016-11-26 16:30:15 +03:00
Vasily Levchenko
f4529298e4
CODEGEN: more logging and verification
2016-11-26 14:16:47 +03:00
Konstantin Anisimov
ce19f73172
RUNTIME: missed operators implemented:
...
- Kotlin_Int_toChar
- Kotlin_Long_xor_Long
- Kotlin_Long_ushr_Long
(cherry picked from commit 7222a8effe6ae23c7ce9784fc65225282876fde4)
2016-11-25 23:37:49 +03:00
Konstantin Anisimov
87c8a9f895
CODEGEN: fix initialization and workarounds for object initialization with companion objects and etc.
...
(cherry picked from commit ae9e493ee92a3730a5ad82e072ab7eed32a8cc27)
2016-11-25 23:37:49 +03:00
Konstantin Anisimov
4717e99ac2
TEST: companion and init0 tests
...
(cherry picked from commit f8e80249e9f986ae58a52a57173d2cb0b68a653b)
2016-11-25 23:37:49 +03:00
Konstantin Anisimov
8496a0f2a9
CODEGEN: naive implementation of string_concatination (not tested)
...
(cherry picked from commit 8e0e9480d7cbec6e640f1b5a8a15af0d2f1bc278)
2016-11-25 23:37:49 +03:00
Konstantin Anisimov
7a0d0ec5a7
CODEGEN: emprovements:
...
- fixed stop on non body functions
- IMPLICIT_CAST implemented
- naive extension function implementation
(cherry picked from commit 3d3b51b0fca3980012e77f47feded5030f0d7901)
2016-11-25 23:37:49 +03:00
Konstantin Anisimov
1b1360c77e
TEST: extension function generation
...
(cherry picked from commit 27b8c962b2b12883150166c83c19b950c9091334)
2016-11-25 23:37:49 +03:00
Vasily Levchenko
9c9d75f6b8
CODEGEN: make TODO more informative
...
(cherry picked from commit b28a5732bb6c1f278efb48efd08319cc5e4f5e75)
2016-11-25 23:37:49 +03:00
Konstantin Anisimov
d88ff9ac08
CODEGEN: buggy fixing:
...
visitReturn - shouldn't emit anything, just pass execution to evaluateReturn
evaluateThrow - should ends with unreachable statement
evaluateReturn - should actually emit ret instruction only for non-Unit return type of statement
(cherry picked from commit 0221353f05fa20826c817a9195210825535193c4)
2016-11-25 23:37:49 +03:00
Konstantin Anisimov
c05b8c6411
CODEGEN: IMPLICIT_COERCION_TO_UNIT implementation and analyze each branch separately
...
(cherry picked from commit 649f47c990fe297e7e622e27e71c1ae10d16b329)
2016-11-25 23:37:49 +03:00
Konstantin Anisimov
a93b7ab886
LOGGER: dump ir to string (partly)
...
(cherry picked from commit 674f32e46c78dac18877497651f6b27e1eed1dcc)
2016-11-25 23:37:49 +03:00
Vasily Levchenko
50b2646329
.gitignore: *.kt.exe
2016-11-24 21:00:38 +03:00
Vasily Levchenko
4806cf8fe1
TEST: executables has .kt.exe extension
2016-11-24 20:59:56 +03:00
Alexander Gorshenev
268e3b26c0
A couple of new tests
...
for boxing
and for body assignment in an interface
2016-11-24 17:46:16 +04:00
Vasily Levchenko
2a0d01191a
CODEGEN: primary/secondary constructor fields initialization
...
for code:
--------8<--------
>cat ../backend.native/tests/codegen/object/fields1.kt
class B(val a:Int, b:Int) {
constructor(pos:Int):this(1, pos) {}
val pos = b + 1
}
fun primaryConstructorCall(a:Int, b:Int) = B(a, b).pos
fun secondaryConstructorCall(a:Int) = B(a).pos
--------8<--------
translator generates:
--------8<--------
; ModuleID = '../backend.native/tests/codegen/object/fields1.kt.bc'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.12.0"
...
define i8* @"kfun:B.<init>(Int;Int)"(i8*, i32, i32) { ;primary constructor
entry:
%this = alloca i8*
store i8* %0, i8** %this
%a = alloca i32
store i32 %1, i32* %a
%b = alloca i32
store i32 %2, i32* %b
%tmp_0 = load i8*, i8** %this
%tmp_2 = load i8*, i8** %this
%tmp_1 = call i8* @"kfun:kotlin.Any.<init>()"(i8* %tmp_2)
%tmp_3 = bitcast i8* %tmp_0 to %struct.ObjHeader*
%tmp_4 = getelementptr %struct.ObjHeader, %struct.ObjHeader* %tmp_3, i32 1
%tmp_5 = bitcast %struct.ObjHeader* %tmp_4 to %"kclass:B"*
%tmp_6 = getelementptr inbounds %"kclass:B", %"kclass:B"* %tmp_5, i32 0, i32 0
%tmp_7 = load i32, i32* %a
store i32 %tmp_7, i32* %tmp_6
%tmp_8 = bitcast i8* %tmp_0 to %struct.ObjHeader*
%tmp_9 = getelementptr %struct.ObjHeader, %struct.ObjHeader* %tmp_8, i32 1
%tmp_10 = bitcast %struct.ObjHeader* %tmp_9 to %"kclass:B"*
%tmp_11 = getelementptr inbounds %"kclass:B", %"kclass:B"* %tmp_10, i32 0, i32 1
%tmp_13 = load i32, i32* %b
%tmp_12 = call i32 @Kotlin_Int_plus_Int(i32 %tmp_13, i32 1)
store i32 %tmp_12, i32* %tmp_11 ; <-- store b + 1 value to pos field
ret i8* %tmp_0
}
...
define i8* @"kfun:B.<init>(Int)"(i8*, i32) { ;secondary constructor
entry:
%this = alloca i8*
store i8* %0, i8** %this
%pos = alloca i32
store i32 %1, i32* %pos
%tmp_0 = load i8*, i8** %this
%tmp_3 = load i32, i32* %pos
%tmp_4 = load i8*, i8** %this
%tmp_1 = call i8* @"kfun:B.<init>(Int;Int)"(i8* %tmp_4, i32 1, i32 %tmp_3) ; call primary constructor
ret i8* %tmp_0
}
--------8<--------
2016-11-24 15:52:34 +03:00