CACAO
StackSlotManager.cpp
Go to the documentation of this file.
1 /* src/vm/jit/compiler2/StackSlotManager.cpp - StackSlotManager
2 
3  Copyright (C) 2013
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 #include <algorithm>
26 
30 
31 namespace cacao {
32 namespace jit {
33 namespace compiler2 {
34 
36  while (!slots.empty()) {
37  ManagedStackSlot *slot = slots.back();
38  slots.pop_back();
39  delete slot;
40  }
41 
42  while (!argument_slots.empty()) {
44  argument_slots.pop_back();
45  delete slot;
46  }
47 }
48 
50  slots.push_back(new ManagedStackSlot(this, type));
51  return slots.back();
52 }
53 
56  auto slot = new ManagedStackSlot(this, type);
57  slot->set_index(index);
58  argument_slots.push_back(slot);
59  return slot;
60 }
61 
64  for (auto slot : slots) {
65  slot->set_index(next_index++);
66  }
67 }
68 
71 }
72 
75 }
76 
77 } // end namespace compiler2
78 } // end namespace jit
79 } // end namespace cacao
80 
81 
82 /*
83  * These are local overrides for various environment variables in Emacs.
84  * Please do not remove this and leave it at the end of the file, where
85  * Emacs will automagically detect them.
86  * ---------------------------------------------------------------------
87  * Local variables:
88  * mode: c++
89  * indent-tabs-mode: t
90  * c-basic-offset: 4
91  * tab-width: 4
92  * End:
93  * vim:noexpandtab:sw=4:ts=4:
94  */
jlong jlong jlong jlong jint jmethodID jint slot
Definition: jvmti.h:497
std::size_t index
ManagedStackSlot * create_slot(Type::TypeID type)
Create a ManagedStackSlot.
#define max(a, b)
Definition: lsra.hpp:80
u4 number_of_machine_argument_slots
The number of argument slots at machine-level.
void finalize()
Assigns each ManagedStackSlot a position in the virtual frame.
ManagedStackSlot * create_argument_slot(Type::TypeID type, u4 index)
Create a ManagedStackSlot for an invocation argument.
A &quot;virtual&quot; slot that will eventually be mapped to a machine-level slot.
#define SIZE_OF_STACKSLOT
Definition: simplereg.cpp:80
uint32_t u4
Definition: types.hpp:46