src/cpu/zero/vm/javaFrameAnchor_zero.hpp

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/cpu/zero/vm/javaFrameAnchor_zero.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,96 @@
     1.4 +/*
     1.5 + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright 2007, 2008, 2010 Red Hat, Inc.
     1.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 + *
     1.9 + * This code is free software; you can redistribute it and/or modify it
    1.10 + * under the terms of the GNU General Public License version 2 only, as
    1.11 + * published by the Free Software Foundation.
    1.12 + *
    1.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 + * version 2 for more details (a copy is included in the LICENSE file that
    1.17 + * accompanied this code).
    1.18 + *
    1.19 + * You should have received a copy of the GNU General Public License version
    1.20 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 + *
    1.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 + * or visit www.oracle.com if you need additional information or have any
    1.25 + * questions.
    1.26 + *
    1.27 + */
    1.28 +
    1.29 +#ifndef CPU_ZERO_VM_JAVAFRAMEANCHOR_ZERO_HPP
    1.30 +#define CPU_ZERO_VM_JAVAFRAMEANCHOR_ZERO_HPP
    1.31 +
    1.32 + private:
    1.33 +  ZeroFrame* volatile _last_Java_fp;
    1.34 +
    1.35 + public:
    1.36 +  // Each arch must define reset, save, restore
    1.37 +  // These are used by objects that only care about:
    1.38 +  //  1 - initializing a new state (thread creation, javaCalls)
    1.39 +  //  2 - saving a current state (javaCalls)
    1.40 +  //  3 - restoring an old state (javaCalls)
    1.41 +  // Note that whenever _last_Java_sp != NULL other anchor fields
    1.42 +  // must be valid.  The profiler apparently depends on this.
    1.43 +
    1.44 +  void clear() {
    1.45 +    // clearing _last_Java_sp must be first
    1.46 +    _last_Java_sp = NULL;
    1.47 +    // fence?
    1.48 +    _last_Java_fp = NULL;
    1.49 +    _last_Java_pc = NULL;
    1.50 +  }
    1.51 +
    1.52 +  void copy(JavaFrameAnchor* src) {
    1.53 +    set(src->_last_Java_sp, src->_last_Java_pc, src->_last_Java_fp);
    1.54 +  }
    1.55 +
    1.56 +  void set(intptr_t* sp, address pc, ZeroFrame* fp) {
    1.57 +    // In order to make sure the transition state is valid for "this"
    1.58 +    // We must clear _last_Java_sp before copying the rest of the new
    1.59 +    // data
    1.60 +    //
    1.61 +    // Hack Alert: Temporary bugfix for 4717480/4721647 To act like
    1.62 +    // previous version (pd_cache_state) don't NULL _last_Java_sp
    1.63 +    // unless the value is changing
    1.64 +    //
    1.65 +    if (_last_Java_sp != sp)
    1.66 +      _last_Java_sp = NULL;
    1.67 +
    1.68 +    _last_Java_fp = fp;
    1.69 +    _last_Java_pc = pc;
    1.70 +    // Must be last so profiler will always see valid frame if
    1.71 +    // has_last_frame() is true
    1.72 +    _last_Java_sp = sp;
    1.73 +  }
    1.74 +
    1.75 +  bool walkable() {
    1.76 +    return true;
    1.77 +  }
    1.78 +
    1.79 +  void make_walkable(JavaThread* thread) {
    1.80 +    // nothing to do
    1.81 +  }
    1.82 +
    1.83 +  intptr_t* last_Java_sp() const {
    1.84 +    return _last_Java_sp;
    1.85 +  }
    1.86 +
    1.87 +  ZeroFrame* last_Java_fp() const {
    1.88 +    return _last_Java_fp;
    1.89 +  }
    1.90 +
    1.91 +  address last_Java_pc() const {
    1.92 +    return _last_Java_pc;
    1.93 +  }
    1.94 +
    1.95 +  static ByteSize last_Java_fp_offset() {
    1.96 +    return byte_offset_of(JavaFrameAnchor, _last_Java_fp);
    1.97 +  }
    1.98 +
    1.99 +#endif // CPU_ZERO_VM_JAVAFRAMEANCHOR_ZERO_HPP

mercurial