Leonardo de Moura
066fbf2d5b
refactor(runtime/object): remove state field
2018-08-16 20:46:14 -07:00
Leonardo de Moura
584eddee01
feat(runtime/object): add support for tasks
...
This is just the first draft. We still need a lot of testing.
2018-08-16 19:09:50 -07:00
Leonardo de Moura
d14831c470
fix(runtime/apply): apply should use the standard calling convention
2018-08-15 21:07:54 -07:00
Leonardo de Moura
c3be026645
chore(runtime/object): document calling convention for runtime primitives
2018-08-15 20:10:43 -07:00
Leonardo de Moura
74d94432da
fix(runtime/object): make thunk_get thread safe
2018-08-15 15:34:15 -07:00
Leonardo de Moura
4ec43a84ca
chore(runtime/object): document standard/borrowed calling convetion
2018-08-14 17:43:00 -07:00
Leonardo de Moura
bcb37ef862
feat(runtime): thunk serialization
2018-08-14 15:15:12 -07:00
Leonardo de Moura
f036a7ad16
chore(runtime/object): mk_thunk(c) should not modify c's RC
...
This is useful when we are generating a function that does not use the
"borrow semantics" for an argument `c` which is used in `mk_thunk(c)`.
2018-08-10 18:11:29 -07:00
Leonardo de Moura
6eb598268d
chore(runtime/object): naming convention
...
`dec_ref` methods assume the input object is *not* a scalar
2018-08-10 18:11:29 -07:00
Leonardo de Moura
ea8e1075d2
feat(runtime/thunk): add runtime support for thunks
...
We did not use constructor objects for implementing thunks because we
wanted to use `atomic<object *>` to implement the cached result.
2018-08-10 18:11:29 -07:00
Leonardo de Moura
01ea596aea
refactor(kernel/expr): implement expr using runtime/object
2018-06-21 16:05:33 -07:00
Leonardo de Moura
9a46fb51cd
perf(runtime/object): use memcmp to implement string_lt
...
The encoding of unicode scalars into UTF8 byte stream is order
preserving. So, we can use `std::memcmp` to compare strings
2018-06-21 09:54:46 -07:00
Leonardo de Moura
13c532d0d4
fix(*): truncation bugs
...
- Lean strings (like std::string) may contain null characters. The
codebase was ignoring this issue.
- We now have a wrapper `string_ref` for wrapping Lean string objects in
C++. This wrapper also implements correctly the coercions std::string <-> string_ref.
Remark: I also found a few places where the code relies on the
following property which is not true
Forall s : std::string, std::string(s.c_str()) == s
- `name` object wrapper was assuming that all numerals were small
`nat` values. This is true in most cases, but the system would
crash when processing if it is a big number.
- The commit tries to make sure runtime/util/kernel are correct.
Modules that will be deleted contain many `TODO` comments
indicating they may crash and/or produce incorrect results
when strings contain null characters and numerals are big.
cc @kha
@kha: I thought about using `string` instead of `string_ref`.
We consistently use `std::string`. So, it should be fine, but I
was concerned about code readability.
After we bootstrap Lean4, we will be able to delete `lean::list`
template, and rename `lean::list_ref` to `lean::list`.
I am going to add `pair_ref` for wrapping Lean pair objects.
If we use `lean::string` instead of `lean::string_ref`, then
we should also use `lean::pair` instead of `lean::pair_ref`.
But, there is a problem in this case since we have
https://github.com/leanprover/lean4/blob/master/src/util/pair.h#L13
:(
2018-06-15 16:05:11 -07:00
Leonardo de Moura
fe2d416cde
fix(runtime,util,kernel): should not use strcmp to compare Lean string objects
...
Reason:
- UTF8 encoding
- Lean strings may contain null char. That is, null char is not an end
of string delimiter like in C. Lean string objects are similar to std::string
2018-06-15 16:05:11 -07:00
Leonardo de Moura
7512d1996e
feat(runtime): add string_eq and string_ne
2018-06-13 11:42:57 -07:00
Leonardo de Moura
e90585737f
refactor(*): use C++11 std::current_exception and std::rethrow_exception
...
With these new C++11 APIs, we can delete the `clone` and `rethrow`
methods from our exception classes.
2018-06-07 16:28:54 -07:00
Leonardo de Moura
909284dd74
refactor(runtime): normlize object names
2018-06-01 15:34:42 -07:00
Leonardo de Moura
14d62ab12d
chore(runtime/serializer): compilation warning
2018-05-29 08:04:42 -07:00
Leonardo de Moura
b66a088b52
fix(runtime/serializer): memory leak
2018-05-23 09:52:20 -07:00
Leonardo de Moura
480d999e63
fix(runtime/object): bugs at string_append and string_push
2018-05-22 17:51:51 -07:00
Leonardo de Moura
7afa418e13
chore(runtime/serializer): style
2018-05-22 17:43:23 -07:00
Leonardo de Moura
339764bf6a
refactor(runtime): add string_object
...
The idea is to avoid the hack for storing the string unicode length.
It also reduces the amount of space used to serialize strings.
2018-05-22 17:28:04 -07:00
Leonardo de Moura
fb00f9a780
fix(runtime/object): missing free
2018-05-22 16:50:07 -07:00
Leonardo de Moura
b2f3d3f456
chore(*): remove redundant code
2018-05-22 16:46:04 -07:00
Leonardo de Moura
5b17a30203
feat(runtime): add object serializer
...
Any type implemented on top of `object` gets the serializer/deserializer for free
2018-05-22 16:34:41 -07:00
Leonardo de Moura
abf9d8fe37
fix(runtime/object): assertion violation
2018-05-20 13:51:31 -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
e081f9ad78
chore(runtime/lean_obj): cleanup
2018-05-20 10:02:19 -07:00
Leonardo de Moura
fde4e15cb4
fix(runtime/lean_obj): OSX issue
2018-05-20 08:18:03 -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
dfc5adbd2a
feat(runtime/lean_obj): add integer primitives
2018-05-17 17:47:22 -07:00
Leonardo de Moura
0aadb27327
perf(runtime/lean_obj): improve nat comparison
2018-05-17 17:41:03 -07:00
Leonardo de Moura
b4fb4385a2
fix(runtime/lean_obj): test
2018-05-17 17:14:24 -07:00
Leonardo de Moura
5d8501acf5
chore(runtime/lean_obj): consistent naming convention
2018-05-17 16:45:27 -07:00
Leonardo de Moura
a4583e23ea
chore(gen/apply): fix bogus style warning
2018-05-17 16:09:20 -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
74b7ae0734
fix(runtime/apply): the trick to avoid alloca is not thread safe
2018-05-17 13:34:00 -07:00
Leonardo de Moura
aadb5a8481
chore(runtime/lean_obj): missing primitives
2018-05-17 13:11:47 -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
3708a22484
feat(runtime/lean_obj): add lean_dbg_print_num
2018-05-15 11:57:53 -07:00
Leonardo de Moura
b1d8a17f1b
fix(runtime): add init_module
2018-05-14 20:38:21 -07:00
Leonardo de Moura
168e7fa0cd
chore(runtime/lean_obj): style
2018-05-14 17:27:25 -07:00
Leonardo de Moura
8ee2f4fea1
feat(*): basic runtime string support
2018-05-14 16:52:55 -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
0556412f8d
refactor(*): add runtime folder
...
@kha The runtime folder includes what is needed to link a
standalone Lean program. It is still contains some unnecessary files.
We will be able to remove them after we release Lean4.
2018-05-14 14:23:56 -07:00
Leonardo de Moura
1590807762
chore(src/runtime/cpp): remove cpp runtime, we are going to use library/vm instead
2016-06-25 13:15:40 -07:00