Modify the snapshot API functions to expect a 32-bit aligned buffer pointer (#1655)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
@@ -3419,7 +3419,7 @@ jerry_parse_and_save_snapshot (const jerry_char_t *source_p,
|
||||
size_t source_size,
|
||||
bool is_for_global,
|
||||
bool is_strict,
|
||||
uint8_t *buffer_p,
|
||||
uint32_t *buffer_p,
|
||||
size_t buffer_size);
|
||||
```
|
||||
|
||||
@@ -3441,7 +3441,7 @@ jerry_parse_and_save_snapshot (const jerry_char_t *source_p,
|
||||
{
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
|
||||
static uint8_t global_mode_snapshot_buffer[1024];
|
||||
static uint32_t global_mode_snapshot_buffer[256];
|
||||
const jerry_char_t *code_to_snapshot_p = "(function () { return 'string from snapshot'; }) ();";
|
||||
|
||||
size_t global_mode_snapshot_size = jerry_parse_and_save_snapshot (code_to_snapshot_p,
|
||||
@@ -3449,7 +3449,7 @@ jerry_parse_and_save_snapshot (const jerry_char_t *source_p,
|
||||
true,
|
||||
false,
|
||||
global_mode_snapshot_buffer,
|
||||
sizeof (global_mode_snapshot_buffer));
|
||||
sizeof (global_mode_snapshot_buffer) / sizeof (uint32_t));
|
||||
|
||||
jerry_cleanup ();
|
||||
}
|
||||
@@ -3475,7 +3475,7 @@ is no longer needed.
|
||||
|
||||
```c
|
||||
jerry_value_t
|
||||
jerry_exec_snapshot (const void *snapshot_p,
|
||||
jerry_exec_snapshot (const uint32_t *snapshot_p,
|
||||
size_t snapshot_size,
|
||||
bool copy_bytecode);
|
||||
```
|
||||
@@ -3495,7 +3495,7 @@ jerry_exec_snapshot (const void *snapshot_p,
|
||||
```c
|
||||
{
|
||||
jerry_value_t res;
|
||||
static uint8_t global_mode_snapshot_buffer[1024];
|
||||
static uint32_t global_mode_snapshot_buffer[256];
|
||||
const jerry_char_t *code_to_snapshot_p = "(function () { return 'string from snapshot'; }) ();";
|
||||
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
@@ -3504,7 +3504,7 @@ jerry_exec_snapshot (const void *snapshot_p,
|
||||
true,
|
||||
false,
|
||||
global_mode_snapshot_buffer,
|
||||
sizeof (global_mode_snapshot_buffer));
|
||||
sizeof (global_mode_snapshot_buffer) / sizeof (uint32_t));
|
||||
jerry_cleanup ();
|
||||
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
@@ -3538,7 +3538,7 @@ size_t
|
||||
jerry_parse_and_save_literals (const jerry_char_t *source_p,
|
||||
size_t source_size,
|
||||
bool is_strict,
|
||||
uint8_t *buffer_p,
|
||||
uint32_t *buffer_p,
|
||||
size_t buffer_size,
|
||||
bool is_c_format);
|
||||
```
|
||||
@@ -3560,14 +3560,14 @@ jerry_parse_and_save_literals (const jerry_char_t *source_p,
|
||||
{
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
|
||||
static uint8_t save_literal_buffer[1024];
|
||||
static uint32_t save_literal_buffer[256];
|
||||
const jerry_char_t *code_for_literal_save_p = "var obj = { a:'aa', bb:'Bb' }";
|
||||
|
||||
size_t literal_sizes = jerry_parse_and_save_literals (code_for_literal_save_p,
|
||||
strlen ((const char *) code_for_literal_save_p),
|
||||
false,
|
||||
save_literal_buffer,
|
||||
sizeof (save_literal_buffer),
|
||||
sizeof (save_literal_buffer) / sizeof (uint32_t),
|
||||
true);
|
||||
|
||||
if (literal_sizes != 0)
|
||||
|
||||
Reference in New Issue
Block a user