[kaffe] CVS kaffe (stack): Bring jit1 up-to-date with respect to jit3's jitCodeHeader stuff.
Kaffe CVS
cvs-commits at kaffe.org
Tue Dec 21 14:25:55 PST 2004
PatchSet 5704
Date: 2004/12/21 22:21:35
Author: stack
Branch: HEAD
Tag: (none)
Log:
Bring jit1 up-to-date with respect to jit3's jitCodeHeader stuff.
Members:
ChangeLog:1.3249->1.3250
kaffe/kaffevm/jit/machine.c:1.72->1.73
kaffe/kaffevm/jit/machine.h:1.19->1.20
kaffe/kaffevm/jit/native-wrapper.c:1.4->1.5
kaffe/kaffevm/jit3/machine.c:1.65->1.66
kaffe/kaffevm/jit3/machine.h:1.22->1.23
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3249 kaffe/ChangeLog:1.3250
--- kaffe/ChangeLog:1.3249 Tue Dec 21 18:03:58 2004
+++ kaffe/ChangeLog Tue Dec 21 22:21:35 2004
@@ -1,5 +1,20 @@
2004-12-21 Timothy S. Stack <stack at cs.utah.edu>
+ * kaffe/kaffevm/jit/machine.h, kaffe/kaffevm/jit/machine.c:
+ Add jitCodeHeader support.
+
+ * kaffe/kaffevm/jit/native-wrapper.c:
+ Put ifdef guards around the initFakeCalls call since it isn't
+ available in jit1.
+
+ * kaffe/kaffevm/jit3/machine.c:
+ Remove dead code.
+
+ * kaffe/kaffevm/jit3/machine.h:
+ Add initFakeCalls proto and HAVE_FAKE_CALLS define.
+
+2004-12-21 Timothy S. Stack <stack at cs.utah.edu>
+
* kaffe/kaffevm/external.c:
Fix a typo.
Index: kaffe/kaffe/kaffevm/jit/machine.c
diff -u kaffe/kaffe/kaffevm/jit/machine.c:1.72 kaffe/kaffe/kaffevm/jit/machine.c:1.73
--- kaffe/kaffe/kaffevm/jit/machine.c:1.72 Mon Dec 20 00:55:14 2004
+++ kaffe/kaffe/kaffevm/jit/machine.c Tue Dec 21 22:21:36 2004
@@ -451,8 +451,8 @@
int exc_len = 0;
#endif
uint32 constlen;
+ jitCodeHeader *jch;
nativecode* methblock;
- nativecode* codebase;
/* Emit pending instructions */
generateInsnSequence(codeInfo);
@@ -460,35 +460,41 @@
/* Okay, put this into malloc'ed memory */
constlen = nConst * sizeof(union _constpoolval);
/* Allocate some padding to align codebase if so desired
- */
- methblock = gc_malloc(exc_len + constlen + CODEPC + (align ? (align - ALIGNMENT_OF_SIZE(sizeof(jdouble))) : 0), KGC_ALLOC_JITCODE);
+ */
+ methblock = gc_malloc(sizeof(jitCodeHeader) + exc_len + constlen + CODEPC + (align ? (align - ALIGNMENT_OF_SIZE(sizeof(jdouble))) : 0), KGC_ALLOC_JITCODE);
if (methblock == 0) {
postOutOfMemory(einfo);
return (false);
}
- codebase = methblock + exc_len + constlen;
+ jch = (jitCodeHeader *)methblock;
+ jch->pool = (void *)((char *)(jch + 1)) + exc_len;
+ jch->code_start = ((char *)jch->pool) + constlen;
+ jch->code_len = CODEPC;
/* align entry point if so desired */
- if (align != 0 && (unsigned long)codebase % align != 0) {
- int pad = (align - (unsigned long)codebase % align);
- assert(pad <= align - ALIGNMENT_OF_SIZE(sizeof(jdouble)));
- codebase = (char*)codebase + pad;
+ if (align != 0 && (unsigned long)jch->code_start % align != 0) {
+ int pad = (align - (unsigned long)jch->code_start % align);
+
+ assert(pad <= align - ALIGNMENT_OF_SIZE(sizeof(jdouble)));
+
+ jch->code_start = (char*)jch->code_start + pad;
}
- memcpy(codebase, codeblock, CODEPC);
+ memcpy(jch->code_start, codeblock, CODEPC);
addToCounter(&jitcodeblock, "jitmem-codeblock", 1,
-(jlong)GCSIZEOF(codeblock));
KFREE(codeblock);
/* Establish any code constants */
- establishConstants(methblock + exc_len);
+ establishConstants(jch->pool);
/* Link it */
- linkLabels(codeInfo, (uintp)codebase);
+ linkLabels(codeInfo, (uintp)jch->code_start);
/* Note info on the compiled code for later installation */
code->mem = methblock;
code->memlen = exc_len + constlen + CODEPC;
- code->code = codebase;
+ code->code = jch->code_start;
code->codelen = CODEPC;
+
return (true);
}
@@ -518,6 +524,7 @@
{
int i;
jexceptionEntry* e;
+ jitCodeHeader *jch;
void *tramp;
/* Work out new estimate of code per bytecode */
@@ -537,6 +544,9 @@
meth->c.ncode.ncode_start = code->mem;
meth->c.ncode.ncode_end = (char*)code->code + code->codelen;
+ jch = (jitCodeHeader *)code->mem;
+ jch->method = meth;
+
/* Flush code out of cache */
FLUSH_DCACHE(METHOD_NATIVECODE(meth), meth->c.ncode.ncode_end);
Index: kaffe/kaffe/kaffevm/jit/machine.h
diff -u kaffe/kaffe/kaffevm/jit/machine.h:1.19 kaffe/kaffe/kaffevm/jit/machine.h:1.20
--- kaffe/kaffe/kaffevm/jit/machine.h:1.19 Fri Sep 19 13:15:15 2003
+++ kaffe/kaffe/kaffevm/jit/machine.h Tue Dec 21 22:21:36 2004
@@ -140,6 +140,14 @@
struct _methods;
bool translate(struct _methods*, errorInfo*);
+typedef struct _jitCodeHeader {
+ unsigned long flags;
+ Method *method;
+ void *pool;
+ nativecode *code_start;
+ size_t code_len;
+} jitCodeHeader;
+
typedef struct _nativeCodeInfo {
void* mem;
int memlen;
Index: kaffe/kaffe/kaffevm/jit/native-wrapper.c
diff -u kaffe/kaffe/kaffevm/jit/native-wrapper.c:1.4 kaffe/kaffe/kaffevm/jit/native-wrapper.c:1.5
--- kaffe/kaffe/kaffevm/jit/native-wrapper.c:1.4 Tue Dec 21 00:15:31 2004
+++ kaffe/kaffe/kaffevm/jit/native-wrapper.c Tue Dec 21 22:21:36 2004
@@ -29,8 +29,6 @@
#include "feedback.h"
#endif
-void initFakeCalls(void);
-
static void*
startJNIcall(void)
{
@@ -110,7 +108,9 @@
maxArgs = maxLocal = count; /* make sure args are spilled if needed */
maxStack = 0;
+#if defined(HAVE_FAKE_CALLS)
initFakeCalls();
+#endif
success = initInsnSequence(xmeth, 0, maxLocal, maxStack, &info);
if (!success) {
goto done;
Index: kaffe/kaffe/kaffevm/jit3/machine.c
diff -u kaffe/kaffe/kaffevm/jit3/machine.c:1.65 kaffe/kaffe/kaffevm/jit3/machine.c:1.66
--- kaffe/kaffe/kaffevm/jit3/machine.c:1.65 Tue Dec 21 08:06:37 2004
+++ kaffe/kaffe/kaffevm/jit3/machine.c Tue Dec 21 22:21:37 2004
@@ -171,7 +171,6 @@
fieldInfo finfo;
Hjava_lang_Class* crinfo;
codeinfo* mycodeInfo;
- jitCodeHeader *jch;
nativeCodeInfo ncode;
@@ -185,7 +184,6 @@
lockClass(xmeth->class);
- jch = xmeth->c.ncode.ncode_start;
if (METHOD_TRANSLATED(xmeth)) {
goto done3;
}
Index: kaffe/kaffe/kaffevm/jit3/machine.h
diff -u kaffe/kaffe/kaffevm/jit3/machine.h:1.22 kaffe/kaffe/kaffevm/jit3/machine.h:1.23
--- kaffe/kaffe/kaffevm/jit3/machine.h:1.22 Tue Dec 21 00:15:32 2004
+++ kaffe/kaffe/kaffevm/jit3/machine.h Tue Dec 21 22:21:37 2004
@@ -190,6 +190,8 @@
extern jboolean initInsnSequence(Method *meth, int codesize, int localsz, int stacksz, struct _errorInfo *einfo);
extern jboolean finishInsnSequence(void*, nativeCodeInfo*, struct _errorInfo*);
extern void installMethodCode(void*, Method*, nativeCodeInfo*);
+#define HAVE_FAKE_CALLS 1
+void initFakeCalls(void);
extern struct _label_* newFakeCall(void*, uintp);
extern void doSpill(struct _sequence*);
extern void doReload(struct _sequence*);
More information about the kaffe
mailing list