Tue, 15 Sep 2009 21:53:47 -0700
6863023: need non-perm oops in code cache for JSR 292
Summary: Make a special root-list for those few nmethods which might contain non-perm oops.
Reviewed-by: twisti, kvn, never, jmasa, ysr
duke@435 | 1 | /* |
cfang@1366 | 2 | * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | // SimpleScopeDesc is used when all you need to extract from |
duke@435 | 26 | // a given pc,nmethod pair is a methodOop and a bci. This is |
duke@435 | 27 | // quite a bit faster than allocating a full ScopeDesc, but |
duke@435 | 28 | // very limited in abilities. |
duke@435 | 29 | |
duke@435 | 30 | class SimpleScopeDesc : public StackObj { |
duke@435 | 31 | private: |
duke@435 | 32 | methodOop _method; |
duke@435 | 33 | int _bci; |
duke@435 | 34 | |
duke@435 | 35 | public: |
duke@435 | 36 | SimpleScopeDesc(nmethod* code,address pc) { |
duke@435 | 37 | PcDesc* pc_desc = code->pc_desc_at(pc); |
duke@435 | 38 | assert(pc_desc != NULL, "Must be able to find matching PcDesc"); |
duke@435 | 39 | DebugInfoReadStream buffer(code, pc_desc->scope_decode_offset()); |
duke@435 | 40 | int ignore_sender = buffer.read_int(); |
duke@435 | 41 | _method = methodOop(buffer.read_oop()); |
cfang@1366 | 42 | _bci = buffer.read_bci(); |
duke@435 | 43 | } |
duke@435 | 44 | |
duke@435 | 45 | methodOop method() { return _method; } |
duke@435 | 46 | int bci() { return _bci; } |
duke@435 | 47 | }; |
duke@435 | 48 | |
duke@435 | 49 | // ScopeDescs contain the information that makes source-level debugging of |
duke@435 | 50 | // nmethods possible; each scopeDesc describes a method activation |
duke@435 | 51 | |
duke@435 | 52 | class ScopeDesc : public ResourceObj { |
duke@435 | 53 | public: |
duke@435 | 54 | // Constructor |
cfang@1366 | 55 | ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute); |
duke@435 | 56 | |
duke@435 | 57 | // Calls above, giving default value of "serialized_null" to the |
duke@435 | 58 | // "obj_decode_offset" argument. (We don't use a default argument to |
duke@435 | 59 | // avoid a .hpp-.hpp dependency.) |
cfang@1366 | 60 | ScopeDesc(const nmethod* code, int decode_offset, bool reexecute); |
duke@435 | 61 | |
duke@435 | 62 | // JVM state |
cfang@1335 | 63 | methodHandle method() const { return _method; } |
cfang@1335 | 64 | int bci() const { return _bci; } |
cfang@1335 | 65 | bool should_reexecute() const { return _reexecute; } |
duke@435 | 66 | |
duke@435 | 67 | GrowableArray<ScopeValue*>* locals(); |
duke@435 | 68 | GrowableArray<ScopeValue*>* expressions(); |
duke@435 | 69 | GrowableArray<MonitorValue*>* monitors(); |
duke@435 | 70 | GrowableArray<ScopeValue*>* objects(); |
duke@435 | 71 | |
duke@435 | 72 | // Stack walking, returns NULL if this is the outer most scope. |
duke@435 | 73 | ScopeDesc* sender() const; |
duke@435 | 74 | |
duke@435 | 75 | // Returns where the scope was decoded |
duke@435 | 76 | int decode_offset() const { return _decode_offset; } |
duke@435 | 77 | |
duke@435 | 78 | // Tells whether sender() returns NULL |
duke@435 | 79 | bool is_top() const; |
duke@435 | 80 | // Tells whether sd is equal to this |
duke@435 | 81 | bool is_equal(ScopeDesc* sd) const; |
duke@435 | 82 | |
duke@435 | 83 | private: |
duke@435 | 84 | // Alternative constructor |
duke@435 | 85 | ScopeDesc(const ScopeDesc* parent); |
duke@435 | 86 | |
duke@435 | 87 | // JVM state |
duke@435 | 88 | methodHandle _method; |
duke@435 | 89 | int _bci; |
cfang@1335 | 90 | bool _reexecute; |
duke@435 | 91 | |
duke@435 | 92 | // Decoding offsets |
duke@435 | 93 | int _decode_offset; |
duke@435 | 94 | int _sender_decode_offset; |
duke@435 | 95 | int _locals_decode_offset; |
duke@435 | 96 | int _expressions_decode_offset; |
duke@435 | 97 | int _monitors_decode_offset; |
duke@435 | 98 | |
duke@435 | 99 | // Object pool |
duke@435 | 100 | GrowableArray<ScopeValue*>* _objects; |
duke@435 | 101 | |
duke@435 | 102 | // Nmethod information |
duke@435 | 103 | const nmethod* _code; |
duke@435 | 104 | |
duke@435 | 105 | // Decoding operations |
duke@435 | 106 | void decode_body(); |
duke@435 | 107 | GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset); |
duke@435 | 108 | GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset); |
duke@435 | 109 | GrowableArray<ScopeValue*>* decode_object_values(int decode_offset); |
duke@435 | 110 | |
duke@435 | 111 | DebugInfoReadStream* stream_at(int decode_offset) const; |
duke@435 | 112 | |
duke@435 | 113 | |
duke@435 | 114 | public: |
duke@435 | 115 | // Verification |
duke@435 | 116 | void verify(); |
duke@435 | 117 | |
duke@435 | 118 | #ifndef PRODUCT |
duke@435 | 119 | public: |
duke@435 | 120 | // Printing support |
duke@435 | 121 | void print_on(outputStream* st) const; |
duke@435 | 122 | void print_on(outputStream* st, PcDesc* pd) const; |
duke@435 | 123 | void print_value_on(outputStream* st) const; |
duke@435 | 124 | #endif |
duke@435 | 125 | }; |