allow array references in areturn
This commit is contained in:
parent
661e5c0751
commit
3a75d5bcdc
@ -80,7 +80,7 @@ void op_anewarray(struct vm * vm, uint32_t index)
|
|||||||
|
|
||||||
void op_areturn(struct vm * vm)
|
void op_areturn(struct vm * vm)
|
||||||
{
|
{
|
||||||
assert(vm->current_frame->return_type == 'L');
|
assert(vm->current_frame->return_type == 'L' || vm->current_frame->return_type == '[');
|
||||||
vm_method_return(vm);
|
vm_method_return(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +321,8 @@ void vm_method_return(struct vm * vm)
|
|||||||
case 'I': [[fallthrough]];
|
case 'I': [[fallthrough]];
|
||||||
case 'L': [[fallthrough]];
|
case 'L': [[fallthrough]];
|
||||||
case 'S': [[fallthrough]];
|
case 'S': [[fallthrough]];
|
||||||
case 'Z':
|
case 'Z': [[fallthrough]];
|
||||||
|
case '[':
|
||||||
{
|
{
|
||||||
uint32_t value = operand_stack_pop_u32(old_frame);
|
uint32_t value = operand_stack_pop_u32(old_frame);
|
||||||
operand_stack_push_u32(vm->current_frame, value);
|
operand_stack_push_u32(vm->current_frame, value);
|
||||||
|
17
p/TestArray.java
Normal file
17
p/TestArray.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package p;
|
||||||
|
|
||||||
|
class TestArray {
|
||||||
|
static char[] test() {
|
||||||
|
char[] a = {'a', 'b', 'c', 'd'};
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char test2(char[] c) {
|
||||||
|
return (char)((int)(c[0]) * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main() {
|
||||||
|
char[] a = test();
|
||||||
|
test2(a);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user