fix Windows memory-limit detection, and fix MrEd Windows console output for things like dump-memory-stats
svn: r5752
This commit is contained in:
parent
3d19cd30d1
commit
ed188cbf51
|
@ -17,6 +17,11 @@ __declspec(dllexport) void gc_fprintf(int ignored, const char *c, ...);
|
|||
|
||||
#ifdef GCPRINT_TO_WINDOWS_CONSOLE
|
||||
|
||||
static BOOL WINAPI IgnoreEverything(DWORD evt)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void GC_prim_stringout(char *s, int len)
|
||||
{
|
||||
static HANDLE console;
|
||||
|
@ -24,14 +29,23 @@ static void GC_prim_stringout(char *s, int len)
|
|||
|
||||
if (!console) {
|
||||
COORD size;
|
||||
int is_new;
|
||||
CONSOLE_SCREEN_BUFFER_INFO info;
|
||||
|
||||
console = GetStdHandle(STD_ERROR_HANDLE);
|
||||
if (console == INVALID_HANDLE_VALUE) {
|
||||
if (!GetConsoleScreenBufferInfo(console, &info)) {
|
||||
/* Since getting the screen buffer info failed,
|
||||
we must be in GUI mode. Create a console
|
||||
window --- and set the handler so that closing
|
||||
the window doesn't abort MrEd! */
|
||||
AllocConsole();
|
||||
console = GetStdHandle(STD_ERROR_HANDLE);
|
||||
size.X = 90;
|
||||
size.Y = 500;
|
||||
SetConsoleScreenBufferSize(console, size);
|
||||
GetConsoleScreenBufferInfo(console, &info);
|
||||
size = info.dwSize;
|
||||
if (size.Y < 500) {
|
||||
size.Y = 500;
|
||||
SetConsoleScreenBufferSize(console, size);
|
||||
}
|
||||
SetConsoleCtrlHandler(IgnoreEverything, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,13 +125,34 @@ static void protect_pages(void *p, size_t len, int writeable)
|
|||
#ifndef DONT_NEED_MAX_HEAP_SIZE
|
||||
typedef unsigned long size_type;
|
||||
|
||||
typedef BOOL (WINAPI * QueryInformationJobObject_Proc)(HANDLE hJob,
|
||||
JOBOBJECTINFOCLASS JobObjectInfoClass,
|
||||
LPVOID lpJobObjectInfo,
|
||||
DWORD cbJobObjectInfoLength,
|
||||
LPDWORD lpReturnLength);
|
||||
static size_type determine_max_heap_size(void)
|
||||
{
|
||||
/* FIXME: should use QueryInformationJobObject() */
|
||||
#if 0
|
||||
GCPRINT(GCOUTF,
|
||||
"Don't know how to get heap size for Windows: assuming 1GB\n");
|
||||
#endif
|
||||
return (1 * 1024 * 1024 * 1024);
|
||||
QueryInformationJobObject_Proc qijo;
|
||||
JOBOBJECT_EXTENDED_LIMIT_INFORMATION info;
|
||||
HMODULE hm;
|
||||
SYSTEM_INFO si;
|
||||
|
||||
hm = LoadLibrary("kernel32.dll");
|
||||
if (hm)
|
||||
qijo = (QueryInformationJobObject_Proc)GetProcAddress(hm, "QueryInformationJobObject");
|
||||
else
|
||||
qijo = NULL;
|
||||
|
||||
if (qijo) {
|
||||
DWORD size;
|
||||
if (qijo(NULL, JobObjectExtendedLimitInformation, &info, sizeof(info), &size)) {
|
||||
if (info.BasicLimitInformation.LimitFlags & JOB_OBJECT_LIMIT_PROCESS_MEMORY) {
|
||||
return info.ProcessMemoryLimit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GetSystemInfo(&si);
|
||||
return (size_type)si.lpMaximumApplicationAddress - (size_type)si.lpMinimumApplicationAddress;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1200,8 +1200,9 @@ Scheme_Object *scheme_dump_gc_stats(int c, Scheme_Object *p[])
|
|||
if (scheme_external_dump_arg)
|
||||
scheme_external_dump_arg(c ? p[0] : NULL);
|
||||
|
||||
#ifdef USE_TAGGED_ALLOCATION
|
||||
scheme_console_printf("Begin Dump\n");
|
||||
|
||||
#ifdef USE_TAGGED_ALLOCATION
|
||||
trace_path_type = -1;
|
||||
obj_type = -1;
|
||||
if (c && SCHEME_SYMBOLP(p[0])) {
|
||||
|
|
|
@ -12,6 +12,11 @@
|
|||
(define opt-flags "/O2 /Oy-")
|
||||
(define re:only #f)
|
||||
|
||||
(unless (find-executable-path "cl.exe" #f)
|
||||
(error (string-append
|
||||
"Cannot find executable \"cl.exe\".\n"
|
||||
"You may need to find and run \"vsvars32.bat\".")))
|
||||
|
||||
(unless (directory-exists? "xsrc")
|
||||
(make-directory "xsrc"))
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
AdditionalDependencies="user32.lib"
|
||||
OutputFile="..\..\..\collects\launcher\$(ProjectName).exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
|
|
Loading…
Reference in New Issue
Block a user