Changeset 10376


Ignore:
Timestamp:
11/05/05 20:15:09 (16 years ago)
Author:
piso
Message:

STD-SLOT-BOUNDP: access slotTable directly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/StandardObject.java

    r10375 r10376  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: StandardObject.java,v 1.53 2005-11-05 20:02:01 piso Exp $
     5 * $Id: StandardObject.java,v 1.54 2005-11-05 20:15:09 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    361361            throws ConditionThrowable
    362362        {
    363             StandardObject instance;
     363            final StandardObject instance;
    364364            try {
    365365                instance = (StandardObject) first;
     
    373373                layout = instance.updateLayout();
    374374            }
    375             int index = layout.getSlotIndex(second);
    376             if (index >= 0) {
     375            final LispObject index = layout.slotTable.get(second);
     376            if (index != null) {
    377377                // Found instance slot.
    378                 LispObject value = instance.slots[index];
    379                 return value != UNBOUND_VALUE ? T : NIL;
     378                return instance.slots[((Fixnum)index).value] != UNBOUND_VALUE ? T : NIL;
    380379            }
    381380            // Check for shared slot.
    382             LispObject location = layout.getSharedSlotLocation(second);
    383             if (location != null) {
    384                 LispObject value = location.cdr();
    385                 return value != UNBOUND_VALUE ? T : NIL;
    386             }
     381            final LispObject location = layout.getSharedSlotLocation(second);
     382            if (location != null)
     383                return location.cdr() != UNBOUND_VALUE ? T : NIL;
     384            // Not found.
    387385            final LispThread thread = LispThread.currentThread();
    388386            LispObject value =
    389387                thread.execute(Symbol.SLOT_MISSING, instance.getLispClass(),
    390388                               instance, second, Symbol.SLOT_BOUNDP);
    391             // "If slot-missing is invoked and returns a value, a boolean
    392             // equivalent to its primary value is returned by slot-boundp."
     389            // "If SLOT-MISSING is invoked and returns a value, a boolean
     390            // equivalent to its primary value is returned by SLOT-BOUNDP."
    393391            thread._values = null;
    394392            return value != NIL ? T : NIL;
     
    417415            }
    418416            LispObject value;
    419             LispObject index = layout.slotTable.get(second);
     417            final LispObject index = layout.slotTable.get(second);
    420418            if (index != null) {
    421419                // Found instance slot.
     
    460458                layout = instance.updateLayout();
    461459            }
    462             LispObject index = layout.slotTable.get(second);
     460            final LispObject index = layout.slotTable.get(second);
    463461            if (index != null) {
    464462                // Found instance slot.
Note: See TracChangeset for help on using the changeset viewer.