Skip to content
Snippets Groups Projects
  1. Jan 17, 2024
    • Cheng Shao's avatar
      base: treat all FDs as "nonblocking" on wasm · 2eca52b4
      Cheng Shao authored
      On posix platforms, when performing read/write on FDs, we check the
      nonblocking flag first. For FDs without this flag (e.g. stdout), we
      call fdReady() first, which in turn calls poll() to wait for I/O to be
      available on that FD. This is problematic for wasm32-wasi: although
      select()/poll() is supported via the poll_oneoff() wasi syscall, that
      syscall is rather heavyweight and runtime behavior differs in
      different wasi implementations. The issue is even worse when targeting
      browsers, given there's no satisfactory way to implement async I/O as
      a synchronous syscall, so existing JS polyfills for wasi often give up
      and simply return ENOSYS.
      
      Before we have a proper I/O manager that avoids poll_oneoff() for
      async I/O on wasm, this patch improves the status quo a lot by merely
      pretending all FDs are "nonblocking". Read/write on FDs will directly
      invoke read()/write(), which are much more reliably handled in
      existing wasi implementations, especially those in browsers.
      
      Fixes #23275 and the following test cases: T7773 isEOF001 openFile009
      T4808 cgrun025
      
      Approved by CLC proposal #234:
      https://github.com/haskell/core-libraries-committee/issues/234
      2eca52b4
  2. Jan 10, 2024
  3. Dec 31, 2023
  4. Dec 12, 2023
  5. Nov 09, 2023
  6. Sep 12, 2023
  7. Aug 22, 2023
  8. Aug 04, 2023
  9. Jul 19, 2023
  10. Jul 11, 2023
    • Ben Gamari's avatar
      compiler: Record original thunk info tables on stack · eb623149
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Here we introduce a new code generation option, `-forig-thunk-info`,
      which ensures that an `stg_orig_thunk_info` frame is pushed before every
      update frame. This can be invaluable when debugging thunk cycles and
      similar.
      
      See Note [Original thunk info table frames] for details.
      
      Closes #23255.
      eb623149
  11. Jul 06, 2023
  12. Jun 13, 2023
  13. May 23, 2023
    • Rodrigo Mesquita's avatar
      codeGen: Fix LFInfo of imported datacon wrappers · 2fc18e9e
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      As noted in #23231 and in the previous commit, we were failing to give a
      an LFInfo of LFCon to a nullary datacon wrapper from another module,
      failing to properly tag pointers which ultimately led to the
      segmentation fault in #23146.
      
      On top of the previous commit which now considers wrappers where we
      previously only considered workers, we change the order of the guards so
      that we check for the arity of the binding before we check whether it is
      a constructor. This allows us to
      (1) Correctly assign `LFReEntrant` to imported wrappers whose worker was
      nullary, which we previously would fail to do
      (2) Remove the `isNullaryRepDataCon` predicate:
          (a) which was previously wrong, since it considered wrappers whose
          workers had zero-width arguments to be non-nullary and would fail to
          give `LFCon` to them
          (b) is now unnecessary, since arity == 0 guarantees
              - that the worker takes no arguments at all
              - and the wrapper takes no arguments and its RHS must be an
                application of the worker to zero-width-args only.
              - we lint these two items with an assertion that the datacon
                `hasNoNonZeroWidthArgs`
      
      We also update `isTagged` to use the new logic in determining the
      LFInfos of imported Ids.
      
      The creation of LFInfos for imported Ids and this detail are explained
      in Note [The LFInfo of Imported Ids].
      
      Note that before the patch to those issues we would already consider these
      nullary wrappers to have `LFCon` lambda form info; but failed to re-construct
      that information in `mkLFImported`
      
      Closes #23231, #23146
      
      (I've additionally batched some fixes to documentation I found while
      investigating this issue)
      2fc18e9e
    • Ben Gamari's avatar
      testsuite: Add tests for #23146 · 33cf4659
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Both lifted and unlifted variants.
      33cf4659
  14. May 04, 2023
    • Sylvain Henry's avatar
      Fix remaining issues with bound checking (#23123) · 2d5c1dde
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      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.
      2d5c1dde
    • Josh Meredith's avatar
      JS: fix bounds checking (Issue 23123) · 116d7312
      Josh Meredith authored and Marge Bot's avatar Marge Bot committed
      * 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.
      116d7312
  15. Apr 27, 2023
  16. Apr 24, 2023
  17. Apr 04, 2023
  18. Mar 30, 2023
  19. Mar 08, 2023
  20. Mar 03, 2023
  21. Feb 28, 2023
  22. Jan 31, 2023
  23. Jan 18, 2023
    • Krzysztof Gogolewski's avatar
      Use -Wdefault when running Python testdriver (#22727) · ee9b78aa
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      ee9b78aa
    • Sylvain Henry's avatar
      testsuite: req_smp --> req_target_smp, req_ghc_smp · 06036d93
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      See #22630 and !9552
      
      This commit:
       - splits req_smp into req_target_smp and req_ghc_smp
       - changes the testsuite driver to calculate req_ghc_smp
       - changes a handful of tests to use req_target_smp instead of req_smp
       - changes a handful of tests to use req_host_smp when needed
      
      The problem:
       - the problem this solves is the ambiguity surrounding req_smp
       - on master req_smp was used to express the constraint that the program
       being compiled supports smp _and_ that the host RTS (i.e., the RTS used
       to compile the program) supported smp. Normally that is fine, but in
       cross compilation this is not always the case as was discovered in #22630.
      
      The solution:
       - Differentiate the two constraints:
         - use req_target_smp to say the RTS the compiled program is linked
         with (and the platform) supports smp
         - use req_host_smp to say the RTS the host is linked with supports smp
      
      WIP: fix req_smp (target vs ghc)
      
      add flag to separate bootstrapper
      
      split req_smp -> req_target_smp and req_ghc_smp
      
      update tests smp flags
      
      cleanup and add some docstrings
      
      only set ghc_with_smp to bootstrapper on S1 or CC
      
      Only set ghc_with_smp to bootstrapperWithSMP of when testing stage 1
      and cross compiling
      
      test the RTS in config/ghc not hadrian
      
      re-add ghc_with_smp
      
      fix and align req names
      
      fix T11760 to use req_host_smp
      
      test the rts directly, avoid python 3.5 limitation
      
      test the compiler in a try block
      
      align out of tree and in tree withSMP flags
      
      mark failing tests as host req smp
      
      testsuite: req_host_smp --> req_ghc_smp
      
      Fix ghc vs host, fix ghc_with_smp leftover
      06036d93
  24. Jan 11, 2023
    • Krzysztof Gogolewski's avatar
      Misc cleanup · 083f7015
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      - Remove unused mkWildEvBinder
      - Use typeTypeOrConstraint - more symmetric and asserts that
        that the type is Type or Constraint
      - Fix escape sequences in Python; they raise a deprecation warning
        with -Wdefault
      083f7015
  25. Jan 10, 2023
  26. Nov 29, 2022
  27. Oct 26, 2022
  28. Oct 19, 2022
  29. Oct 17, 2022
  30. Aug 26, 2022
    • Krzysztof Gogolewski's avatar
      Remove label style from printing context · f5e0f086
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      Previously, the SDocContext used for code generation contained
      information whether the labels should use Asm or C style.
      However, at every individual call site, this is known statically.
      This removes the parameter to 'PprCode' and replaces every 'pdoc'
      used to print a label in code style with 'pprCLabel' or 'pprAsmLabel'.
      The OutputableP instance is now used only for dumps.
      
      The output of T15155 changes, it now uses the Asm style
      (which is faithful to what actually happens).
      f5e0f086
  31. Aug 08, 2022
Loading