Commit bee2fe33 authored by ehuelsmann@1c010e3e-69d0-11dd-93a8-456734b0d56f's avatar ehuelsmann@1c010e3e-69d0-11dd-93a8-456734b0d56f
Browse files

Moving huge object serialization from <init>() to <clinit>()

broke the code generation for that special case -- there's no longer
a 'this' variable to be loaded. Replace with <this class>.class.
parent 9421a46a
......@@ -1057,7 +1057,7 @@ representation, based on the derived type of the LispObject."
(defun make-static-initializer (class)
(let ((*compiler-debug* nil)
(method (make-jvm-method :static-initializer
:void nil :flags '(:public :static))))
:void nil :flags '(:public :static))))
;; We don't normally need to see debugging output for <clinit>.
(with-code-to-method (class method)
method)))
......@@ -1205,8 +1205,8 @@ of the other types."
(emit-invokestatic +lisp+ "readObjectFromString"
(list +java-string+) +lisp-object+))
(t
(aload 0) ;; this
(emit-invokevirtual +java-object+ "getClass" '() +java-class+)
;; get a 'class literal' for this class
(emit 'ldc_w (pool-class *this-class*))
(let ((pathname
(compiland-external-constant-resource-name *current-compiland*)))
(with-open-file (f pathname
......
......@@ -226,7 +226,7 @@
(values (subtypep compiler-type typespec)))))
(declaim (type hash-table *function-result-types*))
(defconst *function-result-types* (make-hash-table :test 'equal))
(defvar *function-result-types* (make-hash-table :test 'equal))
(declaim (ftype (function (t) t) function-result-type))
(defun function-result-type (name)
......
......@@ -698,8 +698,11 @@ The class can't be modified after finalization."
;; header
(write-u4 #xCAFEBABE stream)
(write-u2 3 stream)
(write-u2 45 stream)
(write-u2 0 stream)
(write-u2 49 stream) ;; our <clinit> methods use class literals
;; which require a high enough class file format
;; we used to have 45, but the LDC instruction doesn't support
;; class literals in that version... (49 == Java 1.5)
;; constants pool
(write-constants (class-file-constants class) stream)
......@@ -714,7 +717,7 @@ The class can't be modified after finalization."
;; interfaces
(if (class-file-interfaces class)
(progn
(progn
(write-u2 (length (class-file-interfaces class)) stream)
(dolist (interface-ref (class-file-interfaces class))
(write-u2 interface-ref stream)))
......
......@@ -660,6 +660,13 @@
(inst 19 (u2 (car args))) ; LDC_W
(inst 18 args))))
;; ldc_w
(define-resolver 19 (instruction)
(let* ((args (instruction-args instruction)))
(unless (= (length args) 1)
(error "Wrong number of args for LDC_W."))
(inst 19 (u2 (car args)))))
;; ldc2_w
(define-resolver 20 (instruction)
(let* ((args (instruction-args instruction)))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment