1 /*
2 * Copyright (c) 1997, 2012, 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 *
202 }
203 guarantee(__ pc() <= s->code_end(), "overflowed buffer");
204 // shut the door on sizing bugs
205 int slop = 2*BytesPerInstWord; // 32-bit offset is this much larger than a 13-bit one
206 assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for sethi;add");
207
208 s->set_exception_points(npe_addr, ame_addr);
209 return s;
210 }
211
212
213 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
214 if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) return 1000;
215 else {
216 const int slop = 2*BytesPerInstWord; // sethi;add (needed for long offsets)
217 if (is_vtable_stub) {
218 // ld;ld;ld,jmp,nop
219 const int basic = 5*BytesPerInstWord +
220 // shift;add for load_klass (only shift with zero heap based)
221 (UseCompressedKlassPointers ?
222 ((Universe::narrow_klass_base() == NULL) ? BytesPerInstWord : 2*BytesPerInstWord) : 0);
223 return basic + slop;
224 } else {
225 const int basic = (28 LP64_ONLY(+ 6)) * BytesPerInstWord +
226 // shift;add for load_klass (only shift with zero heap based)
227 (UseCompressedKlassPointers ?
228 ((Universe::narrow_klass_base() == NULL) ? BytesPerInstWord : 2*BytesPerInstWord) : 0);
229 return (basic + slop);
230 }
231 }
232
233 // In order to tune these parameters, run the JVM with VM options
234 // +PrintMiscellaneous and +WizardMode to see information about
235 // actual itable stubs. Look for lines like this:
236 // itable #1 at 0x5551212[116] left over: 8
237 // Reduce the constants so that the "left over" number is 8
238 // Do not aim at a left-over number of zero, because a very
239 // large vtable or itable offset (> 4K) will require an extra
240 // sethi/or pair of instructions.
241 //
242 // The JVM98 app. _202_jess has a megamorphic interface call.
243 // The itable code looks like this:
244 // Decoding VtableStub itbl[1]@16
245 // ld [ %o0 + 4 ], %g3
246 // save %sp, -64, %sp
247 // ld [ %g3 + 0xe8 ], %l2
248 // sll %l2, 2, %l2
|
1 /*
2 * Copyright (c) 1997, 2013, 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 *
202 }
203 guarantee(__ pc() <= s->code_end(), "overflowed buffer");
204 // shut the door on sizing bugs
205 int slop = 2*BytesPerInstWord; // 32-bit offset is this much larger than a 13-bit one
206 assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for sethi;add");
207
208 s->set_exception_points(npe_addr, ame_addr);
209 return s;
210 }
211
212
213 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
214 if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) return 1000;
215 else {
216 const int slop = 2*BytesPerInstWord; // sethi;add (needed for long offsets)
217 if (is_vtable_stub) {
218 // ld;ld;ld,jmp,nop
219 const int basic = 5*BytesPerInstWord +
220 // shift;add for load_klass (only shift with zero heap based)
221 (UseCompressedKlassPointers ?
222 MacroAssembler::instr_size_for_decode_klass_not_null() : 0);
223 return basic + slop;
224 } else {
225 const int basic = (28 LP64_ONLY(+ 6)) * BytesPerInstWord +
226 // shift;add for load_klass (only shift with zero heap based)
227 (UseCompressedKlassPointers ?
228 MacroAssembler::instr_size_for_decode_klass_not_null() : 0);
229 return (basic + slop);
230 }
231 }
232
233 // In order to tune these parameters, run the JVM with VM options
234 // +PrintMiscellaneous and +WizardMode to see information about
235 // actual itable stubs. Look for lines like this:
236 // itable #1 at 0x5551212[116] left over: 8
237 // Reduce the constants so that the "left over" number is 8
238 // Do not aim at a left-over number of zero, because a very
239 // large vtable or itable offset (> 4K) will require an extra
240 // sethi/or pair of instructions.
241 //
242 // The JVM98 app. _202_jess has a megamorphic interface call.
243 // The itable code looks like this:
244 // Decoding VtableStub itbl[1]@16
245 // ld [ %o0 + 4 ], %g3
246 // save %sp, -64, %sp
247 // ld [ %g3 + 0xe8 ], %l2
248 // sll %l2, 2, %l2
|