annotate src/cpu/x86/vm/c1_MacroAssembler_x86.hpp @ 10408:836a62f43af9

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 19 Jun 2013 10:45:56 +0200
parents ce248dc0a656
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 1999, 2010, 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: 337
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 337
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: 337
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
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
0
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // C1_MacroAssembler contains high-level macros for C1
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
31 int _rsp_offset; // track rsp changes
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // initialization
a61af66fc99e Initial load
duke
parents:
diff changeset
33 void pd_init() { _rsp_offset = 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
36 void try_allocate(
a61af66fc99e Initial load
duke
parents:
diff changeset
37 Register obj, // result: pointer to object after successful allocation
a61af66fc99e Initial load
duke
parents:
diff changeset
38 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise
a61af66fc99e Initial load
duke
parents:
diff changeset
39 int con_size_in_bytes, // object size in bytes if known at compile time
a61af66fc99e Initial load
duke
parents:
diff changeset
40 Register t1, // temp register
a61af66fc99e Initial load
duke
parents:
diff changeset
41 Register t2, // temp register
a61af66fc99e Initial load
duke
parents:
diff changeset
42 Label& slow_case // continuation point if fast allocation fails
a61af66fc99e Initial load
duke
parents:
diff changeset
43 );
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 void initialize_header(Register obj, Register klass, Register len, Register t1, Register t2);
a61af66fc99e Initial load
duke
parents:
diff changeset
46 void initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1);
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // locking
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // hdr : must be rax, contents destroyed
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // obj : must point to the object to lock, contents preserved
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // disp_hdr: must point to the displaced header location, contents preserved
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // scratch : scratch register, contents destroyed
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // returns code offset at which to add null check debug information
7126
ce248dc0a656 removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents: 3714
diff changeset
54 int lock_object (Register swap, Register obj, Register disp_hdr, Register scratch, Label& slow_case);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // unlocking
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // hdr : contents destroyed
a61af66fc99e Initial load
duke
parents:
diff changeset
58 // obj : must point to the object to lock, contents preserved
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // disp_hdr: must be eax & must point to the displaced header location, contents destroyed
7126
ce248dc0a656 removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents: 3714
diff changeset
60 void unlock_object(Register swap, Register obj, Register lock, Label& slow_case);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 void initialize_object(
a61af66fc99e Initial load
duke
parents:
diff changeset
63 Register obj, // result: pointer to object after successful allocation
a61af66fc99e Initial load
duke
parents:
diff changeset
64 Register klass, // object klass
a61af66fc99e Initial load
duke
parents:
diff changeset
65 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise
a61af66fc99e Initial load
duke
parents:
diff changeset
66 int con_size_in_bytes, // object size in bytes if known at compile time
a61af66fc99e Initial load
duke
parents:
diff changeset
67 Register t1, // temp register
a61af66fc99e Initial load
duke
parents:
diff changeset
68 Register t2 // temp register
a61af66fc99e Initial load
duke
parents:
diff changeset
69 );
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // allocation of fixed-size objects
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // (can also be used to allocate fixed-size arrays, by setting
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // hdr_size correctly and storing the array length afterwards)
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // obj : must be rax, will contain pointer to allocated object
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // t1, t2 : scratch registers - contents destroyed
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // header_size: size of object header in words
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // object_size: total size of object in words
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // slow_case : exit to slow case implementation if fast allocation fails
a61af66fc99e Initial load
duke
parents:
diff changeset
79 void allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case);
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 enum {
a61af66fc99e Initial load
duke
parents:
diff changeset
82 max_array_allocation_length = 0x00FFFFFF
a61af66fc99e Initial load
duke
parents:
diff changeset
83 };
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // allocation of arrays
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // obj : must be rax, will contain pointer to allocated object
a61af66fc99e Initial load
duke
parents:
diff changeset
87 // len : array length in number of elements
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // t : scratch register - contents destroyed
a61af66fc99e Initial load
duke
parents:
diff changeset
89 // header_size: size of object header in words
a61af66fc99e Initial load
duke
parents:
diff changeset
90 // f : element scale factor
a61af66fc99e Initial load
duke
parents:
diff changeset
91 // slow_case : exit to slow case implementation if fast allocation fails
a61af66fc99e Initial load
duke
parents:
diff changeset
92 void allocate_array(Register obj, Register len, Register t, Register t2, int header_size, Address::ScaleFactor f, Register klass, Label& slow_case);
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 int rsp_offset() const { return _rsp_offset; }
a61af66fc99e Initial load
duke
parents:
diff changeset
95 void set_rsp_offset(int n) { _rsp_offset = n; }
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // Note: NEVER push values directly, but only through following push_xxx functions;
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // This helps us to track the rsp changes compared to the entry rsp (->_rsp_offset)
a61af66fc99e Initial load
duke
parents:
diff changeset
99
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 0
diff changeset
100 void push_jint (jint i) { _rsp_offset++; push(i); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
101 void push_oop (jobject o) { _rsp_offset++; pushoop(o); }
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 0
diff changeset
102 // Seems to always be in wordSize
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 0
diff changeset
103 void push_addr (Address a) { _rsp_offset++; pushptr(a); }
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 0
diff changeset
104 void push_reg (Register r) { _rsp_offset++; push(r); }
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 0
diff changeset
105 void pop_reg (Register r) { _rsp_offset--; pop(r); assert(_rsp_offset >= 0, "stack offset underflow"); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 void dec_stack (int nof_words) {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 _rsp_offset -= nof_words;
a61af66fc99e Initial load
duke
parents:
diff changeset
109 assert(_rsp_offset >= 0, "stack offset underflow");
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 0
diff changeset
110 addptr(rsp, wordSize * nof_words);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 void dec_stack_after_call (int nof_words) {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 _rsp_offset -= nof_words;
a61af66fc99e Initial load
duke
parents:
diff changeset
115 assert(_rsp_offset >= 0, "stack offset underflow");
a61af66fc99e Initial load
duke
parents:
diff changeset
116 }
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 void invalidate_registers(bool inv_rax, bool inv_rbx, bool inv_rcx, bool inv_rdx, bool inv_rsi, bool inv_rdi) PRODUCT_RETURN;
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
119
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
120 #endif // CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP