annotate src/share/vm/code/icBuffer.hpp @ 1754:e967bad2a9ab

6941275: G1: The MemoryPools are incorrectly supported for G1 Summary: The way we were caluclating the max value meant that it might fluctuate during the run and this broke some assumptions inside the MBeans framework. This change sets the max value of each pool to -1, which means undefined according to the spec. Reviewed-by: mchung, johnc
author tonyp
date Wed, 25 Aug 2010 08:44:58 -0400
parents c18cbe5936b8
children f95d63e2154a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
2 * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 //
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // For CompiledIC's:
a61af66fc99e Initial load
duke
parents:
diff changeset
27 //
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // In cases where we do not have MT-safe state transformation,
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // we go to a transition state, using ICStubs. At a safepoint,
a61af66fc99e Initial load
duke
parents:
diff changeset
30 // the inline caches are transferred from the transitional code:
a61af66fc99e Initial load
duke
parents:
diff changeset
31 //
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // instruction_address --> 01 set xxx_oop, Ginline_cache_klass
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // 23 jump_to Gtemp, yyyy
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // 4 nop
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 class ICStub: public Stub {
a61af66fc99e Initial load
duke
parents:
diff changeset
37 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
38 int _size; // total size of the stub incl. code
a61af66fc99e Initial load
duke
parents:
diff changeset
39 address _ic_site; // points at call instruction of owning ic-buffer
a61af66fc99e Initial load
duke
parents:
diff changeset
40 /* stub code follows here */
a61af66fc99e Initial load
duke
parents:
diff changeset
41 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
42 friend class ICStubInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // This will be called only by ICStubInterface
a61af66fc99e Initial load
duke
parents:
diff changeset
44 void initialize(int size) { _size = size; _ic_site = NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
45 void finalize(); // called when a method is removed
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // General info
a61af66fc99e Initial load
duke
parents:
diff changeset
48 int size() const { return _size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
49 static int code_size_to_size(int code_size) { return round_to(sizeof(ICStub), CodeEntryAlignment) + code_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // Creation
a61af66fc99e Initial load
duke
parents:
diff changeset
53 void set_stub(CompiledIC *ic, oop cached_value, address dest_addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // Code info
a61af66fc99e Initial load
duke
parents:
diff changeset
56 address code_begin() const { return (address)this + round_to(sizeof(ICStub), CodeEntryAlignment); }
a61af66fc99e Initial load
duke
parents:
diff changeset
57 address code_end() const { return (address)this + size(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // Call site info
a61af66fc99e Initial load
duke
parents:
diff changeset
60 address ic_site() const { return _ic_site; }
a61af66fc99e Initial load
duke
parents:
diff changeset
61 void clear();
a61af66fc99e Initial load
duke
parents:
diff changeset
62 bool is_empty() const { return _ic_site == NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // stub info
a61af66fc99e Initial load
duke
parents:
diff changeset
65 address destination() const; // destination of jump instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
66 oop cached_oop() const; // cached_oop for stub
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // Debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
69 void verify() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 void print() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // Creation
a61af66fc99e Initial load
duke
parents:
diff changeset
73 friend ICStub* ICStub_from_destination_address(address destination_address);
a61af66fc99e Initial load
duke
parents:
diff changeset
74 };
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // ICStub Creation
a61af66fc99e Initial load
duke
parents:
diff changeset
77 inline ICStub* ICStub_from_destination_address(address destination_address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
78 ICStub* stub = (ICStub*) (destination_address - round_to(sizeof(ICStub), CodeEntryAlignment));
a61af66fc99e Initial load
duke
parents:
diff changeset
79 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
80 stub->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
81 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
82 return stub;
a61af66fc99e Initial load
duke
parents:
diff changeset
83 }
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 class InlineCacheBuffer: public AllStatic {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
87 // friends
a61af66fc99e Initial load
duke
parents:
diff changeset
88 friend class ICStub;
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 static int ic_stub_code_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 static StubQueue* _buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 static ICStub* _next_stub;
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 static StubQueue* buffer() { return _buffer; }
a61af66fc99e Initial load
duke
parents:
diff changeset
96 static void set_next_stub(ICStub* next_stub) { _next_stub = next_stub; }
a61af66fc99e Initial load
duke
parents:
diff changeset
97 static ICStub* get_next_stub() { return _next_stub; }
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 static void init_next_stub();
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 static ICStub* new_ic_stub();
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // Machine-dependent implementation of ICBuffer
a61af66fc99e Initial load
duke
parents:
diff changeset
105 static void assemble_ic_buffer_code(address code_begin, oop cached_oop, address entry_point);
a61af66fc99e Initial load
duke
parents:
diff changeset
106 static address ic_buffer_entry_point (address code_begin);
a61af66fc99e Initial load
duke
parents:
diff changeset
107 static oop ic_buffer_cached_oop (address code_begin);
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // Initialization; must be called before first usage
a61af66fc99e Initial load
duke
parents:
diff changeset
112 static void initialize();
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // Access
a61af66fc99e Initial load
duke
parents:
diff changeset
115 static bool contains(address instruction_address);
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 // removes the ICStubs after backpatching
a61af66fc99e Initial load
duke
parents:
diff changeset
118 static void update_inline_caches();
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // for debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
121 static bool is_empty();
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123
a61af66fc99e Initial load
duke
parents:
diff changeset
124 // New interface
a61af66fc99e Initial load
duke
parents:
diff changeset
125 static void create_transition_stub(CompiledIC *ic, oop cached_oop, address entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
126 static address ic_destination_for(CompiledIC *ic);
a61af66fc99e Initial load
duke
parents:
diff changeset
127 static oop cached_oop_for(CompiledIC *ic);
a61af66fc99e Initial load
duke
parents:
diff changeset
128 };