1 /*
2 * Copyright (c) 1997, 2016, 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 *
3329 Label done;
3330 Label initialize_header;
3331 Label initialize_object; // including clearing the fields
3332
3333 Register RallocatedObject = Otos_i;
3334 Register RinstanceKlass = O1;
3335 Register Roffset = O3;
3336 Register Rscratch = O4;
3337
3338 __ get_2_byte_integer_at_bcp(1, Rscratch, Roffset, InterpreterMacroAssembler::Unsigned);
3339 __ get_cpool_and_tags(Rscratch, G3_scratch);
3340 // make sure the class we're about to instantiate has been resolved
3341 // This is done before loading InstanceKlass to be consistent with the order
3342 // how Constant Pool is updated (see ConstantPool::klass_at_put)
3343 __ add(G3_scratch, Array<u1>::base_offset_in_bytes(), G3_scratch);
3344 __ ldub(G3_scratch, Roffset, G3_scratch);
3345 __ cmp(G3_scratch, JVM_CONSTANT_Class);
3346 __ br(Assembler::notEqual, false, Assembler::pn, slow_case);
3347 __ delayed()->sll(Roffset, LogBytesPerWord, Roffset);
3348 // get InstanceKlass
3349 //__ sll(Roffset, LogBytesPerWord, Roffset); // executed in delay slot
3350 __ add(Roffset, sizeof(ConstantPool), Roffset);
3351 __ ld_ptr(Rscratch, Roffset, RinstanceKlass);
3352
3353 // make sure klass is fully initialized:
3354 __ ldub(RinstanceKlass, in_bytes(InstanceKlass::init_state_offset()), G3_scratch);
3355 __ cmp(G3_scratch, InstanceKlass::fully_initialized);
3356 __ br(Assembler::notEqual, false, Assembler::pn, slow_case);
3357 __ delayed()->ld(RinstanceKlass, in_bytes(Klass::layout_helper_offset()), Roffset);
3358
3359 // get instance_size in InstanceKlass (already aligned)
3360 //__ ld(RinstanceKlass, in_bytes(Klass::layout_helper_offset()), Roffset);
3361
3362 // make sure klass does not have has_finalizer, or is abstract, or interface or java/lang/Class
3363 __ btst(Klass::_lh_instance_slow_path_bit, Roffset);
3364 __ br(Assembler::notZero, false, Assembler::pn, slow_case);
3365 __ delayed()->nop();
3366
3367 // allocate the instance
3368 // 1) Try to allocate in the TLAB
3369 // 2) if fail, and the TLAB is not full enough to discard, allocate in the shared Eden
3370 // 3) if the above fails (or is not applicable), go to a slow case
3371 // (creates a new TLAB, etc.)
3557 // Get constant pool tag
3558 __ get_2_byte_integer_at_bcp(1, Lscratch, Roffset, InterpreterMacroAssembler::Unsigned);
3559
3560 // See if the checkcast has been quickened
3561 __ get_cpool_and_tags(Lscratch, G3_scratch);
3562 __ add(G3_scratch, Array<u1>::base_offset_in_bytes(), G3_scratch);
3563 __ ldub(G3_scratch, Roffset, G3_scratch);
3564 __ cmp(G3_scratch, JVM_CONSTANT_Class);
3565 __ br(Assembler::equal, true, Assembler::pt, quicked);
3566 __ delayed()->sll(Roffset, LogBytesPerWord, Roffset);
3567
3568 __ push_ptr(); // save receiver for result, and for GC
3569 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc) );
3570 __ get_vm_result_2(RspecifiedKlass);
3571 __ pop_ptr(Otos_i, G3_scratch); // restore receiver
3572
3573 __ ba_short(resolved);
3574
3575 // Extract target class from constant pool
3576 __ bind(quicked);
3577 __ add(Roffset, sizeof(ConstantPool), Roffset);
3578 __ ld_ptr(Lscratch, Roffset, RspecifiedKlass);
3579 __ bind(resolved);
3580 __ load_klass(Otos_i, RobjKlass); // get value klass
3581
3582 // Generate a fast subtype check. Branch to cast_ok if no
3583 // failure. Throw exception if failure.
3584 __ gen_subtype_check( RobjKlass, RspecifiedKlass, G3_scratch, G4_scratch, G1_scratch, cast_ok );
3585
3586 // Not a subtype; so must throw exception
3587 __ throw_if_not_x( Assembler::never, Interpreter::_throw_ClassCastException_entry, G3_scratch );
3588
3589 __ bind(cast_ok);
3590
3591 if (ProfileInterpreter) {
3592 __ ba_short(done);
3593 }
3594 __ bind(is_null);
3595 __ profile_null_seen(G3_scratch);
3596 __ bind(done);
3597 }
3598
3614 // Get constant pool tag
3615 __ get_2_byte_integer_at_bcp(1, Lscratch, Roffset, InterpreterMacroAssembler::Unsigned);
3616
3617 // See if the checkcast has been quickened
3618 __ get_cpool_and_tags(Lscratch, G3_scratch);
3619 __ add(G3_scratch, Array<u1>::base_offset_in_bytes(), G3_scratch);
3620 __ ldub(G3_scratch, Roffset, G3_scratch);
3621 __ cmp(G3_scratch, JVM_CONSTANT_Class);
3622 __ br(Assembler::equal, true, Assembler::pt, quicked);
3623 __ delayed()->sll(Roffset, LogBytesPerWord, Roffset);
3624
3625 __ push_ptr(); // save receiver for result, and for GC
3626 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc) );
3627 __ get_vm_result_2(RspecifiedKlass);
3628 __ pop_ptr(Otos_i, G3_scratch); // restore receiver
3629
3630 __ ba_short(resolved);
3631
3632 // Extract target class from constant pool
3633 __ bind(quicked);
3634 __ add(Roffset, sizeof(ConstantPool), Roffset);
3635 __ get_constant_pool(Lscratch);
3636 __ ld_ptr(Lscratch, Roffset, RspecifiedKlass);
3637 __ bind(resolved);
3638 __ load_klass(Otos_i, RobjKlass); // get value klass
3639
3640 // Generate a fast subtype check. Branch to cast_ok if no
3641 // failure. Return 0 if failure.
3642 __ or3(G0, 1, Otos_i); // set result assuming quick tests succeed
3643 __ gen_subtype_check( RobjKlass, RspecifiedKlass, G3_scratch, G4_scratch, G1_scratch, done );
3644 // Not a subtype; return 0;
3645 __ clr( Otos_i );
3646
3647 if (ProfileInterpreter) {
3648 __ ba_short(done);
3649 }
3650 __ bind(is_null);
3651 __ profile_null_seen(G3_scratch);
3652 __ bind(done);
3653 }
3654
3655 void TemplateTable::_breakpoint() {
3656
|
1 /*
2 * Copyright (c) 1997, 2017, 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 *
3329 Label done;
3330 Label initialize_header;
3331 Label initialize_object; // including clearing the fields
3332
3333 Register RallocatedObject = Otos_i;
3334 Register RinstanceKlass = O1;
3335 Register Roffset = O3;
3336 Register Rscratch = O4;
3337
3338 __ get_2_byte_integer_at_bcp(1, Rscratch, Roffset, InterpreterMacroAssembler::Unsigned);
3339 __ get_cpool_and_tags(Rscratch, G3_scratch);
3340 // make sure the class we're about to instantiate has been resolved
3341 // This is done before loading InstanceKlass to be consistent with the order
3342 // how Constant Pool is updated (see ConstantPool::klass_at_put)
3343 __ add(G3_scratch, Array<u1>::base_offset_in_bytes(), G3_scratch);
3344 __ ldub(G3_scratch, Roffset, G3_scratch);
3345 __ cmp(G3_scratch, JVM_CONSTANT_Class);
3346 __ br(Assembler::notEqual, false, Assembler::pn, slow_case);
3347 __ delayed()->sll(Roffset, LogBytesPerWord, Roffset);
3348 // get InstanceKlass
3349 __ load_resolved_klass_at_offset(Rscratch, Roffset, RinstanceKlass);
3350
3351 // make sure klass is fully initialized:
3352 __ ldub(RinstanceKlass, in_bytes(InstanceKlass::init_state_offset()), G3_scratch);
3353 __ cmp(G3_scratch, InstanceKlass::fully_initialized);
3354 __ br(Assembler::notEqual, false, Assembler::pn, slow_case);
3355 __ delayed()->ld(RinstanceKlass, in_bytes(Klass::layout_helper_offset()), Roffset);
3356
3357 // get instance_size in InstanceKlass (already aligned)
3358 //__ ld(RinstanceKlass, in_bytes(Klass::layout_helper_offset()), Roffset);
3359
3360 // make sure klass does not have has_finalizer, or is abstract, or interface or java/lang/Class
3361 __ btst(Klass::_lh_instance_slow_path_bit, Roffset);
3362 __ br(Assembler::notZero, false, Assembler::pn, slow_case);
3363 __ delayed()->nop();
3364
3365 // allocate the instance
3366 // 1) Try to allocate in the TLAB
3367 // 2) if fail, and the TLAB is not full enough to discard, allocate in the shared Eden
3368 // 3) if the above fails (or is not applicable), go to a slow case
3369 // (creates a new TLAB, etc.)
3555 // Get constant pool tag
3556 __ get_2_byte_integer_at_bcp(1, Lscratch, Roffset, InterpreterMacroAssembler::Unsigned);
3557
3558 // See if the checkcast has been quickened
3559 __ get_cpool_and_tags(Lscratch, G3_scratch);
3560 __ add(G3_scratch, Array<u1>::base_offset_in_bytes(), G3_scratch);
3561 __ ldub(G3_scratch, Roffset, G3_scratch);
3562 __ cmp(G3_scratch, JVM_CONSTANT_Class);
3563 __ br(Assembler::equal, true, Assembler::pt, quicked);
3564 __ delayed()->sll(Roffset, LogBytesPerWord, Roffset);
3565
3566 __ push_ptr(); // save receiver for result, and for GC
3567 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc) );
3568 __ get_vm_result_2(RspecifiedKlass);
3569 __ pop_ptr(Otos_i, G3_scratch); // restore receiver
3570
3571 __ ba_short(resolved);
3572
3573 // Extract target class from constant pool
3574 __ bind(quicked);
3575 __ load_resolved_klass_at_offset(Lscratch, Roffset, RspecifiedKlass);
3576
3577
3578 __ bind(resolved);
3579 __ load_klass(Otos_i, RobjKlass); // get value klass
3580
3581 // Generate a fast subtype check. Branch to cast_ok if no
3582 // failure. Throw exception if failure.
3583 __ gen_subtype_check( RobjKlass, RspecifiedKlass, G3_scratch, G4_scratch, G1_scratch, cast_ok );
3584
3585 // Not a subtype; so must throw exception
3586 __ throw_if_not_x( Assembler::never, Interpreter::_throw_ClassCastException_entry, G3_scratch );
3587
3588 __ bind(cast_ok);
3589
3590 if (ProfileInterpreter) {
3591 __ ba_short(done);
3592 }
3593 __ bind(is_null);
3594 __ profile_null_seen(G3_scratch);
3595 __ bind(done);
3596 }
3597
3613 // Get constant pool tag
3614 __ get_2_byte_integer_at_bcp(1, Lscratch, Roffset, InterpreterMacroAssembler::Unsigned);
3615
3616 // See if the checkcast has been quickened
3617 __ get_cpool_and_tags(Lscratch, G3_scratch);
3618 __ add(G3_scratch, Array<u1>::base_offset_in_bytes(), G3_scratch);
3619 __ ldub(G3_scratch, Roffset, G3_scratch);
3620 __ cmp(G3_scratch, JVM_CONSTANT_Class);
3621 __ br(Assembler::equal, true, Assembler::pt, quicked);
3622 __ delayed()->sll(Roffset, LogBytesPerWord, Roffset);
3623
3624 __ push_ptr(); // save receiver for result, and for GC
3625 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc) );
3626 __ get_vm_result_2(RspecifiedKlass);
3627 __ pop_ptr(Otos_i, G3_scratch); // restore receiver
3628
3629 __ ba_short(resolved);
3630
3631 // Extract target class from constant pool
3632 __ bind(quicked);
3633 __ get_constant_pool(Lscratch);
3634 __ load_resolved_klass_at_offset(Lscratch, Roffset, RspecifiedKlass);
3635
3636 __ bind(resolved);
3637 __ load_klass(Otos_i, RobjKlass); // get value klass
3638
3639 // Generate a fast subtype check. Branch to cast_ok if no
3640 // failure. Return 0 if failure.
3641 __ or3(G0, 1, Otos_i); // set result assuming quick tests succeed
3642 __ gen_subtype_check( RobjKlass, RspecifiedKlass, G3_scratch, G4_scratch, G1_scratch, done );
3643 // Not a subtype; return 0;
3644 __ clr( Otos_i );
3645
3646 if (ProfileInterpreter) {
3647 __ ba_short(done);
3648 }
3649 __ bind(is_null);
3650 __ profile_null_seen(G3_scratch);
3651 __ bind(done);
3652 }
3653
3654 void TemplateTable::_breakpoint() {
3655
|