* Mainline merge as of 2006-02-16 (@111136).
[official-gcc.git] / libjava / include / execution.h
blob88189f6449ec263646df103ff12e9477e03ab308
1 // execution.h - Execution engines. -*- c++ -*-
3 /* Copyright (C) 2004, 2006 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 details. */
11 #ifndef __JAVA_EXECUTION_H__
12 #define __JAVA_EXECUTION_H__
14 // This represents one execution engine. Note that we use function
15 // pointers and not virtual methods to avoid calls to
16 // __cxa_call_unexpected and the like.
17 struct _Jv_ExecutionEngine
19 public:
21 void (*unregister) (jclass);
22 // FIXME: probably should handle this elsewhere, see how
23 // interpreter does it.
24 bool (*need_resolve_string_fields) ();
25 void (*verify) (jclass);
26 void (*allocate_static_fields) (jclass, int, int);
27 void (*create_ncode) (jclass);
28 _Jv_ResolvedMethod *(*resolve_method) (_Jv_Method *, jclass,
29 jboolean, jint);
30 void (*post_miranda_hook) (jclass);
33 // This handles all gcj-compiled code, including BC ABI.
34 struct _Jv_CompiledEngine : public _Jv_ExecutionEngine
36 public:
38 static void do_unregister (jclass)
42 static bool do_need_resolve_string_fields ()
44 return true;
47 static void do_verify (jclass klass)
49 _Jv_Linker::verify_type_assertions (klass);
52 static _Jv_ResolvedMethod *do_resolve_method (_Jv_Method *, jclass,
53 jboolean, jint)
55 return NULL;
58 static void do_allocate_static_fields (jclass, int, int)
60 // Compiled classes don't need this.
63 static void do_create_ncode (jclass)
65 // Not needed.
68 static void do_post_miranda_hook (jclass)
70 // Not needed.
73 _Jv_CompiledEngine ()
75 unregister = do_unregister;
76 need_resolve_string_fields = do_need_resolve_string_fields;
77 verify = do_verify;
78 allocate_static_fields = do_allocate_static_fields;
79 create_ncode = do_create_ncode;
80 resolve_method = do_resolve_method;
81 post_miranda_hook = do_post_miranda_hook;
84 // These operators make it so we don't have to link in libstdc++.
85 void *operator new (size_t bytes)
87 return _Jv_Malloc(bytes);
90 void operator delete (void *mem)
92 _Jv_Free(mem);
96 // This handles interpreted code.
97 class _Jv_InterpreterEngine : public _Jv_ExecutionEngine
99 public:
101 static void do_verify (jclass);
102 static void do_allocate_static_fields (jclass, int, int);
103 static void do_create_ncode (jclass);
104 static _Jv_ResolvedMethod *do_resolve_method (_Jv_Method *, jclass,
105 jboolean, jint);
107 static bool do_need_resolve_string_fields ()
109 return false;
112 static void do_unregister(jclass klass)
114 _Jv_UnregisterClass(klass);
117 static void do_post_miranda_hook (jclass);
119 _Jv_InterpreterEngine ()
121 unregister = do_unregister;
122 need_resolve_string_fields = do_need_resolve_string_fields;
123 verify = do_verify;
124 allocate_static_fields = do_allocate_static_fields;
125 create_ncode = do_create_ncode;
126 resolve_method = do_resolve_method;
127 post_miranda_hook = do_post_miranda_hook;
130 // These operators make it so we don't have to link in libstdc++.
131 void *operator new (size_t bytes)
133 return _Jv_Malloc(bytes);
136 void operator delete (void *mem)
138 _Jv_Free(mem);
143 extern _Jv_InterpreterEngine _Jv_soleInterpreterEngine;
144 extern _Jv_CompiledEngine _Jv_soleCompiledEngine;
146 #endif // __JAVA_EXECUTION_H__