Commit graph

45 commits

Author SHA1 Message Date
Leonardo de Moura
afd54039ab chore(library): remove >>, we should use *> 2018-09-12 17:31:21 -07:00
Leonardo de Moura
9e305a5f26 chore(library): remove return, we should use pure 2018-09-12 16:51:11 -07:00
Leonardo de Moura
b78e9df869 chore(runtime/object): tag => obj_tag
`tag` at `object.h` conflicts with `tag` at `expr.h`
2018-05-20 12:00:59 -07:00
Leonardo de Moura
2944f7a027 chore(runtime): lean_obj.* ==> object.* 2018-05-20 10:17:15 -07:00
Leonardo de Moura
2d604e7d25 chore(runtime/lean_obj): remove lean_ prefix 2018-05-20 10:13:44 -07:00
Leonardo de Moura
acdcbdb71e feat(library/init/lean/ir): add instructions for (big) integer arithmetic 2018-05-17 18:17:23 -07:00
Leonardo de Moura
5d8501acf5 chore(runtime/lean_obj): consistent naming convention 2018-05-17 16:45:27 -07:00
Leonardo de Moura
af1a5fe874 feat(library/init/lean/ir): add x : ty := y instruction
It is useful when we are not producing IR in SSA.
2018-05-17 15:44:13 -07:00
Leonardo de Moura
dede61b122 feat(library/init/lean/ir): add tag and tag_ref instructions 2018-05-17 14:51:41 -07:00
Leonardo de Moura
5d53eccb59 feat(runtime): string support 2018-05-17 13:11:47 -07:00
Leonardo de Moura
53d459911f refactor(library/init/lean/ir): RC instructions 2018-05-16 10:28:51 -07:00
Leonardo de Moura
8cb7511a91 feat(runtime/lean_obj): natural number support 2018-05-16 10:28:51 -07:00
Leonardo de Moura
ade8cb7296 chore(library/init/lean/ir): make it clear that big number may be a tagged pointer 2018-05-15 15:58:58 -07:00
Leonardo de Moura
6e1a64a3ed fix(library/init/lean/ir): change semantics of big number operations
Remark: only `inc`, `dec` and `decs` should modify the reference counters.
2018-05-15 15:52:54 -07:00
Leonardo de Moura
cf36d8b08e refactor(library/init/lean/ir): rename ir.instr constructors 2018-05-15 14:48:12 -07:00
Leonardo de Moura
272f80c799 feat(library/init/lean/ir): add string_push and string_append instructions 2018-05-15 14:27:10 -07:00
Leonardo de Moura
74767df5ff feat(library/init/lean/ir/extract_cpp): add initialize_prefix and finalize_prefix 2018-05-15 14:09:38 -07:00
Leonardo de Moura
0f2a8f09c2 chore(library/init/lean/ir): cleanup 2018-05-15 12:09:04 -07:00
Leonardo de Moura
5cfb442f2c feat(library/init/lean/ir): add compilation unit initializer/finalizer 2018-05-15 11:57:53 -07:00
Leonardo de Moura
59f9de720d feat(library/init/lean/ir/lirc): we should support only C external names without mangling 2018-05-14 16:32:18 -07:00
Leonardo de Moura
aa1006d01b feat(library/init/lean/ir/extract_cpp): generate libleanruntime.a 2018-05-14 14:34:10 -07:00
Leonardo de Moura
31ce1a23e7 fix(library/init/lean/ir/extract_cpp): add support for bignum literals 2018-05-14 11:12:49 -07:00
Leonardo de Moura
37201b9192 feat(library/init/lean/ir/extract_cpp): add emit_closure 2018-05-14 09:53:45 -07:00
Leonardo de Moura
ba76d86a38 feat(library/init/lean/ir/extract_cpp): add emit_app, fix assignment 2018-05-14 09:28:17 -07:00
Leonardo de Moura
11270591ff fix(library/init/lean/ir/extract_cpp): missing case at collect_used 2018-05-13 14:49:57 -07:00
Leonardo de Moura
12854dc944 feat(library/init/lean/ir/extract_cpp): include uncurry 2018-05-13 14:47:54 -07:00
Leonardo de Moura
344de0e42e feat(library/init/lean/ir/extract_cpp): emit header of all functions used in a compilation unit 2018-05-13 14:40:52 -07:00
Leonardo de Moura
8b0a35fa5d feat(library/init/lean/ir/extract_cpp): add uncurry for functions with many arguments 2018-05-13 13:28:18 -07:00
Leonardo de Moura
1039951b09 fix(library/init/lean/ir/extract_cpp): typo 2018-05-13 10:33:56 -07:00
Leonardo de Moura
224fdc7a78 refactor(library/init/lean/ir): platform dependent IR
Motivation: in 64-bit machines, we can store boxed uint32 values as a
tagged pointer. In 32-bit machines, we need to allocated an object (like
Haskell) to store the uint32 value. So, the generated bytecode is quite
different in each platform.

