-/* Make a constructor with 1 Int# arg */
-STGFUN(mci_make_constrI_entry)
-{
- nat size, np, nw;
- StgClosure* con;
- StgInfoTable* itbl;
- FB_
- /* Sp[0 & 1] are tag, Addr#
- Sp[2 & 3] are tag, Int#
- */
- itbl = ((StgInfoTable**)Sp)[1];
- np = INFO_PTR_TO_STRUCT(itbl)->layout.payload.ptrs;
- nw = INFO_PTR_TO_STRUCT(itbl)->layout.payload.nptrs;
- size = sizeofW(StgHeader) + stg_max(MIN_NONUPD_SIZE, np+nw);
- /* STGCALL5(fprintf,stderr,"np %d nw %d size %d\n",np,nw,size); */
-
- /* The total number of words to copy off the stack is np + nw.
- That doesn't include tag words, tho.
- */
- HP_CHK_GEN_TICKY(size, NO_PTRS, mci_make_constrI_entry, );
- TICK_ALLOC_PRIM(sizeofW(StgHeader), size-sizeofW(StgHeader), 0);
- CCS_ALLOC(CCCS,size); /* ccs prof */
-
- con = (StgClosure*)(Hp + 1 - size);
- SET_HDR(con, itbl,CCCS);
-
- con->payload[0] = ((StgClosure**)Sp)[3];
- Sp = Sp +1/*word*/ +1/*tag*/; /* Zap the Int# arg */
- Sp = Sp +2; /* Zap the Addr# arg */
- R1.cl = con;
-
- JMP_(ENTRY_CODE(GET_INFO(R1.cl)));
- FE_
-}
+/* When the returned value is in R1 and it isn't a pointer. */
+#define STG_CtoI_RET_R1n_Template(label) \
+ IFN_(label) \
+ { \
+ StgPtr bco; \
+ FB_ \
+ bco = ((StgPtr*)Sp)[1]; \
+ Sp -= 1; \
+ ((StgPtr*)Sp)[0] = (StgPtr)R1.i; \
+ Sp -= 1; \
+ ((StgPtr*)Sp)[0] = (StgPtr)1; /* tag */ \
+ Sp -= 1; \
+ ((StgPtr*)Sp)[0] = bco; \
+ JMP_(stg_yield_to_interpreter); \
+ FE_ \
+ }