* src/vm/jit/trap.cpp (trap_handle): Adapted to support "reusable trap points".
[cacao.git] / src / vm / hook.hpp
1 /* src/vm/hook.hpp - hook points inside the VM
2
3    Copyright (C) 2009
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 _HOOK_HPP
27 #define _HOOK_HPP
28
29 #include "config.h"
30
31
32 /**
33  * Hook points are inline functions acting as probes scattered throughout
34  * several VM subsystems. They can be used to implement event generation
35  * or statistics gathering without polluting the source code. Hence all
36  * compiler macro and runtime checks should be done in this file. One
37  * example of where hooks are useful is JVMTI event firing.
38  */
39 namespace Hook {
40         void breakpoint     (Breakpoint *bp);
41         void class_linked   (classinfo *c);
42         void class_loaded   (classinfo *c);
43         void method_enter   (methodinfo *m);
44         void method_exit    (methodinfo *m);
45         void method_unwind  (methodinfo *m);
46         void native_resolved(methodinfo *m, void *symbol, void **symbolptr);
47         void thread_start   (threadobject *t);
48         void thread_end     (threadobject *t);
49         void vm_init        ();
50 }
51
52
53 inline void Hook::breakpoint(Breakpoint *bp)
54 {
55 #if defined(ENABLE_JVMTI)
56         methodinfo* m = bp->method;
57         int32_t     l = bp->location;
58
59         log_message_method("JVMTI: Reached breakpoint in method ", m);
60         log_println("JVMTI: Reached breakpoint at location %d", l);
61 #endif
62 }
63
64 inline void Hook::class_linked(classinfo *c)
65 {
66         /* nop */
67 }
68
69 inline void Hook::class_loaded(classinfo *c)
70 {
71         /* nop */
72 }
73
74 inline void Hook::method_enter(methodinfo *m)
75 {
76         /* nop */
77 }
78
79 inline void Hook::method_exit(methodinfo *m)
80 {
81         /* nop */
82 }
83
84 inline void Hook::method_unwind(methodinfo *m)
85 {
86         /* nop */
87 }
88
89 inline void Hook::native_resolved(methodinfo *m, void *symbol, void **symbolptr)
90 {
91         /* nop */
92 }
93
94 inline void Hook::thread_start(threadobject *t)
95 {
96         /* nop */
97 }
98
99 inline void Hook::thread_end(threadobject *t)
100 {
101         /* nop */
102 }
103
104 inline void Hook::vm_init()
105 {
106         /* nop */
107 }
108
109
110 #endif /* _HOOK_HPP */
111
112
113 /*
114  * These are local overrides for various environment variables in Emacs.
115  * Please do not remove this and leave it at the end of the file, where
116  * Emacs will automagically detect them.
117  * ---------------------------------------------------------------------
118  * Local variables:
119  * mode: c++
120  * indent-tabs-mode: t
121  * c-basic-offset: 4
122  * tab-width: 4
123  * End:
124  * vim:noexpandtab:sw=4:ts=4:
125  */