Commit Graph

350 Commits

Author SHA1 Message Date
Edwin Brady
bbd0f286c2 Fix fileModifiedTime on 32 bit systems
Can't use MKBIGI for the result, since that'll be a negative number for
the current time! So use MKBIGUI instead to ensure it stays unsigned.
2020-03-06 09:13:00 +00:00
Jonas Claeson
159a7d473e Remove unused header files in the C RTS 2020-01-21 08:56:34 +01:00
Jonas Claeson
33be12cabe Moved idris_usleep to idris_stdfgn 2020-01-21 08:54:25 +01:00
Edwin Brady
24a083f3ae Small runtime performance tweak
Avoiding needless setting values when we're going to write there anyway.
2019-09-28 20:32:43 +01:00
Edwin Brady
ac930f3dcd Fix GC heap sizing
If there's still not enough room after a GC, grow the heap and do it
again so that there is enough room. (This is a quick hack to fix a rare
issue with large buffers!)
2019-09-28 20:32:43 +01:00
Alex Gryzlov
2405b0b425 add fRemove FFI call 2019-07-10 13:21:29 +03:00
Niklas Larsson
7626280473 Implement idris_clock on windows 2019-05-09 01:28:59 +02:00
Edwin Brady
62bd431d58 Add Clock/clockTime in System
This is for getting the time at a finer granularity than seconds. I
want this for getting approximate wall clock time measurements for run
time of fragments of programs, so the interface is very basic, but I am
open to better, more sophisticated APIs!

I expect this won't work on Windows, so it's #ifdefed out and always
returns 0. If you know how to fix this, please do!
2019-04-25 23:18:42 +01:00
Edwin Brady
dd065f3245 Fix potential memory error on tail calls
SLIDE needs to use 'memmove' rather than 'memcpy' because in the case
that the called function has more arguments than the current stack
frame, the regions will overlap, which would lead to undefined
behaviour.
2019-04-25 11:09:15 +01:00
Niklas Larsson
c736c53aba
Merge pull request #4678 from mokshasoft/small-rts-fixes
Small rts fixes
2019-04-10 11:22:19 +02:00
Jonas Claeson
72bcc273e6 Moved process count-down to terminate function for the C RTS
Some threads exit by finishing the runThread function, and some finish
by calling idris_stopThread. The test io003 triggered the assert in
runThread. Bring back calling terminate from the end of runThread.
2019-04-09 17:42:51 +02:00
Jonas Claeson
4b918b12cd Also destroy the pthread_attr_t 2019-03-23 11:05:56 +01:00
Jonas Claeson
01e5bb8f44 Simplyfy the terminate function sligthly 2019-03-23 10:50:23 +01:00
Jonas Claeson
63658515ce Also destroy the alloc_lock mutex 2019-03-23 10:47:49 +01:00
Jonas Claeson
73e0a98346 Fix leak of ThreadData
Valgrind detected this memory leak amongst others:

$ valgrind --leak-check=full --show-leak-kinds=all --trace-children=yes ./coop
==32242== 32 bytes in 1 blocks are still reachable in loss record 1 of 4
==32242==    at 0x483880B: malloc (vg_replace_malloc.c:309)
==32242==    by 0x409888: vmThread (idris_rts.c:825)
==32242==    by 0x404683: _idris_System_46_Concurrency_46_Channels_46_spawn (in /home/l337/OpenSource/Haskell/Idris-dev/coop)
==32242==    by 0x4031A3: _idris_Main_46_main (in /home/l337/OpenSource/Haskell/Idris-dev/coop)
==32242==    by 0x4066E9: _idris__123_runMain_95_0_125_ (in /home/l337/OpenSource/Haskell/Idris-dev/coop)
==32242==    by 0x408D0C: main (in /home/l337/OpenSource/Haskell/Idris-dev/coop)
2019-03-23 10:39:13 +01:00
Jonas Claeson
0597159d36 ThreadData only needed when pthread is enabled 2019-03-20 10:39:18 +01:00
Jonas Claeson
04abcae325 memcpy neede by idris_rts.h even without pthread enabled 2019-03-16 18:29:07 +01:00
Jonas Claeson
f95d2306b0 Update the seL4 build to use CMake instead of Kbuild
The seL4 build infrastructure has been changed and uses CMake instead
of Kbuild.
2019-03-16 18:16:07 +01:00
jinbijin
f9f05c9f33
Initialise error while opening a directory.
On at least some machines, the field error of DirInfo isn't actually automatically initialised as zero; this is enforced in this commit.
2019-02-25 18:07:44 +01:00
Edwin Brady
1980f49f43 Zero whole heap on initialisation
Instead of doing it on every allocation. A small thing, but a noticeable
performance gain on building the Blodwen libraries in particular.
2019-01-06 17:07:17 +00:00
Edwin Brady
655b4c7f3d Fix potential memory allocation problem
If we allocate space for a substring, and that triggers a gc, the
original string won't be in the same place, so we need to account for
this in idris_substr.
2018-09-13 23:00:59 +01:00
Edwin Brady
713e485ff6 newBuffer should return a managed pointer
Otherwise, we're just guessing on the size, and that way lies segfaults.
It turns out the size in Buffer.idr might have been correct once, but
isn't now, and so unless we're lucky registering the pointer will copy
memory we don't have access to. If the RTS does the registering of the
pointer, at least it knows the size.

