Added support for fused math-assign ops (+=, etc).
2 * Copyright (C) 2012 David Anderson
4 * This file is part of JITCraft.
6 * JITCraft is free software: you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License as published by the Free
8 * Software Foundation, either version 3 of the License, or (at your option)
11 * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * JITCraft. If not, see http://www.gnu.org/licenses/.
18 #ifndef _include_jc_stack_h_
19 #define _include_jc_stack_h_
46 Top(LocalSlot *sp, bytecode *pc)
64 Address lifoPosition_;
67 Frame(Frame *prev, bytecode *prevpc, Code *code, Address lifoPosition)
71 lifoPosition_(lifoPosition)
76 return reinterpret_cast<LocalSlot *>(this + 1);
78 LocalSlot *stackBase() {
79 return locals() + code_->nlocals();
87 bytecode *prevpc() const {
90 Address lifoPosition() const {
93 LocalSlot &arg(unsigned slot) {
94 assert(slot < code()->nargs());
95 return *(reinterpret_cast<LocalSlot *>(this) - slot - 1);
106 static const size_t STACK_SIZE = 1024 * 1024;
115 Frame *pushFrame(Frame *prev, Code *code);
116 Frame *popFrame(Frame *frame);
121 void setTop(Top *top) {
125 return Top((LocalSlot *)buffer_);
131 #endif // _include_jc_stack_h_