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 
27 
28 namespace cacao {
29 namespace jit {
30 namespace compiler2 {
31 
33  for( StackSlotListTy::iterator i = slots.begin(),
34  e = slots.begin(); i != e; ) {
35  delete i->first;
36  delete i->second;
37  }
38 }
39 
41  ManagedStackSlot* mslot = new ManagedStackSlot(this, counter, type);
42  slots.insert(std::make_pair(mslot, new StackSlot(-counter, type)));
43  counter++;
44  return mslot;
45 }
46 
48  // TODO compress stack
49  // for now we only us 8 byte slots
50  return slots.size() * 8;
51 }
52 
54  StackSlotListTy::const_iterator i = slots.find(MSS);
55  if (i == slots.end()) {
56  return NULL;
57  }
58  return i->second;
59 }
60 
61 } // end namespace compiler2
62 } // end namespace jit
63 } // end namespace cacao
64 
65 
66 /*
67  * These are local overrides for various environment variables in Emacs.
68  * Please do not remove this and leave it at the end of the file, where
69  * Emacs will automagically detect them.
70  * ---------------------------------------------------------------------
71  * Local variables:
72  * mode: c++
73  * indent-tabs-mode: t
74  * c-basic-offset: 4
75  * tab-width: 4
76  * End:
77  * vim:noexpandtab:sw=4:ts=4:
78  */
u4 get_frame_size() const
get the size of the stack frame in bytes
ManagedStackSlot * create_ManagedStackSlot(Type::TypeID type)
create a new managed stack slot
MIIterator i
MIIterator e
uint32_t u4
Definition: types.hpp:46
StackSlot * get_StackSlot(ManagedStackSlot *MSS)
get a stack slot from a managed stack slot