1 /*
2 * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // A Cache for storing (method, bci) -> oopMap.
26 // The memory management system uses the cache when locating object
27 // references in an interpreted frame.
28 //
29 // OopMapCache's are allocated lazily per instanceKlass.
30
31 // The oopMap (InterpreterOopMap) is stored as a bit mask. If the
32 // bit_mask can fit into two words it is stored in
33 // the _bit_mask array, otherwise it is allocated on the heap.
34 // For OopMapCacheEntry the bit_mask is allocated in the C heap
35 // because these entries persist between garbage collections.
36 // For InterpreterOopMap the bit_mask is allocated in
37 // a resource area for better performance. InterpreterOopMap
38 // should only be created and deleted during same garbage collection.
39 //
40 // If ENABBLE_ZAP_DEAD_LOCALS is defined, two bits are used
41 // per entry instead of one. In all cases,
42 // the first bit is set to indicate oops as opposed to other
43 // values. If the second bit is available,
44 // it is set for dead values. We get the following encoding:
171
172 // flush cache entry is occupied by an obsolete method
173 void flush_obsolete_entries();
174
175 // Returns the oopMap for (method, bci) in parameter "entry".
176 // Returns false if an oop map was not found.
177 void lookup(methodHandle method, int bci, InterpreterOopMap* entry);
178
179 // Compute an oop map without updating the cache or grabbing any locks (for debugging)
180 static void compute_one_oop_map(methodHandle method, int bci, InterpreterOopMap* entry);
181
182 // Helpers
183 // Iterate over the entries in the cached OopMapCacheEntry's
184 void oop_iterate(OopClosure *blk);
185 void oop_iterate(OopClosure *blk, MemRegion mr);
186 void verify();
187
188 // Returns total no. of bytes allocated as part of OopMapCache's
189 static long memory_usage() PRODUCT_RETURN0;
190 };
|
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_INTERPRETER_OOPMAPCACHE_HPP
26 #define SHARE_VM_INTERPRETER_OOPMAPCACHE_HPP
27
28 #include "oops/generateOopMap.hpp"
29
30 // A Cache for storing (method, bci) -> oopMap.
31 // The memory management system uses the cache when locating object
32 // references in an interpreted frame.
33 //
34 // OopMapCache's are allocated lazily per instanceKlass.
35
36 // The oopMap (InterpreterOopMap) is stored as a bit mask. If the
37 // bit_mask can fit into two words it is stored in
38 // the _bit_mask array, otherwise it is allocated on the heap.
39 // For OopMapCacheEntry the bit_mask is allocated in the C heap
40 // because these entries persist between garbage collections.
41 // For InterpreterOopMap the bit_mask is allocated in
42 // a resource area for better performance. InterpreterOopMap
43 // should only be created and deleted during same garbage collection.
44 //
45 // If ENABBLE_ZAP_DEAD_LOCALS is defined, two bits are used
46 // per entry instead of one. In all cases,
47 // the first bit is set to indicate oops as opposed to other
48 // values. If the second bit is available,
49 // it is set for dead values. We get the following encoding:
176
177 // flush cache entry is occupied by an obsolete method
178 void flush_obsolete_entries();
179
180 // Returns the oopMap for (method, bci) in parameter "entry".
181 // Returns false if an oop map was not found.
182 void lookup(methodHandle method, int bci, InterpreterOopMap* entry);
183
184 // Compute an oop map without updating the cache or grabbing any locks (for debugging)
185 static void compute_one_oop_map(methodHandle method, int bci, InterpreterOopMap* entry);
186
187 // Helpers
188 // Iterate over the entries in the cached OopMapCacheEntry's
189 void oop_iterate(OopClosure *blk);
190 void oop_iterate(OopClosure *blk, MemRegion mr);
191 void verify();
192
193 // Returns total no. of bytes allocated as part of OopMapCache's
194 static long memory_usage() PRODUCT_RETURN0;
195 };
196
197 #endif // SHARE_VM_INTERPRETER_OOPMAPCACHE_HPP
|