Commit Graph

124 Commits

Author SHA1 Message Date
Nikolay Nikolov
b9ca30165c * WebAssembly: refactored tai_local, so that it is a single directive,
containing multiple locals, instead of creating multiple tai_local directives,
  each containing a single local. No functional changes.
2024-09-15 00:49:05 +03:00
Nikolay Nikolov
05b67c7408 - WebAssembly: removed tai_local.name, because we don't use it 2024-09-15 00:09:39 +03:00
Nikolay Nikolov
99943610cb * WebAssembly: generate the final bashB opcode of a function via the
end_function instruction, instead of adding it magically in the object writer.
  This makes the WebAssembly debug line info more accurate, covering the
  end_function instruction as well.
2024-09-11 07:46:23 +03:00
Nikolay Nikolov
c8e4a52428 + WebAssembly internal object writer: added safety check for catching bugs,
caused by instruction size changes between Pass1 and Pass2
2024-09-11 04:44:50 +03:00
Nikolay Nikolov
d41d98b70b * WebAssembly internal object writer: fixed helper function SlebSize() 2024-09-11 04:44:05 +03:00
Nikolay Nikolov
5e327453a8 + WebAssembly external asm writer: workaround for the 'missing functype' error,
produced by LLVM-MC versions 13 and above
2024-09-01 19:52:50 +03:00
Nikolay Nikolov
35701f8fa2 * fail with an internal compiler error in case an atomic WebAssembly instruction
is generated, while WebAssembly multithreading is disabled
2024-07-07 16:43:41 +03:00
Nikolay Nikolov
6a28ac53da + support the native exception instructions in TWasmValidationStacks.Validate 2024-02-27 12:54:56 +02:00
Nikolay Nikolov
f2d739b93a + perform WebAssembly validation, if the compiler is compiled with the
DEBUG_WASM_VALIDATION defined
2024-02-26 12:13:59 +02:00
Nikolay Nikolov
0ae014a98f + support the BR and BR_IF instructions in TWasmValidationStacks.Validate 2024-02-25 13:52:34 +02:00
Nikolay Nikolov
13f58fe343 + support if,block,loop,else,end_if,end_block,end_loop in TWasmValidationStacks.Validate 2024-02-25 13:08:41 +02:00
Nikolay Nikolov
472f9be9a6 + support the global.get and global.set instructions in TWasmValidationStacks.Validate 2024-02-25 11:38:36 +02:00
Nikolay Nikolov
ab65c9889b + added the WasmBasicType to TWasmGlobalAsmSymbol. This will help WebAssembly
validation and stack tracking.
2024-02-25 08:54:39 +02:00
Nikolay Nikolov
f4b9d51aff + introduced TWasmGlobalAsmSymbol subclass of TAsmSymbol. Use it for all
AT_WASM_GLOBAL symbols. This allows in the future to add extra data to the
  TWasmGlobalAsmSymbol, such as the WebAssembly global type, which will aid in
  WebAssembly validation and stack tracking.
2024-02-25 07:29:56 +02:00
Nikolay Nikolov
81d98f5ae2 + support the CALL instruction in TWasmValidationStacks.Validate 2024-02-25 04:51:14 +02:00
Nikolay Nikolov
21cc89f1e3 + added a second TWasmFuncType parameter to the CALL WebAssembly instruction. It
is not part of the WebAssembly syntax and binary encoding, but it helps
  WebAssembly stack tracking and validation.
