comparison src/share/vm/interpreter/bytecodeInterpreter.cpp @ 23614:32b682649973 jdk8u75-b04

8132051: Better byte behavior Reviewed-by: coleenp, roland
author kevinw
date Fri, 15 Jan 2016 22:33:15 +0000
parents 6d13c17668d1
children b5f3a471e646 8f58998958ca
comparison
equal deleted inserted replaced
23613:b374548dcb48 23614:32b682649973
1 /* 1 /*
2 * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
1778 BI_PROFILE_UPDATE_CHECKCAST(/*null_seen=*/true, NULL); 1778 BI_PROFILE_UPDATE_CHECKCAST(/*null_seen=*/true, NULL);
1779 } 1779 }
1780 ((objArrayOop) arrObj)->obj_at_put(index, rhsObject); 1780 ((objArrayOop) arrObj)->obj_at_put(index, rhsObject);
1781 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -3); 1781 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -3);
1782 } 1782 }
1783 CASE(_bastore): 1783 CASE(_bastore): {
1784 ARRAY_STOREFROM32(T_BYTE, jbyte, "%d", STACK_INT, 0); 1784 ARRAY_INTRO(-3);
1785 int item = STACK_INT(-1);
1786 // if it is a T_BOOLEAN array, mask the stored value to 0/1
1787 if (arrObj->klass() == Universe::boolArrayKlassObj()) {
1788 item &= 1;
1789 } else {
1790 assert(arrObj->klass() == Universe::byteArrayKlassObj(),
1791 "should be byte array otherwise");
1792 }
1793 ((typeArrayOop)arrObj)->byte_at_put(index, item);
1794 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -3);
1795 }
1785 CASE(_castore): 1796 CASE(_castore):
1786 ARRAY_STOREFROM32(T_CHAR, jchar, "%d", STACK_INT, 0); 1797 ARRAY_STOREFROM32(T_CHAR, jchar, "%d", STACK_INT, 0);
1787 CASE(_sastore): 1798 CASE(_sastore):
1788 ARRAY_STOREFROM32(T_SHORT, jshort, "%d", STACK_INT, 0); 1799 ARRAY_STOREFROM32(T_SHORT, jshort, "%d", STACK_INT, 0);
1789 CASE(_lastore): 1800 CASE(_lastore):
2010 } else if (tos_type == itos) { 2021 } else if (tos_type == itos) {
2011 SET_STACK_INT(obj->int_field_acquire(field_offset), -1); 2022 SET_STACK_INT(obj->int_field_acquire(field_offset), -1);
2012 } else if (tos_type == ltos) { 2023 } else if (tos_type == ltos) {
2013 SET_STACK_LONG(obj->long_field_acquire(field_offset), 0); 2024 SET_STACK_LONG(obj->long_field_acquire(field_offset), 0);
2014 MORE_STACK(1); 2025 MORE_STACK(1);
2015 } else if (tos_type == btos) { 2026 } else if (tos_type == btos || tos_type == ztos) {
2016 SET_STACK_INT(obj->byte_field_acquire(field_offset), -1); 2027 SET_STACK_INT(obj->byte_field_acquire(field_offset), -1);
2017 } else if (tos_type == ctos) { 2028 } else if (tos_type == ctos) {
2018 SET_STACK_INT(obj->char_field_acquire(field_offset), -1); 2029 SET_STACK_INT(obj->char_field_acquire(field_offset), -1);
2019 } else if (tos_type == stos) { 2030 } else if (tos_type == stos) {
2020 SET_STACK_INT(obj->short_field_acquire(field_offset), -1); 2031 SET_STACK_INT(obj->short_field_acquire(field_offset), -1);
2031 } else if (tos_type == itos) { 2042 } else if (tos_type == itos) {
2032 SET_STACK_INT(obj->int_field(field_offset), -1); 2043 SET_STACK_INT(obj->int_field(field_offset), -1);
2033 } else if (tos_type == ltos) { 2044 } else if (tos_type == ltos) {
2034 SET_STACK_LONG(obj->long_field(field_offset), 0); 2045 SET_STACK_LONG(obj->long_field(field_offset), 0);
2035 MORE_STACK(1); 2046 MORE_STACK(1);
2036 } else if (tos_type == btos) { 2047 } else if (tos_type == btos || tos_type == ztos) {
2037 SET_STACK_INT(obj->byte_field(field_offset), -1); 2048 SET_STACK_INT(obj->byte_field(field_offset), -1);
2038 } else if (tos_type == ctos) { 2049 } else if (tos_type == ctos) {
2039 SET_STACK_INT(obj->char_field(field_offset), -1); 2050 SET_STACK_INT(obj->char_field(field_offset), -1);
2040 } else if (tos_type == stos) { 2051 } else if (tos_type == stos) {
2041 SET_STACK_INT(obj->short_field(field_offset), -1); 2052 SET_STACK_INT(obj->short_field(field_offset), -1);
2120 } else if (tos_type == atos) { 2131 } else if (tos_type == atos) {
2121 VERIFY_OOP(STACK_OBJECT(-1)); 2132 VERIFY_OOP(STACK_OBJECT(-1));
2122 obj->release_obj_field_put(field_offset, STACK_OBJECT(-1)); 2133 obj->release_obj_field_put(field_offset, STACK_OBJECT(-1));
2123 } else if (tos_type == btos) { 2134 } else if (tos_type == btos) {
2124 obj->release_byte_field_put(field_offset, STACK_INT(-1)); 2135 obj->release_byte_field_put(field_offset, STACK_INT(-1));
2136 } else if (tos_type == ztos) {
2137 int bool_field = STACK_INT(-1); // only store LSB
2138 obj->release_byte_field_put(field_offset, (bool_field & 1));
2125 } else if (tos_type == ltos) { 2139 } else if (tos_type == ltos) {
2126 obj->release_long_field_put(field_offset, STACK_LONG(-1)); 2140 obj->release_long_field_put(field_offset, STACK_LONG(-1));
2127 } else if (tos_type == ctos) { 2141 } else if (tos_type == ctos) {
2128 obj->release_char_field_put(field_offset, STACK_INT(-1)); 2142 obj->release_char_field_put(field_offset, STACK_INT(-1));
2129 } else if (tos_type == stos) { 2143 } else if (tos_type == stos) {
2140 } else if (tos_type == atos) { 2154 } else if (tos_type == atos) {
2141 VERIFY_OOP(STACK_OBJECT(-1)); 2155 VERIFY_OOP(STACK_OBJECT(-1));
2142 obj->obj_field_put(field_offset, STACK_OBJECT(-1)); 2156 obj->obj_field_put(field_offset, STACK_OBJECT(-1));
2143 } else if (tos_type == btos) { 2157 } else if (tos_type == btos) {
2144 obj->byte_field_put(field_offset, STACK_INT(-1)); 2158 obj->byte_field_put(field_offset, STACK_INT(-1));
2159 } else if (tos_type == ztos) {
2160 int bool_field = STACK_INT(-1); // only store LSB
2161 obj->byte_field_put(field_offset, (bool_field & 1));
2145 } else if (tos_type == ltos) { 2162 } else if (tos_type == ltos) {
2146 obj->long_field_put(field_offset, STACK_LONG(-1)); 2163 obj->long_field_put(field_offset, STACK_LONG(-1));
2147 } else if (tos_type == ctos) { 2164 } else if (tos_type == ctos) {
2148 obj->char_field_put(field_offset, STACK_INT(-1)); 2165 obj->char_field_put(field_offset, STACK_INT(-1));
2149 } else if (tos_type == stos) { 2166 } else if (tos_type == stos) {