Skip to content

Commit

Permalink
chips/atmega: Increase parse stack size to 128 by shrinking heap
Browse files Browse the repository at this point in the history
The tiny 64 element parse stack could be overflowed by nesting parens
twice. The heap is shrunk to 768 bytes so that the stack will fit.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Feb 5, 2021
1 parent 598066b commit 2f91314
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion chips/atmega/snek-328p.builtin
Expand Up @@ -32,6 +32,8 @@ A3, -2, 17
A4, -2, 18
A5, -2, 19
#include <snek-atmega.h>
#define SNEK_POOL 1024
#if !defined(SNEK_POOL)
#define SNEK_POOL 768
#endif
#define SNEK_MAX_TOKEN 63
#define EEPROM_SIZE 1024
2 changes: 1 addition & 1 deletion chips/atmega/snek-atmega.h
Expand Up @@ -23,7 +23,7 @@
#define SNEK_DEBUG 0
#define strtof(a,b) strtod(a,b)
#define VALUE_STACK_SIZE 16
#define PARSE_STACK_SIZE 64
#define PARSE_STACK_SIZE 128
#define SNEK_STACK 32
#define PARSE_TABLE_DECLARATION(t) PROGMEM t
#define PARSE_TABLE_FETCH_TOKEN(a) ((token_key_t) pgm_read_byte(a))
Expand Down
2 changes: 1 addition & 1 deletion ports/mega/snek-mega.builtin
Expand Up @@ -83,6 +83,6 @@ A14, -2, 68
A15, -2, 69
#include <snek-atmega.h>
#include <snek-atmega-math.h>
#define SNEK_POOL 6144
#define SNEK_POOL 5120
#define SNEK_MAX_TOKEN 63
#define EEPROM_SIZE 4096

0 comments on commit 2f91314

Please sign in to comment.