2694
2695 // Class initialization barrier for static methods
2696 if (VM_Version::supports_fast_class_init_checks() && bytecode() == Bytecodes::_invokestatic) {
2697 const Register method = temp;
2698 const Register klass = temp;
2699 const Register thread = LP64_ONLY(r15_thread) NOT_LP64(noreg);
2700 assert(thread != noreg, "x86_32 not supported");
2701
2702 __ movptr(method, Address(cache, in_bytes(ResolvedMethodEntry::method_offset())));
2703 __ load_method_holder(klass, method);
2704 __ clinit_barrier(klass, thread, nullptr /*L_fast_path*/, &L_clinit_barrier_slow);
2705 }
2706 }
2707
2708 void TemplateTable::resolve_cache_and_index_for_field(int byte_no,
2709 Register cache,
2710 Register index) {
2711 const Register temp = rbx;
2712 assert_different_registers(cache, index, temp);
2713
2714 Label resolved;
2715
2716 Bytecodes::Code code = bytecode();
2717 switch (code) {
2718 case Bytecodes::_nofast_getfield: code = Bytecodes::_getfield; break;
2719 case Bytecodes::_nofast_putfield: code = Bytecodes::_putfield; break;
2720 default: break;
2721 }
2722
2723 assert(byte_no == f1_byte || byte_no == f2_byte, "byte_no out of range");
2724 __ load_field_entry(cache, index);
2725 if (byte_no == f1_byte) {
2726 __ load_unsigned_byte(temp, Address(cache, in_bytes(ResolvedFieldEntry::get_code_offset())));
2727 } else {
2728 __ load_unsigned_byte(temp, Address(cache, in_bytes(ResolvedFieldEntry::put_code_offset())));
2729 }
2730 __ cmpl(temp, code); // have we resolved this bytecode?
2731 __ jcc(Assembler::equal, resolved);
2732
2733 // resolve first time through
2734 address entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_from_cache);
2735 __ movl(temp, code);
2736 __ call_VM(noreg, entry, temp);
2737 // Update registers with resolved info
2738 __ load_field_entry(cache, index);
2739
2740 __ bind(resolved);
2741 }
2742
2743 void TemplateTable::load_resolved_field_entry(Register obj,
2744 Register cache,
2745 Register tos_state,
2746 Register offset,
2747 Register flags,
2748 bool is_static = false) {
2749 assert_different_registers(cache, tos_state, flags, offset);
2750
2751 // Field offset
2752 __ load_sized_value(offset, Address(cache, in_bytes(ResolvedFieldEntry::field_offset_offset())), sizeof(int), true /*is_signed*/);
2753
2754 // Flags
2755 __ load_unsigned_byte(flags, Address(cache, in_bytes(ResolvedFieldEntry::flags_offset())));
2756
2757 // TOS state
2758 __ load_unsigned_byte(tos_state, Address(cache, in_bytes(ResolvedFieldEntry::type_offset())));
2759
2760 // Klass overwrite register
|
2694
2695 // Class initialization barrier for static methods
2696 if (VM_Version::supports_fast_class_init_checks() && bytecode() == Bytecodes::_invokestatic) {
2697 const Register method = temp;
2698 const Register klass = temp;
2699 const Register thread = LP64_ONLY(r15_thread) NOT_LP64(noreg);
2700 assert(thread != noreg, "x86_32 not supported");
2701
2702 __ movptr(method, Address(cache, in_bytes(ResolvedMethodEntry::method_offset())));
2703 __ load_method_holder(klass, method);
2704 __ clinit_barrier(klass, thread, nullptr /*L_fast_path*/, &L_clinit_barrier_slow);
2705 }
2706 }
2707
2708 void TemplateTable::resolve_cache_and_index_for_field(int byte_no,
2709 Register cache,
2710 Register index) {
2711 const Register temp = rbx;
2712 assert_different_registers(cache, index, temp);
2713
2714 Label L_clinit_barrier_slow;
2715 Label resolved;
2716
2717 Bytecodes::Code code = bytecode();
2718 switch (code) {
2719 case Bytecodes::_nofast_getfield: code = Bytecodes::_getfield; break;
2720 case Bytecodes::_nofast_putfield: code = Bytecodes::_putfield; break;
2721 default: break;
2722 }
2723
2724 assert(byte_no == f1_byte || byte_no == f2_byte, "byte_no out of range");
2725 __ load_field_entry(cache, index);
2726 if (byte_no == f1_byte) {
2727 __ load_unsigned_byte(temp, Address(cache, in_bytes(ResolvedFieldEntry::get_code_offset())));
2728 } else {
2729 __ load_unsigned_byte(temp, Address(cache, in_bytes(ResolvedFieldEntry::put_code_offset())));
2730 }
2731 __ cmpl(temp, code); // have we resolved this bytecode?
2732 __ jcc(Assembler::equal, resolved);
2733
2734 // resolve first time through
2735 __ bind(L_clinit_barrier_slow);
2736 address entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_from_cache);
2737 __ movl(temp, code);
2738 __ call_VM(noreg, entry, temp);
2739 // Update registers with resolved info
2740 __ load_field_entry(cache, index);
2741
2742 __ bind(resolved);
2743
2744 // Class initialization barrier for static fields
2745 if (VM_Version::supports_fast_class_init_checks() &&
2746 (bytecode() == Bytecodes::_getstatic || bytecode() == Bytecodes::_putstatic)) {
2747 const Register field_holder = temp;
2748 const Register thread = LP64_ONLY(r15_thread) NOT_LP64(noreg);
2749 assert(thread != noreg, "x86_32 not supported");
2750
2751 __ movptr(field_holder, Address(cache, in_bytes(ResolvedFieldEntry::field_holder_offset())));
2752 __ clinit_barrier(field_holder, thread, nullptr /*L_fast_path*/, &L_clinit_barrier_slow);
2753 }
2754 }
2755
2756 void TemplateTable::load_resolved_field_entry(Register obj,
2757 Register cache,
2758 Register tos_state,
2759 Register offset,
2760 Register flags,
2761 bool is_static = false) {
2762 assert_different_registers(cache, tos_state, flags, offset);
2763
2764 // Field offset
2765 __ load_sized_value(offset, Address(cache, in_bytes(ResolvedFieldEntry::field_offset_offset())), sizeof(int), true /*is_signed*/);
2766
2767 // Flags
2768 __ load_unsigned_byte(flags, Address(cache, in_bytes(ResolvedFieldEntry::flags_offset())));
2769
2770 // TOS state
2771 __ load_unsigned_byte(tos_state, Address(cache, in_bytes(ResolvedFieldEntry::type_offset())));
2772
2773 // Klass overwrite register
|