Commit Graph

1970 Commits

Author SHA1 Message Date
Robert Wright
cd3906645b Add RefC getArgs support 2021-05-20 14:25:16 +01:00
Robert Wright
f3aae06b28 Add RefC Clock support 2021-05-20 14:25:16 +01:00
Robert Wright
cf2b05ce02 Add RefC Buffer support 2021-05-20 14:25:16 +01:00
Robert Wright
ecde887d7a Add RefC external type support
The external type must be a Value object for garbage collection reasons.

For completely custom types, use a GCPointer, with appropriate GC function for clearing up your data type.
2021-05-20 14:25:16 +01:00
Robert Wright
204b96fe6c Add RefC math library linking 2021-05-20 14:25:16 +01:00
Robert Wright
c34c6e0959 Complete RefC standard String support
- Fix off-by-one error in String reverse
- Correct order of arguments in strSubstr
- Actually use start index of strSubstr
- Reduce memory usage of strSubstr in case of overrunning string end
- Add fastPack/fastUnpack/fastConcat
- Use unsigned chars for character comparisons
- Fix generated C character encodings
2021-05-20 14:25:16 +01:00
Robert Wright
978d86f28d Fix RefC identity functions memory management 2021-05-20 14:25:16 +01:00
Robert Wright
2a957a38d9 Add RefC FFI header file support 2021-05-20 14:25:16 +01:00
Robert Wright
51ddcad3b8 Improve RefC foreign function support 2021-05-20 14:25:16 +01:00
Robert Wright
d961c0488c Make RefC fail noisily 2021-05-20 14:25:16 +01:00
Robert Wright
06ca4bed5d Refactor C codegen
- Remove commented out code
- Remove unused showEitherStringInt and toIntEitherStringInt functions
- Make cTypeOfCFType pure
- Merge identical case branches of createCFunctions
- Remove unused C support functions
2021-05-20 14:25:16 +01:00
Ohad Kammar
618c71477e
[ close #1384 ] built-in Snoc-lists [< 1, 2, 3 ] (#1383) 2021-05-20 12:56:25 +01:00
Ohad Kammar
823230b77c
Vect reasoning library (#1439)
When working on Frex I needed a whole bunch of lemmata to do with Data.Vect. I hope it will be useful for others.
2021-05-20 11:55:22 +01:00
Guillaume ALLAIS
31a5175a02 [ re #1031 ] Disallow ? patterns on the LHS
We do this during desugaring because elaboration may insert valid
`?` values on the LHS (e.g. when elaborating things that cannot be
pattern-matched on and should be checked to be forced).
2021-05-20 10:23:00 +01:00
Michael Messer
890810e9b6
Remove unsecure commands (#1433) 2021-05-20 10:21:39 +01:00
Edwin Brady
daf30ee4f6
Merge pull request #1438 from edwinb/more-ttc-wrangling
Substantial reduction in TTC size
2021-05-19 18:06:09 +01:00
Edwin Brady
f6919afef1 Increment TTC version 2021-05-19 17:13:51 +01:00
Edwin Brady
5ab91cafc8 Substantial reduction in TTC size
Write small integers out as 1 byte, not 8, at the cost of writing larger
integers out in 9 bytes. Most integers fit in 1 byte, since it's string
and list lengths from user-written code.
2021-05-19 16:48:06 +01:00
Edwin Brady
b901b2e5ad
Merge pull request #1434 from edwinb/ttc-wrangling
Some TTC loading improvements
2021-05-19 13:34:53 +01:00
Edwin Brady
72e0245e06 Remove trailing space 2021-05-19 01:08:04 +01:00
Edwin Brady
b94f7e96ae Strip current namespace when writing out defs
This saves writing the same strings over and over again in the body of a
definition. At the cost of a traversal on reading and writing the ttcs,
there is a good bit less to write out.
2021-05-19 00:23:19 +01:00
stefan-hoeck
eca25776c3 [ doc ] updated changelog 2021-05-18 20:25:26 +01:00
Edwin Brady
d51fe896f7 Trim namespace when writing definitions to TTC
We don't need to write the current namespace every single time! This
won't work as well if there's namespaces in the file, so it needs
refining a bit, but this reduces loading time anyway.
2021-05-18 18:30:06 +01:00
Edwin Brady
7f210b52aa Inline small metavariables
Where 'small' means they don't refer to other metavariables, except
right at the top level, and they don't go beyond a certain small depth,
arrived at by experimenting.

We already did a bit of this, but only for depth 0. The effect of this
is that we don't need to save out lots of metavariables, so ttc loading
is faster. This takes about 8s off the Idris build time!
2021-05-18 17:56:36 +01:00
Stefan Höck
66f3787cb7
[ cleanup ] Annotate JS backend sources (#1425) 2021-05-18 12:37:51 +01:00
Edwin Brady
669bcf3a1d Avoid reading whole ttcs unnecessarily
Sometimes we have to re-read, if we've previously imported and then
imported public, but on the second read we don't need to read the whole
thing, just the header.
2021-05-17 23:40:49 +01:00
Guillaume ALLAIS
2f66f3e006 [ test ] case for the fix 2021-05-17 22:27:28 +01:00
Ohad Kammar
f98bb3991f Bugfix highlighting of let declarations 2021-05-17 22:27:28 +01:00
Guillaume ALLAIS
ac4b31b41f [ fix #1421 ] Use resolved names for the impossible LHS 2021-05-17 21:06:37 +01:00
Guillaume ALLAIS
d0a6c9b5dd [ debug ] better information 2021-05-17 21:06:37 +01:00
Denis Buzdalov
7cc88d2328
[ elab ] More descriptive "Bad elaborator script" error message (#1427) 2021-05-17 18:40:07 +01:00
Ruslan Feizerakhmanov
d97f5266de
[ perf ] Move unnecessary toFullNames calls under a logC (#1423)
Fixed by converting the name of the equality type constructor to a resolved name
so that unresolved names do not show up in the unifier.
2021-05-17 11:13:35 +01:00
Edwin Brady
11761daa76
Merge pull request #1424 from edwinb/micro-optimise
A couple of small optimisations
2021-05-16 21:44:06 +01:00
Edwin Brady
e3fa0711e3 Don't calculate blocked metavariable set
With the new representation of postponed problems, this is now either
not worth doing, or much more expensive than just having another crack
at the problem anyway. So let's not calculate it.

This makes the libraries built a couple of seconds quicker for me, and I
have one example where a program that previously took minutes now type
checks in seconds...

Might revisit this later, if it turns out to be a potential source of
optimisations, but it'll need to be done an entirely different way.
2021-05-16 21:04:56 +01:00
Edwin Brady
5ac441ac05 Some micro-optimisations
Removing some unnecessary ++ and name lookups. Not really that
significant, but doing them anyway.
2021-05-16 15:10:05 +01:00
Edwin Brady
3bbe40cb3e
Merge pull request #1420 from edwinb/unify-postponing
Store postponed unification problems as values
2021-05-15 20:57:50 +01:00
Edwin Brady
70d8e4b337 Merge github.com:idris-lang/Idris2 into unify-postponing 2021-05-15 20:10:43 +01:00
Edwin Brady
45fc100f6c Store postponed unification problems as values
We stored them as equations between terms, I think because terms are
easy to re-evaluate with new information, and because I thought we might
want to save them out. It's not usually a problem to do that. However...
Going back and forth between terms and values can be expensive if
we're stuck in the middle of a complicated unification problem, the like
of which can turn up a lot if your types are complicated. So, we need to
be able to handle this.
Now store the postponed problems as NF, rather than Term, and add a
fuction to resume evaluating a NF with an updated context.
2021-05-15 20:03:33 +01:00
G. Allais
349308396c
[ fix #621 ] add warnings for shadowed global definition (#1407) 2021-05-14 17:35:21 +01:00
Edwin Brady
c87a6d52bb
Merge pull request #1400 from edwinb/tweak-cg
Some compilation/code generation improvements
2021-05-14 16:09:09 +01:00
Edwin Brady
c6f125b79c Fix tail calls in node back end
Authored by @stefan-hoeck
Stefan also says "Please note: The fix is quick and dirty. I plan to
open an new issue about the state of the JS backend soonish, since the
whole code requires some cleanup and documentation."
2021-05-14 15:19:30 +01:00
Guillaume ALLAIS
4917d124aa [ fix ] highlighting of tuples 2021-05-14 13:47:35 +01:00
Guillaume ALLAIS
3610464a10 [ fix ] record projections 2021-05-14 13:47:35 +01:00
Denis Buzdalov
0392b49c63 [ doc ] Update the test-lib's readme according to the current state 2021-05-14 11:46:11 +01:00
Edwin Brady
ba10b46054 Add missing 'commit' on backtrack
This means we can add things to the main context rather than the staging
context, if the 'branch' is always bracketed with a 'commit'. It doesn't
make a huge difference, but it is at least tidy!
2021-05-13 20:28:41 +01:00
Zoe Stafford
7e520994fd
[ fix ] missing log option (#1411) 2021-05-13 20:23:31 +01:00
Zoe Stafford
7fe8c42116
[ builtin ] O(1) integerToNat for any 'Nat'-like type (#1403) 2021-05-13 18:44:24 +01:00
Johann Rudloff
2477d060a8 Use sysctl instead of nproc to get number of processors on FreeBSD
On FreeBSD `nproc` is not available in a standard installation, so the
equivalent `sysctl -n hw.ncpu` is used.
2021-05-13 18:27:57 +01:00
Johann Rudloff
b9e95d5d8d Do not explicitly load libc on FreeBSD
On FreeBSD, the versionless `libc.so` file is a (text-based) linker
script and can not be loaded dynamically at runtime. Instead of
hardcoding the libc version "7" for FreeBSD we can just skip the load
completely, since libc is already implicitly loaded by the Chez runtime.
2021-05-13 18:27:57 +01:00
Johann Rudloff
664a7616b1 Remove path and version from Racket libc FFI definer
According to [1], Racket recommends specifying `#f` as "library path"
when the goal is to access functions of the C runtime.

This enables using the Racket backend on systems where libc is not
always version "6" (e.g. on FreeBSD it's "7").

[1]: https://docs.racket-lang.org/foreign/Loading_Foreign_Libraries.html#%28def._%28%28lib._ffi%2Funsafe..rkt%29._ffi-lib%29%29
2021-05-13 18:27:57 +01:00