Commit graph

18 commits

Author SHA1 Message Date
Mac Malone
79838834c1
refactor: port shell option processing to Lean (v2) (#11434)
This PR moves the processing of options passed to the CLI from
`shell.cpp` to `Shell.lean`.

As with previous ports, this attempts to mirror as much of the original
behavior as possible, Benefits to be gained from the ported code can
come in later PRs. There should be no significant behavioral changes
from this port. Nonetheless, error reporting has changed some, hopefully
for the better. For instance, errors for improper argument
configurations has been made more consistent (e.g., Lean will now error
if numeric arguments fall outside the expected range for an option).

(Redo of #11345 to fix Windows issue.)
2025-12-02 17:41:51 +00:00
Sebastian Ullrich
3772bb8685
chore: revert "refactor: port shell option processing to Lean" (#11378)
Needs a fix to unbreak the Windows build first.

Reverts leanprover/lean4#11345
2025-11-26 09:28:48 +00:00
Mac Malone
e1f8c147e7
refactor: port shell option processing to Lean (#11345)
This PR moves the processing of options passed to the CLI from
`shell.cpp` to `Shell.lean`.

As with previous ports, this attempts to mirror as much of the original
behavior as possible, Benefits to be gained from the ported code can
come in later PRs. There should be no significant behavioral changes
from this port. Nonetheless, error reporting has changed some, hopefully
for the better. For instance, errors for improper argument
configurations has been made more consistent (e.g., Lean will now error
if numeric arguments fall outside the expected range for an option).
2025-11-25 23:39:31 +00:00
Henrik Böving
50cfe354be
chore: remove old LEAN_AUTO_THREAD_FINALIZATION workaround (#8885)
This PR removes an old workaround around non-implemented C++11 features
in the thread finalization.

This `ifdef` dates back to approximately 2015 as can be seen
[here](https://github.com/leanprover/lean3/blame/master/src/util/thread.cpp#L177),
the comments mention that it was originally implemented because not all
compilers at the time were able to support the C++11 `thread_local`
keyword. 10 years later this is hopefully the case and we can remove
this workaround.

There is an additional motivation for doing this,
`lean::initialize_thread` contains the following allocation:
```cpp
    g_thread_finalizers_mgr = new thread_finalizers_manager;
```
this is supposed to be freed at some point but:
```cpp
// TODO(gabriel): race condition with thread finalizers
void delete_thread_finalizer_manager() {
    // delete g_thread_finalizers_mgr;
    // g_thread_finalizers_mgr = nullptr;
}
```
so `g_thread_finalizers_mgr` leaks upon repeated invocation of
`lean::initialize_thread`.

Note that Windows has already been using this alternative implementation
for a while so the alternative implementation has (hopefully) not rotten
away in the meantime.
2025-06-20 08:52:17 +00:00
Sebastian Ullrich
87d41e6326
chore: missing include on Windows (#4919) 2024-08-05 15:50:43 +00:00
Sebastian Ullrich
3921257ece
feat: thread initialization for reverse FFI (#3632)
Makes it possible to properly allocate and free thread-local runtime
resources for threads not started by Lean itself
2024-03-07 17:02:47 +00:00
Leonardo de Moura
c8406a301d chore: reduce src/include/lean 2021-09-07 08:24:54 -07:00
Sebastian Ullrich
9dffc61e27 fix: free lthread resources on Windows 2020-09-29 08:01:10 -07:00
Leonardo de Moura
2f1ec93289 chore: move runtime implementation to src/runtime 2020-05-22 14:35:16 -07:00
Leonardo de Moura
1a77ee4f89 chore: delete old runtime directory 2020-05-18 11:33:18 -07:00
Leonardo de Moura
8bdca35282 chore: use #include <lean/runtime/...> for runtime .h files 2020-05-18 11:30:07 -07:00
Sebastian Ullrich
9fdcf6ea59 refactor: put all includes in include/lean/ 2020-05-18 11:00:26 -07:00
Sebastian Ullrich
5107403d24 feat: detect stack overflows on all platforms and threads 2020-05-04 11:11:11 +02:00
Leonardo de Moura
00af75accf chore: style
fix nonsense
2019-10-29 14:50:22 -07:00
Leonardo de Moura
4b7b95cd76 fix: missing file
LEAN_SMALL_ALLOCATOR is defined at `config.h`
2019-10-29 14:48:02 -07:00
Sebastian Ullrich
90b91760aa fix: SMALL_ALLOCATOR=OFF 2019-10-29 13:41:16 -07:00
Leonardo de Moura
5c7849a869 feat(runtime): eager heap initialization 2019-04-25 18:10:36 -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
Renamed from src/util/thread.cpp (Browse further)