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.

A JVM in Rust part 5 – Executing instructions

98 pointsby andreabergiaover 1 year ago

6 comments

bialpioover 1 year ago
Rust noob here so please be gentle - can someone explain why in `Vm&lt;&#x27;a&gt;` the lifetime is needed? I see that in tests, `Vm&lt;&#x27;static&gt;` gets created, presumably because there&#x27;s nowhere to grab a better lifetime from? But if that&#x27;s the case, would it be possible to express this in a different way? ISTM that Vm owns everything it needs, so is there a way to avoid bubbling the lifetime up?<p>Similar question applies to ClassManager - it already owns all the classes (they are in an arena), so it looks like a lifetime is needed because there&#x27;s no way to say &quot;things live as long as ClassManager lives&quot; w&#x2F;o introducing the lifetime at `ClassManager&lt;&#x27;a&gt;` level...
评论 #37300368 未加载
评论 #37300387 未加载
unwindover 1 year ago
Nice and detailed, thanks! As a struggling Rust n00b it&#x27;s instructive with these kinds of walk-throughs.<p>Found a typo: &quot;[...] and the program counter will be implemented.&quot; -- the last word qouted should be &quot;incremented&quot;, right?
评论 #37300335 未加载
tracker1over 1 year ago
Pretty interesting to see the progress on this. Wonder if any of the JVM devs are looking at this, and curious how far it will progress.
评论 #37300189 未加载
评论 #37304774 未加载
评论 #37302734 未加载
skitterover 1 year ago
When storing an object in an array, the value is checked to be a Value::Object (which can&#x27;t be null), but you also have Value::Null, so storing null in an array fails (I think). Storing null in local variables, a static field or an instance field works fine.
评论 #37304022 未加载
hnarnover 1 year ago
From the first post in the series:<p>&gt; I am very happy with what I have learned, about Rust and about how to implement a virtual machine. In particular, I am super happy about having implemented a real, working, garbage collector. It’s quite mediocre, but it’s mine and I love it. Given that I have achieved what I set out to do originally, I have decided to stop the project here. I know there are bugs, but I do not plan to fix them.<p>Toy projects are fine, but I just think this should be pointed out clearly that this is not a serious, ongoing project.
评论 #37300330 未加载
评论 #37300629 未加载
FrustratedMonkyover 1 year ago
So can we have a JVM written in Rust, running on WASM, running some Java, running MineCraft?
评论 #37299463 未加载
评论 #37299442 未加载
评论 #37299781 未加载