This patch makes ALLOC_CHUNK_SIZE into a configurable setting.
This makes it possible to have memory blocks larger than 640k,
allowing fuller use of the space provided by Glulx. Apply the following patch.
About Patches
Issue C63102 [previous patch]
Support $ALLOC_CHUNK_SIZE memory setting
Submitted by: Jesse McGrew
Appeared in: Compiler 6.31 or before
Fixed in: -
Problem
Solution
diff -c inform631-old/header.h inform631_source/header.h
*** inform631-old/header.h Fri Feb 10 02:21:06 2006
--- inform631_source/header.h Sat Jul 22 14:53:11 2006
***************
*** 798,806 ****
int main_flag;
} ErrorPosition;
! /* A memory block can hold at most 640K: */
! #define ALLOC_CHUNK_SIZE 8192
typedef struct memory_block_s
{ int chunks;
--- 798,806 ----
int main_flag;
} ErrorPosition;
! /* A memory block can hold at most ALLOC_CHUNK_SIZE * 72: */
! extern int ALLOC_CHUNK_SIZE;
typedef struct memory_block_s
{ int chunks;
diff -c inform631-old/memory.c inform631_source/memory.c
*** inform631-old/memory.c Sat Jan 28 06:14:30 2006
--- inform631_source/memory.c Sat Jul 22 15:59:18 2006
***************
*** 123,129 ****
{ compiler_error_named("memory: negative index to", chunk_name(MB, 0));
return;
}
! if (ch >= 72) fatalerror("One of the memory blocks has exceeded 640K");
if (MB->chunk[ch] == NULL)
{ int i;
--- 123,129 ----
{ compiler_error_named("memory: negative index to", chunk_name(MB, 0));
return;
}
! if (ch >= 72) memoryerror("ALLOC_CHUNK_SIZE", ALLOC_CHUNK_SIZE);
if (MB->chunk[ch] == NULL)
{ int i;
***************
*** 174,179 ****
--- 174,180 ----
int DICT_WORD_SIZE;
int NUM_ATTR_BYTES;
int32 MAX_NUM_STATIC_STRINGS;
+ int ALLOC_CHUNK_SIZE;
/* The way memory sizes are set causes great nuisance for those parameters
which have different defaults under Z-code and Glulx. We have to get
***************
*** 185,190 ****
--- 186,192 ----
static int MAX_LOCAL_VARIABLES_z, MAX_LOCAL_VARIABLES_g;
static int DICT_WORD_SIZE_z, DICT_WORD_SIZE_g;
static int NUM_ATTR_BYTES_z, NUM_ATTR_BYTES_g;
+ static int ALLOC_CHUNK_SIZE_z, ALLOC_CHUNK_SIZE_g;
/* ------------------------------------------------------------------------- */
/* Memory control from the command line */
***************
*** 197,202 ****
--- 199,205 ----
printf("| %25s = %-7d |\n","MAX_ABBREVS",MAX_ABBREVS);
printf("| %25s = %-7d |\n","MAX_ACTIONS",MAX_ACTIONS);
printf("| %25s = %-7d |\n","MAX_ADJECTIVES",MAX_ADJECTIVES);
+ printf("| %25s = %-7d |\n","ALLOC_CHUNK_SIZE",ALLOC_CHUNK_SIZE);
printf("| %25s = %-7d |\n","NUM_ATTR_BYTES",NUM_ATTR_BYTES);
printf("| %25s = %-7d |\n","MAX_CLASSES",MAX_CLASSES);
printf("| %25s = %-7d |\n","MAX_CLASS_TABLE_SIZE",MAX_CLASS_TABLE_SIZE);
***************
*** 285,290 ****
--- 288,296 ----
MAX_GLOBAL_VARIABLES_z = 240;
MAX_GLOBAL_VARIABLES_g = 512;
+
+ ALLOC_CHUNK_SIZE_z = 8192;
+ ALLOC_CHUNK_SIZE_g = 32768;
}
if (size_flag == LARGE_SIZE)
{
***************
*** 333,338 ****
--- 339,347 ----
MAX_GLOBAL_VARIABLES_z = 240;
MAX_GLOBAL_VARIABLES_g = 512;
+
+ ALLOC_CHUNK_SIZE_z = 8192;
+ ALLOC_CHUNK_SIZE_g = 16384;
}
if (size_flag == SMALL_SIZE)
{
***************
*** 381,386 ****
--- 390,398 ----
MAX_GLOBAL_VARIABLES_z = 240;
MAX_GLOBAL_VARIABLES_g = 256;
+
+ ALLOC_CHUNK_SIZE_z = 8192;
+ ALLOC_CHUNK_SIZE_g = 8192;
}
/* Regardless of size_flag... */
***************
*** 405,410 ****
--- 417,423 ----
MAX_LOCAL_VARIABLES = MAX_LOCAL_VARIABLES_z;
DICT_WORD_SIZE = DICT_WORD_SIZE_z;
NUM_ATTR_BYTES = NUM_ATTR_BYTES_z;
+ ALLOC_CHUNK_SIZE = ALLOC_CHUNK_SIZE_z;
}
else {
MAX_ZCODE_SIZE = MAX_ZCODE_SIZE_g;
***************
*** 413,418 ****
--- 426,432 ----
MAX_LOCAL_VARIABLES = MAX_LOCAL_VARIABLES_g;
DICT_WORD_SIZE = DICT_WORD_SIZE_g;
NUM_ATTR_BYTES = NUM_ATTR_BYTES_g;
+ ALLOC_CHUNK_SIZE = ALLOC_CHUNK_SIZE_g;
}
}
***************
*** 644,650 ****
" MAX_NUM_STATIC_STRINGS is the maximum number of compiled strings \n\
allowed in the program. (Glulx only)\n");
return;
!
}
printf("No such memory setting as \"%s\"\n",command);
--- 658,670 ----
" MAX_NUM_STATIC_STRINGS is the maximum number of compiled strings \n\
allowed in the program. (Glulx only)\n");
return;
! }
! if (strcmp(command,"ALLOC_CHUNK_SIZE")==0)
! {
! printf(
! " ALLOC_CHUNK_SIZE is a base unit of Inform's internal memory allocation \n\
! for various structures.\n");
! return;
}
printf("No such memory setting as \"%s\"\n",command);
***************
*** 779,784 ****
--- 799,808 ----
{ MAX_GLOBAL_VARIABLES=j, flag=1;
MAX_GLOBAL_VARIABLES_g=MAX_GLOBAL_VARIABLES_z=j;
}
+ if (strcmp(command,"ALLOC_CHUNK_SIZE")==0)
+ { ALLOC_CHUNK_SIZE=j, flag=1;
+ ALLOC_CHUNK_SIZE_g=ALLOC_CHUNK_SIZE_z=j;
+ }
if (flag==0)
printf("No such memory setting as \"%s\"\n", command);
Last updated 17 April 2013.
This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation.
Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Roger Firth.