diff options
author | Brian Sullivan <briansul@microsoft.com> | 2016-07-12 13:52:20 -0700 |
---|---|---|
committer | Brian Sullivan <briansul@microsoft.com> | 2016-07-26 16:16:51 -0700 |
commit | feb33b9085f202ac9e6331fdf4dc02751d89cf8d (patch) | |
tree | 6b4305ad73b35818bfaa6249b671aff082c32c59 /src/vm/arm64 | |
parent | 35e1d3bea2446a3ad6d5470b685a612b022052ad (diff) | |
download | coreclr-feb33b9085f202ac9e6331fdf4dc02751d89cf8d.tar.gz coreclr-feb33b9085f202ac9e6331fdf4dc02751d89cf8d.tar.bz2 coreclr-feb33b9085f202ac9e6331fdf4dc02751d89cf8d.zip |
Enable multireg returns on Arm64
Added method IsMultiRegPassedType and updated IsMultiRegReturnType
Switched these methods to using getArgTypeForStruct and getReturnTypeForStruct
Removed IsRegisterPassable and used IsMultiRegReturned instead.
Converted lvIsMultiregStruct to use getArgTypeForStruct
Renamed varDsc->lvIsMultiregStruct() to compiler->lvaIsMultiregStruct(varDsc)
Skip calling getPrimitiveTypeForStruct when we have a struct larger than 8 bytes
Refactored ReturnTypeDesc::InitializeReturnType
Fixed missing SPK_ByReference case in InitializeReturnType
Fixes for RyiJIt x86 TYP_LONG return types and additional ARM64 work for full multireg support
Added ARM64 guard the uses of MAX_RET_MULTIREG_BYTES with FEATURE_MULTIREG_RET
Fixes for multireg returns in Arm64 Codegen
Added dumping of lvIsMultiRegArg and lvIsMultiRegRet in the assembly output
Added check and set of compFloatingPointUsed to InitializeStructReturnType
Fixes to handle JIT helper calls that say they return a TYP_STRUCT with no class handle available
Placed all of the second GC return reg under MULTIREG_HAS_SECOND_GC_RET ifdefs
Added the Arm64 VM changes from Rahul's PR 5175
Update getArgTypeForStruct for x86/arm32 so that it returns TYP_STRUCT for all pass by value cases
Fixes for the passing of 3,5,6 or 7 byte sized structs
Fix issue on ARM64 where we would back fill into x7 after passing a 16-byte struct on the stack
Implemented register shuffling for multi reg Call returns on Arm64
Fixed regression on Arm32 for struct args that are not multi regs
Updated Tests.Lst with 23 additional passing tests
Changes from codereview feedback
Diffstat (limited to 'src/vm/arm64')
-rw-r--r-- | src/vm/arm64/CallDescrWorkerARM64.asm | 4 | ||||
-rw-r--r-- | src/vm/arm64/asmhelpers.asm | 26 | ||||
-rw-r--r-- | src/vm/arm64/cgencpu.h | 11 |
3 files changed, 26 insertions, 15 deletions
diff --git a/src/vm/arm64/CallDescrWorkerARM64.asm b/src/vm/arm64/CallDescrWorkerARM64.asm index 556983934e..464640157e 100644 --- a/src/vm/arm64/CallDescrWorkerARM64.asm +++ b/src/vm/arm64/CallDescrWorkerARM64.asm @@ -118,8 +118,8 @@ LNoDoubleHFAReturn EMIT_BREAKPOINT ; Unreachable LIntReturn - ;; Save return value into retbuf for int - str x0, [x19, #(CallDescrData__returnValue + 0)] + ;; Save return value(s) into retbuf for int + stp x0,x1, [x19, #(CallDescrData__returnValue + 0)] LReturnDone diff --git a/src/vm/arm64/asmhelpers.asm b/src/vm/arm64/asmhelpers.asm index 72794adef1..89e6710a96 100644 --- a/src/vm/arm64/asmhelpers.asm +++ b/src/vm/arm64/asmhelpers.asm @@ -779,10 +779,10 @@ UMThunkStub_WrongAppDomain ; remaining arguments are unused bl UM2MDoADCallBack - ; restore integral return value - ldr x0, [fp, #16] + ; restore any integral return value(s) + ldp x0, x1, [fp, #16] - ; restore FP or HFA return value + ; restore any FP or HFA return value(s) RESTORE_FLOAT_ARGUMENT_REGISTERS sp, 0 b UMThunkStub_PostCall @@ -857,9 +857,10 @@ UM2MThunk_WrapperHelper_RegArgumentsSetup blr x16 - ; save integral return value - str x0, [x19] - ; save FP/HFA return values + ; save any integral return value(s) + stp x0, x1, [x19] + + ; save any FP or HFA return value(s) SAVE_FLOAT_ARGUMENT_REGISTERS x19, -1 * (SIZEOF__FloatArgumentRegisters + 16) EPILOG_STACK_RESTORE @@ -931,13 +932,20 @@ UM2MThunk_WrapperHelper_RegArgumentsSetup PROLOG_SAVE_REG_PAIR x25, x26, #64 PROLOG_SAVE_REG_PAIR x27, x28, #80 - str x0, [sp, #96] - ; HFA return value can be in d0-d3 + ; save any integral return value(s) + stp x0, x1, [sp, #96] + + ; save any FP/HFA return value(s) stp d0, d1, [sp, #112] stp d2, d3, [sp, #128] + mov x0, sp bl OnHijackScalarWorker - ldr x0, [sp, #96] + + ; restore any integral return value(s) + ldp x0, x1, [sp, #96] + + ; restore any FP/HFA return value(s) ldp d0, d1, [sp, #112] ldp d2, d3, [sp, #128] diff --git a/src/vm/arm64/cgencpu.h b/src/vm/arm64/cgencpu.h index 53079352cb..20b39c440d 100644 --- a/src/vm/arm64/cgencpu.h +++ b/src/vm/arm64/cgencpu.h @@ -54,8 +54,8 @@ class ComCallMethodDesc; #define CACHE_LINE_SIZE 32 // As per Intel Optimization Manual the cache line size is 32 bytes #define LOG2SLOT LOG2_PTRSIZE -#define ENREGISTERED_RETURNTYPE_MAXSIZE 64 // bytes (maximum HFA size is 8 doubles) -#define ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE 8 // bytes +#define ENREGISTERED_RETURNTYPE_MAXSIZE 32 // bytes (four FP registers: d0,d1,d2 and d3) +#define ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE 16 // bytes (two int registers: x0 and x1) #define ENREGISTERED_PARAMTYPE_MAXSIZE 16 // bytes (max value type size that can be passed by value) #define CALLDESCR_ARGREGS 1 // CallDescrWorker has ArgumentRegister parameter @@ -515,8 +515,11 @@ struct HijackArgs DWORD64 X19, X20, X21, X22, X23, X24, X25, X26, X27, X28; union { - DWORD64 X0; - size_t ReturnValue; + struct { + DWORD64 X0; + DWORD64 X1; + }; + size_t ReturnValue[2]; }; }; |