CACAO
executionstate.hpp
Go to the documentation of this file.
1 /* src/vm/jit/executionstate.hpp - execution-state handling
2 
3  Copyright (C) 2007, 2008, 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 EXECUTIONSTATE_HPP_
27 #define EXECUTIONSTATE_HPP_ 1
28 
29 #include <stdint.h> // for uint8_t, uint64_t, etc
30 #include "config.h"
31 #include "arch.hpp"
32 #include "md-abi.hpp"
33 #include "vm/global.hpp" // for java_handle_t
34 
35 struct codeinfo;
36 struct executionstate_t;
37 
38 /* configuration of native stack slot size ************************************/
39 
40 #define SIZE_OF_STACKSLOT 8
41 #define STACK_SLOTS_PER_FLOAT 1
42 typedef uint64_t stackslot_t;
43 
44 
45 /* executionstate_t ************************************************************
46 
47  An execution-state represents the state of a thread containing all
48  registers that are important. This structure is an internal
49  structure similar to mcontext_t.
50 
51 *******************************************************************************/
52 
54  uint8_t *pc; /* program counter */
55  uint8_t *sp; /* stack pointer within method */
56  uint8_t *pv; /* procedure value. NULL means */
57  /* search the AVL tree */
58  uint8_t *ra; /* return address / link register */
59 
60  uintptr_t intregs[INT_REG_CNT]; /* register values */
61 
62 #if defined(__AARCH64__)
63  long double fltregs[FLT_REG_CNT]; /* on aarch64 FP registers are 128 bit */
64 #else
65  double fltregs[FLT_REG_CNT]; /* register values */
66 #endif
67 
68  codeinfo *code; /* codeinfo corresponding to the pv */
69 };
70 
71 
72 /* prototypes *****************************************************************/
73 
75 
77 
78 #if !defined(NDEBUG)
79 void executionstate_sanity_check(void *context);
81 #endif
82 
83 /* Machine and OS dependent functions (code in ARCH_DIR/OS_DIR/md-os.c) */
84 
87 
88 #endif // EXECUTIONSTATE_HPP_
89 
90 
91 /*
92  * These are local overrides for various environment variables in Emacs.
93  * Please do not remove this and leave it at the end of the file, where
94  * Emacs will automagically detect them.
95  * ---------------------------------------------------------------------
96  * Local variables:
97  * mode: c++
98  * indent-tabs-mode: t
99  * c-basic-offset: 4
100  * tab-width: 4
101  * End:
102  * vim:noexpandtab:sw=4:ts=4:
103  */
void executionstate_pop_stackframe(executionstate_t *es)
Restore callee-saved registers (including the RA register), set the stack pointer to the next stackfr...
#define INT_REG_CNT
Definition: md-abi.hpp:72
void executionstate_println(executionstate_t *es)
void executionstate_unwind_exception(executionstate_t *es, java_handle_t *e)
Performs stack unwinding in case of an exception.
void md_executionstate_write(executionstate_t *es, void *context)
Definition: md-os.cpp:147
MIIterator e
void md_executionstate_read(executionstate_t *es, void *context)
Definition: md-os.cpp:107
void executionstate_sanity_check(void *context)
uintptr_t intregs[INT_REG_CNT]
double fltregs[FLT_REG_CNT]
uint64_t stackslot_t
#define FLT_REG_CNT
Definition: md-abi.hpp:79