1 /*
2 * Copyright 1999-2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
356 __ block_comment("patch entry point");
357 }
358 __ call(RuntimeAddress(target));
359 assert(_patch_info_offset == (patch_info_pc - __ pc()), "must not change");
360 ce->add_call_info_here(_info);
361 int jmp_off = __ offset();
362 __ jmp(_patch_site_entry);
363 // Add enough nops so deoptimization can overwrite the jmp above with a call
364 // and not destroy the world.
365 for (int j = __ offset() ; j < jmp_off + 5 ; j++ ) {
366 __ nop();
367 }
368 if (_id == load_klass_id) {
369 CodeSection* cs = __ code_section();
370 RelocIterator iter(cs, (address)_pc_start, (address)(_pc_start + 1));
371 relocInfo::change_reloc_info_for_address(&iter, (address) _pc_start, relocInfo::oop_type, relocInfo::none);
372 }
373 }
374
375
376 void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) {
377 ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
378 __ bind(_entry);
379 __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id)));
380 ce->add_call_info_here(_info);
381 debug_only(__ should_not_reach_here());
382 }
383
384
385 void SimpleExceptionStub::emit_code(LIR_Assembler* ce) {
386 assert(__ rsp_offset() == 0, "frame size should be fixed");
387
388 __ bind(_entry);
389 // pass the object on stack because all registers must be preserved
390 if (_obj->is_cpu_register()) {
391 ce->store_parameter(_obj->as_register(), 0);
392 }
393 __ call(RuntimeAddress(Runtime1::entry_for(_stub)));
394 ce->add_call_info_here(_info);
395 debug_only(__ should_not_reach_here());
|
1 /*
2 * Copyright 1999-2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
356 __ block_comment("patch entry point");
357 }
358 __ call(RuntimeAddress(target));
359 assert(_patch_info_offset == (patch_info_pc - __ pc()), "must not change");
360 ce->add_call_info_here(_info);
361 int jmp_off = __ offset();
362 __ jmp(_patch_site_entry);
363 // Add enough nops so deoptimization can overwrite the jmp above with a call
364 // and not destroy the world.
365 for (int j = __ offset() ; j < jmp_off + 5 ; j++ ) {
366 __ nop();
367 }
368 if (_id == load_klass_id) {
369 CodeSection* cs = __ code_section();
370 RelocIterator iter(cs, (address)_pc_start, (address)(_pc_start + 1));
371 relocInfo::change_reloc_info_for_address(&iter, (address) _pc_start, relocInfo::oop_type, relocInfo::none);
372 }
373 }
374
375
376 void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
377 __ bind(_entry);
378 __ call(RuntimeAddress(SharedRuntime::deopt_blob()->unpack_with_reexecution()));
379 ce->add_call_info_here(_info);
380 debug_only(__ should_not_reach_here());
381 }
382
383
384 void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) {
385 ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
386 __ bind(_entry);
387 __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id)));
388 ce->add_call_info_here(_info);
389 debug_only(__ should_not_reach_here());
390 }
391
392
393 void SimpleExceptionStub::emit_code(LIR_Assembler* ce) {
394 assert(__ rsp_offset() == 0, "frame size should be fixed");
395
396 __ bind(_entry);
397 // pass the object on stack because all registers must be preserved
398 if (_obj->is_cpu_register()) {
399 ce->store_parameter(_obj->as_register(), 0);
400 }
401 __ call(RuntimeAddress(Runtime1::entry_for(_stub)));
402 ce->add_call_info_here(_info);
403 debug_only(__ should_not_reach_here());
|