[armedbear-cvs] r12079 - trunk/abcl/src/org/armedbear/lisp
Erik Huelsmann
ehuelsmann at common-lisp.net
Fri Jul 31 19:46:01 UTC 2009
Author: ehuelsmann
Date: Fri Jul 31 15:45:54 2009
New Revision: 12079
Log:
Add API to execute()-able classes for hot spot profiling
next to normal stack profiling.
Modified:
trunk/abcl/src/org/armedbear/lisp/Function.java
trunk/abcl/src/org/armedbear/lisp/LispObject.java
trunk/abcl/src/org/armedbear/lisp/Primitives.java
trunk/abcl/src/org/armedbear/lisp/SpecialOperator.java
trunk/abcl/src/org/armedbear/lisp/StandardGenericFunction.java
trunk/abcl/src/org/armedbear/lisp/Symbol.java
Modified: trunk/abcl/src/org/armedbear/lisp/Function.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Function.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/Function.java Fri Jul 31 15:45:54 2009
@@ -37,6 +37,7 @@
{
private LispObject propertyList = NIL;
private int callCount;
+ private int hotCount;
protected Function() {}
@@ -306,8 +307,8 @@
error(new WrongNumberOfArgumentsException(this));
}
- @Override
// Profiling.
+ @Override
public final int getCallCount()
{
return callCount;
@@ -324,4 +325,22 @@
{
++callCount;
}
+
+ @Override
+ public final int getHotCount()
+ {
+ return hotCount;
+ }
+
+ @Override
+ public void setHotCount(int n)
+ {
+ hotCount = n;
+ }
+
+ @Override
+ public final void incrementHotCount()
+ {
+ ++hotCount;
+ }
}
Modified: trunk/abcl/src/org/armedbear/lisp/LispObject.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/LispObject.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/LispObject.java Fri Jul 31 15:45:54 2009
@@ -1156,4 +1156,17 @@
public void incrementCallCount()
{
}
+
+ public int getHotCount()
+ {
+ return 0;
+ }
+
+ public void setHotCount(int n)
+ {
+ }
+
+ public void incrementHotCount()
+ {
+ }
}
Modified: trunk/abcl/src/org/armedbear/lisp/Primitives.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Primitives.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/Primitives.java Fri Jul 31 15:45:54 2009
@@ -4044,7 +4044,31 @@
}
};
- // ### lambda-name
+ // ### call-count
+ private static final Primitive HOT_COUNT =
+ new Primitive("hot-count", PACKAGE_SYS, true)
+ {
+ @Override
+ public LispObject execute(LispObject arg) throws ConditionThrowable
+ {
+ return Fixnum.getInstance(arg.getHotCount());
+ }
+ };
+
+ // ### set-call-count
+ private static final Primitive SET_HOT_COUNT =
+ new Primitive("set-hot-count", PACKAGE_SYS, true)
+ {
+ @Override
+ public LispObject execute(LispObject first, LispObject second)
+ throws ConditionThrowable
+ {
+ first.setHotCount(Fixnum.getValue(second));
+ return second;
+ }
+ };
+
+ // ### lambda-name
private static final Primitive LAMBDA_NAME =
new Primitive("lambda-name", PACKAGE_SYS, true)
{
Modified: trunk/abcl/src/org/armedbear/lisp/SpecialOperator.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/SpecialOperator.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/SpecialOperator.java Fri Jul 31 15:45:54 2009
@@ -36,6 +36,7 @@
public class SpecialOperator extends Operator
{
private int callCount;
+ private int hotCount;
public SpecialOperator(Symbol symbol)
{
@@ -174,4 +175,22 @@
{
++callCount;
}
+
+ @Override
+ public final int getHotCount()
+ {
+ return hotCount;
+ }
+
+ @Override
+ public final void setHotCount(int n)
+ {
+ callCount = n;
+ }
+
+ @Override
+ public final void incrementHotCount()
+ {
+ ++hotCount;
+ }
}
Modified: trunk/abcl/src/org/armedbear/lisp/StandardGenericFunction.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/StandardGenericFunction.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/StandardGenericFunction.java Fri Jul 31 15:45:54 2009
@@ -224,6 +224,7 @@
// Profiling.
private int callCount;
+ private int hotCount;
@Override
public final int getCallCount()
@@ -243,7 +244,25 @@
++callCount;
}
- // AMOP (p. 216) specifies the following readers as generic functions:
+ @Override
+ public final int getHotCount()
+ {
+ return hotCount;
+ }
+
+ @Override
+ public void setHotCount(int n)
+ {
+ hotCount = n;
+ }
+
+ @Override
+ public final void incrementHotCount()
+ {
+ ++hotCount;
+ }
+
+ // AMOP (p. 216) specifies the following readers as generic functions:
// generic-function-argument-precedence-order
// generic-function-declarations
// generic-function-lambda-list
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 Jul 31 15:45:54 2009
@@ -906,6 +906,14 @@
function.incrementCallCount();
}
+ @Override
+ public void incrementHotCount()
+ {
+ if (function != null)
+ function.incrementHotCount();
+ }
+
+
// External symbols in CL package.
public static final Symbol AND_ALLOW_OTHER_KEYS =
PACKAGE_CL.addExternalSymbol("&ALLOW-OTHER-KEYS");
More information about the armedbear-cvs
mailing list