* src/vm/jit/codegen-common.cpp, src/vm/jit/x86_64/codegen.c: Generate
[cacao.git] / src / vm / jit / executionstate.h
1 /* src/vm/jit/executionstate.h - execution-state handling
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 _EXECUTIONSTATE_H
27 #define _EXECUTIONSTATE_H
28
29 /* forward typedefs ***********************************************************/
30
31 typedef struct executionstate_t executionstate_t;
32
33
34 #include "config.h"
35
36 #include <stdint.h>
37
38 #include "arch.h"
39 #include "md-abi.h"
40
41 #include "vm/jit/code.hpp"
42
43
44 /* executionstate_t ************************************************************
45
46    An execution-state represents the state of a thread containing all
47    registers that are important.  This structure is an internal
48    structure similar to mcontext_t.
49
50 *******************************************************************************/
51
52 struct executionstate_t {
53         uint8_t   *pc;                                         /* program counter */
54         uint8_t   *sp;                             /* stack pointer within method */
55         uint8_t   *pv;                             /* procedure value. NULL means */
56                                                    /* search the AVL tree         */
57         uint8_t   *ra;                          /* return address / link register */
58
59         uintptr_t  intregs[INT_REG_CNT];                       /* register values */
60         double     fltregs[FLT_REG_CNT];                       /* register values */
61 #if defined(HAS_ADDRESS_REGISTER_FILE)
62         uintptr_t  adrregs[ADR_REG_CNT];                       /* register values */
63 #endif
64
65         codeinfo  *code;                      /* codeinfo corresponding to the pv */
66 };
67
68
69 /* prototypes *****************************************************************/
70
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74
75 #if !defined(NDEBUG)
76 void executionstate_sanity_check(void *context);
77 void executionstate_println(executionstate_t *es);
78 #endif
79
80 /* Machine and OS dependent functions (code in ARCH_DIR/OS_DIR/md-os.c) */
81
82 void md_executionstate_read(executionstate_t *es, void *ucontext);
83 void md_executionstate_write(executionstate_t *es, void *ucontext);
84
85 #ifdef __cplusplus
86 }
87 #endif
88
89 #endif /* _EXECUTIONSTATE_H */
90
91
92 /*
93  * These are local overrides for various environment variables in Emacs.
94  * Please do not remove this and leave it at the end of the file, where
95  * Emacs will automagically detect them.
96  * ---------------------------------------------------------------------
97  * Local variables:
98  * mode: c
99  * indent-tabs-mode: t
100  * c-basic-offset: 4
101  * tab-width: 4
102  * End:
103  * vim:noexpandtab:sw=4:ts=4:
104  */