1 /*
2 * Copyright (c) 1999, 2008, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // C1_MacroAssembler contains high-level macros for C1
26
27 private:
28 int _rsp_offset; // track rsp changes
29 // initialization
30 void pd_init() { _rsp_offset = 0; }
31
32 public:
33 void try_allocate(
34 Register obj, // result: pointer to object after successful allocation
35 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise
36 int con_size_in_bytes, // object size in bytes if known at compile time
37 Register t1, // temp register
38 Register t2, // temp register
39 Label& slow_case // continuation point if fast allocation fails
40 );
41
42 void initialize_header(Register obj, Register klass, Register len, Register t1, Register t2);
43 void initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1);
44
96
97 void push_jint (jint i) { _rsp_offset++; push(i); }
98 void push_oop (jobject o) { _rsp_offset++; pushoop(o); }
99 // Seems to always be in wordSize
100 void push_addr (Address a) { _rsp_offset++; pushptr(a); }
101 void push_reg (Register r) { _rsp_offset++; push(r); }
102 void pop_reg (Register r) { _rsp_offset--; pop(r); assert(_rsp_offset >= 0, "stack offset underflow"); }
103
104 void dec_stack (int nof_words) {
105 _rsp_offset -= nof_words;
106 assert(_rsp_offset >= 0, "stack offset underflow");
107 addptr(rsp, wordSize * nof_words);
108 }
109
110 void dec_stack_after_call (int nof_words) {
111 _rsp_offset -= nof_words;
112 assert(_rsp_offset >= 0, "stack offset underflow");
113 }
114
115 void invalidate_registers(bool inv_rax, bool inv_rbx, bool inv_rcx, bool inv_rdx, bool inv_rsi, bool inv_rdi) PRODUCT_RETURN;
|
1 /*
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP
26 #define CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP
27
28 // C1_MacroAssembler contains high-level macros for C1
29
30 private:
31 int _rsp_offset; // track rsp changes
32 // initialization
33 void pd_init() { _rsp_offset = 0; }
34
35 public:
36 void try_allocate(
37 Register obj, // result: pointer to object after successful allocation
38 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise
39 int con_size_in_bytes, // object size in bytes if known at compile time
40 Register t1, // temp register
41 Register t2, // temp register
42 Label& slow_case // continuation point if fast allocation fails
43 );
44
45 void initialize_header(Register obj, Register klass, Register len, Register t1, Register t2);
46 void initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1);
47
99
100 void push_jint (jint i) { _rsp_offset++; push(i); }
101 void push_oop (jobject o) { _rsp_offset++; pushoop(o); }
102 // Seems to always be in wordSize
103 void push_addr (Address a) { _rsp_offset++; pushptr(a); }
104 void push_reg (Register r) { _rsp_offset++; push(r); }
105 void pop_reg (Register r) { _rsp_offset--; pop(r); assert(_rsp_offset >= 0, "stack offset underflow"); }
106
107 void dec_stack (int nof_words) {
108 _rsp_offset -= nof_words;
109 assert(_rsp_offset >= 0, "stack offset underflow");
110 addptr(rsp, wordSize * nof_words);
111 }
112
113 void dec_stack_after_call (int nof_words) {
114 _rsp_offset -= nof_words;
115 assert(_rsp_offset >= 0, "stack offset underflow");
116 }
117
118 void invalidate_registers(bool inv_rax, bool inv_rbx, bool inv_rcx, bool inv_rdx, bool inv_rsi, bool inv_rdi) PRODUCT_RETURN;
119
120 #endif // CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP
|