summaryrefslogtreecommitdiffstats
path: root/pcre-8.39-cygwin-jit.patch
blob: 694729fab80d53d7c4139f785793332ad14f8d0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
--- origsrc/pcre-8.39/sljit/sljitConfigInternal.h	2016-04-06 03:05:43.000000000 -0500
+++ src/pcre-8.39/sljit/sljitConfigInternal.h	2016-08-11 14:33:58.201820000 -0500
@@ -564,7 +564,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free
 
 #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
 
-#ifndef _WIN64
+#if !defined _WIN64 && !defined __CYGWIN__
 #define SLJIT_NUMBER_OF_REGISTERS 12
 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 6
 #define SLJIT_LOCALS_OFFSET_BASE (sizeof(sljit_sw))
@@ -572,7 +572,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free
 #define SLJIT_NUMBER_OF_REGISTERS 12
 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
 #define SLJIT_LOCALS_OFFSET_BASE ((4 + 2) * sizeof(sljit_sw))
-#endif /* _WIN64 */
+#endif /* _WIN64 || __CYGWIN__ */
 
 #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
 
@@ -644,7 +644,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free
 	(SLJIT_NUMBER_OF_REGISTERS - SLJIT_NUMBER_OF_SAVED_REGISTERS)
 
 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 6
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && (defined _WIN64)
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && (defined _WIN64 || defined __CYGWIN__)
 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 1
 #else
 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 0
--- origsrc/pcre-8.39/sljit/sljitNativeX86_32.c	2016-02-29 11:00:26.000000000 -0600
+++ src/pcre-8.39/sljit/sljitNativeX86_32.c	2016-08-11 14:34:29.121178600 -0500
@@ -164,7 +164,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 #endif
 
 	compiler->local_size = local_size;
