Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/methodHandles_x86.cpp @ 1293:51db1e4b379d
6932536: JSR 292 modified JDK MethodHandlesTest fails on x86_64
Summary: A modified MethodHandlesTest revealed two bugs on x86_64.
Reviewed-by: never, jrose
author | twisti |
---|---|
date | Mon, 08 Mar 2010 04:46:30 -0800 |
parents | 855c5171834c |
children | 76c1d7d13ec5 |
comparison
equal
deleted
inserted
replaced
1288:c76ca382971b | 1293:51db1e4b379d |
---|---|
1 /* | 1 /* |
2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 1997-2010 Sun Microsystems, Inc. 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. |
713 Address vmarg2 = vmarg1.plus_disp(Interpreter::stackElementSize()); | 713 Address vmarg2 = vmarg1.plus_disp(Interpreter::stackElementSize()); |
714 | 714 |
715 switch (ek) { | 715 switch (ek) { |
716 case _adapter_opt_i2l: | 716 case _adapter_opt_i2l: |
717 { | 717 { |
718 #ifdef _LP64 | |
719 __ movslq(rdx_temp, vmarg1); // Load sign-extended | |
720 __ movq(vmarg1, rdx_temp); // Store into first slot | |
721 #else | |
718 __ movl(rdx_temp, vmarg1); | 722 __ movl(rdx_temp, vmarg1); |
719 __ sarl(rdx_temp, 31); // __ extend_sign() | 723 __ sarl(rdx_temp, BitsPerInt - 1); // __ extend_sign() |
720 __ movl(vmarg2, rdx_temp); // store second word | 724 __ movl(vmarg2, rdx_temp); // store second word |
725 #endif | |
721 } | 726 } |
722 break; | 727 break; |
723 case _adapter_opt_unboxl: | 728 case _adapter_opt_unboxl: |
724 { | 729 { |
725 // Load the value up from the heap. | 730 // Load the value up from the heap. |
726 __ movptr(rdx_temp, vmarg1); | 731 __ movptr(rdx_temp, vmarg1); |
727 int value_offset = java_lang_boxing_object::value_offset_in_bytes(T_LONG); | 732 int value_offset = java_lang_boxing_object::value_offset_in_bytes(T_LONG); |
728 assert(value_offset == java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE), ""); | 733 assert(value_offset == java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE), ""); |
729 __ null_check(rdx_temp, value_offset); | 734 __ null_check(rdx_temp, value_offset); |
735 #ifdef _LP64 | |
736 __ movq(rbx_temp, Address(rdx_temp, value_offset)); | |
737 __ movq(vmarg1, rbx_temp); | |
738 #else | |
730 __ movl(rbx_temp, Address(rdx_temp, value_offset + 0*BytesPerInt)); | 739 __ movl(rbx_temp, Address(rdx_temp, value_offset + 0*BytesPerInt)); |
731 __ movl(rdx_temp, Address(rdx_temp, value_offset + 1*BytesPerInt)); | 740 __ movl(rdx_temp, Address(rdx_temp, value_offset + 1*BytesPerInt)); |
732 __ movl(vmarg1, rbx_temp); | 741 __ movl(vmarg1, rbx_temp); |
733 __ movl(vmarg2, rdx_temp); | 742 __ movl(vmarg2, rdx_temp); |
743 #endif | |
734 } | 744 } |
735 break; | 745 break; |
736 default: | 746 default: |
737 assert(false, ""); | 747 assert(false, ""); |
738 } | 748 } |
923 __ movl(rax_argslot, rcx_amh_vmargslot); | 933 __ movl(rax_argslot, rcx_amh_vmargslot); |
924 __ lea(rax_argslot, __ argument_address(rax_argslot)); | 934 __ lea(rax_argslot, __ argument_address(rax_argslot)); |
925 | 935 |
926 // 'stack_move' is negative number of words to duplicate | 936 // 'stack_move' is negative number of words to duplicate |
927 Register rdx_stack_move = rdx_temp; | 937 Register rdx_stack_move = rdx_temp; |
928 __ movl(rdx_stack_move, rcx_amh_conversion); | 938 __ movl2ptr(rdx_stack_move, rcx_amh_conversion); |
929 __ sarl(rdx_stack_move, CONV_STACK_MOVE_SHIFT); | 939 __ sarptr(rdx_stack_move, CONV_STACK_MOVE_SHIFT); |
930 | 940 |
931 int argslot0_num = 0; | 941 int argslot0_num = 0; |
932 Address argslot0 = __ argument_address(RegisterOrConstant(argslot0_num)); | 942 Address argslot0 = __ argument_address(RegisterOrConstant(argslot0_num)); |
933 assert(argslot0.base() == rsp, ""); | 943 assert(argslot0.base() == rsp, ""); |
934 int pre_arg_size = argslot0.disp(); | 944 int pre_arg_size = argslot0.disp(); |
986 __ push(rdi); // need a temp | 996 __ push(rdi); // need a temp |
987 // (must do previous push after argslot address is taken) | 997 // (must do previous push after argslot address is taken) |
988 | 998 |
989 // 'stack_move' is number of words to drop | 999 // 'stack_move' is number of words to drop |
990 Register rdi_stack_move = rdi; | 1000 Register rdi_stack_move = rdi; |
991 __ movl(rdi_stack_move, rcx_amh_conversion); | 1001 __ movl2ptr(rdi_stack_move, rcx_amh_conversion); |
992 __ sarl(rdi_stack_move, CONV_STACK_MOVE_SHIFT); | 1002 __ sarptr(rdi_stack_move, CONV_STACK_MOVE_SHIFT); |
993 remove_arg_slots(_masm, rdi_stack_move, | 1003 remove_arg_slots(_masm, rdi_stack_move, |
994 rax_argslot, rbx_temp, rdx_temp); | 1004 rax_argslot, rbx_temp, rdx_temp); |
995 | 1005 |
996 __ pop(rdi); // restore temp | 1006 __ pop(rdi); // restore temp |
997 | 1007 |
1077 if (length_constant == -1) { | 1087 if (length_constant == -1) { |
1078 // Form a pointer to the end of the affected region. | 1088 // Form a pointer to the end of the affected region. |
1079 __ lea(rdx_argslot_limit, Address(rax_argslot, Interpreter::stackElementSize())); | 1089 __ lea(rdx_argslot_limit, Address(rax_argslot, Interpreter::stackElementSize())); |
1080 // 'stack_move' is negative number of words to insert | 1090 // 'stack_move' is negative number of words to insert |
1081 Register rdi_stack_move = rdi; | 1091 Register rdi_stack_move = rdi; |
1082 __ movl(rdi_stack_move, rcx_amh_conversion); | 1092 __ movl2ptr(rdi_stack_move, rcx_amh_conversion); |
1083 __ sarl(rdi_stack_move, CONV_STACK_MOVE_SHIFT); | 1093 __ sarptr(rdi_stack_move, CONV_STACK_MOVE_SHIFT); |
1084 Register rsi_temp = rsi_array; // spill this | 1094 Register rsi_temp = rsi_array; // spill this |
1085 insert_arg_slots(_masm, rdi_stack_move, -1, | 1095 insert_arg_slots(_masm, rdi_stack_move, -1, |
1086 rax_argslot, rbx_temp, rsi_temp); | 1096 rax_argslot, rbx_temp, rsi_temp); |
1087 // reload the array (since rsi was killed) | 1097 // reload the array (since rsi was killed) |
1088 __ movptr(rsi_array, vmarg); | 1098 __ movptr(rsi_array, vmarg); |