Path: blob/master/src/hotspot/cpu/zero/bytecodeInterpreter_zero.hpp
40931 views
/*1* Copyright (c) 2002, 2020, 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_BYTECODEINTERPRETER_ZERO_HPP26#define CPU_ZERO_BYTECODEINTERPRETER_ZERO_HPP2728// Platform specific for C++ based Interpreter2930#if defined(PPC) || 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 void set_mirror(oop new_mirror) {47_mirror = new_mirror;48}49inline interpreterState self_link() {50return _self_link;51}52inline void set_self_link(interpreterState new_self_link) {53_self_link = new_self_link;54}55inline interpreterState prev_link() {56return _prev_link;57}58inline void set_prev_link(interpreterState new_prev_link) {59_prev_link = new_prev_link;60}61inline void set_stack_limit(intptr_t* new_stack_limit) {62_stack_limit = new_stack_limit;63}64inline void set_stack_base(intptr_t* new_stack_base) {65_stack_base = new_stack_base;66}67inline void set_monitor_base(BasicObjectLock *new_monitor_base) {68_monitor_base = new_monitor_base;69}70inline void set_thread(JavaThread* new_thread) {71_thread = new_thread;72}73inline void set_constants(ConstantPoolCache* new_constants) {74_constants = new_constants;75}76inline oop oop_temp() {77return _oop_temp;78}79inline oop *oop_temp_addr() {80return &_oop_temp;81}82inline void set_oop_temp(oop new_oop_temp) {83_oop_temp = new_oop_temp;84}85inline address callee_entry_point() {86return _result._to_call._callee_entry_point;87}88inline address osr_buf() {89return _result._osr._osr_buf;90}91inline address osr_entry() {92return _result._osr._osr_entry;93}9495public:96const char *name_of_field_at_address(address addr);9798// The frame manager handles this99#define SET_LAST_JAVA_FRAME()100#define RESET_LAST_JAVA_FRAME()101102// ZeroStack Implementation103104#undef STACK_INT105#undef STACK_FLOAT106#undef STACK_ADDR107#undef STACK_OBJECT108#undef STACK_DOUBLE109#undef STACK_LONG110111#define GET_STACK_SLOT(offset) (*((intptr_t*) &topOfStack[-(offset)]))112#define STACK_SLOT(offset) ((address) &topOfStack[-(offset)])113#define STACK_ADDR(offset) (*((address *) &topOfStack[-(offset)]))114#define STACK_INT(offset) (*((jint*) &topOfStack[-(offset)]))115#define STACK_FLOAT(offset) (*((jfloat *) &topOfStack[-(offset)]))116#define STACK_OBJECT(offset) (*((oop *) &topOfStack [-(offset)]))117#define STACK_DOUBLE(offset) (((VMJavaVal64*) &topOfStack[-(offset)])->d)118#define STACK_LONG(offset) (((VMJavaVal64 *) &topOfStack[-(offset)])->l)119120#define SET_STACK_SLOT(value, offset) (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value))121#define SET_STACK_ADDR(value, offset) (*((address *)&topOfStack[-(offset)]) = (value))122#define SET_STACK_INT(value, offset) (*((jint *)&topOfStack[-(offset)]) = (value))123#define SET_STACK_FLOAT(value, offset) (*((jfloat *)&topOfStack[-(offset)]) = (value))124#define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value))125#define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value))126#define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = \127((VMJavaVal64*)(addr))->d)128#define SET_STACK_LONG(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value))129#define SET_STACK_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = \130((VMJavaVal64*)(addr))->l)131// JavaLocals implementation132133#define LOCALS_SLOT(offset) ((intptr_t*)&locals[-(offset)])134#define LOCALS_ADDR(offset) ((address)locals[-(offset)])135#define LOCALS_INT(offset) (*((jint*)&locals[-(offset)]))136#define LOCALS_FLOAT(offset) (*((jfloat*)&locals[-(offset)]))137#define LOCALS_OBJECT(offset) (cast_to_oop(locals[-(offset)]))138#define LOCALS_DOUBLE(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->d)139#define LOCALS_LONG(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->l)140#define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)]))141#define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)]))142143#define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value))144#define SET_LOCALS_ADDR(value, offset) (*((address *)&locals[-(offset)]) = (value))145#define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value))146#define SET_LOCALS_FLOAT(value, offset) (*((jfloat *)&locals[-(offset)]) = (value))147#define SET_LOCALS_OBJECT(value, offset) (*((oop *)&locals[-(offset)]) = (value))148#define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value))149#define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value))150#define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \151((VMJavaVal64*)(addr))->d)152#define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \153((VMJavaVal64*)(addr))->l)154155#endif // CPU_ZERO_BYTECODEINTERPRETER_ZERO_HPP156157158