Commit Graph

63591 Commits

Author SHA1 Message Date
Nikolay Nikolov
5b3efc4b38 + implemented encoding of the most simple wasm instructions 2021-09-20 01:24:39 +03:00
Nikolay Nikolov
455f603c8c + debug print the obj symbols to the console 2021-09-20 00:14:45 +03:00
florian
8cb92fd49a * simplify real expressions involving unary minus
+ test
2021-09-19 23:08:32 +02:00
Nikolay Nikolov
12796d176d + added the indirect function table to the imports section 2021-09-20 00:05:28 +03:00
Nikolay Nikolov
905f0b1f78 + add the __stack_pointer global import 2021-09-19 23:56:32 +03:00
Nikolay Nikolov
e8c3f5d6b0 + create the data section and the first entry of the import section 2021-09-19 23:43:45 +03:00
Nikolay Nikolov
2563cb6daa + start writing the wasm sections. The DataCount section is the first section to be implemented. 2021-09-19 22:46:54 +03:00
Nikolay Nikolov
e45d8578e8 + count the number of segments and assign segment indices to the wasm sections 2021-09-19 21:04:55 +03:00
Nikolay Nikolov
eea8f32772 + introduced TWasmObjSection.IsCode and .IsData 2021-09-19 20:56:06 +03:00
Nikolay Nikolov
698b5de389 + added TWasmObjSection class 2021-09-19 20:51:33 +03:00
Nikolay Nikolov
429454c8f4 + write some debug info to the console in the wasm obj writer 2021-09-19 20:47:20 +03:00
Nikolay Nikolov
967b721e4f + enabled the WASM32_INTERNALASM define when compiling with the lazarus project file 2021-09-19 20:09:25 +03:00
Nikolay Nikolov
c200bf5311 * fixed TWasmObjData.sectionname_gas 2021-09-19 19:41:27 +03:00
Nikolay Nikolov
fd4d6b8fc3 + write the wasm binary module header and version 2021-09-19 19:33:33 +03:00
Nikolay Nikolov
ffc5131087 + implemented TWasmObjData.sectionname 2021-09-19 19:24:16 +03:00
Nikolay Nikolov
59ea39ce75 + started the wasmbase unit (similar to elfbase and omfbase) 2021-09-19 18:49:50 +03:00
florian
fc41306c45 * fix alignment issues with -<single/double> when using SSE 2021-09-19 17:44:16 +02:00
mattias
a13694988d pastojs: fixed assign external const to int 2021-09-19 17:27:34 +02:00
mattias
a46261bc15 pastojs: fixed tests 2021-09-19 17:03:20 +02:00
mattias
6c1c4a66e8 pastojs: fixed invalidate directory cache 2021-09-19 16:56:36 +02:00
mattias
0b5c8030e4 pas2js: comment 2021-09-19 16:55:12 +02:00
Nikolay Nikolov
cc314e61a2 + started working on the WebAssembly internal assembler 2021-09-19 16:17:09 +03:00
mattias
f10fae66df pastojs: error on linklib options 2021-09-19 14:11:51 +02:00
mattias
d14c13fc72 pastojs: fixed compile tests 2021-09-19 14:04:29 +02:00
mattias
8a0fe7bc85 fcl-js: less hints 2021-09-19 14:04:07 +02:00
florian
5bcc530707 * handle -<mm reg.> more cleverly if SSE is used 2021-09-18 22:11:03 +02:00
florian
5a2d884fe3 * is_calljmp really means calls and jmp
* is_calljmpuncondret includes ret
2021-09-18 19:24:53 +02:00
florian
f78818e387 * some warnings fixed 2021-09-18 19:24:53 +02:00
Nikolay Nikolov
d3ec8f0d29 * generate an internalerror if there are values remaining on top of stack
at the end of a procedure. If the compiler is compiled with
  DEBUG_WASMSTACK, the previous asm comment message is emitted instead of
  internal error.
