Changeset 13514


Ignore:
Timestamp:
08/19/11 20:43:00 (10 years ago)
Author:
ehuelsmann
Message:

Fix #116 (fail to load cl-unicode) by saving serialized resources with a
size bigger that 64k in a separate file instead of within-classfile.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/FaslClassLoader.java

    r13259 r13514  
    3434package org.armedbear.lisp;
    3535
     36import java.io.InputStream;
    3637import static org.armedbear.lisp.Lisp.*;
    3738
    38 import java.util.*;
    3939
    4040public class FaslClassLoader extends JavaClassLoader {
     
    8888            throw new ClassNotFoundException("Function class not found: " + name, e);
    8989        }
     90    }
     91
     92    @Override
     93    public InputStream getResourceAsStream(String resourceName) {
     94      final LispThread thread = LispThread.currentThread();
     95
     96      Pathname name = new Pathname(resourceName.substring("org/armedbear/lisp/".length()));
     97      LispObject truenameFasl = Symbol.LOAD_TRUENAME_FASL.symbolValue(thread);
     98      LispObject truename = Symbol.LOAD_TRUENAME.symbolValue(thread);
     99     
     100      if (truenameFasl instanceof Pathname) {
     101          return Pathname.mergePathnames(name, (Pathname)truenameFasl, Keyword.NEWEST)
     102                    .getInputStream();
     103      } else if (truename instanceof Pathname) {
     104          return Pathname.mergePathnames(name, (Pathname) truename, Keyword.NEWEST)
     105                  .getInputStream();
     106      } else if (!Pathname.truename(name).equals(NIL)) {
     107              return name.getInputStream();
     108      }
     109
     110      return null;
    90111    }
    91112
  • trunk/abcl/src/org/armedbear/lisp/compile-file.lisp

    r13498 r13514  
    586586      (push fasl-loader pathnames))
    587587    (dotimes (i *class-number*)
    588       (push (probe-file (compute-classfile-name (1+ i))) pathnames))
     588      (let ((truename (probe-file (compute-classfile-name (1+ i)))))
     589        (when truename
     590          (push truename pathnames)
     591          (dolist (resource (directory
     592                             (make-pathname :name (format nil "~A_*"
     593                                                           (pathname-name truename))
     594                                            :type "clc"
     595                                            :defaults truename)))
     596            (push resource pathnames)))))
    589597    (setf pathnames (nreverse (remove nil pathnames)))
    590598    (let ((load-file (merge-pathnames (make-pathname :type "_")
  • trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r13511 r13514  
    11821182                     (list +java-string+) +lisp-object+))
    11831183
    1184 (defun external-constant-resource-name (class)
    1185   (declare (ignore class))
    1186   ;; dummy implementation to suppress compiler warnings
    1187   ;; which break abcl compilation
    1188   )
     1184(defun compiland-external-constant-resource-name (compiland)
     1185  (let ((resource-number (compiland-next-resource compiland))
     1186        (pathname (abcl-class-file-pathname (compiland-class-file compiland))))
     1187    (incf (compiland-next-resource compiland))
     1188    (make-pathname :name (format nil "~A_~D"
     1189                                 (pathname-name pathname) resource-number)
     1190                   :type "clc"
     1191                   :defaults pathname)))
    11891192
    11901193(defun serialize-object (object)
     
    11991202                          (list +java-string+) +lisp-object+))
    12001203      (t
    1201        (assert (not "Serialized representation too long to be stored in a string"))
    12021204       (aload 0) ;; this
    12031205       (emit-invokevirtual +java-object+ "getClass" '() +java-class+)
    1204        (emit 'ldc (pool-string (external-constant-resource-name *this-class*)))
     1206       (let ((pathname
     1207              (compiland-external-constant-resource-name *current-compiland*)))
     1208         (with-open-file (f pathname
     1209                            :direction :output
     1210                            :if-exists :supersede
     1211                            :if-does-not-exist :create)
     1212           (write-string s f))
     1213         (emit 'ldc (pool-string
     1214                     (namestring (make-pathname :name (pathname-name pathname)
     1215                                                :type (pathname-type pathname)
     1216                                                :version nil)))))
    12051217       (emit-invokevirtual +java-class+ "getResourceAsStream"
    12061218                           (list +java-string+)
  • trunk/abcl/src/org/armedbear/lisp/jvm.lisp

    r13488 r13514  
    199199                    ; defined with FLET, LABELS or LAMBDA
    200200  blocks            ; TAGBODY, PROGV, BLOCK, etc. blocks
     201  (next-resource 0)
    201202  argument-register
    202203  closure-register
Note: See TracChangeset for help on using the changeset viewer.