2 % (c) Parade/AQUA Projects, Glasgow University, 1995
3 % Kevin Hammond, February 15th. 1995
5 % This is for GUM only.
7 %************************************************************************
9 \section[FetchMe.lhc]{Reading Closures}
11 %************************************************************************
13 This module defines routines for handling remote pointers (@FetchMe@s)
14 in GUM. It is threaded (@.lhc@) because @FetchMe_entry@ will be
15 called during evaluation.
18 #ifdef PAR /* whole file */
20 #define MAIN_REG_MAP /* STG world */
26 EXTDATA_RO(BH_UPD_info);
27 EXTDATA_RO(FetchMe_info);
29 EXTFUN(EnterNodeCode);
38 STGCALL0(void,(),GranSimBlock); /* Do this before losing its TSO_LINK */
41 rGA = FETCHME_GA(Node);
42 ASSERT(rGA->loc.gc.gtid != mytid);
44 TSO_LINK(CurrentTSO) = Nil_closure;
45 SET_INFO_PTR(Node, FMBQ_info);
46 FMBQ_ENTRIES(Node) = (W_) CurrentTSO;
48 LivenessReg = LIVENESS_R1;
50 TSO_PC1(CurrentTSO) = EnterNodeCode;
52 /* Calls out are now safe */
55 QP_Event1("GR", CurrentTSO);
58 if (RTSflags.ParFlags.granSimStats) {
59 /* Note that CURRENT_TIME may perform an unsafe call */
60 TIME now = CURRENT_TIME;
61 TSO_EXECTIME(CurrentTSO) += now - TSO_BLOCKEDAT(CurrentTSO);
62 TSO_FETCHCOUNT(CurrentTSO)++;
63 TSO_QUEUE(CurrentTSO) = Q_FETCHING;
64 TSO_BLOCKEDAT(CurrentTSO) = now;
65 DumpGranEventAndNode(GR_FETCH, CurrentTSO, (SAVE_R1).p,
66 taskIDtoPE(rGA->loc.gc.gtid));
69 /* Assign a brand-new global address to the newly created FMBQ */
70 lGA = MakeGlobal((SAVE_R1).p, rtsFalse);
71 splitWeight(&fmbqGA, lGA);
72 ASSERT(fmbqGA.weight == 1L << (BITS_IN(unsigned) - 1));
74 sendFetch(rGA, &fmbqGA, 0/*load*/);
80 FETCHME_ITBL(FetchMe_info,FetchMe_entry);
84 And for migrated FetchMes that are now blocked on remote blocking queues...
91 /* Don't wrap the calls; we're done with STG land */
92 fprintf(stderr, "Panic: Entered a BlockedFetch\n");
101 @FMBQ@ nodes are @FetchMe@s with blocking queues attached. The fetch has
102 been sent, but no reply has been received yet.
106 EXTFUN(EnterNodeCode);
113 STGCALL0(void,(),GranSimBlock); /* Before overwriting TSO_LINK */
116 TSO_LINK(CurrentTSO) = (P_) FMBQ_ENTRIES(Node);
117 FMBQ_ENTRIES(Node) = (W_) CurrentTSO;
119 LivenessReg = LIVENESS_R1;
121 TSO_PC1(CurrentTSO) = EnterNodeCode;
124 QP_Event1("GR", CurrentTSO);
127 if (RTSflags.ParFlags.granSimStats) {
128 /* Note that CURRENT_TIME may perform an unsafe call */
129 TIME now = CURRENT_TIME;
130 TSO_EXECTIME(CurrentTSO) += now - TSO_BLOCKEDAT(CurrentTSO);
131 TSO_FETCHCOUNT(CurrentTSO)++;
132 TSO_QUEUE(CurrentTSO) = Q_FETCHING;
133 TSO_BLOCKEDAT(CurrentTSO) = now;
134 DumpGranEvent(GR_FETCH, CurrentTSO);
143 #endif /* PAR -- whole file */