Live data from Hacker News

I have written a JVM in Rust

andreabergia.com

151–160 of 185 posts

Re: I have written a JVM in Rust

#151
post #112

Earlier quoted context omitted.

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.

Compiling to native isn't exactly black magic and works just as well.

JVM wastes cycles on things like classes, which is not necessary at all. Going forward, Rust has already proven that you can do things at compile time to guarantee things like memory safety.

Re: I have written a JVM in Rust

#152
post #112

Earlier quoted context omitted.

How is that not actually good? Engineering is all about tradeoffs, and ‘works’ is pretty high praise frankly.

Compiling to native isn't exactly black magic and works just as well. JVM wastes cycles on things like classes, which is not necessary at all. Going forward, Rust has already proven that you can do things at compile time to guarantee things like memory safety.

At the expense of productivity.

ART also compiles to native since Android 5.

Android 14 is around the corner, time to keep up with the times.

Re: I have written a JVM in Rust

#153

Earlier quoted context omitted.

It's actually very well suited to low level extremely low power embedded systems. The toolkit and dev experience targeting these platforms is actually pretty good DX. 32 bit 4mhz processor with ~64kb of nvram all running off of an induction charge!

I doubt its any better than native code. After all, modern jvm use is pretty much all jit anyways.

There are plenty of native code options for Java as well.

Re: I have written a JVM in Rust

#154
post #106

Earlier quoted context omitted.

Also many SIM cards (UICCs) / embedded SIM modules as well as e.g. the Secure Element that Samsung uses for Knox run with Java Card.

And Android recently added a Java API to talk to secure elements on your phone! We've come full circle.

eSIMs still support Java Card modules.

https://source.android.com/docs/core/connect/esim-overview?h...

Re: I have written a JVM in Rust

#155

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.

Android isn't conventional Java. For starters, its runtime uses its own bytecode (dex) that's based on registers instead of a stack. But then, also, many things that aren't related to GUI are C++ with a thin Java wrapper on top. When I think about a "Java OS", I imagine a JVM running in kernel mode, providing minimal OS functionality (scheduler, access to hardware I/O ports) and there not being any kind of userspace.

Just like Swing and JavaFX use a thin layer over whatever are the 3D APIas of the host.

While Android isn't proper Java, converting JVM bytecodes into a better format for embedded deployment is quite common on embedded world.

PTC, Aicas, Gemalto, microEJ, WebSphere Real Time, Aonix,....

Current Java OS as per your definition, would be PTC and Aicas real time JVMs for bare metal deployments in embedded scenarios.

Re: I have written a JVM in Rust

#156
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.

As far as I know even paying through Apple Pay with your credit card will run that Java Card program.

Though mind you, it is a very limited subset of Java, not the standard one.

Re: I have written a JVM in Rust

#157

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.

Android is mostly things that run java, not java itself. You can look at the source code, there is a relatively small amount of java in there.

Android has many lines of Java to support its frameworks and system services.

Re: I have written a JVM in Rust

#158
post #156

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.

As far as I know even paying through Apple Pay with your credit card will run that Java Card program. Though mind you, it is a very limited subset of Java, not the standard one.

Yep, the Secure Element runs little Java applets

Re: I have written a JVM in Rust

#159

Earlier quoted context omitted.

It's actually very well suited to low level extremely low power embedded systems. The toolkit and dev experience targeting these platforms is actually pretty good DX. 32 bit 4mhz processor with ~64kb of nvram all running off of an induction charge!

I doubt its any better than native code. After all, modern jvm use is pretty much all jit anyways.

You doubt it, but can you back up your belief?

Re: I have written a JVM in Rust

#160
post #147

Earlier quoted context omitted.

You can justify every project that has succeeded against any odds by saying "but it did succeed". It's true, but imo not a very good way of judging when a technology was a good fit or not.

What other criteria do you suggest? Ideological purity is rather subjective, and has an unfortunately poor track record of real world success.

I guess it's too much to ask for software engineers to understand how a technology matches its constraints.
Post reply on HN