Initial RAM optimization for ESP8266

by putting big constants into ROM, instead of residing in RAM.
Related to https://github.com/Samsung/jerryscript/issues/1224.

JerryScript-DCO-1.0-Signed-off-by: Slavey Karadzhov slaff@attachix.com
This commit is contained in:
Slavey Karadzhov
2016-08-01 18:06:52 +02:00
parent d1b0b58729
commit ce8abfb636
7 changed files with 74 additions and 8 deletions
+11
View File
@@ -40,6 +40,17 @@
# define __attr_pure___ __attribute__((pure))
#endif /* !__attr_pure___ */
/**
* Normally compilers store const(ant)s in ROM. Thus saving RAM.
* But if your compiler does not support it then the directive below can force it.
*
* For the moment it is mainly meant for the following targets:
* - ESP8266
*/
#ifndef JERRY_CONST_DATA
# define JERRY_CONST_DATA
#endif /* JERRY_CONST_DATA */
#ifndef __GNUC__
#define __extension__
#endif /* !__GNUC__ */
+2 -2
View File
@@ -37,7 +37,7 @@ lit_get_magic_string_ex_count (void)
const lit_utf8_byte_t *
lit_get_magic_string_utf8 (lit_magic_string_id_t id) /**< magic string id */
{
static const lit_utf8_byte_t * const magic_strings[] =
static const lit_utf8_byte_t * const magic_strings[] JERRY_CONST_DATA =
{
#define LIT_MAGIC_STRING_DEF(id, utf8_string) \
(const lit_utf8_byte_t *) utf8_string,
@@ -58,7 +58,7 @@ lit_get_magic_string_utf8 (lit_magic_string_id_t id) /**< magic string id */
lit_utf8_size_t
lit_get_magic_string_size (lit_magic_string_id_t id) /**< magic string id */
{
static const lit_magic_size_t lit_magic_string_sizes[] =
static const lit_magic_size_t lit_magic_string_sizes[] JERRY_CONST_DATA =
{
#define LIT_MAGIC_STRING_DEF(id, utf8_string) \
sizeof(utf8_string) - 1,
+4 -4
View File
@@ -30,7 +30,7 @@
* The characters covered by these intervalse are from
* the following Unicode categories: Lu, Ll, Lt, Lm, Lo, Nl
*/
static const uint16_t unicode_letter_interv_sps[] =
static const uint16_t unicode_letter_interv_sps[] JERRY_CONST_DATA =
{
/*
* these are handled separetely
@@ -67,7 +67,7 @@ static const uint16_t unicode_letter_interv_sps[] =
* The characters covered by these intervalse are from
* the following Unicode categories: Lu, Ll, Lt, Lm, Lo, Nl
*/
static const uint8_t unicode_letter_interv_lens[] =
static const uint8_t unicode_letter_interv_lens[] JERRY_CONST_DATA =
{
22, 30, 255, 39, 17, 93, 8, 6,
1, 4, 2, 19, 43, 7, 25, 129, 56, 1,
@@ -100,7 +100,7 @@ static const uint8_t unicode_letter_interv_lens[] =
* The characters are from the following Unicode categories:
* Lu, Ll, Lt, Lm, Lo, Nl
*/
static const uint16_t unicode_letter_chars[] =
static const uint16_t unicode_letter_chars[] JERRY_CONST_DATA =
{
0x00AA, 0x00B5, 0x00BA, 0x02EE, 0x037A, 0x0386, 0x038C, 0x0559, 0x06D5, 0x0710,
0x093D, 0x0950, 0x09B2, 0x0A5E, 0x0A8D, 0x0ABD, 0x0AD0, 0x0AE0, 0x0B3D, 0x0B9C,
@@ -117,7 +117,7 @@ static const uint16_t unicode_letter_chars[] =
* The characters covered by these intervalse are from
* the following Unicode categories: Nd, Mn, Mc, Pc
*/
static const uint16_t unicode_non_letter_ident_part_interv_sps[] =
static const uint16_t unicode_non_letter_ident_part_interv_sps[] JERRY_CONST_DATA =
{
/*
* decimal digits: handled separately
+1 -1
View File
@@ -32,7 +32,7 @@
/**
* Flags of the opcodes.
*/
const uint8_t cbc_flags[] =
const uint8_t cbc_flags[] JERRY_CONST_DATA =
{
CBC_OPCODE_LIST
};
+1 -1
View File
@@ -184,7 +184,7 @@ vm_op_set_value (ecma_value_t object, /**< base object */
/**
* Decode table for both opcodes and extended opcodes.
*/
static const uint16_t vm_decode_table[] =
static const uint16_t vm_decode_table[] JERRY_CONST_DATA =
{
CBC_OPCODE_LIST
CBC_EXT_OPCODE_LIST