@@ -658,8 +658,12 @@ void TemplateTable::aload() {
658658}
659659
660660void TemplateTable::locals_index_wide (Register reg) {
661- __ lhu (reg, at_bcp (2 ));
662- __ revb_h_h_u (reg, reg); // reverse bytes in half-word and zero-extend
661+ assert_different_registers (reg, t1);
662+ // Convert the 16-bit value into native byte-ordering and zero-extend
663+ __ lbu (reg, at_bcp (2 ));
664+ __ lbu (t1, at_bcp (3 ));
665+ __ slli (reg, reg, 8 );
666+ __ orr (reg, reg, t1);
663667 __ neg (reg, reg);
664668}
665669
@@ -671,8 +675,12 @@ void TemplateTable::wide_iload() {
671675
672676void TemplateTable::wide_lload () {
673677 transition (vtos, ltos);
674- __ lhu (x11, at_bcp (2 ));
675- __ revb_h_h_u (x11, x11); // reverse bytes in half-word and zero-extend
678+ // Convert the 16-bit value into native byte-ordering and zero-extend
679+ __ lbu (x11, at_bcp (2 ));
680+ __ lbu (t1, at_bcp (3 ));
681+ __ slli (x11, x11, 8 );
682+ __ orr (x11, x11, t1);
683+
676684 __ slli (x11, x11, LogBytesPerWord);
677685 __ sub (x11, xlocals, x11);
678686 __ ld (x10, Address (x11, Interpreter::local_offset_in_bytes (1 )));
@@ -686,8 +694,12 @@ void TemplateTable::wide_fload() {
686694
687695void TemplateTable::wide_dload () {
688696 transition (vtos, dtos);
689- __ lhu (x11, at_bcp (2 ));
690- __ revb_h_h_u (x11, x11); // reverse bytes in half-word and zero-extend
697+ // Convert the 16-bit value into native byte-ordering and zero-extend
698+ __ lbu (x11, at_bcp (2 ));
699+ __ lbu (t1, at_bcp (3 ));
700+ __ slli (x11, x11, 8 );
701+ __ orr (x11, x11, t1);
702+
691703 __ slli (x11, x11, LogBytesPerWord);
692704 __ sub (x11, xlocals, x11);
693705 __ fld (f10, Address (x11, Interpreter::local_offset_in_bytes (1 )));
@@ -1471,12 +1483,14 @@ void TemplateTable::iinc() {
14711483
14721484void TemplateTable::wide_iinc () {
14731485 transition (vtos, vtos);
1474- __ lwu (x11, at_bcp (2 )); // get constant and index
1475- __ revb_h_w_u (x11, x11); // reverse bytes in half-word (32bit) and zero-extend
1476- __ zero_extend (x12, x11, 16 );
1477- __ neg (x12, x12);
1478- __ slli (x11, x11, 32 );
1479- __ srai (x11, x11, 48 );
1486+ // get constant
1487+ // Convert the 16-bit value into native byte-ordering and sign-extend
1488+ __ lb (x11, at_bcp (4 ));
1489+ __ lbu (t1, at_bcp (5 ));
1490+ __ slli (x11, x11, 8 );
1491+ __ orr (x11, x11, t1);
1492+
1493+ locals_index_wide (x12);
14801494 __ ld (x10, iaddress (x12, t0, _masm));
14811495 __ addw (x10, x10, x11);
14821496 __ sd (x10, iaddress (x12, t0, _masm));
@@ -1625,10 +1639,10 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
16251639 __ lb (x12, at_bcp (1 ));
16261640 __ lbu (t1, at_bcp (2 ));
16271641 __ slli (x12, x12, 8 );
1628- __ add (x12, x12, t1);
1642+ __ orr (x12, x12, t1);
16291643 } else {
16301644 __ lwu (x12, at_bcp (1 ));
1631- __ revb_w (x12, x12);
1645+ __ revbw (x12, x12);
16321646 }
16331647
16341648 // Handle all the JSR stuff here, then exit.
@@ -1893,8 +1907,8 @@ void TemplateTable::tableswitch() {
18931907 // load lo & hi
18941908 __ lwu (x12, Address (x11, BytesPerInt));
18951909 __ lwu (x13, Address (x11, 2 * BytesPerInt));
1896- __ revb_w (x12, x12);
1897- __ revb_w (x13, x13);
1910+ __ revbw (x12, x12);
1911+ __ revbw (x13, x13);
18981912 // check against lo & hi
18991913 __ blt (x10, x12, default_case);
19001914 __ bgt (x10, x13, default_case);
@@ -1905,7 +1919,7 @@ void TemplateTable::tableswitch() {
19051919 __ profile_switch_case (x10, x11, x12);
19061920 // continue execution
19071921 __ bind (continue_execution);
1908- __ revb_w (x13, x13);
1922+ __ revbw (x13, x13);
19091923 __ add (xbcp, xbcp, x13);
19101924 __ load_unsigned_byte (t0, Address (xbcp));
19111925 __ dispatch_only (vtos, /* generate_poll*/ true );
@@ -1925,7 +1939,7 @@ void TemplateTable::fast_linearswitch() {
19251939 transition (itos, vtos);
19261940 Label loop_entry, loop, found, continue_execution;
19271941 // bswap x10 so we can avoid bswapping the table entries
1928- __ revb_w (x10, x10);
1942+ __ revbw (x10, x10);
19291943 // align xbcp
19301944 __ la (x9, at_bcp (BytesPerInt)); // btw: should be able to get rid of
19311945 // this instruction (change offsets
@@ -1936,7 +1950,7 @@ void TemplateTable::fast_linearswitch() {
19361950 // Convert the 32-bit npairs (number of pairs) into native byte-ordering
19371951 // We can use sign-extension here because npairs must be greater than or
19381952 // equal to 0 per JVM spec on 'lookupswitch' bytecode.
1939- __ revb_w (x11, x11);
1953+ __ revbw (x11, x11);
19401954 __ j (loop_entry);
19411955 // table search
19421956 __ bind (loop);
@@ -1957,7 +1971,7 @@ void TemplateTable::fast_linearswitch() {
19571971 __ profile_switch_case (x11, x10, x9);
19581972 // continue execution
19591973 __ bind (continue_execution);
1960- __ revb_w (x13, x13);
1974+ __ revbw (x13, x13);
19611975 __ add (xbcp, xbcp, x13);
19621976 __ lbu (t0, Address (xbcp, 0 ));
19631977 __ dispatch_only (vtos, /* generate_poll*/ true );
@@ -2012,7 +2026,7 @@ void TemplateTable::fast_binaryswitch() {
20122026 // Convert the 32-bit npairs (number of pairs) into native byte-ordering
20132027 // We can use sign-extension here because npairs must be greater than or
20142028 // equal to 0 per JVM spec on 'lookupswitch' bytecode.
2015- __ revb_w (j, j);
2029+ __ revbw (j, j);
20162030
20172031 // And start
20182032 Label entry;
@@ -2030,7 +2044,7 @@ void TemplateTable::fast_binaryswitch() {
20302044 // Convert array[h].match to native byte-ordering before compare
20312045 __ shadd (temp, h, array, temp, 3 );
20322046 __ lwu (temp, Address (temp, 0 ));
2033- __ revb_w (temp, temp);
2047+ __ revbw (temp, temp);
20342048
20352049 Label L_done, L_greater;
20362050 __ bge (key, temp, L_greater);
@@ -2053,14 +2067,14 @@ void TemplateTable::fast_binaryswitch() {
20532067 // Convert array[i].match to native byte-ordering before compare
20542068 __ shadd (temp, i, array, temp, 3 );
20552069 __ lwu (temp, Address (temp, 0 ));
2056- __ revb_w (temp, temp);
2070+ __ revbw (temp, temp);
20572071 __ bne (key, temp, default_case);
20582072
20592073 // entry found -> j = offset
20602074 __ shadd (temp, i, array, temp, 3 );
20612075 __ lwu (j, Address (temp, BytesPerInt));
20622076 __ profile_switch_case (i, key, array);
2063- __ revb_w (j, j);
2077+ __ revbw (j, j);
20642078
20652079 __ add (temp, xbcp, j);
20662080 __ load_unsigned_byte (t0, Address (temp, 0 ));
@@ -2073,7 +2087,7 @@ void TemplateTable::fast_binaryswitch() {
20732087 __ bind (default_case);
20742088 __ profile_switch_default (i);
20752089 __ lwu (j, Address (array, -2 * BytesPerInt));
2076- __ revb_w (j, j);
2090+ __ revbw (j, j);
20772091
20782092 __ add (temp, xbcp, j);
20792093 __ load_unsigned_byte (t0, Address (temp, 0 ));
0 commit comments