dec20-patches.sl 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. % DEC20-PATCHES.SL
  2. % to convert to Portable, 2 reg for LINK model
  3. % From DEC20-Asm.RED
  4. % These will now be simpler than 20, just JRST
  5. % Should even be InternalEntry for efficiency, avoid circular defns
  6. % Right now, expect same as !%Store!-JCALL would install
  7. (SETQ UndefinedFunctionCellInstructions!*
  8. '((!*JCALL UndefinedFunction)))
  9. (SETQ LambdaFunctionCellInstructions!*
  10. '((!*JCALL CompiledCallingInterpreted)))
  11. (Put 'LinkReg 'RegisterName 12)
  12. (Put 'NargReg 'RegisterName 13)
  13. % From PC:Common-Cmacros.sl
  14. (de MakeLinkRegs(Fn Nargs)
  15. (cond ((FlagP Fn 'NoLinkage) NIL)
  16. (T (list (list '!*Move (list 'IdLoc FunctionName) '(reg LinkReg) )
  17. (list '!*Move (list 'Wconst NumberofArguments) '(reg NargReg) )
  18. ))))
  19. (FLAG '(IDapply0 IDapply1 IDapply2 IDapply3 IDapply4) 'NoLinkage)
  20. (de !*Link (FunctionName FunctionType NumberOfArguments)
  21. (cond ((FlagP FunctionName 'ForeignFunction)
  22. (list (list '!*ForeignLink
  23. FunctionName
  24. FunctionType
  25. NumberOfArguments)))
  26. (t (append (MakeLinkRegs FunctionName NumberofArguments)
  27. (list (list '!*Call FunctionName))))))
  28. (de !*LinkE (DeAllocCount FunctionName FunctionType NumberOfArguments)
  29. (cons (list '!*DeAlloc DeAllocCount)
  30. (cond ((FlagP FunctionName 'ForeignFunction)
  31. (list (list '!*ForeignLink
  32. FunctionName
  33. FunctionType
  34. NumberOfArguments)
  35. '(!*Exit 0)))
  36. (t (Append (MakeLinkRegs FunctionName NumberofArguments)
  37. (list (list '!*JCall FunctionName)))))))
  38. (DefList '((IDApply0 (
  39. (!*move (Wconst 0) (reg NargReg))
  40. (!*move (reg 1) (reg LinkReg))
  41. % (!*Wtimes2 (reg 1) (Wconst AddressingUnitsPerFunctionCell))
  42. (pushj (reg st) (Indexed (reg 1) (WArray SymFnc)))))
  43. (IDApply1 (
  44. (!*move (Wconst 1) (reg NargReg))
  45. (!*move (reg 2) (reg LinkReg))
  46. % (!*Wtimes2 (reg 2) (Wconst AddressingUnitsPerFunctionCell))
  47. (pushj (reg st) (Indexed (reg 2) (WArray SymFnc)))))
  48. (IDApply2 (
  49. (!*move (Wconst 2) (reg NargReg))
  50. (!*move (reg 3) (reg LinkReg))
  51. % (!*Wtimes2 (reg 3) (Wconst AddressingUnitsPerFunctionCell))
  52. (pushj (reg st) (Indexed (reg 3) (WArray SymFnc)))))
  53. (IDApply3 (
  54. (!*move (Wconst 3) (reg NargReg))
  55. (!*move (reg 4) (reg LinkReg))
  56. % (!*Wtimes2 (reg 4) (Wconst AddressingUnitsPerFunctionCell))
  57. (pushj (reg st) (Indexed (reg 4) (WArray SymFnc)))))
  58. (IDApply4 (
  59. (!*move (Wconst 4) (reg NargReg))
  60. (!*move (reg 5) (reg LinkReg))
  61. % (!*Wtimes2 (reg 5) (Wconst AddressingUnitsPerFunctionCell))
  62. (pushj (reg st) (Indexed (reg 5) (WArray SymFnc)))))
  63. ) 'OpenCode)
  64. (DefList '((IDApply0 (
  65. (!*move (Wconst 0) (reg NargReg))
  66. (!*move (reg 1) (reg LinkReg))
  67. % (!*wtimes2 (reg 1) (Wconst AddressingUnitsPerFunctionCell))
  68. (jrst (Indexed (reg 1) (WArray SymFnc)))))
  69. (IDApply1 (
  70. (!*move (Wconst 1) (reg NargReg))
  71. (!*move (reg 2) (reg LinkReg))
  72. % (!*wtimes2 (reg 2) (Wconst AddressingUnitsPerFunctionCell))
  73. (jrst (Indexed (reg 2) (WArray SymFnc)))))
  74. (IDApply2 (
  75. (!*move (Wconst 2) (reg NargReg))
  76. (!*move (reg 3) (reg LinkReg))
  77. % (!*wtimes2 (reg 3) (Wconst AddressingUnitsPerFunctionCell))
  78. (jrst (Indexed (reg 3) (WArray SymFnc)))))
  79. (IDApply3 (
  80. (!*move (Wconst 3) (reg NargReg))
  81. (!*move (reg 4) (reg LinkReg))
  82. % (!*wtimes2 (reg 4) (Wconst AddressingUnitsPerFunctionCell))
  83. (jrst (Indexed (reg 4) (WArray SymFnc)))))
  84. (IDApply4 (
  85. (!*move (Wconst 4) (reg NargReg))
  86. (!*move (reg 5) (reg LinkReg))
  87. % (!*wtimes2 (reg 5) (Wconst AddressingUnitsPerFunctionCell))
  88. (jrst (Indexed (reg 5) (WArray SymFnc)))))
  89. ) 'ExitOpenCode)
  90. % From PC:lap-to-asm.red
  91. (de DataPrintUndefinedFunctionCell ()
  92. (Prog (OldOut)
  93. (setq OldOut (WRS DataOut!*))
  94. (foreach X in (Pass1Lap UndefinedFunctionCellInstructions!*) do
  95. (ASMOutLap1 X))
  96. (WRS OldOut)))
  97. (DSKIN "PC:P-LAMBIND.SL")
  98. % new SYSLISP bug, perhaps useful refefined it?
  99. (off usermode)
  100. (dm for(u) ( MkFor1 u))