* Moved all files from vmcore/ to vm/.
[cacao.git] / src / vm / jit / linenumbertable.h
1 /* src/vm/jit/linenumbertable.h - linenumber table
2
3    Copyright (C) 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 _LINENUMBERTABLE_H
27 #define _LINENUMBERTABLE_H
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /* forward typedefs ***********************************************************/
34
35 typedef struct linenumbertable_t            linenumbertable_t;
36 typedef struct linenumbertable_entry_t      linenumbertable_entry_t;
37 typedef struct linenumbertable_list_entry_t linenumbertable_list_entry_t;
38
39
40 #include "config.h"
41
42 #include <stdint.h>
43
44 #include "toolbox/list.h"
45
46 #include "vm/method.h"
47
48 #include "vm/jit/jit.h"
49 #include "vm/jit/code.h"
50 #include "vm/jit/codegen-common.h"
51
52
53 /* linenumbertable_t **********************************************************/
54
55 struct linenumbertable_t {
56         int32_t                  length;    /* length of the entries array        */
57         linenumbertable_entry_t *entries;   /* actual linenumber entries          */
58 };
59
60
61 /* linenumbertable_entry_t *****************************************************
62
63    NOTE: See doc/inlining_stacktrace.txt for special meanings of line
64    and pc.
65
66 *******************************************************************************/
67
68 struct linenumbertable_entry_t {
69         int32_t  linenumber;                /* linenumber of this entry           */
70         void    *pc;                        /* PC where this linenumber starts    */
71 };
72
73
74 /* linenumbertable_list_entry_t ***********************************************/
75
76 struct linenumbertable_list_entry_t {
77         int32_t    linenumber;      /* line number, used for inserting into the   */
78                                     /* table and for validity checking            */
79                                     /* -1......start of inlined body              */
80                                     /* -2......end of inlined body                */
81                                     /* <= -3...special entry with methodinfo *    */
82                                                                 /* (see doc/inlining_stacktrace.txt)          */
83         ptrint     mpc;             /* machine code program counter of first      */
84                                     /* instruction for given line                 */
85                                     /* NOTE: for linenumber <= -3 this is a the   */
86                                     /* (methodinfo *) of the inlined method       */
87         listnode_t linkage;
88 };
89
90
91 /* function prototypes ********************************************************/
92
93 void    linenumbertable_create(jitdata *jd);
94
95 void    linenumbertable_list_entry_add(codegendata *cd, int32_t linenumber);
96 void    linenumbertable_list_entry_add_inline_start(codegendata *cd, instruction *iptr);
97 void    linenumbertable_list_entry_add_inline_end(codegendata *cd, instruction *iptr);
98
99 int32_t linenumbertable_linenumber_for_pc(methodinfo **pm, codeinfo *code, void *pc);
100
101 #ifdef __cplusplus
102 }
103 #endif
104
105 #endif /* _LINENUMBERTABLE_H */
106
107
108 /*
109  * These are local overrides for various environment variables in Emacs.
110  * Please do not remove this and leave it at the end of the file, where
111  * Emacs will automagically detect them.
112  * ---------------------------------------------------------------------
113  * Local variables:
114  * mode: c
115  * indent-tabs-mode: t
116  * c-basic-offset: 4
117  * tab-width: 4
118  * End:
119  * vim:noexpandtab:sw=4:ts=4:
120  */