... | @@ -6,7 +6,7 @@ Haskell compiler. It defines how the Haskell evaluation model |
... | @@ -6,7 +6,7 @@ Haskell compiler. It defines how the Haskell evaluation model |
|
should be efficiently implemented on standard hardware. Despite
|
|
should be efficiently implemented on standard hardware. Despite
|
|
this key role, it is generally poorly understood amongst GHC users.
|
|
this key role, it is generally poorly understood amongst GHC users.
|
|
This document aims to provide an overview of the STG machine in
|
|
This document aims to provide an overview of the STG machine in
|
|
it's modern, eval/apply-based, pointer-tagged incarnation by a
|
|
its modern, eval/apply-based, pointer-tagged incarnation by a
|
|
series of simple examples showing how Haskell source code is
|
|
series of simple examples showing how Haskell source code is
|
|
compiled.
|
|
compiled.
|
|
|
|
|
... | @@ -650,7 +650,7 @@ overwrites the old pointer to a closure of type ()): |
... | @@ -650,7 +650,7 @@ overwrites the old pointer to a closure of type ()): |
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
Because `known_fun_2` is of arity 2, when we jump to it's entry
|
|
Because `known_fun_2` is of arity 2, when we jump to its entry
|
|
code, it will only consume the top two arguments from the stack:
|
|
code, it will only consume the top two arguments from the stack:
|
|
i.e. the two pointers to `base_GHCziBase_id_closure`. It will then
|
|
i.e. the two pointers to `base_GHCziBase_id_closure`. It will then
|
|
evaluate to some sort of value and transfer control to the entry
|
|
evaluate to some sort of value and transfer control to the entry
|
... | @@ -1047,7 +1047,7 @@ as the `Nothing` or as the `Just` branch of the case: |
... | @@ -1047,7 +1047,7 @@ as the `Nothing` or as the `Just` branch of the case: |
|
|
|
|
|
|
|
|
|
As we saw earlier, any time that the STG machine decides that it
|
|
As we saw earlier, any time that the STG machine decides that it
|
|
has a value in it's hand, it will continue evaluation by
|
|
has a value in its hand, it will continue evaluation by
|
|
tail-calling the entry code found by dereferencing the info-table
|
|
tail-calling the entry code found by dereferencing the info-table
|
|
pointer at the top of the stack. So by putting the address of our
|
|
pointer at the top of the stack. So by putting the address of our
|
|
continuation in here, we ensure that the entry code for `scj_info`
|
|
continuation in here, we ensure that the entry code for `scj_info`
|
... | | ... | |