Changeset 12444


Ignore:
Timestamp:
02/10/10 23:06:45 (11 years ago)
Author:
ehuelsmann
Message:

Make the lispClass slot in Layout private and add

an additional constructor to StandardObject? which takes a layout
instead of a class. This change is required to be able to bootstrap
StandardClass?.

Location:
branches/metaclass/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/metaclass/abcl/src/org/armedbear/lisp/Layout.java

    r12298 r12444  
    3636import static org.armedbear.lisp.Lisp.*;
    3737
    38 public final class Layout extends LispObject
     38public class Layout extends LispObject
    3939{
    40   public final LispClass lispClass;
     40  private final LispClass lispClass;
    4141  public final EqHashTable slotTable;
    4242
     
    7777  private Layout(Layout oldLayout)
    7878  {
    79     lispClass = oldLayout.lispClass;
     79    lispClass = oldLayout.getLispClass();
    8080    slotNames = oldLayout.slotNames;
    8181    sharedSlots = oldLayout.sharedSlots;
     
    9595  {
    9696    LispObject result = NIL;
    97     result = result.push(new Cons("class", lispClass));
     97    result = result.push(new Cons("class", getLispClass()));
    9898    for (int i = 0; i < slotNames.length; i++)
    9999      {
     
    102102    result = result.push(new Cons("shared slots", sharedSlots));
    103103    return result.nreverse();
     104  }
     105
     106  public LispClass getLispClass()
     107  {
     108    return lispClass;
    104109  }
    105110
     
    168173      public LispObject execute(LispObject arg)
    169174      {
    170           return checkLayout(arg).lispClass;
     175          return checkLayout(arg).getLispClass();
    171176      }
    172177    };
  • branches/metaclass/abcl/src/org/armedbear/lisp/StandardObject.java

    r12288 r12444  
    4646  }
    4747
    48   protected StandardObject(LispClass cls, int length)
    49   {
    50     layout = cls.getClassLayout();
     48
     49  protected StandardObject(Layout layout, int length)
     50  {
     51    this.layout = layout;
    5152    slots = new LispObject[length];
    5253    for (int i = slots.length; i-- > 0;)
     
    5455  }
    5556
     57
     58  protected StandardObject(LispClass cls, int length)
     59  {
     60    layout = cls == null ? null : cls.getClassLayout();
     61    slots = new LispObject[length];
     62    for (int i = slots.length; i-- > 0;)
     63      slots[i] = UNBOUND_VALUE;
     64  }
     65
    5666  protected StandardObject(LispClass cls)
    5767  {
    58     layout = cls.getClassLayout();
    59     slots = new LispObject[layout.getLength()];
     68    layout = cls == null ? null : cls.getClassLayout();
     69    slots = new LispObject[layout == null ? 0 : layout.getLength()];
    6070    for (int i = slots.length; i-- > 0;)
    6171      slots[i] = UNBOUND_VALUE;
     
    91101  public final LispClass getLispClass()
    92102  {
    93     return layout.lispClass;
     103    return layout.getLispClass();
    94104  }
    95105
     
    101111    // CLASS-OF if it has a proper name, and otherwise returns the class
    102112    // itself."
    103     final LispClass c1 = layout.lispClass;
     113    final LispClass c1 = layout.getLispClass();
    104114    // The proper name of a class is "a symbol that names the class whose
    105115    // name is that symbol".
     
    118128  public LispObject classOf()
    119129  {
    120     return layout.lispClass;
     130    return layout.getLispClass();
    121131  }
    122132
     
    128138    if (type == StandardClass.STANDARD_OBJECT)
    129139      return T;
    130     LispClass cls = layout != null ? layout.lispClass : null;
     140    LispClass cls = layout != null ? layout.getLispClass() : null;
    131141    if (cls != null)
    132142      {
     
    174184    Debug.assertTrue(layout.isInvalid());
    175185    Layout oldLayout = layout;
    176     LispClass cls = oldLayout.lispClass;
     186    LispClass cls = oldLayout.getLispClass();
    177187    Layout newLayout = cls.getClassLayout();
    178188    Debug.assertTrue(!newLayout.isInvalid());
     
    341351      public LispObject execute(LispObject arg)
    342352      {
    343           return checkStandardObject(arg).layout.lispClass;
     353          return checkStandardObject(arg).layout.getLispClass();
    344354      }
    345355    };
Note: See TracChangeset for help on using the changeset viewer.