[Vm-dev] [commit][2931]
Type the memory allocators as accepting and answering usqInts to give a
chance at
commits at squeakvm.org
commits at squeakvm.org
Mon May 26 20:28:22 UTC 2014
Revision: 2931
Author: eliot
Date: 2014-05-26 13:28:22 -0700 (Mon, 26 May 2014)
Log Message:
-----------
Type the memory allocators as accepting and answering usqInts to give a chance at
allocating more than 2Gb.
Modified Paths:
--------------
branches/Cog/platforms/Mac OS/vm/sqMacMemory.c
branches/Cog/platforms/Mac OS/vm/sqPlatformSpecific.h
branches/Cog/platforms/unix/vm/sqPlatformSpecific.h
branches/Cog/platforms/unix/vm/sqUnixMemory.c
branches/Cog/platforms/win32/vm/sqWin32Alloc.c
branches/Cog/platforms/win32/vm/sqWin32Alloc.h
Property Changed:
----------------
branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
- Mon May 26 12:50:58 PDT 2014
+ Mon May 26 13:27:49 PDT 2014
Modified: branches/Cog/platforms/Mac OS/vm/sqMacMemory.c
===================================================================
--- branches/Cog/platforms/Mac OS/vm/sqMacMemory.c 2014-05-26 19:55:25 UTC (rev 2930)
+++ branches/Cog/platforms/Mac OS/vm/sqMacMemory.c 2014-05-26 20:28:22 UTC (rev 2931)
@@ -51,7 +51,7 @@
}
usqInt
-sqAllocateMemoryMac(sqInt desiredHeapSize, sqInt minHeapSize)
+sqAllocateMemoryMac(usqInt desiredHeapSize, usqInt minHeapSize)
{
void * debug, *actually;
#if SPURVM
Modified: branches/Cog/platforms/Mac OS/vm/sqPlatformSpecific.h
===================================================================
--- branches/Cog/platforms/Mac OS/vm/sqPlatformSpecific.h 2014-05-26 19:55:25 UTC (rev 2930)
+++ branches/Cog/platforms/Mac OS/vm/sqPlatformSpecific.h 2014-05-26 20:28:22 UTC (rev 2931)
@@ -74,7 +74,7 @@
#define allocateMemoryMinimumImageFileHeaderSize(heapSize, minimumMemory, fileStream, headerSize) \
sqAllocateMemoryMac(heapSize, minimumMemory)
-usqInt sqAllocateMemoryMac(sqInt desiredHeapSize, sqInt minHeapSize);
+usqInt sqAllocateMemoryMac(usqInt desiredHeapSize, usqInt minHeapSize);
#define sqAllocateMemory(x,y) sqAllocateMemoryMac(&y,x)
Modified: branches/Cog/platforms/unix/vm/sqPlatformSpecific.h
===================================================================
--- branches/Cog/platforms/unix/vm/sqPlatformSpecific.h 2014-05-26 19:55:25 UTC (rev 2930)
+++ branches/Cog/platforms/unix/vm/sqPlatformSpecific.h 2014-05-26 20:28:22 UTC (rev 2931)
@@ -41,7 +41,7 @@
#include "sqMemoryAccess.h"
-extern sqInt sqAllocateMemory(sqInt minHeapSize, sqInt desiredHeapSize);
+extern usqInt sqAllocateMemory(usqInt minHeapSize, usqInt desiredHeapSize);
#define allocateMemoryMinimumImageFileHeaderSize(heapSize, minimumMemory, fileStream, headerSize) \
sqAllocateMemory(minimumMemory, heapSize)
extern sqInt sqGrowMemoryBy(sqInt oldLimit, sqInt delta);
Modified: branches/Cog/platforms/unix/vm/sqUnixMemory.c
===================================================================
--- branches/Cog/platforms/unix/vm/sqUnixMemory.c 2014-05-26 19:55:25 UTC (rev 2930)
+++ branches/Cog/platforms/unix/vm/sqUnixMemory.c 2014-05-26 20:28:22 UTC (rev 2931)
@@ -56,7 +56,7 @@
#include "config.h"
#include "debug.h"
-void *uxAllocateMemory(sqInt minHeapSize, sqInt desiredHeapSize);
+void *uxAllocateMemory(usqInt minHeapSize, usqInt desiredHeapSize);
char *uxGrowMemoryBy(char *oldLimit, sqInt delta);
char *uxShrinkMemoryBy(char *oldLimit, sqInt delta);
sqInt uxMemoryExtraBytesLeft(sqInt includingSwap);
@@ -107,29 +107,27 @@
/* answer the address of (minHeapSize <= N <= desiredHeapSize) bytes of memory. */
-void *uxAllocateMemory(sqInt minHeapSize, sqInt desiredHeapSize)
+void *uxAllocateMemory(usqInt minHeapSize, usqInt desiredHeapSize)
{
#if !ALWAYS_USE_MMAP
if (!useMmap)
return malloc(desiredHeapSize);
#endif
- if (heap)
- {
+ if (heap) {
fprintf(stderr, "uxAllocateMemory: already called\n");
exit(1);
- }
+ }
pageSize= getpagesize();
pageMask= ~(pageSize - 1);
DPRINTF(("uxAllocateMemory: pageSize 0x%x (%d), mask 0x%x\n", pageSize, pageSize, pageMask));
#if (!MAP_ANON)
- if ((devZero= open("/dev/zero", O_RDWR)) < 0)
- {
+ if ((devZero= open("/dev/zero", O_RDWR)) < 0) {
perror("uxAllocateMemory: /dev/zero");
return 0;
- }
+ }
#endif
DPRINTF(("uxAllocateMemory: /dev/zero descriptor %d\n", devZero));
@@ -137,22 +135,19 @@
heapLimit= valign(max(desiredHeapSize, useMmap));
- while ((!heap) && (heapLimit >= minHeapSize))
- {
+ while ((!heap) && (heapLimit >= minHeapSize)) {
DPRINTF(("uxAllocateMemory: mapping 0x%08x bytes (%d Mbytes)\n", heapLimit, heapLimit >> 20));
- if (MAP_FAILED == (heap= mmap(0, heapLimit, MAP_PROT, MAP_FLAGS, devZero, 0)))
- {
+ if (MAP_FAILED == (heap= mmap(0, heapLimit, MAP_PROT, MAP_FLAGS, devZero, 0))) {
heap= 0;
heapLimit= valign(heapLimit / 4 * 3);
}
- }
+ }
- if (!heap)
- {
+ if (!heap) {
fprintf(stderr, "uxAllocateMemory: failed to allocate at least %lld bytes)\n", (long long)minHeapSize);
useMmap= 0;
return malloc(desiredHeapSize);
- }
+ }
heapSize= heapLimit;
@@ -271,7 +266,7 @@
#if defined(SQ_IMAGE32) && defined(SQ_HOST64)
-sqInt sqAllocateMemory(sqInt minHeapSize, sqInt desiredHeapSize)
+usqInt sqAllocateMemory(usqInt minHeapSize, usqInt desiredHeapSize)
{
sqMemoryBase= uxAllocateMemory(minHeapSize, desiredHeapSize);
if (!sqMemoryBase) return 0;
@@ -296,7 +291,7 @@
#else
-sqInt sqAllocateMemory(sqInt minHeapSize, sqInt desiredHeapSize) { return (sqInt)(long)uxAllocateMemory(minHeapSize, desiredHeapSize); }
+usqInt sqAllocateMemory(usqInt minHeapSize, usqInt desiredHeapSize) { return (sqInt)(long)uxAllocateMemory(minHeapSize, desiredHeapSize); }
sqInt sqGrowMemoryBy(sqInt oldLimit, sqInt delta) { return (sqInt)(long)uxGrowMemoryBy((char *)(long)oldLimit, delta); }
sqInt sqShrinkMemoryBy(sqInt oldLimit, sqInt delta) { return (sqInt)(long)uxShrinkMemoryBy((char *)(long)oldLimit, delta); }
sqInt sqMemoryExtraBytesLeft(sqInt includingSwap) { return uxMemoryExtraBytesLeft(includingSwap); }
Modified: branches/Cog/platforms/win32/vm/sqWin32Alloc.c
===================================================================
--- branches/Cog/platforms/win32/vm/sqWin32Alloc.c 2014-05-26 19:55:25 UTC (rev 2930)
+++ branches/Cog/platforms/win32/vm/sqWin32Alloc.c 2014-05-26 20:28:22 UTC (rev 2931)
@@ -53,7 +53,7 @@
/************************************************************************/
/* sqAllocateMemory: Initialize virtual memory */
/************************************************************************/
-void *sqAllocateMemory(int minHeapSize, int desiredHeapSize)
+void *sqAllocateMemory(usqInt minHeapSize, usqInt desiredHeapSize)
{ SYSTEM_INFO sysInfo;
DWORD initialCommit, commit;
Modified: branches/Cog/platforms/win32/vm/sqWin32Alloc.h
===================================================================
--- branches/Cog/platforms/win32/vm/sqWin32Alloc.h 2014-05-26 19:55:25 UTC (rev 2930)
+++ branches/Cog/platforms/win32/vm/sqWin32Alloc.h 2014-05-26 20:28:22 UTC (rev 2931)
@@ -21,7 +21,7 @@
#undef sqShrinkMemoryBy
#undef sqMemoryExtraBytesLeft
-void *sqAllocateMemory(int minHeapSize, int desiredHeapSize);
+void *sqAllocateMemory(usqInt minHeapSize, usqInt desiredHeapSize);
#define allocateMemoryMinimumImageFileHeaderSize(heapSize, minimumMemory, fileStream, headerSize) \
sqAllocateMemory(minimumMemory, heapSize)
int sqGrowMemoryBy(int oldLimit, int delta);
More information about the Vm-dev
mailing list