1
- From ded6ccc89556e1bd5ab448f58e3a1103c11bddf5 Mon Sep 17 00:00:00 2001
1
+ From 644325d16aa9c5be6632768053a73f23c91ea5e0 Mon Sep 17 00:00:00 2001
2
2
From: Yaakov Selkowitz <
[email protected] >
3
3
Date: Thu, 12 May 2016 20:52:27 -0500
4
4
Subject: [PATCH 3/3] pcre2-10.40-cygwin-jit
5
5
6
6
Originally added in https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/pcre2.git;a=commit;h=d2472e4e74b52cb7f0936f8978c955b311fb71c3
7
7
---
8
- src /sljit/sljitConfigInternal.h | 6 + +--
9
- src /sljit/sljitNativeX86_64.c | 50 +++++++++++++++------ ----------
10
- src /sljit/sljitNativeX86_common.c | 16 +++++- ----
8
+ deps /sljit/sljit_src/ sljitConfigInternal.h | 6 +--
9
+ deps /sljit/sljit_src/ sljitNativeX86_64.c | 50 ++++++++++----------
10
+ deps /sljit/sljit_src/ sljitNativeX86_common.c | 16 +++----
11
11
3 files changed, 36 insertions(+), 36 deletions(-)
12
12
13
- diff --git a/src /sljit/sljitConfigInternal.h b/src /sljit/sljitConfigInternal.h
14
- index de06dd8..67daa14 100644
15
- --- a/src /sljit/sljitConfigInternal.h
16
- +++ b/src /sljit/sljitConfigInternal.h
17
- @@ -602 ,15 +602 ,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code);
13
+ diff --git a/deps /sljit/sljit_src/ sljitConfigInternal.h b/deps /sljit/sljit_src /sljitConfigInternal.h
14
+ index 3ae944e..c58c3be 100644
15
+ --- a/deps /sljit/sljit_src /sljitConfigInternal.h
16
+ +++ b/deps /sljit/sljit_src /sljitConfigInternal.h
17
+ @@ -617 ,15 +617 ,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code);
18
18
#define SLJIT_NUMBER_OF_TEMPORARY_REGISTERS 2
19
19
#define SLJIT_NUMBER_OF_FLOAT_REGISTERS 15
20
20
#define SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS 1
@@ -27,16 +27,16 @@ index de06dd8..67daa14 100644
27
27
+ #else /* _WIN64 || __CYGWIN__ */
28
28
#define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
29
29
#define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 10
30
- #define SLJIT_LOCALS_OFFSET_BASE (4 * SSIZE_OF(sw ))
30
+ #define SLJIT_LOCALS_OFFSET_BASE (4 * (sljit_s32)sizeof(sljit_sw ))
31
31
- #endif /* !_WIN64 */
32
32
+ #endif /* !_WIN64 && !__CYGWIN__ */
33
33
#define SLJIT_TMP_DEST_REG SLJIT_TMP_R0
34
34
#define SLJIT_TMP_MEM_REG SLJIT_TMP_R0
35
35
#define SLJIT_TMP_DEST_FREG SLJIT_TMP_FR0
36
- diff --git a/src /sljit/sljitNativeX86_64.c b/src /sljit/sljitNativeX86_64.c
37
- index 1ab7929..d748fa7 100644
38
- --- a/src /sljit/sljitNativeX86_64.c
39
- +++ b/src /sljit/sljitNativeX86_64.c
36
+ diff --git a/deps /sljit/sljit_src/ sljitNativeX86_64.c b/deps /sljit/sljit_src /sljitNativeX86_64.c
37
+ index e4d3db8..3862568 100644
38
+ --- a/deps /sljit/sljit_src /sljitNativeX86_64.c
39
+ +++ b/deps /sljit/sljit_src /sljitNativeX86_64.c
40
40
@@ -447,7 +447,7 @@ static sljit_u8* generate_mov_addr_code(struct sljit_jump *jump, sljit_u8 *code_
41
41
return code_ptr;
42
42
}
@@ -46,12 +46,14 @@ index 1ab7929..d748fa7 100644
46
46
typedef struct {
47
47
sljit_sw regs[2];
48
48
} sljit_sse2_reg;
49
- @@ -461,11 +461,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
49
+ @@ -461,13 +461,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
50
50
sljit_s32 word_arg_count = 0;
51
51
sljit_s32 saved_arg_count = SLJIT_KEPT_SAVEDS_COUNT(options);
52
52
sljit_s32 saved_regs_size, tmp, i;
53
53
- #ifdef _WIN64
54
54
+ #if defined _WIN64 || defined __CYGWIN__
55
+ sljit_s32 fscratches;
56
+ sljit_s32 fsaveds;
55
57
sljit_s32 saved_float_regs_size;
56
58
sljit_s32 saved_float_regs_offset = 0;
57
59
sljit_s32 float_arg_count = 0;
@@ -60,7 +62,7 @@ index 1ab7929..d748fa7 100644
60
62
sljit_u8 *inst;
61
63
62
64
CHECK_ERROR();
63
- @@ -504 ,7 +504 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
65
+ @@ -513 ,7 +513 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
64
66
PUSH_REG(reg_lmap[i]);
65
67
}
66
68
@@ -69,7 +71,7 @@ index 1ab7929..d748fa7 100644
69
71
local_size += SLJIT_LOCALS_OFFSET;
70
72
saved_float_regs_size = GET_SAVED_FLOAT_REGISTERS_SIZE(fscratches, fsaveds, sse2_reg);
71
73
72
- @@ -512 ,16 +512 ,16 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
74
+ @@ -521 ,16 +521 ,16 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
73
75
saved_float_regs_offset = ((local_size + 0xf) & ~0xf);
74
76
local_size = saved_float_regs_offset + saved_float_regs_size;
75
77
}
@@ -89,7 +91,7 @@ index 1ab7929..d748fa7 100644
89
91
switch (word_arg_count) {
90
92
case 0:
91
93
tmp = SLJIT_R2;
92
- @@ -536 ,7 +536 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
94
+ @@ -545 ,7 +545 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
93
95
tmp = SLJIT_R3;
94
96
break;
95
97
}
@@ -98,7 +100,7 @@ index 1ab7929..d748fa7 100644
98
100
switch (word_arg_count + float_arg_count) {
99
101
case 0:
100
102
tmp = SLJIT_R3;
101
- @@ -551 ,7 +551 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
103
+ @@ -560 ,7 +560 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
102
104
tmp = TMP_REG1;
103
105
break;
104
106
}
@@ -107,7 +109,7 @@ index 1ab7929..d748fa7 100644
107
109
if (arg_types & SLJIT_ARG_TYPE_SCRATCH_REG) {
108
110
if (tmp != SLJIT_R0 + word_arg_count)
109
111
EMIT_MOV(compiler, SLJIT_R0 + word_arg_count, 0, tmp, 0);
110
- @@ -561 ,13 +561 ,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
112
+ @@ -570 ,13 +570 ,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
111
113
}
112
114
word_arg_count++;
113
115
} else {
@@ -123,7 +125,7 @@ index 1ab7929..d748fa7 100644
123
125
}
124
126
arg_types >>= SLJIT_ARG_SHIFT;
125
127
}
126
- @@ -575 ,7 +575 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
128
+ @@ -584 ,7 +584 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
127
129
local_size = ((local_size + saved_regs_size + 0xf) & ~0xf) - saved_regs_size;
128
130
compiler->local_size = local_size;
129
131
@@ -132,7 +134,7 @@ index 1ab7929..d748fa7 100644
132
134
if (local_size > 0) {
133
135
if (local_size <= 4 * 4096) {
134
136
if (local_size > 4096)
135
- @@ -604 ,12 +604 ,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
137
+ @@ -613 ,12 +613 ,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
136
138
if (local_size > 0)
137
139
EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -local_size);
138
140
}
@@ -147,7 +149,7 @@ index 1ab7929..d748fa7 100644
147
149
if (saved_float_regs_size > 0) {
148
150
compiler->mode32 = 1;
149
151
150
- @@ -624 ,7 +624 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
152
+ @@ -633 ,7 +633 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
151
153
saved_float_regs_offset += 16;
152
154
}
153
155
}
@@ -156,24 +158,30 @@ index 1ab7929..d748fa7 100644
156
158
157
159
return SLJIT_SUCCESS;
158
160
}
159
- @@ -634,23 +634,23 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *comp
160
- sljit_s32 fscratches , sljit_s32 fsaveds , sljit_s32 local_size)
161
+ @@ -643,11 +643,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *comp
162
+ sljit_s32 scratches , sljit_s32 saveds , sljit_s32 local_size)
161
163
{
162
164
sljit_s32 saved_regs_size;
163
165
- #ifdef _WIN64
164
166
+ #if defined _WIN64 || defined __CYGWIN__
167
+ sljit_s32 fscratches;
168
+ sljit_s32 fsaveds;
165
169
sljit_s32 saved_float_regs_size;
166
170
- #endif /* _WIN64 */
167
171
+ #endif /* _WIN64 || __CYGWIN__ */
168
172
169
173
CHECK_ERROR();
170
- CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size));
171
- set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size);
174
+ CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, local_size));
175
+ @@ -655,7 +655,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *comp
176
+
177
+ scratches = ENTER_GET_REGS(scratches);
172
178
173
179
- #ifdef _WIN64
174
180
+ #if defined _WIN64 || defined __CYGWIN__
175
- local_size += SLJIT_LOCALS_OFFSET;
176
- saved_float_regs_size = GET_SAVED_FLOAT_REGISTERS_SIZE(fscratches, fsaveds, sse2_reg);
181
+ saveds = ENTER_GET_REGS(saveds);
182
+ fscratches = compiler->fscratches;
183
+ fsaveds = compiler->fsaveds;
184
+ @@ -665,9 +665,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *comp
177
185
178
186
if (saved_float_regs_size > 0)
179
187
local_size = ((local_size + 0xf) & ~0xf) + saved_float_regs_size;
@@ -185,7 +193,7 @@ index 1ab7929..d748fa7 100644
185
193
186
194
/* Including the return address saved by the call instruction. */
187
195
saved_regs_size = GET_SAVED_REGISTERS_SIZE(scratches, saveds - SLJIT_KEPT_SAVEDS_COUNT(options), 1);
188
- @@ -663 ,13 +663 ,13 @@ static sljit_s32 emit_stack_frame_release(struct sljit_compiler *compiler, sljit
196
+ @@ -680 ,13 +680 ,13 @@ static sljit_s32 emit_stack_frame_release(struct sljit_compiler *compiler, sljit
189
197
sljit_uw size;
190
198
sljit_s32 local_size, i, tmp;
191
199
sljit_u8 *inst;
@@ -202,7 +210,7 @@ index 1ab7929..d748fa7 100644
202
210
saved_float_regs_offset = GET_SAVED_FLOAT_REGISTERS_SIZE(fscratches, fsaveds, sse2_reg);
203
211
204
212
if (saved_float_regs_offset > 0) {
205
- @@ -689 ,7 +689 ,7 @@ static sljit_s32 emit_stack_frame_release(struct sljit_compiler *compiler, sljit
213
+ @@ -706 ,7 +706 ,7 @@ static sljit_s32 emit_stack_frame_release(struct sljit_compiler *compiler, sljit
206
214
207
215
compiler->mode32 = 0;
208
216
}
@@ -211,7 +219,7 @@ index 1ab7929..d748fa7 100644
211
219
212
220
local_size = compiler->local_size;
213
221
214
- @@ -766 ,7 +766 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_to(struct sljit_compiler *c
222
+ @@ -783 ,7 +783 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_to(struct sljit_compiler *c
215
223
/* Call / return instructions */
216
224
/* --------------------------------------------------------------------- */
217
225
@@ -220,10 +228,10 @@ index 1ab7929..d748fa7 100644
220
228
221
229
static sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_s32 *src_ptr)
222
230
{
223
- diff --git a/src /sljit/sljitNativeX86_common.c b/src /sljit/sljitNativeX86_common.c
224
- index ecb7e9b..91dfcc8 100644
225
- --- a/src /sljit/sljitNativeX86_common.c
226
- +++ b/src /sljit/sljitNativeX86_common.c
231
+ diff --git a/deps /sljit/sljit_src/ sljitNativeX86_common.c b/deps /sljit/sljit_src /sljitNativeX86_common.c
232
+ index 9f599d5..1113bc4 100644
233
+ --- a/deps /sljit/sljit_src /sljitNativeX86_common.c
234
+ +++ b/deps /sljit/sljit_src /sljitNativeX86_common.c
227
235
@@ -88,7 +88,7 @@ static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 2] = {
228
236
/* Note: r12 & 0x7 == 0b100, which decoded as SIB byte present
229
237
Note: avoid to use r12 and r13 for memory addressing
@@ -242,7 +250,7 @@ index ecb7e9b..91dfcc8 100644
242
250
#define HALFWORD_MAX 0x7fffffffl
243
251
#define HALFWORD_MIN -0x80000000l
244
252
#else
245
- @@ -1377 ,7 +1377 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
253
+ @@ -1409 ,7 +1409 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
246
254
case SLJIT_DIV_UW:
247
255
case SLJIT_DIV_SW:
248
256
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
@@ -251,7 +259,7 @@ index ecb7e9b..91dfcc8 100644
251
259
SLJIT_ASSERT(
252
260
reg_map[SLJIT_R0] == 0
253
261
&& reg_map[SLJIT_R1] == 2
254
- @@ -1394 ,7 +1394 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
262
+ @@ -1426 ,7 +1426 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
255
263
256
264
op = GET_OPCODE(op);
257
265
if ((op | 0x2) == SLJIT_DIV_UW) {
@@ -260,7 +268,7 @@ index ecb7e9b..91dfcc8 100644
260
268
EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0);
261
269
inst = emit_x86_instruction(compiler, 1, SLJIT_R1, 0, SLJIT_R1, 0);
262
270
#else
263
- @@ -1405 ,7 +1405 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
271
+ @@ -1437 ,7 +1437 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
264
272
}
265
273
266
274
if ((op | 0x2) == SLJIT_DIV_SW) {
@@ -269,7 +277,7 @@ index ecb7e9b..91dfcc8 100644
269
277
EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0);
270
278
#endif
271
279
272
- @@ -1430 ,7 +1430 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
280
+ @@ -1462 ,7 +1462 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
273
281
inst[0] = GROUP_F7;
274
282
inst[1] = MOD_REG | ((op >= SLJIT_DIVMOD_UW) ? reg_map[TMP_REG1] : reg_map[SLJIT_R1]);
275
283
#else /* !SLJIT_CONFIG_X86_32 */
@@ -278,7 +286,7 @@ index ecb7e9b..91dfcc8 100644
278
286
size = (!compiler->mode32 || op >= SLJIT_DIVMOD_UW) ? 3 : 2;
279
287
#else /* !_WIN64 */
280
288
size = (!compiler->mode32) ? 3 : 2;
281
- @@ -1438 ,7 +1438 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
289
+ @@ -1470 ,7 +1470 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
282
290
inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
283
291
FAIL_IF(!inst);
284
292
INC_SIZE(size);
@@ -287,7 +295,7 @@ index ecb7e9b..91dfcc8 100644
287
295
if (!compiler->mode32)
288
296
*inst++ = REX_W | ((op >= SLJIT_DIVMOD_UW) ? REX_B : 0);
289
297
else if (op >= SLJIT_DIVMOD_UW)
290
- @@ -1468 ,7 +1468 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
298
+ @@ -1500 ,7 +1500 ,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compile
291
299
inst[1] |= IDIV;
292
300
break;
293
301
}
0 commit comments