calls instead of machine instructions, using the C calling
convention.
- $Id: builtin.c 793 2003-12-16 18:50:39Z edwin $
+ $Id: builtin.c 851 2004-01-05 23:59:28Z stefan $
*/
return local_exceptionptr;
}
+java_objectheader *builtin_get_exceptionptr()
+{
+#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#ifdef HAVE___THREAD
+ return exceptionptr;
+#else
+ pthread_getspecific(tkey_exceptionptr);
+#endif
+#else
+ panic("builtin_get_exceptionptr should not be used in this configuration");
+ return NULL;
+#endif
+}
+
+void builtin_set_exceptionptr(java_objectheader *e)
+{
+#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#ifdef HAVE___THREAD
+ exceptionptr = e;
+#else
+ pthread_setspecific(tkey_exceptionptr, e);
+#endif
+#else
+ panic("builtin_set_exceptionptr should not be used in this configuration");
+#endif
+}
+
/******************* function: builtin_canstore *******************************
Changes: Edwin Steiner
- $Id: builtin.h 821 2003-12-31 14:14:01Z twisti $
+ $Id: builtin.h 851 2004-01-05 23:59:28Z stefan $
*/
int *pos, int noindent);
/* NOT AN OP */
+java_objectheader *builtin_get_exceptionptr();
+/* NOT AN OP */
+void builtin_set_exceptionptr(java_objectheader*);
+/* NOT AN OP */
+
java_objectheader *builtin_new(classinfo *c);
#define BUILTIN_new (functionptr) builtin_new
*/
+#include "global.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#if defined(NATIVE_THREADS)
pthread_mutex_t cast_mutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_t compiler_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t compiler_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+
+int cast_counter;
+
+#ifndef HAVE___THREAD
+pthread_key_t tkey_exceptionptr;
+#endif
#endif
static classinfo *class_java_lang_ThreadDeath;
void
initThreads(u1 *stackbottom)
{
+#if defined(NATIVE_THREADS) && !defined(HAVE___THREAD)
+ pthread_key_create(&tkey_exceptionptr, NULL);
+#endif
+
thread *the_main_thread;
int i;
char mainname[] = "main";
checkEvents(true);
}
}
+
+void cast_lock()
+{
+}
+
+void cast_unlock()
+{
+}
void asm_perform_threadswitch(u1 **from, u1 **to, u1 **stackTop);
u1* asm_initialize_thread_stack(void *func, u1 *stack);
+#if defined(NATIVE_THREADS) && !defined(HAVE___THREAD)
+extern pthread_key_t tkey_exceptionptr;
+#endif
+
#else
#define intsDisable()
calls instead of machine instructions, using the C calling
convention.
- $Id: builtin.c 793 2003-12-16 18:50:39Z edwin $
+ $Id: builtin.c 851 2004-01-05 23:59:28Z stefan $
*/
return local_exceptionptr;
}
+java_objectheader *builtin_get_exceptionptr()
+{
+#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#ifdef HAVE___THREAD
+ return exceptionptr;
+#else
+ pthread_getspecific(tkey_exceptionptr);
+#endif
+#else
+ panic("builtin_get_exceptionptr should not be used in this configuration");
+ return NULL;
+#endif
+}
+
+void builtin_set_exceptionptr(java_objectheader *e)
+{
+#if defined(USE_THREADS) && defined(NATIVE_THREADS)
+#ifdef HAVE___THREAD
+ exceptionptr = e;
+#else
+ pthread_setspecific(tkey_exceptionptr, e);
+#endif
+#else
+ panic("builtin_set_exceptionptr should not be used in this configuration");
+#endif
+}
+
/******************* function: builtin_canstore *******************************
Changes: Edwin Steiner
- $Id: builtin.h 821 2003-12-31 14:14:01Z twisti $
+ $Id: builtin.h 851 2004-01-05 23:59:28Z stefan $
*/
int *pos, int noindent);
/* NOT AN OP */
+java_objectheader *builtin_get_exceptionptr();
+/* NOT AN OP */
+void builtin_set_exceptionptr(java_objectheader*);
+/* NOT AN OP */
+
java_objectheader *builtin_new(classinfo *c);
#define BUILTIN_new (functionptr) builtin_new
*/
+#include "global.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#if defined(NATIVE_THREADS)
pthread_mutex_t cast_mutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_t compiler_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t compiler_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+
+int cast_counter;
+
+#ifndef HAVE___THREAD
+pthread_key_t tkey_exceptionptr;
+#endif
#endif
static classinfo *class_java_lang_ThreadDeath;
void
initThreads(u1 *stackbottom)
{
+#if defined(NATIVE_THREADS) && !defined(HAVE___THREAD)
+ pthread_key_create(&tkey_exceptionptr, NULL);
+#endif
+
thread *the_main_thread;
int i;
char mainname[] = "main";
checkEvents(true);
}
}
+
+void cast_lock()
+{
+}
+
+void cast_unlock()
+{
+}
void asm_perform_threadswitch(u1 **from, u1 **to, u1 **stackTop);
u1* asm_initialize_thread_stack(void *func, u1 *stack);
+#if defined(NATIVE_THREADS) && !defined(HAVE___THREAD)
+extern pthread_key_t tkey_exceptionptr;
+#endif
+
#else
#define intsDisable()