[kaffe] CVS kaffe (guilhem): config/alpha/osf/md.c
Kaffe CVS
cvs-commits at kaffe.org
Fri Mar 11 08:47:55 PST 2005
PatchSet 5515
Date: 2005/03/11 16:41:45
Author: guilhem
Branch: HEAD
Tag: (none)
Log:
* config/alpha/osf/md.c
(init_md): Initialize explicitly the static lock.
* config/i386/jit3-icode.h
(HAVE_mon_enter, HAVE_mon_exit): Disabled.
* include/errors.h
(errorInfo): Use a const modifier for mess.
* kaffe/kaffevm/baseClasses.c
(initialiseKaffe): Call sub-system initializers.
* kaffe/kaffevm/classMethod.c: Removed all iLockRoot. Use
*StaticMutex functions because classEntry has now a static lock.
* kaffe/kaffevm/classMethod.h
(classEntry): Changed dynamic lock "lock" into static lock
"slock".
* kaffe/kaffevm/classPool.c: Removed all iLockRoot. Use
*StaticMutex functions for class entries.
(KaffeVM_initClassPool): New initializer.
* kaffe/kaffevm/exception.c
(dispatchException): Updated to new lock API.
* kaffe/kaffevm/external.c,
kaffe/kaffevm/findInJar.c,
kaffe/kaffevm/lookup.c,
kaffe/kaffevm/reference.c,
kaffe/kaffevm/string.c,
kaffe/kaffevm/utf8const.c,
kaffe/kaffevm/boehm-gc/gc2.c,
kaffe/kaffevm/jit/native-wrapper.c,
kaffe/kaffevm/kaffe-gc/gc-incremental.c,
kaffe/kaffevm/kaffe-gc/gc-mem.c: Removed iLockRoot. Upgraded to new
static lock API.
* kaffe/kaffevm/jar.[ch]: Likewise. Use also a static lock for jarFile.
(KaffeVM_initJarCache): New initializer.
* kaffe/kaffevm/kaffe-gc/gc-refs.c: Likewise.
(KaffeGC_initRefs): New initializer.
* kaffe/kaffevm/ksem.[ch]: Updated to match true semaphore behaviour.
* kaffe/kaffevm/gcFuncs.c
(walkObject, walkClass, walkRefArray): Mark the heavy lock if it
has been allocated.
(initCollector): Changed KGC_ALLOC_LOCK into garbage-collected memory.
* kaffe/kaffevm/locks.c, kaffe/kaffevm/locks.h: New
implementation for heavy locks and thin locks.
* kaffe/kaffevm/thread.c: Reduced the number of
KTHREAD(get_data). Removed iLockRoot.
* kaffe/kaffevm/support.h: Added initEngine().
* libraries/clib/net/InetAddressImpl.c: Removed iLockRoot. Updated
to the new lock interface.
(initInetLock, initNsLock): New initializer to take care of
concurrent initialization of the static locks.
* kaffe/kaffevm/intrp/machine.c,
kaffe/kaffevm/jit/machine.c,
kaffe/kaffevm/jit3/machine.c: Updated to new lock interface.
(initEngine): New initializer.
Members:
ChangeLog:1.3689->1.3690
config/alpha/osf/md.c:1.8->1.9
config/i386/jit3-icode.h:1.9->1.10
include/errors.h:1.16->1.17
kaffe/kaffevm/baseClasses.c:1.59->1.60
kaffe/kaffevm/classMethod.c:1.135->1.136
kaffe/kaffevm/classMethod.h:1.77->1.78
kaffe/kaffevm/classPool.c:1.33->1.34
kaffe/kaffevm/exception.c:1.93->1.94
kaffe/kaffevm/external.c:1.78->1.79
kaffe/kaffevm/findInJar.c:1.65->1.66
kaffe/kaffevm/gcFuncs.c:1.67->1.68
kaffe/kaffevm/jar.c:1.36->1.37
kaffe/kaffevm/jar.h:1.9->1.10
kaffe/kaffevm/ksem.c:1.12->1.13
kaffe/kaffevm/ksem.h:1.10->1.11
kaffe/kaffevm/locks.c:1.56->1.57
kaffe/kaffevm/locks.h:1.27->1.28
kaffe/kaffevm/lookup.c:1.42->1.43
kaffe/kaffevm/reference.c:1.2->1.3
kaffe/kaffevm/string.c:1.39->1.40
kaffe/kaffevm/support.h:1.38->1.39
kaffe/kaffevm/thread.c:1.92->1.93
kaffe/kaffevm/utf8const.c:1.45->1.46
kaffe/kaffevm/boehm-gc/gc2.c:1.8->1.9
kaffe/kaffevm/intrp/machine.c:1.48->1.49
kaffe/kaffevm/jit/machine.c:1.75->1.76
kaffe/kaffevm/jit/native-wrapper.c:1.7->1.8
kaffe/kaffevm/jit3/machine.c:1.71->1.72
kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.19->1.20
kaffe/kaffevm/kaffe-gc/gc-mem.c:1.24->1.25
kaffe/kaffevm/kaffe-gc/gc-refs.c:1.11->1.12
kaffe/kaffevm/kaffe-gc/gc-refs.h:1.5->1.6
kaffe/xprof/debugFile.c:1.7->1.8
kaffe/xprof/feedback.c:1.4->1.5
kaffe/xprof/sectionFile.c:1.6->1.7
libraries/clib/net/InetAddressImpl.c:1.28->1.29
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3689 kaffe/ChangeLog:1.3690
--- kaffe/ChangeLog:1.3689 Fri Mar 11 15:13:51 2005
+++ kaffe/ChangeLog Fri Mar 11 16:41:45 2005
@@ -1,3 +1,75 @@
+2005-05-11 Guilhem Lavaux <guilhem at kaffe.org>,
+ Helmer Krämer <hkraemer at freenet.de>
+
+ * config/alpha/osf/md.c
+ (init_md): Initialize explicitly the static lock.
+
+ * config/i386/jit3-icode.h
+ (HAVE_mon_enter, HAVE_mon_exit): Disabled.
+
+ * include/errors.h
+ (errorInfo): Use a const modifier for mess.
+
+ * kaffe/kaffevm/baseClasses.c
+ (initialiseKaffe): Call sub-system initializers.
+
+ * kaffe/kaffevm/classMethod.c: Removed all iLockRoot. Use
+ *StaticMutex functions because classEntry has now a static lock.
+
+ * kaffe/kaffevm/classMethod.h
+ (classEntry): Changed dynamic lock "lock" into static lock
+ "slock".
+
+ * kaffe/kaffevm/classPool.c: Removed all iLockRoot. Use
+ *StaticMutex functions for class entries.
+ (KaffeVM_initClassPool): New initializer.
+
+ * kaffe/kaffevm/exception.c
+ (dispatchException): Updated to new lock API.
+
+ * kaffe/kaffevm/external.c,
+ kaffe/kaffevm/findInJar.c,
+ kaffe/kaffevm/lookup.c,
+ kaffe/kaffevm/reference.c,
+ kaffe/kaffevm/string.c,
+ kaffe/kaffevm/utf8const.c,
+ kaffe/kaffevm/boehm-gc/gc2.c,
+ kaffe/kaffevm/jit/native-wrapper.c,
+ kaffe/kaffevm/kaffe-gc/gc-incremental.c,
+ kaffe/kaffevm/kaffe-gc/gc-mem.c: Removed iLockRoot. Upgraded to new
+ static lock API.
+
+ * kaffe/kaffevm/jar.[ch]: Likewise. Use also a static lock for jarFile.
+ (KaffeVM_initJarCache): New initializer.
+
+ * kaffe/kaffevm/kaffe-gc/gc-refs.c: Likewise.
+ (KaffeGC_initRefs): New initializer.
+
+ * kaffe/kaffevm/ksem.[ch]: Updated to match true semaphore behaviour.
+
+ * kaffe/kaffevm/gcFuncs.c
+ (walkObject, walkClass, walkRefArray): Mark the heavy lock if it
+ has been allocated.
+ (initCollector): Changed KGC_ALLOC_LOCK into garbage-collected memory.
+
+ * kaffe/kaffevm/locks.c, kaffe/kaffevm/locks.h: New
+ implementation for heavy locks and thin locks.
+
+ * kaffe/kaffevm/thread.c: Reduced the number of
+ KTHREAD(get_data). Removed iLockRoot.
+
+ * kaffe/kaffevm/support.h: Added initEngine().
+
+ * libraries/clib/net/InetAddressImpl.c: Removed iLockRoot. Updated
+ to the new lock interface.
+ (initInetLock, initNsLock): New initializer to take care of
+ concurrent initialization of the static locks.
+
+ * kaffe/kaffevm/intrp/machine.c,
+ kaffe/kaffevm/jit/machine.c,
+ kaffe/kaffevm/jit3/machine.c: Updated to new lock interface.
+ (initEngine): New initializer.
+
2005-03-11 Dalibor Topic <robilad at kaffe.org>
Resynced with GNU Classpath.
Index: kaffe/config/alpha/osf/md.c
diff -u kaffe/config/alpha/osf/md.c:1.8 kaffe/config/alpha/osf/md.c:1.9
--- kaffe/config/alpha/osf/md.c:1.8 Tue Jul 8 07:33:48 2003
+++ kaffe/config/alpha/osf/md.c Fri Mar 11 16:41:50 2005
@@ -34,6 +34,12 @@
#define FPCR_DZED 0
#endif
+#if defined(USE_LIBEXC)
+#include "locks.h"
+/* libexc is not thread safe :-( */
+static iStaticLock excLock;
+#endif
+
void
init_md(void)
{
@@ -55,6 +61,8 @@
those that don't. */
ieee_set_fp_control(IEEE_TRAP_ENABLE_INV);
#endif
+
+ initStaticLock(&excLock);
}
@@ -80,14 +88,9 @@
#include <excpt.h>
#include "debug.h"
-#include "locks.h"
-
-/* libexc is not thread safe :-( */
-static iStaticLock excLock;
void __alpha_osf_firstFrame (exceptionFrame *frame)
{
- int iLockRoot;
/* Retreive caller frame as current one will be invalidate
after function exit. */
@@ -104,7 +107,6 @@
exceptionFrame * __alpha_osf_nextFrame (exceptionFrame *frame)
{
- int iLockRoot;
DBG(STACKTRACE,
dprintf("__alpha_osf_nextFrame(0x%p) pc 0x%p fp 0x%p sp 0x%p\n", frame,
@@ -140,7 +142,6 @@
/* Construct JIT Exception information and register it. */
void __alpha_osf_register_jit_exc (void *methblock, void *codebase, void *codeend)
{
- int iLockRoot;
extern int maxLocal, maxStack, maxTemp, maxArgs, maxPush;
struct {
pdsc_crd crd[2];
@@ -209,7 +210,6 @@
void __alpha_osf_unregister_jit_exc (void *methblock, void *codebase, void *codeend)
{
- int iLockRoot;
int codelen = codeend - codebase;
DBG(STACKTRACE,
Index: kaffe/config/i386/jit3-icode.h
diff -u kaffe/config/i386/jit3-icode.h:1.9 kaffe/config/i386/jit3-icode.h:1.10
--- kaffe/config/i386/jit3-icode.h:1.9 Sun Jun 17 16:39:10 2001
+++ kaffe/config/i386/jit3-icode.h Fri Mar 11 16:41:51 2005
@@ -223,8 +223,8 @@
#define HAVE_call_indirect_const call_ind_xCC
-#define HAVE_mon_enter monenter_xxRCC
-#define HAVE_mon_exit monexit_xxRCC
+//#define HAVE_mon_enter monenter_xxRCC
+//#define HAVE_mon_exit monexit_xxRCC
#define HAVE_get_arg_ptr get_arg_ptr_R
Index: kaffe/include/errors.h
diff -u kaffe/include/errors.h:1.16 kaffe/include/errors.h:1.17
--- kaffe/include/errors.h:1.16 Sun Dec 19 22:13:08 2004
+++ kaffe/include/errors.h Fri Mar 11 16:41:51 2005
@@ -36,7 +36,7 @@
typedef struct _errorInfo {
int type; /* type of error */
const char* classname; /* full dotted name of exception/error class */
- char* mess; /* accompanying msg */
+ const char* mess; /* accompanying msg */
struct Hjava_lang_Throwable* throwable; /* a throwable */
} errorInfo;
Index: kaffe/kaffe/kaffevm/baseClasses.c
diff -u kaffe/kaffe/kaffevm/baseClasses.c:1.59 kaffe/kaffe/kaffevm/baseClasses.c:1.60
--- kaffe/kaffe/kaffevm/baseClasses.c:1.59 Sun Jan 30 18:21:38 2005
+++ kaffe/kaffe/kaffevm/baseClasses.c Fri Mar 11 16:41:52 2005
@@ -41,6 +41,7 @@
#include "debugFile.h"
#include "fileSections.h"
#include "verify-type.h"
+#include "jar.h"
Utf8Const* init_name;
Utf8Const* final_name;
@@ -164,6 +165,10 @@
/* Initialise the (native) threading system */
initNativeThreads(threadStackSize);
+
+ initEngine();
+ KaffeVM_initClassPool();
+ KaffeVM_initJarCache();
/* Initialise the string and utf8 systems */
stringInit();
Index: kaffe/kaffe/kaffevm/classMethod.c
diff -u kaffe/kaffe/kaffevm/classMethod.c:1.135 kaffe/kaffe/kaffevm/classMethod.c:1.136
--- kaffe/kaffe/kaffevm/classMethod.c:1.135 Wed Feb 16 13:35:20 2005
+++ kaffe/kaffe/kaffevm/classMethod.c Fri Mar 11 16:41:52 2005
@@ -115,7 +115,6 @@
static int depth;
#endif /* !(defined(NDEBUG) || !defined(KAFFE_VMDEBUG)) */
static Method *object_fin;
- int iLockRoot;
/* If this class is initialised to the required point, quit now */
if (class->state >= tostate) {
@@ -750,7 +749,6 @@
static bool
resolveInterfaces(Hjava_lang_Class *class, errorInfo *einfo)
{
- int iLockRoot;
int i, j, k;
int totalilen;
Hjava_lang_Class** newifaces;
@@ -1539,7 +1537,6 @@
errorInfo info;
Utf8Const *utf8;
classEntry* centry;
- int iLockRoot;
bool refAdded;
utf8 = utf8ConstNew(name, -1);
@@ -1548,7 +1545,7 @@
if (!centry) goto bad;
utf8ConstRelease(utf8);
- lockMutex(centry);
+ lockStaticMutex(¢ry->slock);
if (centry->data.cl == 0) {
centry->state = NMS_LOADING;
@@ -1570,7 +1567,7 @@
(*class) = centry->data.cl = clazz;
}
- unlockMutex(centry);
+ unlockStaticMutex(¢ry->slock);
if (!(*class))
(*class) = centry->data.cl;
@@ -1618,7 +1615,6 @@
{
Hjava_lang_Class* clas;
const char* name;
- int iLockRoot;
/* Avoid locking if we can */
if (FIELD_RESOLVED(fld)) {
@@ -2230,7 +2226,6 @@
int found_i;
bool rc = false;
Hjava_lang_Class** ifcs;
- int iLockRoot;
/* find an impl_index for this class
* Note that we only find a suitable impl_index with regard to the
@@ -2429,7 +2424,6 @@
Utf8Const* utf8;
Hjava_lang_String* str = NULL;
constants* pool;
- int iLockRoot;
pool = CLASS_CONSTANTS(clazz);
@@ -2768,7 +2762,6 @@
classEntry* centry;
Hjava_lang_Class* arr_class;
int arr_flags;
- int iLockRoot;
/* If we couldn't resolve the element type, there's no way we can
* construct the array type.
@@ -2819,11 +2812,11 @@
}
/* Lock class entry */
- lockMutex(centry);
+ lockStaticMutex(¢ry->slock);
/* Incase someone else did it */
if (centry->data.cl != 0) {
- unlockMutex(centry);
+ unlockStaticMutex(¢ry->slock);
goto found;
}
@@ -2879,7 +2872,7 @@
centry->state = NMS_DONE;
bail:
- unlockMutex(centry);
+ unlockStaticMutex(¢ry->slock);
found:;
if (c && CLASS_IS_PRIMITIVE(c)) {
Index: kaffe/kaffe/kaffevm/classMethod.h
diff -u kaffe/kaffe/kaffevm/classMethod.h:1.77 kaffe/kaffe/kaffevm/classMethod.h:1.78
--- kaffe/kaffe/kaffevm/classMethod.h:1.77 Wed Feb 16 13:35:20 2005
+++ kaffe/kaffe/kaffevm/classMethod.h Fri Mar 11 16:41:52 2005
@@ -19,6 +19,7 @@
#include "constants.h"
#include "errors.h"
#include "jthread.h"
+#include "locks.h"
#define MAXMETHOD 64
@@ -261,7 +262,7 @@
struct _classEntry* next;
Utf8Const* name;
- struct _iLock* lock;
+ iStaticLock slock;
name_mapping_state_t state;
Hjava_lang_ClassLoader* loader;
union {
@@ -614,6 +615,8 @@
void setClassMappingState(classEntry *ce, name_mapping_state_t nms);
void walkClassPool(int (*walker)(Hjava_lang_Class *clazz, void *), void *param);
+
+void KaffeVM_initClassPool(void);
extern Utf8Const* init_name; /* "<clinit>" */
extern Utf8Const* constructor_name; /* "<init>" */
Index: kaffe/kaffe/kaffevm/classPool.c
diff -u kaffe/kaffe/kaffevm/classPool.c:1.33 kaffe/kaffe/kaffevm/classPool.c:1.34
--- kaffe/kaffe/kaffevm/classPool.c:1.33 Fri Feb 4 10:36:14 2005
+++ kaffe/kaffe/kaffevm/classPool.c Fri Mar 11 16:41:52 2005
@@ -30,7 +30,7 @@
#include "md.h"
#define CLASSHASHSZ 256 /* Must be a power of two */
-static iStaticLock classHashLock = KAFFE_STATIC_LOCK_INITIALIZER;
+static iStaticLock classHashLock;
static classEntry* classEntryPool[CLASSHASHSZ];
#if defined(KAFFE_STATS)
statobject classStats;
@@ -65,7 +65,6 @@
{
classEntry* entry;
classEntry** entryp;
- int iLockRoot;
static int f = 0;
if (f == 0) {
@@ -87,6 +86,7 @@
entry->loader = loader;
entry->data.cl = NULL;
entry->next = NULL;
+ initStaticLock(&entry->slock);
/* Lock the class table and insert entry into it (if not already
there) */
@@ -194,7 +194,6 @@
classEntry* entry;
int ipool;
int totalent = 0;
- int iLockRoot;
lockStaticMutex(&classHashLock);
for (ipool = CLASSHASHSZ; --ipool >= 0; ) {
@@ -221,6 +220,7 @@
(*entryp) = entry->next;
addToCounter(&cpemem, "vmmem-class entry pool",
1, -(jlong)GCSIZEOF(entry));
+ destroyStaticLock(&entry->slock);
gc_free(entry);
totalent++;
} else {
@@ -252,7 +252,7 @@
}
static nameDependency *dependencies;
-static iStaticLock mappingLock = KAFFE_STATIC_LOCK_INITIALIZER;
+static iStaticLock mappingLock;
static
nameDependency *findNameDependency(jthread_t jt)
@@ -273,7 +273,6 @@
int addNameDependency(nameDependency *nd)
{
int retval = 1;
- int iLockRoot;
assert(nd != 0);
@@ -301,7 +300,6 @@
static
void remNameDependency(classEntry *ce)
{
- int iLockRoot;
assert(ce != 0);
@@ -331,12 +329,11 @@
int done = 0, retval = 1;
nameDependency nd;
jthread_t jt;
- int iLockRoot;
jt = KTHREAD(current)();
while( !done )
{
- lockMutex(ce);
+ lockStaticMutex(&ce->slock);
switch( ce->state )
{
case NMS_EMPTY:
@@ -351,7 +348,7 @@
done = 1;
break;
}
- waitCond(ce, 0);
+ waitStaticCond(&ce->slock, (jlong)0);
break;
case NMS_LOADING:
/*
@@ -374,7 +371,7 @@
}
else
{
- waitCond(ce, 0);
+ waitStaticCond(&ce->slock, (jlong)0);
}
remNameDependency(ce);
break;
@@ -383,7 +380,7 @@
* Another thread loaded it, however, its not finished
* linking yet.
*/
- waitCond(ce, 0);
+ waitStaticCond(&ce->slock, (jlong)0);
break;
case NMS_DONE:
/* Its already been loaded and linked. */
@@ -391,7 +388,7 @@
done = 1;
break;
}
- unlockMutex(ce);
+ unlockStaticMutex(&ce->slock);
}
return( retval );
}
@@ -403,13 +400,12 @@
int done = 0, retval = 1;
nameDependency nd;
jthread_t jt;
- int iLockRoot;
*out_cl = NULL;
jt = KTHREAD(current)();
while( !done )
{
- lockMutex(ce);
+ lockStaticMutex(&ce->slock);
switch( ce->state )
{
case NMS_EMPTY:
@@ -440,7 +436,7 @@
}
else
{
- waitCond(ce, 0);
+ waitStaticCond(&ce->slock, (jlong)0);
}
remNameDependency(ce);
break;
@@ -449,7 +445,7 @@
* Another thread loaded it, however, its not finished
* linking yet.
*/
- waitCond(ce, 0);
+ waitStaticCond(&ce->slock, (jlong)0);
break;
case NMS_DONE:
/* Its already been loaded and linked. */
@@ -457,7 +453,7 @@
done = 1;
break;
}
- unlockMutex(ce);
+ unlockStaticMutex(&ce->slock);
}
return( retval );
}
@@ -465,12 +461,11 @@
Hjava_lang_Class *classMappingLoaded(classEntry *ce, Hjava_lang_Class *cl)
{
Hjava_lang_Class *retval = NULL;
- int iLockRoot;
assert(ce != 0);
assert(cl != 0);
- lockMutex(ce);
+ lockStaticMutex(&ce->slock);
{
switch( ce->state )
{
@@ -493,20 +488,19 @@
retval = ce->data.cl;
break;
}
- broadcastCond(ce);
+ broadcastStaticCond(&ce->slock);
}
- unlockMutex(ce);
+ unlockStaticMutex(&ce->slock);
return( retval );
}
void setClassMappingState(classEntry *ce, name_mapping_state_t nms)
{
- int iLockRoot;
assert(ce != 0);
- lockMutex(ce);
+ lockStaticMutex(&ce->slock);
{
switch( ce->state )
{
@@ -526,9 +520,15 @@
assert(0);
break;
}
- broadcastCond(ce);
+ broadcastStaticCond(&ce->slock);
}
- unlockMutex(ce);
+ unlockStaticMutex(&ce->slock);
+}
+
+void KaffeVM_initClassPool()
+{
+ initStaticLock(&classHashLock);
+ initStaticLock(&mappingLock);
}
#if defined(KAFFE_STATS) || defined(KAFFE_PROFILER) || defined(KAFFE_VMDEBUG)
Index: kaffe/kaffe/kaffevm/exception.c
diff -u kaffe/kaffe/kaffevm/exception.c:1.93 kaffe/kaffe/kaffevm/exception.c:1.94
--- kaffe/kaffe/kaffevm/exception.c:1.93 Mon Feb 7 01:27:59 2005
+++ kaffe/kaffe/kaffevm/exception.c Fri Mar 11 16:41:52 2005
@@ -85,7 +85,7 @@
{
assert(eh != NULL);
assert(eh->meth == VMEXCEPTHANDLER_KAFFEJNI_HANDLER);
- assert(fp != NULL);
+ assert(fp != (JNIFrameAddress)0);
return (eh->frame.jni.fp == fp);
}
@@ -94,7 +94,7 @@
vmExcept_setJNIFrame(VmExceptHandler* eh, JNIFrameAddress fp)
{
assert(eh != NULL);
- assert(fp != NULL);
+ assert(fp != (JNIFrameAddress)0);
eh->meth = VMEXCEPTHANDLER_KAFFEJNI_HANDLER;
eh->frame.jni.fp = fp;
@@ -181,6 +181,8 @@
case KERR_OUT_OF_MEMORY:
err = gc_throwOOM();
break;
+ default:
+ assert(!!!"Unexpected error info mask");
}
discardErrorInfo(einfo);
@@ -292,7 +294,7 @@
discardErrorInfo(errorInfo *einfo)
{
if (einfo->type & KERR_FREE_MESSAGE) {
- KFREE(einfo->mess);
+ KFREE((void *)einfo->mess);
einfo->type &= ~KERR_FREE_MESSAGE;
}
}
@@ -461,7 +463,7 @@
/* If not here, exit monitor if synchronised. */
if (frame->meth->accflags & ACC_SYNCHRONISED) {
- locks_internal_slowUnlockMutexIfHeld(&obj->lock, (void *)frame->fp, NULL);
+ locks_internal_slowUnlockMutexIfHeld(&obj->lock, NULL);
}
/* If method found and profiler enable, fix self+children time */
Index: kaffe/kaffe/kaffevm/external.c
diff -u kaffe/kaffe/kaffevm/external.c:1.78 kaffe/kaffe/kaffevm/external.c:1.79
--- kaffe/kaffe/kaffevm/external.c:1.78 Mon Jan 10 12:43:19 2005
+++ kaffe/kaffe/kaffevm/external.c Fri Mar 11 16:41:52 2005
@@ -72,7 +72,7 @@
Hjava_lang_ClassLoader* loader;
} libHandle[MAXLIBS];
-static iStaticLock libraryLock = KAFFE_STATIC_LOCK_INITIALIZER; /* mutex on all intern operations */
+static iStaticLock libraryLock; /* mutex on all intern operations */
static char *libraryPath = NULL;
extern JavaVM Kaffe_JavaVM;
@@ -114,6 +114,8 @@
DBG(INIT, dprintf("initNative()\n"); );
+ initStaticLock(&libraryLock);
+
lpath = (const char*)Kaffe_JavaVMArgs.libraryhome;
if (lpath == NULL) {
lpath = getenv(LIBRARYPATH);
@@ -201,7 +203,6 @@
struct _libHandle *lib;
int libIndex;
void *func;
- int iLockRoot;
lockStaticMutex(&libraryLock);
@@ -311,7 +312,6 @@
unloadNativeLibraries(struct Hjava_lang_ClassLoader* loader)
{
int libIndex;
- int iLockRoot;
lockStaticMutex(&libraryLock);
@@ -349,7 +349,6 @@
{
int i = 0;
void* func = NULL;
- int iLockRoot;
lockStaticMutex(&libraryLock);
Index: kaffe/kaffe/kaffevm/findInJar.c
diff -u kaffe/kaffe/kaffevm/findInJar.c:1.65 kaffe/kaffe/kaffevm/findInJar.c:1.66
--- kaffe/kaffe/kaffevm/findInJar.c:1.65 Fri Feb 4 10:36:14 2005
+++ kaffe/kaffe/kaffevm/findInJar.c Fri Mar 11 16:41:52 2005
@@ -172,6 +172,8 @@
return (NULL);
}
+static iStaticLock jarlock;
+
/*
* Locate the given name in the CLASSPATH. Fill in the provided
* classFile handle with a buffer containing the class (or
@@ -184,11 +186,9 @@
{
char *buf;
int fp;
- static iStaticLock jarlock = KAFFE_STATIC_LOCK_INITIALIZER;
classpathEntry* ptr;
int i;
int rc;
- int iLockRoot;
/* Look for the class */
DBG(CLASSLOOKUP, dprintf("Scanning for element %s\n", cname); );
@@ -362,6 +362,8 @@
cp = Kaffe_JavaVMArgs.bootClasspath;
hm = Kaffe_JavaVMArgs.classhome;
+
+ initStaticLock(&jarlock);
if (cp != NULL && cp[0] != '\0') {
/* cp may reside in read-only memory, but
Index: kaffe/kaffe/kaffevm/gcFuncs.c
diff -u kaffe/kaffe/kaffevm/gcFuncs.c:1.67 kaffe/kaffe/kaffevm/gcFuncs.c:1.68
--- kaffe/kaffe/kaffevm/gcFuncs.c:1.67 Sun Feb 6 20:30:15 2005
+++ kaffe/kaffe/kaffevm/gcFuncs.c Fri Mar 11 16:41:52 2005
@@ -266,7 +266,7 @@
alive */
if (m->exception_table != 0) {
jexceptionEntry* eptr = &m->exception_table->entry[0];
- int i;
+ unsigned int i;
for (i = 0; i < m->exception_table->length; i++) {
Hjava_lang_Class* c = eptr[i].catch_type;
@@ -289,7 +289,8 @@
Field* fld;
int n;
constants* pool;
- int idx;
+ unsigned int idx;
+ iLock *lk;
class = (Hjava_lang_Class*)base;
@@ -297,8 +298,18 @@
dprintf("walkClass `%s' state=%d\n", CLASS_CNAME(class), class->state);
);
+ lk = GET_HEAVYLOCK(class->lock);
+ if (lk != NULL
+ && KGC_getObjectIndex(collector, lk) == KGC_ALLOC_LOCK)
+ KGC_markObject(collector, gc_info, lk);
+
+ lk = GET_HEAVYLOCK(class->head.lock);
+ if (lk != NULL
+ && KGC_getObjectIndex(collector, lk) == KGC_ALLOC_LOCK)
+ KGC_markObject(collector, gc_info, lk);
+
if (class->state >= CSTATE_PREPARED) {
- KGC_markObject(collector, gc_info, class->superclass);
+ KGC_markObject(collector, gc_info, class->superclass);
}
/* We only need the interface array to be allocated.
@@ -468,6 +479,7 @@
{
Hjava_lang_Object* arr;
int i;
+ iLock *lk;
Hjava_lang_Object** ptr;
arr = (Hjava_lang_Object*)base;
@@ -475,7 +487,11 @@
return;
}
- ptr = OBJARRAY_DATA(arr);
+ lk = GET_HEAVYLOCK(arr->lock);
+ if (lk != NULL && KGC_getObjectIndex(collector, lk) == KGC_ALLOC_LOCK)
+ KGC_markObject(collector, gc_info, lk);
+
+ ptr = OBJARRAY_DATA(arr);
/* mark class only if not a system class (which would be anchored
* anyway.) */
if (arr->vtable->class->loader != 0) {
@@ -503,7 +519,9 @@
Hjava_lang_Class *clazz;
int *layout;
int8* mem;
- int i, l, nbits;
+ unsigned int i;
+ int l, nbits;
+ iLock *lk;
/*
* Note that there is a window after the object is allocated but
@@ -522,6 +540,10 @@
KGC_markObject(collector, gc_info, clazz);
}
+ lk = GET_HEAVYLOCK(obj->lock);
+ if (lk != NULL && KGC_getObjectIndex(collector, lk) == KGC_ALLOC_LOCK)
+ KGC_markObject(collector, gc_info, lk);
+
layout = clazz->gc_layout;
nbits = CLASS_FSIZE(clazz)/ALIGNMENTOF_VOIDP;
@@ -686,6 +708,8 @@
NULL, KGC_OBJECT_NORMAL, NULL, "jit-code");
KGC_registerGcTypeByIndex(gc, KGC_ALLOC_BYTECODE,
NULL, KGC_OBJECT_NORMAL, NULL, "java-bytecode");
+ KGC_registerGcTypeByIndex(gc, KGC_ALLOC_LOCK,
+ NULL, KGC_OBJECT_NORMAL, KaffeLock_destroyLock, "locks");
KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_STATIC_THREADDATA, "thread-data");
KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_EXCEPTIONTABLE, "exc-table");
@@ -696,7 +720,6 @@
KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_METHOD, "methods");
KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_FIELD, "fields");
KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_UTF8CONST, "utf8consts");
- KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_LOCK, "locks");
KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_REF, "gc-refs");
KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_JITTEMP, "jit-temp-data");
KGC_registerFixedTypeByIndex(gc, KGC_ALLOC_JAR, "jar");
Index: kaffe/kaffe/kaffevm/jar.c
diff -u kaffe/kaffe/kaffevm/jar.c:1.36 kaffe/kaffe/kaffevm/jar.c:1.37
--- kaffe/kaffe/kaffevm/jar.c:1.36 Sat Jan 8 00:31:46 2005
+++ kaffe/kaffe/kaffevm/jar.c Fri Mar 11 16:41:52 2005
@@ -41,6 +41,8 @@
#undef unlockMutex
#define lockMutex(x)
#define unlockMutex(x)
+#undef destroyStaticLock
+#define destroyStaticLock(x)
#endif
/*
@@ -75,12 +77,7 @@
unsigned int count;
};
-static struct _jarCache jarCache = {
-#if !defined(KAFFEH)
- KAFFE_STATIC_LOCK_INITIALIZER,
-#endif
- NULL, 0
-};
+static struct _jarCache jarCache;
/*
* Hash a file name, the hash value is stored in what `hash' points to.
@@ -105,9 +102,6 @@
static jarFile *findCachedJarFile(char *name)
{
jarFile *curr, **prev, *retval = NULL;
-#if !defined(KAFFEH)
- int iLockRoot;
-#endif
assert(name != NULL);
@@ -188,6 +182,7 @@
}
#endif
addToCounter(&jarmem, "vmmem-jar files", 1, -(jlong)GCSIZEOF(jf));
+ destroyStaticLock(&jf->lock);
gc_free(jf);
}
@@ -200,9 +195,6 @@
{
jarFile *curr, **prev, **lru = NULL, *dead_jar = NULL, *retval = jf;
int already_cached = 0;
-#if !defined(KAFFEH)
- int iLockRoot;
-#endif
assert(jf != 0);
assert(!(jf->flags & JFF_CACHED));
@@ -330,9 +322,6 @@
static void removeJarFile(jarFile *jf)
{
jarFile *curr, **prev;
-#if !defined(KAFFEH)
- int iLockRoot;
-#endif
assert(jf != NULL);
@@ -364,9 +353,6 @@
void flushJarCache(void)
{
jarFile **prev, *curr, *next;
-#if !defined(KAFFEH)
- int iLockRoot;
-#endif
lockStaticMutex(&jarCache.lock);
curr = jarCache.files;
@@ -951,14 +937,11 @@
{
uint8 *buf = NULL, *retval = NULL;
jarLocalHeader lh;
-#if !defined(KAFFEH)
- int iLockRoot;
-#endif
assert(jf != 0);
assert(je != 0);
- lockMutex(jf);
+ lockStaticMutex(&jf->lock);
/* Move to the local header in the file and read it. */
if( !jf->error &&
(jarSeek(jf, (off_t)je->localHeaderOffset, SEEK_SET) >= 0) &&
@@ -987,7 +970,7 @@
}
}
- unlockMutex(jf);
+ unlockStaticMutex(&jf->lock);
if( buf )
{
/* Try to decompress it */
@@ -1018,17 +1001,14 @@
if( jar_stat.st_mtime == jf->lastModified )
{
#endif /* !defined(STATIC_JAR_FILES) */
-#if !defined(KAFFEH)
- int iLockRoot;
-#endif
*** Patch too long, truncated ***
More information about the kaffe
mailing list