CACAO
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
source
cacao
src
vm
jit
stack.hpp
Go to the documentation of this file.
1
/* src/vm/jit/stack.hpp - stack analysis header
2
3
Copyright (C) 1996-2014
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 STACK_HPP_
27
#define STACK_HPP_ 1
28
29
#include "config.h"
// for ENABLE_VERIFIER
30
#include <stdint.h>
31
#include "
vm/global.hpp
"
// for Type
32
33
struct
instruction
;
34
struct
jitdata
;
35
36
/* stack element structure ****************************************************/
37
38
enum
VariableFlag
{
39
SAVEDVAR
= 1,
// variable has to survive method invocations
40
INMEMORY
= 2,
// variable stored in memory
41
SAVREG
= 4,
// allocated to a saved register
42
ARGREG
= 8,
// allocated to an arg register
43
PASSTHROUGH
= 32,
// stackslot was passed-through by an ICMD
44
PREALLOC
= 64,
// preallocated var like for ARGVARS.
45
// Used with the new var system
46
INOUT
= 128
// variable is an invar or/and an outvar
47
};
48
49
// check flags
50
static
inline
bool
IS_SAVEDVAR
(
s4
flags
) {
return
flags &
SAVEDVAR
; }
51
static
inline
bool
IS_INMEMORY
(
s4
flags
) {
return
flags &
INMEMORY
; }
52
53
54
enum
VariableKind
{
55
UNDEFVAR
= 0,
// stack slot will become temp during regalloc
56
TEMPVAR
= 1,
// stack slot is temp register
57
STACKVAR
= 2,
// stack slot is numbered stack slot
58
LOCALVAR
= 3,
// stack slot is local variable
59
ARGVAR
= 4
// stack slot is argument variable
60
};
61
62
/* variable kinds */
63
struct
stackelement_t
{
64
stackelement_t
*
prev
;
/* pointer to next element towards bottom */
65
instruction
*
creator
;
/* instruction that created this element */
66
Type
type
;
/* slot type of stack element */
67
int32_t
flags
;
/* flags (SAVED, INMEMORY) */
68
VariableKind
varkind
;
/* kind of variable or register */
69
int32_t
varnum
;
/* number of variable */
70
};
71
72
73
/* function prototypes ********************************************************/
74
75
bool
stack_init
(
void
);
76
77
bool
stack_analyse
(
jitdata
*jd);
78
79
void
stack_javalocals_store
(
instruction
*iptr, int32_t *javalocals);
80
81
#endif // STACK_HPP_
82
83
84
/*
85
* These are local overrides for various environment variables in Emacs.
86
* Please do not remove this and leave it at the end of the file, where
87
* Emacs will automagically detect them.
88
* ---------------------------------------------------------------------
89
* Local variables:
90
* mode: c++
91
* indent-tabs-mode: t
92
* c-basic-offset: 4
93
* tab-width: 4
94
* End:
95
* vim:noexpandtab:sw=4:ts=4:
96
*/
STACKVAR
Definition:
stack.hpp:57
PASSTHROUGH
Definition:
stack.hpp:43
SAVREG
Definition:
stack.hpp:41
jitdata
Definition:
jit.hpp:126
INOUT
Definition:
stack.hpp:46
VariableKind
VariableKind
Definition:
stack.hpp:54
VariableFlag
VariableFlag
Definition:
stack.hpp:38
ARGREG
Definition:
stack.hpp:42
stack_init
bool stack_init(void)
Definition:
stack.cpp:666
stackelement_t::type
Type type
Definition:
stack.hpp:66
jitdata::flags
u4 flags
Definition:
jit.hpp:138
stackelement_t::flags
int32_t flags
Definition:
stack.hpp:67
ARGVAR
Definition:
stack.hpp:59
stackelement_t
Definition:
stack.hpp:63
stackelement_t::prev
stackelement_t * prev
Definition:
stack.hpp:64
INMEMORY
Definition:
stack.hpp:40
instruction
Definition:
instruction.hpp:147
UNDEFVAR
Definition:
stack.hpp:55
stackelement_t::creator
instruction * creator
Definition:
stack.hpp:65
stack_analyse
bool stack_analyse(jitdata *jd)
Definition:
stack.cpp:2144
IS_SAVEDVAR
static bool IS_SAVEDVAR(s4 flags)
Definition:
stack.hpp:50
Type
Type
Types used internally by JITTED code.
Definition:
global.hpp:117
TEMPVAR
Definition:
stack.hpp:56
PREALLOC
Definition:
stack.hpp:44
LOCALVAR
Definition:
stack.hpp:58
s4
int32_t s4
Definition:
types.hpp:45
stackelement_t::varkind
VariableKind varkind
Definition:
stack.hpp:68
stack_javalocals_store
void stack_javalocals_store(instruction *iptr, s4 *javalocals)
Definition:
stack.cpp:4692
IS_INMEMORY
static bool IS_INMEMORY(s4 flags)
Definition:
stack.hpp:51
global.hpp
stackelement_t::varnum
int32_t varnum
Definition:
stack.hpp:69
SAVEDVAR
Definition:
stack.hpp:39
Generated on Fri Aug 4 2017 03:01:50 for CACAO by
1.8.5