summaryrefslogtreecommitdiff
path: root/src/opcode-code-table.c
Commit message (Collapse)AuthorAgeFilesLines
* [WIP] Added initial skeleton code for wasm-decompile. (#1155)Wouter van Oortmerssen2019-09-121-2/+2
| | | | | | * [WIP] Added initial skeleton code for wasm-decompile. * Code review changes.
* Optimize interpreter and `Opcode::FromCode`Ben Smith2018-09-101-0/+41
`Opcode::FromCode` calculated the opcode given a prefix/code pair by using lower_bound over the list of all `OpcodeInfo`s. This was happening for every instruction, which is incredibly slow. Since the interpreter's format is internal only, we can use any encoding we want, so it's simpler and faster to use the `Opcode::Enum` directly without calling `Opcode::FromCode`. `Opcode::FromCode` is also used when reading a binary file, so it should be optimized anyway. Instead of using the `infos_` table, which is indexed by the opcode's `enum_` value, we create a new statically-defined table that maps from prefix-code pair to its enum value. Unfortunately, this can't be done easily in C++ because it does not currently support designated array initializers, so this table is created in a C file instead, `opcode-code-table.c`.