summaryrefslogtreecommitdiff
path: root/rts/js
Commit message (Collapse)AuthorAgeFilesLines
* JS: Implement h$clock_gettime in the JavaScript RTS (#23360)Josh Meredith2023-05-161-0/+20
|
* Fix remaining issues with bound checking (#23123)Sylvain Henry2023-05-045-69/+40
| | | | | | | | | | | | | | | | | | | | While fixing these I've also changed the way we store addresses into ByteArray#. Addr# are composed of two parts: a JavaScript array and an offset (32-bit number). Suppose we want to store an Addr# in a ByteArray# foo at offset i. Before this patch, we were storing both fields as a tuple in the "arr" array field: foo.arr[i] = [addr_arr, addr_offset]; Now we only store the array part in the "arr" field and the offset directly in the array: foo.dv.setInt32(i, addr_offset): foo.arr[i] = addr_arr; It avoids wasting space for the tuple.
* JS: fix bounds checking (Issue 23123)Josh Meredith2023-05-041-0/+12
| | | | | | | | | | | | | | | | | | | | * For ByteArray-based bounds-checking, the JavaScript backend must use the `len` field, instead of the inbuild JavaScript `length` field. * Range-based operations must also check both the start and end of the range for bounds * All indicies are valid for ranges of size zero, since they are essentially no-ops * For cases of ByteArray accesses (e.g. read as Int), the end index is (i * sizeof(type) + sizeof(type) - 1), while the previous implementation uses (i + sizeof(type) - 1). In the Int32 example, this is (i * 4 + 3) * IndexByteArrayOp_Word8As* primitives use byte array indicies (unlike the previous point), but now check both start and end indicies * Byte array copies now check if the arrays are the same by identity and then if the ranges overlap.
* JS: fix thread-related primopsSylvain Henry2023-04-192-12/+26
|
* JS: remove dead code for old integer-gmpSylvain Henry2023-03-101-16/+2
|
* JS: fix for overlap with copyMutableByteArray# (#23033)Sylvain Henry2023-02-281-1/+22
| | | | | | The code wasn't taking into account some kind of overlap. cgrun070 has been extended to test the missing case.
* JS: make some arithmetic primops faster (#22835)Sylvain Henry2023-02-241-29/+64
| | | | | | Don't use BigInt for wordAdd2, mulWord32, and timesInt32. Co-authored-by: Matthew Craven <5086-clyring@users.noreply.gitlab.haskell.org>
* Fix marking async exceptions in the JS backendLuite Stegeman2023-02-061-1/+2
| | | | | | | | Async exceptions are posted as a pair of the exception and the thread object. This fixes the marking pass to correctly follow the two elements of the pair. Potentially fixes #22836
* Fix bound thread statusLuite Stegeman2022-12-091-1/+1
|
* Add support for environments that don't have setImmediateLuite Stegeman2022-12-091-4/+13
|
* Add Javascript backendSylvain Henry2022-11-2924-0/+8813
Add JS backend adapted from the GHCJS project by Luite Stegeman. Some features haven't been ported or implemented yet. Tests for these features have been disabled with an associated gitlab ticket. Bump array submodule Work funded by IOG. Co-authored-by: Jeffrey Young <jeffrey.young@iohk.io> Co-authored-by: Luite Stegeman <stegeman@gmail.com> Co-authored-by: Josh Meredith <joshmeredith2008@gmail.com>