Changeset 11715


Ignore:
Timestamp:
03/25/09 20:29:48 (12 years ago)
Author:
astalla
Message:

Factored out an overload of loadCompiledFunction that can load a
function from a byte array.

File:
1 edited

Legend:

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

    r11714 r11715  
    11341134          Debug.trace("bytesRemaining = " + bytesRemaining);
    11351135
    1136         //JavaClassLoader loader = new JavaClassLoader();
    1137         Class c =
    1138           (new JavaClassLoader()).loadClassFromByteArray(null, bytes, 0, bytes.length);
    1139         if (c != null)
    1140           {
     1136  return loadCompiledFunction(bytes);
     1137      }
     1138    catch (Throwable t)
     1139      {
     1140        Debug.trace(t);
     1141      }
     1142    return null;
     1143  }
     1144
     1145    public static final LispObject loadCompiledFunction(byte[] bytes) throws Throwable {
     1146  Class c = (new JavaClassLoader()).loadClassFromByteArray(null, bytes, 0, bytes.length);
     1147        if (c != null) {
     1148      Class sc = c.getSuperclass();
    11411149            Constructor constructor = c.getConstructor((Class[])null);
    1142             LispObject obj =
    1143                   (LispObject) constructor.newInstance((Object[])null);
    1144             if (obj instanceof Function)
     1150            LispObject obj = (LispObject) constructor.newInstance((Object[])null);
     1151            if (obj instanceof Function) {
    11451152              ((Function)obj).setClassBytes(bytes);
     1153      }
    11461154            return obj;
    1147           }
    1148       }
    1149     catch (Throwable t)
    1150       {
    1151         Debug.trace(t);
    1152       }
    1153     return null;
    1154   }
     1155  } else {
     1156      return null;
     1157  }
     1158    }
    11551159
    11561160  public static final LispObject makeCompiledClosure(LispObject template,
Note: See TracChangeset for help on using the changeset viewer.