0N/A/*
1879N/A * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
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.
0N/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.
0N/A *
0N/A */
0N/A
1879N/A#ifndef CPU_X86_VM_BYTECODEINTERPRETER_X86_HPP
1879N/A#define CPU_X86_VM_BYTECODEINTERPRETER_X86_HPP
1879N/A
0N/A// Platform specific for C++ based Interpreter
0N/A
0N/Aprivate:
0N/A
0N/A interpreterState _self_link; /* Previous interpreter state */ /* sometimes points to self??? */
0N/A address _result_handler; /* temp for saving native result handler */
0N/A intptr_t* _sender_sp; /* sender's sp before stack (locals) extension */
0N/A
0N/A address _extra_junk1; /* temp to save on recompiles */
0N/A address _extra_junk2; /* temp to save on recompiles */
0N/A address _extra_junk3; /* temp to save on recompiles */
0N/A // address dummy_for_native2; /* a native frame result handler would be here... */
0N/A // address dummy_for_native1; /* native result type stored here in a interpreter native frame */
0N/A address _extra_junk4; /* temp to save on recompiles */
0N/A address _extra_junk5; /* temp to save on recompiles */
0N/A address _extra_junk6; /* temp to save on recompiles */
0N/Apublic:
0N/A // we have an interpreter frame...
0N/Ainline intptr_t* sender_sp() {
0N/A return _sender_sp;
0N/A}
0N/A
0N/A// The interpreter always has the frame anchor fully setup so we don't
0N/A// have to do anything going to vm from the interpreter. On return
0N/A// we do have to clear the flags in case they we're modified to
0N/A// maintain the stack walking invariants.
0N/A//
0N/A#define SET_LAST_JAVA_FRAME()
0N/A
0N/A#define RESET_LAST_JAVA_FRAME()
0N/A
0N/A/*
0N/A * Macros for accessing the stack.
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// JavaStack Implementation
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
0N/A
0N/A#define LOCALS_SLOT(offset) ((intptr_t*)&locals[-(offset)])
0N/A#define LOCALS_ADDR(offset) ((address)locals[-(offset)])
0N/A#define LOCALS_INT(offset) ((jint)(locals[-(offset)]))
0N/A#define LOCALS_FLOAT(offset) (*((jfloat*)&locals[-(offset)]))
0N/A#define LOCALS_OBJECT(offset) ((oop)locals[-(offset)])
0N/A#define LOCALS_DOUBLE(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->d)
0N/A#define LOCALS_LONG(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->l)
0N/A#define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))
0N/A#define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))
0N/A
0N/A#define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))
0N/A#define SET_LOCALS_ADDR(value, offset) (*((address *)&locals[-(offset)]) = (value))
0N/A#define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value))
0N/A#define SET_LOCALS_FLOAT(value, offset) (*((jfloat *)&locals[-(offset)]) = (value))
0N/A#define SET_LOCALS_OBJECT(value, offset) (*((oop *)&locals[-(offset)]) = (value))
0N/A#define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))
0N/A#define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))
0N/A#define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \
0N/A ((VMJavaVal64*)(addr))->d)
0N/A#define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \
0N/A ((VMJavaVal64*)(addr))->l)
1879N/A
1879N/A#endif // CPU_X86_VM_BYTECODEINTERPRETER_X86_HPP