GHC internals

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

GHC internals

Simon Peyton Jones
Norman

|    - Is there anything published about the implementation of GHCi?
|      Or perhaps something on the Developers' Wiki that explains how it works?

If you mean the details of bytecode compilation and the bytecode interpreter, I'm really not sure that there is.  That's bad; there should be. I'm ccing Simon M in case he knows of something.

|    - What is the best paper (or papers) to consult on the semantics
|      of GHC core?

Many of these papers
        http://research.microsoft.com/en-us/um/people/simonpj/papers/ext-f/
give syntax, static semantics, and operational semantics of Core.

Moreover, Richard Eisenberg has developed a specification of the Real Core in GHC, kept in the source tree in docs/core-spec

I enclose a typeset version.  

Sadly it doesn't include operational semantics, but I don't think that'd be hard to add, would it Richard?  The papers on the above link give several versions of the operational semantics, which is largely straightforward.

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: core-spec.pdf
Type: application/pdf
Size: 308357 bytes
Desc: core-spec.pdf
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130429/b115adaf/attachment-0001.pdf>

Reply | Threaded
Open this post in threaded view
|

GHC internals

Richard Eisenberg-2
It's true that the document in GHC doesn't include operational semantics, but that's because GHC doesn't ever really implement a concrete operational semantics for Core, at least that I'm aware of. There are various places that a certain operational semantics is assumed. However, I don't think there's one place that really states the semantics in any concrete way. The goal of the document you attached is to have an easy-to-read and easy-to-maintain version of Core, with a direct connection to the implementation. With the operational semantics never stated, including those rules seemed to go against that goal.

That said, it wouldn't be hard for me to imagine an operational semantics and add it to the document -- I just don't know how I would check my imagined version against the implemented one.

Richard

On Apr 29, 2013, at 8:38 AM, Simon Peyton-Jones <simonpj at microsoft.com> wrote:

> Norman
>
> |    - Is there anything published about the implementation of GHCi?
> |      Or perhaps something on the Developers' Wiki that explains how it works?
>
> If you mean the details of bytecode compilation and the bytecode interpreter, I'm really not sure that there is.  That's bad; there should be. I'm ccing Simon M in case he knows of something.
>
> |    - What is the best paper (or papers) to consult on the semantics
> |      of GHC core?
>
> Many of these papers
> http://research.microsoft.com/en-us/um/people/simonpj/papers/ext-f/
> give syntax, static semantics, and operational semantics of Core.
>
> Moreover, Richard Eisenberg has developed a specification of the Real Core in GHC, kept in the source tree in docs/core-spec
>
> I enclose a typeset version.  
>
> Sadly it doesn't include operational semantics, but I don't think that'd be hard to add, would it Richard?  The papers on the above link give several versions of the operational semantics, which is largely straightforward.
>
> Simon
> <core-spec.pdf>



Reply | Threaded
Open this post in threaded view
|

GHC internals

Simon Peyton Jones
That's not really true though.  The compiler implements beta-reduction; and inlining; and directly implements the "Push" rules in exprIsConApp_maybe.

S

| -----Original Message-----
| From: Richard Eisenberg [mailto:eir at cis.upenn.edu]
| Sent: 29 April 2013 14:30
| To: Simon Peyton-Jones
| Cc: 'Norman Ramsey'; ghc-devs at haskell.org; Simon Marlow
| Subject: Re: GHC internals
|
| It's true that the document in GHC doesn't include operational
| semantics, but that's because GHC doesn't ever really implement a
| concrete operational semantics for Core, at least that I'm aware of.
| There are various places that a certain operational semantics is
| assumed. However, I don't think there's one place that really states the
| semantics in any concrete way. The goal of the document you attached is
| to have an easy-to-read and easy-to-maintain version of Core, with a
| direct connection to the implementation. With the operational semantics
| never stated, including those rules seemed to go against that goal.
|
| That said, it wouldn't be hard for me to imagine an operational
| semantics and add it to the document -- I just don't know how I would
| check my imagined version against the implemented one.
|
| Richard
|
| On Apr 29, 2013, at 8:38 AM, Simon Peyton-Jones <simonpj at microsoft.com>
| wrote:
|
| > Norman
| >
| > |    - Is there anything published about the implementation of GHCi?
| > |      Or perhaps something on the Developers' Wiki that explains how
| it works?
| >
| > If you mean the details of bytecode compilation and the bytecode
| interpreter, I'm really not sure that there is.  That's bad; there
| should be. I'm ccing Simon M in case he knows of something.
| >
| > |    - What is the best paper (or papers) to consult on the semantics
| > |      of GHC core?
| >
| > Many of these papers
| > http://research.microsoft.com/en-us/um/people/simonpj/papers/ext-f/
| > give syntax, static semantics, and operational semantics of Core.
| >
| > Moreover, Richard Eisenberg has developed a specification of the Real
| Core in GHC, kept in the source tree in docs/core-spec
| >
| > I enclose a typeset version.
| >
| > Sadly it doesn't include operational semantics, but I don't think
| that'd be hard to add, would it Richard?  The papers on the above link
| give several versions of the operational semantics, which is largely
| straightforward.
| >
| > Simon
| > <core-spec.pdf>



