src/cpu/zero/vm/javaFrameAnchor_zero.hpp

Fri, 30 Apr 2010 04:27:25 -0700

author
twisti
date
Fri, 30 Apr 2010 04:27:25 -0700
changeset 1860
0c5b3cf3c1f5
parent 1445
354d3184f6b2
child 1867
6cfbdb113e52
permissions
-rw-r--r--

6939182: Zero JNI handles fix
Summary: Zero will exit with an error when invoked with -Xcheck:jni.
Reviewed-by: twisti, kamg
Contributed-by: Gary Benson <gbenson@redhat.com>

never@1445 1 /*
never@1445 2 * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
twisti@1860 3 * Copyright 2007, 2008, 2010 Red Hat, Inc.
never@1445 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
never@1445 5 *
never@1445 6 * This code is free software; you can redistribute it and/or modify it
never@1445 7 * under the terms of the GNU General Public License version 2 only, as
never@1445 8 * published by the Free Software Foundation.
never@1445 9 *
never@1445 10 * This code is distributed in the hope that it will be useful, but WITHOUT
never@1445 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
never@1445 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
never@1445 13 * version 2 for more details (a copy is included in the LICENSE file that
never@1445 14 * accompanied this code).
never@1445 15 *
never@1445 16 * You should have received a copy of the GNU General Public License version
never@1445 17 * 2 along with this work; if not, write to the Free Software Foundation,
never@1445 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
never@1445 19 *
never@1445 20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
never@1445 21 * CA 95054 USA or visit www.sun.com if you need additional information or
never@1445 22 * have any questions.
never@1445 23 *
never@1445 24 */
never@1445 25
twisti@1860 26 private:
twisti@1860 27 ZeroFrame* volatile _last_Java_fp;
twisti@1860 28
never@1445 29 public:
never@1445 30 // Each arch must define reset, save, restore
never@1445 31 // These are used by objects that only care about:
never@1445 32 // 1 - initializing a new state (thread creation, javaCalls)
never@1445 33 // 2 - saving a current state (javaCalls)
never@1445 34 // 3 - restoring an old state (javaCalls)
twisti@1860 35 // Note that whenever _last_Java_sp != NULL other anchor fields
twisti@1860 36 // must be valid. The profiler apparently depends on this.
never@1445 37
never@1445 38 void clear() {
never@1445 39 // clearing _last_Java_sp must be first
never@1445 40 _last_Java_sp = NULL;
never@1445 41 // fence?
twisti@1860 42 _last_Java_fp = NULL;
never@1445 43 _last_Java_pc = NULL;
never@1445 44 }
never@1445 45
never@1445 46 void copy(JavaFrameAnchor* src) {
twisti@1860 47 set(src->_last_Java_sp, src->_last_Java_pc, src->_last_Java_fp);
twisti@1860 48 }
twisti@1860 49
twisti@1860 50 void set(intptr_t* sp, address pc, ZeroFrame* fp) {
never@1445 51 // In order to make sure the transition state is valid for "this"
never@1445 52 // We must clear _last_Java_sp before copying the rest of the new
never@1445 53 // data
never@1445 54 //
never@1445 55 // Hack Alert: Temporary bugfix for 4717480/4721647 To act like
never@1445 56 // previous version (pd_cache_state) don't NULL _last_Java_sp
never@1445 57 // unless the value is changing
never@1445 58 //
twisti@1860 59 if (_last_Java_sp != sp)
never@1445 60 _last_Java_sp = NULL;
never@1445 61
twisti@1860 62 _last_Java_fp = fp;
twisti@1860 63 _last_Java_pc = pc;
never@1445 64 // Must be last so profiler will always see valid frame if
never@1445 65 // has_last_frame() is true
twisti@1860 66 _last_Java_sp = sp;
never@1445 67 }
never@1445 68
never@1445 69 bool walkable() {
never@1445 70 return true;
never@1445 71 }
never@1445 72
never@1445 73 void make_walkable(JavaThread* thread) {
never@1445 74 // nothing to do
never@1445 75 }
never@1445 76
never@1445 77 intptr_t* last_Java_sp() const {
never@1445 78 return _last_Java_sp;
never@1445 79 }
never@1445 80
twisti@1860 81 ZeroFrame* last_Java_fp() const {
twisti@1860 82 return _last_Java_fp;
never@1445 83 }

mercurial