diff options
author | Facundo DomÃnguez <facundo.dominguez@tweag.io> | 2016-04-07 16:20:19 -0300 |
---|---|---|
committer | Facundo DomÃnguez <facundo.dominguez@tweag.io> | 2016-05-02 14:30:28 -0300 |
commit | 36d29f7ce332a2b1fbc36de831b0eef7a6405555 (patch) | |
tree | afc93170b8da063b81666b00e29289a161f1ac63 /testsuite/tests/codeGen | |
parent | fa86ac7c14b67f27017d795811265c3a9750024b (diff) | |
download | haskell-36d29f7ce332a2b1fbc36de831b0eef7a6405555.tar.gz |
StaticPointers: Allow closed vars in the static form.
Summary:
With this patch closed variables are allowed regardless of whether
they are bound at the top level or not.
The FloatOut pass is always performed. When optimizations are
disabled, only expressions that go to the top level are floated.
Thus, the applications of the StaticPtr data constructor are always
floated.
The CoreTidy pass makes sure the floated applications appear in the
symbol table of object files. It also collects the floated bindings
and inserts them in the static pointer table.
The renamer does not check anymore if free variables appearing in the
static form are top-level. Instead, the typechecker looks at the
tct_closed flag to decide if the free variables are closed.
The linter checks that applications of StaticPtr only occur at the
top of top-level bindings after the FloatOut pass.
The field spInfoName of StaticPtrInfo has been removed. It used to
contain the name of the top-level binding that contains the StaticPtr
application. However, this information is no longer available when the
StaticPtr is constructed, as the binding name is determined now by the
FloatOut pass.
Test Plan: ./validate
Reviewers: goldfire, simonpj, austin, hvr, bgamari
Reviewed By: simonpj
Subscribers: thomie, mpickering, mboes
Differential Revision: https://phabricator.haskell.org/D2104
GHC Trac Issues: #11656
Diffstat (limited to 'testsuite/tests/codeGen')
-rw-r--r-- | testsuite/tests/codeGen/should_run/CgStaticPointers.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/testsuite/tests/codeGen/should_run/CgStaticPointers.hs b/testsuite/tests/codeGen/should_run/CgStaticPointers.hs index f7776b0c06..66363ded6f 100644 --- a/testsuite/tests/codeGen/should_run/CgStaticPointers.hs +++ b/testsuite/tests/codeGen/should_run/CgStaticPointers.hs @@ -15,15 +15,15 @@ main = do print $ deRefStaticPtr (static g) print $ deRefStaticPtr p0 'a' print $ deRefStaticPtr (static t_field) $ T 'b' + where + g :: String + g = "found" lookupKey :: StaticPtr a -> IO a lookupKey p = unsafeLookupStaticPtr (staticKey p) >>= \case Just p -> return $ deRefStaticPtr p Nothing -> error $ "couldn't find " ++ show (staticPtrInfo p) -g :: String -g = "found" - p0 :: Typeable a => StaticPtr (a -> a) p0 = static (\x -> x) |