X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fruntime%2Fc-as-asm%2FStgMiniInt.lc;h=aa4d0e4ac727dd21fde39bbb132ebdbe5f156de2;hb=063eda14b18aadc138bc27eb460e1af93b09ca9b;hp=2739ad7e83940adb2557a145f0da333031b3a059;hpb=e7d21ee4f8ac907665a7e170c71d59e13a01da09;p=ghc-hetmet.git diff --git a/ghc/runtime/c-as-asm/StgMiniInt.lc b/ghc/runtime/c-as-asm/StgMiniInt.lc index 2739ad7..aa4d0e4 100644 --- a/ghc/runtime/c-as-asm/StgMiniInt.lc +++ b/ghc/runtime/c-as-asm/StgMiniInt.lc @@ -43,12 +43,6 @@ less code. \begin{code} #if defined(__STG_TAILJUMPS__) && defined(__GNUC__) -#if i386_TARGET_ARCH || i486_TARGET_ARCH -/* All together now: "Hack me gently, hack me dead ..." */ -P_ SP_stack[8]; /* two/three? is all that is really needed, I think (WDP) */ -I_ SP_stack_ptr = -1; -#endif - void miniInterpret(start_cont) StgFunPtr start_cont; @@ -113,7 +107,7 @@ save and restore the whole of @jmp_environment@. \begin{code} static jmp_buf jmp_environment; -extern void bcopy PROTO((char *, char *, int)); /*ToDo: properly?*/ +void bcopy PROTO((char *, char *, int)); /*ToDo: properly?*/ void miniInterpret(start_cont) @@ -154,91 +148,6 @@ void miniInterpretEnd(STG_NO_ARGS) /* ToDo: save real register in something somewhere */ longjmp(jmp_environment, 1); } -\end{code} - -%************************************************************************ -%* * -\subsubsection[StgMiniInt-portable-debugging]{Debugging mini-interpreter for ``portable~C''} -%* * -%************************************************************************ - -See comments about @jmp_environment@ in section above. - -The debugging mini-interpreter, which is invoked if suitable RTS flags -are given, offers two extra ``features:'' -\begin{description} - -\item[Circular buffer of last @NUM_SAVED_CONTINUATIONS@ continuations:] -These are in @savedCont@, with @savedContCtr@ pointing to where the -last one was slotted in. - -Reference is frequently made to this buffer when \tr{gdb}-ing broken C -out of the compiler! - -\item[Hygiene-checking:] - -This version of the mini-interpreter can be given a hygiene-checking -function which will be invoked each time 'round the loop. Again, -given suitable RTS flags, we pass along a routine that walks over the -stack checking for Bad Stuff. An example might be: pointers from the -A stack into the wrong semi-space of the heap (indicating a -garbage-collection bug)... -\end{description} - -\begin{code} -extern I_ doSanityChks; /* ToDo: move tidily */ - -#define NUM_SAVED_CONTINUATIONS 32 /* For debug */ -I_ totalContCtr; -I_ savedContCtr; -StgFunPtr savedCont[NUM_SAVED_CONTINUATIONS]; - -void miniInterpret_debug(start_cont, hygiene) - StgFunPtr start_cont; - void (*hygiene)(); -{ - StgFunPtr continuation = (StgFunPtr) start_cont; - StgFunPtr next_continuation; - jmp_buf save_buf; - bcopy((char *) jmp_environment, (char *) save_buf, sizeof(jmp_buf)); - /* Save jmp_environment for previous call to miniInterpret */ - - if (setjmp(jmp_environment) == 0) { - - totalContCtr = 0; - savedContCtr = 0; - savedCont[0] = start_cont; - - while ( 1 ) { - next_continuation = (StgFunPtr) (continuation)(); - - totalContCtr += 1; - savedContCtr = (savedContCtr + 1) % NUM_SAVED_CONTINUATIONS; - savedCont[savedContCtr] = next_continuation; - - continuation = next_continuation; - - /* hygiene chk can't be at start of loop, because it's the - first continuation-thingy that loads up the registers. - */ - if (doSanityChks && hygiene) { - (hygiene)(); - } - } - } - /* Restore jmp_environment for previous call */ - bcopy((char *) save_buf, (char *) jmp_environment, sizeof(jmp_buf)); - - /* ToDo: restore real registers ... (see longjmp) */ - return; - /* - Note that on returning (after miniInterpretEnd is called) - the values variables declared as real machine registers - will be undefined. - */ -} - -/* debugging version uses same "miniInterpretEnd" as the regular one */ #endif /* ! __STG_TAILJUMPS__ */ \end{code}