tests now can use runtime infrostructure
This commit is contained in:
@@ -4,7 +4,7 @@ TESTS := sum \
|
|||||||
|
|
||||||
BIN_TESTS=$(foreach t, ${TESTS},${t}_test)
|
BIN_TESTS=$(foreach t, ${TESTS},${t}_test)
|
||||||
|
|
||||||
VPATH=codegen/function
|
VPATH=codegen/function:${TOP}/runtime/build
|
||||||
|
|
||||||
LLC=llc-mp-3.8
|
LLC=llc-mp-3.8
|
||||||
CC=clang-mp-3.8
|
CC=clang-mp-3.8
|
||||||
@@ -19,7 +19,7 @@ KOTLIN_NATIVE_CLASSPATH=${BACKEND_CLASSES}/bc_frontend:${BACKEND_CLASSES}/cli_bc
|
|||||||
|
|
||||||
|
|
||||||
define PROTO
|
define PROTO
|
||||||
$(1)_test: main.c $1-test.c $1.S
|
$(1)_test: $1-test.c $1.S runtime.S main.c
|
||||||
$(CC) -o $$@ $$^
|
$(CC) -o $$@ $$^
|
||||||
|
|
||||||
${1}_run:${1}_test
|
${1}_run:${1}_test
|
||||||
@@ -35,6 +35,8 @@ run:$(foreach test,${TESTS},${test}_run)
|
|||||||
clean:
|
clean:
|
||||||
${RM} *.o *.S *.BCkt ${BIN_TESTS}
|
${RM} *.o *.S *.BCkt ${BIN_TESTS}
|
||||||
|
|
||||||
|
%.S:%.bc
|
||||||
|
${LLC} -o $@ $<
|
||||||
|
|
||||||
%.S:%.BCkt
|
%.S:%.BCkt
|
||||||
${LLC} -o $@ $<
|
${LLC} -o $@ $<
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
/**
|
/**
|
||||||
* > llc-mp-3.8 b.out -o b.S
|
* > llc-mp-3.8 b.out -o b.S
|
||||||
@@ -14,6 +15,24 @@ void * resolve_symbol(char *name) {
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main() {
|
kotlinNativeMain() {
|
||||||
return run_test();
|
return run_test();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ktype_kotlin_any asm("_ktype:kotlin.Any");
|
||||||
|
|
||||||
|
#define DEFINE(name, symbol) int name() asm(#symbol);
|
||||||
|
#define DECLARE(name) \
|
||||||
|
int \
|
||||||
|
name() { \
|
||||||
|
abort(); \
|
||||||
|
return 1; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DEFINE_AND_DECLARE(name, sym) \
|
||||||
|
DEFINE(name, sym) \
|
||||||
|
DECLARE(name)
|
||||||
|
|
||||||
|
DEFINE_AND_DECLARE(kfun_kotlin_any_to_string,_kfun:kotlin.Any.toString)
|
||||||
|
DEFINE_AND_DECLARE(kfun_kotlin_any_hash_code,_kfun:kotlin.Any.hashCode)
|
||||||
|
DEFINE_AND_DECLARE(kfun_kotlin_any_equals,_kfun:kotlin.Any.equals)
|
||||||
|
|||||||
Reference in New Issue
Block a user