[armedbear-cvs] r12444 - branches/metaclass/abcl/src/org/armedbear/lisp
Erik Huelsmann
ehuelsmann at common-lisp.net
Wed Feb 10 23:06:47 UTC 2010
Author: ehuelsmann
Date: Wed Feb 10 18:06:45 2010
New Revision: 12444
Log:
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.
Modified:
branches/metaclass/abcl/src/org/armedbear/lisp/Layout.java
branches/metaclass/abcl/src/org/armedbear/lisp/StandardObject.java
Modified: branches/metaclass/abcl/src/org/armedbear/lisp/Layout.java
==============================================================================
--- branches/metaclass/abcl/src/org/armedbear/lisp/Layout.java (original)
+++ branches/metaclass/abcl/src/org/armedbear/lisp/Layout.java Wed Feb 10 18:06:45 2010
@@ -35,9 +35,9 @@
import static org.armedbear.lisp.Lisp.*;
-public final class Layout extends LispObject
+public class Layout extends LispObject
{
- public final LispClass lispClass;
+ private final LispClass lispClass;
public final EqHashTable slotTable;
private final LispObject[] slotNames;
@@ -76,7 +76,7 @@
// Copy constructor.
private Layout(Layout oldLayout)
{
- lispClass = oldLayout.lispClass;
+ lispClass = oldLayout.getLispClass();
slotNames = oldLayout.slotNames;
sharedSlots = oldLayout.sharedSlots;
slotTable = initializeSlotTable(slotNames);
@@ -94,7 +94,7 @@
public LispObject getParts()
{
LispObject result = NIL;
- result = result.push(new Cons("class", lispClass));
+ result = result.push(new Cons("class", getLispClass()));
for (int i = 0; i < slotNames.length; i++)
{
result = result.push(new Cons("slot " + i, slotNames[i]));
@@ -103,6 +103,11 @@
return result.nreverse();
}
+ public LispClass getLispClass()
+ {
+ return lispClass;
+ }
+
public boolean isInvalid()
{
return invalid;
@@ -167,7 +172,7 @@
@Override
public LispObject execute(LispObject arg)
{
- return checkLayout(arg).lispClass;
+ return checkLayout(arg).getLispClass();
}
};
Modified: branches/metaclass/abcl/src/org/armedbear/lisp/StandardObject.java
==============================================================================
--- branches/metaclass/abcl/src/org/armedbear/lisp/StandardObject.java (original)
+++ branches/metaclass/abcl/src/org/armedbear/lisp/StandardObject.java Wed Feb 10 18:06:45 2010
@@ -45,9 +45,19 @@
layout = new Layout(StandardClass.STANDARD_OBJECT, NIL, NIL);
}
+
+ protected StandardObject(Layout layout, int length)
+ {
+ this.layout = layout;
+ slots = new LispObject[length];
+ for (int i = slots.length; i-- > 0;)
+ slots[i] = UNBOUND_VALUE;
+ }
+
+
protected StandardObject(LispClass cls, int length)
{
- layout = cls.getClassLayout();
+ layout = cls == null ? null : cls.getClassLayout();
slots = new LispObject[length];
for (int i = slots.length; i-- > 0;)
slots[i] = UNBOUND_VALUE;
@@ -55,8 +65,8 @@
protected StandardObject(LispClass cls)
{
- layout = cls.getClassLayout();
- slots = new LispObject[layout.getLength()];
+ layout = cls == null ? null : cls.getClassLayout();
+ slots = new LispObject[layout == null ? 0 : layout.getLength()];
for (int i = slots.length; i-- > 0;)
slots[i] = UNBOUND_VALUE;
}
@@ -90,7 +100,7 @@
public final LispClass getLispClass()
{
- return layout.lispClass;
+ return layout.getLispClass();
}
@Override
@@ -100,7 +110,7 @@
// conditions, TYPE-OF returns the proper name of the class returned by
// CLASS-OF if it has a proper name, and otherwise returns the class
// itself."
- final LispClass c1 = layout.lispClass;
+ final LispClass c1 = layout.getLispClass();
// The proper name of a class is "a symbol that names the class whose
// name is that symbol".
final Symbol symbol = c1.getSymbol();
@@ -117,7 +127,7 @@
@Override
public LispObject classOf()
{
- return layout.lispClass;
+ return layout.getLispClass();
}
@Override
@@ -127,7 +137,7 @@
return T;
if (type == StandardClass.STANDARD_OBJECT)
return T;
- LispClass cls = layout != null ? layout.lispClass : null;
+ LispClass cls = layout != null ? layout.getLispClass() : null;
if (cls != null)
{
if (type == cls)
@@ -173,7 +183,7 @@
{
Debug.assertTrue(layout.isInvalid());
Layout oldLayout = layout;
- LispClass cls = oldLayout.lispClass;
+ LispClass cls = oldLayout.getLispClass();
Layout newLayout = cls.getClassLayout();
Debug.assertTrue(!newLayout.isInvalid());
StandardObject newInstance = new StandardObject(cls);
@@ -340,7 +350,7 @@
@Override
public LispObject execute(LispObject arg)
{
- return checkStandardObject(arg).layout.lispClass;
+ return checkStandardObject(arg).layout.getLispClass();
}
};
More information about the armedbear-cvs
mailing list