|
1 /* |
|
2 * Copyright 2003-2006 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 * have any questions. |
|
22 * |
|
23 */ |
|
24 |
|
25 // A constMethodKlass is the klass of a constMethodOop |
|
26 |
|
27 class constMethodKlass : public Klass { |
|
28 friend class VMStructs; |
|
29 private: |
|
30 juint _alloc_size; // allocation profiling support |
|
31 public: |
|
32 // Testing |
|
33 bool oop_is_constMethod() const { return true; } |
|
34 virtual bool oop_is_parsable(oop obj) const; |
|
35 |
|
36 // Allocation |
|
37 DEFINE_ALLOCATE_PERMANENT(constMethodKlass); |
|
38 constMethodOop allocate(int byte_code_size, int compressed_line_number_size, |
|
39 int localvariable_table_length, |
|
40 int checked_exceptions_length, TRAPS); |
|
41 static klassOop create_klass(TRAPS); |
|
42 |
|
43 // Sizing |
|
44 int oop_size(oop obj) const; |
|
45 int klass_oop_size() const { return object_size(); } |
|
46 |
|
47 // Casting from klassOop |
|
48 static constMethodKlass* cast(klassOop k) { |
|
49 assert(k->klass_part()->oop_is_constMethod(), "cast to constMethodKlass"); |
|
50 return (constMethodKlass*) k->klass_part(); |
|
51 } |
|
52 |
|
53 // Sizing |
|
54 static int header_size() { |
|
55 return oopDesc::header_size() + sizeof(constMethodKlass)/HeapWordSize; |
|
56 } |
|
57 int object_size() const { |
|
58 return align_object_size(header_size()); |
|
59 } |
|
60 |
|
61 // Garbage collection |
|
62 void oop_follow_contents(oop obj); |
|
63 int oop_adjust_pointers(oop obj); |
|
64 |
|
65 // Parallel Scavenge and Parallel Old |
|
66 PARALLEL_GC_DECLS |
|
67 |
|
68 // Allocation profiling support |
|
69 juint alloc_size() const { return _alloc_size; } |
|
70 void set_alloc_size(juint n) { _alloc_size = n; } |
|
71 |
|
72 // Iterators |
|
73 int oop_oop_iterate(oop obj, OopClosure* blk); |
|
74 int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr); |
|
75 |
|
76 #ifndef PRODUCT |
|
77 public: |
|
78 // Printing |
|
79 void oop_print_on (oop obj, outputStream* st); |
|
80 void oop_print_value_on(oop obj, outputStream* st); |
|
81 |
|
82 #endif |
|
83 |
|
84 public: |
|
85 // Verify operations |
|
86 const char* internal_name() const; |
|
87 void oop_verify_on(oop obj, outputStream* st); |
|
88 bool oop_partially_loaded(oop obj) const; |
|
89 void oop_set_partially_loaded(oop obj); |
|
90 }; |