TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How does dynamic dispatch work in WebAssembly?

98 pointsby mnemonikabout 7 years ago

5 comments

repsilatabout 7 years ago
Kinda annoying, but not surprising. VMs and bytecode formats make simplifying assumptions based on the languages they expect to be hosted on top of them, and that usually means &quot;Something with control flow like C.&quot;<p>Creative uses of computed jumps, messing with the stack, dynamic codegen, all sorts of weird things your new language might do to efficiently implement some new control or data structure aren&#x27;t likely to be possible.<p>At least in the short term nobody is going to be too upset. Today if something needs to wring all the power available from your CPU it isn&#x27;t reasonable to put it on the web. That will continue to be true. WASM is the wise 80% solution, not a toy for ASM hackers and people messing around with weird prototype programming languages.
评论 #16946145 未加载
评论 #16946241 未加载
评论 #16946533 未加载
amlutoabout 7 years ago
Someone should make a CPU that does this. Intel CET is a bit of a start, but a CALL instruction that takes a “type” operand and only calls functions of that type would be a big improvement. So would a totally separate return address stack.
评论 #16945483 未加载
评论 #16945803 未加载
评论 #16945135 未加载
merlishabout 7 years ago
How do you implement co-operative multitasking in WebAssembly?<p>Do you have to analyze the source program &amp; know where every possible call to a yield is, and store all resulting suffixes of a function as new functions?
footaabout 7 years ago
I&#x27;ll be interested to read about the first WASM vulnerabilities that are revealed.
gokabout 7 years ago
So how are function pointers in (say) C implemented?
评论 #16945938 未加载
评论 #16945916 未加载
评论 #16946474 未加载