hotspot/src/cpu/s390/vm/javaFrameAnchor_s390.hpp
changeset 42065 6032b31e3719
equal deleted inserted replaced
42064:a530dbabe64f 42065:6032b31e3719
       
     1 /*
       
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
       
     3  * Copyright (c) 2016 SAP SE. All rights reserved.
       
     4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     5  *
       
     6  * This code is free software; you can redistribute it and/or modify it
       
     7  * under the terms of the GNU General Public License version 2 only, as
       
     8  * published by the Free Software Foundation.
       
     9  *
       
    10  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    13  * version 2 for more details (a copy is included in the LICENSE file that
       
    14  * accompanied this code).
       
    15  *
       
    16  * You should have received a copy of the GNU General Public License version
       
    17  * 2 along with this work; if not, write to the Free Software Foundation,
       
    18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    19  *
       
    20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    21  * or visit www.oracle.com if you need additional information or have any
       
    22  * questions.
       
    23  *
       
    24  */
       
    25 
       
    26 #ifndef CPU_S390_VM_JAVAFRAMEANCHOR_S390_HPP
       
    27 #define CPU_S390_VM_JAVAFRAMEANCHOR_S390_HPP
       
    28 
       
    29  public:
       
    30 
       
    31   // Each arch must define reset, save, restore.
       
    32   // These are used by objects that only care about:
       
    33   //  1 - initializing a new state (thread creation, javaCalls)
       
    34   //  2 - saving a current state (javaCalls)
       
    35   //  3 - restoring an old state (javaCalls).
       
    36 
       
    37   inline void clear(void) {
       
    38     // Clearing _last_Java_sp must be first.
       
    39     OrderAccess::release();
       
    40     _last_Java_sp = NULL;
       
    41     // Fence?
       
    42     OrderAccess::fence();
       
    43 
       
    44     _last_Java_pc = NULL;
       
    45   }
       
    46 
       
    47   inline void set(intptr_t* sp, address pc) {
       
    48     _last_Java_pc = pc;
       
    49 
       
    50     OrderAccess::release();
       
    51     _last_Java_sp = sp;
       
    52   }
       
    53 
       
    54   void copy(JavaFrameAnchor* src) {
       
    55     // In order to make sure the transition state is valid for "this"
       
    56     // we must clear _last_Java_sp before copying the rest of the new data.
       
    57     // Hack Alert: Temporary bugfix for 4717480/4721647
       
    58     // To act like previous version (pd_cache_state) don't NULL _last_Java_sp
       
    59     // unless the value is changing.
       
    60     //
       
    61     if (_last_Java_sp != src->_last_Java_sp) {
       
    62       OrderAccess::release();
       
    63       _last_Java_sp = NULL;
       
    64       OrderAccess::fence();
       
    65     }
       
    66     _last_Java_pc = src->_last_Java_pc;
       
    67     // Must be last so profiler will always see valid frame if has_last_frame() is true.
       
    68 
       
    69     OrderAccess::release();
       
    70     _last_Java_sp = src->_last_Java_sp;
       
    71   }
       
    72 
       
    73   // We don't have to flush registers, so the stack is always walkable.
       
    74   inline bool walkable(void) { return true; }
       
    75   inline void make_walkable(JavaThread* thread) { }
       
    76 
       
    77  public:
       
    78 
       
    79   // We don't have a frame pointer.
       
    80   intptr_t* last_Java_fp(void)        { return NULL; }
       
    81 
       
    82   intptr_t* last_Java_sp() const      { return _last_Java_sp; }
       
    83   void set_last_Java_sp(intptr_t* sp) { OrderAccess::release(); _last_Java_sp = sp; }
       
    84 
       
    85   address last_Java_pc(void)          { return _last_Java_pc; }
       
    86 
       
    87 #endif // CPU_S390_VM_JAVAFRAMEANCHOR_S390_HPP