< prev index next >

src/hotspot/cpu/x86/templateTable_x86.cpp

Print this page




 805                     Address(rdx, rax,
 806                             Address::times_4,
 807                             arrayOopDesc::base_offset_in_bytes(T_FLOAT)),
 808                     noreg, noreg);
 809 }
 810 
 811 void TemplateTable::daload() {
 812   transition(itos, dtos);
 813   // rax: index
 814   // rdx: array
 815   index_check(rdx, rax); // kills rbx
 816   __ access_load_at(T_DOUBLE, IN_HEAP | IS_ARRAY, noreg /* dtos */,
 817                     Address(rdx, rax,
 818                             Address::times_8,
 819                             arrayOopDesc::base_offset_in_bytes(T_DOUBLE)),
 820                     noreg, noreg);
 821 }
 822 
 823 void TemplateTable::aaload() {
 824   transition(itos, atos);
 825 
 826   Register array = rcx;
 827   Register index = rax;
 828 
 829   index_check(array, index); // kills rbx
 830 
 831   __ profile_array(rbx, array, rdx);
 832 
 833   if (ValueArrayFlatten) {
 834     Label is_flat_array, done;
 835     __ test_flattened_array_oop(array, rbx, is_flat_array);
 836     do_oop_load(_masm,
 837                 Address(array, index,
 838                         UseCompressedOops ? Address::times_4 : Address::times_ptr,
 839                         arrayOopDesc::base_offset_in_bytes(T_OBJECT)),
 840                 rax,
 841                 IS_ARRAY);
 842     __ jmp(done);
 843     __ bind(is_flat_array);
 844     __ call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::value_array_load), array, index);
 845     __ bind(done);
 846   } else {
 847     do_oop_load(_masm,
 848                 Address(array, index,
 849                         UseCompressedOops ? Address::times_4 : Address::times_ptr,
 850                         arrayOopDesc::base_offset_in_bytes(T_OBJECT)),
 851                 rax,
 852                 IS_ARRAY);
 853   }
 854 
 855   __ profile_element(rbx, rax, rdx);
 856 }
 857 
 858 void TemplateTable::baload() {
 859   transition(itos, itos);
 860   // rax: index
 861   // rdx: array
 862   index_check(rdx, rax); // kills rbx
 863   __ access_load_at(T_BYTE, IN_HEAP | IS_ARRAY, rax,
 864                     Address(rdx, rax, Address::times_1, arrayOopDesc::base_offset_in_bytes(T_BYTE)),
 865                     noreg, noreg);
 866 }
 867 
 868 void TemplateTable::caload() {
 869   transition(itos, itos);
 870   // rax: index
 871   // rdx: array
 872   index_check(rdx, rax); // kills rbx
 873   __ access_load_at(T_CHAR, IN_HEAP | IS_ARRAY, rax,
 874                     Address(rdx, rax, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)),
 875                     noreg, noreg);


1207   __ jmp(done);
1208 
1209   if (EnableValhalla) {
1210     Label is_type_ok;
1211     __ bind(is_flat_array); // Store non-null value to flat
1212 
1213     // Simplistic type check...
1214 
1215     // Profile the not-null value's klass.
1216     __ load_klass(rbx, rax);
1217     // Move element klass into rax
1218     __ movptr(rax, Address(rdi, ArrayKlass::element_klass_offset()));
1219     // flat value array needs exact type match
1220     // is "rax == rbx" (value subclass == array element superclass)
1221     __ cmpptr(rax, rbx);
1222     __ jccb(Assembler::equal, is_type_ok);
1223 
1224     __ jump(ExternalAddress(Interpreter::_throw_ArrayStoreException_entry));
1225 
1226     __ bind(is_type_ok);
1227     __ movptr(rax, at_tos());  // value
1228     __ movl(rcx, at_tos_p1()); // index
1229     __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::value_array_store), rax, rdx, rcx);











