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