TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

TeaVM – Ahead-of-time transpiler of Java bytecode to JavaScript or WebAssembly

195 点作者 entelechy超过 7 年前

14 条评论

kodablah超过 7 年前
For the reverse, I wrote a WASM-to-JVM compiler: <a href="https:&#x2F;&#x2F;github.com&#x2F;cretz&#x2F;asmble" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cretz&#x2F;asmble</a>.<p>I think WASM has the ability for us to finally cross the language boundaries without marrying ourselves to C&#x2F;C++ ABI. But at this early stage, there&#x27;s no common stdlib for all languages to share.
评论 #16076988 未加载
评论 #16076397 未加载
评论 #16076798 未加载
评论 #16076372 未加载
taxreform超过 7 年前
I read some parts of the spec of WebAssembly recently, and there were several things that disappointed me. To name a few:<p>1) There is no way to allocate in a function&#x27;s variable stack continuous memory space that spans more than 8 bytes. This implies that if a function has as a local variable compound data structure such as an array or a struct, you have to a) have a global virtual stack pointer, b) manipulate the stack pointer to allocate space for the data structure in the virtual stack on the memory, c) read from or write to the allocated memory space, and finally d) restore the stack pointer before the function exits. This is exactly like what resulting assembly code of C compiler does. Why do we have function locals as a WASM primitive, then, if we have to end up with manipulating the stack pointer?<p>2) Currently a function can only return one value even though it is trivial to add support to mutiple return values taking advantage of the fact that WASM is stack-based. And what puzzles me is that mutiple return values is actually mentioned as a possible feature in the future, in several places in the spec. WASM reached the MVP before adding it, which means that we will have to stick with one-return-value functions for quite a long time even if it is added in the future.
评论 #16079088 未加载
评论 #16079626 未加载
acqq超过 7 年前
“TeaVM is a primarily web development tool. It’s not for getting your large existing codebase in Java or Kotlin and producing JavaScript.”<p>“TeaVM is for you, if:<p>- You are a Java developer and you are going to write web front-end from scratch.<p>- You already have Java-based backend and want to integrate front-end code tightly into your existing development infrastructure.<p>- You have some Java back-end code you want to reuse in front-end.<p>-You are ready to rewrite your code to work with TeaVM.“<p><a href="http:&#x2F;&#x2F;teavm.org&#x2F;docs&#x2F;intro&#x2F;overview.html" rel="nofollow">http:&#x2F;&#x2F;teavm.org&#x2F;docs&#x2F;intro&#x2F;overview.html</a>
评论 #16077577 未加载
billsix超过 7 年前
That word,&quot;Transpile&quot;. Lol. GCC transpiles C to assembly.
评论 #16077869 未加载
评论 #16076898 未加载
评论 #16078411 未加载
评论 #16077135 未加载
olingern超过 7 年前
&gt; <i>If you are a Java (or Kotlin, or Scala) developer who used to write back-end code, TeaVM might be your choice. It’s true that a good developer (including Java developer) can learn JavaScript. However, to become an expert you have to spend reasonable amount of your time.</i><p>Oh, this is nice. I finally have a reason to give Kotlin a go. I have some time off and want to write something basic. Pretty excited about this, Rust, and all things wasm popping up.<p>I am, in no way, excited about debugging it, though.
评论 #16078436 未加载
rubyn00bie超过 7 年前
So... from reading the page linked (admitting my ignorance)... I really wonder how useful this is? Not to be rude, or to talk ill of the work, it’s far better than I could do... but!<p>With the release of other ahead of time compilers&#x2F;VMs&#x2F;features for the JVM&#x2F;Java9, I cannot fathom this produces a small enough payload for a web app over a mobile connection.<p>Im probably totally missing something; could someone educate me on practical or even useful but novel applications of this?
评论 #16079086 未加载
评论 #16079124 未加载
评论 #16077553 未加载
ianlevesque超过 7 年前
Does this support GC?
评论 #16076926 未加载
exception_e超过 7 年前
For those that are wondering but skimmed the page: It looks like they&#x27;re thinking about SPA framework (Angular&#x2F;React&#x2F;Etc) and have a subproject to support them.
norswap超过 7 年前
Does this support (a subset of) the standard Java libraries? Where can I find what is supported? (I just saw mentions that reflection wasn&#x27;t)
评论 #16079069 未加载
评论 #16078510 未加载
dizon超过 7 年前
In the end, how will this differ from a Java applet?
评论 #16076618 未加载
simfoo超过 7 年前
The argument against the critics saying WebAssembly would make the web less open was, that you could always disassemble WebAssembly and that said disassembly would be much more readable than for example x86 assembly.<p>So - since a quick research did not turn up anything - is there a WASM to C &quot;transpiler&quot; that generates readable C?
评论 #16077749 未加载
评论 #16079203 未加载
评论 #16079109 未加载
amelius超过 7 年前
But how does garbage collection work?<p>Is it of the stop-the-world kind?
评论 #16078260 未加载
xg15超过 7 年前
I think, by now &quot;transpile&quot; just means &quot;compile, but in web development&quot;.<p>Because, as we all know, web development you never compile things... &#x2F;s
评论 #16077678 未加载
评论 #16077740 未加载
评论 #16077851 未加载
frik超过 7 年前
The last thing we need in hindsight to Meltdown and Spectre is running untrusted binaries in the browser aka WebAssembly.<p>Btw deactivating WebAssembly support in Chrome 63 (up-to-date) doesn&#x27;t work anymore!!<p><pre><code> chrome:&#x2F;&#x2F;flags&#x2F;#enable-webassembly </code></pre> Setting it to &quot;deactivated&quot; does nothing, WebAssembly is still active.
评论 #16077064 未加载
评论 #16077198 未加载