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

Re #116: while working to fix the issue, at least tell the user we're

unable to generate a conforming class file.
parent a3518eed
......@@ -51,6 +51,10 @@
(declaim (special *memory-class-loader*))
(declaim (inline pool-name pool-name-and-type pool-string
pool-field pool-method pool-int pool-float pool-long
pool-double add-exception-handler))
(defun pool-name (name)
(pool-add-utf8 *pool* name))
......@@ -1177,14 +1181,33 @@ extend the class any further."
(emit-invokestatic +lisp+ "readObjectFromString"
(list +java-string+) +lisp-object+))
(defun external-constant-resource-name (class)
(declare (ignore class))
;; dummy implementation to suppress compiler warnings
;; which break abcl compilation
(defun serialize-object (object)
"Generate code to restore a serialized object which is not of any
of the other types."
(let ((s (with-output-to-string (stream)
(dump-form object stream))))
(emit 'ldc (pool-string s))
(emit-invokestatic +lisp+ "readObjectFromString"
(list +java-string+) +lisp-object+)))
((< (length s) #xFFFF) ;; maximum string size in class file
(emit 'ldc (pool-string s))
(emit-invokestatic +lisp+ "readObjectFromString"
(list +java-string+) +lisp-object+))
(assert (not "Serialized representation too long to be stored in a string"))
(aload 0) ;; this
(emit-invokevirtual +java-object+ "getClass" '() +java-class+)
(emit 'ldc (pool-string (external-constant-resource-name *this-class*)))
(emit-invokevirtual +java-class+ "getResourceAsStream"
(list +java-string+)
(emit-invokestatic +lisp+ "readObjectFromStream"
(list +java-io-input-stream+)
(defun serialize-symbol (symbol)
"Generate code to restore a serialized symbol."
......@@ -130,9 +130,11 @@ initialized from the `java-dotted-name'."
`(defconstant ,symbol (make-jvm-class-name ,java-dotted-name)
(define-class-name +java-class+ "java.lang.Class")
(define-class-name +java-object+ "java.lang.Object")
(define-class-name +java-string+ "java.lang.String")
(define-class-name +java-system+ "java.lang.System")
(define-class-name +java-io-input-stream+ "")
(define-class-name +lisp-object+ "org.armedbear.lisp.LispObject")
(defconstant +lisp-object-array+ (class-array +lisp-object+))
(define-class-name +lisp-simple-string+ "org.armedbear.lisp.SimpleString")
Markdown is supported
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