Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/x86/vm/c1_FpuStackSim_x86.hpp
32285 views
/*1* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef CPU_X86_VM_C1_FPUSTACKSIM_X86_HPP25#define CPU_X86_VM_C1_FPUSTACKSIM_X86_HPP2627// Simulates the FPU stack and maintains mapping [fpu-register -> stack offset]28// FPU registers are described as numbers from 0..nof_fpu_regs-12930class Compilation;3132class FpuStackSim VALUE_OBJ_CLASS_SPEC {33private:34Compilation* _compilation;35int _stack_size;36int _regs[FrameMap::nof_fpu_regs];3738int tos_index() const { return _stack_size - 1; }3940int regs_at(int i) const;41void set_regs_at(int i, int val);42void dec_stack_size();43void inc_stack_size();4445// unified bailout support46Compilation* compilation() const { return _compilation; }47void bailout(const char* msg) const { compilation()->bailout(msg); }48bool bailed_out() const { return compilation()->bailed_out(); }4950public:51FpuStackSim(Compilation* compilation);52void pop ();53void pop (int rnr); // rnr must be on tos54void push(int rnr);55void swap(int offset); // exchange tos with tos + offset56int offset_from_tos(int rnr) const; // return the offset of the topmost instance of rnr from TOS57int get_slot(int tos_offset) const; // return the entry at the given offset from TOS58void set_slot(int tos_offset, int rnr); // set the entry at the given offset from TOS59void rename(int old_rnr, int new_rnr); // rename all instances of old_rnr to new_rnr60bool contains(int rnr); // debugging support only61bool is_empty();62bool slot_is_empty(int tos_offset);63int stack_size() const { return _stack_size; }64void clear();65intArray* write_state();66void read_state(intArray* fpu_stack_state);6768void print() PRODUCT_RETURN;69};7071#endif // CPU_X86_VM_C1_FPUSTACKSIM_X86_HPP727374