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