comparison src/share/vm/interpreter/oopMapCache.hpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents d2a62e0f25eb
children c204e2044c29
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
30 30
31 // A Cache for storing (method, bci) -> oopMap. 31 // A Cache for storing (method, bci) -> oopMap.
32 // The memory management system uses the cache when locating object 32 // The memory management system uses the cache when locating object
33 // references in an interpreted frame. 33 // references in an interpreted frame.
34 // 34 //
35 // OopMapCache's are allocated lazily per instanceKlass. 35 // OopMapCache's are allocated lazily per InstanceKlass.
36 36
37 // The oopMap (InterpreterOopMap) is stored as a bit mask. If the 37 // The oopMap (InterpreterOopMap) is stored as a bit mask. If the
38 // bit_mask can fit into two words it is stored in 38 // bit_mask can fit into two words it is stored in
39 // the _bit_mask array, otherwise it is allocated on the heap. 39 // the _bit_mask array, otherwise it is allocated on the heap.
40 // For OopMapCacheEntry the bit_mask is allocated in the C heap 40 // For OopMapCacheEntry the bit_mask is allocated in the C heap
81 #endif 81 #endif
82 oop_bit_number = 0 82 oop_bit_number = 0
83 }; 83 };
84 84
85 private: 85 private:
86 methodOop _method; // the method for which the mask is valid 86 Method* _method; // the method for which the mask is valid
87 unsigned short _bci; // the bci for which the mask is valid 87 unsigned short _bci; // the bci for which the mask is valid
88 int _mask_size; // the mask size in bits 88 int _mask_size; // the mask size in bits
89 int _expression_stack_size; // the size of the expression stack in slots 89 int _expression_stack_size; // the size of the expression stack in slots
90 90
91 protected: 91 protected:
98 #ifdef ASSERT 98 #ifdef ASSERT
99 bool _resource_allocate_bit_mask; 99 bool _resource_allocate_bit_mask;
100 #endif 100 #endif
101 101
102 // access methods 102 // access methods
103 methodOop method() const { return _method; } 103 Method* method() const { return _method; }
104 void set_method(methodOop v) { _method = v; } 104 void set_method(Method* v) { _method = v; }
105 int bci() const { return _bci; } 105 int bci() const { return _bci; }
106 void set_bci(int v) { _bci = v; } 106 void set_bci(int v) { _bci = v; }
107 int mask_size() const { return _mask_size; } 107 int mask_size() const { return _mask_size; }
108 void set_mask_size(int v) { _mask_size = v; } 108 void set_mask_size(int v) { _mask_size = v; }
109 int number_of_entries() const { return mask_size() / bits_per_entry; } 109 int number_of_entries() const { return mask_size() / bits_per_entry; }
140 // allocated space (i.e., the bit mask was to large to hold 140 // allocated space (i.e., the bit mask was to large to hold
141 // in-line), allocate the space from a Resource area. 141 // in-line), allocate the space from a Resource area.
142 void resource_copy(OopMapCacheEntry* from); 142 void resource_copy(OopMapCacheEntry* from);
143 143
144 void iterate_oop(OffsetClosure* oop_closure); 144 void iterate_oop(OffsetClosure* oop_closure);
145 void oop_iterate(OopClosure * blk);
146 void oop_iterate(OopClosure * blk, MemRegion mr);
147 void verify();
148 void print(); 145 void print();
149 146
150 bool is_oop (int offset) { return (entry_at(offset) & (1 << oop_bit_number )) != 0; } 147 bool is_oop (int offset) { return (entry_at(offset) & (1 << oop_bit_number )) != 0; }
151 148
152 int expression_stack_size() { return _expression_stack_size; } 149 int expression_stack_size() { return _expression_stack_size; }
183 void lookup(methodHandle method, int bci, InterpreterOopMap* entry); 180 void lookup(methodHandle method, int bci, InterpreterOopMap* entry);
184 181
185 // Compute an oop map without updating the cache or grabbing any locks (for debugging) 182 // Compute an oop map without updating the cache or grabbing any locks (for debugging)
186 static void compute_one_oop_map(methodHandle method, int bci, InterpreterOopMap* entry); 183 static void compute_one_oop_map(methodHandle method, int bci, InterpreterOopMap* entry);
187 184
188 // Helpers
189 // Iterate over the entries in the cached OopMapCacheEntry's
190 void oop_iterate(OopClosure *blk);
191 void oop_iterate(OopClosure *blk, MemRegion mr);
192 void verify();
193
194 // Returns total no. of bytes allocated as part of OopMapCache's 185 // Returns total no. of bytes allocated as part of OopMapCache's
195 static long memory_usage() PRODUCT_RETURN0; 186 static long memory_usage() PRODUCT_RETURN0;
196 }; 187 };
197 188
198 #endif // SHARE_VM_INTERPRETER_OOPMAPCACHE_HPP 189 #endif // SHARE_VM_INTERPRETER_OOPMAPCACHE_HPP