@@ -169,22 +169,9 @@ int main(int argc, char *argv[])
169
169
uv_setup_args (argc , argv ); // no-op on Windows
170
170
#else
171
171
172
- #if defined(_P64 ) && defined(JL_DEBUG_BUILD )
173
- static int is_running_under_wine ()
174
- {
175
- static const char * (CDECL * pwine_get_version )(void );
176
- HMODULE hntdll = GetModuleHandle ("ntdll.dll" );
177
- assert (hntdll );
178
- pwine_get_version = (void * )GetProcAddress (hntdll , "wine_get_version" );
179
- return pwine_get_version != 0 ;
180
- }
181
- #endif
182
-
183
172
static void lock_low32 () {
184
173
#if defined(_P64 ) && defined(JL_DEBUG_BUILD )
185
174
// Wine currently has a that causes it to answer VirtualQuery incorrectly.
186
- // See https://www.winehq.org/pipermail/wine-devel/2016-March/112188.html for details
187
- int under_wine = is_running_under_wine ();
188
175
// block usage of the 32-bit address space on win64, to catch pointer cast errors
189
176
char * const max32addr = (char * )0xffffffffL ;
190
177
SYSTEM_INFO info ;
@@ -198,16 +185,19 @@ static void lock_low32() {
198
185
if (meminfo .State == MEM_FREE ) { // reserve all free pages in the first 4GB of memory
199
186
char * first = (char * )meminfo .BaseAddress ;
200
187
char * last = first + meminfo .RegionSize ;
201
- char * p ;
202
188
if (last > max32addr )
203
189
last = max32addr ;
204
190
// adjust first up to the first allocation granularity boundary
205
191
// adjust last down to the last allocation granularity boundary
206
192
first = (char * )(((long long )first + info .dwAllocationGranularity - 1 ) & ~(info .dwAllocationGranularity - 1 ));
207
193
last = (char * )((long long )last & ~(info .dwAllocationGranularity - 1 ));
208
194
if (last != first ) {
209
- p = VirtualAlloc (first , last - first , MEM_RESERVE , PAGE_NOACCESS ); // reserve all memory in between
210
- assert (under_wine || p == first );
195
+ void * p = VirtualAlloc (first , last - first , MEM_RESERVE , PAGE_NOACCESS ); // reserve all memory in between
196
+ if ((char * )p != first )
197
+ // Wine and Windows10 seem to have issues with reporting memory access information correctly
198
+ // so we sometimes end up with unexpected results - this is just ignore those and continue
199
+ // this is just a debugging aid to help find accidental pointer truncation anyways, so it's not critical
200
+ VirtualFree (p , 0 , MEM_RELEASE );
211
201
}
212
202
}
213
203
meminfo .BaseAddress += meminfo .RegionSize ;
0 commit comments