(It's likely this is doable without the malloc, using iallocate
directly, but this required fewer changes.)
2018-07-30 16:54:25 +01:00
doofin
6a55558a71
Update idris_stdfgn.c 2018-07-26 03:49:30 +08:00
doofin
c9e8cf924d fix with MKSTR 2018-07-25 17:25:21 +08:00
doofin
c0360f6eba fix 2018-07-25 15:06:16 +08:00
doofin
d026c4e9b5 add currentDir 2018-07-25 14:42:21 +08:00
Edwin Brady
f7f8d92335 Tail calls via trampolines in C back end
This means we can turn off the clang optimiser and still have working
code generated. It does mean that the code generated is a bit slower
(there's a small overhead for the trampolines) but it compiles much
faster, which is a big deal for developing larger systems!

We need a way to turn the clang optimiser back on - probably just a
compiler flag.
2018-06-21 20:18:54 +01:00
Niklas Larsson
c889dc9433 Define IDRIS_GMP if compiling with real GMP
Only add minigmp to the rts if needed.

Remove obsolete hack.

Fixes #4470
2018-06-09 10:47:54 +02:00
Jorge Acereda
2247f69ecb Leak when receiving from inactive sender 2018-04-29 10:30:19 +02:00
Jorge Acereda
699090ee72 Undo previous commit mess which contained unrelated code from another branch 2018-04-27 23:56:49 +02:00
Jorge Acereda
e9a31f4c0f Unboxed Bits8/Bits16 using Int as the underlying representation 2018-04-26 21:05:50 +02:00
Niklas Larsson
c77938fda2
Merge pull request #4414 from jacereda/initial-message-error
idris_checkInitMessages() didn't check the init bit properly
2018-04-09 00:50:09 +02:00
Jorge Acereda
764df5fd12 idris_checkInitMessages() didn't check the init bit properly 2018-04-08 20:04:33 +02:00
Jorge Acereda
af281ab9d0 Bad size in inbox allocation, analyzer warning 2018-04-07 18:20:31 +02:00
Niklas Larsson
c2af016e3b
Merge pull request #4385 from jacereda/smaller-closure
Smaller closure
2018-04-02 19:14:40 +02:00
Jorge Acereda
3d0168fbd9 Remove arity field from Con struct 2018-04-01 15:51:54 +02:00
Jorge Acereda
ad2a7567ac Use hdr.u16 to store arity 2018-04-01 10:57:55 +02:00
Jorge Acereda
8ce876ced3 Remove _null macro 2018-04-01 10:55:46 +02:00
Jorge Acereda
cdeea74633 Align to pointer size 2018-04-01 10:53:31 +02:00
Jorge Acereda
0ea2a09135 Remove some redundant casts 2018-04-01 10:50:14 +02:00
Jorge Acereda
ea21a05bae Untabify 2018-04-01 10:48:45 +02:00
Jorge Acereda
549e40f3c3 Clean up indentation 2018-04-01 10:48:15 +02:00
Jorge Acereda
7ad70c8681 Untabify, clean up indentation 2018-04-01 10:46:20 +02:00
Jorge Acereda
fe8ea07a9b Clean up tabs 2018-04-01 10:44:06 +02:00
Jorge Acereda
46ab7c8e96 Warning on x86 gcc, removed redundant macro 2018-03-23 00:07:23 +01:00
Jorge Acereda
8d986bb2fb Workaround possible bug in x86 gcc-7.3.0 2018-03-22 23:31:15 +01:00
Jorge Acereda
3be07b0e1a Avoid indirections for nullaries, refactorized locked/unlocked variants 2018-03-22 19:08:50 +01:00
Jorge Acereda
11130b194d Bad shift on 32-bit architectures 2018-03-22 12:38:32 +01:00
Edwin Brady
7c9d72a0c7 Add functions for checking file timestamps 2018-03-21 18:20:45 +00:00
Jorge Acereda
7512498053 Add u8/u16 fields to header, use u8 for marking null strings 2018-03-21 00:00:22 +01:00