1230   }
1231   // Pop stack arguments
1232   __ bind(done);
1233   __ addptr(rsp, 3 * Interpreter::stackElementSize);
1234 }
1235 
1236 void TemplateTable::bastore() {
1237   transition(itos, vtos);
1238   __ pop_i(rbx);
1239   // rax: value
1240   // rbx: index
1241   // rdx: array
1242   index_check(rdx, rbx); // prefer index in rbx
1243   // Need to check whether array is boolean or byte
1244   // since both types share the bastore bytecode.
1245   __ load_klass(rcx, rdx);
1246   __ movl(rcx, Address(rcx, Klass::layout_helper_offset()));
1247   int diffbit = Klass::layout_helper_boolean_diffbit();
1248   __ testl(rcx, diffbit);
1249   Label L_skip;




 805                     Address(rdx, rax,
 806                             Address::times_4,
 807                             arrayOopDesc::base_offset_in_bytes(T_FLOAT)),
 808                     noreg, noreg);
 809 }
 810 
 811 void TemplateTable::daload() {
 812   transition(itos, dtos);
 813   // rax: index
 814   // rdx: array
 815   index_check(rdx, rax); // kills rbx
 816   __ access_load_at(T_DOUBLE, IN_HEAP | IS_ARRAY, noreg /* dtos */,
 817                     Address(rdx, rax,
 818                             Address::times_8,
 819                             arrayOopDesc::base_offset_in_bytes(T_DOUBLE)),
 820                     noreg, noreg);
 821 }
 822 
 823 void TemplateTable::aaload() {
 824   transition(itos, atos);
 825   Register array = rdx;

 826   Register index = rax;
 827 
 828   index_check(array, index); // kills rbx
 829   __ profile_array(rbx, array, rcx);


 830   if (ValueArrayFlatten) {
 831     Label is_flat_array, done;
 832     __ test_flattened_array_oop(array, rbx, is_flat_array);
 833     do_oop_load(_masm,
 834                 Address(array, index,
 835                         UseCompressedOops ? Address::times_4 : Address::times_ptr,
 836                         arrayOopDesc::base_offset_in_bytes(T_OBJECT)),
 837                 rax,
 838                 IS_ARRAY);
 839     __ jmp(done);
 840     __ bind(is_flat_array);
 841     __ read_flattened_element(array, index, rbx, rcx, rax);
 842     __ bind(done);
 843   } else {
 844     do_oop_load(_masm,
 845                 Address(array, index,
 846                         UseCompressedOops ? Address::times_4 : Address::times_ptr,
 847                         arrayOopDesc::base_offset_in_bytes(T_OBJECT)),
 848                 rax,
 849                 IS_ARRAY);
 850   }
 851   __ profile_element(rbx, rax, rcx);

 852 }
 853 
 854 void TemplateTable::baload() {
 855   transition(itos, itos);
 856   // rax: index
 857   // rdx: array
 858   index_check(rdx, rax); // kills rbx
 859   __ access_load_at(T_BYTE, IN_HEAP | IS_ARRAY, rax,
 860                     Address(rdx, rax, Address::times_1, arrayOopDesc::base_offset_in_bytes(T_BYTE)),
 861                     noreg, noreg);
 862 }
 863 
 864 void TemplateTable::caload() {
 865   transition(itos, itos);
 866   // rax: index
 867   // rdx: array
 868   index_check(rdx, rax); // kills rbx
 869   __ access_load_at(T_CHAR, IN_HEAP | IS_ARRAY, rax,
 870                     Address(rdx, rax, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)),
 871                     noreg, noreg);


1203   __ jmp(done);
1204 
1205   if (EnableValhalla) {
1206     Label is_type_ok;
1207     __ bind(is_flat_array); // Store non-null value to flat
1208 
1209     // Simplistic type check...
1210 
1211     // Profile the not-null value's klass.
1212     __ load_klass(rbx, rax);
1213     // Move element klass into rax
1214     __ movptr(rax, Address(rdi, ArrayKlass::element_klass_offset()));
1215     // flat value array needs exact type match
1216     // is "rax == rbx" (value subclass == array element superclass)
1217     __ cmpptr(rax, rbx);
1218     __ jccb(Assembler::equal, is_type_ok);
1219 
1220     __ jump(ExternalAddress(Interpreter::_throw_ArrayStoreException_entry));
1221 
1222     __ bind(is_type_ok);
1223     // rbx: value's klass
1224     // rdx: array
1225     // rdi: array klass
1226     __ test_klass_is_empty_value(rbx, rax, done);
1227 
1228     // calc dst for copy
1229     __ movl(rax, at_tos_p1()); // index
1230     __ data_for_value_array_index(rdx, rdi, rax, rax);
1231 
1232     // ...and src for copy
1233     __ movptr(rcx, at_tos());  // value
1234     __ data_for_oop(rcx, rcx, rbx);
1235 
1236     __ access_value_copy(IN_HEAP, rcx, rax, rbx);
1237   }
1238   // Pop stack arguments
1239   __ bind(done);
1240   __ addptr(rsp, 3 * Interpreter::stackElementSize);
1241 }
1242 
1243 void TemplateTable::bastore() {
1244   transition(itos, vtos);
1245   __ pop_i(rbx);
1246   // rax: value
1247   // rbx: index
1248   // rdx: array
1249   index_check(rdx, rbx); // prefer index in rbx
1250   // Need to check whether array is boolean or byte
1251   // since both types share the bastore bytecode.
1252   __ load_klass(rcx, rdx);
1253   __ movl(rcx, Address(rcx, Klass::layout_helper_offset()));
1254   int diffbit = Klass::layout_helper_boolean_diffbit();
1255   __ testl(rcx, diffbit);
1256   Label L_skip;


< prev index next >