Merged with tip.
[cacao.git] / src / threads / none / thread-none.h
1 /* src/threads/none/thread-none.h - fake threads header
2
3    Copyright (C) 1996-2005, 2006, 2007, 2008
4    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5
6    This file is part of CACAO.
7
8    This program is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2, or (at
11    your option) any later version.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23 */
24
25
26 #ifndef _THREAD_NONE_H
27 #define _THREAD_NONE_H
28
29 #include "config.h"
30
31 #include <stdint.h>
32
33 #include "vm/types.h"
34
35 #include "vm/builtin.h"
36
37 #include "vm/jit/stacktrace.h"
38
39
40 /* define some stuff we need to no-ops ****************************************/
41
42 #define THREADSPECIFIC
43 #define THREADOBJECT      NULL
44 #define THREADINFO        NULL
45
46 #define threadobject      void
47
48
49 /* native-world flags *********************************************************/
50
51 #define THREAD_NATIVEWORLD_ENTER /*nop*/
52 #define THREAD_NATIVEWORLD_EXIT  /*nop*/
53
54
55 #if defined(ENABLE_DEBUG_FILTER)
56 extern u2 _no_threads_filterverbosecallctr[2];
57 #define FILTERVERBOSECALLCTR (_no_threads_filterverbosecallctr)
58 #endif
59
60 /* state for trace java call **************************************************/
61
62 #if !defined(NDEBUG)
63 extern s4 _no_threads_tracejavacallindent;
64 #define TRACEJAVACALLINDENT (_no_threads_tracejavacallindent)
65
66 extern u4 _no_threads_tracejavacallcount;
67 #define TRACEJAVACALLCOUNT (_no_threads_tracejavacallcount)
68 #endif
69
70
71 /* global variables ***********************************************************/
72
73 extern stackframeinfo_t *_no_threads_stackframeinfo;
74
75
76 /* inline functions ***********************************************************/
77
78 inline static java_handle_t *thread_get_current_object(void)
79 {
80         java_handle_t *o;
81
82         /* We return a fake java.lang.Thread object, otherwise we get
83            NullPointerException's in GNU Classpath. */
84
85         o = builtin_new(class_java_lang_Thread);
86
87         return o;
88 }
89
90 inline static stackframeinfo_t *threads_get_current_stackframeinfo(void)
91 {
92         return _no_threads_stackframeinfo;
93 }
94
95 inline static void threads_set_current_stackframeinfo(stackframeinfo_t *sfi)
96 {
97         _no_threads_stackframeinfo = sfi;
98 }
99
100 #endif /* _THREAD_NONE_H */
101
102
103 /*
104  * These are local overrides for various environment variables in Emacs.
105  * Please do not remove this and leave it at the end of the file, where
106  * Emacs will automagically detect them.
107  * ---------------------------------------------------------------------
108  * Local variables:
109  * mode: c
110  * indent-tabs-mode: t
111  * c-basic-offset: 4
112  * tab-width: 4
113  * End:
114  */