Commit graph

24 commits

Author SHA1 Message Date
Leonardo de Moura
c8406a301d chore: reduce src/include/lean 2021-09-07 08:24:54 -07:00
Wojciech Nawrocki
e5182fe4af fix: exported symbol arities 2021-05-29 07:56:54 +02:00
Sebastian Ullrich
f5565d1d92 fix: mark a few more things as persistent 2020-10-11 17:43:28 +02:00
Sebastian Ullrich
7718795178 fix: mark Lean objects in C++ globals reachable from the new frontend as persistent
sed -Ei 's/(g_\w+)\s*= new (name|expr|format|level|string_ref)\W.*;/\0\n    mark_persistent(\1->raw());/' src/kernel/**/*.cpp src/util/**/*.cpp src/library/**/*.cpp
2020-10-11 17:43:28 +02:00
Leonardo de Moura
8383177c96 fix: nonoptimal specialization
@Kha Here is the fix for the problem I told you this morning.
Please, take a look at `specialize.cpp` and see whether it makes sense.
2020-09-24 12:40:28 -07:00
Leonardo de Moura
7c76a19885 chore: fix includes 2020-05-22 14:17:25 -07:00
Leonardo de Moura
8bdca35282 chore: use #include <lean/runtime/...> for runtime .h files 2020-05-18 11:30:07 -07:00
Leonardo de Moura
16d88b04ea chore: avoid cnstr_set_scalar and cnstr_get_scalar 2020-02-25 13:27:30 -08:00
Leonardo de Moura
6ada62a3ee feat: export helper functions
Motivation: prevent changes in the scalar fields layout from breaking
C++ code.
Ideally, we should do that for all constructors, and implement a tool
that creates the C++ functions automatically for us.
We don't do it because we will delete most of this code after we
finish the Lean4 transition.
2020-02-25 13:00:22 -08:00
Leonardo de Moura
85092412c7 refactor: remove Expr.FVar hack
@Kha @dselsam:
This hack was preventing us from making `Expr` a "real" Lean type.
This was bad for a few reasons:
- It was hard to extend/modify `Expr` in Lean since we would also have
to modify the C++ code that creates the `Expr` objects with the hidden
fields.
- `Expr.lam` and `Expr.forallE` were not following the Lean layout
standard where we sort fields by size. @Kha: recall we used that to
avoid a UB. The issue with `Expr.lam` and `Expr.forallE` is that they
have a "visible" field (`BinderInfo`), which is smaller than
hidden fields such as hash code.
- `Expr.fvar` had only one field at `Expr.lean,` but four behind the
scenes.

I added a new constructor `Local` that is only accessible from C++.
It is only used in legacy code we inherited from Lean2.
We will eventually delete it.

This refactoring was quite painful since many parts of the codebase
were mixing the new `Expr.fvar` with the old `Expr.local`.
I doubt I would be able to do it without the new staging framework
@Kha built.

BTW, some of the patches are horrible. I didn't care much since we
are going to deleted the super ugly files. That being said,
you should expect new weird bevaior due to `Expr.fvar` vs `Expr.local`.

Next step: use the new `ExprCachedData` to make all `Expr` hidden visibles
accessible from Lean.

checkpoint
2019-11-15 14:04:26 -08:00
Leonardo de Moura
7c99d58b83 chore: update stage0 and fix local_ctx.cpp 2019-10-26 09:55:31 -07:00
Leonardo de Moura
3b762d4dc0 refactor(runtime): C backend 2019-08-24 07:40:38 -07:00
Leonardo de Moura
dcd15f3424 refactor(runtime): C backend 2019-08-24 07:40:38 -07:00
Leonardo de Moura
19051d9a0d chore(library/init/lean/localcontext): export as C functions 2019-08-16 19:49:17 -07:00
Leonardo de Moura
ae97cfdd68 feat(kernel/local_ctx): use LocalContext 2019-08-07 11:50:20 -07:00
Leonardo de Moura
bad3f8e77e chore(kernel/local_ctx): use new representation defined at localcontext.lean 2019-08-06 10:47:50 -07:00
Sebastian Ullrich
d45cc4cb7b fix(kernel): manually align unboxed fields 2019-07-26 12:39:35 -07:00
Leonardo de Moura
43ceb6bfbe refactor(kernel/local_ctx): simplify local_ctx
Remark: we still need to revise the classes: `type_context` and `local_context`.
2018-10-24 10:02:38 -07:00
Leonardo de Moura
d814ee612a chore(kernel/local_ctx): typo 2018-09-11 18:10:10 -07:00
Leonardo de Moura
03a99986bb feat(kernel): implement local_decl using runtime 2018-09-08 16:25:43 -07:00
Leonardo de Moura
e9f843ddf6 refactor(kernel/expr): remove mlocal_* functions
The constructors `mvar` and `fvar` have different memory layouts.
2018-06-22 14:25:31 -07:00
Leonardo de Moura
fd5bfc7dfe refactor(kernel): simplify binder_info
Now, it is an enumeration type like its Lean counterpart.
2018-06-20 15:31:40 -07:00
Leonardo de Moura
d5c24806e7 feat(kernel/local_ctx): add methods for replacing legacy Pi/Fun 2018-06-09 07:45:16 -07:00
Leonardo de Moura
0a5e7ff1a9 feat(kernel): add local_ctx
We will have only one kind of local constant (aka free variable) in
Lean4. Thus, we need a local context object to implement the kernel
type checker.
2018-06-06 15:24:10 -07:00