1010N/A/*
1879N/A * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
2327N/A * Copyright 2007, 2008, 2011 Red Hat, Inc.
1010N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1010N/A *
1010N/A * This code is free software; you can redistribute it and/or modify it
1010N/A * under the terms of the GNU General Public License version 2 only, as
1010N/A * published by the Free Software Foundation.
1010N/A *
1010N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1010N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1010N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1010N/A * version 2 for more details (a copy is included in the LICENSE file that
1010N/A * accompanied this code).
1010N/A *
1010N/A * You should have received a copy of the GNU General Public License version
1010N/A * 2 along with this work; if not, write to the Free Software Foundation,
1010N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1010N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
1010N/A *
1010N/A */
1010N/A
1879N/A#ifndef CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_HPP
1879N/A#define CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_HPP
1879N/A
1010N/A// Platform specific for C++ based Interpreter
1010N/A
1010N/A#if defined(PPC) || defined(SPARC) || defined(IA64)
1010N/A#define LOTS_OF_REGS // Use plenty of registers
1010N/A#else
1010N/A#undef LOTS_OF_REGS // Loser platforms
1010N/A#endif
1010N/A
1010N/A private:
1010N/A interpreterState _self_link;
1010N/A
1010N/A public:
1010N/A inline void set_locals(intptr_t* new_locals) {
1010N/A _locals = new_locals;
1010N/A }
1010N/A inline void set_method(methodOop new_method) {
1010N/A _method = new_method;
1010N/A }
1010N/A inline interpreterState self_link() {
1010N/A return _self_link;
1010N/A }
1010N/A inline void set_self_link(interpreterState new_self_link) {
1010N/A _self_link = new_self_link;
1010N/A }
1010N/A inline interpreterState prev_link() {
1010N/A return _prev_link;
1010N/A }
1010N/A inline void set_prev_link(interpreterState new_prev_link) {
1010N/A _prev_link = new_prev_link;
1010N/A }
1010N/A inline void set_stack_limit(intptr_t* new_stack_limit) {
1010N/A _stack_limit = new_stack_limit;
1010N/A }
1010N/A inline void set_stack_base(intptr_t* new_stack_base) {
1010N/A _stack_base = new_stack_base;
1010N/A }
1010N/A inline void set_monitor_base(BasicObjectLock *new_monitor_base) {
1010N/A _monitor_base = new_monitor_base;
1010N/A }
1010N/A inline void set_thread(JavaThread* new_thread) {
1010N/A _thread = new_thread;
1010N/A }
1010N/A inline void set_constants(constantPoolCacheOop new_constants) {
1010N/A _constants = new_constants;
1010N/A }
1010N/A inline oop oop_temp() {
1010N/A return _oop_temp;
1010N/A }
1010N/A inline oop *oop_temp_addr() {
1010N/A return &_oop_temp;
1010N/A }
1010N/A inline void set_oop_temp(oop new_oop_temp) {
1010N/A _oop_temp = new_oop_temp;
1010N/A }
1010N/A inline address callee_entry_point() {
1010N/A return _result._to_call._callee_entry_point;
1010N/A }
1010N/A inline address osr_buf() {
1010N/A return _result._osr._osr_buf;
1010N/A }
1010N/A inline address osr_entry() {
1010N/A return _result._osr._osr_entry;
1010N/A }
1010N/A
1010N/A public:
1010N/A const char *name_of_field_at_address(address addr);
1010N/A
1010N/A// The frame manager handles this
1010N/A#define SET_LAST_JAVA_FRAME()
1010N/A#define RESET_LAST_JAVA_FRAME()
1010N/A
1010N/A// ZeroStack Implementation
1010N/A
1010N/A#undef STACK_INT
1010N/A#undef STACK_FLOAT
1010N/A#undef STACK_ADDR
1010N/A#undef STACK_OBJECT
1010N/A#undef STACK_DOUBLE
1010N/A#undef STACK_LONG
1010N/A
1010N/A#define GET_STACK_SLOT(offset) (*((intptr_t*) &topOfStack[-(offset)]))
1010N/A#define STACK_SLOT(offset) ((address) &topOfStack[-(offset)])
1010N/A#define STACK_ADDR(offset) (*((address *) &topOfStack[-(offset)]))
1010N/A#define STACK_INT(offset) (*((jint*) &topOfStack[-(offset)]))
1010N/A#define STACK_FLOAT(offset) (*((jfloat *) &topOfStack[-(offset)]))
1010N/A#define STACK_OBJECT(offset) (*((oop *) &topOfStack [-(offset)]))
1010N/A#define STACK_DOUBLE(offset) (((VMJavaVal64*) &topOfStack[-(offset)])->d)
1010N/A#define STACK_LONG(offset) (((VMJavaVal64 *) &topOfStack[-(offset)])->l)
1010N/A
1010N/A#define SET_STACK_SLOT(value, offset) (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value))
1010N/A#define SET_STACK_ADDR(value, offset) (*((address *)&topOfStack[-(offset)]) = (value))
1010N/A#define SET_STACK_INT(value, offset) (*((jint *)&topOfStack[-(offset)]) = (value))
1010N/A#define SET_STACK_FLOAT(value, offset) (*((jfloat *)&topOfStack[-(offset)]) = (value))
1010N/A#define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value))
1010N/A#define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value))
1010N/A#define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = \
1010N/A ((VMJavaVal64*)(addr))->d)
1010N/A#define SET_STACK_LONG(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value))
1010N/A#define SET_STACK_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = \
1010N/A ((VMJavaVal64*)(addr))->l)
1010N/A// JavaLocals implementation
1010N/A
1010N/A#define LOCALS_SLOT(offset) ((intptr_t*)&locals[-(offset)])
1010N/A#define LOCALS_ADDR(offset) ((address)locals[-(offset)])
1010N/A#define LOCALS_INT(offset) (*((jint*)&locals[-(offset)]))
1010N/A#define LOCALS_FLOAT(offset) (*((jfloat*)&locals[-(offset)]))
1010N/A#define LOCALS_OBJECT(offset) ((oop)locals[-(offset)])
1010N/A#define LOCALS_DOUBLE(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->d)
1010N/A#define LOCALS_LONG(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->l)
1010N/A#define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))
1010N/A#define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))
1010N/A
1010N/A#define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))
1010N/A#define SET_LOCALS_ADDR(value, offset) (*((address *)&locals[-(offset)]) = (value))
1010N/A#define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value))
1010N/A#define SET_LOCALS_FLOAT(value, offset) (*((jfloat *)&locals[-(offset)]) = (value))
1010N/A#define SET_LOCALS_OBJECT(value, offset) (*((oop *)&locals[-(offset)]) = (value))
1010N/A#define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))
1010N/A#define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))
1010N/A#define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \
1010N/A ((VMJavaVal64*)(addr))->d)
1010N/A#define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \
1010N/A ((VMJavaVal64*)(addr))->l)
1879N/A
2327N/A// VMSlots implementation
2327N/A
2327N/A#define VMSLOTS_SLOT(offset) ((intptr_t*)&vmslots[(offset)])
2327N/A#define VMSLOTS_ADDR(offset) ((address)vmslots[(offset)])
2327N/A#define VMSLOTS_INT(offset) (*((jint*)&vmslots[(offset)]))
2327N/A#define VMSLOTS_FLOAT(offset) (*((jfloat*)&vmslots[(offset)]))
2327N/A#define VMSLOTS_OBJECT(offset) ((oop)vmslots[(offset)])
2327N/A#define VMSLOTS_DOUBLE(offset) (((VMJavaVal64*)&vmslots[(offset) - 1])->d)
2327N/A#define VMSLOTS_LONG(offset) (((VMJavaVal64*)&vmslots[(offset) - 1])->l)
2327N/A
2327N/A#define SET_VMSLOTS_SLOT(value, offset) (*(intptr_t*)&vmslots[(offset)] = *(intptr_t *)(value))
2327N/A#define SET_VMSLOTS_ADDR(value, offset) (*((address *)&vmslots[(offset)]) = (value))
2327N/A#define SET_VMSLOTS_INT(value, offset) (*((jint *)&vmslots[(offset)]) = (value))
2327N/A#define SET_VMSLOTS_FLOAT(value, offset) (*((jfloat *)&vmslots[(offset)]) = (value))
2327N/A#define SET_VMSLOTS_OBJECT(value, offset) (*((oop *)&vmslots[(offset)]) = (value))
2327N/A#define SET_VMSLOTS_DOUBLE(value, offset) (((VMJavaVal64*)&vmslots[(offset) - 1])->d = (value))
2327N/A#define SET_VMSLOTS_LONG(value, offset) (((VMJavaVal64*)&vmslots[(offset) - 1])->l = (value))
2327N/A
1879N/A#endif // CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_HPP