Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.hpp
32285 views
/*1* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.2* Copyright 2007, 2008, 2011 Red Hat, Inc.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#ifndef CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_HPP26#define CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_HPP2728// Platform specific for C++ based Interpreter2930#if defined(PPC) || defined(SPARC) || defined(IA64)31#define LOTS_OF_REGS // Use plenty of registers32#else33#undef LOTS_OF_REGS // Loser platforms34#endif3536private:37interpreterState _self_link;3839public:40inline void set_locals(intptr_t* new_locals) {41_locals = new_locals;42}43inline void set_method(Method* new_method) {44_method = new_method;45}46inline interpreterState self_link() {47return _self_link;48}49inline void set_self_link(interpreterState new_self_link) {50_self_link = new_self_link;51}52inline interpreterState prev_link() {53return _prev_link;54}55inline void set_prev_link(interpreterState new_prev_link) {56_prev_link = new_prev_link;57}58inline void set_stack_limit(intptr_t* new_stack_limit) {59_stack_limit = new_stack_limit;60}61inline void set_stack_base(intptr_t* new_stack_base) {62_stack_base = new_stack_base;63}64inline void set_monitor_base(BasicObjectLock *new_monitor_base) {65_monitor_base = new_monitor_base;66}67inline void set_thread(JavaThread* new_thread) {68_thread = new_thread;69}70inline void set_constants(ConstantPoolCache* new_constants) {71_constants = new_constants;72}73inline oop oop_temp() {74return _oop_temp;75}76inline oop *oop_temp_addr() {77return &_oop_temp;78}79inline void set_oop_temp(oop new_oop_temp) {80_oop_temp = new_oop_temp;81}82inline address callee_entry_point() {83return _result._to_call._callee_entry_point;84}85inline address osr_buf() {86return _result._osr._osr_buf;87}88inline address osr_entry() {89return _result._osr._osr_entry;90}9192public:93const char *name_of_field_at_address(address addr);9495// The frame manager handles this96#define SET_LAST_JAVA_FRAME()97#define RESET_LAST_JAVA_FRAME()9899// ZeroStack Implementation100101#undef STACK_INT102#undef STACK_FLOAT103#undef STACK_ADDR104#undef STACK_OBJECT105#undef STACK_DOUBLE106#undef STACK_LONG107108#define GET_STACK_SLOT(offset) (*((intptr_t*) &topOfStack[-(offset)]))109#define STACK_SLOT(offset) ((address) &topOfStack[-(offset)])110#define STACK_ADDR(offset) (*((address *) &topOfStack[-(offset)]))111#define STACK_INT(offset) (*((jint*) &topOfStack[-(offset)]))112#define STACK_FLOAT(offset) (*((jfloat *) &topOfStack[-(offset)]))113#define STACK_OBJECT(offset) (*((oop *) &topOfStack [-(offset)]))114#define STACK_DOUBLE(offset) (((VMJavaVal64*) &topOfStack[-(offset)])->d)115#define STACK_LONG(offset) (((VMJavaVal64 *) &topOfStack[-(offset)])->l)116117#define SET_STACK_SLOT(value, offset) (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value))118#define SET_STACK_ADDR(value, offset) (*((address *)&topOfStack[-(offset)]) = (value))119#define SET_STACK_INT(value, offset) (*((jint *)&topOfStack[-(offset)]) = (value))120#define SET_STACK_FLOAT(value, offset) (*((jfloat *)&topOfStack[-(offset)]) = (value))121#define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value))122#define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value))123#define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = \124((VMJavaVal64*)(addr))->d)125#define SET_STACK_LONG(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value))126#define SET_STACK_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = \127((VMJavaVal64*)(addr))->l)128// JavaLocals implementation129130#define LOCALS_SLOT(offset) ((intptr_t*)&locals[-(offset)])131#define LOCALS_ADDR(offset) ((address)locals[-(offset)])132#define LOCALS_INT(offset) (*((jint*)&locals[-(offset)]))133#define LOCALS_FLOAT(offset) (*((jfloat*)&locals[-(offset)]))134#define LOCALS_OBJECT(offset) (cast_to_oop(locals[-(offset)]))135#define LOCALS_DOUBLE(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->d)136#define LOCALS_LONG(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->l)137#define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))138#define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))139140#define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))141#define SET_LOCALS_ADDR(value, offset) (*((address *)&locals[-(offset)]) = (value))142#define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value))143#define SET_LOCALS_FLOAT(value, offset) (*((jfloat *)&locals[-(offset)]) = (value))144#define SET_LOCALS_OBJECT(value, offset) (*((oop *)&locals[-(offset)]) = (value))145#define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))146#define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))147#define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \148((VMJavaVal64*)(addr))->d)149#define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \150((VMJavaVal64*)(addr))->l)151152// VMSlots implementation153154#define VMSLOTS_SLOT(offset) ((intptr_t*)&vmslots[(offset)])155#define VMSLOTS_ADDR(offset) ((address)vmslots[(offset)])156#define VMSLOTS_INT(offset) (*((jint*)&vmslots[(offset)]))157#define VMSLOTS_FLOAT(offset) (*((jfloat*)&vmslots[(offset)]))158#define VMSLOTS_OBJECT(offset) ((oop)vmslots[(offset)])159#define VMSLOTS_DOUBLE(offset) (((VMJavaVal64*)&vmslots[(offset) - 1])->d)160#define VMSLOTS_LONG(offset) (((VMJavaVal64*)&vmslots[(offset) - 1])->l)161162#define SET_VMSLOTS_SLOT(value, offset) (*(intptr_t*)&vmslots[(offset)] = *(intptr_t *)(value))163#define SET_VMSLOTS_ADDR(value, offset) (*((address *)&vmslots[(offset)]) = (value))164#define SET_VMSLOTS_INT(value, offset) (*((jint *)&vmslots[(offset)]) = (value))165#define SET_VMSLOTS_FLOAT(value, offset) (*((jfloat *)&vmslots[(offset)]) = (value))166#define SET_VMSLOTS_OBJECT(value, offset) (*((oop *)&vmslots[(offset)]) = (value))167#define SET_VMSLOTS_DOUBLE(value, offset) (((VMJavaVal64*)&vmslots[(offset) - 1])->d = (value))168#define SET_VMSLOTS_LONG(value, offset) (((VMJavaVal64*)&vmslots[(offset) - 1])->l = (value))169170#endif // CPU_ZERO_VM_BYTECODEINTERPRETER_ZERO_HPP171172173