117 }
118 L.bind_loc(locator());
119 L.patch_instructions((MacroAssembler*)this);
120 }
121
122 void AbstractAssembler::generate_stack_overflow_check( int frame_size_in_bytes) {
123 if (UseStackBanging) {
124 // Each code entry causes one stack bang n pages down the stack where n
125 // is configurable by StackShadowPages. The setting depends on the maximum
126 // depth of VM call stack or native before going back into java code,
127 // since only java code can raise a stack overflow exception using the
128 // stack banging mechanism. The VM and native code does not detect stack
129 // overflow.
130 // The code in JavaCalls::call() checks that there is at least n pages
131 // available, so all entry code needs to do is bang once for the end of
132 // this shadow zone.
133 // The entry code may need to bang additional pages if the framesize
134 // is greater than a page.
135
136 const int page_size = os::vm_page_size();
137 int bang_end = StackShadowPages*page_size;
138
139 // This is how far the previous frame's stack banging extended.
140 const int bang_end_safe = bang_end;
141
142 if (frame_size_in_bytes > page_size) {
143 bang_end += frame_size_in_bytes;
144 }
145
146 int bang_offset = bang_end_safe;
147 while (bang_offset <= bang_end) {
148 // Need at least one stack bang at end of shadow zone.
149 bang_stack_with_offset(bang_offset);
150 bang_offset += page_size;
151 }
152 } // end (UseStackBanging)
153 }
154
155 void Label::add_patch_at(CodeBuffer* cb, int branch_loc) {
156 assert(_loc == -1, "Label is unbound");
157 if (_patch_index < PatchCacheSize) {
|
117 }
118 L.bind_loc(locator());
119 L.patch_instructions((MacroAssembler*)this);
120 }
121
122 void AbstractAssembler::generate_stack_overflow_check( int frame_size_in_bytes) {
123 if (UseStackBanging) {
124 // Each code entry causes one stack bang n pages down the stack where n
125 // is configurable by StackShadowPages. The setting depends on the maximum
126 // depth of VM call stack or native before going back into java code,
127 // since only java code can raise a stack overflow exception using the
128 // stack banging mechanism. The VM and native code does not detect stack
129 // overflow.
130 // The code in JavaCalls::call() checks that there is at least n pages
131 // available, so all entry code needs to do is bang once for the end of
132 // this shadow zone.
133 // The entry code may need to bang additional pages if the framesize
134 // is greater than a page.
135
136 const int page_size = os::vm_page_size();
137
138 // The stack banging code from the deopt/uncommon trap blobs
139 // (debug only) and the compiled code must be consistent. The
140 // deopt/uncommon trap blobs bang up to and including the
141 // StackShadowPages+1 page + the number of pages in the frame.
142 int bang_end = (StackShadowPages+1)*page_size;
143
144 // This is how far the previous frame's stack banging extended.
145 const int bang_end_safe = bang_end;
146
147 if (frame_size_in_bytes > page_size) {
148 bang_end += frame_size_in_bytes;
149 }
150
151 int bang_offset = bang_end_safe;
152 while (bang_offset <= bang_end) {
153 // Need at least one stack bang at end of shadow zone.
154 bang_stack_with_offset(bang_offset);
155 bang_offset += page_size;
156 }
157 } // end (UseStackBanging)
158 }
159
160 void Label::add_patch_at(CodeBuffer* cb, int branch_loc) {
161 assert(_loc == -1, "Label is unbound");
162 if (_patch_index < PatchCacheSize) {
|