The FUN application code is wrong when entering a BCO, because the BCO
entry code assumes a stack-only calling convention. Use the PAP entry
code instead, which also uses a stack-only convention.
text "F_ " <> fun_ret_label <> text "( void )\n{",
nest 4 (vcat [
text "StgInfoTable *info;",
text "F_ " <> fun_ret_label <> text "( void )\n{",
nest 4 (vcat [
text "StgInfoTable *info;",
text "nat arity;",
-- if fast == 1:
text "nat arity;",
-- if fast == 1:
text "case BCO:",
nest 4 (vcat [
text "arity = BCO_ARITY((StgBCO *)R1.p);",
text "case BCO:",
nest 4 (vcat [
text "arity = BCO_ARITY((StgBCO *)R1.p);",
+ text "target = (F_)&stg_BCO_entry;",
+ text "goto apply_pap;"
text "case FUN_STATIC:",
nest 4 (vcat [
text "arity = itbl_to_fun_itbl(info)->arity;",
text "case FUN_STATIC:",
nest 4 (vcat [
text "arity = itbl_to_fun_itbl(info)->arity;",
text "ASSERT(arity > 0);",
genMkPAP "BUILD_PAP" "GET_ENTRY(R1.cl)" False{-not PAP-}
args all_args_size fun_info_label
text "ASSERT(arity > 0);",
genMkPAP "BUILD_PAP" "GET_ENTRY(R1.cl)" False{-not PAP-}
args all_args_size fun_info_label
text "case PAP:",
nest 4 (vcat [
text "arity = ((StgPAP *)R1.p)->arity;",
text "case PAP:",
nest 4 (vcat [
text "arity = ((StgPAP *)R1.p)->arity;",
+ text "target = (F_)&stg_PAP_entry;",
+ text "apply_pap:",
text "ASSERT(arity > 0);",
text "ASSERT(arity > 0);",
- genMkPAP "NEW_PAP" "stg_PAP_entry" True{-is PAP-}
+ genMkPAP "NEW_PAP" "target" True{-is PAP-}
args all_args_size fun_info_label
]),
args all_args_size fun_info_label
]),