2024-02-25 04:48:17 +02:00
Nikolay Nikolov
2dcb15f88f + support a_call_indirect in TWasmValidationStacks.Validate 2024-02-24 10:49:15 +02:00
Nikolay Nikolov
26855a29c8 * fix warning 2024-02-08 16:54:33 +02:00
Nikolay Nikolov
e073d5f7f7 + implemented support for the local.get, local.set and local.tee instructions in TWasmValidationStacks.Validate 2024-02-08 16:49:45 +02:00
Nikolay Nikolov
28c4c58b34 * fix warning 2024-02-05 23:35:45 +02:00
Nikolay Nikolov
d7581aa1ee + implemented TWasmValidationStacks.Validate for many (but not all, yet) instructions 2024-02-05 23:29:44 +02:00
Nikolay Nikolov
e53620ebdb * fix warnings 2024-02-01 01:20:15 +02:00
Nikolay Nikolov
5e0dcfb49b + introduced TWasmValidationStacks.Unreachable 2024-01-31 02:57:19 +02:00
Nikolay Nikolov
24315a7f28 + introduced TWasmValidationStacks.label_types 2024-01-31 02:45:43 +02:00
Nikolay Nikolov
f3e667da42 + introduced TWasmValidationStacks.PopCtrl 2024-01-31 02:38:09 +02:00
Nikolay Nikolov
4cb97dcdb3 * fixed warning 2024-01-31 02:33:31 +02:00
Nikolay Nikolov
4cc5cf4d0e + introduced TWasmValidationStacks.PushCtrl 2024-01-31 02:25:44 +02:00
Nikolay Nikolov
18c6e13f45 * fixed warning 2024-01-31 02:19:03 +02:00
Nikolay Nikolov
064adbf3f8 + introduced TWasmValidationStacks.PopVals 2024-01-31 02:15:09 +02:00
Nikolay Nikolov
4d5479741d + introduced TWasmValidationStacks.PushVals 2024-01-31 02:11:59 +02:00
Nikolay Nikolov
2d5c1d43cf + introduced TWasmValidationStacks.PopVal(expect) 2024-01-31 02:10:05 +02:00
Nikolay Nikolov
d575aa5240 + introduced TWasmBasicTypeList 2024-01-31 01:55:38 +02:00
Nikolay Nikolov
1786875319 + implemented TWasmValueStack.GetCount
+ implemented TWasmControlStack.GetCount
+ implemented TWasmValidationStacks.PopVal
2024-01-31 01:52:05 +02:00
Nikolay Nikolov
3f0853692c + implemented methods in TWasmControlStack: Push, Pop, GetItems, SetItems 2024-01-31 01:20:24 +02:00
Nikolay Nikolov
506634f261 * TWasmControlFrame changed to a record 2024-01-31 01:05:02 +02:00
Nikolay Nikolov
6aa49038a5 * inverted the indices of TWasmValueStack, so that item 0 is top of stack 2024-01-22 11:02:32 +02:00
Nikolay Nikolov
fadf43a33b + added TWasmControlStack and frame. Not used, yet. Will be used in the future
for WebAssembly stack tracking and validation.
2024-01-22 10:15:43 +02:00
Nikolay Nikolov
42f447257d + introduced TWasmValueStack for tracking the state of the WebAssembly stack. Not used, yet, but will be in the future. 2024-01-17 11:21:48 +02:00
Nikolay Nikolov
0be3fe9ab4 - removed TWasmObjData.AddFuncType, instead call directly [F]FuncTypes.AddOrGetFuncType 2023-12-31 15:52:27 +02:00
Nikolay Nikolov
3defa34470 + check whether all br instructions, generated by goto point to a pascal goto label 2023-10-22 05:23:04 +03:00
Nikolay Nikolov
31dff18a61 * refactored the taicpu_wasm_structured_instruction descendants to use a wstyp enum variable, instead of using the 'is' operator to determine the class type 2023-10-22 04:33:29 +03:00
Nikolay Nikolov
84e2613ca8 * refactor: wasm_convert_to_flat_asmlist and wasm_convert_to_structured_asmlist now accept a single var parameter 2023-10-22 03:11:28 +03:00
Nikolay Nikolov
84186db35f * support local.get/set/tee with a const parameter in the wasm internal assembler writer 2023-10-22 00:52:37 +03:00
Nikolay Nikolov
ce742b5b4d * convert loop..end_loop blocks to flat list + branch instruction 2023-10-18 03:45:02 +03:00
Nikolay Nikolov
9584348c40 + added amfrtDeleteAi, support deleting instructions in map_structured_asmlist_inner 2023-10-18 03:31:11 +03:00
Nikolay Nikolov
0f07c966b6 * convert if structured instructions to br_if + labels 2023-10-18 02:31:58 +03:00
Nikolay Nikolov
59128241ad + support mapping of structured instructions also in map_structured_asmlist_inner 2023-10-18 01:59:55 +03:00
Nikolay Nikolov
d911e462b2 + added support for params and results in tai_wasmstruc_if.ConvertToBrIf 2023-10-17 03:00:23 +03:00
Nikolay Nikolov
c2173185e7 + added method tai_wasmstruc_if.ConvertToBrIf 2023-10-17 02:11:46 +03:00
Nikolay Nikolov
bc7b113e09 + convert wasm structured list to flat list 2023-10-17 00:14:12 +03:00