Live data from Hacker News

I have written a JVM in Rust

andreabergia.com

111–120 of 185 posts

Re: I have written a JVM in Rust

#111
post #98

Earlier quoted context omitted.

Google appears to be significantly more useful than GPT-4 here. [1] is the third result for me for the query "credit card jvm". [2] is the second result and gives a direct (and more importantly, actually correct) answer. That post links to the Oracle documentation for Java Cards [3] which is the fourth result. [1] https://en.m.wikipedia.org/wiki/Java_Card [2] https://superuser.com/questions/362567/are-there-any-credi…

Fair enough, there is a "Java Card". I'm not convinved that Java is running on any of my or your credit cards in your wallet today, though I'm not willing to bet on it.

This lists a few things using Java Cards (likely stuff that's in your wallet, surprisingly): https://stackoverflow.com/questions/47731005/practical-use-o...

(fwiw I have a bit of prior experience here)

Re: I have written a JVM in Rust

#112
post #93

Earlier quoted context omitted.

Embedded JVM is actually huge/pervasive and runs things as benign as the chip on your credit card.

By the virtue of being the most convenient alternative, not because its actually good.

How is that not actually good?

Engineering is all about tradeoffs, and ‘works’ is pretty high praise frankly.

Re: I have written a JVM in Rust

#113
post #82

Earlier quoted context omitted.

Nope. For a more realistic example of such a JVM, look at SubstrateVM (written in "SystemJava" and compiled to native code ahead of time along with the app it runs), and "Java on Truffle" (a.k.a. Espresso), which is a JVM written in Java designed to be compiled to run on top of SubstrateVM. Both projects are a part of Graal. The reason to do this, beyond the inherently neat Inception factor, is that JVMs are a PITA t…

I find that Rust is like maybe 1.5-2x more productive to code in than say C or C++. Part of that is the tooling has so much less arcane baggage, part of that is that I need to reach less for external tools for metaprogramming, part of that is fewer crazy macro/template compiler errors, and part of that is less time spent debugging. It all adds up.

I've heard very inconsistent things about this, which is interesting. Often people say Rust is less productive, as there's often "makework" involved with satisfying the borrow checker. I suspect a lot of it revolves around how you perceive that sort of thing: it can be cast as both productivity (satisfying it can potentially rule out bugs) or a loss of productivity (you were already satisfied the code was correct).

But I don't have enough experience with Rust to really have formed an opinion on that yet.

Re: I have written a JVM in Rust

#114
post #93

Earlier quoted context omitted.

Embedded JVM is actually huge/pervasive and runs things as benign as the chip on your credit card.

By the virtue of being the most convenient alternative, not because its actually good.

Still better than ElectronJS, I would say

Re: I have written a JVM in Rust

#115
post #111

Earlier quoted context omitted.

Fair enough, there is a "Java Card". I'm not convinved that Java is running on any of my or your credit cards in your wallet today, though I'm not willing to bet on it.

This lists a few things using Java Cards (likely stuff that's in your wallet, surprisingly): https://stackoverflow.com/questions/47731005/practical-use-o... (fwiw I have a bit of prior experience here)

That's pretty neat. It sounds like Java Card (or at least some other cards) actually "boot up" by way of inductive coupling, ie, via the "contactless" card readers where you just hold your card in proximity to the reader thing. Did not know that, I assumed it was just reading a key via NFC or something.

Re: I have written a JVM in Rust

#116

That is pretty awesome! When I joined the Java effort in '92 (called Oak at the time) the group I was with was looking at writing a full OS in Java. The idea being that you could get to just the minimal set of things needed as "machine code" (aka native methods) you could reduce the attack surface of an embedded OS. (originally Java was targeted to run in things like TV's and other appliances). We were, of course, wo…

> writing a full OS in Java IMAO, Android kind of achieve that...kind of. They write lots of OS logics in Java (or Kotlin) but mixing lots of system services written in native code at the same time, interconnected by the famous (or infamous?) Bind IPC.

It's a modified version of the linux kernel no? That'd be mostly C.

Re: I have written a JVM in Rust

#117
post #102
post #93

Earlier quoted context omitted.

Embedded JVM is actually huge/pervasive and runs things as benign as the chip on your credit card.

Every blu ray player runs java for bonus features on the disk- they can even connect to the internet!

The very first feature I disable on every Blu-ray player I've ever used.

Re: I have written a JVM in Rust

#118

Earlier quoted context omitted.

Likewise. Not to go onto too much of tangent, but on a more personal note I've been generally struggling with this feeling a lot lately. I've been a professional software developer for almost 10 years, and I _know_ I'm competent (and not an impostor) as demonstrated by my current position and ability to ship things. However, lately after viewing developer blogs I become overwhelmed that I actually don't know enough a…

What you're describing is very common amongst developers. So common in fact, that I've written a post about this https://alic.dev/blog/comparisons In short: recognizing your insecurities is the first step. The next step is figuring out what's important to you, shedding impossible to achieve and irrational ambitions, prioritizing your goals in life, and articulating concrete steps to further them.

Thanks, appreciate the link and going to keep this in mind. Cheers.

Re: I have written a JVM in Rust

#119
post #116

Earlier quoted context omitted.

> writing a full OS in Java IMAO, Android kind of achieve that...kind of. They write lots of OS logics in Java (or Kotlin) but mixing lots of system services written in native code at the same time, interconnected by the famous (or infamous?) Bind IPC.

It's a modified version of the linux kernel no? That'd be mostly C.

He might be referring to system services that manage hardware devices .etc BatteryService .rtc

Re: I have written a JVM in Rust

#120

I have a few questions about the garbage collection. One of the hard parts of implementing a garbage collector is making sure everything is properly rooted (especially with a moving collector). you have the `do_garbage_collection` method marked unsafe[1], but don't explain what the calling code needs to do to ensure it is safe to call. How do you ensure all references to the heap are rooted? This is not a trivial pro…

GCs are pretty easy, and just a matter of good accounting. That is, until you start doing concurrent GC then it becomes hellishly difficult.
Post reply on HN