This change also allow us to simplify the IR. Example: we don't need the
type `sizet` anymore.

Impact: To be able to bootstrap in both platforms,
we will have to store two versions of the generated code: 32 and 64
versions. In principle, we only need to store the 64-bit version,
and use cross-compilation to build the 32-bit version.
2018-05-10 13:15:02 -07:00
Leonardo de Moura
552ca3bb11 feat(library/init/lean/ir): allow uint32 in case instruction 2018-05-10 12:56:55 -07:00
Leonardo de Moura
ad61772c72 feat(library/init/lean/ir): add is_null
We will use this instruction for compiling inductive datatypes such as
`option A` where `A` is represented as an `object`.
In this case, we can represent `some a` as `a` (without any extra memory
allocation), and `none` as the null pointer.
2018-05-10 12:47:44 -07:00
Leonardo de Moura
aba3d08372 fix(library/init/lean/ir/extract_cpp): minor fixes 2018-05-10 10:54:43 -07:00
Leonardo de Moura
9a261975f7 chore(library/init/lean/ir/extract_cpp): cleanup 2018-05-10 10:28:30 -07:00
Leonardo de Moura
e882d9d7cf feat(library/init/lean/ir): add array_size, sarray_size and string_len 2018-05-10 10:02:16 -07:00
Leonardo de Moura
68458aa97b refactor(library/init/lean/ir): array operations 2018-05-10 09:52:00 -07:00
Leonardo de Moura
4862da3fca feat(library/init/lean/ir): add array_pop and sarray_pop 2018-05-10 09:24:48 -07:00
Leonardo de Moura
f1535121b9 refactor(library/init/lean/ir): combine unary instructions 2018-05-10 09:19:13 -07:00
Leonardo de Moura
655cfbf3b0 refactor(library/init/lean/ir): read and sread instructions are now binop 2018-05-10 08:47:16 -07:00
Leonardo de Moura
7b89a8c910 chore(library/init/lean/ir): copy_array ==> array_copy, copy_sarray ==> sarray_copy 2018-05-10 08:36:33 -07:00
Leonardo de Moura
d2c4918ca3 chore(library/init/lean/ir): shared ==> is_shared, scalar ==> is_scalar 2018-05-10 08:30:28 -07:00
Leonardo de Moura
2e0629133f feat(library/init/lean/ir): add emit_lit 2018-05-09 18:29:54 -07:00
Leonardo de Moura
fc840eab3f feat(library/init/lean/ir): add emit_unop 2018-05-09 18:20:46 -07:00
Leonardo de Moura
c7153f7661 chore(library/init/lean/ir/extract_cpp): cleanup 2018-05-09 18:03:00 -07:00
Leonardo de Moura
9345765815 feat(library/init/lean/ir/extract_cpp): start IR => C++ extractor 2018-05-09 17:47:55 -07:00