1
0
mirror of https://github.com/elua/elua.git synced 2025-01-25 01:02:54 +08:00

Make table of available RAM regions static

Instead of constructing them on the stack at runtime in every call to
platform_get_{first,last}_free_ram().
When there was is only one RAM region this makes no difference, as the
whole thing is optimised out. However, when there are more than one
region, this improves both size and speed, especially in the simple
allocator, which calls these functions twice each at every call to
malloc().
This commit is contained in:
Martin Guy 2013-05-07 17:57:07 +02:00
parent ed9b7df41a
commit 63fbfb68c5

View File

@ -350,7 +350,7 @@ extern char end[];
void* platform_get_first_free_ram( unsigned id )
{
void* mstart[] = MEM_START_ADDRESS;
static void* mstart[] = MEM_START_ADDRESS;
u32 p;
if( id >= sizeof( mstart ) / sizeof( void* ) )
@ -363,7 +363,7 @@ void* platform_get_first_free_ram( unsigned id )
void* platform_get_last_free_ram( unsigned id )
{
void* mend[] = MEM_END_ADDRESS;
static void* mend[] = MEM_END_ADDRESS;
u32 p;
if( id >= sizeof( mend ) / sizeof( void* ) )