src/cpu/x86/vm/c1_FpuStackSim_x86.hpp

Wed, 21 May 2008 10:45:07 -0700

author
kvn
date
Wed, 21 May 2008 10:45:07 -0700
changeset 598
885ed790ecf0
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6695810: null oop passed to encode_heap_oop_not_null
Summary: fix several problems in C2 related to Escape Analysis and Compressed Oops.
Reviewed-by: never, jrose

     1 /*
     2  * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
     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 it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 //  Simulates the FPU stack and maintains mapping [fpu-register -> stack offset]
    26 //  FPU registers are described as numbers from 0..nof_fpu_regs-1
    28 class Compilation;
    30 class FpuStackSim VALUE_OBJ_CLASS_SPEC {
    31  private:
    32   Compilation* _compilation;
    33   int          _stack_size;
    34   int          _regs[FrameMap::nof_fpu_regs];
    36   int tos_index() const                        { return _stack_size - 1; }
    38   int regs_at(int i) const;
    39   void set_regs_at(int i, int val);
    40   void dec_stack_size();
    41   void inc_stack_size();
    43   // unified bailout support
    44   Compilation*  compilation() const              { return _compilation; }
    45   void          bailout(const char* msg) const   { compilation()->bailout(msg); }
    46   bool          bailed_out() const               { return compilation()->bailed_out(); }
    48  public:
    49   FpuStackSim(Compilation* compilation);
    50   void pop ();
    51   void pop (int rnr);                          // rnr must be on tos
    52   void push(int rnr);
    53   void swap(int offset);                       // exchange tos with tos + offset
    54   int offset_from_tos(int rnr) const;          // return the offset of the topmost instance of rnr from TOS
    55   int  get_slot(int tos_offset) const;         // return the entry at the given offset from TOS
    56   void set_slot(int tos_offset, int rnr);      // set the entry at the given offset from TOS
    57   void rename(int old_rnr, int new_rnr);       // rename all instances of old_rnr to new_rnr
    58   bool contains(int rnr);                      // debugging support only
    59   bool is_empty();
    60   bool slot_is_empty(int tos_offset);
    61   int stack_size() const                       { return _stack_size; }
    62   void clear();
    63   intArray* write_state();
    64   void read_state(intArray* fpu_stack_state);
    66   void print() PRODUCT_RETURN;
    67 };

mercurial