[kaffe] CVS kaffe (stack): Improve the allocation behavior of the jitter and small fixes for
Kaffe CVS
cvs-commits at kaffe.org
Sun Sep 21 11:24:02 PDT 2003
PatchSet 4051
Date: 2003/09/21 18:18:12
Author: stack
Branch: HEAD
Tag: (none)
Log:
Improve the allocation behavior of the jitter and small fixes for
linking in the tritonus native libs.
Members:
ChangeLog:1.1647->1.1648
configure:1.256->1.257
configure.in:1.223->1.224
kaffe/kaffevm/gc.h:1.18->1.19
kaffe/kaffevm/gcFuncs.c:1.47->1.48
kaffe/kaffevm/jit3/constpool.c:1.6->1.7
kaffe/kaffevm/jit3/icode.c:1.32->1.33
kaffe/kaffevm/jit3/labels.c:1.11->1.12
kaffe/kaffevm/jit3/machine.c:1.41->1.42
kaffe/kaffevm/jit3/seq.c:1.6->1.7
kaffe/kaffevm/jit3/seq.h:1.7->1.8
kaffe/kaffevm/jit3/slots.c:1.9->1.10
kaffe/xprof/callGraph.c:1.3->1.4
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1647 kaffe/ChangeLog:1.1648
--- kaffe/ChangeLog:1.1647 Sun Sep 21 17:26:32 2003
+++ kaffe/ChangeLog Sun Sep 21 18:18:12 2003
@@ -1,3 +1,29 @@
+2003-09-19 Timothy S. Stack <stack at cs.utah.edu>
+
+ * configure.in:
+ Add the tritonus alsa and esd libraries to the list that will be
+ linked into the executable.
+
+ * kaffe/kaffevm/gc.h,
+ kaffe/kaffevm/gcFuncs.c:
+ Add separate allocation types for temporary jitter data.
+
+ * kaffe/kaffevm/jit3/constpool.c,
+ kaffe/kaffevm/jit3/icode.c,
+ kaffe/kaffevm/jit3/labels.c,
+ kaffe/kaffevm/jit3/machine.c,
+ kaffe/kaffevm/jit3/slots.c:
+ Use separate allocation types for temporary jitter data.
+
+ * kaffe/kaffevm/jit3/seq.h,
+ kaffe/kaffevm/jit3/seq.c:
+ Change allocation behavior to free large pools of memory after
+ jitting is done.
+
+ * kaffe/xprof/callGraph.c:
+ Always write out a callgraph record, even if its out of bounds,
+ otherwise, a record might not make it into gmon file.
+
2003-09-19 Dalibor Topic <robilad at kaffe.org>
* libraries/javalib/javax/sound/midi/MetaMessage.java,
Index: kaffe/configure
diff -u kaffe/configure:1.256 kaffe/configure:1.257
--- kaffe/configure:1.256 Mon Sep 1 17:16:16 2003
+++ kaffe/configure Sun Sep 21 18:18:13 2003
@@ -41562,6 +41562,7 @@
*)
if test x"$have_alsa" = x"yes"; then
ALSA_DIR=alsa
+ ALSA_LIB="\$(top_builddir)/libraries/extensions/sound/alsa/libtritonusalsa.la"
fi
;;
esac
@@ -41580,6 +41581,7 @@
*)
if test x"$have_esd" = x"yes" && test x"$have_esd_h" = x"yes"; then
ESD_DIR=esd
+ ESD_LIB="\$(top_builddir)/libraries/extensions/sound/esd/libtritonusesd.la"
fi
;;
esac
@@ -41594,7 +41596,9 @@
case "$enable_sound" in
no)
ALSA_DIR=""
+ ALSA_LIB=""
ESD_DIR=""
+ ESD_LIB=""
;;
*)
;;
@@ -41959,6 +41963,8 @@
\$(top_builddir)/libraries/clib/io/libio.la \
\$(top_builddir)/libraries/clib/zip/libzip.la \
$MATH_LIB \
+$ALSA_LIB \
+$ESD_LIB \
\$(top_builddir)/libraries/clib/management/libmanagement.la \
\$(top_builddir)/libraries/clib/security/libsecurity.la \
$AWT_LIB \
Index: kaffe/configure.in
diff -u kaffe/configure.in:1.223 kaffe/configure.in:1.224
--- kaffe/configure.in:1.223 Mon Sep 1 17:16:20 2003
+++ kaffe/configure.in Sun Sep 21 18:18:15 2003
@@ -1238,6 +1238,7 @@
*)
if test x"$have_alsa" = x"yes"; then
ALSA_DIR=alsa
+ ALSA_LIB="\$(top_builddir)/libraries/extensions/sound/alsa/libtritonusalsa.la"
fi
;;
esac
@@ -1253,6 +1254,7 @@
*)
if test x"$have_esd" = x"yes" && test x"$have_esd_h" = x"yes"; then
ESD_DIR=esd
+ ESD_LIB="\$(top_builddir)/libraries/extensions/sound/esd/libtritonusesd.la"
fi
;;
esac
@@ -1265,7 +1267,9 @@
case "$enable_sound" in
no)
ALSA_DIR=""
+ ALSA_LIB=""
ESD_DIR=""
+ ESD_LIB=""
;;
*)
;;
@@ -1424,6 +1428,8 @@
\$(top_builddir)/libraries/clib/io/libio.la \
\$(top_builddir)/libraries/clib/zip/libzip.la \
$MATH_LIB \
+$ALSA_LIB \
+$ESD_LIB \
\$(top_builddir)/libraries/clib/management/libmanagement.la \
\$(top_builddir)/libraries/clib/security/libsecurity.la \
$AWT_LIB \
Index: kaffe/kaffe/kaffevm/gc.h
diff -u kaffe/kaffe/kaffevm/gc.h:1.18 kaffe/kaffe/kaffevm/gc.h:1.19
--- kaffe/kaffe/kaffevm/gc.h:1.18 Sat Jul 26 16:50:49 2003
+++ kaffe/kaffe/kaffevm/gc.h Sun Sep 21 18:18:18 2003
@@ -57,7 +57,14 @@
#define GC_ALLOC_JITTEMP 21
#define GC_ALLOC_JAVALOADER 22
#define GC_ALLOC_JAR 23
-#define GC_ALLOC_MAX_INDEX 24
+#define GC_ALLOC_JIT_SEQ 24
+#define GC_ALLOC_JIT_CONST 25
+#define GC_ALLOC_JIT_ARGS 26
+#define GC_ALLOC_JIT_FAKE_CALL 27
+#define GC_ALLOC_JIT_SLOTS 28
+#define GC_ALLOC_JIT_CODEBLOCK 29
+#define GC_ALLOC_JIT_LABELS 30
+#define GC_ALLOC_MAX_INDEX 31
/*
* Define a COM-like GC interface.
Index: kaffe/kaffe/kaffevm/gcFuncs.c
diff -u kaffe/kaffe/kaffevm/gcFuncs.c:1.47 kaffe/kaffe/kaffevm/gcFuncs.c:1.48
--- kaffe/kaffe/kaffevm/gcFuncs.c:1.47 Sun Aug 31 22:09:01 2003
+++ kaffe/kaffe/kaffevm/gcFuncs.c Sun Sep 21 18:18:18 2003
@@ -638,6 +638,13 @@
GC_registerFixedTypeByIndex(gc, GC_ALLOC_REF, "gc-refs");
GC_registerFixedTypeByIndex(gc, GC_ALLOC_JITTEMP, "jit-temp-data");
GC_registerFixedTypeByIndex(gc, GC_ALLOC_JAR, "jar");
+ GC_registerFixedTypeByIndex(gc, GC_ALLOC_JIT_SEQ, "jit-seq");
+ GC_registerFixedTypeByIndex(gc, GC_ALLOC_JIT_CONST, "jit-const");
+ GC_registerFixedTypeByIndex(gc, GC_ALLOC_JIT_ARGS, "jit-args");
+ GC_registerFixedTypeByIndex(gc, GC_ALLOC_JIT_FAKE_CALL, "jit-fake-call");
+ GC_registerFixedTypeByIndex(gc, GC_ALLOC_JIT_SLOTS, "jit-slots");
+ GC_registerFixedTypeByIndex(gc, GC_ALLOC_JIT_CODEBLOCK, "jit-codeblock");
+ GC_registerFixedTypeByIndex(gc, GC_ALLOC_JIT_LABELS, "jit-labels");
DBG(INIT, dprintf("initCollector() done\n"); )
return (gc);
Index: kaffe/kaffe/kaffevm/jit3/constpool.c
diff -u kaffe/kaffe/kaffevm/jit3/constpool.c:1.6 kaffe/kaffe/kaffevm/jit3/constpool.c:1.7
--- kaffe/kaffe/kaffevm/jit3/constpool.c:1.6 Wed Sep 17 21:14:08 2003
+++ kaffe/kaffe/kaffevm/jit3/constpool.c Sun Sep 21 18:18:19 2003
@@ -79,7 +79,7 @@
int i;
/* Allocate chunk of constpool elements */
- cpc = gc_malloc(sizeof(constpoolchunk), GC_ALLOC_JITTEMP);
+ cpc = gc_malloc(sizeof(constpoolchunk), GC_ALLOC_JIT_CONST);
/* XXX Ack! */
assert(cpc != 0);
Index: kaffe/kaffe/kaffevm/jit3/icode.c
diff -u kaffe/kaffe/kaffevm/jit3/icode.c:1.32 kaffe/kaffe/kaffevm/jit3/icode.c:1.33
--- kaffe/kaffe/kaffevm/jit3/icode.c:1.32 Sun Aug 31 22:09:04 2003
+++ kaffe/kaffe/kaffevm/jit3/icode.c Sun Sep 21 18:18:19 2003
@@ -4413,7 +4413,7 @@
args = gc_realloc(args,
sizeof(struct pusharg_info) * sz_args,
- GC_ALLOC_JITTEMP);
+ GC_ALLOC_JIT_ARGS);
if( !args )
{
/* XXX We should be a little more graceful */
Index: kaffe/kaffe/kaffevm/jit3/labels.c
diff -u kaffe/kaffe/kaffevm/jit3/labels.c:1.11 kaffe/kaffe/kaffevm/jit3/labels.c:1.12
--- kaffe/kaffe/kaffevm/jit3/labels.c:1.11 Wed Sep 17 21:14:08 2003
+++ kaffe/kaffe/kaffevm/jit3/labels.c Sun Sep 21 18:18:19 2003
@@ -63,6 +63,9 @@
#endif
void
+objectStatsPrint(void);
+
+void
resetLabels(void)
{
currLabel = firstLabel;
@@ -242,7 +245,7 @@
labelchunk *lc;
/* Allocate chunk of label elements */
- lc = gc_malloc(sizeof(labelchunk), GC_ALLOC_JITTEMP);
+ lc = gc_malloc(sizeof(labelchunk), GC_ALLOC_JIT_LABELS);
assert(lc != NULL);
lc->next = labelchunks;
Index: kaffe/kaffe/kaffevm/jit3/machine.c
diff -u kaffe/kaffe/kaffevm/jit3/machine.c:1.41 kaffe/kaffe/kaffevm/jit3/machine.c:1.42
--- kaffe/kaffe/kaffevm/jit3/machine.c:1.41 Tue Sep 16 19:23:38 2003
+++ kaffe/kaffe/kaffevm/jit3/machine.c Sun Sep 21 18:18:19 2003
@@ -724,7 +724,8 @@
/* Before generating code, try to guess how much space we'll need. */
codeblock_size = ALLOCCODEBLOCKSZ;
- codeblock = gc_malloc(codeblock_size + CODEBLOCKREDZONE, GC_ALLOC_JITTEMP);
+ codeblock = gc_malloc(codeblock_size + CODEBLOCKREDZONE,
+ GC_ALLOC_JIT_CODEBLOCK);
if (codeblock == 0) {
postOutOfMemory(einfo);
return (false);
@@ -761,7 +762,7 @@
new_codeblock = gc_realloc(codeblock,
codeblock_size +
CODEBLOCKREDZONE,
- GC_ALLOC_JITTEMP);
+ GC_ALLOC_JIT_CODEBLOCK);
if (new_codeblock == NULL) {
gc_free(codeblock);
codeblock = NULL;
@@ -978,7 +979,7 @@
#endif
c++; /* Add null slot on the end */
- mem = gc_malloc(c * sizeof(SlotData*), GC_ALLOC_JITCODE);
+ mem = gc_malloc(c * sizeof(SlotData*), GC_ALLOC_JIT_SLOTS);
i = maxLocal + maxStack + tmpslot;
c = 0;
@@ -1121,7 +1122,7 @@
}
/* Allocate an array for the slot pointers and copy them in */
- slots = gc_malloc((1+maxLocal) * sizeof(SlotInfo*), GC_ALLOC_JITCODE);
+ slots = gc_malloc((1+maxLocal) * sizeof(SlotInfo*), GC_ALLOC_JIT_SLOTS);
for (j = 0; j < maxLocal; j++) {
slots[j] = &localinfo[j];
}
@@ -1212,7 +1213,7 @@
arraydims = array;
}
else {
- arraydims = checkPtr(gc_calloc(dims+1, sizeof(int), GC_ALLOC_JITCODE));
+ arraydims = checkPtr(gc_calloc(dims+1, sizeof(int), GC_ALLOC_JITTEMP));
}
/* Extract the dimensions into an array */
@@ -1326,7 +1327,7 @@
{
fc = GC_malloc(main_collector,
sizeof(fakeCall),
- GC_ALLOC_JITCODE);
+ GC_ALLOC_JIT_FAKE_CALL);
}
#if defined(HAVE_branch_and_link)
fc->parent = findFakeCall(func);
Index: kaffe/kaffe/kaffevm/jit3/seq.c
diff -u kaffe/kaffe/kaffevm/jit3/seq.c:1.6 kaffe/kaffe/kaffevm/jit3/seq.c:1.7
--- kaffe/kaffe/kaffevm/jit3/seq.c:1.6 Mon May 12 21:13:30 2003
+++ kaffe/kaffe/kaffevm/jit3/seq.c Sun Sep 21 18:18:19 2003
@@ -15,6 +15,7 @@
#include "seq.h"
#include "gc.h"
+static sequencechunk* sequencechunks;
sequence* firstSeq;
sequence* lastSeq;
sequence* currSeq;
@@ -27,6 +28,18 @@
initSeq(void)
{
currSeq = firstSeq;
+ while( (sequencechunks != NULL) && (sequencechunks->next != NULL) )
+ {
+ sequencechunk *sc = sequencechunks;
+
+ sequencechunks = sc->next;
+ gc_free(sc);
+ }
+ if( sequencechunks != NULL )
+ {
+ lastSeq = &sequencechunks->data[ALLOCSEQNR - 1];
+ lastSeq->next = NULL;
+ }
}
/**
@@ -39,11 +52,18 @@
ret = currSeq;
if (ret == 0) {
+ sequencechunk *sc;
+
int i;
/* Allocate chunk of sequence elements */
- ret = gc_malloc(ALLOCSEQNR * sizeof(sequence),
- GC_ALLOC_JITTEMP);
+ sc = gc_malloc(sizeof(sequencechunk), GC_ALLOC_JIT_SEQ);
+ assert(sc != NULL);
+ sc->next = sequencechunks;
+ sequencechunks = sc;
+
+ ret = &sc->data[0];
+
/* Attach to current chain */
if (lastSeq == 0) {
firstSeq = ret;
@@ -51,13 +71,12 @@
else {
lastSeq->next = ret;
}
- lastSeq = &ret[ALLOCSEQNR-1];
+ lastSeq = &sc->data[ALLOCSEQNR-1];
/* Link elements into list */
for (i = 0; i < ALLOCSEQNR-1; i++) {
- ret[i].next = &ret[i+1];
+ sc->data[i].next = &sc->data[i+1];
}
- ret[ALLOCSEQNR-1].next = 0;
}
currSeq = ret->next;
ret->lastuse = 0;
Index: kaffe/kaffe/kaffevm/jit3/seq.h
diff -u kaffe/kaffe/kaffevm/jit3/seq.h:1.7 kaffe/kaffe/kaffevm/jit3/seq.h:1.8
--- kaffe/kaffe/kaffevm/jit3/seq.h:1.7 Mon May 12 21:13:30 2003
+++ kaffe/kaffe/kaffevm/jit3/seq.h Sun Sep 21 18:18:19 2003
@@ -68,6 +68,11 @@
#define ALLOCSEQNR 1024
+typedef struct _sequencechunk {
+ struct _sequencechunk *next;
+ sequence data[ALLOCSEQNR];
+} sequencechunk;
+
#define seq(s) ((s)->insn)
/**
Index: kaffe/kaffe/kaffevm/jit3/slots.c
diff -u kaffe/kaffe/kaffevm/jit3/slots.c:1.9 kaffe/kaffe/kaffevm/jit3/slots.c:1.10
--- kaffe/kaffe/kaffevm/jit3/slots.c:1.9 Mon May 12 21:13:30 2003
+++ kaffe/kaffe/kaffevm/jit3/slots.c Sun Sep 21 18:18:19 2003
@@ -81,10 +81,10 @@
if (nrslots > lastnrslots) {
basicslots = gc_realloc(basicslots,
nrslots * sizeof(SlotInfo),
- GC_ALLOC_JITTEMP);
+ GC_ALLOC_JIT_SLOTS);
basicdatas = gc_realloc(basicdatas,
nrslots * sizeof(SlotData),
- GC_ALLOC_JITTEMP);
+ GC_ALLOC_JIT_SLOTS);
lastnrslots = nrslots;
}
/* Set 'maxslot' to the maximum slot usable (excluding returns) */
Index: kaffe/kaffe/xprof/callGraph.c
diff -u kaffe/kaffe/xprof/callGraph.c:1.3 kaffe/kaffe/xprof/callGraph.c:1.4
--- kaffe/kaffe/xprof/callGraph.c:1.3 Tue Mar 11 08:00:19 2003
+++ kaffe/kaffe/xprof/callGraph.c Sun Sep 21 18:18:19 2003
@@ -2,7 +2,7 @@
* callGraph.c
* Routines for tracking the call graph of jitted code
*
- * Copyright (c) 2000, 2001 University of Utah and the Flux Group.
+ * Copyright (c) 2000, 2001, 2003 University of Utah and the Flux Group.
* All rights reserved.
*
* This file is licensed under the terms of the GNU Public License.
@@ -175,18 +175,22 @@
{
#if defined(KAFFE_VMDEBUG)
/* FIXME: add debug code like Janos VM. */
+ dprintf("Out of bounds call arc "
+ "%p -> %p : %d\n"
+ "low: %p high: %p\n",
+ ca->ca_from,
+ ca->ca_to,
+ ca->ca_count,
+ gf->gf_low,
+ gf->gf_high);
#endif
}
- else
- {
- retval = writeGmonRecord(
- gf,
- GRA_Type, GMON_TAG_CG_ARC,
- GRA_FromPC, ca->ca_from,
- GRA_SelfPC, ca->ca_to,
- GRA_Count, ca->ca_count,
- GRA_DONE);
- }
+ retval = writeGmonRecord(gf,
+ GRA_Type, GMON_TAG_CG_ARC,
+ GRA_FromPC, ca->ca_from,
+ GRA_SelfPC, ca->ca_to,
+ GRA_Count, ca->ca_count,
+ GRA_DONE);
}
}
More information about the kaffe
mailing list