1 // execution.h - Execution engines. -*- c++ -*-
3 /* Copyright (C) 2004 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
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
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);
27 void (*create_ncode
) (jclass
);
28 _Jv_ResolvedMethod
*(*resolve_method
) (_Jv_Method
*, jclass
,
30 void (*post_miranda_hook
) (jclass
);
33 // This handles all gcj-compiled code, including BC ABI.
34 struct _Jv_CompiledEngine
: public _Jv_ExecutionEngine
38 static void do_unregister (jclass
)
42 static bool do_need_resolve_string_fields ()
47 static void do_verify (jclass klass
)
49 _Jv_Linker::verify_type_assertions (klass
);
52 static _Jv_ResolvedMethod
*do_resolve_method (_Jv_Method
*, jclass
,
58 static void do_allocate_static_fields (jclass
, int)
60 // Compiled classes don't need this.
63 static void do_create_ncode (jclass
)
68 static void do_post_miranda_hook (jclass
)
75 unregister
= do_unregister
;
76 need_resolve_string_fields
= do_need_resolve_string_fields
;
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
)
96 // This handles interpreted code.
97 class _Jv_InterpreterEngine
: public _Jv_ExecutionEngine
101 static void do_verify (jclass
);
102 static void do_allocate_static_fields (jclass
, int);
103 static void do_create_ncode (jclass
);
104 static _Jv_ResolvedMethod
*do_resolve_method (_Jv_Method
*, jclass
,
107 static bool do_need_resolve_string_fields ()
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
;
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
)
143 extern _Jv_InterpreterEngine _Jv_soleInterpreterEngine
;
144 extern _Jv_CompiledEngine _Jv_soleCompiledEngine
;
146 #endif // __JAVA_EXECUTION_H__