annotate src/share/vm/runtime/vframe_hp.hpp @ 1145:e018e6884bd8

6631166: CMS: better heuristics when combatting fragmentation Summary: Autonomic per-worker free block cache sizing, tunable coalition policies, fixes to per-size block statistics, retuned gain and bandwidth of some feedback loop filters to allow quicker reactivity to abrupt changes in ambient demand, and other heuristics to reduce fragmentation of the CMS old gen. Also tightened some assertions, including those related to locking. Reviewed-by: jmasa
author ysr
date Wed, 23 Dec 2009 09:23:54 -0800
parents 89e0543e1737
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
948
89e0543e1737 6884624: Update copyright year
xdono
parents: 900
diff changeset
2 * Copyright 1997-2009 Sun Microsystems, Inc. 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 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
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 class compiledVFrame: public javaVFrame {
a61af66fc99e Initial load
duke
parents:
diff changeset
26 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
27 // JVM state
900
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
28 methodOop method() const;
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
29 int bci() const;
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
30 bool should_reexecute() const;
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
31 StackValueCollection* locals() const;
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
32 StackValueCollection* expressions() const;
9987d9d5eb0e 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 0
diff changeset
33 GrowableArray<MonitorInfo*>* monitors() const;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 void set_locals(StackValueCollection* values) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // Virtuals defined in vframe
a61af66fc99e Initial load
duke
parents:
diff changeset
38 bool is_compiled_frame() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
39 vframe* sender() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 bool is_top() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // Casting
a61af66fc99e Initial load
duke
parents:
diff changeset
43 static compiledVFrame* cast(vframe* vf) {
a61af66fc99e Initial load
duke
parents:
diff changeset
44 assert(vf == NULL || vf->is_compiled_frame(), "must be compiled frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
45 return (compiledVFrame*) vf;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 }
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // Constructors
a61af66fc99e Initial load
duke
parents:
diff changeset
50 compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, nmethod* nm);
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // Update a local in a compiled frame. Update happens when deopt occurs
a61af66fc99e Initial load
duke
parents:
diff changeset
53 void update_local(BasicType type, int index, jvalue value);
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // Returns the active nmethod
a61af66fc99e Initial load
duke
parents:
diff changeset
56 nmethod* code() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // Returns the scopeDesc
a61af66fc99e Initial load
duke
parents:
diff changeset
59 ScopeDesc* scope() const { return _scope; }
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // Returns SynchronizationEntryBCI or bci() (used for synchronization)
a61af66fc99e Initial load
duke
parents:
diff changeset
62 int raw_bci() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
65 ScopeDesc* _scope;
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 //StackValue resolve(ScopeValue* sv) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
69 BasicLock* resolve_monitor_lock(Location location) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 StackValue *create_stack_value(ScopeValue *sv) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
73 compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, ScopeDesc* scope);
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
76 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
77 void verify() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
79 };
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // In order to implement set_locals for compiled vframes we must
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // store updated locals in a data structure that contains enough
a61af66fc99e Initial load
duke
parents:
diff changeset
83 // information to recognize equality with a vframe and to store
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // any updated locals.
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 class jvmtiDeferredLocalVariable;
a61af66fc99e Initial load
duke
parents:
diff changeset
87 class jvmtiDeferredLocalVariableSet : public CHeapObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
88 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 methodOop _method; // must be GC'd
a61af66fc99e Initial load
duke
parents:
diff changeset
91 int _bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
92 intptr_t* _id;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 GrowableArray<jvmtiDeferredLocalVariable*>* _locals;
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // JVM state
a61af66fc99e Initial load
duke
parents:
diff changeset
97 methodOop method() const { return _method; }
a61af66fc99e Initial load
duke
parents:
diff changeset
98 int bci() const { return _bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 intptr_t* id() const { return _id; }
a61af66fc99e Initial load
duke
parents:
diff changeset
100 GrowableArray<jvmtiDeferredLocalVariable*>* locals() const { return _locals; }
a61af66fc99e Initial load
duke
parents:
diff changeset
101 void set_local_at(int idx, BasicType typ, jvalue val);
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // Does the vframe match this jvmtiDeferredLocalVariableSet
a61af66fc99e Initial load
duke
parents:
diff changeset
104 bool matches(vframe* vf);
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // GC
a61af66fc99e Initial load
duke
parents:
diff changeset
106 void oops_do(OopClosure* f);
a61af66fc99e Initial load
duke
parents:
diff changeset
107
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
109 jvmtiDeferredLocalVariableSet(methodOop method, int bci, intptr_t* id);
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // destructor
a61af66fc99e Initial load
duke
parents:
diff changeset
112 ~jvmtiDeferredLocalVariableSet();
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 };
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 class jvmtiDeferredLocalVariable : public CHeapObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
118 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120 jvmtiDeferredLocalVariable(int index, BasicType type, jvalue value);
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 BasicType type(void) { return _type; }
a61af66fc99e Initial load
duke
parents:
diff changeset
123 int index(void) { return _index; }
a61af66fc99e Initial load
duke
parents:
diff changeset
124 jvalue value(void) { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
125 // Only mutator is for value as only it can change
a61af66fc99e Initial load
duke
parents:
diff changeset
126 void set_value(jvalue value) { _value = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // For gc
a61af66fc99e Initial load
duke
parents:
diff changeset
128 oop* oop_addr(void) { return (oop*) &_value.l; }
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 BasicType _type;
a61af66fc99e Initial load
duke
parents:
diff changeset
133 jvalue _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
134 int _index;
a61af66fc99e Initial load
duke
parents:
diff changeset
135
a61af66fc99e Initial load
duke
parents:
diff changeset
136 };