Skip to content

Commit 3ea35cd

Browse files
authored
Merge pull request #1435 from clasp-developers/bytecode-feature
Bytecode feature
2 parents 104f2df + 1287f51 commit 3ea35cd

File tree

4 files changed

+31
-29
lines changed

4 files changed

+31
-29
lines changed

src/lisp/kernel/cmp/cmpltv.lisp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@
9999
(%value :initarg :value :reader setf-aref-value :type creator)))
100100

101101
(defclass hash-table-creator (vcreator)
102-
(;; used in disltv
103-
(%test :initarg :test :reader hash-table-creator-test :type symbol)
102+
((%test :initarg :test :reader hash-table-creator-test :type symbol)
104103
(%count :initarg :count :reader hash-table-creator-count
105104
:type (integer 0))))
106105

@@ -570,7 +569,7 @@
570569
(make-array 74 sind rank . dims)
571570
(setf-row-major-aref 75 arrayind rmindex valueind)
572571
(make-hash-table 76 sind test count)
573-
((setf gethash) 77 htind keyind valueind)
572+
(setf-gethash 77 htind keyind valueind)
574573
(make-sb64 78 sind sb64)
575574
(find-package 79 sind nameind)
576575
(make-bignum 80 sind size . words) ; size is signed
@@ -827,11 +826,10 @@
827826
(%uaet-info (array-element-type array)))
828827

829828
(defmethod encode ((inst hash-table-creator) stream)
830-
(let* ((ht (prototype inst))
831-
;; TODO: Custom hash-table tests.
829+
(let* (;; TODO: Custom hash-table tests.
832830
;; NOTE that for non-custom hash table tests, the standard
833831
;; guarantees that hash-table-test returns a symbol.
834-
(testcode (ecase (hash-table-test ht)
832+
(testcode (ecase (hash-table-creator-test inst)
835833
((eq) #b00)
836834
((eql) #b01)
837835
((equal) #b10)
@@ -845,14 +843,14 @@
845843
;; up, it might be rehashed and resized during initialization as it
846844
;; reaches the rehash threshold. I am not sure how to deal with this
847845
;; in a portable fashion. (we could just invert a provided rehash-size?)
848-
(count (max (hash-table-count ht) #xffff)))
846+
(count (min (hash-table-creator-count inst) #xffff)))
849847
(write-mnemonic 'make-hash-table stream)
850848
(write-index inst stream)
851849
(write-byte testcode stream)
852850
(write-b16 count stream)))
853851

854852
(defmethod encode ((inst setf-gethash) stream)
855-
(write-mnemonic '(setf gethash) stream)
853+
(write-mnemonic 'setf-gethash stream)
856854
(write-index (setf-gethash-hash-table inst) stream)
857855
(write-index (setf-gethash-key inst) stream)
858856
(write-index (setf-gethash-value inst) stream))

src/lisp/kernel/cmp/compile-file.lisp

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -301,24 +301,25 @@ Compile a Lisp source stream and return a corresponding LLVM module."
301301
image-startup-position optimize optimize-level))
302302
"See CLHS compile-file."
303303
(with-compilation-unit ()
304-
(let ((output-path (apply #'compile-file-pathname input-file args))
305-
(*compilation-module-index* 0) ; FIXME: necessary?
306-
(*readtable* *readtable*) (*package* *package*)
307-
(*optimize* *optimize*) (*policy* *policy*)
308-
(*compile-file-pathname*
309-
(pathname (merge-pathnames input-file)))
310-
(*compile-file-truename*
311-
(translate-logical-pathname *compile-file-pathname*))
312-
(*compile-file-source-debug-pathname*
313-
(if cfsdpp source-debug-pathname *compile-file-truename*))
314-
(*compile-file-file-scope*
315-
(core:file-scope *compile-file-source-debug-pathname*))
316-
;; bytecode compilation can't be done in parallel at the moment.
317-
;; we could possibly warn about it if execution was specified,
318-
;; but practically speaking it would mostly be noise.
319-
(execution (if (member output-type '(:bytecode :bytecodel))
320-
:serial
321-
execution)))
304+
(let* ((output-type (fixup-output-type output-type))
305+
(output-path (apply #'compile-file-pathname input-file args))
306+
(*compilation-module-index* 0) ; FIXME: necessary?
307+
(*readtable* *readtable*) (*package* *package*)
308+
(*optimize* *optimize*) (*policy* *policy*)
309+
(*compile-file-pathname*
310+
(pathname (merge-pathnames input-file)))
311+
(*compile-file-truename*
312+
(translate-logical-pathname *compile-file-pathname*))
313+
(*compile-file-source-debug-pathname*
314+
(if cfsdpp source-debug-pathname *compile-file-truename*))
315+
(*compile-file-file-scope*
316+
(core:file-scope *compile-file-source-debug-pathname*))
317+
;; bytecode compilation can't be done in parallel at the moment.
318+
;; we could possibly warn about it if execution was specified,
319+
;; but practically speaking it would mostly be noise.
320+
(execution (if (member output-type '(:bytecode :bytecodel))
321+
:serial
322+
execution)))
322323
(with-open-file (source-sin input-file
323324
:external-format external-format)
324325
(with-compilation-results ()

src/lisp/kernel/cmp/disltv.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@
546546
;;; Write a FASL object out to a stream/file.
547547

548548
(defun write-fasl (fasl stream)
549-
(write-bytecode (instructions fasl) (attributes fasl) stream))
549+
(write-bytecode (instructions fasl) stream))
550550

551551
(defun save-fasl (fasl output-path)
552552
(with-open-file (output output-path

src/lisp/kernel/init.lisp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,12 @@
109109

110110
(if (member :generate-faso *features*)
111111
(setq core:*clasp-build-mode* :faso))
112-
113112

114-
(setq cmp:*default-object-type* core:*clasp-build-mode*)
113+
114+
(setq cmp:*default-object-type*
115+
(if (member :generate-bytecode *features*)
116+
:bytecode
117+
core:*clasp-build-mode*))
115118

116119
;;; ------------------------------------------------------------
117120
;;;

0 commit comments

Comments
 (0)