Mercurial > hg > truffle
annotate src/share/vm/oops/constMethodOop.cpp @ 4710:41406797186b
7113012: G1: rename not-fully-young GCs as "mixed"
Summary: Renamed partially-young GCs as mixed and fully-young GCs as young. Change all external output that includes those terms (GC log and GC ergo log) as well as any comments, fields, methods, etc. The changeset also includes very minor code tidying up (added some curly brackets).
Reviewed-by: johnc, brutisso
author | tonyp |
---|---|
date | Fri, 16 Dec 2011 02:14:27 -0500 |
parents | f95d63e2154a |
children | 2fe087c3e814 |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "oops/constMethodOop.hpp" | |
27 #include "oops/methodOop.hpp" | |
0 | 28 |
29 // Static initialization | |
30 const u2 constMethodOopDesc::MAX_IDNUM = 0xFFFE; | |
31 const u2 constMethodOopDesc::UNSET_IDNUM = 0xFFFF; | |
32 | |
33 // How big must this constMethodObject be? | |
34 | |
35 int constMethodOopDesc::object_size(int code_size, | |
36 int compressed_line_number_size, | |
37 int local_variable_table_length, | |
38 int checked_exceptions_length) { | |
39 int extra_bytes = code_size; | |
40 if (compressed_line_number_size > 0) { | |
41 extra_bytes += compressed_line_number_size; | |
42 } | |
43 if (checked_exceptions_length > 0) { | |
44 extra_bytes += sizeof(u2); | |
45 extra_bytes += checked_exceptions_length * sizeof(CheckedExceptionElement); | |
46 } | |
47 if (local_variable_table_length > 0) { | |
48 extra_bytes += sizeof(u2); | |
49 extra_bytes += | |
50 local_variable_table_length * sizeof(LocalVariableTableElement); | |
51 } | |
52 int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord; | |
53 return align_object_size(header_size() + extra_words); | |
54 } | |
55 | |
56 | |
57 // linenumber table - note that length is unknown until decompression, | |
58 // see class CompressedLineNumberReadStream. | |
59 | |
60 u_char* constMethodOopDesc::compressed_linenumber_table() const { | |
61 // Located immediately following the bytecodes. | |
62 assert(has_linenumber_table(), "called only if table is present"); | |
63 return code_end(); | |
64 } | |
65 | |
66 u2* constMethodOopDesc::checked_exceptions_length_addr() const { | |
67 // Located at the end of the constMethod. | |
68 assert(has_checked_exceptions(), "called only if table is present"); | |
69 return last_u2_element(); | |
70 } | |
71 | |
72 u2* constMethodOopDesc::localvariable_table_length_addr() const { | |
73 assert(has_localvariable_table(), "called only if table is present"); | |
74 if (has_checked_exceptions()) { | |
75 // If checked_exception present, locate immediately before them. | |
76 return (u2*) checked_exceptions_start() - 1; | |
77 } else { | |
78 // Else, the linenumber table is at the end of the constMethod. | |
79 return last_u2_element(); | |
80 } | |
81 } | |
82 | |
83 | |
84 // Update the flags to indicate the presence of these optional fields. | |
85 void constMethodOopDesc::set_inlined_tables_length( | |
86 int checked_exceptions_len, | |
87 int compressed_line_number_size, | |
88 int localvariable_table_len) { | |
89 // Must be done in the order below, otherwise length_addr accessors | |
90 // will not work. Only set bit in header if length is positive. | |
91 assert(_flags == 0, "Error"); | |
92 if (compressed_line_number_size > 0) { | |
93 _flags |= _has_linenumber_table; | |
94 } | |
95 if (checked_exceptions_len > 0) { | |
96 _flags |= _has_checked_exceptions; | |
97 *(checked_exceptions_length_addr()) = checked_exceptions_len; | |
98 } | |
99 if (localvariable_table_len > 0) { | |
100 _flags |= _has_localvariable_table; | |
101 *(localvariable_table_length_addr()) = localvariable_table_len; | |
102 } | |
103 } | |
104 | |
105 | |
106 int constMethodOopDesc::checked_exceptions_length() const { | |
107 return has_checked_exceptions() ? *(checked_exceptions_length_addr()) : 0; | |
108 } | |
109 | |
110 | |
111 CheckedExceptionElement* constMethodOopDesc::checked_exceptions_start() const { | |
112 u2* addr = checked_exceptions_length_addr(); | |
113 u2 length = *addr; | |
114 assert(length > 0, "should only be called if table is present"); | |
115 addr -= length * sizeof(CheckedExceptionElement) / sizeof(u2); | |
116 return (CheckedExceptionElement*) addr; | |
117 } | |
118 | |
119 | |
120 int constMethodOopDesc::localvariable_table_length() const { | |
121 return has_localvariable_table() ? *(localvariable_table_length_addr()) : 0; | |
122 } | |
123 | |
124 | |
125 LocalVariableTableElement* constMethodOopDesc::localvariable_table_start() const { | |
126 u2* addr = localvariable_table_length_addr(); | |
127 u2 length = *addr; | |
128 assert(length > 0, "should only be called if table is present"); | |
129 addr -= length * sizeof(LocalVariableTableElement) / sizeof(u2); | |
130 return (LocalVariableTableElement*) addr; | |
131 } |