[armedbear-cvs] r12124 - trunk/abcl/src/org/armedbear/lisp
Erik Huelsmann
ehuelsmann at common-lisp.net
Fri Aug 28 10:55:05 UTC 2009
Author: ehuelsmann
Date: Fri Aug 28 06:55:00 2009
New Revision: 12124
Log:
Proposed solution to ticket #61: skip type checking
on DEFTYPE-d types (usually complex types).
Note: with this change structure slot accessors
still verify their argument types.
Modified:
trunk/abcl/src/org/armedbear/lisp/SpecialOperators.java
trunk/abcl/src/org/armedbear/lisp/Symbol.java
Modified: trunk/abcl/src/org/armedbear/lisp/SpecialOperators.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/SpecialOperators.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/SpecialOperators.java Fri Aug 28 06:55:00 2009
@@ -373,20 +373,25 @@
return error(new WrongNumberOfArgumentsException(this));
LispObject rv = eval(args.cadr(), env, LispThread.currentThread());
+ // check only the most simple types: single symbols
+ // (class type specifiers/primitive types)
+ // DEFTYPE-d types need expansion;
+ // doing so would slow down our execution too much
+
+ // An implementation is allowed not to check the type,
+ // the fact that we do so here is mainly driven by the
+ // requirement to verify argument types in structure-slot
+ // accessors (defstruct.lisp)
+
+ // The policy below is in line with the level of verification
+ // in the compiler at *safety* levels below 3
LispObject type = args.car();
- if (type instanceof Symbol
+ if ((type instanceof Symbol
+ && get(type, Symbol.DEFTYPE_DEFINITION) == NIL)
|| type instanceof BuiltInClass)
- if (rv.typep(type) == NIL) {
- // Try to call the Lisp-side TYPEP, as we will miss
- // DEFTYPEd types.
- Symbol typep
- = PACKAGE_SYS.findAccessibleSymbol("TYPEP");
- LispObject result
- = typep.getSymbolFunction().execute(rv, type);
- if (result == NIL) {
+ if (rv.typep(type) == NIL)
type_error(rv, type);
- }
- }
+
return rv;
}
};
Modified: trunk/abcl/src/org/armedbear/lisp/Symbol.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Symbol.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/Symbol.java Fri Aug 28 06:55:00 2009
@@ -3011,6 +3011,8 @@
PACKAGE_SYS.addInternalSymbol("COMMA-MACRO");
public static final Symbol DATUM =
PACKAGE_SYS.addInternalSymbol("DATUM");
+ public static final Symbol DEFTYPE_DEFINITION =
+ PACKAGE_SYS.addInternalSymbol("DEFTYPE-DEFINITION");
public static final Symbol EXPECTED_TYPE =
PACKAGE_SYS.addInternalSymbol("EXPECTED-TYPE");
public static final Symbol FORMAT_ARGUMENTS =
More information about the armedbear-cvs
mailing list