Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 121.69 KB | None | 0 0
  1. // DO NOT EDIT!
  2. // Automatically generated by GenApply.hs
  3.  
  4. #include "Cmm.h"
  5. #include "AutoApply.h"
  6.  
  7. INFO_TABLE_RET(stg_ap_v, RET_SMALL, W_ info_ptr, )
  8. {
  9. W_ info;
  10. W_ arity;
  11.  
  12. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_v_ret... "); foreign "C" printClosure(R1 "ptr"));
  13. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(1)"ptr"));
  14. again:
  15. if (GETTAG(R1)==1) {
  16. Sp_adj(1);
  17. jump %GET_ENTRY(R1-1) [R1];
  18. }
  19. #ifdef PROFILING
  20. #else
  21. #endif
  22. R1 = UNTAG(R1);
  23. info = %INFO_PTR(R1);
  24. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  25. case BCO: {
  26. arity = TO_W_(StgBCO_arity(R1));
  27. ASSERT(arity > 0);
  28. if (arity == 1) {
  29. Sp_adj(1);
  30. jump ENTRY_LBL(stg_BCO) [R1];
  31. } else {
  32. BUILD_PAP(1,0,stg_ap_v_info,BCO);
  33. }
  34. }
  35. case FUN,
  36. FUN_1_0,
  37. FUN_0_1,
  38. FUN_2_0,
  39. FUN_1_1,
  40. FUN_0_2,
  41. FUN_STATIC: {
  42. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  43. ASSERT(arity > 0);
  44. if (arity == 1) {
  45. Sp_adj(1);
  46. R1 = R1 + 1;
  47. jump %GET_ENTRY(UNTAG(R1)) [R1];
  48. } else {
  49. if (arity < 8) {
  50. R1 = R1 + arity;
  51. }
  52. BUILD_PAP(1,0,stg_ap_v_info,FUN);
  53. }
  54. }
  55. case PAP: {
  56. arity = TO_W_(StgPAP_arity(R1));
  57. ASSERT(arity > 0);
  58. if (arity == 1) {
  59. Sp_adj(1);
  60. R2 = stg_ap_v_info;
  61. jump stg_PAP_apply [R1,R2];
  62. } else {
  63. NEW_PAP(1,0,stg_ap_v_info,PAP);
  64. }
  65. }
  66.  
  67. case AP,
  68. AP_STACK,
  69. BLACKHOLE,
  70. WHITEHOLE,
  71. THUNK,
  72. THUNK_1_0,
  73. THUNK_0_1,
  74. THUNK_2_0,
  75. THUNK_1_1,
  76. THUNK_0_2,
  77. THUNK_STATIC,
  78. THUNK_SELECTOR: {
  79. Sp(0) = stg_ap_v_info;
  80. jump_SAVE_CCCS(%ENTRY_CODE(info));
  81.  
  82. }
  83. case IND,
  84. IND_STATIC,
  85. IND_PERM: {
  86. R1 = StgInd_indirectee(R1);
  87. goto again;
  88. }
  89.  
  90. default: {
  91. foreign "C" barf("stg_ap_v_ret") never returns;
  92. }
  93. }
  94. }
  95.  
  96. INFO_TABLE_RET(stg_ap_f, RET_SMALL, W_ info_ptr, F_ arg1, )
  97. {
  98. W_ info;
  99. W_ arity;
  100.  
  101. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_f_ret... "); foreign "C" printClosure(R1 "ptr"));
  102. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(2)"ptr"));
  103. again:
  104. if (GETTAG(R1)==1) {
  105. F1 = F_[Sp+WDS(1)];
  106. Sp_adj(2);
  107. jump %GET_ENTRY(R1-1) [F1,R1];
  108. }
  109. #ifdef PROFILING
  110. #else
  111. #endif
  112. R1 = UNTAG(R1);
  113. info = %INFO_PTR(R1);
  114. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  115. case BCO: {
  116. arity = TO_W_(StgBCO_arity(R1));
  117. ASSERT(arity > 0);
  118. if (arity == 1) {
  119. Sp_adj(1);
  120. jump ENTRY_LBL(stg_BCO) [R1];
  121. } else {
  122. BUILD_PAP(1,1,stg_ap_f_info,BCO);
  123. }
  124. }
  125. case FUN,
  126. FUN_1_0,
  127. FUN_0_1,
  128. FUN_2_0,
  129. FUN_1_1,
  130. FUN_0_2,
  131. FUN_STATIC: {
  132. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  133. ASSERT(arity > 0);
  134. if (arity == 1) {
  135. F1 = F_[Sp+WDS(1)];
  136. Sp_adj(2);
  137. R1 = R1 + 1;
  138. jump %GET_ENTRY(UNTAG(R1)) [F1,R1];
  139. } else {
  140. if (arity < 8) {
  141. R1 = R1 + arity;
  142. }
  143. BUILD_PAP(1,1,stg_ap_f_info,FUN);
  144. }
  145. }
  146. case PAP: {
  147. arity = TO_W_(StgPAP_arity(R1));
  148. ASSERT(arity > 0);
  149. if (arity == 1) {
  150. Sp_adj(1);
  151. R2 = stg_ap_f_info;
  152. jump stg_PAP_apply [R1,R2];
  153. } else {
  154. NEW_PAP(1,1,stg_ap_f_info,PAP);
  155. }
  156. }
  157.  
  158. case AP,
  159. AP_STACK,
  160. BLACKHOLE,
  161. WHITEHOLE,
  162. THUNK,
  163. THUNK_1_0,
  164. THUNK_0_1,
  165. THUNK_2_0,
  166. THUNK_1_1,
  167. THUNK_0_2,
  168. THUNK_STATIC,
  169. THUNK_SELECTOR: {
  170. Sp(0) = stg_ap_f_info;
  171. jump_SAVE_CCCS(%ENTRY_CODE(info));
  172.  
  173. }
  174. case IND,
  175. IND_STATIC,
  176. IND_PERM: {
  177. R1 = StgInd_indirectee(R1);
  178. goto again;
  179. }
  180.  
  181. default: {
  182. foreign "C" barf("stg_ap_f_ret") never returns;
  183. }
  184. }
  185. }
  186.  
  187. INFO_TABLE_RET(stg_ap_d, RET_SMALL, W_ info_ptr, D_ arg1, )
  188. {
  189. W_ info;
  190. W_ arity;
  191.  
  192. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_d_ret... "); foreign "C" printClosure(R1 "ptr"));
  193. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(2)"ptr"));
  194. again:
  195. if (GETTAG(R1)==1) {
  196. D1 = D_[Sp+WDS(1)];
  197. Sp_adj(2);
  198. jump %GET_ENTRY(R1-1) [D1,R1];
  199. }
  200. #ifdef PROFILING
  201. #else
  202. #endif
  203. R1 = UNTAG(R1);
  204. info = %INFO_PTR(R1);
  205. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  206. case BCO: {
  207. arity = TO_W_(StgBCO_arity(R1));
  208. ASSERT(arity > 0);
  209. if (arity == 1) {
  210. Sp_adj(1);
  211. jump ENTRY_LBL(stg_BCO) [R1];
  212. } else {
  213. BUILD_PAP(1,1,stg_ap_d_info,BCO);
  214. }
  215. }
  216. case FUN,
  217. FUN_1_0,
  218. FUN_0_1,
  219. FUN_2_0,
  220. FUN_1_1,
  221. FUN_0_2,
  222. FUN_STATIC: {
  223. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  224. ASSERT(arity > 0);
  225. if (arity == 1) {
  226. D1 = D_[Sp+WDS(1)];
  227. Sp_adj(2);
  228. R1 = R1 + 1;
  229. jump %GET_ENTRY(UNTAG(R1)) [D1,R1];
  230. } else {
  231. if (arity < 8) {
  232. R1 = R1 + arity;
  233. }
  234. BUILD_PAP(1,1,stg_ap_d_info,FUN);
  235. }
  236. }
  237. case PAP: {
  238. arity = TO_W_(StgPAP_arity(R1));
  239. ASSERT(arity > 0);
  240. if (arity == 1) {
  241. Sp_adj(1);
  242. R2 = stg_ap_d_info;
  243. jump stg_PAP_apply [R1,R2];
  244. } else {
  245. NEW_PAP(1,1,stg_ap_d_info,PAP);
  246. }
  247. }
  248.  
  249. case AP,
  250. AP_STACK,
  251. BLACKHOLE,
  252. WHITEHOLE,
  253. THUNK,
  254. THUNK_1_0,
  255. THUNK_0_1,
  256. THUNK_2_0,
  257. THUNK_1_1,
  258. THUNK_0_2,
  259. THUNK_STATIC,
  260. THUNK_SELECTOR: {
  261. Sp(0) = stg_ap_d_info;
  262. jump_SAVE_CCCS(%ENTRY_CODE(info));
  263.  
  264. }
  265. case IND,
  266. IND_STATIC,
  267. IND_PERM: {
  268. R1 = StgInd_indirectee(R1);
  269. goto again;
  270. }
  271.  
  272. default: {
  273. foreign "C" barf("stg_ap_d_ret") never returns;
  274. }
  275. }
  276. }
  277.  
  278. INFO_TABLE_RET(stg_ap_l, RET_SMALL, W_ info_ptr, L_ arg1, )
  279. {
  280. W_ info;
  281. W_ arity;
  282.  
  283. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_l_ret... "); foreign "C" printClosure(R1 "ptr"));
  284. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(2)"ptr"));
  285. again:
  286. if (GETTAG(R1)==1) {
  287. Sp_adj(1);
  288. jump %GET_ENTRY(R1-1) [R1];
  289. }
  290. #ifdef PROFILING
  291. #else
  292. #endif
  293. R1 = UNTAG(R1);
  294. info = %INFO_PTR(R1);
  295. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  296. case BCO: {
  297. arity = TO_W_(StgBCO_arity(R1));
  298. ASSERT(arity > 0);
  299. if (arity == 1) {
  300. Sp_adj(1);
  301. jump ENTRY_LBL(stg_BCO) [R1];
  302. } else {
  303. BUILD_PAP(1,1,stg_ap_l_info,BCO);
  304. }
  305. }
  306. case FUN,
  307. FUN_1_0,
  308. FUN_0_1,
  309. FUN_2_0,
  310. FUN_1_1,
  311. FUN_0_2,
  312. FUN_STATIC: {
  313. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  314. ASSERT(arity > 0);
  315. if (arity == 1) {
  316. Sp_adj(1);
  317. R1 = R1 + 1;
  318. jump %GET_ENTRY(UNTAG(R1)) [R1];
  319. } else {
  320. if (arity < 8) {
  321. R1 = R1 + arity;
  322. }
  323. BUILD_PAP(1,1,stg_ap_l_info,FUN);
  324. }
  325. }
  326. case PAP: {
  327. arity = TO_W_(StgPAP_arity(R1));
  328. ASSERT(arity > 0);
  329. if (arity == 1) {
  330. Sp_adj(1);
  331. R2 = stg_ap_l_info;
  332. jump stg_PAP_apply [R1,R2];
  333. } else {
  334. NEW_PAP(1,1,stg_ap_l_info,PAP);
  335. }
  336. }
  337.  
  338. case AP,
  339. AP_STACK,
  340. BLACKHOLE,
  341. WHITEHOLE,
  342. THUNK,
  343. THUNK_1_0,
  344. THUNK_0_1,
  345. THUNK_2_0,
  346. THUNK_1_1,
  347. THUNK_0_2,
  348. THUNK_STATIC,
  349. THUNK_SELECTOR: {
  350. Sp(0) = stg_ap_l_info;
  351. jump_SAVE_CCCS(%ENTRY_CODE(info));
  352.  
  353. }
  354. case IND,
  355. IND_STATIC,
  356. IND_PERM: {
  357. R1 = StgInd_indirectee(R1);
  358. goto again;
  359. }
  360.  
  361. default: {
  362. foreign "C" barf("stg_ap_l_ret") never returns;
  363. }
  364. }
  365. }
  366.  
  367. INFO_TABLE_RET(stg_ap_v16, RET_SMALL, W_ info_ptr, V16_ arg1, )
  368. {
  369. W_ info;
  370. W_ arity;
  371.  
  372. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_v16_ret... "); foreign "C" printClosure(R1 "ptr"));
  373. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(3)"ptr"));
  374. again:
  375. if (GETTAG(R1)==1) {
  376. Sp_adj(1);
  377. jump %GET_ENTRY(R1-1) [R1];
  378. }
  379. #ifdef PROFILING
  380. #else
  381. #endif
  382. R1 = UNTAG(R1);
  383. info = %INFO_PTR(R1);
  384. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  385. case BCO: {
  386. arity = TO_W_(StgBCO_arity(R1));
  387. ASSERT(arity > 0);
  388. if (arity == 1) {
  389. Sp_adj(1);
  390. jump ENTRY_LBL(stg_BCO) [R1];
  391. } else {
  392. BUILD_PAP(1,2,stg_ap_v16_info,BCO);
  393. }
  394. }
  395. case FUN,
  396. FUN_1_0,
  397. FUN_0_1,
  398. FUN_2_0,
  399. FUN_1_1,
  400. FUN_0_2,
  401. FUN_STATIC: {
  402. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  403. ASSERT(arity > 0);
  404. if (arity == 1) {
  405. Sp_adj(1);
  406. R1 = R1 + 1;
  407. jump %GET_ENTRY(UNTAG(R1)) [R1];
  408. } else {
  409. if (arity < 8) {
  410. R1 = R1 + arity;
  411. }
  412. BUILD_PAP(1,2,stg_ap_v16_info,FUN);
  413. }
  414. }
  415. case PAP: {
  416. arity = TO_W_(StgPAP_arity(R1));
  417. ASSERT(arity > 0);
  418. if (arity == 1) {
  419. Sp_adj(1);
  420. R2 = stg_ap_v16_info;
  421. jump stg_PAP_apply [R1,R2];
  422. } else {
  423. NEW_PAP(1,2,stg_ap_v16_info,PAP);
  424. }
  425. }
  426.  
  427. case AP,
  428. AP_STACK,
  429. BLACKHOLE,
  430. WHITEHOLE,
  431. THUNK,
  432. THUNK_1_0,
  433. THUNK_0_1,
  434. THUNK_2_0,
  435. THUNK_1_1,
  436. THUNK_0_2,
  437. THUNK_STATIC,
  438. THUNK_SELECTOR: {
  439. Sp(0) = stg_ap_v16_info;
  440. jump_SAVE_CCCS(%ENTRY_CODE(info));
  441.  
  442. }
  443. case IND,
  444. IND_STATIC,
  445. IND_PERM: {
  446. R1 = StgInd_indirectee(R1);
  447. goto again;
  448. }
  449.  
  450. default: {
  451. foreign "C" barf("stg_ap_v16_ret") never returns;
  452. }
  453. }
  454. }
  455.  
  456. INFO_TABLE_RET(stg_ap_v32, RET_SMALL, W_ info_ptr, V32_ arg1, )
  457. {
  458. W_ info;
  459. W_ arity;
  460.  
  461. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_v32_ret... "); foreign "C" printClosure(R1 "ptr"));
  462. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(5)"ptr"));
  463. again:
  464. if (GETTAG(R1)==1) {
  465. Sp_adj(1);
  466. jump %GET_ENTRY(R1-1) [R1];
  467. }
  468. #ifdef PROFILING
  469. #else
  470. #endif
  471. R1 = UNTAG(R1);
  472. info = %INFO_PTR(R1);
  473. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  474. case BCO: {
  475. arity = TO_W_(StgBCO_arity(R1));
  476. ASSERT(arity > 0);
  477. if (arity == 1) {
  478. Sp_adj(1);
  479. jump ENTRY_LBL(stg_BCO) [R1];
  480. } else {
  481. BUILD_PAP(1,4,stg_ap_v32_info,BCO);
  482. }
  483. }
  484. case FUN,
  485. FUN_1_0,
  486. FUN_0_1,
  487. FUN_2_0,
  488. FUN_1_1,
  489. FUN_0_2,
  490. FUN_STATIC: {
  491. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  492. ASSERT(arity > 0);
  493. if (arity == 1) {
  494. Sp_adj(1);
  495. R1 = R1 + 1;
  496. jump %GET_ENTRY(UNTAG(R1)) [R1];
  497. } else {
  498. if (arity < 8) {
  499. R1 = R1 + arity;
  500. }
  501. BUILD_PAP(1,4,stg_ap_v32_info,FUN);
  502. }
  503. }
  504. case PAP: {
  505. arity = TO_W_(StgPAP_arity(R1));
  506. ASSERT(arity > 0);
  507. if (arity == 1) {
  508. Sp_adj(1);
  509. R2 = stg_ap_v32_info;
  510. jump stg_PAP_apply [R1,R2];
  511. } else {
  512. NEW_PAP(1,4,stg_ap_v32_info,PAP);
  513. }
  514. }
  515.  
  516. case AP,
  517. AP_STACK,
  518. BLACKHOLE,
  519. WHITEHOLE,
  520. THUNK,
  521. THUNK_1_0,
  522. THUNK_0_1,
  523. THUNK_2_0,
  524. THUNK_1_1,
  525. THUNK_0_2,
  526. THUNK_STATIC,
  527. THUNK_SELECTOR: {
  528. Sp(0) = stg_ap_v32_info;
  529. jump_SAVE_CCCS(%ENTRY_CODE(info));
  530.  
  531. }
  532. case IND,
  533. IND_STATIC,
  534. IND_PERM: {
  535. R1 = StgInd_indirectee(R1);
  536. goto again;
  537. }
  538.  
  539. default: {
  540. foreign "C" barf("stg_ap_v32_ret") never returns;
  541. }
  542. }
  543. }
  544.  
  545. INFO_TABLE_RET(stg_ap_v64, RET_SMALL, W_ info_ptr, V64_ arg1, )
  546. {
  547. W_ info;
  548. W_ arity;
  549.  
  550. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_v64_ret... "); foreign "C" printClosure(R1 "ptr"));
  551. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(9)"ptr"));
  552. again:
  553. if (GETTAG(R1)==1) {
  554. Sp_adj(1);
  555. jump %GET_ENTRY(R1-1) [R1];
  556. }
  557. #ifdef PROFILING
  558. #else
  559. #endif
  560. R1 = UNTAG(R1);
  561. info = %INFO_PTR(R1);
  562. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  563. case BCO: {
  564. arity = TO_W_(StgBCO_arity(R1));
  565. ASSERT(arity > 0);
  566. if (arity == 1) {
  567. Sp_adj(1);
  568. jump ENTRY_LBL(stg_BCO) [R1];
  569. } else {
  570. BUILD_PAP(1,8,stg_ap_v64_info,BCO);
  571. }
  572. }
  573. case FUN,
  574. FUN_1_0,
  575. FUN_0_1,
  576. FUN_2_0,
  577. FUN_1_1,
  578. FUN_0_2,
  579. FUN_STATIC: {
  580. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  581. ASSERT(arity > 0);
  582. if (arity == 1) {
  583. Sp_adj(1);
  584. R1 = R1 + 1;
  585. jump %GET_ENTRY(UNTAG(R1)) [R1];
  586. } else {
  587. if (arity < 8) {
  588. R1 = R1 + arity;
  589. }
  590. BUILD_PAP(1,8,stg_ap_v64_info,FUN);
  591. }
  592. }
  593. case PAP: {
  594. arity = TO_W_(StgPAP_arity(R1));
  595. ASSERT(arity > 0);
  596. if (arity == 1) {
  597. Sp_adj(1);
  598. R2 = stg_ap_v64_info;
  599. jump stg_PAP_apply [R1,R2];
  600. } else {
  601. NEW_PAP(1,8,stg_ap_v64_info,PAP);
  602. }
  603. }
  604.  
  605. case AP,
  606. AP_STACK,
  607. BLACKHOLE,
  608. WHITEHOLE,
  609. THUNK,
  610. THUNK_1_0,
  611. THUNK_0_1,
  612. THUNK_2_0,
  613. THUNK_1_1,
  614. THUNK_0_2,
  615. THUNK_STATIC,
  616. THUNK_SELECTOR: {
  617. Sp(0) = stg_ap_v64_info;
  618. jump_SAVE_CCCS(%ENTRY_CODE(info));
  619.  
  620. }
  621. case IND,
  622. IND_STATIC,
  623. IND_PERM: {
  624. R1 = StgInd_indirectee(R1);
  625. goto again;
  626. }
  627.  
  628. default: {
  629. foreign "C" barf("stg_ap_v64_ret") never returns;
  630. }
  631. }
  632. }
  633.  
  634. INFO_TABLE_RET(stg_ap_n, RET_SMALL, W_ info_ptr, W_ arg1, )
  635. {
  636. W_ info;
  637. W_ arity;
  638.  
  639. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_n_ret... "); foreign "C" printClosure(R1 "ptr"));
  640. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(2)"ptr"));
  641. again:
  642. if (GETTAG(R1)==1) {
  643. R2 = W_[Sp+WDS(1)];
  644. Sp_adj(2);
  645. jump %GET_ENTRY(R1-1) [R1,R2];
  646. }
  647. #ifdef PROFILING
  648. #else
  649. #endif
  650. R1 = UNTAG(R1);
  651. info = %INFO_PTR(R1);
  652. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  653. case BCO: {
  654. arity = TO_W_(StgBCO_arity(R1));
  655. ASSERT(arity > 0);
  656. if (arity == 1) {
  657. Sp_adj(1);
  658. jump ENTRY_LBL(stg_BCO) [R1];
  659. } else {
  660. BUILD_PAP(1,1,stg_ap_n_info,BCO);
  661. }
  662. }
  663. case FUN,
  664. FUN_1_0,
  665. FUN_0_1,
  666. FUN_2_0,
  667. FUN_1_1,
  668. FUN_0_2,
  669. FUN_STATIC: {
  670. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  671. ASSERT(arity > 0);
  672. if (arity == 1) {
  673. R2 = W_[Sp+WDS(1)];
  674. Sp_adj(2);
  675. R1 = R1 + 1;
  676. jump %GET_ENTRY(UNTAG(R1)) [R1,R2];
  677. } else {
  678. if (arity < 8) {
  679. R1 = R1 + arity;
  680. }
  681. BUILD_PAP(1,1,stg_ap_n_info,FUN);
  682. }
  683. }
  684. case PAP: {
  685. arity = TO_W_(StgPAP_arity(R1));
  686. ASSERT(arity > 0);
  687. if (arity == 1) {
  688. Sp_adj(1);
  689. R2 = stg_ap_n_info;
  690. jump stg_PAP_apply [R1,R2];
  691. } else {
  692. NEW_PAP(1,1,stg_ap_n_info,PAP);
  693. }
  694. }
  695.  
  696. case AP,
  697. AP_STACK,
  698. BLACKHOLE,
  699. WHITEHOLE,
  700. THUNK,
  701. THUNK_1_0,
  702. THUNK_0_1,
  703. THUNK_2_0,
  704. THUNK_1_1,
  705. THUNK_0_2,
  706. THUNK_STATIC,
  707. THUNK_SELECTOR: {
  708. Sp(0) = stg_ap_n_info;
  709. jump_SAVE_CCCS(%ENTRY_CODE(info));
  710.  
  711. }
  712. case IND,
  713. IND_STATIC,
  714. IND_PERM: {
  715. R1 = StgInd_indirectee(R1);
  716. goto again;
  717. }
  718.  
  719. default: {
  720. foreign "C" barf("stg_ap_n_ret") never returns;
  721. }
  722. }
  723. }
  724.  
  725. INFO_TABLE_RET(stg_ap_p, RET_SMALL, W_ info_ptr, gcptr arg1, )
  726. {
  727. W_ info;
  728. W_ arity;
  729.  
  730. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_p_ret... "); foreign "C" printClosure(R1 "ptr"));
  731. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(2)"ptr"));
  732. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1)));
  733. again:
  734. if (GETTAG(R1)==1) {
  735. R2 = W_[Sp+WDS(1)];
  736. Sp_adj(2);
  737. jump %GET_ENTRY(R1-1) [R1,R2];
  738. }
  739. #ifdef PROFILING
  740. #else
  741. #endif
  742. R1 = UNTAG(R1);
  743. info = %INFO_PTR(R1);
  744. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  745. case BCO: {
  746. arity = TO_W_(StgBCO_arity(R1));
  747. ASSERT(arity > 0);
  748. if (arity == 1) {
  749. Sp_adj(1);
  750. jump ENTRY_LBL(stg_BCO) [R1];
  751. } else {
  752. BUILD_PAP(1,1,stg_ap_p_info,BCO);
  753. }
  754. }
  755. case FUN,
  756. FUN_1_0,
  757. FUN_0_1,
  758. FUN_2_0,
  759. FUN_1_1,
  760. FUN_0_2,
  761. FUN_STATIC: {
  762. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  763. ASSERT(arity > 0);
  764. if (arity == 1) {
  765. R2 = W_[Sp+WDS(1)];
  766. Sp_adj(2);
  767. R1 = R1 + 1;
  768. jump %GET_ENTRY(UNTAG(R1)) [R1,R2];
  769. } else {
  770. if (arity < 8) {
  771. R1 = R1 + arity;
  772. }
  773. BUILD_PAP(1,1,stg_ap_p_info,FUN);
  774. }
  775. }
  776. case PAP: {
  777. arity = TO_W_(StgPAP_arity(R1));
  778. ASSERT(arity > 0);
  779. if (arity == 1) {
  780. Sp_adj(1);
  781. R2 = stg_ap_p_info;
  782. jump stg_PAP_apply [R1,R2];
  783. } else {
  784. NEW_PAP(1,1,stg_ap_p_info,PAP);
  785. }
  786. }
  787.  
  788. case AP,
  789. AP_STACK,
  790. BLACKHOLE,
  791. WHITEHOLE,
  792. THUNK,
  793. THUNK_1_0,
  794. THUNK_0_1,
  795. THUNK_2_0,
  796. THUNK_1_1,
  797. THUNK_0_2,
  798. THUNK_STATIC,
  799. THUNK_SELECTOR: {
  800. Sp(0) = stg_ap_p_info;
  801. jump_SAVE_CCCS(%ENTRY_CODE(info));
  802.  
  803. }
  804. case IND,
  805. IND_STATIC,
  806. IND_PERM: {
  807. R1 = StgInd_indirectee(R1);
  808. goto again;
  809. }
  810.  
  811. default: {
  812. foreign "C" barf("stg_ap_p_ret") never returns;
  813. }
  814. }
  815. }
  816.  
  817. INFO_TABLE_RET(stg_ap_pv, RET_SMALL, W_ info_ptr, gcptr arg1, )
  818. {
  819. W_ info;
  820. W_ arity;
  821.  
  822. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_pv_ret... "); foreign "C" printClosure(R1 "ptr"));
  823. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(2)"ptr"));
  824. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1)));
  825. again:
  826. if (GETTAG(R1)==2) {
  827. R2 = W_[Sp+WDS(1)];
  828. Sp_adj(2);
  829. jump %GET_ENTRY(R1-2) [R1,R2];
  830. }
  831. #ifdef PROFILING
  832. if (Sp - WDS(2) < SpLim) {
  833. Sp(0) = stg_ap_pv_info;
  834. jump __stg_gc_enter_1 [R1];
  835. }
  836. #else
  837. #endif
  838. R1 = UNTAG(R1);
  839. info = %INFO_PTR(R1);
  840. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  841. case BCO: {
  842. arity = TO_W_(StgBCO_arity(R1));
  843. ASSERT(arity > 0);
  844. if (arity == 1) {
  845. #ifdef PROFILING
  846. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  847. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  848. W_[Sp+WDS(0)] = CCCS;
  849. W_[Sp+WDS(1)] = stg_ap_v_info;
  850. Sp_adj(-2);
  851. #else
  852. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  853. W_[Sp+WDS(1)] = stg_ap_v_info;
  854. Sp_adj(0);
  855. #endif
  856. jump ENTRY_LBL(stg_BCO) [R1];
  857. }
  858. if (arity == 2) {
  859. Sp_adj(1);
  860. jump ENTRY_LBL(stg_BCO) [R1];
  861. } else {
  862. BUILD_PAP(2,1,stg_ap_pv_info,BCO);
  863. }
  864. }
  865. case FUN,
  866. FUN_1_0,
  867. FUN_0_1,
  868. FUN_2_0,
  869. FUN_1_1,
  870. FUN_0_2,
  871. FUN_STATIC: {
  872. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  873. ASSERT(arity > 0);
  874. if (arity == 1) {
  875. R2 = W_[Sp+WDS(1)];
  876. #ifdef PROFILING
  877. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  878. W_[Sp+WDS(0)] = CCCS;
  879. W_[Sp+WDS(1)] = stg_ap_v_info;
  880. Sp_adj(-1);
  881. #else
  882. W_[Sp+WDS(1)] = stg_ap_v_info;
  883. Sp_adj(1);
  884. #endif
  885. R1 = R1 + 1;
  886. jump %GET_ENTRY(UNTAG(R1)) [R1,R2];
  887. }
  888. if (arity == 2) {
  889. R2 = W_[Sp+WDS(1)];
  890. Sp_adj(2);
  891. R1 = R1 + 2;
  892. jump %GET_ENTRY(UNTAG(R1)) [R1,R2];
  893. } else {
  894. if (arity < 8) {
  895. R1 = R1 + arity;
  896. }
  897. BUILD_PAP(2,1,stg_ap_pv_info,FUN);
  898. }
  899. }
  900. case PAP: {
  901. arity = TO_W_(StgPAP_arity(R1));
  902. ASSERT(arity > 0);
  903. if (arity == 1) {
  904. #ifdef PROFILING
  905. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  906. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  907. W_[Sp+WDS(0)] = CCCS;
  908. W_[Sp+WDS(1)] = stg_ap_v_info;
  909. Sp_adj(-2);
  910. #else
  911. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  912. W_[Sp+WDS(1)] = stg_ap_v_info;
  913. Sp_adj(0);
  914. #endif
  915. R2 = stg_ap_p_info;
  916. jump stg_PAP_apply [R1,R2];
  917. }
  918. if (arity == 2) {
  919. Sp_adj(1);
  920. R2 = stg_ap_pv_info;
  921. jump stg_PAP_apply [R1,R2];
  922. } else {
  923. NEW_PAP(2,1,stg_ap_pv_info,PAP);
  924. }
  925. }
  926.  
  927. case AP,
  928. AP_STACK,
  929. BLACKHOLE,
  930. WHITEHOLE,
  931. THUNK,
  932. THUNK_1_0,
  933. THUNK_0_1,
  934. THUNK_2_0,
  935. THUNK_1_1,
  936. THUNK_0_2,
  937. THUNK_STATIC,
  938. THUNK_SELECTOR: {
  939. Sp(0) = stg_ap_pv_info;
  940. jump_SAVE_CCCS(%ENTRY_CODE(info));
  941.  
  942. }
  943. case IND,
  944. IND_STATIC,
  945. IND_PERM: {
  946. R1 = StgInd_indirectee(R1);
  947. goto again;
  948. }
  949.  
  950. default: {
  951. foreign "C" barf("stg_ap_pv_ret") never returns;
  952. }
  953. }
  954. }
  955.  
  956. INFO_TABLE_RET(stg_ap_pp, RET_SMALL, W_ info_ptr, gcptr arg1,
  957. gcptr arg2, )
  958. {
  959. W_ info;
  960. W_ arity;
  961.  
  962. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_pp_ret... "); foreign "C" printClosure(R1 "ptr"));
  963. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(3)"ptr"));
  964. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1)));
  965. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2)));
  966. again:
  967. if (GETTAG(R1)==2) {
  968. R3 = W_[Sp+WDS(2)];
  969. R2 = W_[Sp+WDS(1)];
  970. Sp_adj(3);
  971. jump %GET_ENTRY(R1-2) [R1,R2,R3];
  972. }
  973. #ifdef PROFILING
  974. if (Sp - WDS(2) < SpLim) {
  975. Sp(0) = stg_ap_pp_info;
  976. jump __stg_gc_enter_1 [R1];
  977. }
  978. #else
  979. #endif
  980. R1 = UNTAG(R1);
  981. info = %INFO_PTR(R1);
  982. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  983. case BCO: {
  984. arity = TO_W_(StgBCO_arity(R1));
  985. ASSERT(arity > 0);
  986. if (arity == 1) {
  987. #ifdef PROFILING
  988. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  989. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  990. W_[Sp+WDS(0)] = CCCS;
  991. W_[Sp+WDS(1)] = stg_ap_p_info;
  992. Sp_adj(-2);
  993. #else
  994. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  995. W_[Sp+WDS(1)] = stg_ap_p_info;
  996. Sp_adj(0);
  997. #endif
  998. jump ENTRY_LBL(stg_BCO) [R1];
  999. }
  1000. if (arity == 2) {
  1001. Sp_adj(1);
  1002. jump ENTRY_LBL(stg_BCO) [R1];
  1003. } else {
  1004. BUILD_PAP(2,2,stg_ap_pp_info,BCO);
  1005. }
  1006. }
  1007. case FUN,
  1008. FUN_1_0,
  1009. FUN_0_1,
  1010. FUN_2_0,
  1011. FUN_1_1,
  1012. FUN_0_2,
  1013. FUN_STATIC: {
  1014. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  1015. ASSERT(arity > 0);
  1016. if (arity == 1) {
  1017. R2 = W_[Sp+WDS(1)];
  1018. #ifdef PROFILING
  1019. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1020. W_[Sp+WDS(0)] = CCCS;
  1021. W_[Sp+WDS(1)] = stg_ap_p_info;
  1022. Sp_adj(-1);
  1023. #else
  1024. W_[Sp+WDS(1)] = stg_ap_p_info;
  1025. Sp_adj(1);
  1026. #endif
  1027. R1 = R1 + 1;
  1028. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3];
  1029. }
  1030. if (arity == 2) {
  1031. R3 = W_[Sp+WDS(2)];
  1032. R2 = W_[Sp+WDS(1)];
  1033. Sp_adj(3);
  1034. R1 = R1 + 2;
  1035. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3];
  1036. } else {
  1037. if (arity < 8) {
  1038. R1 = R1 + arity;
  1039. }
  1040. BUILD_PAP(2,2,stg_ap_pp_info,FUN);
  1041. }
  1042. }
  1043. case PAP: {
  1044. arity = TO_W_(StgPAP_arity(R1));
  1045. ASSERT(arity > 0);
  1046. if (arity == 1) {
  1047. #ifdef PROFILING
  1048. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1049. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1050. W_[Sp+WDS(0)] = CCCS;
  1051. W_[Sp+WDS(1)] = stg_ap_p_info;
  1052. Sp_adj(-2);
  1053. #else
  1054. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1055. W_[Sp+WDS(1)] = stg_ap_p_info;
  1056. Sp_adj(0);
  1057. #endif
  1058. R2 = stg_ap_p_info;
  1059. jump stg_PAP_apply [R1,R2];
  1060. }
  1061. if (arity == 2) {
  1062. Sp_adj(1);
  1063. R2 = stg_ap_pp_info;
  1064. jump stg_PAP_apply [R1,R2];
  1065. } else {
  1066. NEW_PAP(2,2,stg_ap_pp_info,PAP);
  1067. }
  1068. }
  1069.  
  1070. case AP,
  1071. AP_STACK,
  1072. BLACKHOLE,
  1073. WHITEHOLE,
  1074. THUNK,
  1075. THUNK_1_0,
  1076. THUNK_0_1,
  1077. THUNK_2_0,
  1078. THUNK_1_1,
  1079. THUNK_0_2,
  1080. THUNK_STATIC,
  1081. THUNK_SELECTOR: {
  1082. Sp(0) = stg_ap_pp_info;
  1083. jump_SAVE_CCCS(%ENTRY_CODE(info));
  1084.  
  1085. }
  1086. case IND,
  1087. IND_STATIC,
  1088. IND_PERM: {
  1089. R1 = StgInd_indirectee(R1);
  1090. goto again;
  1091. }
  1092.  
  1093. default: {
  1094. foreign "C" barf("stg_ap_pp_ret") never returns;
  1095. }
  1096. }
  1097. }
  1098.  
  1099. INFO_TABLE_RET(stg_ap_ppv, RET_SMALL, W_ info_ptr, gcptr arg1,
  1100. gcptr arg2, )
  1101. {
  1102. W_ info;
  1103. W_ arity;
  1104.  
  1105. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_ppv_ret... "); foreign "C" printClosure(R1 "ptr"));
  1106. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(3)"ptr"));
  1107. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1)));
  1108. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2)));
  1109. again:
  1110. if (GETTAG(R1)==3) {
  1111. R3 = W_[Sp+WDS(2)];
  1112. R2 = W_[Sp+WDS(1)];
  1113. Sp_adj(3);
  1114. jump %GET_ENTRY(R1-3) [R1,R2,R3];
  1115. }
  1116. #ifdef PROFILING
  1117. if (Sp - WDS(2) < SpLim) {
  1118. Sp(0) = stg_ap_ppv_info;
  1119. jump __stg_gc_enter_1 [R1];
  1120. }
  1121. #else
  1122. #endif
  1123. R1 = UNTAG(R1);
  1124. info = %INFO_PTR(R1);
  1125. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  1126. case BCO: {
  1127. arity = TO_W_(StgBCO_arity(R1));
  1128. ASSERT(arity > 0);
  1129. if (arity == 1) {
  1130. #ifdef PROFILING
  1131. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1132. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1133. W_[Sp+WDS(0)] = CCCS;
  1134. W_[Sp+WDS(1)] = stg_ap_pv_info;
  1135. Sp_adj(-2);
  1136. #else
  1137. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1138. W_[Sp+WDS(1)] = stg_ap_pv_info;
  1139. Sp_adj(0);
  1140. #endif
  1141. jump ENTRY_LBL(stg_BCO) [R1];
  1142. }
  1143. if (arity == 2) {
  1144. #ifdef PROFILING
  1145. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1146. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  1147. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  1148. W_[Sp+WDS(1)] = CCCS;
  1149. W_[Sp+WDS(2)] = stg_ap_v_info;
  1150. Sp_adj(-2);
  1151. #else
  1152. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1153. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  1154. W_[Sp+WDS(2)] = stg_ap_v_info;
  1155. Sp_adj(0);
  1156. #endif
  1157. jump ENTRY_LBL(stg_BCO) [R1];
  1158. }
  1159. if (arity == 3) {
  1160. Sp_adj(1);
  1161. jump ENTRY_LBL(stg_BCO) [R1];
  1162. } else {
  1163. BUILD_PAP(3,2,stg_ap_ppv_info,BCO);
  1164. }
  1165. }
  1166. case FUN,
  1167. FUN_1_0,
  1168. FUN_0_1,
  1169. FUN_2_0,
  1170. FUN_1_1,
  1171. FUN_0_2,
  1172. FUN_STATIC: {
  1173. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  1174. ASSERT(arity > 0);
  1175. if (arity == 1) {
  1176. R2 = W_[Sp+WDS(1)];
  1177. #ifdef PROFILING
  1178. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1179. W_[Sp+WDS(0)] = CCCS;
  1180. W_[Sp+WDS(1)] = stg_ap_pv_info;
  1181. Sp_adj(-1);
  1182. #else
  1183. W_[Sp+WDS(1)] = stg_ap_pv_info;
  1184. Sp_adj(1);
  1185. #endif
  1186. R1 = R1 + 1;
  1187. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3];
  1188. }
  1189. if (arity == 2) {
  1190. R3 = W_[Sp+WDS(2)];
  1191. R2 = W_[Sp+WDS(1)];
  1192. #ifdef PROFILING
  1193. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  1194. W_[Sp+WDS(1)] = CCCS;
  1195. W_[Sp+WDS(2)] = stg_ap_v_info;
  1196. Sp_adj(0);
  1197. #else
  1198. W_[Sp+WDS(2)] = stg_ap_v_info;
  1199. Sp_adj(2);
  1200. #endif
  1201. R1 = R1 + 2;
  1202. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3];
  1203. }
  1204. if (arity == 3) {
  1205. R3 = W_[Sp+WDS(2)];
  1206. R2 = W_[Sp+WDS(1)];
  1207. Sp_adj(3);
  1208. R1 = R1 + 3;
  1209. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3];
  1210. } else {
  1211. if (arity < 8) {
  1212. R1 = R1 + arity;
  1213. }
  1214. BUILD_PAP(3,2,stg_ap_ppv_info,FUN);
  1215. }
  1216. }
  1217. case PAP: {
  1218. arity = TO_W_(StgPAP_arity(R1));
  1219. ASSERT(arity > 0);
  1220. if (arity == 1) {
  1221. #ifdef PROFILING
  1222. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1223. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1224. W_[Sp+WDS(0)] = CCCS;
  1225. W_[Sp+WDS(1)] = stg_ap_pv_info;
  1226. Sp_adj(-2);
  1227. #else
  1228. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1229. W_[Sp+WDS(1)] = stg_ap_pv_info;
  1230. Sp_adj(0);
  1231. #endif
  1232. R2 = stg_ap_p_info;
  1233. jump stg_PAP_apply [R1,R2];
  1234. }
  1235. if (arity == 2) {
  1236. #ifdef PROFILING
  1237. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1238. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  1239. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  1240. W_[Sp+WDS(1)] = CCCS;
  1241. W_[Sp+WDS(2)] = stg_ap_v_info;
  1242. Sp_adj(-2);
  1243. #else
  1244. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1245. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  1246. W_[Sp+WDS(2)] = stg_ap_v_info;
  1247. Sp_adj(0);
  1248. #endif
  1249. R2 = stg_ap_pp_info;
  1250. jump stg_PAP_apply [R1,R2];
  1251. }
  1252. if (arity == 3) {
  1253. Sp_adj(1);
  1254. R2 = stg_ap_ppv_info;
  1255. jump stg_PAP_apply [R1,R2];
  1256. } else {
  1257. NEW_PAP(3,2,stg_ap_ppv_info,PAP);
  1258. }
  1259. }
  1260.  
  1261. case AP,
  1262. AP_STACK,
  1263. BLACKHOLE,
  1264. WHITEHOLE,
  1265. THUNK,
  1266. THUNK_1_0,
  1267. THUNK_0_1,
  1268. THUNK_2_0,
  1269. THUNK_1_1,
  1270. THUNK_0_2,
  1271. THUNK_STATIC,
  1272. THUNK_SELECTOR: {
  1273. Sp(0) = stg_ap_ppv_info;
  1274. jump_SAVE_CCCS(%ENTRY_CODE(info));
  1275.  
  1276. }
  1277. case IND,
  1278. IND_STATIC,
  1279. IND_PERM: {
  1280. R1 = StgInd_indirectee(R1);
  1281. goto again;
  1282. }
  1283.  
  1284. default: {
  1285. foreign "C" barf("stg_ap_ppv_ret") never returns;
  1286. }
  1287. }
  1288. }
  1289.  
  1290. INFO_TABLE_RET(stg_ap_ppp, RET_SMALL, W_ info_ptr, gcptr arg1,
  1291. gcptr arg2,
  1292. gcptr arg3, )
  1293. {
  1294. W_ info;
  1295. W_ arity;
  1296.  
  1297. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_ppp_ret... "); foreign "C" printClosure(R1 "ptr"));
  1298. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(4)"ptr"));
  1299. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1)));
  1300. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2)));
  1301. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(3)));
  1302. again:
  1303. if (GETTAG(R1)==3) {
  1304. R4 = W_[Sp+WDS(3)];
  1305. R3 = W_[Sp+WDS(2)];
  1306. R2 = W_[Sp+WDS(1)];
  1307. Sp_adj(4);
  1308. jump %GET_ENTRY(R1-3) [R1,R2,R3,R4];
  1309. }
  1310. #ifdef PROFILING
  1311. if (Sp - WDS(2) < SpLim) {
  1312. Sp(0) = stg_ap_ppp_info;
  1313. jump __stg_gc_enter_1 [R1];
  1314. }
  1315. #else
  1316. #endif
  1317. R1 = UNTAG(R1);
  1318. info = %INFO_PTR(R1);
  1319. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  1320. case BCO: {
  1321. arity = TO_W_(StgBCO_arity(R1));
  1322. ASSERT(arity > 0);
  1323. if (arity == 1) {
  1324. #ifdef PROFILING
  1325. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1326. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1327. W_[Sp+WDS(0)] = CCCS;
  1328. W_[Sp+WDS(1)] = stg_ap_pp_info;
  1329. Sp_adj(-2);
  1330. #else
  1331. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1332. W_[Sp+WDS(1)] = stg_ap_pp_info;
  1333. Sp_adj(0);
  1334. #endif
  1335. jump ENTRY_LBL(stg_BCO) [R1];
  1336. }
  1337. if (arity == 2) {
  1338. #ifdef PROFILING
  1339. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1340. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  1341. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  1342. W_[Sp+WDS(1)] = CCCS;
  1343. W_[Sp+WDS(2)] = stg_ap_p_info;
  1344. Sp_adj(-2);
  1345. #else
  1346. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1347. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  1348. W_[Sp+WDS(2)] = stg_ap_p_info;
  1349. Sp_adj(0);
  1350. #endif
  1351. jump ENTRY_LBL(stg_BCO) [R1];
  1352. }
  1353. if (arity == 3) {
  1354. Sp_adj(1);
  1355. jump ENTRY_LBL(stg_BCO) [R1];
  1356. } else {
  1357. BUILD_PAP(3,3,stg_ap_ppp_info,BCO);
  1358. }
  1359. }
  1360. case FUN,
  1361. FUN_1_0,
  1362. FUN_0_1,
  1363. FUN_2_0,
  1364. FUN_1_1,
  1365. FUN_0_2,
  1366. FUN_STATIC: {
  1367. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  1368. ASSERT(arity > 0);
  1369. if (arity == 1) {
  1370. R2 = W_[Sp+WDS(1)];
  1371. #ifdef PROFILING
  1372. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1373. W_[Sp+WDS(0)] = CCCS;
  1374. W_[Sp+WDS(1)] = stg_ap_pp_info;
  1375. Sp_adj(-1);
  1376. #else
  1377. W_[Sp+WDS(1)] = stg_ap_pp_info;
  1378. Sp_adj(1);
  1379. #endif
  1380. R1 = R1 + 1;
  1381. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  1382. }
  1383. if (arity == 2) {
  1384. R3 = W_[Sp+WDS(2)];
  1385. R2 = W_[Sp+WDS(1)];
  1386. #ifdef PROFILING
  1387. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  1388. W_[Sp+WDS(1)] = CCCS;
  1389. W_[Sp+WDS(2)] = stg_ap_p_info;
  1390. Sp_adj(0);
  1391. #else
  1392. W_[Sp+WDS(2)] = stg_ap_p_info;
  1393. Sp_adj(2);
  1394. #endif
  1395. R1 = R1 + 2;
  1396. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  1397. }
  1398. if (arity == 3) {
  1399. R4 = W_[Sp+WDS(3)];
  1400. R3 = W_[Sp+WDS(2)];
  1401. R2 = W_[Sp+WDS(1)];
  1402. Sp_adj(4);
  1403. R1 = R1 + 3;
  1404. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  1405. } else {
  1406. if (arity < 8) {
  1407. R1 = R1 + arity;
  1408. }
  1409. BUILD_PAP(3,3,stg_ap_ppp_info,FUN);
  1410. }
  1411. }
  1412. case PAP: {
  1413. arity = TO_W_(StgPAP_arity(R1));
  1414. ASSERT(arity > 0);
  1415. if (arity == 1) {
  1416. #ifdef PROFILING
  1417. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1418. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1419. W_[Sp+WDS(0)] = CCCS;
  1420. W_[Sp+WDS(1)] = stg_ap_pp_info;
  1421. Sp_adj(-2);
  1422. #else
  1423. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1424. W_[Sp+WDS(1)] = stg_ap_pp_info;
  1425. Sp_adj(0);
  1426. #endif
  1427. R2 = stg_ap_p_info;
  1428. jump stg_PAP_apply [R1,R2];
  1429. }
  1430. if (arity == 2) {
  1431. #ifdef PROFILING
  1432. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1433. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  1434. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  1435. W_[Sp+WDS(1)] = CCCS;
  1436. W_[Sp+WDS(2)] = stg_ap_p_info;
  1437. Sp_adj(-2);
  1438. #else
  1439. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1440. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  1441. W_[Sp+WDS(2)] = stg_ap_p_info;
  1442. Sp_adj(0);
  1443. #endif
  1444. R2 = stg_ap_pp_info;
  1445. jump stg_PAP_apply [R1,R2];
  1446. }
  1447. if (arity == 3) {
  1448. Sp_adj(1);
  1449. R2 = stg_ap_ppp_info;
  1450. jump stg_PAP_apply [R1,R2];
  1451. } else {
  1452. NEW_PAP(3,3,stg_ap_ppp_info,PAP);
  1453. }
  1454. }
  1455.  
  1456. case AP,
  1457. AP_STACK,
  1458. BLACKHOLE,
  1459. WHITEHOLE,
  1460. THUNK,
  1461. THUNK_1_0,
  1462. THUNK_0_1,
  1463. THUNK_2_0,
  1464. THUNK_1_1,
  1465. THUNK_0_2,
  1466. THUNK_STATIC,
  1467. THUNK_SELECTOR: {
  1468. Sp(0) = stg_ap_ppp_info;
  1469. jump_SAVE_CCCS(%ENTRY_CODE(info));
  1470.  
  1471. }
  1472. case IND,
  1473. IND_STATIC,
  1474. IND_PERM: {
  1475. R1 = StgInd_indirectee(R1);
  1476. goto again;
  1477. }
  1478.  
  1479. default: {
  1480. foreign "C" barf("stg_ap_ppp_ret") never returns;
  1481. }
  1482. }
  1483. }
  1484.  
  1485. INFO_TABLE_RET(stg_ap_pppv, RET_SMALL, W_ info_ptr, gcptr arg1,
  1486. gcptr arg2,
  1487. gcptr arg3, )
  1488. {
  1489. W_ info;
  1490. W_ arity;
  1491.  
  1492. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_pppv_ret... "); foreign "C" printClosure(R1 "ptr"));
  1493. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(4)"ptr"));
  1494. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1)));
  1495. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2)));
  1496. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(3)));
  1497. again:
  1498. if (GETTAG(R1)==4) {
  1499. R4 = W_[Sp+WDS(3)];
  1500. R3 = W_[Sp+WDS(2)];
  1501. R2 = W_[Sp+WDS(1)];
  1502. Sp_adj(4);
  1503. jump %GET_ENTRY(R1-4) [R1,R2,R3,R4];
  1504. }
  1505. #ifdef PROFILING
  1506. if (Sp - WDS(2) < SpLim) {
  1507. Sp(0) = stg_ap_pppv_info;
  1508. jump __stg_gc_enter_1 [R1];
  1509. }
  1510. #else
  1511. #endif
  1512. R1 = UNTAG(R1);
  1513. info = %INFO_PTR(R1);
  1514. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  1515. case BCO: {
  1516. arity = TO_W_(StgBCO_arity(R1));
  1517. ASSERT(arity > 0);
  1518. if (arity == 1) {
  1519. #ifdef PROFILING
  1520. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1521. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1522. W_[Sp+WDS(0)] = CCCS;
  1523. W_[Sp+WDS(1)] = stg_ap_ppv_info;
  1524. Sp_adj(-2);
  1525. #else
  1526. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1527. W_[Sp+WDS(1)] = stg_ap_ppv_info;
  1528. Sp_adj(0);
  1529. #endif
  1530. jump ENTRY_LBL(stg_BCO) [R1];
  1531. }
  1532. if (arity == 2) {
  1533. #ifdef PROFILING
  1534. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1535. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  1536. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  1537. W_[Sp+WDS(1)] = CCCS;
  1538. W_[Sp+WDS(2)] = stg_ap_pv_info;
  1539. Sp_adj(-2);
  1540. #else
  1541. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1542. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  1543. W_[Sp+WDS(2)] = stg_ap_pv_info;
  1544. Sp_adj(0);
  1545. #endif
  1546. jump ENTRY_LBL(stg_BCO) [R1];
  1547. }
  1548. if (arity == 3) {
  1549. #ifdef PROFILING
  1550. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1551. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  1552. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  1553. W_[Sp+WDS(1)] = stg_restore_cccs_info;
  1554. W_[Sp+WDS(2)] = CCCS;
  1555. W_[Sp+WDS(3)] = stg_ap_v_info;
  1556. Sp_adj(-2);
  1557. #else
  1558. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1559. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  1560. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  1561. W_[Sp+WDS(3)] = stg_ap_v_info;
  1562. Sp_adj(0);
  1563. #endif
  1564. jump ENTRY_LBL(stg_BCO) [R1];
  1565. }
  1566. if (arity == 4) {
  1567. Sp_adj(1);
  1568. jump ENTRY_LBL(stg_BCO) [R1];
  1569. } else {
  1570. BUILD_PAP(4,3,stg_ap_pppv_info,BCO);
  1571. }
  1572. }
  1573. case FUN,
  1574. FUN_1_0,
  1575. FUN_0_1,
  1576. FUN_2_0,
  1577. FUN_1_1,
  1578. FUN_0_2,
  1579. FUN_STATIC: {
  1580. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  1581. ASSERT(arity > 0);
  1582. if (arity == 1) {
  1583. R2 = W_[Sp+WDS(1)];
  1584. #ifdef PROFILING
  1585. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1586. W_[Sp+WDS(0)] = CCCS;
  1587. W_[Sp+WDS(1)] = stg_ap_ppv_info;
  1588. Sp_adj(-1);
  1589. #else
  1590. W_[Sp+WDS(1)] = stg_ap_ppv_info;
  1591. Sp_adj(1);
  1592. #endif
  1593. R1 = R1 + 1;
  1594. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  1595. }
  1596. if (arity == 2) {
  1597. R3 = W_[Sp+WDS(2)];
  1598. R2 = W_[Sp+WDS(1)];
  1599. #ifdef PROFILING
  1600. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  1601. W_[Sp+WDS(1)] = CCCS;
  1602. W_[Sp+WDS(2)] = stg_ap_pv_info;
  1603. Sp_adj(0);
  1604. #else
  1605. W_[Sp+WDS(2)] = stg_ap_pv_info;
  1606. Sp_adj(2);
  1607. #endif
  1608. R1 = R1 + 2;
  1609. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  1610. }
  1611. if (arity == 3) {
  1612. R4 = W_[Sp+WDS(3)];
  1613. R3 = W_[Sp+WDS(2)];
  1614. R2 = W_[Sp+WDS(1)];
  1615. #ifdef PROFILING
  1616. W_[Sp+WDS(1)] = stg_restore_cccs_info;
  1617. W_[Sp+WDS(2)] = CCCS;
  1618. W_[Sp+WDS(3)] = stg_ap_v_info;
  1619. Sp_adj(1);
  1620. #else
  1621. W_[Sp+WDS(3)] = stg_ap_v_info;
  1622. Sp_adj(3);
  1623. #endif
  1624. R1 = R1 + 3;
  1625. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  1626. }
  1627. if (arity == 4) {
  1628. R4 = W_[Sp+WDS(3)];
  1629. R3 = W_[Sp+WDS(2)];
  1630. R2 = W_[Sp+WDS(1)];
  1631. Sp_adj(4);
  1632. R1 = R1 + 4;
  1633. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  1634. } else {
  1635. if (arity < 8) {
  1636. R1 = R1 + arity;
  1637. }
  1638. BUILD_PAP(4,3,stg_ap_pppv_info,FUN);
  1639. }
  1640. }
  1641. case PAP: {
  1642. arity = TO_W_(StgPAP_arity(R1));
  1643. ASSERT(arity > 0);
  1644. if (arity == 1) {
  1645. #ifdef PROFILING
  1646. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1647. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1648. W_[Sp+WDS(0)] = CCCS;
  1649. W_[Sp+WDS(1)] = stg_ap_ppv_info;
  1650. Sp_adj(-2);
  1651. #else
  1652. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1653. W_[Sp+WDS(1)] = stg_ap_ppv_info;
  1654. Sp_adj(0);
  1655. #endif
  1656. R2 = stg_ap_p_info;
  1657. jump stg_PAP_apply [R1,R2];
  1658. }
  1659. if (arity == 2) {
  1660. #ifdef PROFILING
  1661. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1662. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  1663. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  1664. W_[Sp+WDS(1)] = CCCS;
  1665. W_[Sp+WDS(2)] = stg_ap_pv_info;
  1666. Sp_adj(-2);
  1667. #else
  1668. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1669. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  1670. W_[Sp+WDS(2)] = stg_ap_pv_info;
  1671. Sp_adj(0);
  1672. #endif
  1673. R2 = stg_ap_pp_info;
  1674. jump stg_PAP_apply [R1,R2];
  1675. }
  1676. if (arity == 3) {
  1677. #ifdef PROFILING
  1678. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1679. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  1680. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  1681. W_[Sp+WDS(1)] = stg_restore_cccs_info;
  1682. W_[Sp+WDS(2)] = CCCS;
  1683. W_[Sp+WDS(3)] = stg_ap_v_info;
  1684. Sp_adj(-2);
  1685. #else
  1686. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1687. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  1688. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  1689. W_[Sp+WDS(3)] = stg_ap_v_info;
  1690. Sp_adj(0);
  1691. #endif
  1692. R2 = stg_ap_ppp_info;
  1693. jump stg_PAP_apply [R1,R2];
  1694. }
  1695. if (arity == 4) {
  1696. Sp_adj(1);
  1697. R2 = stg_ap_pppv_info;
  1698. jump stg_PAP_apply [R1,R2];
  1699. } else {
  1700. NEW_PAP(4,3,stg_ap_pppv_info,PAP);
  1701. }
  1702. }
  1703.  
  1704. case AP,
  1705. AP_STACK,
  1706. BLACKHOLE,
  1707. WHITEHOLE,
  1708. THUNK,
  1709. THUNK_1_0,
  1710. THUNK_0_1,
  1711. THUNK_2_0,
  1712. THUNK_1_1,
  1713. THUNK_0_2,
  1714. THUNK_STATIC,
  1715. THUNK_SELECTOR: {
  1716. Sp(0) = stg_ap_pppv_info;
  1717. jump_SAVE_CCCS(%ENTRY_CODE(info));
  1718.  
  1719. }
  1720. case IND,
  1721. IND_STATIC,
  1722. IND_PERM: {
  1723. R1 = StgInd_indirectee(R1);
  1724. goto again;
  1725. }
  1726.  
  1727. default: {
  1728. foreign "C" barf("stg_ap_pppv_ret") never returns;
  1729. }
  1730. }
  1731. }
  1732.  
  1733. INFO_TABLE_RET(stg_ap_pppp, RET_SMALL, W_ info_ptr, gcptr arg1,
  1734. gcptr arg2,
  1735. gcptr arg3,
  1736. gcptr arg4, )
  1737. {
  1738. W_ info;
  1739. W_ arity;
  1740.  
  1741. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_pppp_ret... "); foreign "C" printClosure(R1 "ptr"));
  1742. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(5)"ptr"));
  1743. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1)));
  1744. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2)));
  1745. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(3)));
  1746. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(4)));
  1747. again:
  1748. if (GETTAG(R1)==4) {
  1749. R5 = W_[Sp+WDS(4)];
  1750. R4 = W_[Sp+WDS(3)];
  1751. R3 = W_[Sp+WDS(2)];
  1752. R2 = W_[Sp+WDS(1)];
  1753. Sp_adj(5);
  1754. jump %GET_ENTRY(R1-4) [R1,R2,R3,R4,R5];
  1755. }
  1756. #ifdef PROFILING
  1757. if (Sp - WDS(2) < SpLim) {
  1758. Sp(0) = stg_ap_pppp_info;
  1759. jump __stg_gc_enter_1 [R1];
  1760. }
  1761. #else
  1762. #endif
  1763. R1 = UNTAG(R1);
  1764. info = %INFO_PTR(R1);
  1765. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  1766. case BCO: {
  1767. arity = TO_W_(StgBCO_arity(R1));
  1768. ASSERT(arity > 0);
  1769. if (arity == 1) {
  1770. #ifdef PROFILING
  1771. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1772. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1773. W_[Sp+WDS(0)] = CCCS;
  1774. W_[Sp+WDS(1)] = stg_ap_ppp_info;
  1775. Sp_adj(-2);
  1776. #else
  1777. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1778. W_[Sp+WDS(1)] = stg_ap_ppp_info;
  1779. Sp_adj(0);
  1780. #endif
  1781. jump ENTRY_LBL(stg_BCO) [R1];
  1782. }
  1783. if (arity == 2) {
  1784. #ifdef PROFILING
  1785. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1786. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  1787. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  1788. W_[Sp+WDS(1)] = CCCS;
  1789. W_[Sp+WDS(2)] = stg_ap_pp_info;
  1790. Sp_adj(-2);
  1791. #else
  1792. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1793. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  1794. W_[Sp+WDS(2)] = stg_ap_pp_info;
  1795. Sp_adj(0);
  1796. #endif
  1797. jump ENTRY_LBL(stg_BCO) [R1];
  1798. }
  1799. if (arity == 3) {
  1800. #ifdef PROFILING
  1801. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1802. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  1803. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  1804. W_[Sp+WDS(1)] = stg_restore_cccs_info;
  1805. W_[Sp+WDS(2)] = CCCS;
  1806. W_[Sp+WDS(3)] = stg_ap_p_info;
  1807. Sp_adj(-2);
  1808. #else
  1809. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1810. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  1811. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  1812. W_[Sp+WDS(3)] = stg_ap_p_info;
  1813. Sp_adj(0);
  1814. #endif
  1815. jump ENTRY_LBL(stg_BCO) [R1];
  1816. }
  1817. if (arity == 4) {
  1818. Sp_adj(1);
  1819. jump ENTRY_LBL(stg_BCO) [R1];
  1820. } else {
  1821. BUILD_PAP(4,4,stg_ap_pppp_info,BCO);
  1822. }
  1823. }
  1824. case FUN,
  1825. FUN_1_0,
  1826. FUN_0_1,
  1827. FUN_2_0,
  1828. FUN_1_1,
  1829. FUN_0_2,
  1830. FUN_STATIC: {
  1831. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  1832. ASSERT(arity > 0);
  1833. if (arity == 1) {
  1834. R2 = W_[Sp+WDS(1)];
  1835. #ifdef PROFILING
  1836. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1837. W_[Sp+WDS(0)] = CCCS;
  1838. W_[Sp+WDS(1)] = stg_ap_ppp_info;
  1839. Sp_adj(-1);
  1840. #else
  1841. W_[Sp+WDS(1)] = stg_ap_ppp_info;
  1842. Sp_adj(1);
  1843. #endif
  1844. R1 = R1 + 1;
  1845. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5];
  1846. }
  1847. if (arity == 2) {
  1848. R3 = W_[Sp+WDS(2)];
  1849. R2 = W_[Sp+WDS(1)];
  1850. #ifdef PROFILING
  1851. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  1852. W_[Sp+WDS(1)] = CCCS;
  1853. W_[Sp+WDS(2)] = stg_ap_pp_info;
  1854. Sp_adj(0);
  1855. #else
  1856. W_[Sp+WDS(2)] = stg_ap_pp_info;
  1857. Sp_adj(2);
  1858. #endif
  1859. R1 = R1 + 2;
  1860. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5];
  1861. }
  1862. if (arity == 3) {
  1863. R4 = W_[Sp+WDS(3)];
  1864. R3 = W_[Sp+WDS(2)];
  1865. R2 = W_[Sp+WDS(1)];
  1866. #ifdef PROFILING
  1867. W_[Sp+WDS(1)] = stg_restore_cccs_info;
  1868. W_[Sp+WDS(2)] = CCCS;
  1869. W_[Sp+WDS(3)] = stg_ap_p_info;
  1870. Sp_adj(1);
  1871. #else
  1872. W_[Sp+WDS(3)] = stg_ap_p_info;
  1873. Sp_adj(3);
  1874. #endif
  1875. R1 = R1 + 3;
  1876. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5];
  1877. }
  1878. if (arity == 4) {
  1879. R5 = W_[Sp+WDS(4)];
  1880. R4 = W_[Sp+WDS(3)];
  1881. R3 = W_[Sp+WDS(2)];
  1882. R2 = W_[Sp+WDS(1)];
  1883. Sp_adj(5);
  1884. R1 = R1 + 4;
  1885. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5];
  1886. } else {
  1887. if (arity < 8) {
  1888. R1 = R1 + arity;
  1889. }
  1890. BUILD_PAP(4,4,stg_ap_pppp_info,FUN);
  1891. }
  1892. }
  1893. case PAP: {
  1894. arity = TO_W_(StgPAP_arity(R1));
  1895. ASSERT(arity > 0);
  1896. if (arity == 1) {
  1897. #ifdef PROFILING
  1898. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1899. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  1900. W_[Sp+WDS(0)] = CCCS;
  1901. W_[Sp+WDS(1)] = stg_ap_ppp_info;
  1902. Sp_adj(-2);
  1903. #else
  1904. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1905. W_[Sp+WDS(1)] = stg_ap_ppp_info;
  1906. Sp_adj(0);
  1907. #endif
  1908. R2 = stg_ap_p_info;
  1909. jump stg_PAP_apply [R1,R2];
  1910. }
  1911. if (arity == 2) {
  1912. #ifdef PROFILING
  1913. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1914. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  1915. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  1916. W_[Sp+WDS(1)] = CCCS;
  1917. W_[Sp+WDS(2)] = stg_ap_pp_info;
  1918. Sp_adj(-2);
  1919. #else
  1920. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1921. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  1922. W_[Sp+WDS(2)] = stg_ap_pp_info;
  1923. Sp_adj(0);
  1924. #endif
  1925. R2 = stg_ap_pp_info;
  1926. jump stg_PAP_apply [R1,R2];
  1927. }
  1928. if (arity == 3) {
  1929. #ifdef PROFILING
  1930. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  1931. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  1932. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  1933. W_[Sp+WDS(1)] = stg_restore_cccs_info;
  1934. W_[Sp+WDS(2)] = CCCS;
  1935. W_[Sp+WDS(3)] = stg_ap_p_info;
  1936. Sp_adj(-2);
  1937. #else
  1938. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  1939. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  1940. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  1941. W_[Sp+WDS(3)] = stg_ap_p_info;
  1942. Sp_adj(0);
  1943. #endif
  1944. R2 = stg_ap_ppp_info;
  1945. jump stg_PAP_apply [R1,R2];
  1946. }
  1947. if (arity == 4) {
  1948. Sp_adj(1);
  1949. R2 = stg_ap_pppp_info;
  1950. jump stg_PAP_apply [R1,R2];
  1951. } else {
  1952. NEW_PAP(4,4,stg_ap_pppp_info,PAP);
  1953. }
  1954. }
  1955.  
  1956. case AP,
  1957. AP_STACK,
  1958. BLACKHOLE,
  1959. WHITEHOLE,
  1960. THUNK,
  1961. THUNK_1_0,
  1962. THUNK_0_1,
  1963. THUNK_2_0,
  1964. THUNK_1_1,
  1965. THUNK_0_2,
  1966. THUNK_STATIC,
  1967. THUNK_SELECTOR: {
  1968. Sp(0) = stg_ap_pppp_info;
  1969. jump_SAVE_CCCS(%ENTRY_CODE(info));
  1970.  
  1971. }
  1972. case IND,
  1973. IND_STATIC,
  1974. IND_PERM: {
  1975. R1 = StgInd_indirectee(R1);
  1976. goto again;
  1977. }
  1978.  
  1979. default: {
  1980. foreign "C" barf("stg_ap_pppp_ret") never returns;
  1981. }
  1982. }
  1983. }
  1984.  
  1985. INFO_TABLE_RET(stg_ap_ppppp, RET_SMALL, W_ info_ptr, gcptr arg1,
  1986. gcptr arg2,
  1987. gcptr arg3,
  1988. gcptr arg4,
  1989. gcptr arg5, )
  1990. {
  1991. W_ info;
  1992. W_ arity;
  1993.  
  1994. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_ppppp_ret... "); foreign "C" printClosure(R1 "ptr"));
  1995. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(6)"ptr"));
  1996. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1)));
  1997. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2)));
  1998. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(3)));
  1999. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(4)));
  2000. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(5)));
  2001. again:
  2002. if (GETTAG(R1)==5) {
  2003. R6 = W_[Sp+WDS(5)];
  2004. R5 = W_[Sp+WDS(4)];
  2005. R4 = W_[Sp+WDS(3)];
  2006. R3 = W_[Sp+WDS(2)];
  2007. R2 = W_[Sp+WDS(1)];
  2008. Sp_adj(6);
  2009. jump %GET_ENTRY(R1-5) [R1,R2,R3,R4,R5,R6];
  2010. }
  2011. #ifdef PROFILING
  2012. if (Sp - WDS(2) < SpLim) {
  2013. Sp(0) = stg_ap_ppppp_info;
  2014. jump __stg_gc_enter_1 [R1];
  2015. }
  2016. #else
  2017. #endif
  2018. R1 = UNTAG(R1);
  2019. info = %INFO_PTR(R1);
  2020. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  2021. case BCO: {
  2022. arity = TO_W_(StgBCO_arity(R1));
  2023. ASSERT(arity > 0);
  2024. if (arity == 1) {
  2025. #ifdef PROFILING
  2026. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2027. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  2028. W_[Sp+WDS(0)] = CCCS;
  2029. W_[Sp+WDS(1)] = stg_ap_pppp_info;
  2030. Sp_adj(-2);
  2031. #else
  2032. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2033. W_[Sp+WDS(1)] = stg_ap_pppp_info;
  2034. Sp_adj(0);
  2035. #endif
  2036. jump ENTRY_LBL(stg_BCO) [R1];
  2037. }
  2038. if (arity == 2) {
  2039. #ifdef PROFILING
  2040. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2041. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2042. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  2043. W_[Sp+WDS(1)] = CCCS;
  2044. W_[Sp+WDS(2)] = stg_ap_ppp_info;
  2045. Sp_adj(-2);
  2046. #else
  2047. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2048. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2049. W_[Sp+WDS(2)] = stg_ap_ppp_info;
  2050. Sp_adj(0);
  2051. #endif
  2052. jump ENTRY_LBL(stg_BCO) [R1];
  2053. }
  2054. if (arity == 3) {
  2055. #ifdef PROFILING
  2056. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2057. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2058. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  2059. W_[Sp+WDS(1)] = stg_restore_cccs_info;
  2060. W_[Sp+WDS(2)] = CCCS;
  2061. W_[Sp+WDS(3)] = stg_ap_pp_info;
  2062. Sp_adj(-2);
  2063. #else
  2064. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2065. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2066. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  2067. W_[Sp+WDS(3)] = stg_ap_pp_info;
  2068. Sp_adj(0);
  2069. #endif
  2070. jump ENTRY_LBL(stg_BCO) [R1];
  2071. }
  2072. if (arity == 4) {
  2073. #ifdef PROFILING
  2074. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2075. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2076. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  2077. W_[Sp+WDS(1)] = W_[Sp+WDS(4)];
  2078. W_[Sp+WDS(2)] = stg_restore_cccs_info;
  2079. W_[Sp+WDS(3)] = CCCS;
  2080. W_[Sp+WDS(4)] = stg_ap_p_info;
  2081. Sp_adj(-2);
  2082. #else
  2083. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2084. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2085. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  2086. W_[Sp+WDS(3)] = W_[Sp+WDS(4)];
  2087. W_[Sp+WDS(4)] = stg_ap_p_info;
  2088. Sp_adj(0);
  2089. #endif
  2090. jump ENTRY_LBL(stg_BCO) [R1];
  2091. }
  2092. if (arity == 5) {
  2093. Sp_adj(1);
  2094. jump ENTRY_LBL(stg_BCO) [R1];
  2095. } else {
  2096. BUILD_PAP(5,5,stg_ap_ppppp_info,BCO);
  2097. }
  2098. }
  2099. case FUN,
  2100. FUN_1_0,
  2101. FUN_0_1,
  2102. FUN_2_0,
  2103. FUN_1_1,
  2104. FUN_0_2,
  2105. FUN_STATIC: {
  2106. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  2107. ASSERT(arity > 0);
  2108. if (arity == 1) {
  2109. R2 = W_[Sp+WDS(1)];
  2110. #ifdef PROFILING
  2111. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  2112. W_[Sp+WDS(0)] = CCCS;
  2113. W_[Sp+WDS(1)] = stg_ap_pppp_info;
  2114. Sp_adj(-1);
  2115. #else
  2116. W_[Sp+WDS(1)] = stg_ap_pppp_info;
  2117. Sp_adj(1);
  2118. #endif
  2119. R1 = R1 + 1;
  2120. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  2121. }
  2122. if (arity == 2) {
  2123. R3 = W_[Sp+WDS(2)];
  2124. R2 = W_[Sp+WDS(1)];
  2125. #ifdef PROFILING
  2126. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  2127. W_[Sp+WDS(1)] = CCCS;
  2128. W_[Sp+WDS(2)] = stg_ap_ppp_info;
  2129. Sp_adj(0);
  2130. #else
  2131. W_[Sp+WDS(2)] = stg_ap_ppp_info;
  2132. Sp_adj(2);
  2133. #endif
  2134. R1 = R1 + 2;
  2135. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  2136. }
  2137. if (arity == 3) {
  2138. R4 = W_[Sp+WDS(3)];
  2139. R3 = W_[Sp+WDS(2)];
  2140. R2 = W_[Sp+WDS(1)];
  2141. #ifdef PROFILING
  2142. W_[Sp+WDS(1)] = stg_restore_cccs_info;
  2143. W_[Sp+WDS(2)] = CCCS;
  2144. W_[Sp+WDS(3)] = stg_ap_pp_info;
  2145. Sp_adj(1);
  2146. #else
  2147. W_[Sp+WDS(3)] = stg_ap_pp_info;
  2148. Sp_adj(3);
  2149. #endif
  2150. R1 = R1 + 3;
  2151. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  2152. }
  2153. if (arity == 4) {
  2154. R5 = W_[Sp+WDS(4)];
  2155. R4 = W_[Sp+WDS(3)];
  2156. R3 = W_[Sp+WDS(2)];
  2157. R2 = W_[Sp+WDS(1)];
  2158. #ifdef PROFILING
  2159. W_[Sp+WDS(2)] = stg_restore_cccs_info;
  2160. W_[Sp+WDS(3)] = CCCS;
  2161. W_[Sp+WDS(4)] = stg_ap_p_info;
  2162. Sp_adj(2);
  2163. #else
  2164. W_[Sp+WDS(4)] = stg_ap_p_info;
  2165. Sp_adj(4);
  2166. #endif
  2167. R1 = R1 + 4;
  2168. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  2169. }
  2170. if (arity == 5) {
  2171. R6 = W_[Sp+WDS(5)];
  2172. R5 = W_[Sp+WDS(4)];
  2173. R4 = W_[Sp+WDS(3)];
  2174. R3 = W_[Sp+WDS(2)];
  2175. R2 = W_[Sp+WDS(1)];
  2176. Sp_adj(6);
  2177. R1 = R1 + 5;
  2178. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  2179. } else {
  2180. if (arity < 8) {
  2181. R1 = R1 + arity;
  2182. }
  2183. BUILD_PAP(5,5,stg_ap_ppppp_info,FUN);
  2184. }
  2185. }
  2186. case PAP: {
  2187. arity = TO_W_(StgPAP_arity(R1));
  2188. ASSERT(arity > 0);
  2189. if (arity == 1) {
  2190. #ifdef PROFILING
  2191. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2192. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  2193. W_[Sp+WDS(0)] = CCCS;
  2194. W_[Sp+WDS(1)] = stg_ap_pppp_info;
  2195. Sp_adj(-2);
  2196. #else
  2197. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2198. W_[Sp+WDS(1)] = stg_ap_pppp_info;
  2199. Sp_adj(0);
  2200. #endif
  2201. R2 = stg_ap_p_info;
  2202. jump stg_PAP_apply [R1,R2];
  2203. }
  2204. if (arity == 2) {
  2205. #ifdef PROFILING
  2206. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2207. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2208. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  2209. W_[Sp+WDS(1)] = CCCS;
  2210. W_[Sp+WDS(2)] = stg_ap_ppp_info;
  2211. Sp_adj(-2);
  2212. #else
  2213. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2214. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2215. W_[Sp+WDS(2)] = stg_ap_ppp_info;
  2216. Sp_adj(0);
  2217. #endif
  2218. R2 = stg_ap_pp_info;
  2219. jump stg_PAP_apply [R1,R2];
  2220. }
  2221. if (arity == 3) {
  2222. #ifdef PROFILING
  2223. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2224. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2225. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  2226. W_[Sp+WDS(1)] = stg_restore_cccs_info;
  2227. W_[Sp+WDS(2)] = CCCS;
  2228. W_[Sp+WDS(3)] = stg_ap_pp_info;
  2229. Sp_adj(-2);
  2230. #else
  2231. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2232. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2233. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  2234. W_[Sp+WDS(3)] = stg_ap_pp_info;
  2235. Sp_adj(0);
  2236. #endif
  2237. R2 = stg_ap_ppp_info;
  2238. jump stg_PAP_apply [R1,R2];
  2239. }
  2240. if (arity == 4) {
  2241. #ifdef PROFILING
  2242. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2243. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2244. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  2245. W_[Sp+WDS(1)] = W_[Sp+WDS(4)];
  2246. W_[Sp+WDS(2)] = stg_restore_cccs_info;
  2247. W_[Sp+WDS(3)] = CCCS;
  2248. W_[Sp+WDS(4)] = stg_ap_p_info;
  2249. Sp_adj(-2);
  2250. #else
  2251. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2252. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2253. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  2254. W_[Sp+WDS(3)] = W_[Sp+WDS(4)];
  2255. W_[Sp+WDS(4)] = stg_ap_p_info;
  2256. Sp_adj(0);
  2257. #endif
  2258. R2 = stg_ap_pppp_info;
  2259. jump stg_PAP_apply [R1,R2];
  2260. }
  2261. if (arity == 5) {
  2262. Sp_adj(1);
  2263. R2 = stg_ap_ppppp_info;
  2264. jump stg_PAP_apply [R1,R2];
  2265. } else {
  2266. NEW_PAP(5,5,stg_ap_ppppp_info,PAP);
  2267. }
  2268. }
  2269.  
  2270. case AP,
  2271. AP_STACK,
  2272. BLACKHOLE,
  2273. WHITEHOLE,
  2274. THUNK,
  2275. THUNK_1_0,
  2276. THUNK_0_1,
  2277. THUNK_2_0,
  2278. THUNK_1_1,
  2279. THUNK_0_2,
  2280. THUNK_STATIC,
  2281. THUNK_SELECTOR: {
  2282. Sp(0) = stg_ap_ppppp_info;
  2283. jump_SAVE_CCCS(%ENTRY_CODE(info));
  2284.  
  2285. }
  2286. case IND,
  2287. IND_STATIC,
  2288. IND_PERM: {
  2289. R1 = StgInd_indirectee(R1);
  2290. goto again;
  2291. }
  2292.  
  2293. default: {
  2294. foreign "C" barf("stg_ap_ppppp_ret") never returns;
  2295. }
  2296. }
  2297. }
  2298.  
  2299. INFO_TABLE_RET(stg_ap_pppppp, RET_SMALL, W_ info_ptr, gcptr arg1,
  2300. gcptr arg2,
  2301. gcptr arg3,
  2302. gcptr arg4,
  2303. gcptr arg5,
  2304. gcptr arg6, )
  2305. {
  2306. W_ info;
  2307. W_ arity;
  2308.  
  2309. IF_DEBUG(apply,foreign "C" debugBelch("stg_ap_pppppp_ret... "); foreign "C" printClosure(R1 "ptr"));
  2310. IF_DEBUG(sanity,foreign "C" checkStackFrame(Sp+WDS(7)"ptr"));
  2311. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(1)));
  2312. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(2)));
  2313. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(3)));
  2314. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(4)));
  2315. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(5)));
  2316. ASSERT(LOOKS_LIKE_CLOSURE_PTR(Sp(6)));
  2317. again:
  2318. if (GETTAG(R1)==6) {
  2319. R6 = W_[Sp+WDS(5)];
  2320. R5 = W_[Sp+WDS(4)];
  2321. R4 = W_[Sp+WDS(3)];
  2322. R3 = W_[Sp+WDS(2)];
  2323. R2 = W_[Sp+WDS(1)];
  2324. Sp_adj(6);
  2325. jump %GET_ENTRY(R1-6) [R1,R2,R3,R4,R5,R6];
  2326. }
  2327. #ifdef PROFILING
  2328. if (Sp - WDS(2) < SpLim) {
  2329. Sp(0) = stg_ap_pppppp_info;
  2330. jump __stg_gc_enter_1 [R1];
  2331. }
  2332. #else
  2333. #endif
  2334. R1 = UNTAG(R1);
  2335. info = %INFO_PTR(R1);
  2336. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(%STD_INFO(info)))) {
  2337. case BCO: {
  2338. arity = TO_W_(StgBCO_arity(R1));
  2339. ASSERT(arity > 0);
  2340. if (arity == 1) {
  2341. #ifdef PROFILING
  2342. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2343. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  2344. W_[Sp+WDS(0)] = CCCS;
  2345. W_[Sp+WDS(1)] = stg_ap_ppppp_info;
  2346. Sp_adj(-2);
  2347. #else
  2348. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2349. W_[Sp+WDS(1)] = stg_ap_ppppp_info;
  2350. Sp_adj(0);
  2351. #endif
  2352. jump ENTRY_LBL(stg_BCO) [R1];
  2353. }
  2354. if (arity == 2) {
  2355. #ifdef PROFILING
  2356. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2357. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2358. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  2359. W_[Sp+WDS(1)] = CCCS;
  2360. W_[Sp+WDS(2)] = stg_ap_pppp_info;
  2361. Sp_adj(-2);
  2362. #else
  2363. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2364. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2365. W_[Sp+WDS(2)] = stg_ap_pppp_info;
  2366. Sp_adj(0);
  2367. #endif
  2368. jump ENTRY_LBL(stg_BCO) [R1];
  2369. }
  2370. if (arity == 3) {
  2371. #ifdef PROFILING
  2372. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2373. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2374. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  2375. W_[Sp+WDS(1)] = stg_restore_cccs_info;
  2376. W_[Sp+WDS(2)] = CCCS;
  2377. W_[Sp+WDS(3)] = stg_ap_ppp_info;
  2378. Sp_adj(-2);
  2379. #else
  2380. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2381. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2382. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  2383. W_[Sp+WDS(3)] = stg_ap_ppp_info;
  2384. Sp_adj(0);
  2385. #endif
  2386. jump ENTRY_LBL(stg_BCO) [R1];
  2387. }
  2388. if (arity == 4) {
  2389. #ifdef PROFILING
  2390. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2391. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2392. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  2393. W_[Sp+WDS(1)] = W_[Sp+WDS(4)];
  2394. W_[Sp+WDS(2)] = stg_restore_cccs_info;
  2395. W_[Sp+WDS(3)] = CCCS;
  2396. W_[Sp+WDS(4)] = stg_ap_pp_info;
  2397. Sp_adj(-2);
  2398. #else
  2399. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2400. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2401. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  2402. W_[Sp+WDS(3)] = W_[Sp+WDS(4)];
  2403. W_[Sp+WDS(4)] = stg_ap_pp_info;
  2404. Sp_adj(0);
  2405. #endif
  2406. jump ENTRY_LBL(stg_BCO) [R1];
  2407. }
  2408. if (arity == 5) {
  2409. #ifdef PROFILING
  2410. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2411. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2412. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  2413. W_[Sp+WDS(1)] = W_[Sp+WDS(4)];
  2414. W_[Sp+WDS(2)] = W_[Sp+WDS(5)];
  2415. W_[Sp+WDS(3)] = stg_restore_cccs_info;
  2416. W_[Sp+WDS(4)] = CCCS;
  2417. W_[Sp+WDS(5)] = stg_ap_p_info;
  2418. Sp_adj(-2);
  2419. #else
  2420. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2421. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2422. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  2423. W_[Sp+WDS(3)] = W_[Sp+WDS(4)];
  2424. W_[Sp+WDS(4)] = W_[Sp+WDS(5)];
  2425. W_[Sp+WDS(5)] = stg_ap_p_info;
  2426. Sp_adj(0);
  2427. #endif
  2428. jump ENTRY_LBL(stg_BCO) [R1];
  2429. }
  2430. if (arity == 6) {
  2431. Sp_adj(1);
  2432. jump ENTRY_LBL(stg_BCO) [R1];
  2433. } else {
  2434. BUILD_PAP(6,6,stg_ap_pppppp_info,BCO);
  2435. }
  2436. }
  2437. case FUN,
  2438. FUN_1_0,
  2439. FUN_0_1,
  2440. FUN_2_0,
  2441. FUN_1_1,
  2442. FUN_0_2,
  2443. FUN_STATIC: {
  2444. arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info)));
  2445. ASSERT(arity > 0);
  2446. if (arity == 1) {
  2447. R2 = W_[Sp+WDS(1)];
  2448. #ifdef PROFILING
  2449. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  2450. W_[Sp+WDS(0)] = CCCS;
  2451. W_[Sp+WDS(1)] = stg_ap_ppppp_info;
  2452. Sp_adj(-1);
  2453. #else
  2454. W_[Sp+WDS(1)] = stg_ap_ppppp_info;
  2455. Sp_adj(1);
  2456. #endif
  2457. R1 = R1 + 1;
  2458. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  2459. }
  2460. if (arity == 2) {
  2461. R3 = W_[Sp+WDS(2)];
  2462. R2 = W_[Sp+WDS(1)];
  2463. #ifdef PROFILING
  2464. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  2465. W_[Sp+WDS(1)] = CCCS;
  2466. W_[Sp+WDS(2)] = stg_ap_pppp_info;
  2467. Sp_adj(0);
  2468. #else
  2469. W_[Sp+WDS(2)] = stg_ap_pppp_info;
  2470. Sp_adj(2);
  2471. #endif
  2472. R1 = R1 + 2;
  2473. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  2474. }
  2475. if (arity == 3) {
  2476. R4 = W_[Sp+WDS(3)];
  2477. R3 = W_[Sp+WDS(2)];
  2478. R2 = W_[Sp+WDS(1)];
  2479. #ifdef PROFILING
  2480. W_[Sp+WDS(1)] = stg_restore_cccs_info;
  2481. W_[Sp+WDS(2)] = CCCS;
  2482. W_[Sp+WDS(3)] = stg_ap_ppp_info;
  2483. Sp_adj(1);
  2484. #else
  2485. W_[Sp+WDS(3)] = stg_ap_ppp_info;
  2486. Sp_adj(3);
  2487. #endif
  2488. R1 = R1 + 3;
  2489. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  2490. }
  2491. if (arity == 4) {
  2492. R5 = W_[Sp+WDS(4)];
  2493. R4 = W_[Sp+WDS(3)];
  2494. R3 = W_[Sp+WDS(2)];
  2495. R2 = W_[Sp+WDS(1)];
  2496. #ifdef PROFILING
  2497. W_[Sp+WDS(2)] = stg_restore_cccs_info;
  2498. W_[Sp+WDS(3)] = CCCS;
  2499. W_[Sp+WDS(4)] = stg_ap_pp_info;
  2500. Sp_adj(2);
  2501. #else
  2502. W_[Sp+WDS(4)] = stg_ap_pp_info;
  2503. Sp_adj(4);
  2504. #endif
  2505. R1 = R1 + 4;
  2506. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  2507. }
  2508. if (arity == 5) {
  2509. R6 = W_[Sp+WDS(5)];
  2510. R5 = W_[Sp+WDS(4)];
  2511. R4 = W_[Sp+WDS(3)];
  2512. R3 = W_[Sp+WDS(2)];
  2513. R2 = W_[Sp+WDS(1)];
  2514. #ifdef PROFILING
  2515. W_[Sp+WDS(3)] = stg_restore_cccs_info;
  2516. W_[Sp+WDS(4)] = CCCS;
  2517. W_[Sp+WDS(5)] = stg_ap_p_info;
  2518. Sp_adj(3);
  2519. #else
  2520. W_[Sp+WDS(5)] = stg_ap_p_info;
  2521. Sp_adj(5);
  2522. #endif
  2523. R1 = R1 + 5;
  2524. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  2525. }
  2526. if (arity == 6) {
  2527. R6 = W_[Sp+WDS(5)];
  2528. R5 = W_[Sp+WDS(4)];
  2529. R4 = W_[Sp+WDS(3)];
  2530. R3 = W_[Sp+WDS(2)];
  2531. R2 = W_[Sp+WDS(1)];
  2532. Sp_adj(6);
  2533. R1 = R1 + 6;
  2534. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  2535. } else {
  2536. if (arity < 8) {
  2537. R1 = R1 + arity;
  2538. }
  2539. BUILD_PAP(6,6,stg_ap_pppppp_info,FUN);
  2540. }
  2541. }
  2542. case PAP: {
  2543. arity = TO_W_(StgPAP_arity(R1));
  2544. ASSERT(arity > 0);
  2545. if (arity == 1) {
  2546. #ifdef PROFILING
  2547. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2548. W_[Sp+WDS(-1)] = stg_restore_cccs_info;
  2549. W_[Sp+WDS(0)] = CCCS;
  2550. W_[Sp+WDS(1)] = stg_ap_ppppp_info;
  2551. Sp_adj(-2);
  2552. #else
  2553. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2554. W_[Sp+WDS(1)] = stg_ap_ppppp_info;
  2555. Sp_adj(0);
  2556. #endif
  2557. R2 = stg_ap_p_info;
  2558. jump stg_PAP_apply [R1,R2];
  2559. }
  2560. if (arity == 2) {
  2561. #ifdef PROFILING
  2562. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2563. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2564. W_[Sp+WDS(0)] = stg_restore_cccs_info;
  2565. W_[Sp+WDS(1)] = CCCS;
  2566. W_[Sp+WDS(2)] = stg_ap_pppp_info;
  2567. Sp_adj(-2);
  2568. #else
  2569. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2570. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2571. W_[Sp+WDS(2)] = stg_ap_pppp_info;
  2572. Sp_adj(0);
  2573. #endif
  2574. R2 = stg_ap_pp_info;
  2575. jump stg_PAP_apply [R1,R2];
  2576. }
  2577. if (arity == 3) {
  2578. #ifdef PROFILING
  2579. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2580. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2581. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  2582. W_[Sp+WDS(1)] = stg_restore_cccs_info;
  2583. W_[Sp+WDS(2)] = CCCS;
  2584. W_[Sp+WDS(3)] = stg_ap_ppp_info;
  2585. Sp_adj(-2);
  2586. #else
  2587. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2588. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2589. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  2590. W_[Sp+WDS(3)] = stg_ap_ppp_info;
  2591. Sp_adj(0);
  2592. #endif
  2593. R2 = stg_ap_ppp_info;
  2594. jump stg_PAP_apply [R1,R2];
  2595. }
  2596. if (arity == 4) {
  2597. #ifdef PROFILING
  2598. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2599. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2600. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  2601. W_[Sp+WDS(1)] = W_[Sp+WDS(4)];
  2602. W_[Sp+WDS(2)] = stg_restore_cccs_info;
  2603. W_[Sp+WDS(3)] = CCCS;
  2604. W_[Sp+WDS(4)] = stg_ap_pp_info;
  2605. Sp_adj(-2);
  2606. #else
  2607. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2608. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2609. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  2610. W_[Sp+WDS(3)] = W_[Sp+WDS(4)];
  2611. W_[Sp+WDS(4)] = stg_ap_pp_info;
  2612. Sp_adj(0);
  2613. #endif
  2614. R2 = stg_ap_pppp_info;
  2615. jump stg_PAP_apply [R1,R2];
  2616. }
  2617. if (arity == 5) {
  2618. #ifdef PROFILING
  2619. W_[Sp+WDS(-2)] = W_[Sp+WDS(1)];
  2620. W_[Sp+WDS(-1)] = W_[Sp+WDS(2)];
  2621. W_[Sp+WDS(0)] = W_[Sp+WDS(3)];
  2622. W_[Sp+WDS(1)] = W_[Sp+WDS(4)];
  2623. W_[Sp+WDS(2)] = W_[Sp+WDS(5)];
  2624. W_[Sp+WDS(3)] = stg_restore_cccs_info;
  2625. W_[Sp+WDS(4)] = CCCS;
  2626. W_[Sp+WDS(5)] = stg_ap_p_info;
  2627. Sp_adj(-2);
  2628. #else
  2629. W_[Sp+WDS(0)] = W_[Sp+WDS(1)];
  2630. W_[Sp+WDS(1)] = W_[Sp+WDS(2)];
  2631. W_[Sp+WDS(2)] = W_[Sp+WDS(3)];
  2632. W_[Sp+WDS(3)] = W_[Sp+WDS(4)];
  2633. W_[Sp+WDS(4)] = W_[Sp+WDS(5)];
  2634. W_[Sp+WDS(5)] = stg_ap_p_info;
  2635. Sp_adj(0);
  2636. #endif
  2637. R2 = stg_ap_ppppp_info;
  2638. jump stg_PAP_apply [R1,R2];
  2639. }
  2640. if (arity == 6) {
  2641. Sp_adj(1);
  2642. R2 = stg_ap_pppppp_info;
  2643. jump stg_PAP_apply [R1,R2];
  2644. } else {
  2645. NEW_PAP(6,6,stg_ap_pppppp_info,PAP);
  2646. }
  2647. }
  2648.  
  2649. case AP,
  2650. AP_STACK,
  2651. BLACKHOLE,
  2652. WHITEHOLE,
  2653. THUNK,
  2654. THUNK_1_0,
  2655. THUNK_0_1,
  2656. THUNK_2_0,
  2657. THUNK_1_1,
  2658. THUNK_0_2,
  2659. THUNK_STATIC,
  2660. THUNK_SELECTOR: {
  2661. Sp(0) = stg_ap_pppppp_info;
  2662. jump_SAVE_CCCS(%ENTRY_CODE(info));
  2663.  
  2664. }
  2665. case IND,
  2666. IND_STATIC,
  2667. IND_PERM: {
  2668. R1 = StgInd_indirectee(R1);
  2669. goto again;
  2670. }
  2671.  
  2672. default: {
  2673. foreign "C" barf("stg_ap_pppppp_ret") never returns;
  2674. }
  2675. }
  2676. }
  2677. stg_ap_stk_
  2678. { Sp_adj(0);
  2679. jump %GET_ENTRY(UNTAG(R1)) [R1];
  2680. }
  2681. stg_stk_save_
  2682. { Sp_adj(-3);
  2683. Sp(2) = R1;
  2684. Sp(1) = 0;
  2685. Sp(0) = stg_gc_fun_info;
  2686. jump stg_gc_noregs [];
  2687. }
  2688.  
  2689. stg_ap_stk_n
  2690. { R2 = W_[Sp+WDS(0)];
  2691. Sp_adj(1);
  2692. jump %GET_ENTRY(UNTAG(R1)) [R1,R2];
  2693. }
  2694. stg_stk_save_n
  2695. { Sp_adj(-4);
  2696. W_[Sp+WDS(3)] = R2;
  2697. Sp(2) = R1;
  2698. Sp(1) = 1;
  2699. Sp(0) = stg_gc_fun_info;
  2700. jump stg_gc_noregs [];
  2701. }
  2702.  
  2703. stg_ap_stk_p
  2704. { R2 = W_[Sp+WDS(0)];
  2705. Sp_adj(1);
  2706. jump %GET_ENTRY(UNTAG(R1)) [R1,R2];
  2707. }
  2708. stg_stk_save_p
  2709. { Sp_adj(-4);
  2710. W_[Sp+WDS(3)] = R2;
  2711. Sp(2) = R1;
  2712. Sp(1) = 1;
  2713. Sp(0) = stg_gc_fun_info;
  2714. jump stg_gc_noregs [];
  2715. }
  2716.  
  2717. stg_ap_stk_f
  2718. { F1 = F_[Sp+WDS(0)];
  2719. Sp_adj(1);
  2720. jump %GET_ENTRY(UNTAG(R1)) [F1,R1];
  2721. }
  2722. stg_stk_save_f
  2723. { Sp_adj(-4);
  2724. F_[Sp+WDS(3)] = F1;
  2725. Sp(2) = R1;
  2726. Sp(1) = 1;
  2727. Sp(0) = stg_gc_fun_info;
  2728. jump stg_gc_noregs [];
  2729. }
  2730.  
  2731. stg_ap_stk_d
  2732. { D1 = D_[Sp+WDS(0)];
  2733. Sp_adj(1);
  2734. jump %GET_ENTRY(UNTAG(R1)) [D1,R1];
  2735. }
  2736. stg_stk_save_d
  2737. { Sp_adj(-4);
  2738. D_[Sp+WDS(3)] = D1;
  2739. Sp(2) = R1;
  2740. Sp(1) = 1;
  2741. Sp(0) = stg_gc_fun_info;
  2742. jump stg_gc_noregs [];
  2743. }
  2744.  
  2745. stg_ap_stk_l
  2746. { Sp_adj(0);
  2747. jump %GET_ENTRY(UNTAG(R1)) [R1];
  2748. }
  2749. stg_stk_save_l
  2750. { Sp_adj(-3);
  2751. Sp(2) = R1;
  2752. Sp(1) = 1;
  2753. Sp(0) = stg_gc_fun_info;
  2754. jump stg_gc_noregs [];
  2755. }
  2756.  
  2757. stg_ap_stk_v16
  2758. { Sp_adj(0);
  2759. jump %GET_ENTRY(UNTAG(R1)) [R1];
  2760. }
  2761. stg_stk_save_v16
  2762. { Sp_adj(-3);
  2763. Sp(2) = R1;
  2764. Sp(1) = 2;
  2765. Sp(0) = stg_gc_fun_info;
  2766. jump stg_gc_noregs [];
  2767. }
  2768.  
  2769. stg_ap_stk_v32
  2770. { Sp_adj(0);
  2771. jump %GET_ENTRY(UNTAG(R1)) [R1];
  2772. }
  2773. stg_stk_save_v32
  2774. { Sp_adj(-3);
  2775. Sp(2) = R1;
  2776. Sp(1) = 4;
  2777. Sp(0) = stg_gc_fun_info;
  2778. jump stg_gc_noregs [];
  2779. }
  2780.  
  2781. stg_ap_stk_v64
  2782. { Sp_adj(0);
  2783. jump %GET_ENTRY(UNTAG(R1)) [R1];
  2784. }
  2785. stg_stk_save_v64
  2786. { Sp_adj(-3);
  2787. Sp(2) = R1;
  2788. Sp(1) = 8;
  2789. Sp(0) = stg_gc_fun_info;
  2790. jump stg_gc_noregs [];
  2791. }
  2792.  
  2793. stg_ap_stk_nn
  2794. { R3 = W_[Sp+WDS(1)];
  2795. R2 = W_[Sp+WDS(0)];
  2796. Sp_adj(2);
  2797. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3];
  2798. }
  2799. stg_stk_save_nn
  2800. { Sp_adj(-5);
  2801. W_[Sp+WDS(4)] = R3;
  2802. W_[Sp+WDS(3)] = R2;
  2803. Sp(2) = R1;
  2804. Sp(1) = 2;
  2805. Sp(0) = stg_gc_fun_info;
  2806. jump stg_gc_noregs [];
  2807. }
  2808.  
  2809. stg_ap_stk_np
  2810. { R3 = W_[Sp+WDS(1)];
  2811. R2 = W_[Sp+WDS(0)];
  2812. Sp_adj(2);
  2813. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3];
  2814. }
  2815. stg_stk_save_np
  2816. { Sp_adj(-5);
  2817. W_[Sp+WDS(4)] = R3;
  2818. W_[Sp+WDS(3)] = R2;
  2819. Sp(2) = R1;
  2820. Sp(1) = 2;
  2821. Sp(0) = stg_gc_fun_info;
  2822. jump stg_gc_noregs [];
  2823. }
  2824.  
  2825. stg_ap_stk_pn
  2826. { R3 = W_[Sp+WDS(1)];
  2827. R2 = W_[Sp+WDS(0)];
  2828. Sp_adj(2);
  2829. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3];
  2830. }
  2831. stg_stk_save_pn
  2832. { Sp_adj(-5);
  2833. W_[Sp+WDS(4)] = R3;
  2834. W_[Sp+WDS(3)] = R2;
  2835. Sp(2) = R1;
  2836. Sp(1) = 2;
  2837. Sp(0) = stg_gc_fun_info;
  2838. jump stg_gc_noregs [];
  2839. }
  2840.  
  2841. stg_ap_stk_pp
  2842. { R3 = W_[Sp+WDS(1)];
  2843. R2 = W_[Sp+WDS(0)];
  2844. Sp_adj(2);
  2845. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3];
  2846. }
  2847. stg_stk_save_pp
  2848. { Sp_adj(-5);
  2849. W_[Sp+WDS(4)] = R3;
  2850. W_[Sp+WDS(3)] = R2;
  2851. Sp(2) = R1;
  2852. Sp(1) = 2;
  2853. Sp(0) = stg_gc_fun_info;
  2854. jump stg_gc_noregs [];
  2855. }
  2856.  
  2857. stg_ap_stk_nnn
  2858. { R4 = W_[Sp+WDS(2)];
  2859. R3 = W_[Sp+WDS(1)];
  2860. R2 = W_[Sp+WDS(0)];
  2861. Sp_adj(3);
  2862. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  2863. }
  2864. stg_stk_save_nnn
  2865. { Sp_adj(-6);
  2866. W_[Sp+WDS(5)] = R4;
  2867. W_[Sp+WDS(4)] = R3;
  2868. W_[Sp+WDS(3)] = R2;
  2869. Sp(2) = R1;
  2870. Sp(1) = 3;
  2871. Sp(0) = stg_gc_fun_info;
  2872. jump stg_gc_noregs [];
  2873. }
  2874.  
  2875. stg_ap_stk_nnp
  2876. { R4 = W_[Sp+WDS(2)];
  2877. R3 = W_[Sp+WDS(1)];
  2878. R2 = W_[Sp+WDS(0)];
  2879. Sp_adj(3);
  2880. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  2881. }
  2882. stg_stk_save_nnp
  2883. { Sp_adj(-6);
  2884. W_[Sp+WDS(5)] = R4;
  2885. W_[Sp+WDS(4)] = R3;
  2886. W_[Sp+WDS(3)] = R2;
  2887. Sp(2) = R1;
  2888. Sp(1) = 3;
  2889. Sp(0) = stg_gc_fun_info;
  2890. jump stg_gc_noregs [];
  2891. }
  2892.  
  2893. stg_ap_stk_npn
  2894. { R4 = W_[Sp+WDS(2)];
  2895. R3 = W_[Sp+WDS(1)];
  2896. R2 = W_[Sp+WDS(0)];
  2897. Sp_adj(3);
  2898. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  2899. }
  2900. stg_stk_save_npn
  2901. { Sp_adj(-6);
  2902. W_[Sp+WDS(5)] = R4;
  2903. W_[Sp+WDS(4)] = R3;
  2904. W_[Sp+WDS(3)] = R2;
  2905. Sp(2) = R1;
  2906. Sp(1) = 3;
  2907. Sp(0) = stg_gc_fun_info;
  2908. jump stg_gc_noregs [];
  2909. }
  2910.  
  2911. stg_ap_stk_npp
  2912. { R4 = W_[Sp+WDS(2)];
  2913. R3 = W_[Sp+WDS(1)];
  2914. R2 = W_[Sp+WDS(0)];
  2915. Sp_adj(3);
  2916. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  2917. }
  2918. stg_stk_save_npp
  2919. { Sp_adj(-6);
  2920. W_[Sp+WDS(5)] = R4;
  2921. W_[Sp+WDS(4)] = R3;
  2922. W_[Sp+WDS(3)] = R2;
  2923. Sp(2) = R1;
  2924. Sp(1) = 3;
  2925. Sp(0) = stg_gc_fun_info;
  2926. jump stg_gc_noregs [];
  2927. }
  2928.  
  2929. stg_ap_stk_pnn
  2930. { R4 = W_[Sp+WDS(2)];
  2931. R3 = W_[Sp+WDS(1)];
  2932. R2 = W_[Sp+WDS(0)];
  2933. Sp_adj(3);
  2934. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  2935. }
  2936. stg_stk_save_pnn
  2937. { Sp_adj(-6);
  2938. W_[Sp+WDS(5)] = R4;
  2939. W_[Sp+WDS(4)] = R3;
  2940. W_[Sp+WDS(3)] = R2;
  2941. Sp(2) = R1;
  2942. Sp(1) = 3;
  2943. Sp(0) = stg_gc_fun_info;
  2944. jump stg_gc_noregs [];
  2945. }
  2946.  
  2947. stg_ap_stk_pnp
  2948. { R4 = W_[Sp+WDS(2)];
  2949. R3 = W_[Sp+WDS(1)];
  2950. R2 = W_[Sp+WDS(0)];
  2951. Sp_adj(3);
  2952. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  2953. }
  2954. stg_stk_save_pnp
  2955. { Sp_adj(-6);
  2956. W_[Sp+WDS(5)] = R4;
  2957. W_[Sp+WDS(4)] = R3;
  2958. W_[Sp+WDS(3)] = R2;
  2959. Sp(2) = R1;
  2960. Sp(1) = 3;
  2961. Sp(0) = stg_gc_fun_info;
  2962. jump stg_gc_noregs [];
  2963. }
  2964.  
  2965. stg_ap_stk_ppn
  2966. { R4 = W_[Sp+WDS(2)];
  2967. R3 = W_[Sp+WDS(1)];
  2968. R2 = W_[Sp+WDS(0)];
  2969. Sp_adj(3);
  2970. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  2971. }
  2972. stg_stk_save_ppn
  2973. { Sp_adj(-6);
  2974. W_[Sp+WDS(5)] = R4;
  2975. W_[Sp+WDS(4)] = R3;
  2976. W_[Sp+WDS(3)] = R2;
  2977. Sp(2) = R1;
  2978. Sp(1) = 3;
  2979. Sp(0) = stg_gc_fun_info;
  2980. jump stg_gc_noregs [];
  2981. }
  2982.  
  2983. stg_ap_stk_ppp
  2984. { R4 = W_[Sp+WDS(2)];
  2985. R3 = W_[Sp+WDS(1)];
  2986. R2 = W_[Sp+WDS(0)];
  2987. Sp_adj(3);
  2988. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  2989. }
  2990. stg_stk_save_ppp
  2991. { Sp_adj(-6);
  2992. W_[Sp+WDS(5)] = R4;
  2993. W_[Sp+WDS(4)] = R3;
  2994. W_[Sp+WDS(3)] = R2;
  2995. Sp(2) = R1;
  2996. Sp(1) = 3;
  2997. Sp(0) = stg_gc_fun_info;
  2998. jump stg_gc_noregs [];
  2999. }
  3000.  
  3001. stg_ap_stk_pppp
  3002. { R5 = W_[Sp+WDS(3)];
  3003. R4 = W_[Sp+WDS(2)];
  3004. R3 = W_[Sp+WDS(1)];
  3005. R2 = W_[Sp+WDS(0)];
  3006. Sp_adj(4);
  3007. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5];
  3008. }
  3009. stg_stk_save_pppp
  3010. { Sp_adj(-7);
  3011. W_[Sp+WDS(6)] = R5;
  3012. W_[Sp+WDS(5)] = R4;
  3013. W_[Sp+WDS(4)] = R3;
  3014. W_[Sp+WDS(3)] = R2;
  3015. Sp(2) = R1;
  3016. Sp(1) = 4;
  3017. Sp(0) = stg_gc_fun_info;
  3018. jump stg_gc_noregs [];
  3019. }
  3020.  
  3021. stg_ap_stk_ppppp
  3022. { R6 = W_[Sp+WDS(4)];
  3023. R5 = W_[Sp+WDS(3)];
  3024. R4 = W_[Sp+WDS(2)];
  3025. R3 = W_[Sp+WDS(1)];
  3026. R2 = W_[Sp+WDS(0)];
  3027. Sp_adj(5);
  3028. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  3029. }
  3030. stg_stk_save_ppppp
  3031. { Sp_adj(-8);
  3032. W_[Sp+WDS(7)] = R6;
  3033. W_[Sp+WDS(6)] = R5;
  3034. W_[Sp+WDS(5)] = R4;
  3035. W_[Sp+WDS(4)] = R3;
  3036. W_[Sp+WDS(3)] = R2;
  3037. Sp(2) = R1;
  3038. Sp(1) = 5;
  3039. Sp(0) = stg_gc_fun_info;
  3040. jump stg_gc_noregs [];
  3041. }
  3042.  
  3043. stg_ap_stk_pppppp
  3044. { R6 = W_[Sp+WDS(4)];
  3045. R5 = W_[Sp+WDS(3)];
  3046. R4 = W_[Sp+WDS(2)];
  3047. R3 = W_[Sp+WDS(1)];
  3048. R2 = W_[Sp+WDS(0)];
  3049. Sp_adj(5);
  3050. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  3051. }
  3052. stg_stk_save_pppppp
  3053. { Sp_adj(-8);
  3054. W_[Sp+WDS(7)] = R6;
  3055. W_[Sp+WDS(6)] = R5;
  3056. W_[Sp+WDS(5)] = R4;
  3057. W_[Sp+WDS(4)] = R3;
  3058. W_[Sp+WDS(3)] = R2;
  3059. Sp(2) = R1;
  3060. Sp(1) = 6;
  3061. Sp(0) = stg_gc_fun_info;
  3062. jump stg_gc_noregs [];
  3063. }
  3064.  
  3065. stg_ap_stk_ppppppp
  3066. { R6 = W_[Sp+WDS(4)];
  3067. R5 = W_[Sp+WDS(3)];
  3068. R4 = W_[Sp+WDS(2)];
  3069. R3 = W_[Sp+WDS(1)];
  3070. R2 = W_[Sp+WDS(0)];
  3071. Sp_adj(5);
  3072. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  3073. }
  3074. stg_stk_save_ppppppp
  3075. { Sp_adj(-8);
  3076. W_[Sp+WDS(7)] = R6;
  3077. W_[Sp+WDS(6)] = R5;
  3078. W_[Sp+WDS(5)] = R4;
  3079. W_[Sp+WDS(4)] = R3;
  3080. W_[Sp+WDS(3)] = R2;
  3081. Sp(2) = R1;
  3082. Sp(1) = 7;
  3083. Sp(0) = stg_gc_fun_info;
  3084. jump stg_gc_noregs [];
  3085. }
  3086.  
  3087. stg_ap_stk_pppppppp
  3088. { R6 = W_[Sp+WDS(4)];
  3089. R5 = W_[Sp+WDS(3)];
  3090. R4 = W_[Sp+WDS(2)];
  3091. R3 = W_[Sp+WDS(1)];
  3092. R2 = W_[Sp+WDS(0)];
  3093. Sp_adj(5);
  3094. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  3095. }
  3096. stg_stk_save_pppppppp
  3097. { Sp_adj(-8);
  3098. W_[Sp+WDS(7)] = R6;
  3099. W_[Sp+WDS(6)] = R5;
  3100. W_[Sp+WDS(5)] = R4;
  3101. W_[Sp+WDS(4)] = R3;
  3102. W_[Sp+WDS(3)] = R2;
  3103. Sp(2) = R1;
  3104. Sp(1) = 8;
  3105. Sp(0) = stg_gc_fun_info;
  3106. jump stg_gc_noregs [];
  3107. }
  3108. stg_ap_v_fast
  3109. { W_ info;
  3110. W_ arity;
  3111. if (GETTAG(R1)==1) {
  3112. Sp_adj(0);
  3113. jump %GET_ENTRY(R1-1) [R1];
  3114. }
  3115. #ifdef PROFILING
  3116. if (Sp - WDS(1) < SpLim) {
  3117. Sp_adj(-1);
  3118. Sp(0) = stg_ap_v_info;
  3119. jump __stg_gc_enter_1 [R1];
  3120. }
  3121. #else
  3122. if (Sp - WDS(1) < SpLim) {
  3123. Sp_adj(-1);
  3124. Sp(0) = stg_ap_v_info;
  3125. jump __stg_gc_enter_1 [R1];
  3126. }
  3127. #endif
  3128. R1 = UNTAG(R1);
  3129. info = %GET_STD_INFO(R1);
  3130. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3131. case FUN,
  3132. FUN_1_0,
  3133. FUN_0_1,
  3134. FUN_2_0,
  3135. FUN_1_1,
  3136. FUN_0_2,
  3137. FUN_STATIC: {
  3138. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3139. ASSERT(arity > 0);
  3140. if (arity == 1) {
  3141. Sp_adj(0);
  3142. R1 = R1 + 1;
  3143. jump %GET_ENTRY(UNTAG(R1)) [R1];
  3144. } else {
  3145. Sp_adj(-1);
  3146. if (arity < 8) {
  3147. R1 = R1 + arity;
  3148. }
  3149. BUILD_PAP(1,0,stg_ap_v_info,FUN);
  3150. }
  3151. }
  3152. default: {
  3153. Sp_adj(-1);
  3154. jump RET_LBL(stg_ap_v) [];
  3155. }
  3156. }
  3157. }
  3158.  
  3159. stg_ap_f_fast
  3160. { W_ info;
  3161. W_ arity;
  3162. if (GETTAG(R1)==1) {
  3163. Sp_adj(0);
  3164. jump %GET_ENTRY(R1-1) [F1,R1];
  3165. }
  3166. #ifdef PROFILING
  3167. if (Sp - WDS(2) < SpLim) {
  3168. Sp_adj(-2);
  3169. F_[Sp+WDS(1)] = F1;
  3170. Sp(0) = stg_ap_f_info;
  3171. jump __stg_gc_enter_1 [R1];
  3172. }
  3173. #else
  3174. if (Sp - WDS(2) < SpLim) {
  3175. Sp_adj(-2);
  3176. F_[Sp+WDS(1)] = F1;
  3177. Sp(0) = stg_ap_f_info;
  3178. jump __stg_gc_enter_1 [R1];
  3179. }
  3180. #endif
  3181. R1 = UNTAG(R1);
  3182. info = %GET_STD_INFO(R1);
  3183. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3184. case FUN,
  3185. FUN_1_0,
  3186. FUN_0_1,
  3187. FUN_2_0,
  3188. FUN_1_1,
  3189. FUN_0_2,
  3190. FUN_STATIC: {
  3191. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3192. ASSERT(arity > 0);
  3193. if (arity == 1) {
  3194. Sp_adj(0);
  3195. R1 = R1 + 1;
  3196. jump %GET_ENTRY(UNTAG(R1)) [F1,R1];
  3197. } else {
  3198. Sp_adj(-2);
  3199. F_[Sp+WDS(1)] = F1;
  3200. if (arity < 8) {
  3201. R1 = R1 + arity;
  3202. }
  3203. BUILD_PAP(1,1,stg_ap_f_info,FUN);
  3204. }
  3205. }
  3206. default: {
  3207. Sp_adj(-2);
  3208. F_[Sp+WDS(1)] = F1;
  3209. jump RET_LBL(stg_ap_f) [];
  3210. }
  3211. }
  3212. }
  3213.  
  3214. stg_ap_d_fast
  3215. { W_ info;
  3216. W_ arity;
  3217. if (GETTAG(R1)==1) {
  3218. Sp_adj(0);
  3219. jump %GET_ENTRY(R1-1) [D1,R1];
  3220. }
  3221. #ifdef PROFILING
  3222. if (Sp - WDS(2) < SpLim) {
  3223. Sp_adj(-2);
  3224. D_[Sp+WDS(1)] = D1;
  3225. Sp(0) = stg_ap_d_info;
  3226. jump __stg_gc_enter_1 [R1];
  3227. }
  3228. #else
  3229. if (Sp - WDS(2) < SpLim) {
  3230. Sp_adj(-2);
  3231. D_[Sp+WDS(1)] = D1;
  3232. Sp(0) = stg_ap_d_info;
  3233. jump __stg_gc_enter_1 [R1];
  3234. }
  3235. #endif
  3236. R1 = UNTAG(R1);
  3237. info = %GET_STD_INFO(R1);
  3238. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3239. case FUN,
  3240. FUN_1_0,
  3241. FUN_0_1,
  3242. FUN_2_0,
  3243. FUN_1_1,
  3244. FUN_0_2,
  3245. FUN_STATIC: {
  3246. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3247. ASSERT(arity > 0);
  3248. if (arity == 1) {
  3249. Sp_adj(0);
  3250. R1 = R1 + 1;
  3251. jump %GET_ENTRY(UNTAG(R1)) [D1,R1];
  3252. } else {
  3253. Sp_adj(-2);
  3254. D_[Sp+WDS(1)] = D1;
  3255. if (arity < 8) {
  3256. R1 = R1 + arity;
  3257. }
  3258. BUILD_PAP(1,1,stg_ap_d_info,FUN);
  3259. }
  3260. }
  3261. default: {
  3262. Sp_adj(-2);
  3263. D_[Sp+WDS(1)] = D1;
  3264. jump RET_LBL(stg_ap_d) [];
  3265. }
  3266. }
  3267. }
  3268.  
  3269. stg_ap_l_fast
  3270. { W_ info;
  3271. W_ arity;
  3272. if (GETTAG(R1)==1) {
  3273. Sp_adj(0);
  3274. jump %GET_ENTRY(R1-1) [R1];
  3275. }
  3276. #ifdef PROFILING
  3277. if (Sp - WDS(1) < SpLim) {
  3278. Sp_adj(-1);
  3279. Sp(0) = stg_ap_l_info;
  3280. jump __stg_gc_enter_1 [R1];
  3281. }
  3282. #else
  3283. if (Sp - WDS(1) < SpLim) {
  3284. Sp_adj(-1);
  3285. Sp(0) = stg_ap_l_info;
  3286. jump __stg_gc_enter_1 [R1];
  3287. }
  3288. #endif
  3289. R1 = UNTAG(R1);
  3290. info = %GET_STD_INFO(R1);
  3291. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3292. case FUN,
  3293. FUN_1_0,
  3294. FUN_0_1,
  3295. FUN_2_0,
  3296. FUN_1_1,
  3297. FUN_0_2,
  3298. FUN_STATIC: {
  3299. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3300. ASSERT(arity > 0);
  3301. if (arity == 1) {
  3302. Sp_adj(0);
  3303. R1 = R1 + 1;
  3304. jump %GET_ENTRY(UNTAG(R1)) [R1];
  3305. } else {
  3306. Sp_adj(-1);
  3307. if (arity < 8) {
  3308. R1 = R1 + arity;
  3309. }
  3310. BUILD_PAP(1,1,stg_ap_l_info,FUN);
  3311. }
  3312. }
  3313. default: {
  3314. Sp_adj(-1);
  3315. jump RET_LBL(stg_ap_l) [];
  3316. }
  3317. }
  3318. }
  3319.  
  3320. stg_ap_v16_fast
  3321. { W_ info;
  3322. W_ arity;
  3323. if (GETTAG(R1)==1) {
  3324. Sp_adj(0);
  3325. jump %GET_ENTRY(R1-1) [R1];
  3326. }
  3327. #ifdef PROFILING
  3328. if (Sp - WDS(1) < SpLim) {
  3329. Sp_adj(-1);
  3330. Sp(0) = stg_ap_v16_info;
  3331. jump __stg_gc_enter_1 [R1];
  3332. }
  3333. #else
  3334. if (Sp - WDS(1) < SpLim) {
  3335. Sp_adj(-1);
  3336. Sp(0) = stg_ap_v16_info;
  3337. jump __stg_gc_enter_1 [R1];
  3338. }
  3339. #endif
  3340. R1 = UNTAG(R1);
  3341. info = %GET_STD_INFO(R1);
  3342. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3343. case FUN,
  3344. FUN_1_0,
  3345. FUN_0_1,
  3346. FUN_2_0,
  3347. FUN_1_1,
  3348. FUN_0_2,
  3349. FUN_STATIC: {
  3350. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3351. ASSERT(arity > 0);
  3352. if (arity == 1) {
  3353. Sp_adj(0);
  3354. R1 = R1 + 1;
  3355. jump %GET_ENTRY(UNTAG(R1)) [R1];
  3356. } else {
  3357. Sp_adj(-1);
  3358. if (arity < 8) {
  3359. R1 = R1 + arity;
  3360. }
  3361. BUILD_PAP(1,2,stg_ap_v16_info,FUN);
  3362. }
  3363. }
  3364. default: {
  3365. Sp_adj(-1);
  3366. jump RET_LBL(stg_ap_v16) [];
  3367. }
  3368. }
  3369. }
  3370.  
  3371. stg_ap_v32_fast
  3372. { W_ info;
  3373. W_ arity;
  3374. if (GETTAG(R1)==1) {
  3375. Sp_adj(0);
  3376. jump %GET_ENTRY(R1-1) [R1];
  3377. }
  3378. #ifdef PROFILING
  3379. if (Sp - WDS(1) < SpLim) {
  3380. Sp_adj(-1);
  3381. Sp(0) = stg_ap_v32_info;
  3382. jump __stg_gc_enter_1 [R1];
  3383. }
  3384. #else
  3385. if (Sp - WDS(1) < SpLim) {
  3386. Sp_adj(-1);
  3387. Sp(0) = stg_ap_v32_info;
  3388. jump __stg_gc_enter_1 [R1];
  3389. }
  3390. #endif
  3391. R1 = UNTAG(R1);
  3392. info = %GET_STD_INFO(R1);
  3393. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3394. case FUN,
  3395. FUN_1_0,
  3396. FUN_0_1,
  3397. FUN_2_0,
  3398. FUN_1_1,
  3399. FUN_0_2,
  3400. FUN_STATIC: {
  3401. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3402. ASSERT(arity > 0);
  3403. if (arity == 1) {
  3404. Sp_adj(0);
  3405. R1 = R1 + 1;
  3406. jump %GET_ENTRY(UNTAG(R1)) [R1];
  3407. } else {
  3408. Sp_adj(-1);
  3409. if (arity < 8) {
  3410. R1 = R1 + arity;
  3411. }
  3412. BUILD_PAP(1,4,stg_ap_v32_info,FUN);
  3413. }
  3414. }
  3415. default: {
  3416. Sp_adj(-1);
  3417. jump RET_LBL(stg_ap_v32) [];
  3418. }
  3419. }
  3420. }
  3421.  
  3422. stg_ap_v64_fast
  3423. { W_ info;
  3424. W_ arity;
  3425. if (GETTAG(R1)==1) {
  3426. Sp_adj(0);
  3427. jump %GET_ENTRY(R1-1) [R1];
  3428. }
  3429. #ifdef PROFILING
  3430. if (Sp - WDS(1) < SpLim) {
  3431. Sp_adj(-1);
  3432. Sp(0) = stg_ap_v64_info;
  3433. jump __stg_gc_enter_1 [R1];
  3434. }
  3435. #else
  3436. if (Sp - WDS(1) < SpLim) {
  3437. Sp_adj(-1);
  3438. Sp(0) = stg_ap_v64_info;
  3439. jump __stg_gc_enter_1 [R1];
  3440. }
  3441. #endif
  3442. R1 = UNTAG(R1);
  3443. info = %GET_STD_INFO(R1);
  3444. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3445. case FUN,
  3446. FUN_1_0,
  3447. FUN_0_1,
  3448. FUN_2_0,
  3449. FUN_1_1,
  3450. FUN_0_2,
  3451. FUN_STATIC: {
  3452. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3453. ASSERT(arity > 0);
  3454. if (arity == 1) {
  3455. Sp_adj(0);
  3456. R1 = R1 + 1;
  3457. jump %GET_ENTRY(UNTAG(R1)) [R1];
  3458. } else {
  3459. Sp_adj(-1);
  3460. if (arity < 8) {
  3461. R1 = R1 + arity;
  3462. }
  3463. BUILD_PAP(1,8,stg_ap_v64_info,FUN);
  3464. }
  3465. }
  3466. default: {
  3467. Sp_adj(-1);
  3468. jump RET_LBL(stg_ap_v64) [];
  3469. }
  3470. }
  3471. }
  3472.  
  3473. stg_ap_n_fast
  3474. { W_ info;
  3475. W_ arity;
  3476. if (GETTAG(R1)==1) {
  3477. Sp_adj(0);
  3478. jump %GET_ENTRY(R1-1) [R1,R2];
  3479. }
  3480. #ifdef PROFILING
  3481. if (Sp - WDS(2) < SpLim) {
  3482. Sp_adj(-2);
  3483. W_[Sp+WDS(1)] = R2;
  3484. Sp(0) = stg_ap_n_info;
  3485. jump __stg_gc_enter_1 [R1];
  3486. }
  3487. #else
  3488. if (Sp - WDS(2) < SpLim) {
  3489. Sp_adj(-2);
  3490. W_[Sp+WDS(1)] = R2;
  3491. Sp(0) = stg_ap_n_info;
  3492. jump __stg_gc_enter_1 [R1];
  3493. }
  3494. #endif
  3495. R1 = UNTAG(R1);
  3496. info = %GET_STD_INFO(R1);
  3497. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3498. case FUN,
  3499. FUN_1_0,
  3500. FUN_0_1,
  3501. FUN_2_0,
  3502. FUN_1_1,
  3503. FUN_0_2,
  3504. FUN_STATIC: {
  3505. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3506. ASSERT(arity > 0);
  3507. if (arity == 1) {
  3508. Sp_adj(0);
  3509. R1 = R1 + 1;
  3510. jump %GET_ENTRY(UNTAG(R1)) [R1,R2];
  3511. } else {
  3512. Sp_adj(-2);
  3513. W_[Sp+WDS(1)] = R2;
  3514. if (arity < 8) {
  3515. R1 = R1 + arity;
  3516. }
  3517. BUILD_PAP(1,1,stg_ap_n_info,FUN);
  3518. }
  3519. }
  3520. default: {
  3521. Sp_adj(-2);
  3522. W_[Sp+WDS(1)] = R2;
  3523. jump RET_LBL(stg_ap_n) [];
  3524. }
  3525. }
  3526. }
  3527.  
  3528. stg_ap_p_fast
  3529. { W_ info;
  3530. W_ arity;
  3531. if (GETTAG(R1)==1) {
  3532. Sp_adj(0);
  3533. jump %GET_ENTRY(R1-1) [R1,R2];
  3534. }
  3535. #ifdef PROFILING
  3536. if (Sp - WDS(2) < SpLim) {
  3537. Sp_adj(-2);
  3538. W_[Sp+WDS(1)] = R2;
  3539. Sp(0) = stg_ap_p_info;
  3540. jump __stg_gc_enter_1 [R1];
  3541. }
  3542. #else
  3543. if (Sp - WDS(2) < SpLim) {
  3544. Sp_adj(-2);
  3545. W_[Sp+WDS(1)] = R2;
  3546. Sp(0) = stg_ap_p_info;
  3547. jump __stg_gc_enter_1 [R1];
  3548. }
  3549. #endif
  3550. R1 = UNTAG(R1);
  3551. info = %GET_STD_INFO(R1);
  3552. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3553. case FUN,
  3554. FUN_1_0,
  3555. FUN_0_1,
  3556. FUN_2_0,
  3557. FUN_1_1,
  3558. FUN_0_2,
  3559. FUN_STATIC: {
  3560. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3561. ASSERT(arity > 0);
  3562. if (arity == 1) {
  3563. Sp_adj(0);
  3564. R1 = R1 + 1;
  3565. jump %GET_ENTRY(UNTAG(R1)) [R1,R2];
  3566. } else {
  3567. Sp_adj(-2);
  3568. W_[Sp+WDS(1)] = R2;
  3569. if (arity < 8) {
  3570. R1 = R1 + arity;
  3571. }
  3572. BUILD_PAP(1,1,stg_ap_p_info,FUN);
  3573. }
  3574. }
  3575. default: {
  3576. Sp_adj(-2);
  3577. W_[Sp+WDS(1)] = R2;
  3578. jump RET_LBL(stg_ap_p) [];
  3579. }
  3580. }
  3581. }
  3582.  
  3583. stg_ap_pv_fast
  3584. { W_ info;
  3585. W_ arity;
  3586. if (GETTAG(R1)==2) {
  3587. Sp_adj(0);
  3588. jump %GET_ENTRY(R1-2) [R1,R2];
  3589. }
  3590. #ifdef PROFILING
  3591. if (Sp - WDS(3) < SpLim) {
  3592. Sp_adj(-2);
  3593. W_[Sp+WDS(1)] = R2;
  3594. Sp(0) = stg_ap_pv_info;
  3595. jump __stg_gc_enter_1 [R1];
  3596. }
  3597. #else
  3598. if (Sp - WDS(2) < SpLim) {
  3599. Sp_adj(-2);
  3600. W_[Sp+WDS(1)] = R2;
  3601. Sp(0) = stg_ap_pv_info;
  3602. jump __stg_gc_enter_1 [R1];
  3603. }
  3604. #endif
  3605. R1 = UNTAG(R1);
  3606. info = %GET_STD_INFO(R1);
  3607. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3608. case FUN,
  3609. FUN_1_0,
  3610. FUN_0_1,
  3611. FUN_2_0,
  3612. FUN_1_1,
  3613. FUN_0_2,
  3614. FUN_STATIC: {
  3615. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3616. ASSERT(arity > 0);
  3617. if (arity == 1) {
  3618. #ifdef PROFILING
  3619. W_[Sp+WDS(-3)] = stg_restore_cccs_info;
  3620. W_[Sp+WDS(-2)] = CCCS;
  3621. W_[Sp+WDS(-1)] = stg_ap_v_info;
  3622. Sp_adj(-3);
  3623. #else
  3624. W_[Sp+WDS(-1)] = stg_ap_v_info;
  3625. Sp_adj(-1);
  3626. #endif
  3627. R1 = R1 + 1;
  3628. jump %GET_ENTRY(UNTAG(R1)) [R1,R2];
  3629. }
  3630. if (arity == 2) {
  3631. Sp_adj(0);
  3632. R1 = R1 + 2;
  3633. jump %GET_ENTRY(UNTAG(R1)) [R1,R2];
  3634. } else {
  3635. Sp_adj(-2);
  3636. W_[Sp+WDS(1)] = R2;
  3637. if (arity < 8) {
  3638. R1 = R1 + arity;
  3639. }
  3640. BUILD_PAP(2,1,stg_ap_pv_info,FUN);
  3641. }
  3642. }
  3643. default: {
  3644. Sp_adj(-2);
  3645. W_[Sp+WDS(1)] = R2;
  3646. jump RET_LBL(stg_ap_pv) [];
  3647. }
  3648. }
  3649. }
  3650.  
  3651. stg_ap_pp_fast
  3652. { W_ info;
  3653. W_ arity;
  3654. if (GETTAG(R1)==2) {
  3655. Sp_adj(0);
  3656. jump %GET_ENTRY(R1-2) [R1,R2,R3];
  3657. }
  3658. #ifdef PROFILING
  3659. if (Sp - WDS(3) < SpLim) {
  3660. Sp_adj(-3);
  3661. W_[Sp+WDS(2)] = R3;
  3662. W_[Sp+WDS(1)] = R2;
  3663. Sp(0) = stg_ap_pp_info;
  3664. jump __stg_gc_enter_1 [R1];
  3665. }
  3666. #else
  3667. if (Sp - WDS(3) < SpLim) {
  3668. Sp_adj(-3);
  3669. W_[Sp+WDS(2)] = R3;
  3670. W_[Sp+WDS(1)] = R2;
  3671. Sp(0) = stg_ap_pp_info;
  3672. jump __stg_gc_enter_1 [R1];
  3673. }
  3674. #endif
  3675. R1 = UNTAG(R1);
  3676. info = %GET_STD_INFO(R1);
  3677. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3678. case FUN,
  3679. FUN_1_0,
  3680. FUN_0_1,
  3681. FUN_2_0,
  3682. FUN_1_1,
  3683. FUN_0_2,
  3684. FUN_STATIC: {
  3685. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3686. ASSERT(arity > 0);
  3687. if (arity == 1) {
  3688. Sp_adj(-2);
  3689. W_[Sp+WDS(1)] = R3;
  3690. W_[Sp+WDS(0)] = stg_ap_p_info;
  3691. R1 = R1 + 1;
  3692. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  3693. }
  3694. if (arity == 2) {
  3695. Sp_adj(0);
  3696. R1 = R1 + 2;
  3697. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3];
  3698. } else {
  3699. Sp_adj(-3);
  3700. W_[Sp+WDS(2)] = R3;
  3701. W_[Sp+WDS(1)] = R2;
  3702. if (arity < 8) {
  3703. R1 = R1 + arity;
  3704. }
  3705. BUILD_PAP(2,2,stg_ap_pp_info,FUN);
  3706. }
  3707. }
  3708. default: {
  3709. Sp_adj(-3);
  3710. W_[Sp+WDS(2)] = R3;
  3711. W_[Sp+WDS(1)] = R2;
  3712. jump RET_LBL(stg_ap_pp) [];
  3713. }
  3714. }
  3715. }
  3716.  
  3717. stg_ap_ppv_fast
  3718. { W_ info;
  3719. W_ arity;
  3720. if (GETTAG(R1)==3) {
  3721. Sp_adj(0);
  3722. jump %GET_ENTRY(R1-3) [R1,R2,R3];
  3723. }
  3724. #ifdef PROFILING
  3725. if (Sp - WDS(3) < SpLim) {
  3726. Sp_adj(-3);
  3727. W_[Sp+WDS(2)] = R3;
  3728. W_[Sp+WDS(1)] = R2;
  3729. Sp(0) = stg_ap_ppv_info;
  3730. jump __stg_gc_enter_1 [R1];
  3731. }
  3732. #else
  3733. if (Sp - WDS(3) < SpLim) {
  3734. Sp_adj(-3);
  3735. W_[Sp+WDS(2)] = R3;
  3736. W_[Sp+WDS(1)] = R2;
  3737. Sp(0) = stg_ap_ppv_info;
  3738. jump __stg_gc_enter_1 [R1];
  3739. }
  3740. #endif
  3741. R1 = UNTAG(R1);
  3742. info = %GET_STD_INFO(R1);
  3743. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3744. case FUN,
  3745. FUN_1_0,
  3746. FUN_0_1,
  3747. FUN_2_0,
  3748. FUN_1_1,
  3749. FUN_0_2,
  3750. FUN_STATIC: {
  3751. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3752. ASSERT(arity > 0);
  3753. if (arity == 1) {
  3754. Sp_adj(-2);
  3755. W_[Sp+WDS(1)] = R3;
  3756. W_[Sp+WDS(0)] = stg_ap_pv_info;
  3757. R1 = R1 + 1;
  3758. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  3759. }
  3760. if (arity == 2) {
  3761. #ifdef PROFILING
  3762. W_[Sp+WDS(-3)] = stg_restore_cccs_info;
  3763. W_[Sp+WDS(-2)] = CCCS;
  3764. W_[Sp+WDS(-1)] = stg_ap_v_info;
  3765. Sp_adj(-3);
  3766. #else
  3767. W_[Sp+WDS(-1)] = stg_ap_v_info;
  3768. Sp_adj(-1);
  3769. #endif
  3770. R1 = R1 + 2;
  3771. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3];
  3772. }
  3773. if (arity == 3) {
  3774. Sp_adj(0);
  3775. R1 = R1 + 3;
  3776. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3];
  3777. } else {
  3778. Sp_adj(-3);
  3779. W_[Sp+WDS(2)] = R3;
  3780. W_[Sp+WDS(1)] = R2;
  3781. if (arity < 8) {
  3782. R1 = R1 + arity;
  3783. }
  3784. BUILD_PAP(3,2,stg_ap_ppv_info,FUN);
  3785. }
  3786. }
  3787. default: {
  3788. Sp_adj(-3);
  3789. W_[Sp+WDS(2)] = R3;
  3790. W_[Sp+WDS(1)] = R2;
  3791. jump RET_LBL(stg_ap_ppv) [];
  3792. }
  3793. }
  3794. }
  3795.  
  3796. stg_ap_ppp_fast
  3797. { W_ info;
  3798. W_ arity;
  3799. if (GETTAG(R1)==3) {
  3800. Sp_adj(0);
  3801. jump %GET_ENTRY(R1-3) [R1,R2,R3,R4];
  3802. }
  3803. #ifdef PROFILING
  3804. if (Sp - WDS(4) < SpLim) {
  3805. Sp_adj(-4);
  3806. W_[Sp+WDS(3)] = R4;
  3807. W_[Sp+WDS(2)] = R3;
  3808. W_[Sp+WDS(1)] = R2;
  3809. Sp(0) = stg_ap_ppp_info;
  3810. jump __stg_gc_enter_1 [R1];
  3811. }
  3812. #else
  3813. if (Sp - WDS(4) < SpLim) {
  3814. Sp_adj(-4);
  3815. W_[Sp+WDS(3)] = R4;
  3816. W_[Sp+WDS(2)] = R3;
  3817. W_[Sp+WDS(1)] = R2;
  3818. Sp(0) = stg_ap_ppp_info;
  3819. jump __stg_gc_enter_1 [R1];
  3820. }
  3821. #endif
  3822. R1 = UNTAG(R1);
  3823. info = %GET_STD_INFO(R1);
  3824. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3825. case FUN,
  3826. FUN_1_0,
  3827. FUN_0_1,
  3828. FUN_2_0,
  3829. FUN_1_1,
  3830. FUN_0_2,
  3831. FUN_STATIC: {
  3832. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3833. ASSERT(arity > 0);
  3834. if (arity == 1) {
  3835. Sp_adj(-3);
  3836. W_[Sp+WDS(1)] = R3;
  3837. W_[Sp+WDS(2)] = R4;
  3838. W_[Sp+WDS(0)] = stg_ap_pp_info;
  3839. R1 = R1 + 1;
  3840. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  3841. }
  3842. if (arity == 2) {
  3843. Sp_adj(-2);
  3844. W_[Sp+WDS(1)] = R4;
  3845. W_[Sp+WDS(0)] = stg_ap_p_info;
  3846. R1 = R1 + 2;
  3847. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  3848. }
  3849. if (arity == 3) {
  3850. Sp_adj(0);
  3851. R1 = R1 + 3;
  3852. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  3853. } else {
  3854. Sp_adj(-4);
  3855. W_[Sp+WDS(3)] = R4;
  3856. W_[Sp+WDS(2)] = R3;
  3857. W_[Sp+WDS(1)] = R2;
  3858. if (arity < 8) {
  3859. R1 = R1 + arity;
  3860. }
  3861. BUILD_PAP(3,3,stg_ap_ppp_info,FUN);
  3862. }
  3863. }
  3864. default: {
  3865. Sp_adj(-4);
  3866. W_[Sp+WDS(3)] = R4;
  3867. W_[Sp+WDS(2)] = R3;
  3868. W_[Sp+WDS(1)] = R2;
  3869. jump RET_LBL(stg_ap_ppp) [];
  3870. }
  3871. }
  3872. }
  3873.  
  3874. stg_ap_pppv_fast
  3875. { W_ info;
  3876. W_ arity;
  3877. if (GETTAG(R1)==4) {
  3878. Sp_adj(0);
  3879. jump %GET_ENTRY(R1-4) [R1,R2,R3,R4];
  3880. }
  3881. #ifdef PROFILING
  3882. if (Sp - WDS(4) < SpLim) {
  3883. Sp_adj(-4);
  3884. W_[Sp+WDS(3)] = R4;
  3885. W_[Sp+WDS(2)] = R3;
  3886. W_[Sp+WDS(1)] = R2;
  3887. Sp(0) = stg_ap_pppv_info;
  3888. jump __stg_gc_enter_1 [R1];
  3889. }
  3890. #else
  3891. if (Sp - WDS(4) < SpLim) {
  3892. Sp_adj(-4);
  3893. W_[Sp+WDS(3)] = R4;
  3894. W_[Sp+WDS(2)] = R3;
  3895. W_[Sp+WDS(1)] = R2;
  3896. Sp(0) = stg_ap_pppv_info;
  3897. jump __stg_gc_enter_1 [R1];
  3898. }
  3899. #endif
  3900. R1 = UNTAG(R1);
  3901. info = %GET_STD_INFO(R1);
  3902. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3903. case FUN,
  3904. FUN_1_0,
  3905. FUN_0_1,
  3906. FUN_2_0,
  3907. FUN_1_1,
  3908. FUN_0_2,
  3909. FUN_STATIC: {
  3910. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  3911. ASSERT(arity > 0);
  3912. if (arity == 1) {
  3913. Sp_adj(-3);
  3914. W_[Sp+WDS(1)] = R3;
  3915. W_[Sp+WDS(2)] = R4;
  3916. W_[Sp+WDS(0)] = stg_ap_ppv_info;
  3917. R1 = R1 + 1;
  3918. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  3919. }
  3920. if (arity == 2) {
  3921. Sp_adj(-2);
  3922. W_[Sp+WDS(1)] = R4;
  3923. W_[Sp+WDS(0)] = stg_ap_pv_info;
  3924. R1 = R1 + 2;
  3925. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  3926. }
  3927. if (arity == 3) {
  3928. #ifdef PROFILING
  3929. W_[Sp+WDS(-3)] = stg_restore_cccs_info;
  3930. W_[Sp+WDS(-2)] = CCCS;
  3931. W_[Sp+WDS(-1)] = stg_ap_v_info;
  3932. Sp_adj(-3);
  3933. #else
  3934. W_[Sp+WDS(-1)] = stg_ap_v_info;
  3935. Sp_adj(-1);
  3936. #endif
  3937. R1 = R1 + 3;
  3938. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  3939. }
  3940. if (arity == 4) {
  3941. Sp_adj(0);
  3942. R1 = R1 + 4;
  3943. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4];
  3944. } else {
  3945. Sp_adj(-4);
  3946. W_[Sp+WDS(3)] = R4;
  3947. W_[Sp+WDS(2)] = R3;
  3948. W_[Sp+WDS(1)] = R2;
  3949. if (arity < 8) {
  3950. R1 = R1 + arity;
  3951. }
  3952. BUILD_PAP(4,3,stg_ap_pppv_info,FUN);
  3953. }
  3954. }
  3955. default: {
  3956. Sp_adj(-4);
  3957. W_[Sp+WDS(3)] = R4;
  3958. W_[Sp+WDS(2)] = R3;
  3959. W_[Sp+WDS(1)] = R2;
  3960. jump RET_LBL(stg_ap_pppv) [];
  3961. }
  3962. }
  3963. }
  3964.  
  3965. stg_ap_pppp_fast
  3966. { W_ info;
  3967. W_ arity;
  3968. if (GETTAG(R1)==4) {
  3969. Sp_adj(0);
  3970. jump %GET_ENTRY(R1-4) [R1,R2,R3,R4,R5];
  3971. }
  3972. #ifdef PROFILING
  3973. if (Sp - WDS(5) < SpLim) {
  3974. Sp_adj(-5);
  3975. W_[Sp+WDS(4)] = R5;
  3976. W_[Sp+WDS(3)] = R4;
  3977. W_[Sp+WDS(2)] = R3;
  3978. W_[Sp+WDS(1)] = R2;
  3979. Sp(0) = stg_ap_pppp_info;
  3980. jump __stg_gc_enter_1 [R1];
  3981. }
  3982. #else
  3983. if (Sp - WDS(5) < SpLim) {
  3984. Sp_adj(-5);
  3985. W_[Sp+WDS(4)] = R5;
  3986. W_[Sp+WDS(3)] = R4;
  3987. W_[Sp+WDS(2)] = R3;
  3988. W_[Sp+WDS(1)] = R2;
  3989. Sp(0) = stg_ap_pppp_info;
  3990. jump __stg_gc_enter_1 [R1];
  3991. }
  3992. #endif
  3993. R1 = UNTAG(R1);
  3994. info = %GET_STD_INFO(R1);
  3995. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  3996. case FUN,
  3997. FUN_1_0,
  3998. FUN_0_1,
  3999. FUN_2_0,
  4000. FUN_1_1,
  4001. FUN_0_2,
  4002. FUN_STATIC: {
  4003. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  4004. ASSERT(arity > 0);
  4005. if (arity == 1) {
  4006. Sp_adj(-4);
  4007. W_[Sp+WDS(1)] = R3;
  4008. W_[Sp+WDS(2)] = R4;
  4009. W_[Sp+WDS(3)] = R5;
  4010. W_[Sp+WDS(0)] = stg_ap_ppp_info;
  4011. R1 = R1 + 1;
  4012. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  4013. }
  4014. if (arity == 2) {
  4015. Sp_adj(-3);
  4016. W_[Sp+WDS(1)] = R4;
  4017. W_[Sp+WDS(2)] = R5;
  4018. W_[Sp+WDS(0)] = stg_ap_pp_info;
  4019. R1 = R1 + 2;
  4020. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  4021. }
  4022. if (arity == 3) {
  4023. Sp_adj(-2);
  4024. W_[Sp+WDS(1)] = R5;
  4025. W_[Sp+WDS(0)] = stg_ap_p_info;
  4026. R1 = R1 + 3;
  4027. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  4028. }
  4029. if (arity == 4) {
  4030. Sp_adj(0);
  4031. R1 = R1 + 4;
  4032. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5];
  4033. } else {
  4034. Sp_adj(-5);
  4035. W_[Sp+WDS(4)] = R5;
  4036. W_[Sp+WDS(3)] = R4;
  4037. W_[Sp+WDS(2)] = R3;
  4038. W_[Sp+WDS(1)] = R2;
  4039. if (arity < 8) {
  4040. R1 = R1 + arity;
  4041. }
  4042. BUILD_PAP(4,4,stg_ap_pppp_info,FUN);
  4043. }
  4044. }
  4045. default: {
  4046. Sp_adj(-5);
  4047. W_[Sp+WDS(4)] = R5;
  4048. W_[Sp+WDS(3)] = R4;
  4049. W_[Sp+WDS(2)] = R3;
  4050. W_[Sp+WDS(1)] = R2;
  4051. jump RET_LBL(stg_ap_pppp) [];
  4052. }
  4053. }
  4054. }
  4055.  
  4056. stg_ap_ppppp_fast
  4057. { W_ info;
  4058. W_ arity;
  4059. if (GETTAG(R1)==5) {
  4060. Sp_adj(0);
  4061. jump %GET_ENTRY(R1-5) [R1,R2,R3,R4,R5,R6];
  4062. }
  4063. #ifdef PROFILING
  4064. if (Sp - WDS(6) < SpLim) {
  4065. Sp_adj(-6);
  4066. W_[Sp+WDS(5)] = R6;
  4067. W_[Sp+WDS(4)] = R5;
  4068. W_[Sp+WDS(3)] = R4;
  4069. W_[Sp+WDS(2)] = R3;
  4070. W_[Sp+WDS(1)] = R2;
  4071. Sp(0) = stg_ap_ppppp_info;
  4072. jump __stg_gc_enter_1 [R1];
  4073. }
  4074. #else
  4075. if (Sp - WDS(6) < SpLim) {
  4076. Sp_adj(-6);
  4077. W_[Sp+WDS(5)] = R6;
  4078. W_[Sp+WDS(4)] = R5;
  4079. W_[Sp+WDS(3)] = R4;
  4080. W_[Sp+WDS(2)] = R3;
  4081. W_[Sp+WDS(1)] = R2;
  4082. Sp(0) = stg_ap_ppppp_info;
  4083. jump __stg_gc_enter_1 [R1];
  4084. }
  4085. #endif
  4086. R1 = UNTAG(R1);
  4087. info = %GET_STD_INFO(R1);
  4088. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  4089. case FUN,
  4090. FUN_1_0,
  4091. FUN_0_1,
  4092. FUN_2_0,
  4093. FUN_1_1,
  4094. FUN_0_2,
  4095. FUN_STATIC: {
  4096. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  4097. ASSERT(arity > 0);
  4098. if (arity == 1) {
  4099. Sp_adj(-5);
  4100. W_[Sp+WDS(1)] = R3;
  4101. W_[Sp+WDS(2)] = R4;
  4102. W_[Sp+WDS(3)] = R5;
  4103. W_[Sp+WDS(4)] = R6;
  4104. W_[Sp+WDS(0)] = stg_ap_pppp_info;
  4105. R1 = R1 + 1;
  4106. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  4107. }
  4108. if (arity == 2) {
  4109. Sp_adj(-4);
  4110. W_[Sp+WDS(1)] = R4;
  4111. W_[Sp+WDS(2)] = R5;
  4112. W_[Sp+WDS(3)] = R6;
  4113. W_[Sp+WDS(0)] = stg_ap_ppp_info;
  4114. R1 = R1 + 2;
  4115. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  4116. }
  4117. if (arity == 3) {
  4118. Sp_adj(-3);
  4119. W_[Sp+WDS(1)] = R5;
  4120. W_[Sp+WDS(2)] = R6;
  4121. W_[Sp+WDS(0)] = stg_ap_pp_info;
  4122. R1 = R1 + 3;
  4123. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  4124. }
  4125. if (arity == 4) {
  4126. Sp_adj(-2);
  4127. W_[Sp+WDS(1)] = R6;
  4128. W_[Sp+WDS(0)] = stg_ap_p_info;
  4129. R1 = R1 + 4;
  4130. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  4131. }
  4132. if (arity == 5) {
  4133. Sp_adj(0);
  4134. R1 = R1 + 5;
  4135. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  4136. } else {
  4137. Sp_adj(-6);
  4138. W_[Sp+WDS(5)] = R6;
  4139. W_[Sp+WDS(4)] = R5;
  4140. W_[Sp+WDS(3)] = R4;
  4141. W_[Sp+WDS(2)] = R3;
  4142. W_[Sp+WDS(1)] = R2;
  4143. if (arity < 8) {
  4144. R1 = R1 + arity;
  4145. }
  4146. BUILD_PAP(5,5,stg_ap_ppppp_info,FUN);
  4147. }
  4148. }
  4149. default: {
  4150. Sp_adj(-6);
  4151. W_[Sp+WDS(5)] = R6;
  4152. W_[Sp+WDS(4)] = R5;
  4153. W_[Sp+WDS(3)] = R4;
  4154. W_[Sp+WDS(2)] = R3;
  4155. W_[Sp+WDS(1)] = R2;
  4156. jump RET_LBL(stg_ap_ppppp) [];
  4157. }
  4158. }
  4159. }
  4160.  
  4161. stg_ap_pppppp_fast
  4162. { W_ info;
  4163. W_ arity;
  4164. if (GETTAG(R1)==6) {
  4165. Sp_adj(0);
  4166. jump %GET_ENTRY(R1-6) [R1,R2,R3,R4,R5,R6];
  4167. }
  4168. #ifdef PROFILING
  4169. if (Sp - WDS(6) < SpLim) {
  4170. Sp_adj(-6);
  4171. W_[Sp+WDS(5)] = R6;
  4172. W_[Sp+WDS(4)] = R5;
  4173. W_[Sp+WDS(3)] = R4;
  4174. W_[Sp+WDS(2)] = R3;
  4175. W_[Sp+WDS(1)] = R2;
  4176. Sp(0) = stg_ap_pppppp_info;
  4177. jump __stg_gc_enter_1 [R1];
  4178. }
  4179. #else
  4180. if (Sp - WDS(6) < SpLim) {
  4181. Sp_adj(-6);
  4182. W_[Sp+WDS(5)] = R6;
  4183. W_[Sp+WDS(4)] = R5;
  4184. W_[Sp+WDS(3)] = R4;
  4185. W_[Sp+WDS(2)] = R3;
  4186. W_[Sp+WDS(1)] = R2;
  4187. Sp(0) = stg_ap_pppppp_info;
  4188. jump __stg_gc_enter_1 [R1];
  4189. }
  4190. #endif
  4191. R1 = UNTAG(R1);
  4192. info = %GET_STD_INFO(R1);
  4193. switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (TO_W_(%INFO_TYPE(info))) {
  4194. case FUN,
  4195. FUN_1_0,
  4196. FUN_0_1,
  4197. FUN_2_0,
  4198. FUN_1_1,
  4199. FUN_0_2,
  4200. FUN_STATIC: {
  4201. arity = TO_W_(StgFunInfoExtra_arity(%GET_FUN_INFO(R1)));
  4202. ASSERT(arity > 0);
  4203. if (arity == 1) {
  4204. Sp_adj(-5);
  4205. W_[Sp+WDS(1)] = R3;
  4206. W_[Sp+WDS(2)] = R4;
  4207. W_[Sp+WDS(3)] = R5;
  4208. W_[Sp+WDS(4)] = R6;
  4209. W_[Sp+WDS(0)] = stg_ap_ppppp_info;
  4210. R1 = R1 + 1;
  4211. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  4212. }
  4213. if (arity == 2) {
  4214. Sp_adj(-4);
  4215. W_[Sp+WDS(1)] = R4;
  4216. W_[Sp+WDS(2)] = R5;
  4217. W_[Sp+WDS(3)] = R6;
  4218. W_[Sp+WDS(0)] = stg_ap_pppp_info;
  4219. R1 = R1 + 2;
  4220. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  4221. }
  4222. if (arity == 3) {
  4223. Sp_adj(-3);
  4224. W_[Sp+WDS(1)] = R5;
  4225. W_[Sp+WDS(2)] = R6;
  4226. W_[Sp+WDS(0)] = stg_ap_ppp_info;
  4227. R1 = R1 + 3;
  4228. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  4229. }
  4230. if (arity == 4) {
  4231. Sp_adj(-2);
  4232. W_[Sp+WDS(1)] = R6;
  4233. W_[Sp+WDS(0)] = stg_ap_pp_info;
  4234. R1 = R1 + 4;
  4235. jump_SAVE_CCCS(%GET_ENTRY(UNTAG(R1)));
  4236. }
  4237. if (arity == 5) {
  4238. #ifdef PROFILING
  4239. W_[Sp+WDS(-3)] = stg_restore_cccs_info;
  4240. W_[Sp+WDS(-2)] = CCCS;
  4241. W_[Sp+WDS(-1)] = stg_ap_p_info;
  4242. Sp_adj(-3);
  4243. #else
  4244. W_[Sp+WDS(-1)] = stg_ap_p_info;
  4245. Sp_adj(-1);
  4246. #endif
  4247. R1 = R1 + 5;
  4248. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  4249. }
  4250. if (arity == 6) {
  4251. Sp_adj(0);
  4252. R1 = R1 + 6;
  4253. jump %GET_ENTRY(UNTAG(R1)) [R1,R2,R3,R4,R5,R6];
  4254. } else {
  4255. Sp_adj(-6);
  4256. W_[Sp+WDS(5)] = R6;
  4257. W_[Sp+WDS(4)] = R5;
  4258. W_[Sp+WDS(3)] = R4;
  4259. W_[Sp+WDS(2)] = R3;
  4260. W_[Sp+WDS(1)] = R2;
  4261. if (arity < 8) {
  4262. R1 = R1 + arity;
  4263. }
  4264. BUILD_PAP(6,6,stg_ap_pppppp_info,FUN);
  4265. }
  4266. }
  4267. default: {
  4268. Sp_adj(-6);
  4269. W_[Sp+WDS(5)] = R6;
  4270. W_[Sp+WDS(4)] = R5;
  4271. W_[Sp+WDS(3)] = R4;
  4272. W_[Sp+WDS(2)] = R3;
  4273. W_[Sp+WDS(1)] = R2;
  4274. jump RET_LBL(stg_ap_pppppp) [];
  4275. }
  4276. }
  4277. }
  4278. section "relrodata" {
  4279. stg_ap_stack_entries:
  4280. W_ 0; W_ 0; W_ 0;
  4281. W_ stg_ap_stk_;
  4282. W_ stg_ap_stk_n;
  4283. W_ stg_ap_stk_p;
  4284. W_ stg_ap_stk_f;
  4285. W_ stg_ap_stk_d;
  4286. W_ stg_ap_stk_l;
  4287. W_ stg_ap_stk_v16;
  4288. W_ stg_ap_stk_v32;
  4289. W_ stg_ap_stk_v64;
  4290. W_ stg_ap_stk_nn;
  4291. W_ stg_ap_stk_np;
  4292. W_ stg_ap_stk_pn;
  4293. W_ stg_ap_stk_pp;
  4294. W_ stg_ap_stk_nnn;
  4295. W_ stg_ap_stk_nnp;
  4296. W_ stg_ap_stk_npn;
  4297. W_ stg_ap_stk_npp;
  4298. W_ stg_ap_stk_pnn;
  4299. W_ stg_ap_stk_pnp;
  4300. W_ stg_ap_stk_ppn;
  4301. W_ stg_ap_stk_ppp;
  4302. W_ stg_ap_stk_pppp;
  4303. W_ stg_ap_stk_ppppp;
  4304. W_ stg_ap_stk_pppppp;
  4305. W_ stg_ap_stk_ppppppp;
  4306. W_ stg_ap_stk_pppppppp;
  4307. }
  4308. section "relrodata" {
  4309. stg_stack_save_entries:
  4310. W_ 0; W_ 0; W_ 0;
  4311. W_ stg_stk_save_;
  4312. W_ stg_stk_save_n;
  4313. W_ stg_stk_save_p;
  4314. W_ stg_stk_save_f;
  4315. W_ stg_stk_save_d;
  4316. W_ stg_stk_save_l;
  4317. W_ stg_stk_save_v16;
  4318. W_ stg_stk_save_v32;
  4319. W_ stg_stk_save_v64;
  4320. W_ stg_stk_save_nn;
  4321. W_ stg_stk_save_np;
  4322. W_ stg_stk_save_pn;
  4323. W_ stg_stk_save_pp;
  4324. W_ stg_stk_save_nnn;
  4325. W_ stg_stk_save_nnp;
  4326. W_ stg_stk_save_npn;
  4327. W_ stg_stk_save_npp;
  4328. W_ stg_stk_save_pnn;
  4329. W_ stg_stk_save_pnp;
  4330. W_ stg_stk_save_ppn;
  4331. W_ stg_stk_save_ppp;
  4332. W_ stg_stk_save_pppp;
  4333. W_ stg_stk_save_ppppp;
  4334. W_ stg_stk_save_pppppp;
  4335. W_ stg_stk_save_ppppppp;
  4336. W_ stg_stk_save_pppppppp;
  4337. }
  4338. section "rodata" {
  4339. stg_arg_bitmaps:
  4340. W_ 0; W_ 0; W_ 0;
  4341. W_ 0;
  4342. W_ 65;
  4343. W_ 1;
  4344. W_ 65;
  4345. W_ 65;
  4346. W_ 65;
  4347. W_ 194;
  4348. W_ 964;
  4349. W_ 16328;
  4350. W_ 194;
  4351. W_ 66;
  4352. W_ 130;
  4353. W_ 2;
  4354. W_ 451;
  4355. W_ 195;
  4356. W_ 323;
  4357. W_ 67;
  4358. W_ 387;
  4359. W_ 131;
  4360. W_ 259;
  4361. W_ 3;
  4362. W_ 4;
  4363. W_ 5;
  4364. W_ 6;
  4365. W_ 7;
  4366. W_ 8;
  4367. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement