Created
December 18, 2014 12:53
-
-
Save sdiehl/e5c9daab7a6d1da0ede7 to your computer and use it in GitHub Desktop.
GenApply.cmm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DO NOT EDIT! | |
// Automatically generated by GenApply.hs | |
#include "Cmm.h" | |
#include "AutoApply.h" | |
INFO_TABLE_RET(stg_ap_v, RET_SMALL, W_ info_ptr, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_v_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(1)"ptr")); | |
again: | |
if (GETTAG(R1)==1) { | |
Sp_adj(1); | |
jump %GET_ENTRY(R1-1) [R1]; | |
} | |
#ifdef PROFILING | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(1,0,stg_ap_v_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,0,stg_ap_v_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R2 = stg_ap_v_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(1,0,stg_ap_v_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_v_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_v_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_f, RET_SMALL, W_ info_ptr, F_ arg1, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_f_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(2)"ptr")); | |
again: | |
if (GETTAG(R1)==1) { | |
F1 = F_[Sp+WDS(1)]; | |
Sp_adj(2); | |
jump %GET_ENTRY(R1-1) [F1,R1]; | |
} | |
#ifdef PROFILING | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(1,1,stg_ap_f_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
F1 = F_[Sp+WDS(1)]; | |
Sp_adj(2); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [F1,R1]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,1,stg_ap_f_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R2 = stg_ap_f_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(1,1,stg_ap_f_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_f_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_f_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_d, RET_SMALL, W_ info_ptr, D_ arg1, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_d_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(2)"ptr")); | |
again: | |
if (GETTAG(R1)==1) { | |
D1 = D_[Sp+WDS(1)]; | |
Sp_adj(2); | |
jump %GET_ENTRY(R1-1) [D1,R1]; | |
} | |
#ifdef PROFILING | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(1,1,stg_ap_d_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
D1 = D_[Sp+WDS(1)]; | |
Sp_adj(2); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [D1,R1]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,1,stg_ap_d_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R2 = stg_ap_d_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(1,1,stg_ap_d_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_d_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_d_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_l, RET_SMALL, W_ info_ptr, L_ arg1, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_l_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(2)"ptr")); | |
again: | |
if (GETTAG(R1)==1) { | |
Sp_adj(1); | |
jump %GET_ENTRY(R1-1) [R1]; | |
} | |
#ifdef PROFILING | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(1,1,stg_ap_l_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,1,stg_ap_l_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R2 = stg_ap_l_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(1,1,stg_ap_l_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_l_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_l_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_v16, RET_SMALL, W_ info_ptr, V16_ arg1, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_v16_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(3)"ptr")); | |
again: | |
if (GETTAG(R1)==1) { | |
Sp_adj(1); | |
jump %GET_ENTRY(R1-1) [R1]; | |
} | |
#ifdef PROFILING | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(1,2,stg_ap_v16_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,2,stg_ap_v16_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R2 = stg_ap_v16_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(1,2,stg_ap_v16_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_v16_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_v16_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_v32, RET_SMALL, W_ info_ptr, V32_ arg1, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_v32_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(5)"ptr")); | |
again: | |
if (GETTAG(R1)==1) { | |
Sp_adj(1); | |
jump %GET_ENTRY(R1-1) [R1]; | |
} | |
#ifdef PROFILING | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(1,4,stg_ap_v32_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,4,stg_ap_v32_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R2 = stg_ap_v32_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(1,4,stg_ap_v32_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_v32_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_v32_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_v64, RET_SMALL, W_ info_ptr, V64_ arg1, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_v64_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(9)"ptr")); | |
again: | |
if (GETTAG(R1)==1) { | |
Sp_adj(1); | |
jump %GET_ENTRY(R1-1) [R1]; | |
} | |
#ifdef PROFILING | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(1,8,stg_ap_v64_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,8,stg_ap_v64_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R2 = stg_ap_v64_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(1,8,stg_ap_v64_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_v64_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_v64_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_n, RET_SMALL, W_ info_ptr, W_ arg1, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_n_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(2)"ptr")); | |
again: | |
if (GETTAG(R1)==1) { | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(2); | |
jump %GET_ENTRY(R1-1) [R1,R2]; | |
} | |
#ifdef PROFILING | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(1,1,stg_ap_n_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(2); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,1,stg_ap_n_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R2 = stg_ap_n_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(1,1,stg_ap_n_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_n_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_n_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_p, RET_SMALL, W_ info_ptr, gcptr arg1, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_p_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(2)"ptr")); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1))); | |
again: | |
if (GETTAG(R1)==1) { | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(2); | |
jump %GET_ENTRY(R1-1) [R1,R2]; | |
} | |
#ifdef PROFILING | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(1,1,stg_ap_p_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(2); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,1,stg_ap_p_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(1); | |
R2 = stg_ap_p_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(1,1,stg_ap_p_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_p_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_p_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_pv, RET_SMALL, W_ info_ptr, gcptr arg1, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_pv_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(2)"ptr")); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1))); | |
again: | |
if (GETTAG(R1)==2) { | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(2); | |
jump %GET_ENTRY(R1-2) [R1,R2]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(2) < SpLim) { | |
Sp(0) = stg_ap_pv_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_v_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_v_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 2) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(2,1,stg_ap_pv_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_v_info; | |
Sp_adj(-1); | |
#else | |
W_[Sp+WDS(1)] = stg_ap_v_info; | |
Sp_adj(1); | |
#endif | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2]; | |
} | |
if (arity == 2) { | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(2); | |
R1 = R1 + 2; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(2,1,stg_ap_pv_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_v_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_v_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_p_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 2) { | |
Sp_adj(1); | |
R2 = stg_ap_pv_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(2,1,stg_ap_pv_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_pv_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_pv_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_pp, RET_SMALL, W_ info_ptr, gcptr arg1, | |
gcptr arg2, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_pp_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(3)"ptr")); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2))); | |
again: | |
if (GETTAG(R1)==2) { | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(3); | |
jump %GET_ENTRY(R1-2) [R1,R2,R3]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(2) < SpLim) { | |
Sp(0) = stg_ap_pp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_p_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_p_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 2) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(2,2,stg_ap_pp_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_p_info; | |
Sp_adj(-1); | |
#else | |
W_[Sp+WDS(1)] = stg_ap_p_info; | |
Sp_adj(1); | |
#endif | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3]; | |
} | |
if (arity == 2) { | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(3); | |
R1 = R1 + 2; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(2,2,stg_ap_pp_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_p_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_p_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_p_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 2) { | |
Sp_adj(1); | |
R2 = stg_ap_pp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(2,2,stg_ap_pp_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_pp_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_pp_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_ppv, RET_SMALL, W_ info_ptr, gcptr arg1, | |
gcptr arg2, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_ppv_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(3)"ptr")); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2))); | |
again: | |
if (GETTAG(R1)==3) { | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(3); | |
jump %GET_ENTRY(R1-3) [R1,R2,R3]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(2) < SpLim) { | |
Sp(0) = stg_ap_ppv_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_pv_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_pv_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_v_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = stg_ap_v_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 3) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(3,2,stg_ap_ppv_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_pv_info; | |
Sp_adj(-1); | |
#else | |
W_[Sp+WDS(1)] = stg_ap_pv_info; | |
Sp_adj(1); | |
#endif | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3]; | |
} | |
if (arity == 2) { | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_v_info; | |
Sp_adj(0); | |
#else | |
W_[Sp+WDS(2)] = stg_ap_v_info; | |
Sp_adj(2); | |
#endif | |
R1 = R1 + 2; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3]; | |
} | |
if (arity == 3) { | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(3); | |
R1 = R1 + 3; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(3,2,stg_ap_ppv_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_pv_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_pv_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_p_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_v_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = stg_ap_v_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_pp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 3) { | |
Sp_adj(1); | |
R2 = stg_ap_ppv_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(3,2,stg_ap_ppv_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_ppv_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_ppv_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_ppp, RET_SMALL, W_ info_ptr, gcptr arg1, | |
gcptr arg2, | |
gcptr arg3, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_ppp_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(4)"ptr")); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(3))); | |
again: | |
if (GETTAG(R1)==3) { | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(4); | |
jump %GET_ENTRY(R1-3) [R1,R2,R3,R4]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(2) < SpLim) { | |
Sp(0) = stg_ap_ppp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_pp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_pp_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_p_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = stg_ap_p_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 3) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(3,3,stg_ap_ppp_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_pp_info; | |
Sp_adj(-1); | |
#else | |
W_[Sp+WDS(1)] = stg_ap_pp_info; | |
Sp_adj(1); | |
#endif | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
if (arity == 2) { | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_p_info; | |
Sp_adj(0); | |
#else | |
W_[Sp+WDS(2)] = stg_ap_p_info; | |
Sp_adj(2); | |
#endif | |
R1 = R1 + 2; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
if (arity == 3) { | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(4); | |
R1 = R1 + 3; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(3,3,stg_ap_ppp_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_pp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_pp_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_p_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_p_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = stg_ap_p_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_pp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 3) { | |
Sp_adj(1); | |
R2 = stg_ap_ppp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(3,3,stg_ap_ppp_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_ppp_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_ppp_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_pppv, RET_SMALL, W_ info_ptr, gcptr arg1, | |
gcptr arg2, | |
gcptr arg3, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_pppv_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(4)"ptr")); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(3))); | |
again: | |
if (GETTAG(R1)==4) { | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(4); | |
jump %GET_ENTRY(R1-4) [R1,R2,R3,R4]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(2) < SpLim) { | |
Sp(0) = stg_ap_pppv_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_ppv_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_ppv_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_pv_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = stg_ap_pv_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 3) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(2)] = CCCS; | |
W_[Sp+WDS(3)] = stg_ap_v_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = stg_ap_v_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 4) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(4,3,stg_ap_pppv_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_ppv_info; | |
Sp_adj(-1); | |
#else | |
W_[Sp+WDS(1)] = stg_ap_ppv_info; | |
Sp_adj(1); | |
#endif | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
if (arity == 2) { | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_pv_info; | |
Sp_adj(0); | |
#else | |
W_[Sp+WDS(2)] = stg_ap_pv_info; | |
Sp_adj(2); | |
#endif | |
R1 = R1 + 2; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
if (arity == 3) { | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(2)] = CCCS; | |
W_[Sp+WDS(3)] = stg_ap_v_info; | |
Sp_adj(1); | |
#else | |
W_[Sp+WDS(3)] = stg_ap_v_info; | |
Sp_adj(3); | |
#endif | |
R1 = R1 + 3; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
if (arity == 4) { | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(4); | |
R1 = R1 + 4; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(4,3,stg_ap_pppv_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_ppv_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_ppv_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_p_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_pv_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = stg_ap_pv_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_pp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 3) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(2)] = CCCS; | |
W_[Sp+WDS(3)] = stg_ap_v_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = stg_ap_v_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_ppp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 4) { | |
Sp_adj(1); | |
R2 = stg_ap_pppv_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(4,3,stg_ap_pppv_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_pppv_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_pppv_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_pppp, RET_SMALL, W_ info_ptr, gcptr arg1, | |
gcptr arg2, | |
gcptr arg3, | |
gcptr arg4, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_pppp_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(5)"ptr")); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(3))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(4))); | |
again: | |
if (GETTAG(R1)==4) { | |
R5 = W_[Sp+WDS(4)]; | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(5); | |
jump %GET_ENTRY(R1-4) [R1,R2,R3,R4,R5]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(2) < SpLim) { | |
Sp(0) = stg_ap_pppp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_ppp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_ppp_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_pp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = stg_ap_pp_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 3) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(2)] = CCCS; | |
W_[Sp+WDS(3)] = stg_ap_p_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = stg_ap_p_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 4) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(4,4,stg_ap_pppp_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_ppp_info; | |
Sp_adj(-1); | |
#else | |
W_[Sp+WDS(1)] = stg_ap_ppp_info; | |
Sp_adj(1); | |
#endif | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5]; | |
} | |
if (arity == 2) { | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_pp_info; | |
Sp_adj(0); | |
#else | |
W_[Sp+WDS(2)] = stg_ap_pp_info; | |
Sp_adj(2); | |
#endif | |
R1 = R1 + 2; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5]; | |
} | |
if (arity == 3) { | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(2)] = CCCS; | |
W_[Sp+WDS(3)] = stg_ap_p_info; | |
Sp_adj(1); | |
#else | |
W_[Sp+WDS(3)] = stg_ap_p_info; | |
Sp_adj(3); | |
#endif | |
R1 = R1 + 3; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5]; | |
} | |
if (arity == 4) { | |
R5 = W_[Sp+WDS(4)]; | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(5); | |
R1 = R1 + 4; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(4,4,stg_ap_pppp_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_ppp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_ppp_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_p_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_pp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = stg_ap_pp_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_pp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 3) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(2)] = CCCS; | |
W_[Sp+WDS(3)] = stg_ap_p_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = stg_ap_p_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_ppp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 4) { | |
Sp_adj(1); | |
R2 = stg_ap_pppp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(4,4,stg_ap_pppp_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_pppp_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_pppp_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_ppppp, RET_SMALL, W_ info_ptr, gcptr arg1, | |
gcptr arg2, | |
gcptr arg3, | |
gcptr arg4, | |
gcptr arg5, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_ppppp_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(6)"ptr")); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(3))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(4))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(5))); | |
again: | |
if (GETTAG(R1)==5) { | |
R6 = W_[Sp+WDS(5)]; | |
R5 = W_[Sp+WDS(4)]; | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(6); | |
jump %GET_ENTRY(R1-5) [R1,R2,R3,R4,R5,R6]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(2) < SpLim) { | |
Sp(0) = stg_ap_ppppp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_pppp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_pppp_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_ppp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = stg_ap_ppp_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 3) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(2)] = CCCS; | |
W_[Sp+WDS(3)] = stg_ap_pp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = stg_ap_pp_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 4) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(4)]; | |
W_[Sp+WDS(2)] = stg_restore_cccs_info; | |
W_[Sp+WDS(3)] = CCCS; | |
W_[Sp+WDS(4)] = stg_ap_p_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = W_[Sp+WDS(4)]; | |
W_[Sp+WDS(4)] = stg_ap_p_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 5) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(5,5,stg_ap_ppppp_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_pppp_info; | |
Sp_adj(-1); | |
#else | |
W_[Sp+WDS(1)] = stg_ap_pppp_info; | |
Sp_adj(1); | |
#endif | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
if (arity == 2) { | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_ppp_info; | |
Sp_adj(0); | |
#else | |
W_[Sp+WDS(2)] = stg_ap_ppp_info; | |
Sp_adj(2); | |
#endif | |
R1 = R1 + 2; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
if (arity == 3) { | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(2)] = CCCS; | |
W_[Sp+WDS(3)] = stg_ap_pp_info; | |
Sp_adj(1); | |
#else | |
W_[Sp+WDS(3)] = stg_ap_pp_info; | |
Sp_adj(3); | |
#endif | |
R1 = R1 + 3; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
if (arity == 4) { | |
R5 = W_[Sp+WDS(4)]; | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(2)] = stg_restore_cccs_info; | |
W_[Sp+WDS(3)] = CCCS; | |
W_[Sp+WDS(4)] = stg_ap_p_info; | |
Sp_adj(2); | |
#else | |
W_[Sp+WDS(4)] = stg_ap_p_info; | |
Sp_adj(4); | |
#endif | |
R1 = R1 + 4; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
if (arity == 5) { | |
R6 = W_[Sp+WDS(5)]; | |
R5 = W_[Sp+WDS(4)]; | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(6); | |
R1 = R1 + 5; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(5,5,stg_ap_ppppp_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_pppp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_pppp_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_p_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_ppp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = stg_ap_ppp_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_pp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 3) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(2)] = CCCS; | |
W_[Sp+WDS(3)] = stg_ap_pp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = stg_ap_pp_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_ppp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 4) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(4)]; | |
W_[Sp+WDS(2)] = stg_restore_cccs_info; | |
W_[Sp+WDS(3)] = CCCS; | |
W_[Sp+WDS(4)] = stg_ap_p_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = W_[Sp+WDS(4)]; | |
W_[Sp+WDS(4)] = stg_ap_p_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_pppp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 5) { | |
Sp_adj(1); | |
R2 = stg_ap_ppppp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(5,5,stg_ap_ppppp_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_ppppp_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_ppppp_ret") never returns; | |
} | |
} | |
} | |
INFO_TABLE_RET(stg_ap_pppppp, RET_SMALL, W_ info_ptr, gcptr arg1, | |
gcptr arg2, | |
gcptr arg3, | |
gcptr arg4, | |
gcptr arg5, | |
gcptr arg6, ) | |
{ | |
W_ info; | |
W_ arity; | |
IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_pppppp_ret... "); foreign "C" printClosure(R1 "ptr")); | |
IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(7)"ptr")); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(3))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(4))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(5))); | |
ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(6))); | |
again: | |
if (GETTAG(R1)==6) { | |
R6 = W_[Sp+WDS(5)]; | |
R5 = W_[Sp+WDS(4)]; | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(6); | |
jump %GET_ENTRY(R1-6) [R1,R2,R3,R4,R5,R6]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(2) < SpLim) { | |
Sp(0) = stg_ap_pppppp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
#endif | |
R1 = UNTAG(R1); | |
info = %INFO_PTR(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) { | |
case BCO: { | |
arity = TO_W_(StgBCO_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_ppppp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_ppppp_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_pppp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = stg_ap_pppp_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 3) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(2)] = CCCS; | |
W_[Sp+WDS(3)] = stg_ap_ppp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = stg_ap_ppp_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 4) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(4)]; | |
W_[Sp+WDS(2)] = stg_restore_cccs_info; | |
W_[Sp+WDS(3)] = CCCS; | |
W_[Sp+WDS(4)] = stg_ap_pp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = W_[Sp+WDS(4)]; | |
W_[Sp+WDS(4)] = stg_ap_pp_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 5) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(4)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(5)]; | |
W_[Sp+WDS(3)] = stg_restore_cccs_info; | |
W_[Sp+WDS(4)] = CCCS; | |
W_[Sp+WDS(5)] = stg_ap_p_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = W_[Sp+WDS(4)]; | |
W_[Sp+WDS(4)] = W_[Sp+WDS(5)]; | |
W_[Sp+WDS(5)] = stg_ap_p_info; | |
Sp_adj(0); | |
#endif | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} | |
if (arity == 6) { | |
Sp_adj(1); | |
jump ENTRY_LBL(stg_BCO) [R1]; | |
} else { | |
BUILD_PAP(6,6,stg_ap_pppppp_info,BCO); | |
} | |
} | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_ppppp_info; | |
Sp_adj(-1); | |
#else | |
W_[Sp+WDS(1)] = stg_ap_ppppp_info; | |
Sp_adj(1); | |
#endif | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
if (arity == 2) { | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_pppp_info; | |
Sp_adj(0); | |
#else | |
W_[Sp+WDS(2)] = stg_ap_pppp_info; | |
Sp_adj(2); | |
#endif | |
R1 = R1 + 2; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
if (arity == 3) { | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(2)] = CCCS; | |
W_[Sp+WDS(3)] = stg_ap_ppp_info; | |
Sp_adj(1); | |
#else | |
W_[Sp+WDS(3)] = stg_ap_ppp_info; | |
Sp_adj(3); | |
#endif | |
R1 = R1 + 3; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
if (arity == 4) { | |
R5 = W_[Sp+WDS(4)]; | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(2)] = stg_restore_cccs_info; | |
W_[Sp+WDS(3)] = CCCS; | |
W_[Sp+WDS(4)] = stg_ap_pp_info; | |
Sp_adj(2); | |
#else | |
W_[Sp+WDS(4)] = stg_ap_pp_info; | |
Sp_adj(4); | |
#endif | |
R1 = R1 + 4; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
if (arity == 5) { | |
R6 = W_[Sp+WDS(5)]; | |
R5 = W_[Sp+WDS(4)]; | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
#ifdef PROFILING | |
W_[Sp+WDS(3)] = stg_restore_cccs_info; | |
W_[Sp+WDS(4)] = CCCS; | |
W_[Sp+WDS(5)] = stg_ap_p_info; | |
Sp_adj(3); | |
#else | |
W_[Sp+WDS(5)] = stg_ap_p_info; | |
Sp_adj(5); | |
#endif | |
R1 = R1 + 5; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
if (arity == 6) { | |
R6 = W_[Sp+WDS(5)]; | |
R5 = W_[Sp+WDS(4)]; | |
R4 = W_[Sp+WDS(3)]; | |
R3 = W_[Sp+WDS(2)]; | |
R2 = W_[Sp+WDS(1)]; | |
Sp_adj(6); | |
R1 = R1 + 6; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} else { | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(6,6,stg_ap_pppppp_info,FUN); | |
} | |
} | |
case PAP: { | |
arity = TO_W_(StgPAP_arity(R1)); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(0)] = CCCS; | |
W_[Sp+WDS(1)] = stg_ap_ppppp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = stg_ap_ppppp_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_p_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = stg_restore_cccs_info; | |
W_[Sp+WDS(1)] = CCCS; | |
W_[Sp+WDS(2)] = stg_ap_pppp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = stg_ap_pppp_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_pp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 3) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = stg_restore_cccs_info; | |
W_[Sp+WDS(2)] = CCCS; | |
W_[Sp+WDS(3)] = stg_ap_ppp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = stg_ap_ppp_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_ppp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 4) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(4)]; | |
W_[Sp+WDS(2)] = stg_restore_cccs_info; | |
W_[Sp+WDS(3)] = CCCS; | |
W_[Sp+WDS(4)] = stg_ap_pp_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = W_[Sp+WDS(4)]; | |
W_[Sp+WDS(4)] = stg_ap_pp_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_pppp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 5) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-2)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(-1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(0)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(4)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(5)]; | |
W_[Sp+WDS(3)] = stg_restore_cccs_info; | |
W_[Sp+WDS(4)] = CCCS; | |
W_[Sp+WDS(5)] = stg_ap_p_info; | |
Sp_adj(-2); | |
#else | |
W_[Sp+WDS(0)] = W_[Sp+WDS(1)]; | |
W_[Sp+WDS(1)] = W_[Sp+WDS(2)]; | |
W_[Sp+WDS(2)] = W_[Sp+WDS(3)]; | |
W_[Sp+WDS(3)] = W_[Sp+WDS(4)]; | |
W_[Sp+WDS(4)] = W_[Sp+WDS(5)]; | |
W_[Sp+WDS(5)] = stg_ap_p_info; | |
Sp_adj(0); | |
#endif | |
R2 = stg_ap_ppppp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} | |
if (arity == 6) { | |
Sp_adj(1); | |
R2 = stg_ap_pppppp_info; | |
jump stg_PAP_apply [R1,R2]; | |
} else { | |
NEW_PAP(6,6,stg_ap_pppppp_info,PAP); | |
} | |
} | |
case AP, | |
AP_STACK, | |
BLACKHOLE, | |
WHITEHOLE, | |
THUNK, | |
THUNK_1_0, | |
THUNK_0_1, | |
THUNK_2_0, | |
THUNK_1_1, | |
THUNK_0_2, | |
THUNK_STATIC, | |
THUNK_SELECTOR: { | |
Sp(0) = stg_ap_pppppp_info; | |
jump_SAVE_CCCS(%ENTRY_CODE(info)); | |
} | |
case IND, | |
IND_STATIC, | |
IND_PERM: { | |
R1 = StgInd_indirectee(R1); | |
goto again; | |
} | |
default: { | |
foreign "C" barf("stg_ap_pppppp_ret") never returns; | |
} | |
} | |
} | |
stg_ap_stk_ | |
{ Sp_adj(0); | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} | |
stg_stk_save_ | |
{ Sp_adj(-3); | |
Sp(2) = R1; | |
Sp(1) = 0; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_n | |
{ R2 = W_[Sp+WDS(0)]; | |
Sp_adj(1); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2]; | |
} | |
stg_stk_save_n | |
{ Sp_adj(-4); | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 1; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_p | |
{ R2 = W_[Sp+WDS(0)]; | |
Sp_adj(1); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2]; | |
} | |
stg_stk_save_p | |
{ Sp_adj(-4); | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 1; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_f | |
{ F1 = F_[Sp+WDS(0)]; | |
Sp_adj(1); | |
jump %GET_ENTRY(UNTAG(R1)) [F1,R1]; | |
} | |
stg_stk_save_f | |
{ Sp_adj(-4); | |
F_[Sp+WDS(3)] = F1; | |
Sp(2) = R1; | |
Sp(1) = 1; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_d | |
{ D1 = D_[Sp+WDS(0)]; | |
Sp_adj(1); | |
jump %GET_ENTRY(UNTAG(R1)) [D1,R1]; | |
} | |
stg_stk_save_d | |
{ Sp_adj(-4); | |
D_[Sp+WDS(3)] = D1; | |
Sp(2) = R1; | |
Sp(1) = 1; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_l | |
{ Sp_adj(0); | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} | |
stg_stk_save_l | |
{ Sp_adj(-3); | |
Sp(2) = R1; | |
Sp(1) = 1; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_v16 | |
{ Sp_adj(0); | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} | |
stg_stk_save_v16 | |
{ Sp_adj(-3); | |
Sp(2) = R1; | |
Sp(1) = 2; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_v32 | |
{ Sp_adj(0); | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} | |
stg_stk_save_v32 | |
{ Sp_adj(-3); | |
Sp(2) = R1; | |
Sp(1) = 4; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_v64 | |
{ Sp_adj(0); | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} | |
stg_stk_save_v64 | |
{ Sp_adj(-3); | |
Sp(2) = R1; | |
Sp(1) = 8; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_nn | |
{ R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(2); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3]; | |
} | |
stg_stk_save_nn | |
{ Sp_adj(-5); | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 2; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_np | |
{ R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(2); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3]; | |
} | |
stg_stk_save_np | |
{ Sp_adj(-5); | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 2; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_pn | |
{ R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(2); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3]; | |
} | |
stg_stk_save_pn | |
{ Sp_adj(-5); | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 2; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_pp | |
{ R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(2); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3]; | |
} | |
stg_stk_save_pp | |
{ Sp_adj(-5); | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 2; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_nnn | |
{ R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(3); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
stg_stk_save_nnn | |
{ Sp_adj(-6); | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 3; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_nnp | |
{ R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(3); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
stg_stk_save_nnp | |
{ Sp_adj(-6); | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 3; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_npn | |
{ R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(3); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
stg_stk_save_npn | |
{ Sp_adj(-6); | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 3; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_npp | |
{ R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(3); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
stg_stk_save_npp | |
{ Sp_adj(-6); | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 3; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_pnn | |
{ R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(3); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
stg_stk_save_pnn | |
{ Sp_adj(-6); | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 3; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_pnp | |
{ R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(3); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
stg_stk_save_pnp | |
{ Sp_adj(-6); | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 3; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_ppn | |
{ R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(3); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
stg_stk_save_ppn | |
{ Sp_adj(-6); | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 3; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_ppp | |
{ R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(3); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
stg_stk_save_ppp | |
{ Sp_adj(-6); | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 3; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_pppp | |
{ R5 = W_[Sp+WDS(3)]; | |
R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(4); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5]; | |
} | |
stg_stk_save_pppp | |
{ Sp_adj(-7); | |
W_[Sp+WDS(6)] = R5; | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 4; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_ppppp | |
{ R6 = W_[Sp+WDS(4)]; | |
R5 = W_[Sp+WDS(3)]; | |
R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(5); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
stg_stk_save_ppppp | |
{ Sp_adj(-8); | |
W_[Sp+WDS(7)] = R6; | |
W_[Sp+WDS(6)] = R5; | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 5; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_pppppp | |
{ R6 = W_[Sp+WDS(4)]; | |
R5 = W_[Sp+WDS(3)]; | |
R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(5); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
stg_stk_save_pppppp | |
{ Sp_adj(-8); | |
W_[Sp+WDS(7)] = R6; | |
W_[Sp+WDS(6)] = R5; | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 6; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_ppppppp | |
{ R6 = W_[Sp+WDS(4)]; | |
R5 = W_[Sp+WDS(3)]; | |
R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(5); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
stg_stk_save_ppppppp | |
{ Sp_adj(-8); | |
W_[Sp+WDS(7)] = R6; | |
W_[Sp+WDS(6)] = R5; | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 7; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_stk_pppppppp | |
{ R6 = W_[Sp+WDS(4)]; | |
R5 = W_[Sp+WDS(3)]; | |
R4 = W_[Sp+WDS(2)]; | |
R3 = W_[Sp+WDS(1)]; | |
R2 = W_[Sp+WDS(0)]; | |
Sp_adj(5); | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
stg_stk_save_pppppppp | |
{ Sp_adj(-8); | |
W_[Sp+WDS(7)] = R6; | |
W_[Sp+WDS(6)] = R5; | |
W_[Sp+WDS(5)] = R4; | |
W_[Sp+WDS(4)] = R3; | |
W_[Sp+WDS(3)] = R2; | |
Sp(2) = R1; | |
Sp(1) = 8; | |
Sp(0) = stg_gc_fun_info; | |
jump stg_gc_noregs []; | |
} | |
stg_ap_v_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==1) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-1) [R1]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(1) < SpLim) { | |
Sp_adj(-1); | |
Sp(0) = stg_ap_v_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(1) < SpLim) { | |
Sp_adj(-1); | |
Sp(0) = stg_ap_v_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(0); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} else { | |
Sp_adj(-1); | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,0,stg_ap_v_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-1); | |
jump RET_LBL(stg_ap_v) []; | |
} | |
} | |
} | |
stg_ap_f_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==1) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-1) [F1,R1]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(2) < SpLim) { | |
Sp_adj(-2); | |
F_[Sp+WDS(1)] = F1; | |
Sp(0) = stg_ap_f_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(2) < SpLim) { | |
Sp_adj(-2); | |
F_[Sp+WDS(1)] = F1; | |
Sp(0) = stg_ap_f_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(0); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [F1,R1]; | |
} else { | |
Sp_adj(-2); | |
F_[Sp+WDS(1)] = F1; | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,1,stg_ap_f_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-2); | |
F_[Sp+WDS(1)] = F1; | |
jump RET_LBL(stg_ap_f) []; | |
} | |
} | |
} | |
stg_ap_d_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==1) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-1) [D1,R1]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(2) < SpLim) { | |
Sp_adj(-2); | |
D_[Sp+WDS(1)] = D1; | |
Sp(0) = stg_ap_d_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(2) < SpLim) { | |
Sp_adj(-2); | |
D_[Sp+WDS(1)] = D1; | |
Sp(0) = stg_ap_d_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(0); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [D1,R1]; | |
} else { | |
Sp_adj(-2); | |
D_[Sp+WDS(1)] = D1; | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,1,stg_ap_d_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-2); | |
D_[Sp+WDS(1)] = D1; | |
jump RET_LBL(stg_ap_d) []; | |
} | |
} | |
} | |
stg_ap_l_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==1) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-1) [R1]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(1) < SpLim) { | |
Sp_adj(-1); | |
Sp(0) = stg_ap_l_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(1) < SpLim) { | |
Sp_adj(-1); | |
Sp(0) = stg_ap_l_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(0); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} else { | |
Sp_adj(-1); | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,1,stg_ap_l_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-1); | |
jump RET_LBL(stg_ap_l) []; | |
} | |
} | |
} | |
stg_ap_v16_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==1) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-1) [R1]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(1) < SpLim) { | |
Sp_adj(-1); | |
Sp(0) = stg_ap_v16_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(1) < SpLim) { | |
Sp_adj(-1); | |
Sp(0) = stg_ap_v16_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(0); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} else { | |
Sp_adj(-1); | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,2,stg_ap_v16_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-1); | |
jump RET_LBL(stg_ap_v16) []; | |
} | |
} | |
} | |
stg_ap_v32_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==1) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-1) [R1]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(1) < SpLim) { | |
Sp_adj(-1); | |
Sp(0) = stg_ap_v32_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(1) < SpLim) { | |
Sp_adj(-1); | |
Sp(0) = stg_ap_v32_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(0); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} else { | |
Sp_adj(-1); | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,4,stg_ap_v32_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-1); | |
jump RET_LBL(stg_ap_v32) []; | |
} | |
} | |
} | |
stg_ap_v64_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==1) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-1) [R1]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(1) < SpLim) { | |
Sp_adj(-1); | |
Sp(0) = stg_ap_v64_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(1) < SpLim) { | |
Sp_adj(-1); | |
Sp(0) = stg_ap_v64_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(0); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1]; | |
} else { | |
Sp_adj(-1); | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,8,stg_ap_v64_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-1); | |
jump RET_LBL(stg_ap_v64) []; | |
} | |
} | |
} | |
stg_ap_n_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==1) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-1) [R1,R2]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(2) < SpLim) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_n_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(2) < SpLim) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_n_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(0); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2]; | |
} else { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R2; | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,1,stg_ap_n_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R2; | |
jump RET_LBL(stg_ap_n) []; | |
} | |
} | |
} | |
stg_ap_p_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==1) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-1) [R1,R2]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(2) < SpLim) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_p_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(2) < SpLim) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_p_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(0); | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2]; | |
} else { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R2; | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(1,1,stg_ap_p_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R2; | |
jump RET_LBL(stg_ap_p) []; | |
} | |
} | |
} | |
stg_ap_pv_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==2) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-2) [R1,R2]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(3) < SpLim) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_pv_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(2) < SpLim) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_pv_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-3)] = stg_restore_cccs_info; | |
W_[Sp+WDS(-2)] = CCCS; | |
W_[Sp+WDS(-1)] = stg_ap_v_info; | |
Sp_adj(-3); | |
#else | |
W_[Sp+WDS(-1)] = stg_ap_v_info; | |
Sp_adj(-1); | |
#endif | |
R1 = R1 + 1; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2]; | |
} | |
if (arity == 2) { | |
Sp_adj(0); | |
R1 = R1 + 2; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2]; | |
} else { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R2; | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(2,1,stg_ap_pv_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R2; | |
jump RET_LBL(stg_ap_pv) []; | |
} | |
} | |
} | |
stg_ap_pp_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==2) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-2) [R1,R2,R3]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(3) < SpLim) { | |
Sp_adj(-3); | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_pp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(3) < SpLim) { | |
Sp_adj(-3); | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_pp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R3; | |
W_[Sp+WDS(0)] = stg_ap_p_info; | |
R1 = R1 + 1; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 2) { | |
Sp_adj(0); | |
R1 = R1 + 2; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3]; | |
} else { | |
Sp_adj(-3); | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(2,2,stg_ap_pp_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-3); | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
jump RET_LBL(stg_ap_pp) []; | |
} | |
} | |
} | |
stg_ap_ppv_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==3) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-3) [R1,R2,R3]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(3) < SpLim) { | |
Sp_adj(-3); | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_ppv_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(3) < SpLim) { | |
Sp_adj(-3); | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_ppv_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R3; | |
W_[Sp+WDS(0)] = stg_ap_pv_info; | |
R1 = R1 + 1; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 2) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-3)] = stg_restore_cccs_info; | |
W_[Sp+WDS(-2)] = CCCS; | |
W_[Sp+WDS(-1)] = stg_ap_v_info; | |
Sp_adj(-3); | |
#else | |
W_[Sp+WDS(-1)] = stg_ap_v_info; | |
Sp_adj(-1); | |
#endif | |
R1 = R1 + 2; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3]; | |
} | |
if (arity == 3) { | |
Sp_adj(0); | |
R1 = R1 + 3; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3]; | |
} else { | |
Sp_adj(-3); | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(3,2,stg_ap_ppv_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-3); | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
jump RET_LBL(stg_ap_ppv) []; | |
} | |
} | |
} | |
stg_ap_ppp_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==3) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-3) [R1,R2,R3,R4]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(4) < SpLim) { | |
Sp_adj(-4); | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_ppp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(4) < SpLim) { | |
Sp_adj(-4); | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_ppp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(-3); | |
W_[Sp+WDS(1)] = R3; | |
W_[Sp+WDS(2)] = R4; | |
W_[Sp+WDS(0)] = stg_ap_pp_info; | |
R1 = R1 + 1; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 2) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R4; | |
W_[Sp+WDS(0)] = stg_ap_p_info; | |
R1 = R1 + 2; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 3) { | |
Sp_adj(0); | |
R1 = R1 + 3; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} else { | |
Sp_adj(-4); | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(3,3,stg_ap_ppp_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-4); | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
jump RET_LBL(stg_ap_ppp) []; | |
} | |
} | |
} | |
stg_ap_pppv_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==4) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-4) [R1,R2,R3,R4]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(4) < SpLim) { | |
Sp_adj(-4); | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_pppv_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(4) < SpLim) { | |
Sp_adj(-4); | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_pppv_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(-3); | |
W_[Sp+WDS(1)] = R3; | |
W_[Sp+WDS(2)] = R4; | |
W_[Sp+WDS(0)] = stg_ap_ppv_info; | |
R1 = R1 + 1; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 2) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R4; | |
W_[Sp+WDS(0)] = stg_ap_pv_info; | |
R1 = R1 + 2; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 3) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-3)] = stg_restore_cccs_info; | |
W_[Sp+WDS(-2)] = CCCS; | |
W_[Sp+WDS(-1)] = stg_ap_v_info; | |
Sp_adj(-3); | |
#else | |
W_[Sp+WDS(-1)] = stg_ap_v_info; | |
Sp_adj(-1); | |
#endif | |
R1 = R1 + 3; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} | |
if (arity == 4) { | |
Sp_adj(0); | |
R1 = R1 + 4; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4]; | |
} else { | |
Sp_adj(-4); | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(4,3,stg_ap_pppv_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-4); | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
jump RET_LBL(stg_ap_pppv) []; | |
} | |
} | |
} | |
stg_ap_pppp_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==4) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-4) [R1,R2,R3,R4,R5]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(5) < SpLim) { | |
Sp_adj(-5); | |
W_[Sp+WDS(4)] = R5; | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_pppp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(5) < SpLim) { | |
Sp_adj(-5); | |
W_[Sp+WDS(4)] = R5; | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_pppp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(-4); | |
W_[Sp+WDS(1)] = R3; | |
W_[Sp+WDS(2)] = R4; | |
W_[Sp+WDS(3)] = R5; | |
W_[Sp+WDS(0)] = stg_ap_ppp_info; | |
R1 = R1 + 1; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 2) { | |
Sp_adj(-3); | |
W_[Sp+WDS(1)] = R4; | |
W_[Sp+WDS(2)] = R5; | |
W_[Sp+WDS(0)] = stg_ap_pp_info; | |
R1 = R1 + 2; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 3) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R5; | |
W_[Sp+WDS(0)] = stg_ap_p_info; | |
R1 = R1 + 3; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 4) { | |
Sp_adj(0); | |
R1 = R1 + 4; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5]; | |
} else { | |
Sp_adj(-5); | |
W_[Sp+WDS(4)] = R5; | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(4,4,stg_ap_pppp_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-5); | |
W_[Sp+WDS(4)] = R5; | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
jump RET_LBL(stg_ap_pppp) []; | |
} | |
} | |
} | |
stg_ap_ppppp_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==5) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-5) [R1,R2,R3,R4,R5,R6]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(6) < SpLim) { | |
Sp_adj(-6); | |
W_[Sp+WDS(5)] = R6; | |
W_[Sp+WDS(4)] = R5; | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_ppppp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(6) < SpLim) { | |
Sp_adj(-6); | |
W_[Sp+WDS(5)] = R6; | |
W_[Sp+WDS(4)] = R5; | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_ppppp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(-5); | |
W_[Sp+WDS(1)] = R3; | |
W_[Sp+WDS(2)] = R4; | |
W_[Sp+WDS(3)] = R5; | |
W_[Sp+WDS(4)] = R6; | |
W_[Sp+WDS(0)] = stg_ap_pppp_info; | |
R1 = R1 + 1; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 2) { | |
Sp_adj(-4); | |
W_[Sp+WDS(1)] = R4; | |
W_[Sp+WDS(2)] = R5; | |
W_[Sp+WDS(3)] = R6; | |
W_[Sp+WDS(0)] = stg_ap_ppp_info; | |
R1 = R1 + 2; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 3) { | |
Sp_adj(-3); | |
W_[Sp+WDS(1)] = R5; | |
W_[Sp+WDS(2)] = R6; | |
W_[Sp+WDS(0)] = stg_ap_pp_info; | |
R1 = R1 + 3; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 4) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R6; | |
W_[Sp+WDS(0)] = stg_ap_p_info; | |
R1 = R1 + 4; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 5) { | |
Sp_adj(0); | |
R1 = R1 + 5; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} else { | |
Sp_adj(-6); | |
W_[Sp+WDS(5)] = R6; | |
W_[Sp+WDS(4)] = R5; | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(5,5,stg_ap_ppppp_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-6); | |
W_[Sp+WDS(5)] = R6; | |
W_[Sp+WDS(4)] = R5; | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
jump RET_LBL(stg_ap_ppppp) []; | |
} | |
} | |
} | |
stg_ap_pppppp_fast | |
{ W_ info; | |
W_ arity; | |
if (GETTAG(R1)==6) { | |
Sp_adj(0); | |
jump %GET_ENTRY(R1-6) [R1,R2,R3,R4,R5,R6]; | |
} | |
#ifdef PROFILING | |
if (Sp - WDS(6) < SpLim) { | |
Sp_adj(-6); | |
W_[Sp+WDS(5)] = R6; | |
W_[Sp+WDS(4)] = R5; | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_pppppp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#else | |
if (Sp - WDS(6) < SpLim) { | |
Sp_adj(-6); | |
W_[Sp+WDS(5)] = R6; | |
W_[Sp+WDS(4)] = R5; | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
Sp(0) = stg_ap_pppppp_info; | |
jump __stg_gc_enter_1 [R1]; | |
} | |
#endif | |
R1 = UNTAG(R1); | |
info = %GET_STD_INFO(R1); | |
switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) { | |
case FUN, | |
FUN_1_0, | |
FUN_0_1, | |
FUN_2_0, | |
FUN_1_1, | |
FUN_0_2, | |
FUN_STATIC: { | |
arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1))); | |
ASSERT(arity > 0); | |
if (arity == 1) { | |
Sp_adj(-5); | |
W_[Sp+WDS(1)] = R3; | |
W_[Sp+WDS(2)] = R4; | |
W_[Sp+WDS(3)] = R5; | |
W_[Sp+WDS(4)] = R6; | |
W_[Sp+WDS(0)] = stg_ap_ppppp_info; | |
R1 = R1 + 1; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 2) { | |
Sp_adj(-4); | |
W_[Sp+WDS(1)] = R4; | |
W_[Sp+WDS(2)] = R5; | |
W_[Sp+WDS(3)] = R6; | |
W_[Sp+WDS(0)] = stg_ap_pppp_info; | |
R1 = R1 + 2; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 3) { | |
Sp_adj(-3); | |
W_[Sp+WDS(1)] = R5; | |
W_[Sp+WDS(2)] = R6; | |
W_[Sp+WDS(0)] = stg_ap_ppp_info; | |
R1 = R1 + 3; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 4) { | |
Sp_adj(-2); | |
W_[Sp+WDS(1)] = R6; | |
W_[Sp+WDS(0)] = stg_ap_pp_info; | |
R1 = R1 + 4; | |
jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1))); | |
} | |
if (arity == 5) { | |
#ifdef PROFILING | |
W_[Sp+WDS(-3)] = stg_restore_cccs_info; | |
W_[Sp+WDS(-2)] = CCCS; | |
W_[Sp+WDS(-1)] = stg_ap_p_info; | |
Sp_adj(-3); | |
#else | |
W_[Sp+WDS(-1)] = stg_ap_p_info; | |
Sp_adj(-1); | |
#endif | |
R1 = R1 + 5; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} | |
if (arity == 6) { | |
Sp_adj(0); | |
R1 = R1 + 6; | |
jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6]; | |
} else { | |
Sp_adj(-6); | |
W_[Sp+WDS(5)] = R6; | |
W_[Sp+WDS(4)] = R5; | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
if (arity < 8) { | |
R1 = R1 + arity; | |
} | |
BUILD_PAP(6,6,stg_ap_pppppp_info,FUN); | |
} | |
} | |
default: { | |
Sp_adj(-6); | |
W_[Sp+WDS(5)] = R6; | |
W_[Sp+WDS(4)] = R5; | |
W_[Sp+WDS(3)] = R4; | |
W_[Sp+WDS(2)] = R3; | |
W_[Sp+WDS(1)] = R2; | |
jump RET_LBL(stg_ap_pppppp) []; | |
} | |
} | |
} | |
section "relrodata" { | |
stg_ap_stack_entries: | |
W_ 0; W_ 0; W_ 0; | |
W_ stg_ap_stk_; | |
W_ stg_ap_stk_n; | |
W_ stg_ap_stk_p; | |
W_ stg_ap_stk_f; | |
W_ stg_ap_stk_d; | |
W_ stg_ap_stk_l; | |
W_ stg_ap_stk_v16; | |
W_ stg_ap_stk_v32; | |
W_ stg_ap_stk_v64; | |
W_ stg_ap_stk_nn; | |
W_ stg_ap_stk_np; | |
W_ stg_ap_stk_pn; | |
W_ stg_ap_stk_pp; | |
W_ stg_ap_stk_nnn; | |
W_ stg_ap_stk_nnp; | |
W_ stg_ap_stk_npn; | |
W_ stg_ap_stk_npp; | |
W_ stg_ap_stk_pnn; | |
W_ stg_ap_stk_pnp; | |
W_ stg_ap_stk_ppn; | |
W_ stg_ap_stk_ppp; | |
W_ stg_ap_stk_pppp; | |
W_ stg_ap_stk_ppppp; | |
W_ stg_ap_stk_pppppp; | |
W_ stg_ap_stk_ppppppp; | |
W_ stg_ap_stk_pppppppp; | |
} | |
section "relrodata" { | |
stg_stack_save_entries: | |
W_ 0; W_ 0; W_ 0; | |
W_ stg_stk_save_; | |
W_ stg_stk_save_n; | |
W_ stg_stk_save_p; | |
W_ stg_stk_save_f; | |
W_ stg_stk_save_d; | |
W_ stg_stk_save_l; | |
W_ stg_stk_save_v16; | |
W_ stg_stk_save_v32; | |
W_ stg_stk_save_v64; | |
W_ stg_stk_save_nn; | |
W_ stg_stk_save_np; | |
W_ stg_stk_save_pn; | |
W_ stg_stk_save_pp; | |
W_ stg_stk_save_nnn; | |
W_ stg_stk_save_nnp; | |
W_ stg_stk_save_npn; | |
W_ stg_stk_save_npp; | |
W_ stg_stk_save_pnn; | |
W_ stg_stk_save_pnp; | |
W_ stg_stk_save_ppn; | |
W_ stg_stk_save_ppp; | |
W_ stg_stk_save_pppp; | |
W_ stg_stk_save_ppppp; | |
W_ stg_stk_save_pppppp; | |
W_ stg_stk_save_ppppppp; | |
W_ stg_stk_save_pppppppp; | |
} | |
section "rodata" { | |
stg_arg_bitmaps: | |
W_ 0; W_ 0; W_ 0; | |
W_ 0; | |
W_ 65; | |
W_ 1; | |
W_ 65; | |
W_ 65; | |
W_ 65; | |
W_ 194; | |
W_ 964; | |
W_ 16328; | |
W_ 194; | |
W_ 66; | |
W_ 130; | |
W_ 2; | |
W_ 451; | |
W_ 195; | |
W_ 323; | |
W_ 67; | |
W_ 387; | |
W_ 131; | |
W_ 259; | |
W_ 3; | |
W_ 4; | |
W_ 5; | |
W_ 6; | |
W_ 7; | |
W_ 8; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment