Leonardo de Moura
3770df2a48
fix(runtime/apply): must use free_heap_obj instead of free
2018-08-28 12:29:14 -07:00
Leonardo de Moura
5c3678482f
chore(runtime/object): cleanup
2018-08-28 12:29:04 -07:00
Leonardo de Moura
3e528a9b67
chore(runtime): fix assertions
2018-08-28 10:33:22 -07:00
Leonardo de Moura
4d6da3dd69
fix(runtime/compact): bug at read
2018-08-28 10:30:51 -07:00
Leonardo de Moura
b63b05e5fd
fix(runtime/thread): MULTI_THREAD=OFF build
2018-08-28 08:08:55 -07:00
Leonardo de Moura
030669ea4d
feat(runtime): do not waste space with RC for region and stack allocated objects
...
The modification introduces an overhead of 1.5% on the
execution time. Here is the the time for compiling the corelib
Before: 8.61 secs (avg of 3 runs)
After: 8.74 secs (avg of 3 runs)
On the other hand, the size of the compacted region for the command
`#compact_tst 10` is smaller.
Before: 176687728
After: 153794704
The size before this change was 14.8% bigger.
For reference, using the old serializer we generate a buffer of size 105291117.
cc @kha
2018-08-28 07:41:55 -07:00
Leonardo de Moura
fdcbf3fe9e
chore(runtime/object): "section comments"
2018-08-22 17:53:11 -07:00
Leonardo de Moura
3ab1ebcb3f
feat(init/core): add task
2018-08-21 16:10:07 -07:00
Leonardo de Moura
0b349f1abf
chore(*): fix style
2018-08-21 09:32:01 -07:00
Leonardo de Moura
38b23431a3
chore(runtime/compact): add inline
2018-08-20 15:30:21 -07:00
Leonardo de Moura
7f9d131a1f
chore(runtime/compact): one alloc per object
2018-08-20 14:46:06 -07:00
Leonardo de Moura
474a0c40c7
fix(runtime/compact): missing memcpy
2018-08-20 10:33:04 -07:00
Leonardo de Moura
dc1f5c0aa6
feat(runtime/object): task API functions can take thunks as arguments
2018-08-20 09:13:35 -07:00
Leonardo de Moura
a27aa53e88
refactor(runtime/compact): save task objects as thunks
...
TODO: modify task API and make sure all functions there can take thunks
instead of tasks as arguments.
2018-08-20 08:52:35 -07:00
Leonardo de Moura
db98397cc0
feat(runtime): object compactor
...
We need more testing and performance testing.
We also need to compare serializer and compacted_region.
2018-08-19 17:10:18 -07:00
Leonardo de Moura
ce504b4c21
feat(runtime/serializer): support for tasks
2018-08-18 14:52:29 -07:00
Leonardo de Moura
684085d93f
refactor(runtime/object): delete data needed to execute task after it finishes
2018-08-18 14:33:27 -07:00
Leonardo de Moura
a0b5502821
fix(runtime/object): memory leak and simplify task_object
...
We remove per task condition_variable and use m_task_finished_cv.
The same condition_variable used to implement `wait_any`.
2018-08-18 10:29:12 -07:00
Leonardo de Moura
d0bc663f0d
chore(runtime/object): avoid ugly handle_finished_rec
...
Users should not rely on the order the dependencies have beed inserted.
If the order matters, priorities should be used instead.
2018-08-17 18:15:58 -07:00
Leonardo de Moura
d52507c4b2
fix(runtime/object): memory leak
2018-08-17 18:12:17 -07:00
Leonardo de Moura
861592fe6a
chore(runtime/object): cleanup
2018-08-17 15:43:01 -07:00
Leonardo de Moura
4bc8414d2b
feat(runtime/object): use "weak pointers" in the task manager, and interrupt tasks at GC time
2018-08-17 15:35:00 -07:00
Leonardo de Moura
24444d65c4
refactor(runtime/object): do not use Lean runtime lists to implement the reverse dependency list in task objects
2018-08-17 14:42:43 -07:00
Leonardo de Moura
1d5411f455
feat(runtime/object): add support for io.wait_any
2018-08-17 13:04:06 -07:00
Leonardo de Moura
5f78087b08
feat(runtime/object): add support for io.has_finished
2018-08-17 12:36:48 -07:00
Leonardo de Moura
5e63e7806c
chore(runtime/object): cleanup
2018-08-17 12:32:47 -07:00
Leonardo de Moura
ae9eac6781
feat(runtime/object): simplify and more tests
2018-08-17 09:41:22 -07:00
Leonardo de Moura
c863e86429
feat(runtime/object): primitives for interrupting threads
2018-08-17 09:25:40 -07:00
Leonardo de Moura
0a2e9c109f
fix(runtime/object): memory leak and violation at task_bind
2018-08-17 09:03:45 -07:00
Leonardo de Moura
f5ecd8477f
fix(runtime/object): memory leak
2018-08-17 08:47:29 -07:00
Leonardo de Moura
168eaefff5
fix(runtime/object): finalization and avoid leak
2018-08-17 08:32:33 -07:00
Leonardo de Moura
cc13c8ee7f
refactor(runtime/object): remove unnecessary, fix malloc/delete mismatch
2018-08-17 08:10:05 -07:00
Leonardo de Moura
018542e2e1
fix(runtime/object): task bugs
2018-08-16 21:28:58 -07:00
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