Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4b25bc8933574c8ced7b0005883338ee
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1305035b1372bdf234e3c5e673ee4c8ab5bda83ff06bc27704786def52667c3143fe587fca8f6e0855ba0c8b6d4dd90b2faefd33736224173f459d751885683e
2 changes: 1 addition & 1 deletion deps/libuv.version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
LIBUV_BRANCH=julia-uv2
LIBUV_SHA1=be317349252699670131395f125c3861d793ca86
LIBUV_SHA1=ed3700c849289ed01fe04273a7bf865340b2bd7e
22 changes: 6 additions & 16 deletions ui/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,9 @@ int main(int argc, char *argv[])
uv_setup_args(argc, argv); // no-op on Windows
#else

#if defined(_P64) && defined(JL_DEBUG_BUILD)
static int is_running_under_wine()
{
static const char * (CDECL *pwine_get_version)(void);
HMODULE hntdll = GetModuleHandle("ntdll.dll");
assert(hntdll);
pwine_get_version = (void *)GetProcAddress(hntdll, "wine_get_version");
return pwine_get_version != 0;
}
#endif

static void lock_low32() {
#if defined(_P64) && defined(JL_DEBUG_BUILD)
// Wine currently has a that causes it to answer VirtualQuery incorrectly.
// See https://www.winehq.org/pipermail/wine-devel/2016-March/112188.html for details
int under_wine = is_running_under_wine();
// block usage of the 32-bit address space on win64, to catch pointer cast errors
char *const max32addr = (char*)0xffffffffL;
SYSTEM_INFO info;
Expand All @@ -198,16 +185,19 @@ static void lock_low32() {
if (meminfo.State == MEM_FREE) { // reserve all free pages in the first 4GB of memory
char *first = (char*)meminfo.BaseAddress;
char *last = first + meminfo.RegionSize;
char *p;
if (last > max32addr)
last = max32addr;
// adjust first up to the first allocation granularity boundary
// adjust last down to the last allocation granularity boundary
first = (char*)(((long long)first + info.dwAllocationGranularity - 1) & ~(info.dwAllocationGranularity - 1));
last = (char*)((long long)last & ~(info.dwAllocationGranularity - 1));
if (last != first) {
p = VirtualAlloc(first, last - first, MEM_RESERVE, PAGE_NOACCESS); // reserve all memory in between
assert(under_wine || p == first);
void *p = VirtualAlloc(first, last - first, MEM_RESERVE, PAGE_NOACCESS); // reserve all memory in between
if ((char*)p != first)
// Wine and Windows10 seem to have issues with reporting memory access information correctly
// so we sometimes end up with unexpected results - this is just ignore those and continue
// this is just a debugging aid to help find accidental pointer truncation anyways, so it's not critical
VirtualFree(p, 0, MEM_RELEASE);
}
}
meminfo.BaseAddress += meminfo.RegionSize;
Expand Down