src/cpu/x86/vm/templateTable_x86.cpp

Print this page

        

*** 542,553 **** __ load_unsigned_byte(reg, at_bcp(offset)); __ negptr(reg); } void TemplateTable::iload() { transition(vtos, itos); ! if (RewriteFrequentPairs) { Label rewrite, done; const Register bc = LP64_ONLY(c_rarg3) NOT_LP64(rcx); LP64_ONLY(assert(rbx != bc, "register damaged")); // get next byte --- 542,561 ---- __ load_unsigned_byte(reg, at_bcp(offset)); __ negptr(reg); } void TemplateTable::iload() { + iload_internal(); + } + + void TemplateTable::nofast_iload() { + iload_internal(may_not_rewrite); + } + + void TemplateTable::iload_internal(RewriteControl rc) { transition(vtos, itos); ! if (RewriteFrequentPairs && rc == may_rewrite) { Label rewrite, done; const Register bc = LP64_ONLY(c_rarg3) NOT_LP64(rcx); LP64_ONLY(assert(rbx != bc, "register damaged")); // get next byte
*** 814,823 **** --- 822,839 ---- transition(vtos, atos); __ movptr(rax, aaddress(n)); } void TemplateTable::aload_0() { + aload_0_internal(); + } + + void TemplateTable::nofast_aload_0() { + aload_0_internal(may_not_rewrite); + } + + void TemplateTable::aload_0_internal(RewriteControl rc) { transition(vtos, atos); // According to bytecode histograms, the pairs: // // _aload_0, _fast_igetfield // _aload_0, _fast_agetfield
*** 836,846 **** // Also rewrite frequent pairs // aload_0, aload_1 // aload_0, iload_1 // These bytecodes with a small amount of code are most profitable // to rewrite ! if (RewriteFrequentPairs) { Label rewrite, done; const Register bc = LP64_ONLY(c_rarg3) NOT_LP64(rcx); LP64_ONLY(assert(rbx != bc, "register damaged")); --- 852,862 ---- // Also rewrite frequent pairs // aload_0, aload_1 // aload_0, iload_1 // These bytecodes with a small amount of code are most profitable // to rewrite ! if (RewriteFrequentPairs && rc == may_rewrite) { Label rewrite, done; const Register bc = LP64_ONLY(c_rarg3) NOT_LP64(rcx); LP64_ONLY(assert(rbx != bc, "register damaged"));
*** 2490,2507 **** size_t index_size) { const Register temp = rbx; assert_different_registers(Rcache, index, temp); Label resolved; assert(byte_no == f1_byte || byte_no == f2_byte, "byte_no out of range"); __ get_cache_and_index_and_bytecode_at_bcp(Rcache, index, temp, byte_no, 1, index_size); ! __ cmpl(temp, (int) bytecode()); // have we resolved this bytecode? __ jcc(Assembler::equal, resolved); // resolve first time through address entry; ! switch (bytecode()) { case Bytecodes::_getstatic : // fall through case Bytecodes::_putstatic : // fall through case Bytecodes::_getfield : // fall through case Bytecodes::_putfield : entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_get_put); break; case Bytecodes::_invokevirtual : // fall through --- 2506,2530 ---- size_t index_size) { const Register temp = rbx; assert_different_registers(Rcache, index, temp); Label resolved; + + Bytecodes::Code code = bytecode(); + switch (code) { + case Bytecodes::_nofast_getfield: code = Bytecodes::_getfield; break; + case Bytecodes::_nofast_putfield: code = Bytecodes::_putfield; break; + } + assert(byte_no == f1_byte || byte_no == f2_byte, "byte_no out of range"); __ get_cache_and_index_and_bytecode_at_bcp(Rcache, index, temp, byte_no, 1, index_size); ! __ cmpl(temp, code); // have we resolved this bytecode? __ jcc(Assembler::equal, resolved); // resolve first time through address entry; ! switch (code) { case Bytecodes::_getstatic : // fall through case Bytecodes::_putstatic : // fall through case Bytecodes::_getfield : // fall through case Bytecodes::_putfield : entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_get_put); break; case Bytecodes::_invokevirtual : // fall through
*** 2509,2522 **** case Bytecodes::_invokestatic : // fall through case Bytecodes::_invokeinterface: entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_invoke); break; case Bytecodes::_invokehandle : entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_invokehandle); break; case Bytecodes::_invokedynamic : entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_invokedynamic); break; default: ! fatal(err_msg("unexpected bytecode: %s", Bytecodes::name(bytecode()))); break; } ! __ movl(temp, (int)bytecode()); __ call_VM(noreg, entry, temp); // Update registers with resolved info __ get_cache_and_index_at_bcp(Rcache, index, 1, index_size); __ bind(resolved); } --- 2532,2545 ---- case Bytecodes::_invokestatic : // fall through case Bytecodes::_invokeinterface: entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_invoke); break; case Bytecodes::_invokehandle : entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_invokehandle); break; case Bytecodes::_invokedynamic : entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_invokedynamic); break; default: ! fatal(err_msg("unexpected bytecode: %s", Bytecodes::name(code))); break; } ! __ movl(temp, code); __ call_VM(noreg, entry, temp); // Update registers with resolved info __ get_cache_and_index_at_bcp(Rcache, index, 1, index_size); __ bind(resolved); }
*** 2627,2637 **** __ pop_ptr(r); __ null_check(r); // for field access must check obj. __ verify_oop(r); } ! void TemplateTable::getfield_or_static(int byte_no, bool is_static) { transition(vtos, vtos); const Register cache = rcx; const Register index = rdx; const Register obj = LP64_ONLY(c_rarg3) NOT_LP64(rcx); --- 2650,2660 ---- __ pop_ptr(r); __ null_check(r); // for field access must check obj. __ verify_oop(r); } ! void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteControl rc) { transition(vtos, vtos); const Register cache = rcx; const Register index = rdx; const Register obj = LP64_ONLY(c_rarg3) NOT_LP64(rcx);
*** 2659,2680 **** __ jcc(Assembler::notZero, notByte); // btos __ load_signed_byte(rax, field); __ push(btos); // Rewrite bytecode to be faster ! if (!is_static) { patch_bytecode(Bytecodes::_fast_bgetfield, bc, rbx); } __ jmp(Done); __ bind(notByte); __ cmpl(flags, atos); __ jcc(Assembler::notEqual, notObj); // atos __ load_heap_oop(rax, field); __ push(atos); ! if (!is_static) { patch_bytecode(Bytecodes::_fast_agetfield, bc, rbx); } __ jmp(Done); __ bind(notObj); --- 2682,2703 ---- __ jcc(Assembler::notZero, notByte); // btos __ load_signed_byte(rax, field); __ push(btos); // Rewrite bytecode to be faster ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_bgetfield, bc, rbx); } __ jmp(Done); __ bind(notByte); __ cmpl(flags, atos); __ jcc(Assembler::notEqual, notObj); // atos __ load_heap_oop(rax, field); __ push(atos); ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_agetfield, bc, rbx); } __ jmp(Done); __ bind(notObj);
*** 2682,2692 **** __ jcc(Assembler::notEqual, notInt); // itos __ movl(rax, field); __ push(itos); // Rewrite bytecode to be faster ! if (!is_static) { patch_bytecode(Bytecodes::_fast_igetfield, bc, rbx); } __ jmp(Done); __ bind(notInt); --- 2705,2715 ---- __ jcc(Assembler::notEqual, notInt); // itos __ movl(rax, field); __ push(itos); // Rewrite bytecode to be faster ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_igetfield, bc, rbx); } __ jmp(Done); __ bind(notInt);
*** 2694,2704 **** __ jcc(Assembler::notEqual, notChar); // ctos __ load_unsigned_short(rax, field); __ push(ctos); // Rewrite bytecode to be faster ! if (!is_static) { patch_bytecode(Bytecodes::_fast_cgetfield, bc, rbx); } __ jmp(Done); __ bind(notChar); --- 2717,2727 ---- __ jcc(Assembler::notEqual, notChar); // ctos __ load_unsigned_short(rax, field); __ push(ctos); // Rewrite bytecode to be faster ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_cgetfield, bc, rbx); } __ jmp(Done); __ bind(notChar);
*** 2706,2716 **** __ jcc(Assembler::notEqual, notShort); // stos __ load_signed_short(rax, field); __ push(stos); // Rewrite bytecode to be faster ! if (!is_static) { patch_bytecode(Bytecodes::_fast_sgetfield, bc, rbx); } __ jmp(Done); __ bind(notShort); --- 2729,2739 ---- __ jcc(Assembler::notEqual, notShort); // stos __ load_signed_short(rax, field); __ push(stos); // Rewrite bytecode to be faster ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_sgetfield, bc, rbx); } __ jmp(Done); __ bind(notShort);
*** 2730,2740 **** __ movq(rax, field); #endif __ push(ltos); // Rewrite bytecode to be faster ! LP64_ONLY(if (!is_static) patch_bytecode(Bytecodes::_fast_lgetfield, bc, rbx)); __ jmp(Done); __ bind(notLong); __ cmpl(flags, ftos); __ jcc(Assembler::notEqual, notFloat); --- 2753,2763 ---- __ movq(rax, field); #endif __ push(ltos); // Rewrite bytecode to be faster ! LP64_ONLY(if (!is_static && rc == may_rewrite) patch_bytecode(Bytecodes::_fast_lgetfield, bc, rbx)); __ jmp(Done); __ bind(notLong); __ cmpl(flags, ftos); __ jcc(Assembler::notEqual, notFloat);
*** 2742,2752 **** LP64_ONLY(__ movflt(xmm0, field)); NOT_LP64(__ fld_s(field)); __ push(ftos); // Rewrite bytecode to be faster ! if (!is_static) { patch_bytecode(Bytecodes::_fast_fgetfield, bc, rbx); } __ jmp(Done); __ bind(notFloat); --- 2765,2775 ---- LP64_ONLY(__ movflt(xmm0, field)); NOT_LP64(__ fld_s(field)); __ push(ftos); // Rewrite bytecode to be faster ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_fgetfield, bc, rbx); } __ jmp(Done); __ bind(notFloat);
*** 2757,2767 **** // dtos LP64_ONLY(__ movdbl(xmm0, field)); NOT_LP64(__ fld_d(field)); __ push(dtos); // Rewrite bytecode to be faster ! if (!is_static) { patch_bytecode(Bytecodes::_fast_dgetfield, bc, rbx); } #ifdef ASSERT __ jmp(Done); --- 2780,2790 ---- // dtos LP64_ONLY(__ movdbl(xmm0, field)); NOT_LP64(__ fld_d(field)); __ push(dtos); // Rewrite bytecode to be faster ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_dgetfield, bc, rbx); } #ifdef ASSERT __ jmp(Done);
*** 2778,2787 **** --- 2801,2814 ---- void TemplateTable::getfield(int byte_no) { getfield_or_static(byte_no, false); } + void TemplateTable::nofast_getfield(int byte_no) { + getfield_or_static(byte_no, false, may_not_rewrite); + } + void TemplateTable::getstatic(int byte_no) { getfield_or_static(byte_no, true); }
*** 2869,2879 **** __ get_cache_and_index_at_bcp(cache, index, 1); __ bind(L1); } } ! void TemplateTable::putfield_or_static(int byte_no, bool is_static) { transition(vtos, vtos); const Register cache = rcx; const Register index = rdx; const Register obj = rcx; --- 2896,2906 ---- __ get_cache_and_index_at_bcp(cache, index, 1); __ bind(L1); } } ! void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteControl rc) { transition(vtos, vtos); const Register cache = rcx; const Register index = rdx; const Register obj = rcx;
*** 2910,2920 **** // btos { __ pop(btos); if (!is_static) pop_and_check_object(obj); __ movb(field, rax); ! if (!is_static) { patch_bytecode(Bytecodes::_fast_bputfield, bc, rbx, true, byte_no); } __ jmp(Done); } --- 2937,2947 ---- // btos { __ pop(btos); if (!is_static) pop_and_check_object(obj); __ movb(field, rax); ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_bputfield, bc, rbx, true, byte_no); } __ jmp(Done); }
*** 2926,2936 **** { __ pop(atos); if (!is_static) pop_and_check_object(obj); // Store into the field do_oop_store(_masm, field, rax, _bs->kind(), false); ! if (!is_static) { patch_bytecode(Bytecodes::_fast_aputfield, bc, rbx, true, byte_no); } __ jmp(Done); } --- 2953,2963 ---- { __ pop(atos); if (!is_static) pop_and_check_object(obj); // Store into the field do_oop_store(_masm, field, rax, _bs->kind(), false); ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_aputfield, bc, rbx, true, byte_no); } __ jmp(Done); }
*** 2941,2951 **** // itos { __ pop(itos); if (!is_static) pop_and_check_object(obj); __ movl(field, rax); ! if (!is_static) { patch_bytecode(Bytecodes::_fast_iputfield, bc, rbx, true, byte_no); } __ jmp(Done); } --- 2968,2978 ---- // itos { __ pop(itos); if (!is_static) pop_and_check_object(obj); __ movl(field, rax); ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_iputfield, bc, rbx, true, byte_no); } __ jmp(Done); }
*** 2956,2966 **** // ctos { __ pop(ctos); if (!is_static) pop_and_check_object(obj); __ movw(field, rax); ! if (!is_static) { patch_bytecode(Bytecodes::_fast_cputfield, bc, rbx, true, byte_no); } __ jmp(Done); } --- 2983,2993 ---- // ctos { __ pop(ctos); if (!is_static) pop_and_check_object(obj); __ movw(field, rax); ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_cputfield, bc, rbx, true, byte_no); } __ jmp(Done); }
*** 2971,2981 **** // stos { __ pop(stos); if (!is_static) pop_and_check_object(obj); __ movw(field, rax); ! if (!is_static) { patch_bytecode(Bytecodes::_fast_sputfield, bc, rbx, true, byte_no); } __ jmp(Done); } --- 2998,3008 ---- // stos { __ pop(stos); if (!is_static) pop_and_check_object(obj); __ movw(field, rax); ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_sputfield, bc, rbx, true, byte_no); } __ jmp(Done); }
*** 2987,2997 **** #ifdef _LP64 { __ pop(ltos); if (!is_static) pop_and_check_object(obj); __ movq(field, rax); ! if (!is_static) { patch_bytecode(Bytecodes::_fast_lputfield, bc, rbx, true, byte_no); } __ jmp(Done); } #else --- 3014,3024 ---- #ifdef _LP64 { __ pop(ltos); if (!is_static) pop_and_check_object(obj); __ movq(field, rax); ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_lputfield, bc, rbx, true, byte_no); } __ jmp(Done); } #else
*** 3034,3044 **** { __ pop(ftos); if (!is_static) pop_and_check_object(obj); NOT_LP64( __ fstp_s(field);) LP64_ONLY( __ movflt(field, xmm0);) ! if (!is_static) { patch_bytecode(Bytecodes::_fast_fputfield, bc, rbx, true, byte_no); } __ jmp(Done); } --- 3061,3071 ---- { __ pop(ftos); if (!is_static) pop_and_check_object(obj); NOT_LP64( __ fstp_s(field);) LP64_ONLY( __ movflt(field, xmm0);) ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_fputfield, bc, rbx, true, byte_no); } __ jmp(Done); }
*** 3052,3062 **** { __ pop(dtos); if (!is_static) pop_and_check_object(obj); NOT_LP64( __ fstp_d(field);) LP64_ONLY( __ movdbl(field, xmm0);) ! if (!is_static) { patch_bytecode(Bytecodes::_fast_dputfield, bc, rbx, true, byte_no); } } #ifdef ASSERT --- 3079,3089 ---- { __ pop(dtos); if (!is_static) pop_and_check_object(obj); NOT_LP64( __ fstp_d(field);) LP64_ONLY( __ movdbl(field, xmm0);) ! if (!is_static && rc == may_rewrite) { patch_bytecode(Bytecodes::_fast_dputfield, bc, rbx, true, byte_no); } } #ifdef ASSERT
*** 3078,3087 **** --- 3105,3118 ---- void TemplateTable::putfield(int byte_no) { putfield_or_static(byte_no, false); } + void TemplateTable::nofast_putfield(int byte_no) { + putfield_or_static(byte_no, false, may_not_rewrite); + } + void TemplateTable::putstatic(int byte_no) { putfield_or_static(byte_no, true); } void TemplateTable::jvmti_post_fast_field_mod() {