+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
+}
+