ObjFW  Check-in [bbeb71e81d]

Overview
Comment:invoke-x86_64: Set %al to number of SSE regs used
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bbeb71e81df2ee795e9abd5a2fd753d4b449f521cc1913b21537a53f8fd10aa1
User & Date: js on 2017-09-11 11:44:58
Other Links: manifest | tags
Context
2017-09-11
15:37
invoke-x86_64.m: Support passing args via stack check-in: 0bf9fafd47 user: js tags: trunk
11:44
invoke-x86_64: Set %al to number of SSE regs used check-in: bbeb71e81d user: js tags: trunk
02:28
Make GCC not complain about -pedantic check-in: ff3dbed5ba user: js tags: trunk
Changes

Modified src/invocation/apple-call-x86_64.S from [5b7d96cf0b] to [d4bd8ff3de].

21
22
23
24
25
26
27


28
29
30
31
32
33
34
.section __TEXT, __text, regular, pure_instructions
_of_invocation_call:
	pushq	%rbp
	movq	%rsp, %rbp

	subq	$16, %rsp
	movq	%rdi, -8(%rbp)



	movdqa	176(%rdi), %xmm7
	movdqa	160(%rdi), %xmm6
	movdqa	144(%rdi), %xmm5
	movdqa	128(%rdi), %xmm4
	movdqa	112(%rdi), %xmm3
	movdqa	96(%rdi), %xmm2







>
>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
.section __TEXT, __text, regular, pure_instructions
_of_invocation_call:
	pushq	%rbp
	movq	%rsp, %rbp

	subq	$16, %rsp
	movq	%rdi, -8(%rbp)

	movb	177(%rdi), %al

	movdqa	176(%rdi), %xmm7
	movdqa	160(%rdi), %xmm6
	movdqa	144(%rdi), %xmm5
	movdqa	128(%rdi), %xmm4
	movdqa	112(%rdi), %xmm3
	movdqa	96(%rdi), %xmm2

Modified src/invocation/invoke-x86_64.m from [ed5f594770] to [abe678c9cf].

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(&registers, '\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
131
132

133
134
135
136
137
138
139
140
		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;

			else
				/* TODO */
				abort();
		}
	}

	of_invocation_call(&registers);








|

>
|







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(&registers);