Add try-catch-finally support: parse and generate opcodes for this construct

Fix varg generation: generate *_n opcodes with parameters in following meta opcodes
Add stack internal structure: dimanically allocated stack.
Use dynamically allocated memory in parser: every local and global variables are stored in dinamically allocated stacks.
Use dynamically allocated memory in serializer: opcodes are also stored in stack.
Change is_true_jmp and is_false_jmp opcodes to relative.
Change *jmp* opcodes to be able to store opcode_counter_t instead of idx_t.
This commit is contained in:
Ilmir Usmanov
2014-09-16 21:22:11 +04:00
parent cd41b236d9
commit e77bd4f4e5
26 changed files with 1644 additions and 1710 deletions
+17 -5
View File
@@ -13,12 +13,19 @@
* limitations under the License.
*/
#ifndef BYTECODE_LINUX_H
#define BYTECODE_LINUX_H
#ifndef BYTECODE_DATA_H
#define BYTECODE_DATA_H
#include "opcodes.h"
#include "stack.h"
#include "jerry-libc.h"
#define MAX_OPCODES 255
#define MAX_OPCODES (256*256 - 1)
#ifndef OPCODE_T_STACK_DEFINED
DEFINE_STACK_TYPE (opcode_counter_t, opcode_t)
#define OPCODE_T_STACK_DEFINED
#endif
/* bytecode_data contains identifiers, string and num literals.
Memory map if the following.
@@ -32,6 +39,11 @@
U32 nums[nums_count];
} */
extern uint8_t *bytecode_data;
opcode_t bytecode_opcodes[MAX_OPCODES];
#endif // BYTECODE_LINUX_H
enum
{
bytecode_opcodes_global_size
};
STACK (opcode_t, bytecode_opcodes)
#endif // BYTECODE_DATA_H