No video

JVM in Rust?? | | Prime Reacts

  Рет қаралды 69,449

ThePrimeTime

ThePrimeTime

Жыл бұрын

Recorded live on twitch, GET IN
/ theprimeagen
Article: andreabergia.com/blog/2023/07...
Author: Andrea Bergia - / andreabergia
MY MAIN YT CHANNEL: Has well edited engineering videos
/ theprimeagen
Discord
/ discord
Have something for me to read or react to?: / theprimeagenreact

Пікірлер: 196
@taeza007hd
@taeza007hd Жыл бұрын
Rust Devs have time to rewrite everything in rust because they didn’t have an actual jobs.
@Dnalor21
@Dnalor21 Жыл бұрын
Hahahahaha 😂
@mhtmhn
@mhtmhn Жыл бұрын
Tom needs to re-write JDSL in Rust
@vaisakhkm783
@vaisakhkm783 Жыл бұрын
Rust is for bignner's , he will rewrite JDSL in JDSL
@-rya1146
@-rya1146 Жыл бұрын
@@vaisakhkm783 Recursive JDSL lol
@tabiasgeehuman
@tabiasgeehuman Жыл бұрын
@@-rya1146 bootstrapping JDSL compiler
@spetz911
@spetz911 Жыл бұрын
JVM in JDSL
@exsesx
@exsesx Жыл бұрын
@@vaisakhkm783 Rewrite Rust in JDSL then
@thingsiplay
@thingsiplay Жыл бұрын
The most shocking revelation to me is, that you didn't knew JAR files are just ZIP files.
@harrytsang1501
@harrytsang1501 Жыл бұрын
Do you know how many common file formats are just zip with extra steps?
@thingsiplay
@thingsiplay Жыл бұрын
@@harrytsang1501 I even rename some zip files, so it can associated with a default program. It's a common technique.
@gregandark8571
@gregandark8571 Жыл бұрын
@@thingsiplay OMG!
@master74200
@master74200 Жыл бұрын
A lot of files are just zip files with some bits and bobs in them. And for those that aren't, they might be SQLite databases instead.
@vaisakhkm783
@vaisakhkm783 Жыл бұрын
i think .exe files are also zip with extra steps... i might be wrong...
@SimGunther
@SimGunther Жыл бұрын
What's next, a Python in Lua?
@TheAces1979
@TheAces1979 Жыл бұрын
🤣🤣🤣
@airman122469
@airman122469 Жыл бұрын
That would actually be pretty funny.
@the_mastermage
@the_mastermage Жыл бұрын
call it LPython
@ac130kz
@ac130kz Жыл бұрын
Lython
@chpsilva
@chpsilva Жыл бұрын
Lithium
@asdqwe4427
@asdqwe4427 Жыл бұрын
Tsoding made a jvm in python and a c compiler in php 😂
@distant6606
@distant6606 Жыл бұрын
guy is built different.
@Quephara
@Quephara Жыл бұрын
😂 😂 😂
@aiba7604
@aiba7604 Жыл бұрын
Doesn't it technically bootstrap?
@jordixboy
@jordixboy Жыл бұрын
writing a VM is actually pretty simple! but its awesome still
@daltonyon
@daltonyon Жыл бұрын
RVM is the new JVM. I love that approach, Rust gives us the possibility to improve what already exists in other languages, create new things, make proof of concept.
@harrytsang1501
@harrytsang1501 Жыл бұрын
I'm still extremely intrigued by macros in rust If the html macro can validate and provide validation, can we have a typeScript macro that creates an AST with type annotations and will throw errors if the typescript is invalid. Just a thought
@lukaszoblak
@lukaszoblak Жыл бұрын
@@harrytsang1501 why not? tokenize, parse, lint and return from macro. no rocket science, matklad could do that in a week, probably
@NoX-512
@NoX-512 Жыл бұрын
@@lukaszoblakTom would do it in a day, because Tom is a genius.
@aerbil3136
@aerbil3136 Жыл бұрын
I'm very suspicious of that @daltonyon is an experimental bot, testing whether they will get anyone noticing it's a bot.
@theshermantanker7043
@theshermantanker7043 Ай бұрын
HotSpot is already so supercharged that I doubt you can make a rewrite that is better than it is, even if you rewrite it in Rust
@theohallenius8882
@theohallenius8882 Жыл бұрын
And I've written a Solidity parser and EVM in Rust and written blog posts teaching others how to do it, ngl it's a great way to learn 👍
@shark950621
@shark950621 Жыл бұрын
Can you link blog post please ? Would love to read about EVM implementation in rust.
@theohallenius8882
@theohallenius8882 Жыл бұрын
@@shark950621 KZfaq doesn't let me share it, you'll have to figure out how to find it 🤣
@AK-vx4dy
@AK-vx4dy Жыл бұрын
Impressive design. Respect to Andrea!
@albucc
@albucc Жыл бұрын
It is a pet project, I do see that. But being able to call java code from rust, and call rust from java (as native methods) makes for a world of libraries that are simply absent in rust, such as xslt processing, and even accessing databases using jdbc, available, and allows for a gradual migration of a java project into a rust hybrid, without resorting to the "throw it all away and start from scratch in rust", which is basically a show stopper for using rust in a corporative environment addicted to java, such as the one I work on.
@woolfel
@woolfel Жыл бұрын
LOL, that made me laugh. writing a virtual machine is a fun and great thing to do. you learn a shit ton writing a virtual machine. Writing my own LISP interpreter made me understand just how badass the JVM is.
@kippers12isOG
@kippers12isOG Жыл бұрын
Hey prime. You described marksweep but his is a semi space copying collector. Based on this description, it doesn't work like you described, marking and then sweeping. I'm pretty sure instead of marking, it does it all in one pass, copying objects it touches to the other semi space as it goes.
@advanceringnewholder
@advanceringnewholder Жыл бұрын
but, can you do rust compiler in Java? running in rjvm
@MrDejvidkit
@MrDejvidkit Жыл бұрын
Yes you can do any compiler in java.
@BubbleBeeee
@BubbleBeeee Жыл бұрын
​@@MrDejvidkitcan you write a JVM in Java?
@sqyyy
@sqyyy Жыл бұрын
@@BubbleBeeee Already exists. The one I know of is called SSVM.
@theshermantanker7043
@theshermantanker7043 Ай бұрын
​@@BubbleBeeeeGraal
@Bobbias
@Bobbias Жыл бұрын
The AOC 2019 IntCode language/vm was invredibly fun to implement.
@robfielding8566
@robfielding8566 Жыл бұрын
I have written a .class file parser before, to turn jars into Graphviz graphs. What was weirder was implementing Java serialization in C# (to talk to a JBoss server from C# clients). It certainly sounds like an elite way to learn Rust well.
@HrHaakon
@HrHaakon Жыл бұрын
And I assume that the JBoss devs couldn't set up a HornetQ JMS service? C# can speak to that quite easily over STOMP, after all.
@robfielding8566
@robfielding8566 Жыл бұрын
@@HrHaakon That sounds interesting. I was doing Java a long time ago. I wasn't sure at the time if there were already ways to be compatible with RMI from C# (which is based on Java serialization). But the very first thing I noticed was a possibly huge vulnerability where you could invoke any zero arg constructor remotely(!!) as a side-effect of how it was done. I was making noise about it to Sun, but never head of a vulnerability based on it until a few years later.
@danielphil80
@danielphil80 Жыл бұрын
In a world of doing things uncomfortable till you're competent. I'm watching something I hardly understand for the same reason.
@coffee-is-power
@coffee-is-power Жыл бұрын
I unironically tried to actually do a JVM in rust quite some time ago, i was able to somewhat parse the class files, but i haven't reached the part that actually executes the bytecode, and also never came back, i have a life...
@CottidaeSEA
@CottidaeSEA Жыл бұрын
Something that I find exciting in the Java world is the appearance of more JVMs. Azul for example has a non-blocking (concurrent) garbage collector that supposedly increases performance greatly. Considering that Java is already pretty damn fast for not running native code, not having the locking GC would make a big difference.
@PanosPitsi
@PanosPitsi Жыл бұрын
“Java is pretty damn fast” 🥶🥶🥶🥶🥶🥶🥶🥶
@flarebear5346
@flarebear5346 Жыл бұрын
The cooler thing is the languages that use the jvm as a compilation target like scalla and kotlin. The space is pretty interesting
@user-kf7vy5yu2v
@user-kf7vy5yu2v Жыл бұрын
Literally nothing about the Java world is exciting unless you are 80 years old
@CottidaeSEA
@CottidaeSEA Жыл бұрын
@@PanosPitsi "Java is already pretty damn fast for not running native code" There, fixed it. Java is one of the fastest interpreted languages you know?
@CottidaeSEA
@CottidaeSEA Жыл бұрын
@@user-kf7vy5yu2v Tell me you haven't heard about Kotlin without telling me you haven't heard about Kotlin.
@greycell2442
@greycell2442 Жыл бұрын
I think the implication in using Python or Java would be... like creating a plugin architecture. Any scripted thing. If he could do threading I guess. I generally think about Python/Cython for some data scraping thing using a Rust client. I haven't tried just yet.
@disguysn
@disguysn Жыл бұрын
You love the Into implementation because you miss the conversions magic from C#. :D
@demolazer
@demolazer Жыл бұрын
Prime needs to take on this project
@ThePrimeTimeagen
@ThePrimeTimeagen Жыл бұрын
The Lord's language Java is clearly my favorite
@OneMilian
@OneMilian Жыл бұрын
@@ThePrimeTimeagen cLeArlY
@Alex-xl4xe
@Alex-xl4xe Жыл бұрын
I wanted to go to sleep and you upload another video. MATE
@RakeshKumar-tu6bi
@RakeshKumar-tu6bi Жыл бұрын
I love Java and seeing a guy write a JVM in Rust(another my fav lovely language) is just amazing. I love it. Salute to the champion.
@kyleMcBurnett
@kyleMcBurnett Жыл бұрын
I'm a kotlin dev. I'd love to have a jvm written in rust.
@petertillemans2231
@petertillemans2231 Жыл бұрын
Finally!!! A a step closer to play C64 retro games in a emulator running in Jython on the JVM on Rust on Windows in a VM on Linux on an ESXI host.
@rodricbr
@rodricbr Жыл бұрын
rust is such a cool language
@olddeveloper8648
@olddeveloper8648 Жыл бұрын
Oooh, the humanity.
@avalagum7957
@avalagum7957 Жыл бұрын
If jvm is written in C++/C, then writing it in Rust sounds natural. I wonder if any part of the jvm will ever be written in Rust, like in the Linux kernel.
@hilligans1
@hilligans1 Жыл бұрын
Wont happen
@avalagum7957
@avalagum7957 Жыл бұрын
@@hilligans1 is there any specific reason that won't happen?
@hilligans1
@hilligans1 Жыл бұрын
@@avalagum7957 they gain nothing from adding
@theshermantanker7043
@theshermantanker7043 Ай бұрын
​@@avalagum7957Adding a new language to HotSpot requires a new compiler, in this case rustc, which is a lot of work. Considering even just moving from C++14 to C++17 is already so difficult, I doubt Rust will ever be used in the JVM
@dulanjala
@dulanjala Жыл бұрын
I wish someone would improve the Rust compiler, it's slow even for small debug builds..
@AllanSavolainen
@AllanSavolainen Жыл бұрын
Cool, after reading this, I want to write JVM with Java!
@baguettedad
@baguettedad Жыл бұрын
When ThePrimeDaddy says cli instead of cli
@AdvancedAntiSkid
@AdvancedAntiSkid Жыл бұрын
Was not expecting this one
@Diego-Garcia
@Diego-Garcia Жыл бұрын
The name is TheJavaRustMachinegen
@Sakrosankt-Bierstube
@Sakrosankt-Bierstube 8 ай бұрын
His next project probably is to rewrite the internet in rust.. like.. the whole internet.. like really everything.
@gregandark8571
@gregandark8571 Жыл бұрын
So what it changes ???
@professornumbskull5555
@professornumbskull5555 Жыл бұрын
Hey Prime, Article link?
@Euphorya
@Euphorya Жыл бұрын
IntCode in Advent of Code 2019 was so fun!
@dejfcold
@dejfcold Жыл бұрын
Ah, I finally can call myself a rust programmer and with zero effort.
@CamaradaArdi
@CamaradaArdi Жыл бұрын
I'm quite confident that he didn't need to write the GC algorithm using pointers or unsafe code, that's the beauty of Rust.
@moimoi9995
@moimoi9995 Жыл бұрын
I've been writing a GC for my Lua interpreter and I have had to use unsafe. I'm planning to abstract it all a bit to make optimisation easier but under the hood it will remain pointers.
@brandonjoaocastillo7490
@brandonjoaocastillo7490 Жыл бұрын
This kind of videos shows me how behind I am, I dont know if at some point it just get better, but currently, thhis thing are way far from my abilities
@george_potoshin
@george_potoshin Жыл бұрын
Now we need a rustc in Java
@__idan__
@__idan__ Жыл бұрын
Kinky way of oxidizing your coffee, btw, no reflection? that's a feature not a bug
@HrHaakon
@HrHaakon Жыл бұрын
GraalVM fan spotted! :p
@edz8659
@edz8659 Жыл бұрын
Java virtual ayyy macarena
@pif5023
@pif5023 Жыл бұрын
Java trying to bring OOP at executable level with .class files
@Ataraxia_Atom
@Ataraxia_Atom Жыл бұрын
Tha f'n catalina wine mixer
@TheSulross
@TheSulross Жыл бұрын
I have all the books detailing the JVM, the byte code standard, class file format, how JNI works, etc, etc. Implementing a large swath as of that as a solo project would be tedious in any programming language.
@AsbestosSoup
@AsbestosSoup Жыл бұрын
I can finally run Minecraft BLAZINGLY FAST
@DBGabriele
@DBGabriele Жыл бұрын
I dont think so.
@desertfish74
@desertfish74 Жыл бұрын
The name. JARJAR
@SharunKumar
@SharunKumar Жыл бұрын
Non garbage collected language used to write a garbage collected vm. What timeline is this?
@theshermantanker7043
@theshermantanker7043 Ай бұрын
??? The primary JVM (HotSpot) is also written in C++, an also non garbage collected language
@nateedwards1313
@nateedwards1313 Жыл бұрын
If Rust™ wants to be taken seriously and needs to have a VRML reader 😤
@lapissea1190
@lapissea1190 Жыл бұрын
Next we need to write a rust executor in java so you can jit when developing so you don't need to wait 75 years for a debug build, you just get bad performance
@HrHaakon
@HrHaakon Жыл бұрын
Half the speed in 1/100th the compile time is a great tradeoff if your test has half the load of production... ;)
@lapissea1190
@lapissea1190 Жыл бұрын
​@@HrHaakon Well, it's more complicated than that. If it takes for example, 150ms to reach a stage in code where you need to check something or it fails then any code that runs after that is irrelevant. It does not matter how much things there is to test. Plus if you really wanted to, you could spawn an actual compilation task in the background and when it completes, transition the execution to actual compiled code. It is funny that's actually how java JIT works. It runs an interpreter that can instantly run code not that fast and starts compiling it in to an optimized machine code version. Once that's done, the interpreter hands off the runtime memory to it.
@cianmoriarty7345
@cianmoriarty7345 Жыл бұрын
What a dark and sinister use of necromancy
@Caellyan
@Caellyan Жыл бұрын
Java without generics is like C++ without templates...
@trannusaran6164
@trannusaran6164 Жыл бұрын
Can we run clojure on it? λ_λ
@vytah
@vytah Жыл бұрын
Definitely nothing newer than Clojure 1.9, as it is the last one that runs on Java 7.
@JanuszKrysztofiak
@JanuszKrysztofiak Жыл бұрын
I wonder about generics. Generally, from JVM point of view, there is next-to-nothing to do in this respect. They are almost like type declarations in TypeScript: just a compile-time syntactic aid/contract that is erased and plays no role at run-time. JVM bytecode has no notion of them. They only appear in meta-data, so when you link that code, tools such as IDEs and compilers are aware that this is not supposed to be an Object but something more specific (that's why you cannot use primitive types such as int in generics - they are not Objects). TypeScript being source-only does not have to do that.
@chucktangy
@chucktangy Жыл бұрын
Yea Generics are implemented primarily in the compiler. Type erasures are just that. The types are GONE at runtime. But reflection does have generic tie-ins which he said he didn't implement so maybe it would be just that like the Type interface, etc.
@theshermantanker7043
@theshermantanker7043 Ай бұрын
This is only true now, generics are being reworked in Valhalla
@TheMrKeksLp
@TheMrKeksLp Жыл бұрын
People need to stop hating on Java out of sheer peer pressure. Java is fine, certainly a lot better than Python and for large programs also way better than JavaScript
@banatibor83
@banatibor83 Жыл бұрын
Recently we have evaluated Go and Java frameworks for writing Kubernetes operators. While Go is the main language in the kubernetes world, and the most supported, the java framwork resulted in better code. Less cluttered, more coherent, no magic comments for the framework etc. Java rules!
@IrizarryBrandon
@IrizarryBrandon Жыл бұрын
I've found this out too, from my limited experience with it, Java appears to be a solid and professionally wrought piece of engineering, if being perhaps somewhat of a product of its time (but gets better all the time!)
@isodoubIet
@isodoubIet Жыл бұрын
It's not so much Java that's the problem I don't think, more so the patterns that people are funneled into for using Java, like the much-maligned AbstractFactoryFactoryFactory. But really you don't have to do it that way, and you can do pretty ok with a bunch of static methods instead of OOP-the-world madness.
@arden6725
@arden6725 Жыл бұрын
@@banatibor83sounds like java programmers not knowing how to use a language that doesn’t have classes
@HrHaakon
@HrHaakon Жыл бұрын
​@@isodoubIet Static methods are fine. You should probably start with static factory methods. Hell, that's how Java does it. UUID has fromString for example. You don't do new UUIDParser.parse(String). But there are reasons for factory objects etc. as well. And having a lot of static methods have led to absolute pain in my experience. It makes certain parts of testing things very hard and leads to people googling things like "how do I mock static methods that are hardwired?" instead of just injecting them in the first place as you're supposed to. For example a thing that takes a String and returns SomeThing is a Function. This actually does help a lot when the code base gets larger and older, because dependencies are now dragged out into the sunlight. Yeah, you now have to expose some wiring, but when you're later coming trying to find the faulty wiring, you'll be very happy that the wiring is visible... ;)
@Taaz2
@Taaz2 Жыл бұрын
is it just me or are Primes videos often too silent/not loud enough?
@PinakiGupta82Appu
@PinakiGupta82Appu Жыл бұрын
Let's write Autodesk 3DS MAX in Rust and release the source under a permissive licence. Or, lynch me if you can't. Formula no. one! Edit: re-write.
@mLevyks
@mLevyks 10 ай бұрын
who else already knew that JARs were just ZIPs because of minecraft? the old days of installing optifine manually
@ArachnidAbby
@ArachnidAbby Жыл бұрын
Its just Just (Java rUST)
@exhaustedrose
@exhaustedrose Жыл бұрын
Java runs on 2 billion devices.
@Metruzanca
@Metruzanca Жыл бұрын
Running java in rust? Cool. Now someone write rustc in java. Then we can run rust from java from rust.
@TanigaDanae
@TanigaDanae Жыл бұрын
The problem why we have "uninitialized" and "null" in his JVM is because in Java there is no default null initialization, enjoy.
@lowercasebtwalso
@lowercasebtwalso Жыл бұрын
Get it to run Minecraft
@zen-ventzi-marinov
@zen-ventzi-marinov Жыл бұрын
Rava
@reisaki18
@reisaki18 Жыл бұрын
.JAR = Java ARchive
@replikvltyoutube3727
@replikvltyoutube3727 Жыл бұрын
Sorry or Congratulations
@tomriddle2075
@tomriddle2075 Жыл бұрын
First
@shakibrahman
@shakibrahman Жыл бұрын
rewrite rustc in rust and maybe it'll actually be fast this time :D
@Cookiekeks
@Cookiekeks Жыл бұрын
What is it written in if not Rust?
@shakibrahman
@shakibrahman Жыл бұрын
@@Cookiekeks 🥺 But but blazingly fast
@airman122469
@airman122469 Жыл бұрын
Why? Why write an interpreter for inferior languages in Rust?
@anhta9001
@anhta9001 Жыл бұрын
Instead, just write a Rust compiler in Java.
@petkogeorgiev2103
@petkogeorgiev2103 Жыл бұрын
It literally says it in the first paragraph or so. It's for fun and educational purposes, most of these things aren't useful by themselves, but doing them make us better developers.
@Anon.G
@Anon.G Жыл бұрын
For fun, to learn
@isodoubIet
@isodoubIet Жыл бұрын
@@anhta9001 I read that in the "programmers are human too" voice
@laughingvampire7555
@laughingvampire7555 Жыл бұрын
is just a waste of time, why use a jvm when you can use rust directly. as a former java -victim- sr developer I think rust is superior
@diadetediotedio6918
@diadetediotedio6918 Жыл бұрын
It is fun bro
@conorx3
@conorx3 Жыл бұрын
You think rust is superior? Likely so does the author. Guy implements a garbage-collected vm language and you’re hung up on the syntax. I would not be surprised if Rust ends up in the JDK after this, nor if the author scores a Rust job because of his skills.
@laughingvampire7555
@laughingvampire7555 Жыл бұрын
@@conorx3 " and you’re hung up on the syntax." stop projecting your opinions onto others. The whole point of my comment is not about syntax, is precisely about the semantics, rust is superior to java because of the semantics, because there is no runtime. Rust syntax is made around the borrow checker, why implement a borrow checker language on a garbage collected? you wouldn't even have the same experience at all because by writing with a rust-ish syntax on the jvm will give you absolutely nothing of the flavor of rust, will hinder only your experience in real rust. Is just a waste of time in every sense. if you think is "just for fun" well, that is just silly anyways.
@wilfred-almeida
@wilfred-almeida Жыл бұрын
EoD, Java sucks & we keep using it.
@AustriaZz
@AustriaZz Жыл бұрын
At this point I think rust ecosystem is broken. This is bad.
@oShinobu
@oShinobu Жыл бұрын
How is this related to the Rust ecosystem?
@ccgarciab
@ccgarciab Жыл бұрын
*reads video title and rushes to create drama*
This CLI Tool is AMAZING | Prime Reacts
11:59
ThePrimeTime
Рет қаралды 79 М.
Go 1.20 Memory Arenas Are AMAZING | Prime Reacts
16:38
ThePrimeTime
Рет қаралды 96 М.
Doing This Instead Of Studying.. 😳
00:12
Jojo Sim
Рет қаралды 29 МЛН
Smart Sigma Kid #funny #sigma #memes
00:26
CRAZY GREAPA
Рет қаралды 18 МЛН
Я не голоден
01:00
К-Media
Рет қаралды 10 МЛН
90% Percent Of My Code Is Generated By LLM's
28:14
ThePrimeTime
Рет қаралды 114 М.
Use Arc Instead of Vec
15:21
Logan Smith
Рет қаралды 142 М.
How much faster has Mojo's dictionary gotten?
7:40
EKB PhD
Рет қаралды 3 М.
7 Signs Of A Bad Programmer | Prime Reacts
11:27
ThePrimeTime
Рет қаралды 379 М.
Two Moments That Made Me A Great Software Engineer
6:15
ThePrimeTime
Рет қаралды 51 М.
A Simpler Way to See Results
19:17
Logan Smith
Рет қаралды 103 М.
Build A Full Stack Chatbot in Rust (feat. Leptos & Rustformers)
43:40
Code to the Moon
Рет қаралды 153 М.
Scaling One Million Checkboxes
49:31
ThePrimeTime
Рет қаралды 199 М.
Makepad: Designing modern UIs with Rust - Rik Arends - RustNL 2023
55:20
Rust Nederland (RustNL)
Рет қаралды 52 М.
Rich Harris Forks JS?? | Prime Reacts
6:56
ThePrimeTime
Рет қаралды 74 М.
Doing This Instead Of Studying.. 😳
00:12
Jojo Sim
Рет қаралды 29 МЛН