PROF_HDR_FIELDS(W_,p1,p2))
/* no return list: explicit stack layout */
{
- /*
+ /*
The final exit.
-
+
The top-top-level closures (e.g., "main") are of type "IO a".
When entered, they perform an IO action and return an 'a' in R1.
-
+
We save R1 on top of the stack where the scheduler can find it,
tidy up the registers and return to the scheduler.
-
+
We Leave the stack looking like this:
-
- +----------------+
+
+ +----------------+
| -------------------> return value
- +----------------+
- | stg_enter_info |
- +----------------+
-
+ +----------------+
+ | stg_enter_info |
+ +----------------+
+
The stg_enter_info is just a dummy info table so that the
garbage collector can understand the stack (there must always
be an info table on top of the stack).
*/
+ // See Note [Unwinding foreign exports on x86-64].
+#if defined(x86_64_HOST_ARCH)
+ unwind UnwindReturnReg = STG_RUN_JMP;
+#else
+ // FIXME: Fill in for other platforms
+ unwind UnwindReturnReg = return;
+#endif
+
Sp = Sp + SIZEOF_StgStopFrame - WDS(2);
Sp(1) = R1;
Sp(0) = stg_enter_info;
// current thread. This is used for switching from compiled execution to the
// interpreter, where calling threadPaused() on every switch would be too
// expensive.
+//
+// See Note [avoiding threadPaused] in Interpreter.c
+//
stg_returnToSchedNotPaused /* no args: explicit stack layout */
{
SAVE_THREAD_STATE();
StgRegTable_rRet(BaseReg) = ThreadFinished;
R1 = BaseReg;
jump StgReturn [R1];
-}
+}
/* -----------------------------------------------------------------------------
Strict IO application - performing an IO action and entering its result.
-
+
rts_evalIO() lets you perform Haskell IO actions from outside of
Haskell-land, returning back to you their result. Want this result
to be evaluated to WHNF by that time, so that we can easily get at
ENTER(ret);
}
-/* -----------------------------------------------------------------------------
- Special STG entry points for module registration.
- -------------------------------------------------------------------------- */
-
-stg_init_finish /* no args: explicit stack layout */
-{
- jump StgReturn [];
-}
-
-/* On entry to stg_init:
- * init_stack[0] = &stg_init_ret;
- * init_stack[1] = __stginit_Something;
- */
-stg_init /* no args: explicit stack layout */
+/* Called when compiled with -falignment-sanitisation on alignment failure */
+stg_badAlignment_entry
{
- W_ next;
- Sp = W_[BaseReg + OFFSET_StgRegTable_rSp];
- next = W_[Sp];
- Sp_adj(1);
- jump next [];
+ foreign "C" barf();
}