Commit Graph

904 Commits

Author SHA1 Message Date
Svyatoslav Scherbina bd449b2ac3 Interop/Runtime: properly initialize ffi_type for structs 2016-10-14 16:28:14 +03:00
Svyatoslav Scherbina b4db26f846 Interop/Runtime: do not reuse JNI local ref globally 2016-10-14 16:28:14 +03:00
Nikolay Igotti 6f43e7befd Fetch IR branch. 2016-10-14 14:25:33 +03:00
Nikolay Igotti 6ccdc02633 Merge pull request #7 from JetBrains/rt_exceptions
Add basic exception supports and tagged refcounting.
2016-10-14 12:30:13 +03:00
Nikolay Igotti 5bbb5a4d13 Comment on race for shared containers, added fourth type for container. 2016-10-14 12:15:53 +03:00
Nikolay Igotti 90a09ca356 Use proper PC. 2016-10-14 11:20:22 +03:00
Nikolay Igotti 5786f5a2af Add basic exception supports and tagged refcounting. 2016-10-14 11:10:19 +03:00
SvyatoslavScherbina 25c5349004 Merge pull request #6 from JetBrains/runtime-code-in-compiler
Import some runtime code to compiler using interop
2016-10-13 18:15:49 +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 f30c840d1c runtime: move hash functions to newly created subproject
to reuse in compiler
2016-10-13 17:29:02 +03:00
Svyatoslav Scherbina 2f004edff7 Interop: fix minor bug in Indexer
handle empty compiler args
2016-10-13 17:29:02 +03:00
Svyatoslav Scherbina d00d3daf86 Interop: support passing linker as arg to stub generator 2016-10-13 17:29:02 +03:00
Svyatoslav Scherbina d800e193e8 runtime/build.gradle: extract bitcode compilation to custom task class 2016-10-13 17:29:01 +03:00
Nikolay Igotti abc98983e1 Add FFI libs for ports. 2016-10-13 17:19:03 +03:00
SvyatoslavScherbina 0707285fa4 Merge pull request #5 from JetBrains/interop-as-dependency
Represent Interop as dependency in Gradle plugin
2016-10-13 16:41:22 +03:00
Nikolay Igotti ed53aceaa5 Minor fixes. 2016-10-13 15:10:54 +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 fc5c7ac6df Interop: support linking with libs from the same build 2016-10-13 13:10:44 +03:00
Svyatoslav Scherbina 1316aee069 Interop: add LD_LIBRARY_PATH to stub generation task 2016-10-13 13:10:20 +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
SvyatoslavScherbina 3e89a3eec7 Merge pull request #2 from JetBrains/interop-callbacks-1
Support callbacks in interop
2016-10-11 17:18:49 +03:00
Nikolay Igotti 86423f381d Fix InteropExample on Linux. 2016-10-11 17:10:29 +03:00
Nikolay Igotti fb61896825 Add memory mgmt. 2016-10-11 13:25:11 +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
vvlevchenko 6d2788b6a8 Merge pull request #3 from JetBrains/rr/interfunctional-call-proposal
inter-procedural call proposal
2016-10-11 11:26:55 +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
Svyatoslav Scherbina 98a0e86646 Interop/Runtime: fix building on Linux
use correct libffi*.a variant
2016-10-11 10:57:29 +03:00
Svyatoslav Scherbina 373bf3bef9 Interop: improve by using callbacks in Indexer 2016-10-10 18:41:59 +03:00
Svyatoslav Scherbina af09ce085c Interop: implement callbacks using libffi 2016-10-10 18:41:59 +03:00
Vasily Levchenko ce10b5fb15 fix run command 2016-10-10 17:25:24 +03:00
vvlevchenko f80d0504cf Merge pull request #1 from JetBrains/rr/translation-prototype
naive sum translation
2016-10-10 17:14:17 +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
Svyatoslav Scherbina 436a950c65 InteropExample: use global kotlin_version 2016-10-10 11:10:58 +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
Nikolay Igotti a95aa29075 Add libffi for iOS submodule. 2016-10-07 14:14:00 +03:00
Nikolay Igotti a2250955b9 Add iOS scripts. 2016-10-07 14:08:01 +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