1 #ifdef USE_PRAGMA_IDENT_HDR
2 #pragma ident "@(#)interp_masm_x86_32.hpp 1.88 07/08/29 13:42:13 JVM"
3 #endif
4 /*
5 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
51
52 // base routine for all dispatches
53 void dispatch_base(TosState state, address* table, bool verifyoop = true);
54 #endif /* CC_INTERP */
55
56 public:
57 InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {}
58
59 void load_earlyret_value(TosState state);
60
61 // Interpreter-specific registers
62 #ifdef CC_INTERP
63 void save_bcp() { /* not needed in c++ interpreter and harmless */ }
64 void restore_bcp() { /* not needed in c++ interpreter and harmless */ }
65
66 // Helpers for runtime call arguments/results
67 void get_method(Register reg);
68
69 #else
70
71 void save_bcp() { movl(Address(rbp, frame::interpreter_frame_bcx_offset * wordSize), rsi); }
72 void restore_bcp() { movl(rsi, Address(rbp, frame::interpreter_frame_bcx_offset * wordSize)); }
73 void restore_locals() { movl(rdi, Address(rbp, frame::interpreter_frame_locals_offset * wordSize)); }
74
75 // Helpers for runtime call arguments/results
76 void get_method(Register reg) { movl(reg, Address(rbp, frame::interpreter_frame_method_offset * wordSize)); }
77 void get_constant_pool(Register reg) { get_method(reg); movl(reg, Address(reg, methodOopDesc::constants_offset())); }
78 void get_constant_pool_cache(Register reg) { get_constant_pool(reg); movl(reg, Address(reg, constantPoolOopDesc::cache_offset_in_bytes())); }
79 void get_cpool_and_tags(Register cpool, Register tags) { get_constant_pool(cpool); movl(tags, Address(cpool, constantPoolOopDesc::tags_offset_in_bytes()));
80 }
81 void get_unsigned_2_byte_index_at_bcp(Register reg, int bcp_offset);
82 void get_cache_and_index_at_bcp(Register cache, Register index, int bcp_offset);
83 void get_cache_entry_pointer_at_bcp(Register cache, Register tmp, int bcp_offset);
84
85 // Expression stack
86 void f2ieee(); // truncate ftos to 32bits
87 void d2ieee(); // truncate dtos to 64bits
88 #endif // CC_INTERP
89
90
91 void pop_ptr(Register r = rax);
92 void pop_ptr(Register r, Register tag);
93 void pop_i(Register r = rax);
94 void pop_l(Register lo = rax, Register hi = rdx);
95 void pop_f();
96 void pop_d();
97 void pop_ftos_to_rsp();
98 void pop_dtos_to_rsp();
99
100 void push_ptr(Register r = rax);
101 void push_ptr(Register r, Register tag);
102 void push_i(Register r = rax);
103 void push_l(Register lo = rax, Register hi = rdx);
104 void push_d(Register r = rax);
105 void push_f();
106
107 void pop(TosState state); // transition vtos -> state
108 void push(TosState state); // transition state -> vtos
109
110 DEBUG_ONLY(void verify_stack_tag(frame::Tag t);)
111
112 #ifndef CC_INTERP
113
114 void empty_expression_stack() {
115 movl(rsp, Address(rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize));
116 // NULL last_sp until next java call
117 movl(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD);
118 }
119
120 // Tagged stack helpers for swap and dup
121 void load_ptr_and_tag(int n, Register val, Register tag);
122 void store_ptr_and_tag(int n, Register val, Register tag);
123
124 // Tagged Local support
125
126 void tag_local(frame::Tag tag, int n);
127 void tag_local(Register tag, int n);
128 void tag_local(frame::Tag tag, Register idx);
129 void tag_local(Register tag, Register idx);
130
131 #ifdef ASSERT
132 void verify_local_tag(frame::Tag tag, int n);
133 void verify_local_tag(frame::Tag tag, Register idx);
134 #endif // ASSERT
135
136 // Super call_VM calls - correspond to MacroAssembler::call_VM(_leaf) calls
137 void super_call_VM_leaf(address entry_point);
219 void profile_not_taken_branch(Register mdp);
220 void profile_call(Register mdp);
221 void profile_final_call(Register mdp);
222 void profile_virtual_call(Register receiver, Register mdp, Register scratch2);
223 void profile_ret(Register return_bci, Register mdp);
224 void profile_null_seen(Register mdp);
225 void profile_typecheck(Register mdp, Register klass, Register scratch);
226 void profile_typecheck_failed(Register mdp);
227 void profile_switch_default(Register mdp);
228 void profile_switch_case(Register index_in_scratch, Register mdp, Register scratch2);
229
230 #endif /* !CC_INTERP */
231
232 typedef enum { NotifyJVMTI, SkipNotifyJVMTI } NotifyMethodExitMode;
233
234 // support for jvmti
235 void notify_method_entry();
236 void notify_method_exit(TosState state, NotifyMethodExitMode mode);
237
238 };
239
|
1 /*
2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
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 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
48
49 // base routine for all dispatches
50 void dispatch_base(TosState state, address* table, bool verifyoop = true);
51 #endif /* CC_INTERP */
52
53 public:
54 InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {}
55
56 void load_earlyret_value(TosState state);
57
58 // Interpreter-specific registers
59 #ifdef CC_INTERP
60 void save_bcp() { /* not needed in c++ interpreter and harmless */ }
61 void restore_bcp() { /* not needed in c++ interpreter and harmless */ }
62
63 // Helpers for runtime call arguments/results
64 void get_method(Register reg);
65
66 #else
67
68 void save_bcp() { movptr(Address(rbp, frame::interpreter_frame_bcx_offset * wordSize), rsi); }
69 void restore_bcp() { movptr(rsi, Address(rbp, frame::interpreter_frame_bcx_offset * wordSize)); }
70 void restore_locals() { movptr(rdi, Address(rbp, frame::interpreter_frame_locals_offset * wordSize)); }
71
72 // Helpers for runtime call arguments/results
73 void get_method(Register reg) { movptr(reg, Address(rbp, frame::interpreter_frame_method_offset * wordSize)); }
74 void get_constant_pool(Register reg) { get_method(reg); movptr(reg, Address(reg, methodOopDesc::constants_offset())); }
75 void get_constant_pool_cache(Register reg) { get_constant_pool(reg); movptr(reg, Address(reg, constantPoolOopDesc::cache_offset_in_bytes())); }
76 void get_cpool_and_tags(Register cpool, Register tags) { get_constant_pool(cpool); movptr(tags, Address(cpool, constantPoolOopDesc::tags_offset_in_bytes()));
77 }
78 void get_unsigned_2_byte_index_at_bcp(Register reg, int bcp_offset);
79 void get_cache_and_index_at_bcp(Register cache, Register index, int bcp_offset);
80 void get_cache_entry_pointer_at_bcp(Register cache, Register tmp, int bcp_offset);
81
82 // Expression stack
83 void f2ieee(); // truncate ftos to 32bits
84 void d2ieee(); // truncate dtos to 64bits
85
86 void pop_ptr(Register r = rax);
87 void pop_ptr(Register r, Register tag);
88 void pop_i(Register r = rax);
89 void pop_l(Register lo = rax, Register hi = rdx);
90 void pop_f();
91 void pop_d();
92 void pop_ftos_to_rsp();
93 void pop_dtos_to_rsp();
94
95 void push_ptr(Register r = rax);
96 void push_ptr(Register r, Register tag);
97 void push_i(Register r = rax);
98 void push_l(Register lo = rax, Register hi = rdx);
99 void push_d(Register r = rax);
100 void push_f();
101
102 void pop(TosState state); // transition vtos -> state
103 void push(TosState state); // transition state -> vtos
104
105 void pop(Register r ) { ((MacroAssembler*)this)->pop(r); }
106
107 void push(Register r ) { ((MacroAssembler*)this)->push(r); }
108 void push(int32_t imm ) { ((MacroAssembler*)this)->push(imm); }
109
110 // These are dummies to prevent surprise implicit conversions to Register
111 void pop(void* v ); // Add unimplemented ambiguous method
112 void push(void* v ); // Add unimplemented ambiguous method
113
114 DEBUG_ONLY(void verify_stack_tag(frame::Tag t);)
115
116 #endif // CC_INTERP
117
118 #ifndef CC_INTERP
119
120 void empty_expression_stack() {
121 movptr(rsp, Address(rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize));
122 // NULL last_sp until next java call
123 movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
124 }
125
126 // Tagged stack helpers for swap and dup
127 void load_ptr_and_tag(int n, Register val, Register tag);
128 void store_ptr_and_tag(int n, Register val, Register tag);
129
130 // Tagged Local support
131
132 void tag_local(frame::Tag tag, int n);
133 void tag_local(Register tag, int n);
134 void tag_local(frame::Tag tag, Register idx);
135 void tag_local(Register tag, Register idx);
136
137 #ifdef ASSERT
138 void verify_local_tag(frame::Tag tag, int n);
139 void verify_local_tag(frame::Tag tag, Register idx);
140 #endif // ASSERT
141
142 // Super call_VM calls - correspond to MacroAssembler::call_VM(_leaf) calls
143 void super_call_VM_leaf(address entry_point);
225 void profile_not_taken_branch(Register mdp);
226 void profile_call(Register mdp);
227 void profile_final_call(Register mdp);
228 void profile_virtual_call(Register receiver, Register mdp, Register scratch2);
229 void profile_ret(Register return_bci, Register mdp);
230 void profile_null_seen(Register mdp);
231 void profile_typecheck(Register mdp, Register klass, Register scratch);
232 void profile_typecheck_failed(Register mdp);
233 void profile_switch_default(Register mdp);
234 void profile_switch_case(Register index_in_scratch, Register mdp, Register scratch2);
235
236 #endif /* !CC_INTERP */
237
238 typedef enum { NotifyJVMTI, SkipNotifyJVMTI } NotifyMethodExitMode;
239
240 // support for jvmti
241 void notify_method_entry();
242 void notify_method_exit(TosState state, NotifyMethodExitMode mode);
243
244 };
|