Differences From Artifact [ed5f594770]:
- File
src/invocation/invoke-x86_64.m
— part of check-in
[95797a4d1c]
at
2017-09-11 02:05:07
on branch trunk
— OFInvocation: Initial support for invoking
So far this is only for x86_64 with the Apple runtime and does not yet
support all types. It also does not yet support passing arguments via
the stack. (user: js, size: 4427) [annotate] [blame] [check-ins using]
To Artifact [abe678c9cf]:
- File src/invocation/invoke-x86_64.m — part of check-in [bbeb71e81d] at 2017-09-11 11:44:58 on branch trunk — invoke-x86_64: Set %al to number of SSE regs used (user: js, size: 4521) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #define NUM_GPR_OUT 2 #define NUM_SSE_IN 8 #define NUM_SSE_OUT 2 struct registers { uint64_t gpr[NUM_GPR_IN + NUM_GPR_OUT]; __m128 sse[NUM_SSE_IN]; }; extern void of_invocation_call(struct registers *); void of_invocation_invoke(OFInvocation *invocation) { OFMethodSignature *methodSignature = [invocation methodSignature]; size_t numberOfArguments = [methodSignature numberOfArguments]; const char *typeEncoding; struct registers registers; size_t currentGPR = 0, currentSSE = 0; for (size_t i = 0; i < numberOfArguments; i++) { union { uint64_t gpr; __m128 sse; } value; enum { | > > > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #define NUM_GPR_OUT 2 #define NUM_SSE_IN 8 #define NUM_SSE_OUT 2 struct registers { uint64_t gpr[NUM_GPR_IN + NUM_GPR_OUT]; __m128 sse[NUM_SSE_IN]; uint8_t num_sse; }; extern void of_invocation_call(struct registers *); void of_invocation_invoke(OFInvocation *invocation) { OFMethodSignature *methodSignature = [invocation methodSignature]; size_t numberOfArguments = [methodSignature numberOfArguments]; const char *typeEncoding; struct registers registers; size_t currentGPR = 0, currentSSE = 0; memset(®isters, '\0', sizeof(registers)); for (size_t i = 0; i < numberOfArguments; i++) { union { uint64_t gpr; __m128 sse; } value; enum { |
︙ | ︙ | |||
124 125 126 127 128 129 130 | if (valueType == VALUE_GPR) { if (currentGPR < NUM_GPR_IN) registers.gpr[currentGPR++] = value.gpr; else /* TODO */ abort(); } else if (valueType == VALUE_SSE) { | | > | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | if (valueType == VALUE_GPR) { if (currentGPR < NUM_GPR_IN) registers.gpr[currentGPR++] = value.gpr; else /* TODO */ abort(); } else if (valueType == VALUE_SSE) { if (currentSSE < NUM_SSE_IN) { registers.sse[currentSSE++] = value.sse; registers.num_sse++; } else /* TODO */ abort(); } } of_invocation_call(®isters); |
︙ | ︙ |