Remove conservative untag

Why is this ok?  Well, the only the stg_gc_enter_1 code assumes
node is untagged, but thunk indirections are guaranteed to be untagged.
(Maybe this wouldn't be true after we update indirections after thunk
update.)  Everything else does the necessary untag.  In my tests,
this helps binary size a lot (10% to 2% increase), but these figures
are slightly dodgy as some older figures I looked at had the baseline
binary increase at only 5%, and overall there's been some binary bloat.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Implement compressed static closure code generation.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Record static indirection in GC'able CAFs.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Fix checkUnload computation but leaks memory.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Segregate linker loaded static objects from global static objects and free them appropriately

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Fix pending stable ptr initialization.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Add rEP_Capability_no.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Add cmmNotWord.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Add BLOCK constants to DeriveConstants.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Add iterateHashTable function.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Teach code generator about Nursery register.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Teach code generator about CurrentAlloc register.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
[HACK] Disable compaction for now.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Implement neededBlocks

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
[START] Implement core infrastructure for resource limits.

This is a basic implementation of the core infrastructure for resource
limits, although it doesn't do anything, as there are no primops for
actually changing your resource container.

TOFIX: GHCi doesn't work.

TOFIX: Compiled-code changes should be optional (either a new way or
configure time option), as they increase code size a bit.

TOFIX: Compaction is not supported.

TOFIX: Some of the RTS function names are not very good.

WONTFIX: 32-bit does not have enough space to support the resource
container pointer in the block descriptor.  So this compilation mode
is not compatible with 32-bit.

Patch notes:

    * Two new registers: RC and OldRC.

    * The key invariants is that the resource container of
      CurrentNursery must be the same as the current resource
      container as recorded in the register RC.

    * Compiled-code changes in two places.  First,
      during thunk entry, we need to do an extra conditional on the RC
      to determine if we need to change containers (doing this fast
      relies on all closures, in particular static closures, having a
      valid block descriptor).  Second, the current RC must be saved and
      restored along with the rest of thread state: thus update frames
      are augmented to record the RC.  We also introduce a new update
      frame for just restoring an RC.  (Exception handling code applies
      these frames).

    * The modified entry code now looks like this:

        W_ rc = Bdescr(node)->rc;
        if (rc != RC) {
            RC = rc; // CurrentNursery/RC invariant violated
            goto gc;
        }

      The slowpath in rts/HeapStackCheck.cmm is responsible for noticing
      that the Current/RC invariant is incorrect, and adjusting
      CurrentNursery so that the invariant is restored, as well as
      pushing a frame stg_restore_container to restore the previous RC.

    * New C-- macros: RC_NURSERY to calculate the resource container of
      the nursery, and RC_CURRENT_NURSERY for the currentNursery

    * GC thread workspaces and nurseries are now reorganized to live in
      the resource container (NB: we change this later in the patchset).
      We do this by appending a variable size array at the end of
      resource containers, which contains a rcthread struct per thread.
      The garbage collector indirects through this, which results in a
      few more dereferences in the evacuate() fast-path.  Work stealing
      is turned off (NB: this is fixed later)

    * New RTS functions alloc*For which allocate into a resource
      container, and allocateFor and cmmMaybeAllocate for respecting
      resource limits when allocating into the current nursery.

    * The most important situation, the heap overflow handler, is
      modified to respect resource limits.

    * New threads inherit the RC of their parent.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Implement dead container garbage collection [INCOMPLETE]

LEAKS MEMORY! need to stgFree the ResourceContainer struct,
but then we need to invalidate existing RC# pointers.  A little
tricky, so don't bother for now.

Tightens up some invariants, yay!

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Implement centralized work queue for GC, with a shitty heuristic for finding new work

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Implement scan stack to find new work in RCs.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Implement support for PINNED objects.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Implement primops and source-language support.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>