Decrease stack usage in lexer.
We have only 92K of stack and using over 4K per frame is wasteful * grub-core/script/yylex.l (yyalloc), (yyfree), (yyrealloc): Declare as macros so that compiler would remove useless structure on stack. Better solution would be to fix flex not to put this structure on the stack but flex is external program.
This commit is contained in:
parent
4f84ae0ec8
commit
080603f0b0
2 changed files with 14 additions and 25 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2013-11-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Decrease stack usage in lexer.
|
||||||
|
|
||||||
|
We have only 92K of stack and using over 4K per frame is wasteful
|
||||||
|
|
||||||
|
* grub-core/script/yylex.l (yyalloc), (yyfree), (yyrealloc): Declare
|
||||||
|
as macros so that compiler would remove useless structure on stack.
|
||||||
|
Better solution would be to fix flex not to put this structure on
|
||||||
|
the stack but flex is external program.
|
||||||
|
|
||||||
2013-11-16 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-11-16 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Decrease stack usage in signature verification.
|
Decrease stack usage in signature verification.
|
||||||
|
|
|
@ -31,9 +31,9 @@
|
||||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||||
|
|
||||||
#define yyfree grub_lexer_yyfree
|
#define yyalloc(size, scanner) (grub_malloc((size)))
|
||||||
#define yyalloc grub_lexer_yyalloc
|
#define yyfree(ptr, scanner) (grub_free((ptr)))
|
||||||
#define yyrealloc grub_lexer_yyrealloc
|
#define yyrealloc(ptr, size, scanner) (grub_realloc((ptr), (size)))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As we don't have access to yyscanner, we cannot do much except to
|
* As we don't have access to yyscanner, we cannot do much except to
|
||||||
|
@ -68,9 +68,6 @@
|
||||||
static int grub_lexer_unput (const char *input, yyscan_t yyscanner);
|
static int grub_lexer_unput (const char *input, yyscan_t yyscanner);
|
||||||
static int grub_lexer_resplit (const char *input, yyscan_t yyscanner);
|
static int grub_lexer_resplit (const char *input, yyscan_t yyscanner);
|
||||||
|
|
||||||
static void grub_lexer_yyfree (void *, yyscan_t yyscanner);
|
|
||||||
static void* grub_lexer_yyalloc (yy_size_t, yyscan_t yyscanner);
|
|
||||||
static void* grub_lexer_yyrealloc (void*, yy_size_t, yyscan_t yyscanner);
|
|
||||||
static void copy_string (struct grub_parser_param *, const char *,
|
static void copy_string (struct grub_parser_param *, const char *,
|
||||||
unsigned hint);
|
unsigned hint);
|
||||||
|
|
||||||
|
@ -339,25 +336,6 @@ yywrap (yyscan_t yyscanner)
|
||||||
return grub_script_lexer_yywrap (yyget_extra (yyscanner), 0);
|
return grub_script_lexer_yywrap (yyget_extra (yyscanner), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
grub_lexer_yyfree (void *ptr, yyscan_t yyscanner __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_free(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void*
|
|
||||||
grub_lexer_yyalloc (yy_size_t size, yyscan_t yyscanner __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
return grub_malloc (size);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void*
|
|
||||||
grub_lexer_yyrealloc (void *ptr, yy_size_t size,
|
|
||||||
yyscan_t yyscanner __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
return grub_realloc (ptr, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void copy_string (struct grub_parser_param *parser, const char *str, unsigned hint)
|
static void copy_string (struct grub_parser_param *parser, const char *str, unsigned hint)
|
||||||
{
|
{
|
||||||
grub_size_t size;
|
grub_size_t size;
|
||||||
|
|
Loading…
Reference in a new issue