/* -----------------------------------------------------------------------------
- * $Id: PrimOps.hc,v 1.40 2000/01/14 11:45:21 hwloidl Exp $
+ * $Id: PrimOps.hc,v 1.46 2000/03/14 09:55:05 simonmar Exp $
*
- * (c) The GHC Team, 1998-1999
+ * (c) The GHC Team, 1998-2000
*
* Primitive functions / data
*
#include "StablePriv.h"
#include "HeapStackCheck.h"
#include "StgRun.h"
+#include "Prelude.h"
/* ** temporary **
#else /* 0 Regs available */
#define PUSH_P(o,x) Sp[-o] = (W_)(x)
-#define PUSH_N(o,x) Sp[1-o] = (W_)(x); /* Sp[-o] = ARGTAG(1) */
+
+#ifdef DEBUG
+#define PUSH_N(o,x) Sp[1-o] = (W_)(x); Sp[-o] = ARG_TAG(1);
+#else
+#define PUSH_N(o,x) Sp[1-o] = (W_)(x);
+#endif
+
#define PUSHED(m) Sp -= (m); JMP_(ENTRY_CODE(Sp[m]));
/* Here's how to construct these macros:
{
/* R1.p = key
R2.p = value
- R3.p = finalizer
+ R3.p = finalizer (or NULL)
*/
StgWeak *w;
FB_
- HP_CHK_GEN_TICKY(sizeofW(StgWeak), R1_PTR|R2_PTR|R3_PTR, mkWeakzh_fast,);
+ if (R3.cl == NULL) {
+ R3.cl = &NO_FINALIZER_closure;
+ }
+
+ HP_CHK_GEN_TICKY(sizeofW(StgWeak),R1_PTR|R2_PTR|R3_PTR, mkWeakzh_fast,);
TICK_ALLOC_PRIM(sizeofW(StgHeader)+1, // +1 is for the link field
sizeofW(StgWeak)-sizeofW(StgHeader)-1, 0);
CCS_ALLOC(CCCS,sizeofW(StgWeak)); /* ccs prof */
w->key = R1.cl;
w->value = R2.cl;
- if (R3.cl) {
- w->finalizer = R3.cl;
- } else {
- w->finalizer = &NO_FINALIZER_closure;
- }
+ w->finalizer = R3.cl;
w->link = weak_ptr_list;
weak_ptr_list = w;
FN_(name) \
{ \
MP_INT arg1, arg2, result; \
- I_ s1, s2; \
+ I_ s1, s2; \
StgArrWords* d1; \
StgArrWords* d2; \
FB_ \
FN_(name) \
{ \
MP_INT arg1, arg2, result1, result2; \
- I_ s1, s2; \
+ I_ s1, s2; \
StgArrWords* d1; \
StgArrWords* d2; \
FB_ \
#endif
if (info == &FULL_MVAR_info) {
- barf("putMVar#: MVar already full");
+#ifdef INTERPRETER
+ fprintf(stderr, "fatal: put on a full MVar in Hugs; aborting\n" );
+ exit(1);
+#else
+ R1.cl = (StgClosure *)PutFullMVar_closure;
+ JMP_(raisezh_fast);
+#endif
}
mvar->value = R2.cl;