Implement -XStaticValues
authorFacundo Domínguez <facundo.dominguez@tweag.io>
Wed, 10 Dec 2014 00:10:18 +0000 (18:10 -0600)
committerAustin Seipp <austin@well-typed.com>
Wed, 10 Dec 2014 01:59:27 +0000 (19:59 -0600)
commitfc45f32491313d2a44e72d8d59cdf95b1660189d
tree853de68ce9feca6a61d2b540ef13fc03162740de
parente5974f8f53de4c97cfaad228eedfca8b31b53887
Implement -XStaticValues

Summary:
As proposed in [1], this extension introduces a new syntactic form
`static e`, where `e :: a` can be any closed expression. The static form
produces a value of type `StaticPtr a`, which works as a reference that
programs can "dereference" to get the value of `e` back. References are
like `Ptr`s, except that they are stable across invocations of a
program.

The relevant wiki pages are [2, 3], which describe the motivation/ideas
and implementation plan respectively.

[1] Jeff Epstein, Andrew P. Black, and Simon Peyton-Jones. Towards
Haskell in the cloud. SIGPLAN Not., 46(12):118–129, September 2011. ISSN
0362-1340.
[2] https://ghc.haskell.org/trac/ghc/wiki/StaticPointers
[3] https://ghc.haskell.org/trac/ghc/wiki/StaticPointers/ImplementationPlan

Authored-by: Facundo Domínguez <facundo.dominguez@tweag.io>
Authored-by: Mathieu Boespflug <m@tweag.io>
Authored-by: Alexander Vershilov <alexander.vershilov@tweag.io>
Test Plan: `./validate`

Reviewers: hvr, simonmar, simonpj, austin

Reviewed By: simonpj, austin

Subscribers: qnikst, bgamari, mboes, carter, thomie, goldfire

Differential Revision: https://phabricator.haskell.org/D550

GHC Trac Issues: #7015
71 files changed:
compiler/deSugar/Coverage.hs
compiler/deSugar/Desugar.hs
compiler/deSugar/DsExpr.hs
compiler/deSugar/DsMeta.hs
compiler/deSugar/DsMonad.hs
compiler/deSugar/StaticPtrTable.hs [new file with mode: 0644]
compiler/ghc.cabal.in
compiler/hsSyn/Convert.hs
compiler/hsSyn/HsExpr.hs
compiler/main/DynFlags.hs
compiler/parser/Lexer.x
compiler/parser/Parser.y
compiler/prelude/PrelNames.hs
compiler/rename/RnExpr.hs
compiler/typecheck/TcBinds.hs
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcHsSyn.hs
compiler/typecheck/TcRnDriver.hs
compiler/typecheck/TcRnMonad.hs
compiler/typecheck/TcRnTypes.hs
docs/users_guide/glasgow_exts.xml
includes/HsFFI.h
includes/Rts.h
includes/rts/StaticPtrTable.h [new file with mode: 0644]
libraries/base/GHC/StaticPtr.hs [new file with mode: 0644]
libraries/base/base.cabal
libraries/template-haskell/Language/Haskell/TH.hs
libraries/template-haskell/Language/Haskell/TH/Lib.hs
libraries/template-haskell/Language/Haskell/TH/Ppr.hs
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
rts/Hash.c
rts/Hash.h
rts/Linker.c
rts/RtsStartup.c
rts/StaticPtrTable.c [new file with mode: 0644]
rts/StaticPtrTable.h [new file with mode: 0644]
testsuite/tests/codeGen/should_run/CgStaticPointers.hs [new file with mode: 0644]
testsuite/tests/codeGen/should_run/CgStaticPointers.stdout [new file with mode: 0644]
testsuite/tests/codeGen/should_run/all.T
testsuite/tests/deSugar/should_run/DsStaticPointers.hs [new file with mode: 0644]
testsuite/tests/deSugar/should_run/DsStaticPointers.stdout [new file with mode: 0644]
testsuite/tests/deSugar/should_run/all.T
testsuite/tests/driver/T4437.hs
testsuite/tests/parser/should_compile/RdrNoStaticPointers01.hs [new file with mode: 0644]
testsuite/tests/parser/should_compile/all.T
testsuite/tests/rename/should_fail/RnStaticPointersFail01.hs [new file with mode: 0644]
testsuite/tests/rename/should_fail/RnStaticPointersFail01.stderr [new file with mode: 0644]
testsuite/tests/rename/should_fail/RnStaticPointersFail02.hs [new file with mode: 0644]
testsuite/tests/rename/should_fail/RnStaticPointersFail02.stderr [new file with mode: 0644]
testsuite/tests/rename/should_fail/RnStaticPointersFail03.hs [new file with mode: 0644]
testsuite/tests/rename/should_fail/RnStaticPointersFail03.stderr [new file with mode: 0644]
testsuite/tests/rename/should_fail/all.T
testsuite/tests/rts/GcStaticPointers.hs [new file with mode: 0644]
testsuite/tests/rts/GcStaticPointers.stdout [new file with mode: 0644]
testsuite/tests/rts/ListStaticPointers.hs [new file with mode: 0644]
testsuite/tests/rts/all.T
testsuite/tests/th/TH_StaticPointers.hs [new file with mode: 0644]
testsuite/tests/th/TH_StaticPointers.stdout [new file with mode: 0644]
testsuite/tests/th/TH_StaticPointers02.hs [new file with mode: 0644]
testsuite/tests/th/TH_StaticPointers02.stderr [new file with mode: 0644]
testsuite/tests/th/all.T
testsuite/tests/typecheck/should_compile/TcStaticPointers01.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/TcStaticPointers02.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/all.T
testsuite/tests/typecheck/should_fail/TcStaticPointersFail01.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/TcStaticPointersFail01.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/TcStaticPointersFail03.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/TcStaticPointersFail03.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T