Mercurial > hg > graal-jvmci-8
comparison src/cpu/zero/vm/javaFrameAnchor_zero.hpp @ 1505:0c5b3cf3c1f5
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>
author | twisti |
---|---|
date | Fri, 30 Apr 2010 04:27:25 -0700 |
parents | 354d3184f6b2 |
children | 6cfbdb113e52 |
comparison
equal
deleted
inserted
replaced
1504:ae8f909e5fc7 | 1505:0c5b3cf3c1f5 |
---|---|
1 /* | 1 /* |
2 * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. |
3 * Copyright 2007, 2008 Red Hat, Inc. | 3 * Copyright 2007, 2008, 2010 Red Hat, Inc. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * | 5 * |
6 * This code is free software; you can redistribute it and/or modify it | 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 | 7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. | 8 * published by the Free Software Foundation. |
21 * CA 95054 USA or visit www.sun.com if you need additional information or | 21 * CA 95054 USA or visit www.sun.com if you need additional information or |
22 * have any questions. | 22 * have any questions. |
23 * | 23 * |
24 */ | 24 */ |
25 | 25 |
26 private: | |
27 ZeroFrame* volatile _last_Java_fp; | |
28 | |
26 public: | 29 public: |
27 // Each arch must define reset, save, restore | 30 // Each arch must define reset, save, restore |
28 // These are used by objects that only care about: | 31 // These are used by objects that only care about: |
29 // 1 - initializing a new state (thread creation, javaCalls) | 32 // 1 - initializing a new state (thread creation, javaCalls) |
30 // 2 - saving a current state (javaCalls) | 33 // 2 - saving a current state (javaCalls) |
31 // 3 - restoring an old state (javaCalls) | 34 // 3 - restoring an old state (javaCalls) |
35 // Note that whenever _last_Java_sp != NULL other anchor fields | |
36 // must be valid. The profiler apparently depends on this. | |
32 | 37 |
33 void clear() { | 38 void clear() { |
34 // clearing _last_Java_sp must be first | 39 // clearing _last_Java_sp must be first |
35 _last_Java_sp = NULL; | 40 _last_Java_sp = NULL; |
36 // fence? | 41 // fence? |
42 _last_Java_fp = NULL; | |
37 _last_Java_pc = NULL; | 43 _last_Java_pc = NULL; |
38 } | 44 } |
39 | 45 |
40 void copy(JavaFrameAnchor* src) { | 46 void copy(JavaFrameAnchor* src) { |
47 set(src->_last_Java_sp, src->_last_Java_pc, src->_last_Java_fp); | |
48 } | |
49 | |
50 void set(intptr_t* sp, address pc, ZeroFrame* fp) { | |
41 // In order to make sure the transition state is valid for "this" | 51 // In order to make sure the transition state is valid for "this" |
42 // We must clear _last_Java_sp before copying the rest of the new | 52 // We must clear _last_Java_sp before copying the rest of the new |
43 // data | 53 // data |
44 // | 54 // |
45 // Hack Alert: Temporary bugfix for 4717480/4721647 To act like | 55 // Hack Alert: Temporary bugfix for 4717480/4721647 To act like |
46 // previous version (pd_cache_state) don't NULL _last_Java_sp | 56 // previous version (pd_cache_state) don't NULL _last_Java_sp |
47 // unless the value is changing | 57 // unless the value is changing |
48 // | 58 // |
49 if (_last_Java_sp != src->_last_Java_sp) | 59 if (_last_Java_sp != sp) |
50 _last_Java_sp = NULL; | 60 _last_Java_sp = NULL; |
51 | 61 |
52 _last_Java_pc = src->_last_Java_pc; | 62 _last_Java_fp = fp; |
63 _last_Java_pc = pc; | |
53 // Must be last so profiler will always see valid frame if | 64 // Must be last so profiler will always see valid frame if |
54 // has_last_frame() is true | 65 // has_last_frame() is true |
55 _last_Java_sp = src->_last_Java_sp; | 66 _last_Java_sp = sp; |
56 } | 67 } |
57 | 68 |
58 bool walkable() { | 69 bool walkable() { |
59 return true; | 70 return true; |
60 } | 71 } |
65 | 76 |
66 intptr_t* last_Java_sp() const { | 77 intptr_t* last_Java_sp() const { |
67 return _last_Java_sp; | 78 return _last_Java_sp; |
68 } | 79 } |
69 | 80 |
70 void set_last_Java_sp(intptr_t* sp) { | 81 ZeroFrame* last_Java_fp() const { |
71 _last_Java_sp = sp; | 82 return _last_Java_fp; |
72 } | 83 } |