comparison src/ralloc.c @ 16:0293115a14e9 r19-15b91

Import from CVS: tag r19-15b91
author cvs
date Mon, 13 Aug 2007 08:49:20 +0200
parents ac2d302a0011
children 859a2309aef8
comparison
equal deleted inserted replaced
15:ad457d5f7d04 16:0293115a14e9
913 purpose. [ACP Vol I]. We can't use the workaround of using a 913 purpose. [ACP Vol I]. We can't use the workaround of using a
914 randomized first fit because we don't want to presume too much 914 randomized first fit because we don't want to presume too much
915 about the memory map. Instead, we try to coalesce empty or 915 about the memory map. Instead, we try to coalesce empty or
916 unavailable blocks at any available opportunity. */ 916 unavailable blocks at any available opportunity. */
917 917
918 static void Addr_Block_initialize(); /* Initialization procedure for address picking scheme */ 918 /* Initialization procedure for address picking scheme */
919 static VM_ADDR New_Addr_Block( SIZE sz ); /* Get a suitable VM_ADDR via mmap */ 919 static void Addr_Block_initialize(void);
920 static void Free_Addr_Block( VM_ADDR addr, SIZE sz ); /* Free a VM_ADDR allocated via New_Addr_Block */ 920
921 /* Get a suitable VM_ADDR via mmap */
922 static VM_ADDR New_Addr_Block( SIZE sz );
923
924 /* Free a VM_ADDR allocated via New_Addr_Block */
925 static void Free_Addr_Block( VM_ADDR addr, SIZE sz );
921 926
922 #ifdef MMAP_GENERATE_ADDRESSES 927 #ifdef MMAP_GENERATE_ADDRESSES
923 /* Implementation of the three calls for address picking when XEmacs is incharge */ 928 /* Implementation of the three calls for address picking when XEmacs is incharge */
924 929
925 /* The enum denotes the status of the following block. */ 930 /* The enum denotes the status of the following block. */
1034 } 1039 }
1035 #else /* !MMAP_GENERATE_ADDRESSES */ 1040 #else /* !MMAP_GENERATE_ADDRESSES */
1036 /* This is an alternate (simpler) implementation in cases where the 1041 /* This is an alternate (simpler) implementation in cases where the
1037 address is picked by the kernel. */ 1042 address is picked by the kernel. */
1038 1043
1039 static void Addr_Block_initialize() 1044 static void Addr_Block_initialize(void)
1040 {} /* Nothing. */ 1045 {
1046 /* Nothing. */
1047 }
1041 1048
1042 static VM_ADDR New_Addr_Block( SIZE sz ) 1049 static VM_ADDR New_Addr_Block( SIZE sz )
1043 { 1050 {
1044 return mmap( 0, sz, PROT_READ|PROT_WRITE, MAP_FLAGS, 1051 return mmap( 0, sz, PROT_READ|PROT_WRITE, MAP_FLAGS,
1045 DEV_ZERO_FD, 0 ); 1052 DEV_ZERO_FD, 0 );
1258 1265
1259 void 1266 void
1260 syms_of_ralloc (void) 1267 syms_of_ralloc (void)
1261 { 1268 {
1262 #ifdef MMAP_METERING 1269 #ifdef MMAP_METERING
1263 defsymbol( &Qmm_times_mapped, "mmap-times-mapped" ); 1270 defsymbol (&Qmm_times_mapped, "mmap-times-mapped");
1264 defsymbol( &Qmm_pages_mapped, "mmap-pages-mapped" ); 1271 defsymbol (&Qmm_pages_mapped, "mmap-pages-mapped");
1265 defsymbol( &Qmm_times_unmapped, "mmap-times-unmapped" ); 1272 defsymbol (&Qmm_times_unmapped, "mmap-times-unmapped");
1266 defsymbol( &Qmm_times_remapped, "mmap-times-remapped" ); 1273 defsymbol (&Qmm_times_remapped, "mmap-times-remapped");
1267 defsymbol( &Qmm_didnt_copy, "mmap-didnt-copy" ); 1274 defsymbol (&Qmm_didnt_copy, "mmap-didnt-copy");
1268 defsymbol( &Qmm_pages_copied, "mmap-pages-copied" ); 1275 defsymbol (&Qmm_pages_copied, "mmap-pages-copied");
1269 defsymbol( &Qmm_average_bumpval, "mmap-average-bumpval" ); 1276 defsymbol (&Qmm_average_bumpval, "mmap-average-bumpval");
1270 defsymbol( &Qmm_wastage, "mmap-wastage" ); 1277 defsymbol (&Qmm_wastage, "mmap-wastage");
1271 defsymbol( &Qmm_live_pages, "mmap-live-pages" ); 1278 defsymbol (&Qmm_live_pages, "mmap-live-pages");
1272 defsymbol( &Qmm_addr_looked_up, "mmap-had-to-look-up-address" ); 1279 defsymbol (&Qmm_addr_looked_up, "mmap-had-to-look-up-address");
1273 defsymbol( &Qmm_hash_worked, "mmap-hash-table-worked" ); 1280 defsymbol (&Qmm_hash_worked, "mmap-hash-table-worked");
1274 defsymbol( &Qmm_addrlist_size, "mmap-addrlist-size" ); 1281 defsymbol (&Qmm_addrlist_size, "mmap-addrlist-size");
1275 defsubr( &Smmap_allocator_status ); 1282 defsubr (&Smmap_allocator_status);
1276 #endif /* MMAP_METERING */ 1283 #endif /* MMAP_METERING */
1277 } 1284 }
1278 1285
1279 void 1286 void
1280 vars_of_ralloc (void) 1287 vars_of_ralloc (void)