Reply | Threaded
Open this post in threaded view
|

GHC internals

Richard Eisenberg-2
At the time, these uses didn't seem like a direct-enough encoding of the operational semantics to include in the writeup. There have been enough requests for operational semantics in that document that I'll put something in, probably by the end of the week -- shouldn't be hard.

Richard


On Apr 29, 2013, at 12:00 PM, Simon Peyton-Jones wrote:

> That's not really true though.  The compiler implements beta-reduction; and inlining; and directly implements the "Push" rules in exprIsConApp_maybe.
>
> S
>
> | -----Original Message-----
> | From: Richard Eisenberg [mailto:eir at cis.upenn.edu]
> | Sent: 29 April 2013 14:30
> | To: Simon Peyton-Jones
> | Cc: 'Norman Ramsey'; ghc-devs at haskell.org; Simon Marlow
> | Subject: Re: GHC internals
> |
> | It's true that the document in GHC doesn't include operational
> | semantics, but that's because GHC doesn't ever really implement a
> | concrete operational semantics for Core, at least that I'm aware of.
> | There are various places that a certain operational semantics is
> | assumed. However, I don't think there's one place that really states the
> | semantics in any concrete way. The goal of the document you attached is
> | to have an easy-to-read and easy-to-maintain version of Core, with a
> | direct connection to the implementation. With the operational semantics
> | never stated, including those rules seemed to go against that goal.
> |
> | That said, it wouldn't be hard for me to imagine an operational
> | semantics and add it to the document -- I just don't know how I would
> | check my imagined version against the implemented one.
> |
> | Richard
> |
> | On Apr 29, 2013, at 8:38 AM, Simon Peyton-Jones <simonpj at microsoft.com>
> | wrote:
> |
> | > Norman
> | >
> | > |    - Is there anything published about the implementation of GHCi?
> | > |      Or perhaps something on the Developers' Wiki that explains how
> | it works?
> | >
> | > If you mean the details of bytecode compilation and the bytecode
> | interpreter, I'm really not sure that there is.  That's bad; there
> | should be. I'm ccing Simon M in case he knows of something.
> | >
> | > |    - What is the best paper (or papers) to consult on the semantics
> | > |      of GHC core?
> | >
> | > Many of these papers
> | > http://research.microsoft.com/en-us/um/people/simonpj/papers/ext-f/
> | > give syntax, static semantics, and operational semantics of Core.
> | >
> | > Moreover, Richard Eisenberg has developed a specification of the Real
> | Core in GHC, kept in the source tree in docs/core-spec
> | >
> | > I enclose a typeset version.
> | >
> | > Sadly it doesn't include operational semantics, but I don't think
> | that'd be hard to add, would it Richard?  The papers on the above link
> | give several versions of the operational semantics, which is largely
> | straightforward.
> | >
> | > Simon
> | > <core-spec.pdf>
>
>



Reply | Threaded
Open this post in threaded view
|

Fwd: GHC internals

Simon Marlow-7
In reply to this post by Simon Peyton Jones
> From: *Simon Peyton-Jones* <simonpj at microsoft.com
> <mailto:simonpj at microsoft.com>>
>
> Norman
>
> |    - Is there anything published about the implementation of GHCi?
> |      Or perhaps something on the Developers' Wiki that explains how it
> works?
>
> If you mean the details of bytecode compilation and the bytecode
> interpreter, I'm really not sure that there is.  That's bad; there
> should be. I'm ccing Simon M in case he knows of something.

Julian Seward wrote some notes on the way GHCi works, which are in the
commentary:

http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/GHCi

It's not much, but there are some technical details about stacks and
suchlike there.  The bytecode itself is a pretty simple stack machine, I
can probably answer questions if there's anything you need some help with.

Cheers,
        Simon



Reply | Threaded
Open this post in threaded view
|

Fwd: GHC internals

