Changeset 12124


Ignore:
Timestamp:
08/28/09 10:55:00 (12 years ago)
Author:
ehuelsmann
Message:

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.

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

Legend:

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

    r12119 r12124  
    374374        LispObject rv = eval(args.cadr(), env, LispThread.currentThread());
    375375
     376        // check only the most simple types: single symbols
     377        // (class type specifiers/primitive types)
     378        // DEFTYPE-d types need expansion;
     379        // doing so would slow down our execution too much
     380
     381        // An implementation is allowed not to check the type,
     382        // the fact that we do so here is mainly driven by the
     383        // requirement to verify argument types in structure-slot
     384        // accessors (defstruct.lisp)
     385
     386        // The policy below is in line with the level of verification
     387        // in the compiler at *safety* levels below 3
    376388        LispObject type = args.car();
    377         if (type instanceof Symbol
     389        if ((type instanceof Symbol
     390             && get(type, Symbol.DEFTYPE_DEFINITION) == NIL)
    378391            || type instanceof BuiltInClass)
    379     if (rv.typep(type) == NIL) {
    380       // Try to call the Lisp-side TYPEP, as we will miss
    381       // DEFTYPEd types.
    382       Symbol typep
    383         = PACKAGE_SYS.findAccessibleSymbol("TYPEP");
    384       LispObject result
    385         = typep.getSymbolFunction().execute(rv, type);
    386       if (result == NIL) {
     392    if (rv.typep(type) == NIL)
    387393        type_error(rv, type);
    388       }
    389     }
     394
    390395        return rv;
    391396      }
  • trunk/abcl/src/org/armedbear/lisp/Symbol.java

    r12105 r12124  
    30123012  public static final Symbol DATUM =
    30133013    PACKAGE_SYS.addInternalSymbol("DATUM");
     3014  public static final Symbol DEFTYPE_DEFINITION =
     3015    PACKAGE_SYS.addInternalSymbol("DEFTYPE-DEFINITION");
    30143016  public static final Symbol EXPECTED_TYPE =
    30153017    PACKAGE_SYS.addInternalSymbol("EXPECTED-TYPE");
Note: See TracChangeset for help on using the changeset viewer.