try-fasl.lsp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. (setq *echo t)
  2. % First I wish to ensure that all relevant code is loaded!
  3. (faslout "foo") (faslend)
  4. (mytrace 'depositquadwordexpression)
  5. (cond
  6. ((member 'vsl lispsystem*)
  7. (de putentry (a b c)
  8. (print (list 'putentry a b c))
  9. nil))
  10. (t (load nbittab)))
  11. % The standard PSL version of codefiletrailer writes out strings in a way
  12. % that can leave junk bytes within the part that pads them out to be a
  13. % multiple of 8 bytes long. This version fixes that so that the fasl files
  14. % that are generated are "clean"
  15. (remflag '(codefiletrailer codewritestring) 'lose)
  16. (fluid '(first-local-id-number))
  17. (setq first-local-id-number 2048)
  18. % (de codewritestring (x)
  19. % (setq x (strinf x))
  20. % (setq s (strlen x))
  21. % (binarywrite codeout* s)
  22. % % This use of binarywriteblock dumps whatever happens to be in mememory
  23. % % in the padding space...
  24. % (binarywriteblock codeout* (strbase x) (strpack s)))
  25. (setq *comp t)
  26. (de codewritestring (x)
  27. (prog (len w)
  28. (setq x (explode2 x))
  29. (setq len (sub1 (length x)))
  30. (setq w (times 8 (strpack len))) % 8 bytes per word
  31. (binarywrite codeout* len)
  32. (foreach b in x do (binarywritebyte codeout* (char-code b)))
  33. % Write out explicit zero bytes to pad.
  34. (while (lessp (setq len (add1 len)) w)
  35. (binarywritebyte codeout* 0))))
  36. (cond
  37. ((null (member 'vsl lispsystem*))
  38. (de binarywritebyte (str b) (fputc b str))))
  39. (de codefiletrailer ()
  40. (prog (s len)
  41. (systemfaslfixup)
  42. (binarywrite codeout* (idifference (isub1 nextidnumber*)
  43. first-local-id-number))
  44. % Number of local IDs
  45. (foreach x in (car orderedidlist*) do
  46. (progn (remprop x fasl-idnumber-property*)
  47. (codewritestring (faslid2string x))))
  48. (binarywrite codeout* % S is size in words
  49. (setq s
  50. (quotient
  51. (plus2 currentoffset*
  52. (sub1 addressingunitsperitem))
  53. addressingunitsperitem)))
  54. (binarywrite codeout* initoffset*)
  55. (binarywriteblock codeout* codebase* s)
  56. (if *compact-bittable
  57. (let((b (compact-bittable bittablebase* bittableoffset*))
  58. (bpw (quotient bitsperword 8)))
  59. (binarywrite codeout*
  60. (setq s (quotient
  61. (plus2 (car b)
  62. (sub1 bpw))
  63. bpw)))
  64. % Here I write the compacted bitmap out using code that does not depend
  65. % in data representation. Actually if I am doing things this way it
  66. % would be better if compact-bittable returned a list rather than a string.
  67. (setq b (explode2 (cdr b)))
  68. (setq len (length b))
  69. (setq s (times 8 s))
  70. (foreach b1 in b do
  71. (binarywritebyte codeout* (char-code b1)))
  72. (while (lessp (setq len (add1 len)) s)
  73. (binarywritebyte codeout* 0))
  74. % This is what it used to say...
  75. % (binarywriteblock codeout* (strbase(strinf (cdr b))) s)
  76. )
  77. (progn
  78. (binarywrite codeout*
  79. (setq s
  80. (quotient
  81. (plus2 bittableoffset*
  82. (sub1 bittable-entries-per-word))
  83. bittable-entries-per-word)))
  84. (binarywriteblock codeout* bittablebase* s)
  85. ))
  86. (deallocatefaslspaces)))
  87. % VSL uses a macro for printf, PSL a function that it calls with
  88. % however many arguments it thinks it wants to. To avoid this messing up
  89. % compilation I will remob that symbol. Ditto bldmsg.
  90. (remob 'printf)
  91. (remob 'bldmsg)
  92. (remob 'errorprintf)
  93. (setq *plap t)
  94. (setq *pgwd t)
  95. (setq *testlap t)
  96. (faslout "foo")
  97. %(dskin "../psl/dist/comp/pass-2-3.sl")
  98. (dskin "p23.sl")
  99. (faslend)