Changeset 12771
- Timestamp:
- 06/27/10 21:38:09 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/Function.java
r12749 r12771 41 41 private int callCount; 42 42 private int hotCount; 43 44 protected Function() {} 43 /** 44 * The value of *load-truename* which was current when this function 45 * was loaded, used for fetching the class bytes in case of disassebly. 46 */ 47 private final LispObject loadedFrom; 48 49 protected Function() { 50 LispObject loadTruename = Symbol.LOAD_TRUENAME.symbolValueNoThrow(); 51 loadedFrom = loadTruename != null ? loadTruename : NIL; 52 } 45 53 46 54 public Function(String name) 47 55 { 56 this(); 48 57 if (name != null) { 49 58 Symbol symbol = Symbol.addFunction(name.toUpperCase(), this); … … 56 65 public Function(Symbol symbol, String arglist) 57 66 { 67 this(); 58 68 symbol.setSymbolFunction(this); 59 69 if (cold) … … 65 75 public Function(Symbol symbol, String arglist, String docstring) 66 76 { 77 this(); 67 78 symbol.setSymbolFunction(this); 68 79 if (cold) … … 101 112 String arglist, String docstring) 102 113 { 114 this(); 103 115 if (arglist instanceof String) 104 116 setLambdaList(new SimpleString(arglist)); … … 121 133 public Function(LispObject name) 122 134 { 135 this(); 123 136 setLambdaName(name); 124 137 } … … 126 139 public Function(LispObject name, LispObject lambdaList) 127 140 { 141 this(); 128 142 setLambdaName(name); 129 143 setLambdaList(lambdaList); … … 183 197 ClassLoader c = getClass().getClassLoader(); 184 198 if(c instanceof FaslClassLoader) { 185 return new JavaObject(((FaslClassLoader) c).getFunctionClassBytes(this)); 199 final LispThread thread = LispThread.currentThread(); 200 SpecialBindingsMark mark = thread.markSpecialBindings(); 201 try { 202 thread.bindSpecial(Symbol.LOAD_TRUENAME, loadedFrom); 203 return new JavaObject(((FaslClassLoader) c).getFunctionClassBytes(this)); 204 } catch(Throwable t) { 205 //This is because unfortunately getFunctionClassBytes uses 206 //Debug.assertTrue(false) to signal errors 207 if(t instanceof ControlTransfer) { 208 throw (ControlTransfer) t; 209 } else { 210 return NIL; 211 } 212 } finally { 213 thread.resetSpecialBindings(mark); 214 } 186 215 } else { 187 216 return NIL;
Note: See TracChangeset
for help on using the changeset viewer.