-#ifdef _WIN32
+#if defined _WIN32 || defined __CYGWIN__
 	if (local_size > 1024) {
 #if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
 		FAIL_IF(emit_do_imm(compiler, MOV_r_i32 + reg_map[SLJIT_R0], local_size));
--- origsrc/pcre-8.39/sljit/sljitNativeX86_64.c	2016-02-29 11:00:26.000000000 -0600
+++ src/pcre-8.39/sljit/sljitNativeX86_64.c	2016-08-11 14:35:57.151763100 -0500
@@ -131,7 +131,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 
 		INC_SIZE(size);
 
-#ifndef _WIN64
+#if !defined _WIN64 && !defined __CYGWIN__
 		if (args > 0) {
 			*inst++ = REX_W;
 			*inst++ = MOV_r_rm;
@@ -169,7 +169,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 	local_size = ((local_size + SLJIT_LOCALS_OFFSET + saved_register_size + 15) & ~15) - saved_register_size;
 	compiler->local_size = local_size;
 
-#ifdef _WIN64
+#if defined _WIN64 || defined __CYGWIN__
 	if (local_size > 1024) {
 		/* Allocate stack for the callback, which grows the stack. */
 		inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 + (3 + sizeof(sljit_s32)));
@@ -223,7 +223,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 		inst += sizeof(sljit_s32);
 	}
 
-#ifdef _WIN64
+#if defined _WIN64 || defined __CYGWIN__
 	/* Save xmm6 register: movaps [rsp + 0x20], xmm6 */
 	if (fscratches >= 6 || fsaveds >= 1) {
 		inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
@@ -264,7 +264,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 	compiler->flags_saved = 0;
 	FAIL_IF(emit_mov_before_return(compiler, op, src, srcw));
 
-#ifdef _WIN64
+#if defined _WIN64 || defined __CYGWIN__
 	/* Restore xmm6 register: movaps xmm6, [rsp + 0x20] */
 	if (compiler->fscratches >= 6 || compiler->fsaveds >= 1) {
 		inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
@@ -557,7 +557,7 @@ static SLJIT_INLINE sljit_s32 call_with_
 {
 	sljit_u8 *inst;
 
-#ifndef _WIN64
+#if !defined _WIN64 && !defined __CYGWIN__
 	SLJIT_COMPILE_ASSERT(reg_map[SLJIT_R1] == 6 && reg_map[SLJIT_R0] < 8 && reg_map[SLJIT_R2] < 8, args_registers);
 
 	inst = (sljit_u8*)ensure_buf(compiler, 1 + ((type < SLJIT_CALL3) ? 3 : 6));
--- origsrc/pcre-8.39/sljit/sljitNativeX86_common.c	2016-03-04 03:20:25.000000000 -0600
+++ src/pcre-8.39/sljit/sljitNativeX86_common.c	2016-08-11 14:39:01.993876900 -0500
@@ -87,7 +87,7 @@ static const sljit_u8 reg_map[SLJIT_NUMB
 /* Note: r12 & 0x7 == 0b100, which decoded as SIB byte present
    Note: avoid to use r12 and r13 for memory addessing
    therefore r12 is better for SAVED_EREG than SAVED_REG. */
-#ifndef _WIN64
+#if !defined _WIN64 && !defined __CYGWIN__
 /* 1st passed in rdi, 2nd argument passed in rsi, 3rd in rdx. */
 static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = {
 	0, 0, 6, 1, 8, 11, 10, 12, 5, 13, 14, 15, 3, 4, 2, 7, 9
@@ -628,7 +628,7 @@ static SLJIT_INLINE sljit_s32 emit_resto
 	return SLJIT_SUCCESS;
 }
 
-#ifdef _WIN32
+#if defined _WIN32 || defined __CYGWIN__
 #include <malloc.h>
 
 static void SLJIT_CALL sljit_grow_stack(sljit_sw local_size)
@@ -750,7 +750,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 	case SLJIT_DIV_SW:
 		compiler->flags_saved = 0;
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-#ifdef _WIN64
+#if defined _WIN64 || defined __CYGWIN__
 		SLJIT_COMPILE_ASSERT(
 			reg_map[SLJIT_R0] == 0
 			&& reg_map[SLJIT_R1] == 2
@@ -769,7 +769,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 
 		op = GET_OPCODE(op);
 		if ((op | 0x2) == SLJIT_DIV_UW) {
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64)
+#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64) || defined(__CYGWIN__)
 			EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0);
 			inst = emit_x86_instruction(compiler, 1, SLJIT_R1, 0, SLJIT_R1, 0);
 #else
@@ -780,7 +780,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 		}
 
 		if ((op | 0x2) == SLJIT_DIV_SW) {
-#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64)
+#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64) || defined(__CYGWIN__)
 			EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0);
 #endif
 
@@ -812,7 +812,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 		*inst++ = GROUP_F7;
 		*inst = MOD_REG | ((op >= SLJIT_DIVMOD_UW) ? reg_map[TMP_REG1] : reg_map[SLJIT_R1]);
 #else
-#ifdef _WIN64
+#if defined _WIN64 || defined __CYGWIN__
 		size = (!compiler->mode32 || op >= SLJIT_DIVMOD_UW) ? 3 : 2;
 #else
 		size = (!compiler->mode32) ? 3 : 2;
@@ -820,7 +820,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 		inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
 		FAIL_IF(!inst);
 		INC_SIZE(size);
-#ifdef _WIN64
+#if defined _WIN64 || defined __CYGWIN__
 		if (!compiler->mode32)
 			*inst++ = REX_W | ((op >= SLJIT_DIVMOD_UW) ? REX_B : 0);
 		else if (op >= SLJIT_DIVMOD_UW)
@@ -850,7 +850,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 			*inst |= IDIV;
 			break;
 		}
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && !defined(_WIN64)
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && !defined(_WIN64) && !defined(__CYGWIN__)
 		if (op <= SLJIT_DIVMOD_SW)
 			EMIT_MOV(compiler, SLJIT_R1, 0, TMP_REG1, 0);
 #else
@@ -2616,7 +2616,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit
 			srcw += sizeof(sljit_sw);
 #endif
 #endif
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && defined(_WIN64)
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && (defined(_WIN64) || defined(__CYGWIN__))
 		if (src == SLJIT_R2) {
 			EMIT_MOV(compiler, TMP_REG1, 0, src, 0);
 			src = TMP_REG1;