WebAssembly backend

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

WebAssembly backend

Klaus T.
Hi, as the WebAssembly ecosystem is expanding fast, I am wondering if there are any plans to create a wasm backend for tinycc, especially given the existence of tiny wasm interpreters like wasm3.

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebAssembly backend

Christian Jullien-3

Hi,

 

I’m not aware of any efforts to create a wasm backend for tinycc but this is something very interesting to consider.

 

From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]] On Behalf Of Klaus T.
Sent: Wednesday, February 12, 2020 23:53
To: [hidden email]
Subject: [Tinycc-devel] WebAssembly backend

 

Hi, as the WebAssembly ecosystem is expanding fast, I am wondering if there are any plans to create a wasm backend for tinycc, especially given the existence of tiny wasm interpreters like wasm3.


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebAssembly backend

Charles Lohr
I tried creating a TinyCC target for asm.js and never really found a clean way to do it because of lack of goto.  My goal was to build an in-browser compiler for cheap wifi microcontrollers, the ESP8266 which could let you write code, compile it and run it without the need for a development system like Arduino.  There isn't xtensa support, but that wouldn't be hard to add. 

It turned all functions into whiles with complicated switch states.  I got most of the control flow stuff working but it was AWFUL... And I ran into the same issue with WebAssembly.  There was an interesting thread here: https://github.com/WebAssembly/design/issues/796 which has been one heck of a revealing thread between the two camps, where the general argument goes: 

(1) But Goto. No, really goto.  (2) Eh, we don't need goto and there's this boogyman we're worried about with it and it's dirty and makes us feel dirty. (3) But really, this is paaainful for compiler writers. (4) Use relooper.  (5) There's literally only one implementation and it's in C++.  (6) Use the C++ implementation.  (7) see 1.

I urge any person who is thinking about getting into languages to read that thread to see how wild and dogmatic these things can get.

It looks like it's feasible to abuse some control flow constructs, like I did with javascript, but unless you have some clever ideas, or any of the proposals go through, it's going to be a while...  If you have some clever ideas, it might be enough to make me go back and pick some projects up!!

On Wed, Feb 12, 2020 at 9:21 PM Christian Jullien <[hidden email]> wrote:

Hi,

 

I’m not aware of any efforts to create a wasm backend for tinycc but this is something very interesting to consider.

 

From: Tinycc-devel [mailto:[hidden email]=[hidden email]] On Behalf Of Klaus T.
Sent: Wednesday, February 12, 2020 23:53
To: [hidden email]
Subject: [Tinycc-devel] WebAssembly backend

 

Hi, as the WebAssembly ecosystem is expanding fast, I am wondering if there are any plans to create a wasm backend for tinycc, especially given the existence of tiny wasm interpreters like wasm3.

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: WebAssembly backend

Daniel Glöckner-2
On Fri, Feb 14, 2020 at 03:58:09AM -0800, Charles Lohr wrote:
> There isn't xtensa support, but that wouldn't be hard to add.

Adding support for a specific Xtensa chip wouldn't be hard, but Xtensa
allows the instruction set to be modified in various different ways when
the cpu core is synthesized. GCC had support for Xtensa for several years
before the ESP8266 came along, but it took some time until GCC learnt how
to deal with the call0 calling conventions necessary for this chip.
The tools provided by Tensilica to chipmakers spit out header files with
lots of defines that you have to use in a compiler to know how to
generate code for a particular chip.

Best regards,

  Daniel

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel