Changeset 11719
- Timestamp:
- 03/29/09 07:56:52 (15 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/compile-file.lisp
r11675 r11719 429 429 (jvm::*functions-defined-in-current-file* '()) 430 430 (*fbound-names* '())) 431 (write "; -*- Mode: Lisp -*-" :escape nil :stream out) 432 (%stream-terpri out) 433 (let ((*package* (find-package '#:cl))) 434 (write (list 'init-fasl :version *fasl-version*) :stream out) 431 (jvm::with-file-compilation 432 (write "; -*- Mode: Lisp -*-" :escape nil :stream out) 435 433 (%stream-terpri out) 436 (write (list 'setq '*source* *compile-file-truename*) :stream out) 437 (%stream-terpri out)) 438 (loop 439 (let* ((*source-position* (file-position in)) 440 (jvm::*source-line-number* (stream-line-number in)) 441 (form (read in nil in)) 442 (*compiler-error-context* form)) 443 (when (eq form in) 444 (return)) 445 (process-toplevel-form form out nil))) 446 (dolist (name *fbound-names*) 447 (fmakunbound name)))) 434 (let ((*package* (find-package '#:cl))) 435 (write (list 'init-fasl :version *fasl-version*) :stream out) 436 (%stream-terpri out) 437 (write (list 'setq '*source* *compile-file-truename*) :stream out) 438 (%stream-terpri out)) 439 (loop 440 (let* ((*source-position* (file-position in)) 441 (jvm::*source-line-number* (stream-line-number in)) 442 (form (read in nil in)) 443 (*compiler-error-context* form)) 444 (when (eq form in) 445 (return)) 446 (process-toplevel-form form out nil))) 447 (dolist (name *fbound-names*) 448 (fmakunbound name))))) 448 449 (cond ((zerop (+ jvm::*errors* jvm::*warnings* jvm::*style-warnings*)) 449 450 (setf warnings-p nil failure-p nil)) -
trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
r11709 r11719 2069 2069 symbol *declared-symbols* ht g 2070 2070 (cond ((null (symbol-package symbol)) 2071 (setf g (if * compile-file-truename*2071 (setf g (if *file-compilation* 2072 2072 (declare-object-as-string symbol +lisp-symbol+ 2073 2073 +lisp-symbol-class+) … … 2301 2301 (defknown declare-instance (t) t) 2302 2302 (defun declare-instance (obj) 2303 (aver (not (null * compile-file-truename*)))2303 (aver (not (null *file-compilation*))) 2304 2304 (aver (or (structure-object-p obj) (standard-object-p obj) 2305 2305 (java:java-object-p obj))) … … 2470 2470 (declare-object-as-string form) +lisp-object+)) 2471 2471 ((stringp form) 2472 (if * compile-file-truename*2472 (if *file-compilation* 2473 2473 (emit 'getstatic *this-class* 2474 2474 (declare-string form) +lisp-simple-string+) … … 2476 2476 (declare-object form) +lisp-object+))) 2477 2477 ((vectorp form) 2478 (if * compile-file-truename*2478 (if *file-compilation* 2479 2479 (emit 'getstatic *this-class* 2480 2480 (declare-object-as-string form) +lisp-object+) … … 2488 2488 (declare-object form) +lisp-object+)) 2489 2489 ((pathnamep form) 2490 (let ((g (if * compile-file-truename*2490 (let ((g (if *file-compilation* 2491 2491 (declare-object-as-string form) 2492 2492 (declare-object form)))) 2493 2493 (emit 'getstatic *this-class* g +lisp-object+))) 2494 2494 ((packagep form) 2495 (let ((g (if * compile-file-truename*2495 (let ((g (if *file-compilation* 2496 2496 (declare-package form) 2497 2497 (declare-object form)))) … … 2500 2500 (standard-object-p form) 2501 2501 (java:java-object-p form)) 2502 (let ((g (if * compile-file-truename*2502 (let ((g (if *file-compilation* 2503 2503 (declare-instance form) 2504 2504 (declare-object form)))) 2505 2505 (emit 'getstatic *this-class* g +lisp-object+))) 2506 2506 (t 2507 (if * compile-file-truename*2507 (if *file-compilation* 2508 2508 (error "COMPILE-CONSTANT unhandled case ~S" form) 2509 2509 (emit 'getstatic *this-class* … … 3004 3004 (aload 0))) 3005 3005 ((null (symbol-package op)) 3006 (let ((g (if * compile-file-truename*3006 (let ((g (if *file-compilation* 3007 3007 (declare-object-as-string op) 3008 3008 (declare-object op)))) … … 3176 3176 (t 3177 3177 (dformat t "compile-local-function-call default case~%") 3178 (let* ((g (if * compile-file-truename*3178 (let* ((g (if *file-compilation* 3179 3179 (declare-local-function local-function) 3180 3180 (declare-object (local-function-function local-function))))) … … 4604 4604 (aload tag-register) 4605 4605 (emit 'getstatic *this-class* 4606 (if * compile-file-truename*4606 (if *file-compilation* 4607 4607 (declare-object-as-string (tag-label tag)) 4608 4608 (declare-object (tag-label tag))) … … 4914 4914 4915 4915 (defun p2-load-time-value (form target representation) 4916 (cond (* compile-file-truename*4916 (cond (*file-compilation* 4917 4917 (emit 'getstatic *this-class* 4918 4918 (declare-load-time-value (second form)) +lisp-object+) … … 4987 4987 (t 4988 4988 ;; An uninterned symbol. 4989 (let ((g (if * compile-file-truename*4989 (let ((g (if *file-compilation* 4990 4990 (declare-object-as-string obj) 4991 4991 (declare-object obj)))) … … 4993 4993 (emit-move-from-stack target representation))) 4994 4994 ((listp obj) 4995 (let ((g (if * compile-file-truename*4995 (let ((g (if *file-compilation* 4996 4996 (declare-object-as-string obj) 4997 4997 (declare-object obj)))) … … 5083 5083 (let* ((compiland (local-function-compiland local-function)) 5084 5084 (lambda-list (cadr (compiland-lambda-expression compiland)))) 5085 (cond (* compile-file-truename*5086 (let* ((pathname ( sys::next-classfile-name))5085 (cond (*file-compilation* 5086 (let* ((pathname (funcall *pathnames-generator*)) 5087 5087 (class-file (make-class-file :pathname pathname 5088 5088 :lambda-list lambda-list))) … … 5109 5109 (let* ((compiland (local-function-compiland local-function)) 5110 5110 (lambda-list (cadr (compiland-lambda-expression compiland)))) 5111 (cond (* compile-file-truename*5112 (let* ((pathname ( sys::next-classfile-name))5111 (cond (*file-compilation* 5112 (let* ((pathname (funcall *pathnames-generator*)) 5113 5113 (class-file (make-class-file :pathname pathname 5114 5114 :lambda-list lambda-list))) … … 5178 5178 (let* ((lambda-list (cadr (compiland-lambda-expression compiland)))) 5179 5179 (aver (null (compiland-class-file compiland))) 5180 (cond (* compile-file-truename*5180 (cond (*file-compilation* 5181 5181 (setf (compiland-class-file compiland) 5182 (make-class-file :pathname ( sys::next-classfile-name)5182 (make-class-file :pathname (funcall *pathnames-generator*) 5183 5183 :lambda-list lambda-list)) 5184 5184 (let ((class-file (compiland-class-file compiland))) … … 5188 5188 +lisp-object+))) 5189 5189 (t 5190 (let ((pathname ( make-temp-file)))5190 (let ((pathname (funcall *pathnames-generator*))) 5191 5191 (setf (compiland-class-file compiland) 5192 5192 (make-class-file :pathname pathname … … 5226 5226 ) 5227 5227 (t 5228 (let ((g (if * compile-file-truename*5228 (let ((g (if *file-compilation* 5229 5229 (declare-local-function local-function) 5230 5230 (declare-object (local-function-function local-function))))) … … 5263 5263 ) 5264 5264 (t 5265 (let ((g (if * compile-file-truename*5265 (let ((g (if *file-compilation* 5266 5266 (declare-local-function local-function) 5267 5267 (declare-object (local-function-function local-function))))) … … 5272 5272 (declare-setf-function name) +lisp-object+) 5273 5273 (emit-move-from-stack target)) 5274 ((and (null * compile-file-truename*)5274 ((and (null *file-compilation*) 5275 5275 (fboundp name) 5276 5276 (fdefinition name)) … … 7533 7533 (when (constantp name) 7534 7534 (let ((value (symbol-value name))) 7535 (when (or (null * compile-file-truename*)7535 (when (or (null *file-compilation*) 7536 7536 (stringp value) 7537 7537 (numberp value) … … 8167 8167 (pool-name "Code") ; Must be in pool! 8168 8168 8169 (when * compile-file-truename*8169 (when *file-compilation* 8170 8170 (pool-name "SourceFile") ; Must be in pool! 8171 8171 (pool-name (file-namestring *compile-file-truename*))) … … 8201 8201 (write-method constructor stream) 8202 8202 ;; attributes count 8203 (cond (* compile-file-truename*8203 (cond (*file-compilation* 8204 8204 ;; attributes count 8205 8205 (write-u2 1 stream) -
trunk/abcl/src/org/armedbear/lisp/jvm.lisp
r11708 r11719 409 409 (setf (variable-ignorable-p variable) t)))))))) 410 410 411 (defvar *file-compilation* nil) 412 (defvar *pathnames-generator* #'make-temp-file) 413 411 414 (defun compile (name &optional definition) 412 (jvm-compile name definition)) 415 (let ((*file-compilation* nil) 416 (*pathnames-generator* #'make-temp-file)) 417 (jvm-compile name definition))) 418 419 (defmacro with-file-compilation (&body body) 420 `(let ((*file-compilation* t) 421 (*pathnames-generator* #'sys::next-classfile-name)) 422 ,@body)) 413 423 414 424 (defun finalize-generic-functions () -
trunk/abcl/src/org/armedbear/lisp/precompiler.lisp
r11712 r11719 1125 1125 (lambda-expression `(named-lambda ,name ,lambda-list ,@decls ,@(when doc `(,doc)) 1126 1126 (block ,block-name ,@body)))) 1127 (cond (* compile-file-truename*1127 (cond (*file-compilation* 1128 1128 `(fset ',name ,lambda-expression)) 1129 1129 (t
Note: See TracChangeset
for help on using the changeset viewer.