diff --git a/src/new-cmp/cmpc-data.lsp b/src/new-cmp/cmpc-data.lsp index ea814c658..67852c554 100644 --- a/src/new-cmp/cmpc-data.lsp +++ b/src/new-cmp/cmpc-data.lsp @@ -140,7 +140,8 @@ (unless (or *compiler-constants* (not *use-static-constants-p*)) (let ((static-constants 0)) (flet ((turned-static-p (record) - (destructuring-bind (object (&whole location vv-tag index object-copy)) + (destructuring-bind (object (&whole location vv-tag index object-copy) + index-copy) (let ((builder (static-constant-expression object))) (when builder (let* ((next-index (incf static-constants)) @@ -163,15 +164,18 @@ (defun replace-optimizable-constants () (let ((found nil)) (flet ((turned-inline-p (record) - (destructuring-bind (object (&whole location vv-tag index object-copy)) - (let ((x (assoc object +optimizable-constants+))) - (when x - (setf found t) - (format *dump-output* "~&;;; Replacing constant ~A with ~A" - object (second x)) - (setf (second location) (second x) - (first location) (first x)) - t))))) + (print record) + (destructuring-bind (object (&whole location vv-tag index object-copy) + index-copy) + record + (let ((x (assoc object +optimizable-constants+))) + (when x + (setf found t) + (format *dump-output* "~&;;; Replacing constant ~A with ~A" + object (second x)) + (setf (second location) (second x) + (first location) (first x)) + t))))) (setf *permanent-objects* (delete-if #'turned-inline-p *permanent-objects*) *temporary-objects* diff --git a/src/new-cmp/cmpc-pass.lsp b/src/new-cmp/cmpc-pass.lsp index 7fe5f1899..fe371af88 100644 --- a/src/new-cmp/cmpc-pass.lsp +++ b/src/new-cmp/cmpc-pass.lsp @@ -18,5 +18,5 @@ (execute-pass 'pass-consistency) (execute-pass 'pass-delete-no-side-effects) (execute-pass 'pass-delete-unused-bindings) - (execute-pass 'pass-decide-var-rep-types) - (execute-pass 'pass-assign-labels)) + (execute-pass 'pass-assign-labels) + (execute-pass 'pass-decide-var-rep-types)) diff --git a/src/new-cmp/cmppackage.lsp b/src/new-cmp/cmppackage.lsp index d035a9996..f0e822ece 100644 --- a/src/new-cmp/cmppackage.lsp +++ b/src/new-cmp/cmppackage.lsp @@ -35,11 +35,47 @@ "MAKE-C1FORM*" "LOCATION-TYPE" "LOCATION-PRIMARY-TYPE" + + "PPRINT-C1FORM" "PPRINT-C1FORMS" + ;; + ;; Symbols naming possible locations + ;; + "TEMP" "LCL" "VV" "VV-TEMP" "TRASH" + "FIXNUM-VALUE" "CHARACTER-VALUE" + "LONG-FLOAT-VALUE" "DOUBLE-FLOAT-VALUE" "SINGLE-FLOAT-VALUE" + "VALUE" "VALUE0" "VALUES+VALUE0" "RETURN" "ACTUAL-RETURN" + "VA-ARG" "CL-VA-ARG" "KEYVARS" + "CALL" "CALL-NORMAL" "CALL-INDIRECT" + "COERCE-LOC" + "FDEFINITION" "MAKE-CCLOSURE" + "JMP-TRUE" "JMP-FALSE" "JMP-ZERO" "JMP-NONZERO" + ;; + ;; Symbols naming C1FORMS + ;; + "SET-MV" "BIND" "BIND-SPECIAL" "UNBIND" "PROGV-EXIT" + "FRAME-POP" "FRAME-SET" "FRAME-SAVE-NEXT" "FRAME-JMP-NEXT" + "FRAME-ID" + "CALL-LOCAL" "CALL-GLOBAL" "JMP" + "FUNCTION-EPILOGUE" "FUNCTION-PROLOGUE" "BIND-REQUIREDS" + "VARARGS-BIND" "VARARGS-POP" "VARARGS-REST" "VARARGS-UNBIND" + "STACK-FRAME-OPEN" "STACK-FRAME-PUSH" "STACK-FRAME-PUSH-VALUES" + "STACK-FRAME-POP-VALUES" "STACK-FRAME-APPLY" "STACK-FRAME-CLOSE" + "DEBUG-ENV-OPEN" "DEBUG-ENV-CLOSE" "DEBUG-ENV-PUSH-VARS" + "DEBUG-ENV-POP-VARS" + "DO-FLET/LABELS" ) (:import-from "SI" "*COMPILER-CONSTANTS*")) -(defpackage "C-BACKEND" +(defpackage "C-PASSES" (:use "FFI" "CL" "C-DATA") + (:export "EXECUTE-PASS" + "PASS-CONSISTENCY" + "PASS-DELETE-NO-SIDE-EFFECTS" + "PASS-ASSIGN-LABELS" + "PASS-DELETE-UNUSED-BINDINGS")) + +(defpackage "C-BACKEND" + (:use "FFI" "CL" "C-DATA" "C-PASSES") (:export "CTOP-WRITE" "DUMP-ALL" "DATA-DUMP" "WT-FILTERED-DATA")) diff --git a/src/new-cmp/cmppass.lsp b/src/new-cmp/cmppass.lsp index f984a10ab..2d2681ef5 100644 --- a/src/new-cmp/cmppass.lsp +++ b/src/new-cmp/cmppass.lsp @@ -59,7 +59,7 @@ ;;; VARARGS-UNBIND nargs-loc varargs-loc min max nkeys check ;;; -(in-package "COMPILER") +(in-package "C-PASSES") (defparameter *dump-output* (open "dump.log" :direction :output :if-exists :supersede