Damien George | 04b9147 | 2014-05-03 23:27:38 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the Micro Python project, http://micropython.org/ |
| 3 | * |
| 4 | * The MIT License (MIT) |
| 5 | * |
| 6 | * Copyright (c) 2013, 2014 Damien P. George |
| 7 | * |
| 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 | * of this software and associated documentation files (the "Software"), to deal |
| 10 | * in the Software without restriction, including without limitation the rights |
| 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 | * copies of the Software, and to permit persons to whom the Software is |
| 13 | * furnished to do so, subject to the following conditions: |
| 14 | * |
| 15 | * The above copyright notice and this permission notice shall be included in |
| 16 | * all copies or substantial portions of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 24 | * THE SOFTWARE. |
| 25 | */ |
| 26 | |
Antonin ENFRUN | da1fffa | 2014-05-12 00:21:50 +0200 | [diff] [blame] | 27 | #if __clang__ |
| 28 | #pragma clang diagnostic push |
| 29 | #pragma clang diagnostic ignored "-Winitializer-overrides" |
| 30 | #endif // __clang__ |
Damien George | 51dfcb4 | 2015-01-01 20:27:54 +0000 | [diff] [blame] | 31 | |
AZ Huang | 9309d99 | 2014-04-15 15:57:01 +0800 | [diff] [blame] | 32 | static void* entry_table[256] = { |
| 33 | [0 ... 255] = &&entry_default, |
| 34 | [MP_BC_LOAD_CONST_FALSE] = &&entry_MP_BC_LOAD_CONST_FALSE, |
| 35 | [MP_BC_LOAD_CONST_NONE] = &&entry_MP_BC_LOAD_CONST_NONE, |
| 36 | [MP_BC_LOAD_CONST_TRUE] = &&entry_MP_BC_LOAD_CONST_TRUE, |
AZ Huang | 9309d99 | 2014-04-15 15:57:01 +0800 | [diff] [blame] | 37 | [MP_BC_LOAD_CONST_SMALL_INT] = &&entry_MP_BC_LOAD_CONST_SMALL_INT, |
AZ Huang | 9309d99 | 2014-04-15 15:57:01 +0800 | [diff] [blame] | 38 | [MP_BC_LOAD_CONST_STRING] = &&entry_MP_BC_LOAD_CONST_STRING, |
Damien George | dab1385 | 2015-01-13 15:55:54 +0000 | [diff] [blame] | 39 | [MP_BC_LOAD_CONST_OBJ] = &&entry_MP_BC_LOAD_CONST_OBJ, |
AZ Huang | 9309d99 | 2014-04-15 15:57:01 +0800 | [diff] [blame] | 40 | [MP_BC_LOAD_NULL] = &&entry_MP_BC_LOAD_NULL, |
AZ Huang | 9309d99 | 2014-04-15 15:57:01 +0800 | [diff] [blame] | 41 | [MP_BC_LOAD_FAST_N] = &&entry_MP_BC_LOAD_FAST_N, |
| 42 | [MP_BC_LOAD_DEREF] = &&entry_MP_BC_LOAD_DEREF, |
| 43 | [MP_BC_LOAD_NAME] = &&entry_MP_BC_LOAD_NAME, |
| 44 | [MP_BC_LOAD_GLOBAL] = &&entry_MP_BC_LOAD_GLOBAL, |
| 45 | [MP_BC_LOAD_ATTR] = &&entry_MP_BC_LOAD_ATTR, |
| 46 | [MP_BC_LOAD_METHOD] = &&entry_MP_BC_LOAD_METHOD, |
| 47 | [MP_BC_LOAD_BUILD_CLASS] = &&entry_MP_BC_LOAD_BUILD_CLASS, |
Damien George | 729f7b4 | 2014-04-17 22:10:53 +0100 | [diff] [blame] | 48 | [MP_BC_LOAD_SUBSCR] = &&entry_MP_BC_LOAD_SUBSCR, |
AZ Huang | 9309d99 | 2014-04-15 15:57:01 +0800 | [diff] [blame] | 49 | [MP_BC_STORE_FAST_N] = &&entry_MP_BC_STORE_FAST_N, |
| 50 | [MP_BC_STORE_DEREF] = &&entry_MP_BC_STORE_DEREF, |
| 51 | [MP_BC_STORE_NAME] = &&entry_MP_BC_STORE_NAME, |
| 52 | [MP_BC_STORE_GLOBAL] = &&entry_MP_BC_STORE_GLOBAL, |
| 53 | [MP_BC_STORE_ATTR] = &&entry_MP_BC_STORE_ATTR, |
| 54 | [MP_BC_STORE_SUBSCR] = &&entry_MP_BC_STORE_SUBSCR, |
| 55 | [MP_BC_DELETE_FAST] = &&entry_MP_BC_DELETE_FAST, |
| 56 | [MP_BC_DELETE_DEREF] = &&entry_MP_BC_DELETE_DEREF, |
| 57 | [MP_BC_DELETE_NAME] = &&entry_MP_BC_DELETE_NAME, |
| 58 | [MP_BC_DELETE_GLOBAL] = &&entry_MP_BC_DELETE_GLOBAL, |
| 59 | [MP_BC_DUP_TOP] = &&entry_MP_BC_DUP_TOP, |
| 60 | [MP_BC_DUP_TOP_TWO] = &&entry_MP_BC_DUP_TOP_TWO, |
| 61 | [MP_BC_POP_TOP] = &&entry_MP_BC_POP_TOP, |
| 62 | [MP_BC_ROT_TWO] = &&entry_MP_BC_ROT_TWO, |
| 63 | [MP_BC_ROT_THREE] = &&entry_MP_BC_ROT_THREE, |
| 64 | [MP_BC_JUMP] = &&entry_MP_BC_JUMP, |
| 65 | [MP_BC_POP_JUMP_IF_TRUE] = &&entry_MP_BC_POP_JUMP_IF_TRUE, |
| 66 | [MP_BC_POP_JUMP_IF_FALSE] = &&entry_MP_BC_POP_JUMP_IF_FALSE, |
| 67 | [MP_BC_JUMP_IF_TRUE_OR_POP] = &&entry_MP_BC_JUMP_IF_TRUE_OR_POP, |
| 68 | [MP_BC_JUMP_IF_FALSE_OR_POP] = &&entry_MP_BC_JUMP_IF_FALSE_OR_POP, |
AZ Huang | 9309d99 | 2014-04-15 15:57:01 +0800 | [diff] [blame] | 69 | [MP_BC_SETUP_WITH] = &&entry_MP_BC_SETUP_WITH, |
| 70 | [MP_BC_WITH_CLEANUP] = &&entry_MP_BC_WITH_CLEANUP, |
| 71 | [MP_BC_UNWIND_JUMP] = &&entry_MP_BC_UNWIND_JUMP, |
| 72 | [MP_BC_SETUP_EXCEPT] = &&entry_MP_BC_SETUP_EXCEPT, |
| 73 | [MP_BC_SETUP_FINALLY] = &&entry_MP_BC_SETUP_FINALLY, |
| 74 | [MP_BC_END_FINALLY] = &&entry_MP_BC_END_FINALLY, |
| 75 | [MP_BC_GET_ITER] = &&entry_MP_BC_GET_ITER, |
| 76 | [MP_BC_FOR_ITER] = &&entry_MP_BC_FOR_ITER, |
| 77 | [MP_BC_POP_BLOCK] = &&entry_MP_BC_POP_BLOCK, |
| 78 | [MP_BC_POP_EXCEPT] = &&entry_MP_BC_POP_EXCEPT, |
AZ Huang | 9309d99 | 2014-04-15 15:57:01 +0800 | [diff] [blame] | 79 | [MP_BC_BUILD_TUPLE] = &&entry_MP_BC_BUILD_TUPLE, |
| 80 | [MP_BC_BUILD_LIST] = &&entry_MP_BC_BUILD_LIST, |
| 81 | [MP_BC_LIST_APPEND] = &&entry_MP_BC_LIST_APPEND, |
| 82 | [MP_BC_BUILD_MAP] = &&entry_MP_BC_BUILD_MAP, |
| 83 | [MP_BC_STORE_MAP] = &&entry_MP_BC_STORE_MAP, |
| 84 | [MP_BC_MAP_ADD] = &&entry_MP_BC_MAP_ADD, |
Damien George | e37dcaa | 2014-12-27 17:07:16 +0000 | [diff] [blame] | 85 | #if MICROPY_PY_BUILTINS_SET |
AZ Huang | 9309d99 | 2014-04-15 15:57:01 +0800 | [diff] [blame] | 86 | [MP_BC_BUILD_SET] = &&entry_MP_BC_BUILD_SET, |
| 87 | [MP_BC_SET_ADD] = &&entry_MP_BC_SET_ADD, |
Damien George | e37dcaa | 2014-12-27 17:07:16 +0000 | [diff] [blame] | 88 | #endif |
Damien George | 83204f3 | 2014-12-27 17:20:41 +0000 | [diff] [blame] | 89 | #if MICROPY_PY_BUILTINS_SLICE |
AZ Huang | 9309d99 | 2014-04-15 15:57:01 +0800 | [diff] [blame] | 90 | [MP_BC_BUILD_SLICE] = &&entry_MP_BC_BUILD_SLICE, |
Damien George | 83204f3 | 2014-12-27 17:20:41 +0000 | [diff] [blame] | 91 | #endif |
AZ Huang | 9309d99 | 2014-04-15 15:57:01 +0800 | [diff] [blame] | 92 | [MP_BC_UNPACK_SEQUENCE] = &&entry_MP_BC_UNPACK_SEQUENCE, |
| 93 | [MP_BC_UNPACK_EX] = &&entry_MP_BC_UNPACK_EX, |
| 94 | [MP_BC_MAKE_FUNCTION] = &&entry_MP_BC_MAKE_FUNCTION, |
| 95 | [MP_BC_MAKE_FUNCTION_DEFARGS] = &&entry_MP_BC_MAKE_FUNCTION_DEFARGS, |
| 96 | [MP_BC_MAKE_CLOSURE] = &&entry_MP_BC_MAKE_CLOSURE, |
| 97 | [MP_BC_MAKE_CLOSURE_DEFARGS] = &&entry_MP_BC_MAKE_CLOSURE_DEFARGS, |
| 98 | [MP_BC_CALL_FUNCTION] = &&entry_MP_BC_CALL_FUNCTION, |
| 99 | [MP_BC_CALL_FUNCTION_VAR_KW] = &&entry_MP_BC_CALL_FUNCTION_VAR_KW, |
| 100 | [MP_BC_CALL_METHOD] = &&entry_MP_BC_CALL_METHOD, |
| 101 | [MP_BC_CALL_METHOD_VAR_KW] = &&entry_MP_BC_CALL_METHOD_VAR_KW, |
| 102 | [MP_BC_RETURN_VALUE] = &&entry_MP_BC_RETURN_VALUE, |
| 103 | [MP_BC_RAISE_VARARGS] = &&entry_MP_BC_RAISE_VARARGS, |
| 104 | [MP_BC_YIELD_VALUE] = &&entry_MP_BC_YIELD_VALUE, |
| 105 | [MP_BC_YIELD_FROM] = &&entry_MP_BC_YIELD_FROM, |
| 106 | [MP_BC_IMPORT_NAME] = &&entry_MP_BC_IMPORT_NAME, |
| 107 | [MP_BC_IMPORT_FROM] = &&entry_MP_BC_IMPORT_FROM, |
| 108 | [MP_BC_IMPORT_STAR] = &&entry_MP_BC_IMPORT_STAR, |
Damien George | 8456cc0 | 2014-10-25 16:43:46 +0100 | [diff] [blame] | 109 | [MP_BC_LOAD_CONST_SMALL_INT_MULTI ... MP_BC_LOAD_CONST_SMALL_INT_MULTI + 63] = &&entry_MP_BC_LOAD_CONST_SMALL_INT_MULTI, |
| 110 | [MP_BC_LOAD_FAST_MULTI ... MP_BC_LOAD_FAST_MULTI + 15] = &&entry_MP_BC_LOAD_FAST_MULTI, |
| 111 | [MP_BC_STORE_FAST_MULTI ... MP_BC_STORE_FAST_MULTI + 15] = &&entry_MP_BC_STORE_FAST_MULTI, |
Damien George | bdbe8c9 | 2015-12-08 12:28:11 +0000 | [diff] [blame] | 112 | [MP_BC_UNARY_OP_MULTI ... MP_BC_UNARY_OP_MULTI + 6] = &&entry_MP_BC_UNARY_OP_MULTI, |
Damien George | c5029bc | 2015-06-13 22:00:10 +0100 | [diff] [blame] | 113 | [MP_BC_BINARY_OP_MULTI ... MP_BC_BINARY_OP_MULTI + 35] = &&entry_MP_BC_BINARY_OP_MULTI, |
AZ Huang | 9309d99 | 2014-04-15 15:57:01 +0800 | [diff] [blame] | 114 | }; |
Antonin ENFRUN | da1fffa | 2014-05-12 00:21:50 +0200 | [diff] [blame] | 115 | |
| 116 | #if __clang__ |
| 117 | #pragma clang diagnostic pop |
| 118 | #endif // __clang__ |