Skip to content
Snippets Groups Projects
  1. Jun 19, 2023
  2. Jun 12, 2023
  3. Jun 11, 2023
    • Reinier Maas's avatar
      c5dadd72
    • Reinier Maas's avatar
      fixup! Define HEAP_ALLOCED for CMM code · 02c7181e
      Reinier Maas authored
      02c7181e
    • davide's avatar
      1585179f
    • Duncan Coutts's avatar
    • Duncan Coutts's avatar
      Add Note [Byte arrays outside of the HEAP_ALLOCED space] · cb453107
      Duncan Coutts authored
      And refer to it from the various places involved in the scheme.
      cb453107
    • Duncan Coutts's avatar
      23975374
    • Duncan Coutts's avatar
      Update user guide for byte arrays outside of the heap · 48c0a1ed
      Duncan Coutts authored
      Add a sub-subsection in the chapter on GHC extensions to the FFI, under
      the existing Memory Allocation subsection.
      
      Explain that it's permitted to have {Mutable}ByteArray# outside the heap
      and the tricky associated constraints. Mention the new primop
      placeByteArray#.
      48c0a1ed
    • Duncan Coutts's avatar
      Add test T17747 · 6e0cb8f7
      Duncan Coutts authored
      Closes issue #17747
      
      Test that we can allocate ByteArray#s outside of the HEAP_ALLOCED()
      address space without upsetting the GC. To be extra sure we attach weak
      pointers with C finalizers to the ByteArray#s. We keep them alive and
      run a major GC so that the GC has to trace the live ByteArray#s.
      
      Prior to the first patch in this series, doing this would upset the GC
      because the GC does not expect heap objects with closure type ARR_WORDS
      to exist outside the GC heap.
      
      > internal error: evacuate(static): strange closure type 42
      
      Finally we allow everything to be GC'd again, and check that the C
      finalizers did run.
      
      This feature also required a change to the isByteArrayPinned# which
      itself required a CMM implementation of the HEAP_ALLOCED system. So we
      also add a check that the CMM and C implementations of HEAP_ALLOCED
      agree with each other.
      6e0cb8f7
    • Duncan Coutts's avatar
      Fix isByteArrayPinned# for the !HEAP_ALLOCATED case · 8c0a8732
      Duncan Coutts authored
      The isByteArrayPinned# primop works by looking up the block descriptor
      for the byte array to see if it lives in a pinned area or not. This of
      course cannot work for byte arrays that are not HEAP_ALLOCATED since
      they don't have block descriptors.
      
      The solution is to check if it is HEAP_ALLOCATED first. Since this is
      done in CMM code we make use of the new HEAP_ALLOCATED support for CMM.
      It is a bit awkward since it does not have a uniform interface.
      8c0a8732
    • Duncan Coutts's avatar
      Define HEAP_ALLOCED for CMM code · cb58cca0
      Duncan Coutts authored
      Allow rts/sm/HeapAlloc.h to be #included by CMM code and have it provide
      a suitable implementation of HEAP_ALLOCED.
      
      The HEAP_ALLOCED system has three implementations, the large address
      space case, two fallbakc impls, one for 32bit and one for 64bit. The
      first two are simple enough that we can provide a HEAP_ALLOCED macro
      that can be used in a CMM expression context.
      
      The 64bit fallback case is rather more tricky. We provide a different
      interface to HEAP_ALLOCED for this case, which has to be called in a
      statement/"callish" style.
      cb58cca0
    • Duncan Coutts's avatar
      Add new primop placeByteArray# · 40a7504b
      Duncan Coutts authored
      It places a byte array heap object header at the given address, which
      must be outside the heap. It also sets the byte array size.
      40a7504b
    • Duncan Coutts's avatar
      Permit ARR_WORDS closures outside HEAP_ALLOCED space · e101c256
      Duncan Coutts authored
      In the GC, evacuate() is prepared to deal with some heap objects that
      are not in the HEAP_ALLOCED() memory space. These are mainly the heap
      objects that GHC puts into the data sections of object files.
      
      It is also useful however to allow ByteArray# and MutableByteArray#
      heap objects to appear outside of the HEAP_ALLOCED() memory space. These
      have the ARR_WORDS closure type and contain no pointer should be easy to
      deal with. Indeed evacuate() already deals with closure types for
      constructors containing no pointers by doing nothing.
      
      So we just tack the ARR_WORDS case into this group of closure types that
      are permitted outside the HEAP_ALLOCED area but otherwise ignored.
      e101c256
  4. Jun 10, 2023
    • Jorge Mendes's avatar
      Remove redundant case statement in rts/js/mem.js. · 9d1a8d87
      Jorge Mendes authored and Marge Bot's avatar Marge Bot committed
      9d1a8d87
    • Andrei Borzenkov's avatar
      Fix -Wterm-variable-capture scope (#23434) · b84a2900
      Andrei Borzenkov authored and Marge Bot's avatar Marge Bot committed
      -Wterm-variable-capture wasn't accordant with type variable
      scoping in associated types, in type classes. For example,
      this code produced the warning:
        k = 12
      
        class C k a where
          type AT a :: k -> Type
      
      I solved this issue by reusing machinery of newTyVarNameRn function
      that is accordand with associated types: it does lookup for each free type
      variable when we are in the type class context. And in this patch I
      use result of this work to make sure that -Wterm-variable-capture warns
      only on implicitly quantified type variables.
      b84a2900
  5. Jun 09, 2023
  6. Jun 08, 2023
  7. Jun 07, 2023
Loading