2021-09-18 18:10:57 +03:00
Nikolay Nikolov
324382d3a5 * use create_functype to determine accurately the number of parameters to
discard in twasmcallnode.do_release_unused_return_value. This fixes
  various stack tracking bugs when a constructor is invoking another
  constructor, etc.
2021-09-18 17:59:50 +03:00
Nikolay Nikolov
f7cc2d560c + initialize br_blocks in the thlcgwasm constructor 2021-09-18 16:29:19 +03:00
Nikolay Nikolov
a3610bfea1 + also added stack underflow check in thlcgwasm.incstack (in case stack
height was already negative in the beginning, due to previous underflow)
2021-09-18 16:28:14 +03:00
Nikolay Nikolov
d4bd1f1e9b * don't halt with an internal error, but add an asm comment instead, when a
stack underflow is detected in thlcgwasm.decstack and when the compiler is
  compiled with the DEBUG_WASMSTACK define
2021-09-18 16:28:14 +03:00
Nikolay Nikolov
58e4692795 * fixed thlcgwasm.g_adjust_stack_after_call after the removal of discardresult 2021-09-18 16:28:14 +03:00
Nikolay Nikolov
fa36141649 * fixed the stack tracking in twasmcallnode.do_release_unused_return_value for
ret_in_param function calls
2021-09-18 16:28:14 +03:00
florian
d292958665 * + .gitconfig with configuration for better diffing, needs a
git config --local include.path ../.gitconfig
    to be activated
2021-09-18 14:26:18 +02:00
J. Gareth "Kit" Moreton
962c5bd727 x86: MOV constant optimisation 2021-09-18 08:30:50 +00:00
Nikolay Nikolov
33e25a3dfe + added except_native.inc include file (empty for now, but will provide RTL
support for the native wasm exceptions in the future)
2021-09-18 03:08:48 +03:00
Nikolay Nikolov
f76e91fb8b * cloned twasmtryexceptnode.pass_generate_code_no_exceptions into twasmtryexceptnode.pass_generate_code_native_exceptions 2021-09-18 02:52:24 +03:00
Nikolay Nikolov
334ea46b44 * cloned twasmraisenode.pass_1_no_exceptions into twasmraisenode.pass_1_native_exceptions 2021-09-18 02:48:51 +03:00
Nikolay Nikolov
c2754eac3f + introduced the wasm32_throw_fpcexception inline function, that emits a
'throw' instruction. This way we'll be able to emit this instruction from
  RTL code (i.e. from fpc_raiseexception, when that is implemented for
  WebAssembly)
2021-09-18 02:39:16 +03:00
Nikolay Nikolov
ac2f299d04 + declare __FPC_exception as a label, otherwise wasm-ld crashes 2021-09-18 01:47:28 +03:00
florian
8ad5362b17 * more warnings fixed 2021-09-17 23:44:55 +02:00
Nikolay Nikolov
87702b58c5 + emit a catch instruction in the try/end_try block, generated for
try..finally in native wasm exceptions mode
2021-09-18 00:26:00 +03:00
Yuriy Sydorov
a83f5749de * Reverted the accidentally committed debug code in 4a7a113a. 2021-09-17 23:54:41 +03:00
Nikolay Nikolov
288f79cb3b + declare the __FPC_exception tag, when compiling with native WebAssembly
exceptions
2021-09-17 23:46:38 +03:00
Nikolay Nikolov
d8665f8a51 * write the .globaltype directive and the imports in the beginning of the
assembly file, because that appears to be required by llvm-mc from git
2021-09-17 23:46:38 +03:00
florian
bee87583de * avoid warnings 2021-09-17 22:27:44 +02:00
FPK
3f26551c42 Compile with -Oodfa to get better warnings 2021-09-17 20:01:23 +00:00
Nikolay Nikolov
d36e239f45 + enabled the exception handling instructions in the llvm-mc command line 2021-09-17 21:20:14 +03:00