Commit Graph

240 Commits

Author SHA1 Message Date
Steve Dunham
cf5c594474 [ fix ] fix windows CI, aligned_alloc not supported on win32 2024-05-17 14:44:48 -07:00
Hattori, Hiroki
1dc7b74e4e
[RefC] Suppress arglist wrapper (#3177)
* [RefC] Suppress code generation for unnecessary arglist wrappers.

* [RefC] cleanup dead code of arglist.

* Removed Value_Arglist to reduce Closure's allocation overhead.

* fix linter error

* [RefC] make trampoline() safety.

* [RefC] cleanup cStatementsFromANF to keep code simple.

* fix linter error

* fix linter error

* In another time, another galaxy. THE LINTER INVADORS conquaer the all humanity and make them slaves. Under 2024, a only leaved job for every humans is adjusting spaces of source code, or just type gg0vG$== in vim.

* [ test ] update golden value

* added supports 32 params on closure.

* [RefC] [Cleanup] removing duplicate codes.

* [RefC] Switch calling conventions based on the number of arguments to avoid limits on the number of arguments and to reduce stack usage.

* [RefC] Argument that are too large are placed on the heap, as are closures.

* [RefC] use idris2_malloc instead of malloc.

* [RefC] [Cleanup] Keep pure things pure.

* [RefC] Mapped some special constructors to NULL. This reduces malloc cost and generates simpler code in ConCase. But not work yet.

* [RefC] fix merge failure.

* [RefC] stringOps.c replace  NULL for NIL.

* [RefC] cleanup

* [RefC] ConstCase now generate simple if-then statements instead of using helpers. This reduces malloc/free costs.

* fix indentation

* fix whitespaces

* [RefC] The name field in Value_Constructor was restored for tycon. But changed to static const*. Hopefully the C compiler will remove the common string constants. The smartest thing to do would be to create a dummy global variable and use its address as a tag, but that would depend on the C compiler to resolve conflicts.

* [refc] a big changes of the space

* [RefC] Little tricks to reduce temporary variables

* spaces

* [RefC] fix compiler warnings

* [RefC] [test]  Perform memory leak analysis, if valgrind is installed.

* [RefC] Fix invalid memory read. Fix C compiler warnings.

* [RefC] Fix invalid memory read of strSubstr. [test] Perform memory leak analysis, if valgrind is installed.

* [test] fix junk line

* linter

* linter

* linter

* linter

* [RefC] merge with erase_trivial_constuctors

* merge w/ erase_trivial_constructors

* Revert "merge w/ erase_trivial_constructors"

This reverts commit be593a3715.

* Revert "[RefC] merge with erase_trivial_constuctors"

This reverts commit 3c21eb45d8.

* merge w/ upstream/main

* fix merge failure

* rename

* fix renaming

* [RefC] fix merge fail

* [RefC] renamed C functions for safty.

* [RefC] cleanup

* [RefC] Fix constructor tag of UnconsResult.CHARACTER.

---------

Co-authored-by: Mathew Polzin <matt.polzin@gmail.com>
Co-authored-by: Guillaume Allais <guillaume.allais@ens-lyon.org>
2024-04-17 15:48:43 +01:00
G. Allais
fee293b575
[ re #3177 ] Separate the renaming from the rest (#3248) 2024-04-03 17:22:19 +01:00
Hattori, Hiroki
ddc634b1b2
[RefC] Unbox small integers. (#3181) 2024-03-21 07:32:37 -05:00
Hattori, Hiroki
1906c75433
[RefC] [Cleanup] Erase trivial constructors; Stop copying constructor name. (#3206) 2024-02-20 08:01:06 -06:00
Ruslan
2e1c3fbf2e
Fix a bug in C implementation of idrnet_recv_bytes (missing flags parameter) (#3212)
* Fix a bug in C implementation of idrnet_recv_bytes (missing flags parameter)
2024-02-12 11:35:52 -06:00
Alex1005a
196d08dd6d
Implement Precise Reference Counting for C backend (#2989)
* start implement drop spec

* [RefC] remove vars after prim function call

* [RefC] gc pointer processing changed

* [RefC] fix memory leak in stringIteratorToString

* [RefC] runtime.c refactoring

* Implement basic reuse analisis

* [RefC] do not delete reusable variables in value in let

* [RefC] Use names instead tags in reuse map

* [RefC] Don't set all fields to null in reuse constructor

* Use record syntax in RefC

* Add some utility functions to RefC

* Sort output in garbageCollect refc test

* Add memory leak test for RefC

* [RefC] Remove variable only from body in let

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>

* [RefC] Remove borrowed set from env

* [RefC] Use Ref variable for Enviroment instead of passing as an argument

* [RefC] Use locally function as combinator

* [RefC] removing unnecessary dup and remove during pattern matching

* Update refcTests and refcMemoryLeakTests

* Remove some test files

* move CHANGELOG entry to CHANGELOG_NEXT

* Move refc-memory tests

* Change calling convention test

* [RefC] [Test] Reuse test

---------

Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
Co-authored-by: Mathew Polzin <matt.polzin@gmail.com>
2024-02-12 00:43:17 -06:00
HIROKI, Hattori
af4e888857 [RefC] [Cleanup] Pattern matching generates simpler code. Reduce malloc/free costs. 2024-01-23 21:59:23 +09:00
Hattori, Hiroki
5f643c04d1
[RefC] [Test] Valgrind support & Fix invalid memory read of strSubstr (#3196) 2024-01-22 07:25:22 -06:00
HIROKI, Hattori
cabc7abebe [RefC] Erase the World (not a fantasy things) 2024-01-21 19:34:05 +09:00
Hattori, Hiroki
844ea28149
- [RefC] delete unnecessary conversion to keep code simply. (#3176)
* - [RefC] delete unnecessary conversion to keep code simply.
- [RefC] rename some C functions to confliction safe.

* make the linter feels good.

* Get me a job as a linter slave.

* [RefC] Added hard fail for unsupported primitives.

* Fix typo.
2024-01-14 11:17:34 -06:00
Alexander
bd882c56c2
Fix file mode processing in support_system_file_popen
In JS switch cases with shared code should look like this
2024-01-04 20:00:50 +03:00
Denis Buzdalov
da916b68d4 [ fix ] Correctly manage the empty file case while reading a file 2023-12-21 13:30:30 -06:00
Denis Buzdalov
b495fe83f0 [ fix ] Support waiting for popen2-created processes
This fixes problem of creation the garbage of zombie processes on POSIX
systems. This also makes behaviour of `popen2` identical in Windows,
namely, all resources are freed only when waiting, giving at the same
time an ability to observe the exit code afterwards.
2023-12-19 23:03:31 +03:00
Steve Dunham
e2ceb97fd8 [ gambit ] fix pack / unpack segfault with gambit scheme 2023-11-29 15:32:17 +00:00
CodingCellist
d80bc1537d
[ base ] Add bindings for ieee Double number consts (#3116) 2023-11-09 14:01:40 +00:00
Aleksei Volkov
af7ba2fa67
[ ttc ] Compare modification time with nanosecond precision (#3046) 2023-08-31 11:55:57 +01:00
Jens Petersen
48dbc3251b implement DESTDIR support for distros
both 'make install' and 'idris2 --install*' should respect DESTDIR now
2023-08-22 16:44:13 +01:00
Steve Dunham
dc43ce2056 [ fix ] fix scheme002 test on windows 2023-08-03 23:16:14 +01:00
Steve Dunham
8d7791ba55
[ base ] Add getTermCols and getTermLines to base library and fix pri… (#3009) 2023-07-18 09:42:47 -05:00
Steve Dunham
9544162bc4
[ new ] Add support for bi-directional pipes on POSIX systems (resolves #2935) (#2944) 2023-04-15 09:39:17 -05:00
Steve Dunham
081938bad8 [ base ] Add support for unbuffered stdin 2023-03-07 13:28:25 -08:00
G. Allais
310a8f12cd
[ new ] missing buffer primitives (#2893) 2023-02-26 17:50:52 +00:00
Zoe Stafford
ff822a747b
Js char io (#2887)
* Implement `{get,put}Char` for javascript backend

* Update changelog
2023-02-13 15:48:07 +00:00
Mathew Polzin
2e9c7fb8b5
Create a separate Makefile for the Idris 2 support libraries. (#2869)
* Create a separate Makefile for the Idris 2 support libraries.

* Update INSTALL.md

* satisfy natural language linter

* Add to CHANGELOG

* Update CHANGELOG.md
2023-02-09 16:49:49 -06:00
Mathew Polzin
ad12f8335c
[ new ] popen/pclose for the NodeJS backend. (#2857)
* implement popen and pclose (to an extent) for NodeJS

* bring node020 back into tests.

* ah, I see what was being done here. Fix the idris for the test.

* fix test's unreachable clause warning

* fix expectation

* Add note to CHANGELOG

* small tweaks to get popen into merge-ready state.
2023-01-30 09:38:42 -06:00
Zoe Stafford
ae974af1d1
Use built-in bigint truncation on js backend 2023-01-08 12:50:26 +00:00
Zoe Stafford
ae2d4efc17 add javascript support to System.Clock
This may behave incorrectly when used with web workers
2022-12-22 11:47:44 +00:00
Johann Rudloff
018ef1fd8b [chez] Detect AArch64 machine/OS combinations correctly 2022-12-20 20:28:26 +01:00
Kamil Shakirov
73733f03ff Cleanup after rebase 2022-11-15 16:38:13 +01:00
Kamil Shakirov
502aa6f4fc Do not install papers library 2022-11-15 16:38:13 +01:00
Kamil Shakirov
dccb80d0bf [ fix ] Fix Makefile targets for linear and papers libraries 2022-11-15 16:38:13 +01:00
Hattori, Hiroki
5c9f8e36a1
[ RefC ] Add 16 and 32 bit access to base/Data.Buffer . (#2609)
* Fix symbom mangling

* Revert "Fix symbom mangling"

This reverts commit 6481e80155.

* Fix typo

* [RefC] Add missed prims of setBuffer* .

* [ fix ] formatting

* [ re #2609 ] Use 'UInt' instead of 'Word'

More descriptive/to the point / Less assumed knowledge.

There are no *LE suffixes for UInt8, since endianness is to do with
multiple bytes and UInt8 is a single one.

Co-authored-by: Guillaume Allais <guillaume.allais@ens-lyon.org>
Co-authored-by: Thomas E. Hansen <teh6@st-andrews.ac.uk>
2022-11-15 12:15:06 +01:00
CodingCellist
9cd92f1fc4
[ re #2742 ] Count no. processors online rather than configured (#2754)
* [ re #2742 ] Count no. processors online rather than configured

Seems there might be some oddities with what is reported when, e.g.
reporting the maximum number of processors supported by the currently
installed motherboard, regardless of which processor is socketed.

* [ #2754 ] Update CHANGELOG
2022-11-11 11:12:24 +01:00
Gregory Werbin
e0d6d0881e Remove unnecessary use of LDFLAGS 2022-11-11 09:33:09 +01:00
Gregory Werbin
1020437aad Use CPPFLAGS when needed 2022-11-11 09:33:09 +01:00
Sam Phillips
795eeb23c5 Make Racket backend channels behave same as Chez.
Add tests for both that demonstrate equivalent behavior.
2022-10-04 10:24:27 +02:00
Ben Hormann
ca5f1f1938 [ fix #2279 ] Racket bootstrap unsafe-fx 2022-09-23 18:55:31 +01:00
running-grass
36f930ef87
[ fix ] typo (#2656) 2022-09-21 12:14:49 +01:00
Guillaume Allais
c38e6bcfa9 [ lint ] once and for all 2022-09-21 12:12:34 +01:00
stefan-hoeck
188de8b4cc [ fix ] issue 2616 2022-09-12 02:10:13 -07:00
Hattori, Hiroki
4ba651bb8e
[RefC] Add sysCodegen primitive to avoid compiler error. (#2613) 2022-09-08 00:44:14 +01:00
ProofOfKeags
68a144bf18
Support System.Signal for node backend (#2556)
* first pass at signal support for node backend

* change signal values to int's

* implements defaultSignal

* return -1 as expected by calling API if any error is raised by nodejs runtime

* finishes signal support for nodejs

* extract repetitive foreign import identifiers

* fix comments
2022-07-10 10:18:58 +01:00
Jesse Nava
db13a35bf5 [ fix ] Ensure casting from String to Double results in floating numbers on scheme backends 2022-05-09 18:36:17 +01:00
György Kurucz
7a5f63eab0 [ fix ] Add missing cases for BITS types in extractInt
e79e4277 ("[ fix ] Make Bits types use int switch statement in RefC")
made the RefC backend generate code calling `extractInt` with Bits
types, bit did not add the extra cases to `extractInt`. This commit adds
the missing cases.

Fixes #2452
2022-05-04 10:18:58 +01:00
György Kurucz
7618491536 [ refactor ] Use switch statement in extractInt in the RefC runtime
Modern compilers should be smart enough regardless and generate
efficient code for the sequence of ifs, this is really just a syntax
change to make the code shorter.
2022-05-04 10:18:58 +01:00
György Kurucz
a05f091a90 [ refactor ] Format support/refc/runtime.c with clang-format 2022-05-04 10:18:58 +01:00
vfrinken
b1f45f2748
RefC backend improvements (#2425)
* RefC backend improvements

1. OnCollect had the wrong number of arguments. The code creator expects
   3 arguments, but onCollect in prim.h expected 4 arguments. The first of which
   was an erased arguments. That is now fixed.

2. OnCollect did not call `newReference` when creating a new reference to the pointer
   and the freeing function

3. OnCollect and OnCollectAny still had a spurious printf statement

Those issues have been fixed, the test case can be found in
  tests/refc/garbageCollect

4. The IORef mechanism expects that the %World token will be passed around
   consistently. This is not the case. States in Control.App make use of
   IORefs, but the function created from Control.App.prim_app_bind
   had the world token erased to NULL.
   Now, IORefs are managed using a global variable,
   IORef_Storage * global_IORef_Storage;
   referenced in cBackend.h, defined in the created .c file, and set to NULL
   in main();

5. While multithreading and forking is still not supported, compiling a program
   that makes use of Control.App demands a C implementation of prim_fork.
   Files support/refc/threads.c and support/refc/threads.h provide a
   dummy implementation for it, so that Control.App programs compile and run.

A test for these 2 issues is given in tests/refc/issue2424

* format changes

to make the linter happy

* format changes

to make the linter happy

* format changes

to make the linter happy

* spelling mistake braket -> bracket

Co-authored-by: Volkmar Frinken <volkmar@onutechnology.com>
2022-04-27 13:59:32 +01:00
Zoe Stafford
68bcacf3ec
[base] add missing node ffi functions (#2427) 2022-04-22 15:45:52 +01:00
Guillaume Allais
b4662a8537 [ fix ] show keywords & bound variables 2022-04-14 12:17:11 +01:00