Commit graph

46 commits

Author SHA1 Message Date
Leonardo de Moura
46d6f7bfb5 chore(runtime/object): store function pointer as void * inside closure 2018-09-11 14:27:45 -07:00
Leonardo de Moura
5bc9b07ab9 feat(runtime/object): split Heap into MTHeap and STHeap 2018-09-09 14:46:28 -07:00
Leonardo de Moura
0573d7e1d5 fix(runtime/object): parray RC bugs 2018-09-09 12:04:27 -07:00
Leonardo de Moura
b45ac3fcc0 chore(runtime/object): minor 2018-09-09 10:59:36 -07:00
Leonardo de Moura
36423e4389 fix(runtime): parray memory leaks 2018-09-09 10:33:15 -07:00
Leonardo de Moura
4863ca071a chore(runtime): make sure we use the same naming convention for getters and setters 2018-09-09 10:07:00 -07:00
Leonardo de Moura
8f195515a6 feat(runtime): add persistent arrays to runtime 2018-09-09 09:44:38 -07:00
Leonardo de Moura
3e528a9b67 chore(runtime): fix assertions 2018-08-28 10:33:22 -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
dc1f5c0aa6 feat(runtime/object): task API functions can take thunks as arguments 2018-08-20 09:13: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
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
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
bcb37ef862 feat(runtime): thunk serialization 2018-08-14 15:15:12 -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
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
909284dd74 refactor(runtime): normlize object names 2018-06-01 15:34:42 -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
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
2944f7a027 chore(runtime): lean_obj.* ==> object.* 2018-05-20 10:17:15 -07:00
Renamed from src/runtime/lean_obj.cpp (Browse further)