Commit Graph

73 Commits

Author SHA1 Message Date
Vasily Levchenko 3331cdbf94 kotlin-ir: sync 2016-10-23 12:13:17 +03:00
Vasily Levchenko e8dd179770 realization LazyClassReceiverParameterDescriptor 2016-10-22 09:37:45 +03:00
Vasily Levchenko 731361f2e9 added comment that thereis required check about shadowing 2016-10-22 09:36:23 +03:00
Vasily Levchenko 1b97973dc8 constructor should initialize fields of object basing on comparizon with storage structure 2016-10-22 09:35:03 +03:00
Vasily Levchenko 64acd9d894 field acces test (when there're no storage in object for contructor parameter) (not runnable yet) 2016-10-22 09:32:48 +03:00
Vasily Levchenko 09ee81b7a3 object initialization and properties access 2016-10-21 20:21:54 +03:00
Vasily Levchenko 0523505354 Runtime: export function to import own functionality to target module (perhaps it's frontend task) 2016-10-21 20:21:54 +03:00
Vasily Levchenko 7d243378cd TEST:object initialization 2016-10-21 20:21:54 +03:00
Vasily Levchenko 639c4f9786 frontend: prints compilation error 2016-10-20 23:03:10 +03:00
Vasily Levchenko badcccac58 tests now can use runtime infrostructure 2016-10-20 12:34:49 +03:00
Svyatoslav Scherbina 25403723be backend.native: improve memory management using mem scopes 2016-10-19 13:45:40 +03:00
Svyatoslav Scherbina a1593c86f1 backend.native: support external functions
also implement changing external function symbol name with the annotation
2016-10-19 13:45:40 +03:00
Svyatoslav Scherbina 61e1d91c03 backend.native: use common/hash to compute hashes for RTTI 2016-10-19 13:42:53 +03:00
Svyatoslav Scherbina 9f5f2eecfc backend.native: add minor improvements to code for compile time values 2016-10-19 13:33:51 +03:00
Svyatoslav Scherbina 5bb5cb70ee build: trivially support runtime sources written in Kotlin 2016-10-19 13:33:50 +03:00
Svyatoslav Scherbina 7350b4da37 backend-native: fix tests after reworking Gradle interop plugin 2016-10-19 13:33:50 +03:00
Vasily Levchenko 4142ff8845 kotlin-ir: sync 2016-10-18 09:55:21 +03:00
Svyatoslav Scherbina 2835ddb7f2 build: add "LD_LIBRARY_PATH=llvmDir/lib" for Linux 2016-10-17 18:25:31 +03:00
Svyatoslav Scherbina e4bc19b145 build: download llvm and libffi from the JFrog repo 2016-10-17 17:35:57 +03:00
Vasily Levchenko ddae560ffe support new interface for jvm frontend 2016-10-17 14:03:25 +03:00
Vasily Levchenko 5790787840 kotlin-ir sync 2016-10-17 05:28:05 +03:00
Nikolay Igotti 6f43e7befd Fetch IR branch. 2016-10-14 14:25:33 +03:00
Svyatoslav Scherbina 8c4f5c3cef backend.native: add -fPIC for interop with :common:hash
to fix build on Linux
2016-10-13 18:12:21 +03:00
Svyatoslav Scherbina edc88c67da backend.native: include interop with :common:hash 2016-10-13 17:29:02 +03:00
Svyatoslav Scherbina 94f3c1d048 Interop: implement stub gen without .def
also add some default values to .def file format
2016-10-13 13:10:44 +03:00
Svyatoslav Scherbina 57cfc617a6 Interop: represent it as dependency in Gradle plugin 2016-10-12 16:29:52 +03:00
Vasily Levchenko 6f666b6ca9 fix: constructing parameterless function descriptors 2016-10-12 11:14:23 +03:00
Vasily Levchenko 937e721d56 kotlin-ir sync 2016-10-11 21:50:51 +03:00
Nikolay Igotti f02339c1dc Merge pull request #4 from JetBrains/mem_mgmt
Add memory mgmt.
2016-10-11 19:10:53 +03:00
Nikolay Igotti e730ee9f37 Fix spaces. 2016-10-11 19:08:46 +03:00
Nikolay Igotti 83fbb3342f Restore codegen. 2016-10-11 19:02:30 +03:00
Nikolay Igotti 7ff6a52e4c Restore codegen. 2016-10-11 18:44:27 +03:00
Nikolay Igotti ecb5a67db7 Add City64 as local hash, and update RTTI accordingly. 2016-10-11 18:40:16 +03:00
Vasily Levchenko 3a738b2ad3 arithmetic test 2016-10-11 11:41:37 +03:00
Vasily Levchenko b038dbc724 arithmetic added (minus, mul, div, mod) 2016-10-11 11:41:37 +03:00
Vasily Levchenko 97e31820ae inter-procedural call test 2016-10-11 11:24:47 +03:00
Vasily Levchenko 390edc146d interprocedural call implementation 2016-10-11 11:24:47 +03:00
Vasily Levchenko 31c022f0a6 g/c: cosmetic some clean up 2016-10-11 11:21:56 +03:00
Vasily Levchenko ce10b5fb15 fix run command 2016-10-10 17:25:24 +03:00
Vasily Levchenko 4c32689e1f unit test introduced:
User should create <test-name>-test.c file in the following manner:
> cat codegen/function/sum-test.c
extern void *resolve_symbol(const char*);

int
run_test() {
  int (*sum)(int, int) = resolve_symbol("kfun:sum");

  if (sum(2, 3) != 5) return 1;

  return 0;
}
and add <test-name> to the TESTS variable in the Makefile
to run tests:
> make clean run
Note: failing tests should return no zero values.
2016-10-10 15:11:55 +03:00
Vasily Levchenko dbdbc9a844 Base level translator: it could compile primitive functions with arithmetic operations:
note: operations are hardcoded e.g. operato plus resolved in corresponding instruction.

fun sum(a:Int, b:Int) = a + b

produces following code:
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.12.0"

define i32 @"kfun:sum"(i32, i32) {
entry:
  %a = alloca i32
  store i32 %0, i32* %a
  %b = alloca i32
  store i32 %1, i32* %b
  %tmp1 = load i32, i32* %a
  %tmp2 = load i32, i32* %b
  %tmp0 = add i32 %tmp1, %tmp2
  ret i32 %tmp0
}

Note: this code is optimizable with -mem2reg
> opt-mp-3.8 -mem2reg sum.BCkt -o - | llvm-dis-mp-3.8 -o -
; ModuleID = '<stdin>'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.12.0"

define i32 @"kfun:sum"(i32, i32) {
entry:
  %tmp0 = add i32 %0, %1
  ret i32 %tmp0
}
2016-10-10 15:11:55 +03:00
Vasily Levchenko bbe86f25bc hardcoded (temporary) path to extensions/common.xml, to fix fall on unresolved symbols 2016-10-07 17:17:53 +03:00
Vasily Levchenko 8c2a620c06 kotlin-ir: sync 2016-10-07 09:49:57 +03:00
Vasily Levchenko 75aaed1d07 kotlin-ir: sync 2016-10-05 20:52:25 +03:00
Nikolay Igotti 3a9d013c96 Typo. 2016-10-05 19:18:12 +03:00
Nikolay Igotti 488ca7170b Try to fix empty Linux lib problem. 2016-10-05 19:14:59 +03:00
Vasily Levchenko 71da52456e linux build fix: on linux we need to set LD_LIBRARY_PATH to launch jvm with native dependency to llvm 2016-10-05 16:19:54 +03:00
Svyatoslav Scherbina 38d0000242 backend.native: simplify build.gradle by making it more idiomatic 2016-10-05 08:28:47 +03:00
Vasily Levchenko deec80499c attempt to build linux build on team city.
it fails with message about missing noexecstack on load our library
2016-10-05 00:49:55 +03:00
Svyatoslav Scherbina e464989b1b backend.native: simplify build.gradle after improving Interop plugin 2016-10-04 16:32:15 +03:00