Changeset 11998


Ignore:
Timestamp:
06/06/09 17:46:59 (14 years ago)
Author:
ehuelsmann
Message:

Add a cache for opened '.zip' files.

Before this change, consecutive calls to
loadCompiledFunction() would open the same
zip file over and over.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
1 added
2 edited

Legend:

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

    r11994 r11998  
    10761076                          }
    10771077                        zipFileName = URLDecoder.decode(zipFileName, "UTF-8");
    1078                         ZipFile zipFile = new ZipFile(zipFileName);
     1078                        ZipFile zipFile = ZipCache.getZip(zipFileName);
    10791079                        try
    10801080                          {
     
    10901090                        finally
    10911091                          {
    1092                             zipFile.close();
     1092                            ZipCache.removeZip(zipFile.getName());
    10931093                          }
    10941094                      }
     
    11401140        LispObject loadTruename = Symbol.LOAD_TRUENAME.symbolValue(thread);
    11411141        String zipFileName = ((Pathname)loadTruename).getNamestring();
    1142         ZipFile zipFile = new ZipFile(zipFileName);
     1142        ZipFile zipFile = ZipCache.getZip(zipFileName);
    11431143        try
    11441144          {
     
    11561156        finally
    11571157          {
    1158             zipFile.close();
     1158            ZipCache.removeZip(zipFile.getName());
    11591159          }
    11601160      }
     
    11981198        Class c = (new JavaClassLoader()).loadClassFromByteArray(null, bytes, 0, bytes.length);
    11991199        if (c != null) {
    1200             Class sc = c.getSuperclass();
    12011200            Constructor constructor = c.getConstructor((Class[])null);
    12021201            LispObject obj = (LispObject) constructor.newInstance((Object[])null);
  • trunk/abcl/src/org/armedbear/lisp/Load.java

    r11889 r11998  
    124124        {
    125125            try {
    126                 zipfile = new ZipFile(file);
     126                zipfile = ZipCache.getZip(file.getPath());
    127127            }
    128128            catch (Throwable t) {
     
    176176            if (in != null) {
    177177                try {
    178                     in.close();
     178                   in.close();
    179179                }
    180180                catch (IOException e) {
     
    184184            if (zipfile != null) {
    185185                try {
    186                     zipfile.close();
     186                    ZipCache.removeZip(zipfile.getName());
    187187                }
    188188                catch (IOException e) {
     
    266266                        if (ext.equalsIgnoreCase(".abcl")) {
    267267                            try {
    268                                 zipfile = new ZipFile(file);
     268                                zipfile = ZipCache.getZip(file.getPath());
    269269                                String name = file.getName();
    270270                                int index = name.lastIndexOf('.');
     
    339339                if (zipfile != null) {
    340340                    try {
    341                         zipfile.close();
     341                        ZipCache.removeZip(zipfile.getName());
    342342                    }
    343343                    catch (IOException e) {
Note: See TracChangeset for help on using the changeset viewer.