Simon Marlow-7
On 30/04/13 10:27, William Kenyon wrote:
>> If you mean the details of bytecode compilation and the bytecode interpreter, I'm really not sure that there is.  That's bad; there
>> should be. I'm ccing Simon M in case he knows of something.
>
> I'm just starting to write detailed documentation for the bytecode
> generator and interpreter as part of my Masters project,
>
> What format would be most useful for you guys? I could do it in haddock
> and then include it into my project?
> Or just do it in plain latex and make my report publicly available?

Wiki documentation in the commentary would be the best for us.  That
doesn't have to be the format you write in, as long as you can translate
it into Trac markup and put it in the commentary somehow.

Cheers,
        Simon


>
> Will
>
>
> On 30 April 2013 10:02, Simon Marlow <marlowsd at gmail.com
> <mailto:marlowsd at gmail.com>> wrote:
>
>         From: *Simon Peyton-Jones* <simonpj at microsoft.com
>         <mailto:simonpj at microsoft.com>
>         <mailto:simonpj at microsoft.com <mailto:simonpj at microsoft.com>>__>
>
>
>         Norman
>
>         |    - Is there anything published about the implementation of GHCi?
>         |      Or perhaps something on the Developers' Wiki that
>         explains how it
>         works?
>
>         If you mean the details of bytecode compilation and the bytecode
>         interpreter, I'm really not sure that there is.  That's bad; there
>         should be. I'm ccing Simon M in case he knows of something.
>
>
>     Julian Seward wrote some notes on the way GHCi works, which are in
>     the commentary:
>
>     http://hackage.haskell.org/__trac/ghc/wiki/Commentary/__Compiler/Backends/GHCi
>     <http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/GHCi>
>
>     It's not much, but there are some technical details about stacks and
>     suchlike there.  The bytecode itself is a pretty simple stack
>     machine, I can probably answer questions if there's anything you
>     need some help with.
>
>     Cheers,
>              Simon
>
>
>
>     _________________________________________________
>     ghc-devs mailing list
>     ghc-devs at haskell.org <mailto:ghc-devs at haskell.org>
>     http://www.haskell.org/__mailman/listinfo/ghc-devs
>     <http://www.haskell.org/mailman/listinfo/ghc-devs>
>
>



Reply | Threaded
Open this post in threaded view
|

Fwd: GHC internals

Simon Peyton Jones
In reply to this post by Simon Marlow-7
Fantastic.  As Simon says, what would be most helpful is better documentation on the wki, in the Commentary. The root is here
http://hackage.haskell.org/trac/ghc/wiki/Commentary
and the rudimentary GHCi docs are here
          http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/GHCi
If that's too awkward, a link to a PDF would be good, but it's clearly not editable by others.

Simon

From: William Kenyon [mailto:wk249 at cam.ac.uk]
Sent: 30 April 2013 10:28
To: Simon Marlow; Simon Peyton-Jones
Cc: Norman Ramsey; ghc-devs at haskell.org
Subject: Re: Fwd: GHC internals

> If you mean the details of bytecode compilation and the bytecode interpreter, I'm really not sure that there is.  That's bad; there
> should be. I'm ccing Simon M in case he knows of something.

I'm just starting to write detailed documentation for the bytecode generator and interpreter as part of my Masters project,

What format would be most useful for you guys? I could do it in haddock and then include it into my project?
Or just do it in plain latex and make my report publicly available?

Will

On 30 April 2013 10:02, Simon Marlow <marlowsd at gmail.com<mailto:marlowsd at gmail.com>> wrote:
From: *Simon Peyton-Jones* <simonpj at microsoft.com<mailto:simonpj at microsoft.com>
<mailto:simonpj at microsoft.com<mailto:simonpj at microsoft.com>>>


Norman

|    - Is there anything published about the implementation of GHCi?
|      Or perhaps something on the Developers' Wiki that explains how it
works?

If you mean the details of bytecode compilation and the bytecode
interpreter, I'm really not sure that there is.  That's bad; there
should be. I'm ccing Simon M in case he knows of something.

Julian Seward wrote some notes on the way GHCi works, which are in the commentary:

http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/GHCi

It's not much, but there are some technical details about stacks and suchlike there.  The bytecode itself is a pretty simple stack machine, I can probably answer questions if there's anything you need some help with.

Cheers,
        Simon



_______________________________________________
ghc-devs mailing list
ghc-devs at haskell.org<mailto:ghc-devs at haskell.org>
http://www.haskell.org/mailman/listinfo/ghc-devs

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130430/855c8a64/attachment-0001.htm>