Mercurial > hg > graal-compiler
annotate src/share/vm/oops/constMethodOop.cpp @ 1711:a6bff45449bc
6973570: OrderAccess::storestore() scales poorly on multi-socket x64 and sparc: cache-line ping-ponging
Summary: volatile store to static variable removed in favour of a volatile store to stack to avoid excessive cache coherency traffic; verified that the volatile store is not elided by any of our current compilers.
Reviewed-by: dholmes, dice, jcoomes, kvn
author | ysr |
---|---|
date | Tue, 10 Aug 2010 14:53:35 -0700 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2003, 2006, 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 | |
25 # include "incls/_precompiled.incl" | |
26 # include "incls/_constMethodOop.cpp.incl" | |
27 | |
28 // Static initialization | |
29 const u2 constMethodOopDesc::MAX_IDNUM = 0xFFFE; | |
30 const u2 constMethodOopDesc::UNSET_IDNUM = 0xFFFF; | |
31 | |
32 // How big must this constMethodObject be? | |
33 | |
34 int constMethodOopDesc::object_size(int code_size, | |
35 int compressed_line_number_size, | |
36 int local_variable_table_length, | |
37 int checked_exceptions_length) { | |
38 int extra_bytes = code_size; | |
39 if (compressed_line_number_size > 0) { | |
40 extra_bytes += compressed_line_number_size; | |
41 } | |
42 if (checked_exceptions_length > 0) { | |
43 extra_bytes += sizeof(u2); | |
44 extra_bytes += checked_exceptions_length * sizeof(CheckedExceptionElement); | |
45 } | |
46 if (local_variable_table_length > 0) { | |
47 extra_bytes += sizeof(u2); | |
48 extra_bytes += | |
49 local_variable_table_length * sizeof(LocalVariableTableElement); | |
50 } | |
51 int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord; | |
52 return align_object_size(header_size() + extra_words); | |
53 } | |
54 | |
55 | |
56 // linenumber table - note that length is unknown until decompression, | |
57 // see class CompressedLineNumberReadStream. | |
58 | |
59 u_char* constMethodOopDesc::compressed_linenumber_table() const { | |
60 // Located immediately following the bytecodes. | |
61 assert(has_linenumber_table(), "called only if table is present"); | |
62 return code_end(); | |
63 } | |
64 | |
65 u2* constMethodOopDesc::checked_exceptions_length_addr() const { | |
66 // Located at the end of the constMethod. | |
67 assert(has_checked_exceptions(), "called only if table is present"); | |
68 return last_u2_element(); | |
69 } | |
70 | |
71 u2* constMethodOopDesc::localvariable_table_length_addr() const { | |
72 assert(has_localvariable_table(), "called only if table is present"); | |
73 if (has_checked_exceptions()) { | |
74 // If checked_exception present, locate immediately before them. | |
75 return (u2*) checked_exceptions_start() - 1; | |
76 } else { | |
77 // Else, the linenumber table is at the end of the constMethod. | |
78 return last_u2_element(); | |
79 } | |
80 } | |
81 | |
82 | |
83 // Update the flags to indicate the presence of these optional fields. | |
84 void constMethodOopDesc::set_inlined_tables_length( | |
85 int checked_exceptions_len, | |
86 int compressed_line_number_size, | |
87 int localvariable_table_len) { | |
88 // Must be done in the order below, otherwise length_addr accessors | |
89 // will not work. Only set bit in header if length is positive. | |
90 assert(_flags == 0, "Error"); | |
91 if (compressed_line_number_size > 0) { | |
92 _flags |= _has_linenumber_table; | |
93 } | |
94 if (checked_exceptions_len > 0) { | |
95 _flags |= _has_checked_exceptions; | |
96 *(checked_exceptions_length_addr()) = checked_exceptions_len; | |
97 } | |
98 if (localvariable_table_len > 0) { | |
99 _flags |= _has_localvariable_table; | |
100 *(localvariable_table_length_addr()) = localvariable_table_len; | |
101 } | |
102 } | |
103 | |
104 | |
105 int constMethodOopDesc::checked_exceptions_length() const { | |
106 return has_checked_exceptions() ? *(checked_exceptions_length_addr()) : 0; | |
107 } | |
108 | |
109 | |
110 CheckedExceptionElement* constMethodOopDesc::checked_exceptions_start() const { | |
111 u2* addr = checked_exceptions_length_addr(); | |
112 u2 length = *addr; | |
113 assert(length > 0, "should only be called if table is present"); | |
114 addr -= length * sizeof(CheckedExceptionElement) / sizeof(u2); | |
115 return (CheckedExceptionElement*) addr; | |
116 } | |
117 | |
118 | |
119 int constMethodOopDesc::localvariable_table_length() const { | |
120 return has_localvariable_table() ? *(localvariable_table_length_addr()) : 0; | |
121 } | |
122 | |
123 | |
124 LocalVariableTableElement* constMethodOopDesc::localvariable_table_start() const { | |
125 u2* addr = localvariable_table_length_addr(); | |
126 u2 length = *addr; | |
127 assert(length > 0, "should only be called if table is present"); | |
128 addr -= length * sizeof(LocalVariableTableElement) / sizeof(u2); | |
129 return (LocalVariableTableElement*) addr; | |
130 } |