Leonardo de Moura
addbb8dd67
fix: redirect
...
@cipher1024 I modified your fix. It would produce memory leaks if the
code executed by #eval modifies the stdout.
Here is the problem.
- Your replaces the handler with some new handler `H` and stores the
old handler `O` in a `flet`.
- Code is executed and replaces the stdout handler with `H'`. The `H`s RC is
decremented and `H'`s RC is incremeneted. So far, so good.
- Now, the destructor of your `flet` is executed, and it replaces `H'`
with `O`, but `H'` RC is not decremented.
2020-01-23 15:58:34 -08:00
Simon Hudon
123577126c
fix: #eval redirection of stdout
2020-01-23 15:44:49 -08:00
Simon Hudon
961861ceab
fix: thread local storage of std streams
2020-01-19 17:23:24 -08:00
Simon Hudon
bd87ea5d5e
feat: override standard streams
2020-01-19 17:23:12 -08:00
Simon Hudon
7575a32035
feat: add std streams
...
This reverts commit 021ce21d5f70c2efcc58a0588ed6dc4999be6a33.
2020-01-19 17:22:58 -08:00
Simon Hudon
6d8927da10
fix: little details
2020-01-12 08:02:48 -08:00
Simon Hudon
92c8773137
feat: file IO using handles
2020-01-12 08:02:48 -08:00
Leonardo de Moura
48578c9743
chore: remove hacks
2020-01-08 21:09:17 -08:00
Leonardo de Moura
981e35b6da
chore: style
2020-01-08 21:09:17 -08:00
Leonardo de Moura
4550e75dcb
chore: temporary hack for solving staging issue
2020-01-08 21:09:17 -08:00
Leonardo de Moura
01c5b0710c
feat: pointer equality for IO.ref
2020-01-08 21:09:17 -08:00
Sebastian Ullrich
ae3b3bb825
chore: remove cygwin support
2019-11-12 08:28:58 -08:00
Sebastian Ullrich
d8bb4df96f
chore: revert "chore: add std::cout.flush"
...
This reverts commit a43a225013 .
2019-11-06 10:13:39 -08:00
Leonardo de Moura
a43a225013
chore: add std::cout.flush
...
cc @kha
2019-10-29 11:07:22 -07:00
Leonardo de Moura
745367a4ed
fix: remove irrelevant arguments
2019-10-23 16:51:09 -07:00
Leonardo de Moura
30571f12d4
chore: adjust runtime to new EState
2019-10-21 17:05:16 -07:00
Leonardo de Moura
10760d3eb2
chore: try (to fix) Windows build
2019-10-06 18:55:32 -07:00
Leonardo de Moura
afc5352360
chore: fix style
2019-10-04 21:16:37 -07:00
Leonardo de Moura
a4c7e597a8
chore: (try to) fix Windows build
2019-10-04 20:52:54 -07:00
Leonardo de Moura
dcd15f3424
refactor(runtime): C backend
2019-08-24 07:40:38 -07:00
Leonardo de Moura
a336176017
feat(runtime/io): improve "file not found" error message
2019-07-27 09:45:38 -07:00
Leonardo de Moura
a16df483fa
fix(runtime/io): compilation error on windows
2019-07-26 10:09:55 -07:00
Leonardo de Moura
798bbc0662
feat(library/init/system/io): new primitives
2019-07-25 18:12:44 -07:00
Leonardo de Moura
02f516f09d
feat(runtime/io): add primitives
2019-07-25 09:36:37 -07:00
Leonardo de Moura
77a59f4998
feat(library/init/io): add IO.getEnv
2019-07-25 08:31:23 -07:00
Leonardo de Moura
79545f55c0
feat(library/init/io): add IO.readTextFile
2019-07-18 17:31:31 -07:00
Leonardo de Moura
30a6a2ade8
feat(library/init/data, runtime): remove parray support from runtime, and implement them in Lean using Scala/Clojure Radix trees
...
The Scala/Clojure approach for persistent arrays works great with our
`reset/reuse`. We seem to be much more efficient than their
implementations because of `reset/reuse`. The new approach also seems
better than the old one implemented in the runtime, and has a few
advantages:
1- The reroot procedure used in the old approach required
synchronization for multi-threaded code, or we would need to perform
deep copies when sending `parray` objects between threads.
2- We don't need any runtime extension for the new approach.
3- The old approach used "trail lists" for undoing array updates.
This works well for bactracking search use cases, but it is bad
in use cases where we are simultaneously updating the persistent
arrays that have shared nodes.
2019-06-02 09:18:19 -07:00
Leonardo de Moura
53ec9ee181
chore(*): style
2019-05-14 07:08:58 -07:00
Leonardo de Moura
5844913102
feat(library/module, library/init/lean/environment): add primitives for reading/writing files as compacted regions
2019-05-13 17:26:28 -07:00
Leonardo de Moura
2cd2bec831
fix(init/init.cpp): initialization bug
2019-05-11 17:51:23 -07:00
Leonardo de Moura
c46608ced5
feat(library/init/io): implement unsafeIO in Lean
...
Motivation: avoid closure allocation.
2019-05-11 16:28:11 -07:00
Leonardo de Moura
fd2a5dd45e
feat(library/init/io): add IO.initializing
2019-05-10 11:26:49 -07:00
Leonardo de Moura
d110a607fe
fix(runtime/io): bug at IO.Ref primitives in multi-threaded mode
2019-03-23 09:06:04 -07:00
Leonardo de Moura
3202840959
fix(runtime/io): make IO.Ref thread-safe again
...
See new comment at `io.cpp`
2019-03-22 09:59:32 -07:00
Leonardo de Moura
a79b00d733
chore(runtime, stage0): update Ref primitive operation names
2019-03-21 16:43:54 -07:00
Leonardo de Moura
1da4782483
feat(runtime, library/init/io): add io.ref
2019-03-16 22:16:28 -07:00
Leonardo de Moura
b1c187f717
feat(library/compiler): allow io unit as main function result type
...
When `io unit` is used, we use `return 0` for `result.ok`, and `return
1` for `result.except`.
2019-03-16 16:05:45 -07:00
Leonardo de Moura
dcdeff1794
chore(runtime): remove dead file
2019-03-16 15:34:58 -07:00
Leonardo de Moura
6d0ec3a8c9
refactor(library/init/io): implement io monad using estate monad
2019-03-16 15:34:58 -07:00
Leonardo de Moura
0888dee25e
chore(*): meta ==> unsafe
2019-03-15 15:04:40 -07:00
Leonardo de Moura
39dd079e37
feat(runtime): low tech allocation profiler
...
```
@[extern 4 "lean_io_allocprof"]
constant allocprof {α : Type} (msg : @& string) (fn : io α) : io α
```
2019-03-14 15:15:29 -07:00
Leonardo de Moura
562f530522
chore(runtime/io): use std::cerr
2019-03-14 11:04:12 -07:00
Leonardo de Moura
b722885137
feat(library/init/io): add unsafe_io and timeit
2019-02-13 16:59:24 -08:00
Leonardo de Moura
e10240fe5c
refactor(runtime/io): use extern "C" for io primitives
2019-02-13 11:21:29 -08:00
Leonardo de Moura
434627ee8e
chore(runtime/io): implement io.prim.put_str just to be able to test
2019-02-06 14:35:13 -08:00
Leonardo de Moura
3a7d407d6c
feat(library/compiler/builtin): register io primitives
...
TODO: implement `io` primitives in the new runtime
2018-11-15 16:14:50 -08:00