annotate src/share/vm/interpreter/templateInterpreter.hpp @ 605:98cb887364d3

6810672: Comment typos Summary: I have collected some typos I have found while looking at the code. Reviewed-by: kvn, never
author twisti
date Fri, 27 Feb 2009 13:27:09 -0800
parents a61af66fc99e
children e5b0439ef4ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
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
605
98cb887364d3 6810672: Comment typos
twisti
parents: 0
diff changeset
25 // This file contains the platform-independent parts
0
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // of the template interpreter and the template interpreter generator.
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 #ifndef CC_INTERP
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 //------------------------------------------------------------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // A little wrapper class to group tosca-specific entry points into a unit.
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // (tosca = Top-Of-Stack CAche)
a61af66fc99e Initial load
duke
parents:
diff changeset
33
a61af66fc99e Initial load
duke
parents:
diff changeset
34 class EntryPoint VALUE_OBJ_CLASS_SPEC {
a61af66fc99e Initial load
duke
parents:
diff changeset
35 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
36 address _entry[number_of_states];
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // Construction
a61af66fc99e Initial load
duke
parents:
diff changeset
40 EntryPoint();
a61af66fc99e Initial load
duke
parents:
diff changeset
41 EntryPoint(address bentry, address centry, address sentry, address aentry, address ientry, address lentry, address fentry, address dentry, address ventry);
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // Attributes
a61af66fc99e Initial load
duke
parents:
diff changeset
44 address entry(TosState state) const; // return target address for a given tosca state
a61af66fc99e Initial load
duke
parents:
diff changeset
45 void set_entry(TosState state, address entry); // set target address for a given tosca state
a61af66fc99e Initial load
duke
parents:
diff changeset
46 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // Comparison
a61af66fc99e Initial load
duke
parents:
diff changeset
49 bool operator == (const EntryPoint& y); // for debugging only
a61af66fc99e Initial load
duke
parents:
diff changeset
50 };
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 //------------------------------------------------------------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
54 // A little wrapper class to group tosca-specific dispatch tables into a unit.
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 class DispatchTable VALUE_OBJ_CLASS_SPEC {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
58 enum { length = 1 << BitsPerByte }; // an entry point for each byte value (also for undefined bytecodes)
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
61 address _table[number_of_states][length]; // dispatch tables, indexed by tosca and bytecode
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // Attributes
a61af66fc99e Initial load
duke
parents:
diff changeset
65 EntryPoint entry(int i) const; // return entry point for a given bytecode i
a61af66fc99e Initial load
duke
parents:
diff changeset
66 void set_entry(int i, EntryPoint& entry); // set entry point for a given bytecode i
a61af66fc99e Initial load
duke
parents:
diff changeset
67 address* table_for(TosState state) { return _table[state]; }
a61af66fc99e Initial load
duke
parents:
diff changeset
68 address* table_for() { return table_for((TosState)0); }
a61af66fc99e Initial load
duke
parents:
diff changeset
69 int distance_from(address *table) { return table - table_for(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
70 int distance_from(TosState state) { return distance_from(table_for(state)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // Comparison
a61af66fc99e Initial load
duke
parents:
diff changeset
73 bool operator == (DispatchTable& y); // for debugging only
a61af66fc99e Initial load
duke
parents:
diff changeset
74 };
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 class TemplateInterpreter: public AbstractInterpreter {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 friend class InterpreterMacroAssembler;
a61af66fc99e Initial load
duke
parents:
diff changeset
79 friend class TemplateInterpreterGenerator;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 friend class TemplateTable;
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // friend class Interpreter;
a61af66fc99e Initial load
duke
parents:
diff changeset
82 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 enum MoreConstants {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 number_of_return_entries = 9, // number of return entry points
a61af66fc99e Initial load
duke
parents:
diff changeset
86 number_of_deopt_entries = 9, // number of deoptimization entry points
a61af66fc99e Initial load
duke
parents:
diff changeset
87 number_of_return_addrs = 9 // number of return addresses
a61af66fc99e Initial load
duke
parents:
diff changeset
88 };
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 static address _throw_ArrayIndexOutOfBoundsException_entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 static address _throw_ArrayStoreException_entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
94 static address _throw_ArithmeticException_entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
95 static address _throw_ClassCastException_entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 static address _throw_NullPointerException_entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
97 static address _throw_exception_entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 static address _throw_StackOverflowError_entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 static address _remove_activation_entry; // continuation address if an exception is not handled by current frame
a61af66fc99e Initial load
duke
parents:
diff changeset
102 #ifdef HOTSWAP
a61af66fc99e Initial load
duke
parents:
diff changeset
103 static address _remove_activation_preserving_args_entry; // continuation address when current frame is being popped
a61af66fc99e Initial load
duke
parents:
diff changeset
104 #endif // HOTSWAP
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
107 static EntryPoint _trace_code;
a61af66fc99e Initial load
duke
parents:
diff changeset
108 #endif // !PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
109 static EntryPoint _return_entry[number_of_return_entries]; // entry points to return to from a call
a61af66fc99e Initial load
duke
parents:
diff changeset
110 static EntryPoint _earlyret_entry; // entry point to return early from a call
a61af66fc99e Initial load
duke
parents:
diff changeset
111 static EntryPoint _deopt_entry[number_of_deopt_entries]; // entry points to return to from a deoptimization
a61af66fc99e Initial load
duke
parents:
diff changeset
112 static EntryPoint _continuation_entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
113 static EntryPoint _safept_entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 static address _return_3_addrs_by_index[number_of_return_addrs]; // for invokevirtual return entries
a61af66fc99e Initial load
duke
parents:
diff changeset
116 static address _return_5_addrs_by_index[number_of_return_addrs]; // for invokeinterface return entries
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 static DispatchTable _active_table; // the active dispatch table (used by the interpreter for dispatch)
a61af66fc99e Initial load
duke
parents:
diff changeset
119 static DispatchTable _normal_table; // the normal dispatch table (used to set the active table in normal mode)
a61af66fc99e Initial load
duke
parents:
diff changeset
120 static DispatchTable _safept_table; // the safepoint dispatch table (used to set the active table for safepoints)
a61af66fc99e Initial load
duke
parents:
diff changeset
121 static address _wentry_point[DispatchTable::length]; // wide instructions only (vtos tosca always)
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123
a61af66fc99e Initial load
duke
parents:
diff changeset
124 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
125 // Initialization/debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
126 static void initialize();
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // this only returns whether a pc is within generated code for the interpreter.
a61af66fc99e Initial load
duke
parents:
diff changeset
128 static bool contains(address pc) { return _code != NULL && _code->contains(pc); }
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 static address remove_activation_early_entry(TosState state) { return _earlyret_entry.entry(state); }
a61af66fc99e Initial load
duke
parents:
diff changeset
133 #ifdef HOTSWAP
a61af66fc99e Initial load
duke
parents:
diff changeset
134 static address remove_activation_preserving_args_entry() { return _remove_activation_preserving_args_entry; }
a61af66fc99e Initial load
duke
parents:
diff changeset
135 #endif // HOTSWAP
a61af66fc99e Initial load
duke
parents:
diff changeset
136
a61af66fc99e Initial load
duke
parents:
diff changeset
137 static address remove_activation_entry() { return _remove_activation_entry; }
a61af66fc99e Initial load
duke
parents:
diff changeset
138 static address throw_exception_entry() { return _throw_exception_entry; }
a61af66fc99e Initial load
duke
parents:
diff changeset
139 static address throw_ArithmeticException_entry() { return _throw_ArithmeticException_entry; }
a61af66fc99e Initial load
duke
parents:
diff changeset
140 static address throw_NullPointerException_entry() { return _throw_NullPointerException_entry; }
a61af66fc99e Initial load
duke
parents:
diff changeset
141 static address throw_StackOverflowError_entry() { return _throw_StackOverflowError_entry; }
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // Code generation
a61af66fc99e Initial load
duke
parents:
diff changeset
144 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
145 static address trace_code (TosState state) { return _trace_code.entry(state); }
a61af66fc99e Initial load
duke
parents:
diff changeset
146 #endif // !PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
147 static address continuation (TosState state) { return _continuation_entry.entry(state); }
a61af66fc99e Initial load
duke
parents:
diff changeset
148 static address* dispatch_table(TosState state) { return _active_table.table_for(state); }
a61af66fc99e Initial load
duke
parents:
diff changeset
149 static address* dispatch_table() { return _active_table.table_for(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
150 static int distance_from_dispatch_table(TosState state){ return _active_table.distance_from(state); }
a61af66fc99e Initial load
duke
parents:
diff changeset
151 static address* normal_table(TosState state) { return _normal_table.table_for(state); }
a61af66fc99e Initial load
duke
parents:
diff changeset
152 static address* normal_table() { return _normal_table.table_for(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
153
a61af66fc99e Initial load
duke
parents:
diff changeset
154 // Support for invokes
a61af66fc99e Initial load
duke
parents:
diff changeset
155 static address* return_3_addrs_by_index_table() { return _return_3_addrs_by_index; }
a61af66fc99e Initial load
duke
parents:
diff changeset
156 static address* return_5_addrs_by_index_table() { return _return_5_addrs_by_index; }
a61af66fc99e Initial load
duke
parents:
diff changeset
157 static int TosState_as_index(TosState state); // computes index into return_3_entry_by_index table
a61af66fc99e Initial load
duke
parents:
diff changeset
158
a61af66fc99e Initial load
duke
parents:
diff changeset
159 static address return_entry (TosState state, int length);
a61af66fc99e Initial load
duke
parents:
diff changeset
160 static address deopt_entry (TosState state, int length);
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162 // Safepoint support
a61af66fc99e Initial load
duke
parents:
diff changeset
163 static void notice_safepoints(); // stops the thread when reaching a safepoint
a61af66fc99e Initial load
duke
parents:
diff changeset
164 static void ignore_safepoints(); // ignores safepoints
a61af66fc99e Initial load
duke
parents:
diff changeset
165
a61af66fc99e Initial load
duke
parents:
diff changeset
166 // Deoptimization support
a61af66fc99e Initial load
duke
parents:
diff changeset
167 static address continuation_for(methodOop method,
a61af66fc99e Initial load
duke
parents:
diff changeset
168 address bcp,
a61af66fc99e Initial load
duke
parents:
diff changeset
169 int callee_parameters,
a61af66fc99e Initial load
duke
parents:
diff changeset
170 bool is_top_frame,
a61af66fc99e Initial load
duke
parents:
diff changeset
171 bool& use_next_mdp);
a61af66fc99e Initial load
duke
parents:
diff changeset
172
a61af66fc99e Initial load
duke
parents:
diff changeset
173 #include "incls/_templateInterpreter_pd.hpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
174
a61af66fc99e Initial load
duke
parents:
diff changeset
175 };
a61af66fc99e Initial load
duke
parents:
diff changeset
176
a61af66fc99e Initial load
duke
parents:
diff changeset
177 #endif // !CC_INTERP