/*
* Copyright 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_SHARK_SHARKSTACK_HPP
#define SHARE_VM_SHARK_SHARKSTACK_HPP
#include "shark/llvmHeaders.hpp"
#include "shark/sharkInvariants.hpp"
#include "shark/sharkType.hpp"
class SharkFunction;
class SharkNativeWrapper;
class SharkStackWithNormalFrame;
class SharkStackWithNativeFrame;
public:
static SharkStack* CreateBuildAndPushFrame(
static SharkStack* CreateBuildAndPushFrame(
protected:
: SharkCompileInvariants(parent) {}
protected:
protected:
// Properties of the method being compiled
protected:
virtual int arg_size() const = 0;
virtual int max_locals() const = 0;
virtual int max_stack() const = 0;
virtual int max_monitors() const = 0;
// BasicBlock creation
protected:
// Interpreter entry point for bailouts
protected:
virtual address interpreter_entry_point() const = 0;
// Interface with the Zero stack
private:
return builder()->CreateAddressOfStructEntry(
thread(),
"zero_stack");
}
return builder()->CreateValueOfStructEntry(
zero_stack(),
ZeroStack::base_offset(),
SharkType::intptr_type(),
"stack_base");
}
return builder()->CreateAddressOfStructEntry(
zero_stack(),
"stack_pointer_addr");
}
return builder()->CreateAddressOfStructEntry(
thread(),
"frame_pointer_addr");
}
public:
}
}
}
}
// Interface with the frame anchor
private:
return builder()->CreateAddressOfStructEntry(
thread(),
"last_Java_sp_addr");
}
return builder()->CreateAddressOfStructEntry(
thread(),
"last_Java_fp_addr");
}
public:
void CreateSetLastJavaFrame() {
// Note that whenever _last_Java_sp != NULL other anchor fields
// must be valid. The profiler apparently depends on this.
// XXX There's last_Java_pc as well, but I don't think anything uses it
// Also XXX: should we fence here? Zero doesn't...
// Also also XXX: we could probably cache the sp (and the fp we know??)
}
void CreateResetLastJavaFrame() {
}
private:
// Our method's frame
private:
int _extended_frame_size;
int _stack_slots_offset;
public:
int extended_frame_size() const {
return _extended_frame_size;
}
int oopmap_frame_size() const {
return extended_frame_size() - arg_size();
}
// Offsets of things in the frame
private:
int _oop_tmp_slot_offset;
int _method_slot_offset;
int _pc_slot_offset;
int _locals_slots_offset;
public:
int stack_slots_offset() const {
return _stack_slots_offset;
}
int oop_tmp_slot_offset() const {
return _oop_tmp_slot_offset;
}
int method_slot_offset() const {
return _method_slot_offset;
}
int pc_slot_offset() const {
return _pc_slot_offset;
}
int locals_slots_offset() const {
return _locals_slots_offset;
}
return _monitors_slots_offset +
}
return monitor_offset(index) +
}
return monitor_offset(index) +
}
// Addresses of things in the frame
public:
const char* name = "") const;
return slot_addr(
"monitor");
}
return slot_addr(
"object_addr");
}
return slot_addr(
SharkType::intptr_type(),
"displaced_header_addr");
}
// oopmap helpers
public:
}
}
};
friend class SharkStack;
protected:
private:
private:
return _function;
}
// Properties of the method being compiled
private:
int arg_size() const;
int max_locals() const;
int max_stack() const;
int max_monitors() const;
// BasicBlock creation
private:
// Interpreter entry point for bailouts
private:
address interpreter_entry_point() const;
};
friend class SharkStack;
protected:
private:
private:
return _wrapper;
}
// Properties of the method being compiled
private:
int arg_size() const;
int max_locals() const;
int max_stack() const;
int max_monitors() const;
// BasicBlock creation
private:
// Interpreter entry point for bailouts
private:
address interpreter_entry_point() const;
};
#endif // SHARE_VM_SHARK_SHARKSTACK_HPP