mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8132051: Better byte behavior
Co-authored-by: Roland Westerlin <roland.westerlin@oracle.com> Co-authored-by: Vladimir Kozlov <vladimir.kozlov@oracle.com> Co-authored-by: John Rose <john.r.rose@oracle.com> Reviewed-by: bdelsart, roland, kvn, jrose, ahgross
This commit is contained in:
parent
ed18f94d21
commit
200784d505
40 changed files with 514 additions and 88 deletions
|
@ -1767,8 +1767,19 @@ run:
|
|||
((objArrayOop) arrObj)->obj_at_put(index, rhsObject);
|
||||
UPDATE_PC_AND_TOS_AND_CONTINUE(1, -3);
|
||||
}
|
||||
CASE(_bastore):
|
||||
ARRAY_STOREFROM32(T_BYTE, jbyte, "%d", STACK_INT, 0);
|
||||
CASE(_bastore): {
|
||||
ARRAY_INTRO(-3);
|
||||
int item = STACK_INT(-1);
|
||||
// if it is a T_BOOLEAN array, mask the stored value to 0/1
|
||||
if (arrObj->klass() == Universe::boolArrayKlassObj()) {
|
||||
item &= 1;
|
||||
} else {
|
||||
assert(arrObj->klass() == Universe::byteArrayKlassObj(),
|
||||
"should be byte array otherwise");
|
||||
}
|
||||
((typeArrayOop)arrObj)->byte_at_put(index, item);
|
||||
UPDATE_PC_AND_TOS_AND_CONTINUE(1, -3);
|
||||
}
|
||||
CASE(_castore):
|
||||
ARRAY_STOREFROM32(T_CHAR, jchar, "%d", STACK_INT, 0);
|
||||
CASE(_sastore):
|
||||
|
@ -1999,7 +2010,7 @@ run:
|
|||
} else if (tos_type == ltos) {
|
||||
SET_STACK_LONG(obj->long_field_acquire(field_offset), 0);
|
||||
MORE_STACK(1);
|
||||
} else if (tos_type == btos) {
|
||||
} else if (tos_type == btos || tos_type == ztos) {
|
||||
SET_STACK_INT(obj->byte_field_acquire(field_offset), -1);
|
||||
} else if (tos_type == ctos) {
|
||||
SET_STACK_INT(obj->char_field_acquire(field_offset), -1);
|
||||
|
@ -2020,7 +2031,7 @@ run:
|
|||
} else if (tos_type == ltos) {
|
||||
SET_STACK_LONG(obj->long_field(field_offset), 0);
|
||||
MORE_STACK(1);
|
||||
} else if (tos_type == btos) {
|
||||
} else if (tos_type == btos || tos_type == ztos) {
|
||||
SET_STACK_INT(obj->byte_field(field_offset), -1);
|
||||
} else if (tos_type == ctos) {
|
||||
SET_STACK_INT(obj->char_field(field_offset), -1);
|
||||
|
@ -2109,6 +2120,9 @@ run:
|
|||
obj->release_obj_field_put(field_offset, STACK_OBJECT(-1));
|
||||
} else if (tos_type == btos) {
|
||||
obj->release_byte_field_put(field_offset, STACK_INT(-1));
|
||||
} else if (tos_type == ztos) {
|
||||
int bool_field = STACK_INT(-1); // only store LSB
|
||||
obj->release_byte_field_put(field_offset, (bool_field & 1));
|
||||
} else if (tos_type == ltos) {
|
||||
obj->release_long_field_put(field_offset, STACK_LONG(-1));
|
||||
} else if (tos_type == ctos) {
|
||||
|
@ -2129,6 +2143,9 @@ run:
|
|||
obj->obj_field_put(field_offset, STACK_OBJECT(-1));
|
||||
} else if (tos_type == btos) {
|
||||
obj->byte_field_put(field_offset, STACK_INT(-1));
|
||||
} else if (tos_type == ztos) {
|
||||
int bool_field = STACK_INT(-1); // only store LSB
|
||||
obj->byte_field_put(field_offset, (bool_field & 1));
|
||||
} else if (tos_type == ltos) {
|
||||
obj->long_field_put(field_offset, STACK_LONG(-1));
|
||||
} else if (tos_type == ctos) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue