Ticket #8993: boost_1_54_0-m68k-1.patch
File boost_1_54_0-m68k-1.patch, 2.9 KB (added by , 9 years ago) |
---|
-
boost_1_54_0/tools/build/v2/engine/function.c
old new struct _stack 216 216 217 217 static void * stack; 218 218 219 static size_t align_down( size_t n ) 220 { 221 return n & ~( sizeof( LIST * ) - 1 ); 222 } 223 224 static size_t align_up( size_t n ) 225 { 226 return align_down( n + sizeof( LIST * ) - 1 ); 227 } 228 219 229 STACK * stack_global() 220 230 { 221 231 static STACK result; … … STACK * stack_global() 223 233 { 224 234 int const size = 1 << 21; 225 235 stack = BJAM_MALLOC( size ); 226 result.data = ( char *)stack + size;236 result.data = (void *)align_down( (size_t)( (char *)stack + size ) ); 227 237 } 228 238 return &result; 229 239 } … … static int expand_modifiers( STACK * s, 854 864 855 865 if ( total != 0 ) 856 866 { 857 VAR_EDITS * out = stack_allocate( s, total * sizeof( VAR_EDITS) );867 VAR_EDITS * out = stack_allocate( s, align_up( total * sizeof( VAR_EDITS ) ) ); 858 868 LISTITER * iter = stack_allocate( s, n * sizeof( LIST * ) ); 859 869 for ( i = 0; i < n; ++i ) 860 870 iter[ i ] = list_begin( args[ i ] ); … … LIST * function_run( FUNCTION * function 4263 4273 stack_push( s, l ); 4264 4274 l = apply_modifiers( s, n ); 4265 4275 list_free( stack_pop( s ) ); 4266 stack_deallocate( s, n * sizeof( VAR_EDITS) );4276 stack_deallocate( s, align_up( n * sizeof( VAR_EDITS ) ) ); 4267 4277 for ( i = 0; i < code->arg; ++i ) 4268 4278 list_free( stack_pop( s ) ); /* pop modifiers */ 4269 4279 stack_push( s, l ); … … LIST * function_run( FUNCTION * function 4289 4299 l = apply_subscript_and_modifiers( s, n ); 4290 4300 list_free( stack_pop( s ) ); 4291 4301 list_free( stack_pop( s ) ); 4292 stack_deallocate( s, n * sizeof( VAR_EDITS) );4302 stack_deallocate( s, align_up( n * sizeof( VAR_EDITS ) ) ); 4293 4303 for ( i = 0; i < code->arg; ++i ) 4294 4304 list_free( stack_pop( s ) ); /* pop modifiers */ 4295 4305 stack_push( s, l ); … … LIST * function_run( FUNCTION * function 4312 4322 list_free( stack_pop( s ) ); 4313 4323 } 4314 4324 list_free( vars ); 4315 stack_deallocate( s, n * sizeof( VAR_EDITS) );4325 stack_deallocate( s, align_up( n * sizeof( VAR_EDITS ) ) ); 4316 4326 for ( i = 0; i < code->arg; ++i ) 4317 4327 list_free( stack_pop( s ) ); /* pop modifiers */ 4318 4328 stack_push( s, result ); … … LIST * function_run( FUNCTION * function 4358 4368 } 4359 4369 list_free( stack_pop( s ) ); 4360 4370 list_free( vars ); 4361 stack_deallocate( s, n * sizeof( VAR_EDITS) );4371 stack_deallocate( s, align_up( n * sizeof( VAR_EDITS ) ) ); 4362 4372 for ( i = 0; i < code->arg; ++i ) 4363 4373 list_free( stack_pop( s ) ); /* pop modifiers */ 4364 4374 stack_push( s, result );