Thu, 07 Oct 2010 08:06:06 -0700
6983240: guarantee((Solaris::min_stack_allowed >= (StackYellowPages+StackRedPages...) wrong
Summary: min_stack_allowed is a compile time constant and Stack*Pages are settable
Reviewed-by: dholmes, kvn
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 */
25 // C1_MacroAssembler contains high-level macros for C1
27 private:
28 int _rsp_offset; // track rsp changes
29 // initialization
30 void pd_init() { _rsp_offset = 0; }
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 );
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);
45 // locking
46 // hdr : must be rax, contents destroyed
47 // obj : must point to the object to lock, contents preserved
48 // disp_hdr: must point to the displaced header location, contents preserved
49 // scratch : scratch register, contents destroyed
50 // returns code offset at which to add null check debug information
51 int lock_object (Register swap, Register obj, Register disp_hdr, Register scratch, Label& slow_case);
53 // unlocking
54 // hdr : contents destroyed
55 // obj : must point to the object to lock, contents preserved
56 // disp_hdr: must be eax & must point to the displaced header location, contents destroyed
57 void unlock_object(Register swap, Register obj, Register lock, Label& slow_case);
59 void initialize_object(
60 Register obj, // result: pointer to object after successful allocation
61 Register klass, // object klass
62 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise
63 int con_size_in_bytes, // object size in bytes if known at compile time
64 Register t1, // temp register
65 Register t2 // temp register
66 );
68 // allocation of fixed-size objects
69 // (can also be used to allocate fixed-size arrays, by setting
70 // hdr_size correctly and storing the array length afterwards)
71 // obj : must be rax, will contain pointer to allocated object
72 // t1, t2 : scratch registers - contents destroyed
73 // header_size: size of object header in words
74 // object_size: total size of object in words
75 // slow_case : exit to slow case implementation if fast allocation fails
76 void allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case);
78 enum {
79 max_array_allocation_length = 0x00FFFFFF
80 };
82 // allocation of arrays
83 // obj : must be rax, will contain pointer to allocated object
84 // len : array length in number of elements
85 // t : scratch register - contents destroyed
86 // header_size: size of object header in words
87 // f : element scale factor
88 // slow_case : exit to slow case implementation if fast allocation fails
89 void allocate_array(Register obj, Register len, Register t, Register t2, int header_size, Address::ScaleFactor f, Register klass, Label& slow_case);
91 int rsp_offset() const { return _rsp_offset; }
92 void set_rsp_offset(int n) { _rsp_offset = n; }
94 // Note: NEVER push values directly, but only through following push_xxx functions;
95 // This helps us to track the rsp changes compared to the entry rsp (->_rsp_offset)
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"); }
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 }
110 void dec_stack_after_call (int nof_words) {
111 _rsp_offset -= nof_words;
112 assert(_rsp_offset >= 0, "stack offset underflow");
113 }
115 void invalidate_registers(bool inv_rax, bool inv_rbx, bool inv_rcx, bool inv_rdx, bool inv_rsi, bool inv_rdi) PRODUCT_RETURN;