2007 address& iep,
2008 address& lep,
2009 address& fep,
2010 address& dep,
2011 address& vep) {
2012 assert(t->is_valid() && t->tos_in() == vtos, "illegal template");
2013 Label L;
2014 aep = __ pc(); __ push_ptr(); __ b(L);
2015 fep = __ pc(); __ push_f(); __ b(L);
2016 dep = __ pc(); __ push_d(); __ b(L);
2017 lep = __ pc(); __ push_l(); __ b(L);
2018 bep = cep = sep =
2019 iep = __ pc(); __ push_i();
2020 vep = __ pc();
2021 __ bind(L);
2022 generate_and_dispatch(t);
2023 }
2024
2025 //-----------------------------------------------------------------------------
2026
2027 // Non-product code
2028 #ifndef PRODUCT
2029 address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
2030 address entry = __ pc();
2031
2032 __ protect_return_address();
2033 __ push(lr);
2034 __ push(state);
2035 __ push(RegSet::range(r0, r15), sp);
2036 __ mov(c_rarg2, r0); // Pass itos
2037 __ call_VM(noreg,
2038 CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode),
2039 c_rarg1, c_rarg2, c_rarg3);
2040 __ pop(RegSet::range(r0, r15), sp);
2041 __ pop(state);
2042 __ pop(lr);
2043 __ authenticate_return_address();
2044 __ ret(lr); // return from result handler
2045
2046 return entry;
2047 }
2048
2049 void TemplateInterpreterGenerator::count_bytecode() {
2050 __ mov(r10, (address) &BytecodeCounter::_counter_value);
2051 __ atomic_addw(noreg, 1, r10);
2052 }
2053
2054 void TemplateInterpreterGenerator::histogram_bytecode(Template* t) {
2055 __ mov(r10, (address) &BytecodeHistogram::_counters[t->bytecode()]);
2056 __ atomic_addw(noreg, 1, r10);
2057 }
2058
2059 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template* t) {
2060 // Calculate new index for counter:
2061 // _index = (_index >> log2_number_of_codes) |
2062 // (bytecode << log2_number_of_codes);
2063 Register index_addr = rscratch1;
2064 Register index = rscratch2;
2065 __ mov(index_addr, (address) &BytecodePairHistogram::_index);
2066 __ ldrw(index, index_addr);
2067 __ mov(r10,
2068 ((int)t->bytecode()) << BytecodePairHistogram::log2_number_of_codes);
2069 __ orrw(index, r10, index, Assembler::LSR,
2070 BytecodePairHistogram::log2_number_of_codes);
2071 __ strw(index, index_addr);
2072
2073 // Bump bucket contents:
2074 // _counters[_index] ++;
2075 Register counter_addr = rscratch1;
2076 __ mov(r10, (address) &BytecodePairHistogram::_counters);
2077 __ lea(counter_addr, Address(r10, index, Address::lsl(LogBytesPerInt)));
2078 __ atomic_addw(noreg, 1, counter_addr);
|
2007 address& iep,
2008 address& lep,
2009 address& fep,
2010 address& dep,
2011 address& vep) {
2012 assert(t->is_valid() && t->tos_in() == vtos, "illegal template");
2013 Label L;
2014 aep = __ pc(); __ push_ptr(); __ b(L);
2015 fep = __ pc(); __ push_f(); __ b(L);
2016 dep = __ pc(); __ push_d(); __ b(L);
2017 lep = __ pc(); __ push_l(); __ b(L);
2018 bep = cep = sep =
2019 iep = __ pc(); __ push_i();
2020 vep = __ pc();
2021 __ bind(L);
2022 generate_and_dispatch(t);
2023 }
2024
2025 //-----------------------------------------------------------------------------
2026
2027 void TemplateInterpreterGenerator::count_bytecode() {
2028 if (CountBytecodesPerThread) {
2029 Address bc_counter_addr(rthread, Thread::bc_counter_offset());
2030 __ ldr(r10, bc_counter_addr);
2031 __ add(r10, r10, 1);
2032 __ str(r10, bc_counter_addr);
2033 }
2034 if (CountBytecodes || TraceBytecodes || StopInterpreterAt > 0) {
2035 __ mov(r10, (address) &BytecodeCounter::_counter_value);
2036 __ atomic_add(noreg, 1, r10);
2037 }
2038 }
2039
2040 void TemplateInterpreterGenerator::histogram_bytecode(Template* t) {
2041 __ mov(r10, (address) &BytecodeHistogram::_counters[t->bytecode()]);
2042 __ atomic_addw(noreg, 1, r10);
2043 }
2044
2045 // Non-product code
2046 #ifndef PRODUCT
2047 address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
2048 address entry = __ pc();
2049
2050 __ protect_return_address();
2051 __ push(lr);
2052 __ push(state);
2053 __ push(RegSet::range(r0, r15), sp);
2054 __ mov(c_rarg2, r0); // Pass itos
2055 __ call_VM(noreg,
2056 CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode),
2057 c_rarg1, c_rarg2, c_rarg3);
2058 __ pop(RegSet::range(r0, r15), sp);
2059 __ pop(state);
2060 __ pop(lr);
2061 __ authenticate_return_address();
2062 __ ret(lr); // return from result handler
2063
2064 return entry;
2065 }
2066
2067 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template* t) {
2068 // Calculate new index for counter:
2069 // _index = (_index >> log2_number_of_codes) |
2070 // (bytecode << log2_number_of_codes);
2071 Register index_addr = rscratch1;
2072 Register index = rscratch2;
2073 __ mov(index_addr, (address) &BytecodePairHistogram::_index);
2074 __ ldrw(index, index_addr);
2075 __ mov(r10,
2076 ((int)t->bytecode()) << BytecodePairHistogram::log2_number_of_codes);
2077 __ orrw(index, r10, index, Assembler::LSR,
2078 BytecodePairHistogram::log2_number_of_codes);
2079 __ strw(index, index_addr);
2080
2081 // Bump bucket contents:
2082 // _counters[_index] ++;
2083 Register counter_addr = rscratch1;
2084 __ mov(r10, (address) &BytecodePairHistogram::_counters);
2085 __ lea(counter_addr, Address(r10, index, Address::lsl(LogBytesPerInt)));
2086 __ atomic_addw(noreg, 1, counter_addr);
|