[iortcw] 27/89: All: Rename variables for QVM 'dynamic' memory
Simon McVittie
smcv at debian.org
Fri Sep 8 10:44:20 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to tag 1.51b
in repository iortcw.
commit bf4d40075671a225326d46b9597b0fad76211ccd
Author: Zack Middleton <zack at cloemail.com>
Date: Wed Jun 21 20:46:47 2017 -0500
All: Rename variables for QVM 'dynamic' memory
vm->dataAlloc conflicts with a change made to ioq3. So rename it and
other related variables to heapAlloc etc.
---
MP/code/qcommon/vm.c | 36 ++++++++++++++++++------------------
MP/code/qcommon/vm_local.h | 6 +++---
SP/code/qcommon/vm.c | 36 ++++++++++++++++++------------------
SP/code/qcommon/vm_local.h | 6 +++---
4 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/MP/code/qcommon/vm.c b/MP/code/qcommon/vm.c
index 5cf2c84..f3b04a0 100644
--- a/MP/code/qcommon/vm.c
+++ b/MP/code/qcommon/vm.c
@@ -446,7 +446,7 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc, qboolean unpure)
dataLength = header.h->dataLength + header.h->litLength +
header.h->bssLength;
- vm->dataAlloc = vm->dataLength = dataLength - PROGRAM_STACK_SIZE;
+ vm->heapAlloc = vm->heapLength = dataLength - PROGRAM_STACK_SIZE;
dataLength += vm_minQvmHunkMegs->integer * 1024 * 1024;
@@ -706,7 +706,7 @@ vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *),
vm->stackBottom = vm->programStack - PROGRAM_STACK_SIZE;
// allocate temporary memory down from the bottom of the stack
- vm->dataAllocTop = vm->stackBottom;
+ vm->heapAllocTop = vm->stackBottom;
Com_Printf("%s loaded in %d bytes on the hunk\n", module, remaining - Hunk_MemoryRemaining());
@@ -1002,10 +1002,10 @@ void VM_VmInfo_f( void ) {
Com_Printf( " code length : %7i\n", vm->codeLength );
Com_Printf( " table length: %7i\n", vm->instructionCount*4 );
Com_Printf( " data length : %7i\n", vm->dataMask + 1 );
- Com_Printf( " total memory: %7i\n", vm->stackBottom - vm->dataLength );
- Com_Printf( " free memory : %7i\n", vm->dataAllocTop - vm->dataAlloc );
- Com_Printf( " used permanent memory: %7i\n", vm->dataAlloc - vm->dataLength );
- Com_Printf( " used temporary memory: %7i\n", vm->stackBottom - vm->dataAllocTop );
+ Com_Printf( " total memory: %7i\n", vm->stackBottom - vm->heapLength );
+ Com_Printf( " free memory : %7i\n", vm->heapAllocTop - vm->heapAlloc );
+ Com_Printf( " used permanent memory: %7i\n", vm->heapAlloc - vm->heapLength );
+ Com_Printf( " used temporary memory: %7i\n", vm->stackBottom - vm->heapAllocTop );
}
}
@@ -1068,19 +1068,19 @@ unsigned VM_GetTempMemory( vm_t *vm, int size, const void *initData ) {
// align addresses
allocSize = ( size + 31 ) & ~31;
- if ( vm->dataAllocTop - allocSize <= vm->dataAlloc ) {
+ if ( vm->heapAllocTop - allocSize <= vm->heapAlloc ) {
return 0;
}
- vm->dataAllocTop -= allocSize;
+ vm->heapAllocTop -= allocSize;
if ( initData ) {
- Com_Memcpy( vm->dataBase + vm->dataAllocTop, initData, size );
+ Com_Memcpy( vm->dataBase + vm->heapAllocTop, initData, size );
} else {
- Com_Memset( vm->dataBase + vm->dataAllocTop, 0, size );
+ Com_Memset( vm->dataBase + vm->heapAllocTop, 0, size );
}
- return vm->dataAllocTop;
+ return vm->heapAllocTop;
}
/*
@@ -1100,17 +1100,17 @@ void VM_FreeTempMemory( vm_t *vm, unsigned qvmPointer, int size, void *outData )
// align addresses
allocSize = ( size + 31 ) & ~31;
- if ( vm->dataAllocTop + allocSize > vm->stackBottom ) {
+ if ( vm->heapAllocTop + allocSize > vm->stackBottom ) {
Com_Error( ERR_DROP, "Tried to free too much QVM temporary memory!");
}
if ( outData ) {
- Com_Memcpy( outData, vm->dataBase + vm->dataAllocTop, size );
+ Com_Memcpy( outData, vm->dataBase + vm->heapAllocTop, size );
}
- Com_Memset( vm->dataBase + vm->dataAllocTop, 0, size );
+ Com_Memset( vm->dataBase + vm->heapAllocTop, 0, size );
- vm->dataAllocTop += allocSize;
+ vm->heapAllocTop += allocSize;
}
#if 0 // ZTM: new unused code for allocating unfreeable memory in dlls and qvms.
@@ -1126,13 +1126,13 @@ unsigned int QVM_Alloc( vm_t *vm, int size ) {
// align addresses
allocSize = ( size + 31 ) & ~31;
- if ( vm->dataAlloc + allocSize > vm->dataAllocTop ) {
+ if ( vm->heapAlloc + allocSize > vm->heapAllocTop ) {
Com_Error( ERR_DROP, "QVM_Alloc: %s failed on allocation of %i bytes", vm->name, size );
return 0;
}
- pointer = vm->dataAlloc;
- vm->dataAlloc += allocSize;
+ pointer = vm->heapAlloc;
+ vm->heapAlloc += allocSize;
Com_Memset( vm->dataBase + pointer, 0, size );
diff --git a/MP/code/qcommon/vm_local.h b/MP/code/qcommon/vm_local.h
index c9a2813..d1b60c5 100644
--- a/MP/code/qcommon/vm_local.h
+++ b/MP/code/qcommon/vm_local.h
@@ -171,9 +171,9 @@ struct vm_s {
byte *dataBase;
int dataMask;
- int dataLength; // length of QVMs data
- int dataAlloc; // QVM's current allocate point
- int dataAllocTop; // QVM's current temporary memory allocate point
+ int heapLength; // length of QVMs data
+ int heapAlloc; // QVM's current allocate point
+ int heapAllocTop; // QVM's current temporary memory allocate point
int stackBottom; // if programStack < stackBottom, error
diff --git a/SP/code/qcommon/vm.c b/SP/code/qcommon/vm.c
index a72ed47..6b9d0e2 100644
--- a/SP/code/qcommon/vm.c
+++ b/SP/code/qcommon/vm.c
@@ -449,7 +449,7 @@ vmHeader_t *VM_LoadQVM( vm_t *vm, qboolean alloc, qboolean unpure)
dataLength = header.h->dataLength + header.h->litLength +
header.h->bssLength;
- vm->dataAlloc = vm->dataLength = dataLength - PROGRAM_STACK_SIZE;
+ vm->heapAlloc = vm->heapLength = dataLength - PROGRAM_STACK_SIZE;
dataLength += vm_minQvmHunkMegs->integer * 1024 * 1024;
@@ -689,7 +689,7 @@ vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *),
vm->stackBottom = vm->programStack - PROGRAM_STACK_SIZE;
// allocate temporary memory down from the bottom of the stack
- vm->dataAllocTop = vm->stackBottom;
+ vm->heapAllocTop = vm->stackBottom;
Com_Printf("%s loaded in %d bytes on the hunk\n", module, remaining - Hunk_MemoryRemaining());
@@ -978,10 +978,10 @@ void VM_VmInfo_f( void ) {
Com_Printf( " code length : %7i\n", vm->codeLength );
Com_Printf( " table length: %7i\n", vm->instructionCount*4 );
Com_Printf( " data length : %7i\n", vm->dataMask + 1 );
- Com_Printf( " total memory: %7i\n", vm->stackBottom - vm->dataLength );
- Com_Printf( " free memory : %7i\n", vm->dataAllocTop - vm->dataAlloc );
- Com_Printf( " used permanent memory: %7i\n", vm->dataAlloc - vm->dataLength );
- Com_Printf( " used temporary memory: %7i\n", vm->stackBottom - vm->dataAllocTop );
+ Com_Printf( " total memory: %7i\n", vm->stackBottom - vm->heapLength );
+ Com_Printf( " free memory : %7i\n", vm->heapAllocTop - vm->heapAlloc );
+ Com_Printf( " used permanent memory: %7i\n", vm->heapAlloc - vm->heapLength );
+ Com_Printf( " used temporary memory: %7i\n", vm->stackBottom - vm->heapAllocTop );
}
}
@@ -1044,19 +1044,19 @@ unsigned VM_GetTempMemory( vm_t *vm, int size, const void *initData ) {
// align addresses
allocSize = ( size + 31 ) & ~31;
- if ( vm->dataAllocTop - allocSize <= vm->dataAlloc ) {
+ if ( vm->heapAllocTop - allocSize <= vm->heapAlloc ) {
return 0;
}
- vm->dataAllocTop -= allocSize;
+ vm->heapAllocTop -= allocSize;
if ( initData ) {
- Com_Memcpy( vm->dataBase + vm->dataAllocTop, initData, size );
+ Com_Memcpy( vm->dataBase + vm->heapAllocTop, initData, size );
} else {
- Com_Memset( vm->dataBase + vm->dataAllocTop, 0, size );
+ Com_Memset( vm->dataBase + vm->heapAllocTop, 0, size );
}
- return vm->dataAllocTop;
+ return vm->heapAllocTop;
}
/*
@@ -1076,17 +1076,17 @@ void VM_FreeTempMemory( vm_t *vm, unsigned qvmPointer, int size, void *outData )
// align addresses
allocSize = ( size + 31 ) & ~31;
- if ( vm->dataAllocTop + allocSize > vm->stackBottom ) {
+ if ( vm->heapAllocTop + allocSize > vm->stackBottom ) {
Com_Error( ERR_DROP, "Tried to free too much QVM temporary memory!");
}
if ( outData ) {
- Com_Memcpy( outData, vm->dataBase + vm->dataAllocTop, size );
+ Com_Memcpy( outData, vm->dataBase + vm->heapAllocTop, size );
}
- Com_Memset( vm->dataBase + vm->dataAllocTop, 0, size );
+ Com_Memset( vm->dataBase + vm->heapAllocTop, 0, size );
- vm->dataAllocTop += allocSize;
+ vm->heapAllocTop += allocSize;
}
/*
@@ -1101,13 +1101,13 @@ unsigned int QVM_Alloc( vm_t *vm, int size ) {
// align addresses
allocSize = ( size + 31 ) & ~31;
- if ( vm->dataAlloc + allocSize > vm->dataAllocTop ) {
+ if ( vm->heapAlloc + allocSize > vm->heapAllocTop ) {
Com_Error( ERR_DROP, "QVM_Alloc: %s failed on allocation of %i bytes", vm->name, size );
return 0;
}
- pointer = vm->dataAlloc;
- vm->dataAlloc += allocSize;
+ pointer = vm->heapAlloc;
+ vm->heapAlloc += allocSize;
Com_Memset( vm->dataBase + pointer, 0, size );
diff --git a/SP/code/qcommon/vm_local.h b/SP/code/qcommon/vm_local.h
index c9a2813..d1b60c5 100644
--- a/SP/code/qcommon/vm_local.h
+++ b/SP/code/qcommon/vm_local.h
@@ -171,9 +171,9 @@ struct vm_s {
byte *dataBase;
int dataMask;
- int dataLength; // length of QVMs data
- int dataAlloc; // QVM's current allocate point
- int dataAllocTop; // QVM's current temporary memory allocate point
+ int heapLength; // length of QVMs data
+ int heapAlloc; // QVM's current allocate point
+ int heapAllocTop; // QVM's current temporary memory allocate point
int stackBottom; // if programStack < stackBottom, error
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list