/* src/vm/class.cpp - class related functions
- Copyright (C) 1996-2005, 2006, 2007, 2008, 2010
+ Copyright (C) 1996-2011
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
}
+/**
+ * Helper function for the CLASS_IS_OR_ALMOST_INITIALIZED macro.
+ */
+bool class_initializing_thread_is_self(classinfo *c)
+{
+ threadobject *t = thread_get_current();
+ return t == c->initializing_thread;
+}
+
/* class_get_signature *********************************************************
Return the signature of the given class. For array and primitive
/* src/vm/class.hpp - class related functions header
- Copyright (C) 1996-2005, 2006, 2007, 2008
+ Copyright (C) 1996-2011
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
/* some macros ****************************************************************/
#define CLASS_IS_OR_ALMOST_INITIALIZED(c) \
- (((c)->state & CLASS_INITIALIZING) || ((c)->state & CLASS_INITIALIZED))
+ (((c)->state & CLASS_INITIALIZED) || ((c)->state & CLASS_INITIALIZING && class_initializing_thread_is_self((c))))
/* classinfo ******************************************************************/
#endif
} dummy_java_lang_Class;
+struct threadobject;
+
struct classinfo { /* class structure */
dummy_java_lang_Class object;
/* (interfaces) */
s4 instancesize; /* size of an instance of this class */
+ struct threadobject *initializing_thread;
vftbl_t *vftbl; /* pointer to virtual function table */
methodinfo *finalizer; /* finalizer method */
utf *class_get_signature(classinfo *c);
#endif
+bool class_initializing_thread_is_self(classinfo *c);
+
/* some debugging functions */
#if !defined(NDEBUG)
* indent-tabs-mode: t
* c-basic-offset: 4
* tab-width: 4
+ * vim:noexpandtab:sw=4:ts=4:
* End:
*/
/* src/vm/initialize.cpp - static class initializer functions
- Copyright (C) 1996-2005, 2006, 2007, 2008, 2009
+ Copyright (C) 1996-2011
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
/* this initalizing run begins NOW */
+ c->initializing_thread = thread_get_current();
c->state |= CLASS_INITIALIZING;
/* call the internal function */
* indent-tabs-mode: t
* c-basic-offset: 4
* tab-width: 4
+ * vim:noexpandtab:sw=4:ts=4:
* End:
*/