As currently implemented, this will leak a few bytes per VM after they
terminate, but it is at least better than segfaulting when sending
messages to VMs which have terminated.
We need to get exactly what's in the file or strange things might happen
and assumptions get broken.
Change getLine to strip newlines itself rather than have the RTS do it,
for consistency with the REPL behaviour.
The replacement doesn't actually work properly, so needs to be fixed
asap, but if we have code that violates a licence it really has to go as
soon as we find out.
Primitives for head/tail/index/cons/reverse/length now all assume the
char* is UTF8 encoded. Also updated generation of literals to encode as
UTF8. Primitives are probably not as efficient as they could be (though
some of the will be used rarely)
ASCII strings will work exactly as before.
Everything I know about UTF8 encoding has been learned in the past few
hours. Therefore, this is unlikely to be the best way to do this. Please
educate me, ideally in the form of annotated Pull Requests :).
cppcheck now excludes imported library code from other projects and (for
now) the Windows RTS. Everything also passes, so #1907 is superseded and
fulfilled.
This commented out code was out of date, and would only cause errors when put back into the code. For instance the structures referenced in these comments have changed to the point where this is no longer relevant.
Now allow recv to only receive from a specific sender. This way a server
(for example) can carry on a conversation with a specific process
without having to mess about with the mailbox in various error prone
ways...
requireAlloc always needs to be paried with doneAlloc or the VM may
deadlock. Also, need to set the VM we're allocating on in copyTo with
pthread_setspecific
This means we can make primitives for reading/writing file handles which
are given the world state, so can be written more safely. Also, a
minimal back end can implement these rather than implementing an entire
FFI.
Updated primitive LReadStr (which can now reasonably be total, like any
foreign function, because it has a world state) and added primitive
LWriteStr.
Now storing VM in a pthread_key (in environments which support pthreads)
meaning that allocation doesn't need to be passed a VM pointer, and so
we can safely use the idris allocator from GMP (and indeed any C library
which wants to use it).
See previous commit message for the explanation of the bug.
This commit gives the right fix for the bug, which is to take out the values
that you will need from the arguments before using the allocator. The reason
is that the allocator may trigger a GC collection which will move your
arguments away. While you can use the resulting FWD pointer to get the data,
FWD values should never be used outside of the garbage collector. The gmp
operations should be looked at to make sure it is not doing this.
In summary, any C code that uses the allocator should save any relevant values
that its pointers are pointing to first.