X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FStgStdThunks.hc;h=9bc1a21ee8e9e254062cba9ba6b0743cf0c9c92d;hb=50027272414438955dbc41696541cbd25da55883;hp=b54148f469f2419928bec4837aa1b6c7345223eb;hpb=da3c4b445c328c7ea24cab02783edf2aa1c83473;p=ghc-hetmet.git diff --git a/ghc/rts/StgStdThunks.hc b/ghc/rts/StgStdThunks.hc index b54148f..9bc1a21 100644 --- a/ghc/rts/StgStdThunks.hc +++ b/ghc/rts/StgStdThunks.hc @@ -1,13 +1,16 @@ /* ----------------------------------------------------------------------------- - * $Id: StgStdThunks.hc,v 1.8 1999/10/21 09:18:02 simonmar Exp $ + * $Id: StgStdThunks.hc,v 1.15 2001/03/23 16:36:21 simonmar Exp $ * - * (c) The GHC Team, 1998-1999 + * (c) The GHC Team, 1998-2000 * * Canned "Standard Form" Thunks * * ---------------------------------------------------------------------------*/ #include "Stg.h" +#include "Rts.h" +#include "StoragePriv.h" +#include "HeapStackCheck.h" /* ----------------------------------------------------------------------------- The code for a thunk that simply extracts a field from a @@ -39,32 +42,29 @@ #endif #define SELECTOR_CODE_UPD(offset) \ - EF_(__sel_ret_##offset##_upd_ret); \ - INFO_TABLE_SRT_BITMAP(__sel_ret_##offset##_upd_info,__sel_ret_##offset##_upd_ret, RET_BITMAP, 0, 0, 0, RET_SMALL, static, EF_, 0, 0); \ - EF_(__sel_ret_##offset##_upd_ret) { \ + IF_(stg_sel_ret_##offset##_upd_ret); \ + INFO_TABLE_SRT_BITMAP(stg_sel_ret_##offset##_upd_info,stg_sel_ret_##offset##_upd_ret, RET_BITMAP, 0, 0, 0, RET_SMALL, static, EF_, 0, 0); \ + EF_(stg_sel_ret_##offset##_upd_ret) { \ FB_ \ R1.p=(P_)R1.cl->payload[offset]; \ GET_SAVED_CCCS; \ Sp=Sp+sizeofW(StgHeader); \ - TICK_ENT_VIA_NODE(); \ JMP_(ENTRY_CODE(*R1.p)); \ FE_ \ } \ \ - EF_(__sel_##offset##_upd_entry); \ - INFO_TABLE_SELECTOR(__sel_##offset##_upd_info, __sel_##offset##_upd_entry, offset,, EF_, 0,0);\ - EF_(__sel_##offset##_upd_entry) { \ + EF_(stg_sel_##offset##_upd_entry); \ + INFO_TABLE_SELECTOR(stg_sel_##offset##_upd_info, stg_sel_##offset##_upd_entry, offset,, EF_, "stg_sel" #offset "_upd_entry", "stg_sel" #offset "_upd_entry");\ + EF_(stg_sel_##offset##_upd_entry) { \ FB_ \ - TICK_ENT_THK(); \ STK_CHK_NP(UPD_FRAME_SIZE,1,); \ - UPD_BH_UPDATABLE(R1.p); \ + UPD_BH_UPDATABLE(&stg_sel_##offset##_upd_info); \ PUSH_UPD_FRAME(R1.p,0); \ ENTER_CCS(R1.p); \ SAVE_CCCS(UPD_FRAME_SIZE); \ - Sp[-UPD_FRAME_SIZE]=(W_)&__sel_ret_##offset##_upd_info; \ + Sp[-UPD_FRAME_SIZE]=(W_)&stg_sel_ret_##offset##_upd_info; \ R1.p = (P_)R1.cl->payload[0]; \ Sp=Sp-UPD_FRAME_SIZE; \ - TICK_ENT_VIA_NODE(); \ JMP_(ENTRY_CODE(*R1.p)); \ FE_ \ } @@ -87,29 +87,28 @@ SELECTOR_CODE_UPD(14); SELECTOR_CODE_UPD(15); #define SELECTOR_CODE_NOUPD(offset) \ - INFO_TABLE_SRT_BITMAP(__sel_ret_##offset##_noupd_info, __sel_ret_##offset##_noupd_ret, RET_BITMAP, 0, 0, 0, RET_SMALL, static, EF_, 0, 0); \ - EF_(__sel_ret_##offset##_noupd_ret) { \ + IF_(stg_sel_ret_##offset##_noupd_ret); \ + INFO_TABLE_SRT_BITMAP(stg_sel_ret_##offset##_noupd_info, stg_sel_ret_##offset##_noupd_ret, RET_BITMAP, 0, 0, 0, RET_SMALL, static, EF_, 0, 0); \ + IF_(stg_sel_ret_##offset##_noupd_ret) { \ FB_ \ R1.p=(P_)R1.cl->payload[offset]; \ GET_SAVED_CCCS; \ Sp=Sp+sizeofW(StgHeader); \ - TICK_ENT_VIA_NODE(); \ JMP_(ENTRY_CODE(*R1.p)); \ FE_ \ } \ \ - EF_(__sel_##offset##_noupd_entry); \ - INFO_TABLE_SELECTOR(__sel_##offset##_noupd_info, __sel_##offset##_noupd_entry, offset,, EF_, 0,0);\ - EF_(__sel_##offset##_noupd_entry) { \ + EF_(stg_sel_##offset##_noupd_entry); \ + INFO_TABLE_SELECTOR(stg_sel_##offset##_noupd_info, stg_sel_##offset##_noupd_entry, offset,, EF_, "stg_sel" #offset "_noupd_entry", "stg_sel" #offset "_noupd_entry");\ + EF_(stg_sel_##offset##_noupd_entry) { \ FB_ \ - TICK_ENT_THK(); \ STK_CHK_NP(NOUPD_FRAME_SIZE,1,) \ + UPD_BH_SINGLE_ENTRY(&stg_sel_##offset##_noupd_info); \ ENTER_CCS(R1.p); \ SAVE_CCCS(NOUPD_FRAME_SIZE); \ - Sp[-NOUPD_FRAME_SIZE]=(W_)&__sel_ret_##offset##_noupd_info; \ + Sp[-NOUPD_FRAME_SIZE]=(W_)&stg_sel_ret_##offset##_noupd_info; \ R1.p = (P_)R1.cl->payload[0]; \ Sp=Sp-NOUPD_FRAME_SIZE; \ - TICK_ENT_VIA_NODE(); \ JMP_(ENTRY_CODE(*R1.p)); \ FE_ \ } @@ -145,75 +144,68 @@ SELECTOR_CODE_NOUPD(15); works when profiling etc. -------------------------------------------------------------------------- */ -FN_(__ap_1_upd_entry); -FN_(__ap_2_upd_entry); -FN_(__ap_3_upd_entry); -FN_(__ap_4_upd_entry); -FN_(__ap_5_upd_entry); -FN_(__ap_6_upd_entry); -FN_(__ap_7_upd_entry); -FN_(__ap_8_upd_entry); +FN_(stg_ap_1_upd_entry); +FN_(stg_ap_2_upd_entry); +FN_(stg_ap_3_upd_entry); +FN_(stg_ap_4_upd_entry); +FN_(stg_ap_5_upd_entry); +FN_(stg_ap_6_upd_entry); +FN_(stg_ap_7_upd_entry); +FN_(stg_ap_8_upd_entry); #define UF_SIZE (sizeofW(StgUpdateFrame)) -/* __ap_1_upd_info is a bit redundant, but there appears to be a bug - * in the compiler that means __ap_1 is generated occasionally (ToDo) +/* stg_ap_1_upd_info is a bit redundant, but there appears to be a bug + * in the compiler that means stg_ap_1 is generated occasionally (ToDo) */ -INFO_TABLE_SRT(__ap_1_upd_info,__ap_1_upd_entry,1,0,0,0,0,THUNK,,EF_,0,0); -FN_(__ap_1_upd_entry) { +INFO_TABLE_SRT(stg_ap_1_upd_info,stg_ap_1_upd_entry,1,0,0,0,0,THUNK,,EF_,"stg_ap_1_upd_info","stg_ap_1_upd_info"); +FN_(stg_ap_1_upd_entry) { FB_ - TICK_ENT_THK(); STK_CHK_NP(sizeofW(StgUpdateFrame),1,); - UPD_BH_UPDATABLE(R1.p); + UPD_BH_UPDATABLE(&stg_ap_1_upd_info); ENTER_CCS(R1.p); PUSH_UPD_FRAME(R1.p,0); R1.p=(P_)(R1.cl->payload[0]); Sp = Sp - sizeofW(StgUpdateFrame); - TICK_ENT_VIA_NODE(); JMP_(ENTRY_CODE(*R1.p)); FE_ } -INFO_TABLE_SRT(__ap_2_upd_info,__ap_2_upd_entry,2,0,0,0,0,THUNK,,EF_,0,0); -FN_(__ap_2_upd_entry) { +INFO_TABLE_SRT(stg_ap_2_upd_info,stg_ap_2_upd_entry,2,0,0,0,0,THUNK,,EF_,"stg_ap_2_upd_info","stg_ap_2_upd_info"); +FN_(stg_ap_2_upd_entry) { FB_ - TICK_ENT_THK(); STK_CHK_NP(sizeofW(StgUpdateFrame)+1,1,); - UPD_BH_UPDATABLE(R1.p); + UPD_BH_UPDATABLE(&stg_ap_2_upd_info); ENTER_CCS(R1.p); PUSH_UPD_FRAME(R1.p,0); Sp[-UF_SIZE-1]=(W_)(R1.cl->payload[1]); R1.p=(P_)(R1.cl->payload[0]); Sp = Sp - (sizeofW(StgUpdateFrame)+1); - TICK_ENT_VIA_NODE(); JMP_(ENTRY_CODE(*R1.p)); FE_ } -INFO_TABLE_SRT(__ap_3_upd_info,__ap_3_upd_entry,3,0,0,0,0,THUNK,,EF_,0,0); -FN_(__ap_3_upd_entry) { +INFO_TABLE_SRT(stg_ap_3_upd_info,stg_ap_3_upd_entry,3,0,0,0,0,THUNK,,EF_,"stg_ap_3_upd_info","stg_ap_3_upd_info"); +FN_(stg_ap_3_upd_entry) { FB_ - TICK_ENT_THK(); STK_CHK_NP(sizeofW(StgUpdateFrame)+2,1,); - UPD_BH_UPDATABLE(R1.p); + UPD_BH_UPDATABLE(&stg_ap_3_upd_info); ENTER_CCS(R1.p); PUSH_UPD_FRAME(R1.p,0); Sp[-UF_SIZE-1]=(W_)(R1.cl->payload[2]); Sp[-UF_SIZE-2]=(W_)(R1.cl->payload[1]); R1.p=(P_)(R1.cl->payload[0]); Sp = Sp - (sizeofW(StgUpdateFrame)+2); - TICK_ENT_VIA_NODE(); JMP_(ENTRY_CODE(*R1.p)); FE_ } -INFO_TABLE_SRT(__ap_4_upd_info,__ap_4_upd_entry,4,0,0,0,0,THUNK,,EF_,0,0); -FN_(__ap_4_upd_entry) { +INFO_TABLE_SRT(stg_ap_4_upd_info,stg_ap_4_upd_entry,4,0,0,0,0,THUNK,,EF_,"stg_ap_4_upd_info","stg_ap_4_upd_info"); +FN_(stg_ap_4_upd_entry) { FB_ - TICK_ENT_THK(); STK_CHK_NP(sizeofW(StgUpdateFrame)+3,1,); - UPD_BH_UPDATABLE(R1.p); + UPD_BH_UPDATABLE(&stg_ap_4_upd_info); ENTER_CCS(R1.p); PUSH_UPD_FRAME(R1.p,0); Sp[-UF_SIZE-1]=(W_)(R1.cl->payload[3]); @@ -221,17 +213,15 @@ FN_(__ap_4_upd_entry) { Sp[-UF_SIZE-3]=(W_)(R1.cl->payload[1]); R1.p=(P_)(R1.cl->payload[0]); Sp = Sp - (sizeofW(StgUpdateFrame)+3); - TICK_ENT_VIA_NODE(); JMP_(ENTRY_CODE(*R1.p)); FE_ } -INFO_TABLE_SRT(__ap_5_upd_info,__ap_5_upd_entry,5,0,0,0,0,THUNK,,EF_,0,0); -FN_(__ap_5_upd_entry) { +INFO_TABLE_SRT(stg_ap_5_upd_info,stg_ap_5_upd_entry,5,0,0,0,0,THUNK,,EF_,"stg_ap_5_upd_info","stg_ap_5_upd_info"); +FN_(stg_ap_5_upd_entry) { FB_ - TICK_ENT_THK(); STK_CHK_NP(sizeofW(StgUpdateFrame)+4,1,); - UPD_BH_UPDATABLE(R1.p); + UPD_BH_UPDATABLE(&stg_ap_5_upd_info); ENTER_CCS(R1.p); PUSH_UPD_FRAME(R1.p,0); Sp[-UF_SIZE-1]=(W_)(R1.cl->payload[4]); @@ -240,17 +230,15 @@ FN_(__ap_5_upd_entry) { Sp[-UF_SIZE-4]=(W_)(R1.cl->payload[1]); R1.p=(P_)(R1.cl->payload[0]); Sp = Sp - (sizeofW(StgUpdateFrame)+4); - TICK_ENT_VIA_NODE(); JMP_(ENTRY_CODE(*R1.p)); FE_ } -INFO_TABLE_SRT(__ap_6_upd_info,__ap_6_upd_entry,6,0,0,0,0,THUNK,,EF_,0,0); -FN_(__ap_6_upd_entry) { +INFO_TABLE_SRT(stg_ap_6_upd_info,stg_ap_6_upd_entry,6,0,0,0,0,THUNK,,EF_,"stg_ap_6_upd_info","stg_ap_6_upd_info"); +FN_(stg_ap_6_upd_entry) { FB_ - TICK_ENT_THK(); STK_CHK_NP(sizeofW(StgUpdateFrame)+5,1,); - UPD_BH_UPDATABLE(R1.p); + UPD_BH_UPDATABLE(&stg_ap_6_upd_info); ENTER_CCS(R1.p); PUSH_UPD_FRAME(R1.p,0); Sp[-UF_SIZE-1]=(W_)(R1.cl->payload[5]); @@ -260,17 +248,15 @@ FN_(__ap_6_upd_entry) { Sp[-UF_SIZE-5]=(W_)(R1.cl->payload[1]); R1.p=(P_)(R1.cl->payload[0]); Sp = Sp - (sizeofW(StgUpdateFrame)+5); - TICK_ENT_VIA_NODE(); JMP_(ENTRY_CODE(*R1.p)); FE_ } -INFO_TABLE_SRT(__ap_7_upd_info,__ap_7_upd_entry,7,0,0,0,0,THUNK,,EF_,0,0); -FN_(__ap_7_upd_entry) { +INFO_TABLE_SRT(stg_ap_7_upd_info,stg_ap_7_upd_entry,7,0,0,0,0,THUNK,,EF_,"stg_ap_7_upd_info","stg_ap_7_upd_info"); +FN_(stg_ap_7_upd_entry) { FB_ - TICK_ENT_THK(); STK_CHK_NP(sizeofW(StgUpdateFrame)+6,1,); - UPD_BH_UPDATABLE(R1.p); + UPD_BH_UPDATABLE(&stg_ap_7_upd_info); ENTER_CCS(R1.p); PUSH_UPD_FRAME(R1.p,0); Sp[-UF_SIZE-1]=(W_)(R1.cl->payload[6]); @@ -281,17 +267,15 @@ FN_(__ap_7_upd_entry) { Sp[-UF_SIZE-6]=(W_)(R1.cl->payload[1]); R1.p=(P_)(R1.cl->payload[0]); Sp = Sp - (sizeofW(StgUpdateFrame)+6); - TICK_ENT_VIA_NODE(); JMP_(ENTRY_CODE(*R1.p)); FE_ } -INFO_TABLE_SRT(__ap_8_upd_info,__ap_8_upd_entry,8,0,0,0,0,THUNK,,EF_,0,0); -FN_(__ap_8_upd_entry) { +INFO_TABLE_SRT(stg_ap_8_upd_info,stg_ap_8_upd_entry,8,0,0,0,0,THUNK,,EF_,"stg_ap_8_upd_info","stg_ap_8_upd_info"); +FN_(stg_ap_8_upd_entry) { FB_ - TICK_ENT_THK(); STK_CHK_NP(sizeofW(StgUpdateFrame)+7,1,); - UPD_BH_UPDATABLE(R1.p); + UPD_BH_UPDATABLE(&stg_ap_8_upd_info); ENTER_CCS(R1.p); PUSH_UPD_FRAME(R1.p,0); Sp[-UF_SIZE-1]=(W_)(R1.cl->payload[7]); @@ -303,7 +287,6 @@ FN_(__ap_8_upd_entry) { Sp[-UF_SIZE-7]=(W_)(R1.cl->payload[1]); R1.p=(P_)(R1.cl->payload[0]); Sp=Sp-10; - TICK_ENT_VIA_NODE(); JMP_(ENTRY_CODE(*R1.p)); FE_ }