summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFacundo Domínguez <facundo.dominguez@tweag.io>2014-12-22 19:15:36 -0200
committerFacundo Domínguez <facundo.dominguez@tweag.io>2014-12-22 19:16:54 -0200
commitc72f61c6d4dd779d61bd0ebc0b1211a84c5b9038 (patch)
treecab68e458106294731ccd5d3f2ad1f328000204a
parent22bb78bb02718e162130690dfb9a11d7b719cea1 (diff)
downloadhaskell-c72f61c6d4dd779d61bd0ebc0b1211a84c5b9038.tar.gz
Groom comments related to StaticPointers.
Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D575
-rw-r--r--compiler/deSugar/StaticPtrTable.hs5
-rw-r--r--compiler/rename/RnExpr.hs2
-rw-r--r--docs/users_guide/glasgow_exts.xml6
-rw-r--r--includes/rts/StaticPtrTable.h3
-rw-r--r--rts/Hash.c2
-rw-r--r--rts/Hash.h2
-rw-r--r--testsuite/tests/rts/GcStaticPointers.hs12
-rw-r--r--testsuite/tests/th/TH_StaticPointers02.hs4
-rw-r--r--testsuite/tests/th/TH_StaticPointers02.stderr2
9 files changed, 16 insertions, 22 deletions
diff --git a/compiler/deSugar/StaticPtrTable.hs b/compiler/deSugar/StaticPtrTable.hs
index d4cad0e03e..858a0e8f7b 100644
--- a/compiler/deSugar/StaticPtrTable.hs
+++ b/compiler/deSugar/StaticPtrTable.hs
@@ -24,8 +24,7 @@
-- >
-- > }
--
--- where constants are values of a fingerprint of the string
--- "<package_id>:<module_name>.sptEntry:<N>"
+-- where the constants are fingerprints produced from the static forms.
--
module StaticPtrTable (sptInitCode) where
@@ -38,7 +37,7 @@ import GHC.Fingerprint
-- | @sptInitCode module statics@ is a C stub to insert the static entries
--- @statics@ of @module@ into the static pointer table
+-- @statics@ of @module@ into the static pointer table.
--
-- Each entry contains the fingerprint used to locate the entry and the
-- top-level binding for the entry.
diff --git a/compiler/rename/RnExpr.hs b/compiler/rename/RnExpr.hs
index 475554727e..cf5457eca1 100644
--- a/compiler/rename/RnExpr.hs
+++ b/compiler/rename/RnExpr.hs
@@ -313,7 +313,7 @@ rnExpr e@(ELazyPat {}) = patSynErr e
For the static form we check that the free variables are all top-level
value bindings. This is done by checking that the name is external or
-wired-in. See the Note about the NameSorts in Name.lhs.
+wired-in. See the Notes about the NameSorts in Name.hs.
-}
rnExpr e@(HsStatic expr) = do
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index 86ceb06298..83576efd1f 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -10470,9 +10470,6 @@ While the following definitions are rejected:
ref6 = let x = 1 in static x
ref7 y = static (let x = 1 in y)
</programlisting>
-Note that currently, the body <literal>e</literal> in <literal>static
-e</literal> is restricted to a single identifier when at the GHCi
-prompt.
</para>
</sect2>
@@ -10502,13 +10499,14 @@ That being said, with the appropriate use of wrapper datatypes, the
above limitations induce no loss of generality:
<programlisting>
{-# LANGUAGE ConstraintKinds #-}
-{-# LANGUAGE DerivingDataTypeable #-}
+{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE StaticPointers #-}
import Control.Monad.ST
+import Data.Typeable
import GHC.StaticPtr
data Dict c = c => Dict
diff --git a/includes/rts/StaticPtrTable.h b/includes/rts/StaticPtrTable.h
index 8b56510223..87a905c073 100644
--- a/includes/rts/StaticPtrTable.h
+++ b/includes/rts/StaticPtrTable.h
@@ -17,8 +17,7 @@
/** Inserts an entry in the Static Pointer Table.
*
* The key is a fingerprint computed from the StaticName of a static pointer
- * and the spe_closure is a pointer to the closure defining the table entry
- * (GHC.SptEntry).
+ * and the spe_closure is a pointer to the closure defining the table entry.
*
* A stable pointer to the closure is made to prevent it from being garbage
* collected while the entry exists on the table.
diff --git a/rts/Hash.c b/rts/Hash.c
index 1881092851..422c3d9182 100644
--- a/rts/Hash.c
+++ b/rts/Hash.c
@@ -206,7 +206,7 @@ lookupHashTable(HashTable *table, StgWord key)
return NULL;
}
-// Puts up to keys_sz keys of the hash table into the given array. Returns the
+// Puts up to szKeys keys of the hash table into the given array. Returns the
// actual amount of keys that have been retrieved.
//
// If the table is modified concurrently, the function behavior is undefined.
diff --git a/rts/Hash.h b/rts/Hash.h
index e802644659..136f94a18c 100644
--- a/rts/Hash.h
+++ b/rts/Hash.h
@@ -21,7 +21,7 @@ void * removeHashTable ( HashTable *table, StgWord key, void *data );
int keyCountHashTable (HashTable *table);
-// Puts up to keys_sz keys of the hash table into the given array. Returns the
+// Puts up to szKeys keys of the hash table into the given array. Returns the
// actual amount of keys that have been retrieved.
//
// If the table is modified concurrently, the function behavior is undefined.
diff --git a/testsuite/tests/rts/GcStaticPointers.hs b/testsuite/tests/rts/GcStaticPointers.hs
index 7c2fc2b354..c498af5842 100644
--- a/testsuite/tests/rts/GcStaticPointers.hs
+++ b/testsuite/tests/rts/GcStaticPointers.hs
@@ -14,9 +14,9 @@ import Unsafe.Coerce (unsafeCoerce)
nats :: [Integer]
nats = [0 .. ]
--- Just a StaticPtr to some CAF so that we can deRef it.
-nats_fp :: StaticKey
-nats_fp = staticKey (static nats :: StaticPtr [Integer])
+-- The key of a 'StaticPtr' to some CAF.
+nats_key :: StaticKey
+nats_key = staticKey (static nats :: StaticPtr [Integer])
main = do
let z = nats !! 400
@@ -26,8 +26,8 @@ main = do
print z
performGC
threadDelay 1000000
- let Just p = unsafeLookupStaticPtr nats_fp
+ let Just p = unsafeLookupStaticPtr nats_key
print (deRefStaticPtr (unsafeCoerce p) !! 800 :: Integer)
- -- Uncommenting the next line keeps primes alive and would prevent a segfault
- -- if nats were garbage collected.
+ -- Uncommenting the next line keeps 'nats' alive and would prevent a segfault
+ -- if 'nats' were garbage collected.
-- print (nats !! 900)
diff --git a/testsuite/tests/th/TH_StaticPointers02.hs b/testsuite/tests/th/TH_StaticPointers02.hs
index 1f619a7569..b381050b13 100644
--- a/testsuite/tests/th/TH_StaticPointers02.hs
+++ b/testsuite/tests/th/TH_StaticPointers02.hs
@@ -1,9 +1,7 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StaticPointers #-}
--- | A test to try the static form in splices.
---
--- A static form is defined in a splice and then it is used in the program.
+-- | A test to try the static form in splices, which should fail.
--
module Main(main) where
diff --git a/testsuite/tests/th/TH_StaticPointers02.stderr b/testsuite/tests/th/TH_StaticPointers02.stderr
index cc6fa82e40..88da9d15e1 100644
--- a/testsuite/tests/th/TH_StaticPointers02.stderr
+++ b/testsuite/tests/th/TH_StaticPointers02.stderr
@@ -1,5 +1,5 @@
-TH_StaticPointers02.hs:13:34:
+TH_StaticPointers02.hs:11:34:
static forms cannot be used in splices: static 'a'
In the splice:
$(case staticKey (static 'a') of {