Live data from Hacker News

I have written a JVM in Rust

andreabergia.com

171–180 of 185 posts

Re: I have written a JVM in Rust

#171
post #169

Earlier quoted context omitted.

Them: People are using Java for this because there aren't alternatives You: If it is the convenient alternative than it is a good choice Me: That is a bad justification for something being a good choice You: What criteria then? Me: An understanding of the engineering principals/ domain Am I accurately summarizing this conversation so far? This isn't about alternatives, or what else they should have done. Something ca…

From an engineering perspective, I don't think it's fair to say something CAN be a bad fit and yet a good choice? At least not without acknowledging it was the best choice available, and therefore not likely actually a bad fit? In that scenario, it's literally the best possible fit. That you don't have any viable better alternative at hand may be further evidence of that? (and I don't mean from a standards basis 'wel…

> I don't think it's fair to say something CAN be a bad fit and yet a good choice?

So we fundamentally disagree.

> has had no practical economic effect, or slowed down implementation meaningfully.

This goes back to my "to prove me wrong you have to show me alternate universes where other options had that investment made under the same circumstances".

Re: I have written a JVM in Rust

#172
post #169

Earlier quoted context omitted.

From an engineering perspective, I don't think it's fair to say something CAN be a bad fit and yet a good choice? At least not without acknowledging it was the best choice available, and therefore not likely actually a bad fit? In that scenario, it's literally the best possible fit. That you don't have any viable better alternative at hand may be further evidence of that? (and I don't mean from a standards basis 'wel…

> I don't think it's fair to say something CAN be a bad fit and yet a good choice? So we fundamentally disagree. > has had no practical economic effect, or slowed down implementation meaningfully. This goes back to my "to prove me wrong you have to show me alternate universes where other options had that investment made under the same circumstances".

Since I'm literally not asking for proof, just asking you to propose any concrete alternative - I'm going to have to ask you to stop the BS.

Re: I have written a JVM in Rust

#173

Earlier quoted context omitted.

> I wanted to express the fact that everything that gets allocated (call stack, frames, classes, and objects) is alive and valid until the "root" VM is, thus I used 'a more or less everywhere. That's not being expressed in the type system. The lifetime 'a is unbounded (meaning you can make it anything you want, including 'static) so anything that shares 'a can outlive the vm without rust complaining. it would be no d…

Funnily enough I did the same in an early wip version of my toy JVM. Ended up using unsafe to use 'static references internally but only hand out wrappers that include a reference to the JVM. This also ensures that objects/classes/… from one JVM can't be used in another one.

Could you not pass around Mutex performantly?

Re: I have written a JVM in Rust

#174
post #93

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.

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

also every SIM card. which is potentially quite a bit less benign - the baseband chip is this completely separate processor which the SOC can't see into, and the SIM card can snoop messages, send commands, and generally act like a secure enclave. It is/was? used for a couple banking systems for feature-phones like MPESA, where the app can run as a featurephone app with the menu item toolkits the phone provides.

I think the e-sim idea is probably a net security benefit imo, apple has leveraged the carriers out of a fairly dangerous tool.

https://www.youtube.com/watch?v=31D94QOo2gY

Recently I was thinking about what a program written to take advantage of Optane's persistent-memory model would have looked like, if you use it like RAM it's forever gonna be slow shitty RAM. Javacard seems to be the closest hit for that, in some ways. Maybe some of the higher-tier javacards have GC.

I guess at that point it's basically a JVM application state snapshot, which is the same thing, so maybe not any better.

Re: I have written a JVM in Rust

#175

When I see such cool projects, I feel very overwhelmed. How do you get started with Rust and master basics to even attempt doing such a thing? Can OP explain?

Do some embedded work, implement a bare metal program on an ARM microcontroller in C or Rust. Make a LED blink. Then, make the same LED blink in pure ASM. The RP2040 is easy to bring up.

The magic will fade away quickly.

Re: I have written a JVM in Rust

#176
post #93

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.

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

Java Card is a very different language that's only superficially similar to Java. It prohibits OOP, only allows static methods, and makes you store everything in byte arrays and use System.arrayCopy. It's basically a less convenient C, with its complete lack of structs.

Re: I have written a JVM in Rust

#177
post #172

Earlier quoted context omitted.

> I don't think it's fair to say something CAN be a bad fit and yet a good choice? So we fundamentally disagree. > has had no practical economic effect, or slowed down implementation meaningfully. This goes back to my "to prove me wrong you have to show me alternate universes where other options had that investment made under the same circumstances".

Since I'm literally not asking for proof, just asking you to propose any concrete alternative - I'm going to have to ask you to stop the BS.

> any perceived complexity for implementing a Java VM in hardware has had no practical economic effect, or slowed down implementation meaningfully.

This is an assertion that can only be disputed with an alternate universe.

Re: I have written a JVM in Rust

#178
post #172

Earlier quoted context omitted.

Since I'm literally not asking for proof, just asking you to propose any concrete alternative - I'm going to have to ask you to stop the BS.

> any perceived complexity for implementing a Java VM in hardware has had no practical economic effect, or slowed down implementation meaningfully. This is an assertion that can only be disputed with an alternate universe.

Hardly. That would require an assertion like 'any perceived complexity for implementing a Java VM in hardware did not exist because it was rolled out in the most economic way possible given non-technical constraints, and it also did not slow down the implementation beyond the minimum absolutely necessary for any technical solution possible.'.

Notice the difference?

To propose alternative solutions based on practical economic effect just requires a reasonable degree of comparison to projects of similar scope at other times, reports of difficulty from various vendors, and comparisons of end price for this solution, end price for other solutions of similar scope, to the overall scope of the solution and value it brings. None of which requires perfect alternative universe A/B testing to come to some reasonable analysis.

If another solution could be done for half the price (say $0.005 per unit, instead of $0.01 per unit) but the perceived value for vendors is $1/unit - then it's hard to say there is any practical economic effect going either way. Neither solution would block profitability or value. That said, they could easily be compared and better/worse solutions could also be determined or tradeoffs analyzed based on that data, also without perfect alternate universe A/B testing to come to some reasonable analysis. Industry does this all the time at scale, including projected costs of implementation of various solutions.

If the solution was rolled out within a timeframe considered useful/expected for this kind of solution, then it also didn't slow down implementation meaningfully - as in it didn't block it, or add serious delay. If there is another solution which could have been done in half the time, that's cool. But it wasn't required. Identifying such an alternative, if one exists, could be done if you have any data, without having to do an alternative universe A/B test. Though since the proof is in the pudding, to REALLY be sure maybe it would. But that's hardly what I've been referring to or asking for, clearly.

Doesn't mean they wouldn't have been better solutions, and proposed them as alternatives can easily be done without parallel universes! In fact, chances are they have already been implemented somewhere in another niche, so there is adequate data to do so.

Re: I have written a JVM in Rust

#179

When I see such cool projects, I feel very overwhelmed. How do you get started with Rust and master basics to even attempt doing such a thing? Can OP explain?

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…

Thanks for sharing

Re: I have written a JVM in Rust

#180

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…

I happen to personally know the author, and I'm not really surprised he pulled this off. Using him as a baseline of who is a real developer his extremely unhealthy. Please don't :)

It is always good to know how smart developers work and approach problems. I don't want to make him my north star
Post reply on HN