Path: blob/master/src/hotspot/cpu/zero/abstractInterpreter_zero.cpp
40931 views
/*1* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.2* Copyright 2007, 2008, 2009, 2010, 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#include "precompiled.hpp"26#include "interpreter/zero/bytecodeInterpreter.hpp"27#include "interpreter/zero/zeroInterpreter.hpp"28#include "runtime/frame.inline.hpp"29#include "utilities/globalDefinitions.hpp"3031int AbstractInterpreter::BasicType_as_index(BasicType type) {32int i = 0;33switch (type) {34case T_BOOLEAN: i = 0; break;35case T_CHAR : i = 1; break;36case T_BYTE : i = 2; break;37case T_SHORT : i = 3; break;38case T_INT : i = 4; break;39case T_LONG : i = 5; break;40case T_VOID : i = 6; break;41case T_FLOAT : i = 7; break;42case T_DOUBLE : i = 8; break;43case T_OBJECT : i = 9; break;44case T_ARRAY : i = 9; break;45default : ShouldNotReachHere();46}47assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers,48"index out of bounds");49return i;50}5152// Deoptimization helpers5354int AbstractInterpreter::size_activation(int max_stack,55int tempcount,56int extra_args,57int moncount,58int callee_param_count,59int callee_locals,60bool is_top_frame) {61int header_words = InterpreterFrame::header_words;62int monitor_words = moncount * frame::interpreter_frame_monitor_size();63int stack_words = is_top_frame ? max_stack : tempcount;64int callee_extra_locals = callee_locals - callee_param_count;6566return header_words + monitor_words + stack_words + callee_extra_locals;67}6869void AbstractInterpreter::layout_activation(Method* method,70int tempcount,71int popframe_extra_args,72int moncount,73int caller_actual_parameters,74int callee_param_count,75int callee_locals,76frame* caller,77frame* interpreter_frame,78bool is_top_frame,79bool is_bottom_frame) {80assert(popframe_extra_args == 0, "what to do?");81assert(!is_top_frame || (!callee_locals && !callee_param_count),82"top frame should have no caller");8384// This code must exactly match what InterpreterFrame::build85// does (the full InterpreterFrame::build, that is, not the86// one that creates empty frames for the deoptimizer).87//88// interpreter_frame will be filled in. It's size is determined by89// a previous call to the size_activation() method,90//91// Note that tempcount is the current size of the expression92// stack. For top most frames we will allocate a full sized93// expression stack and not the trimmed version that non-top94// frames have.9596int monitor_words = moncount * frame::interpreter_frame_monitor_size();97intptr_t *locals = interpreter_frame->fp() + method->max_locals();98interpreterState istate = interpreter_frame->get_interpreterState();99intptr_t *monitor_base = (intptr_t*) istate;100intptr_t *stack_base = monitor_base - monitor_words;101intptr_t *stack = stack_base - tempcount - 1;102103BytecodeInterpreter::layout_interpreterState(istate,104caller,105NULL,106method,107locals,108stack,109stack_base,110monitor_base,111NULL,112is_top_frame);113}114115// Helper for (runtime) stack overflow checks116117int AbstractInterpreter::size_top_interpreter_activation(Method* method) {118return 0;119}120121122