Parsing Java Bytecode with Python (JelloVM Ep.01)

  Рет қаралды 56,743

Tsoding Daily

Tsoding Daily

Жыл бұрын

References:
- Specs: docs.oracle.com/javase/specs/...
- WASM Learning Website: kolumb.github.io/learning-was...
- Source Code: github.com/tsoding/pjython

Пікірлер: 148
@vivekascoder
@vivekascoder Жыл бұрын
"Money is not the most important thing in your life, what's important is knowing how to parse JVM" -Tsoding
@TenderBug
@TenderBug Жыл бұрын
Take that Larry Elison
@milan1039
@milan1039 Жыл бұрын
13:10
@L0wPressure
@L0wPressure Жыл бұрын
That's some wisdom for you folks! XD
@satyajeetkumarjha1482
@satyajeetkumarjha1482 10 ай бұрын
13:15
@paulzupan3732
@paulzupan3732 7 ай бұрын
Actually very true, create a language, target the JVM and you're good to go
@calebharper9567
@calebharper9567 Жыл бұрын
I like how he reflexively keeps typing semicolons at the end of lines and correcting it
@EDFHLFLFF
@EDFHLFLFF Жыл бұрын
I always do that in matlab too, mostly because sometimes you're meant to and sometimes not 🤷
@raidensama1511
@raidensama1511 Жыл бұрын
He could leave them in, it would still work.
@mandrak87
@mandrak87 Жыл бұрын
I just wanted to say how much I enjoy watching your videos. It is the perfect balance between top quality educational content and really funny/entertaining jokes mixed in. You truly are a one of a kind engineer. Keep up the fantastic work and I hope things are not too bad for you in Russia. Tsoding rocks 👍
@craigcraig6248
@craigcraig6248 Жыл бұрын
Yeah this is a really underrated channel for a cs nerd like me
@simonetii
@simonetii Жыл бұрын
in python3 with f strings you can do foo = "a" print(f"{foo=}) which will print foo = "a" basically if you put an equal sign at the end of the block it will evaluate the expression and return its value and the expression itself as string great video as always bro
@NathanChambers
@NathanChambers Жыл бұрын
wrong, print(f"{foo=}) will print foo="a" if you want the spaces for example print(f"{foo= }) would print foo= "a". Point being, it doesn't automatically add a space before and after the = like your example :)
@desertfish74
@desertfish74 Жыл бұрын
We had Jython in the past (java running python programs) now Pava (?) Python running Java. Letsgoo
@reinhold1616
@reinhold1616 Жыл бұрын
java running python running java running python running java when?
@ndrechtseiter
@ndrechtseiter Жыл бұрын
@@reinhold1616 milk inside a bag of milk inside a bag of milk
@ratofthecity6351
@ratofthecity6351 4 ай бұрын
​@@ndrechtseiterREAL
@ratofthecity6351
@ratofthecity6351 3 ай бұрын
​@@ndrechtseiterholy shit milk game
@angelcaru
@angelcaru 2 ай бұрын
milk mentioned@@ratofthecity6351
@smergibblegibberish
@smergibblegibberish Жыл бұрын
He hadn't uploaded since the Russian mobilization started. I had started to worry for him. Glad to see he is alright.
@mrmaniac9905
@mrmaniac9905 Жыл бұрын
Glad to see you back keep up the content, I love watching it in the background at work!
@jozef_kascak
@jozef_kascak Жыл бұрын
Glad to see you back. I hope you are safe from everything.
@1vader
@1vader Жыл бұрын
Some reasons why the binaries contain the class names: - debugging output, e.g. exception stacktraces - reflection - methods that print the class name, including default toString implementations and getClass().getName()
@DeathSugar
@DeathSugar Жыл бұрын
is there a way to strip them? or the only way to do it is via JIT/AOT?
@laurensweyn
@laurensweyn Жыл бұрын
@@DeathSugar You can strip class names via an obfuscator. This effectively renames all your classes to 'A', 'B', 'C'... 'AA', 'AB' and so on. Great if you want to avoid reverse engineering, not so great if you want to understand a stack trace or any errors/debug output
@DeathSugar
@DeathSugar Жыл бұрын
@@laurensweyn is it built-in thing in java? Can this data be moved in some dsym file, like CXX does?
@SnackLive
@SnackLive Жыл бұрын
@@DeathSugar Dont remember if is actually build in the compilator but theres a lot of tooling dedicated to obfuscation and code reduction
@pozdroszejset4460
@pozdroszejset4460 Жыл бұрын
@@DeathSugar proguard is a popular one
@accountname1047
@accountname1047 Жыл бұрын
You are a wizard, love watching you work
@eboubaker3722
@eboubaker3722 Жыл бұрын
Ooh man my favorite channel makes a video about my favorite language java best day ever
@jasonkary8431
@jasonkary8431 5 ай бұрын
Being an old guy, I know why there are and ... It's from the teletype machine days. is a carriage return where the print head is physically returned to the start of the line. is a line feed where physically scrolled the paper up one line. No collusion involved. ;)
@VojtaJavora
@VojtaJavora 5 ай бұрын
Right, but once nobody used teletypes, why did each of them choose different line ending.
@TheBigLou13
@TheBigLou13 Жыл бұрын
This was interesting to watch and I learned a lot. Thank you! :) You're clever and a quick thinker.
@bassguitarbill
@bassguitarbill Жыл бұрын
Really entertaining video, looking forward to the rest of this!
@Fikerus2
@Fikerus2 Жыл бұрын
2:52 He checked the date to say what year it is
@spermakonya
@spermakonya Жыл бұрын
😂
@alphad.lawless3980
@alphad.lawless3980 Жыл бұрын
That's because your mind is light years ahead
@mattcoley
@mattcoley Жыл бұрын
35:00 - Lol welcome to the spec. It literally says in that page they regret some of these decisions. But yeah, its not a horribly complicated spec, just got some quirks. 43:30 - Arrays of 'constants' of each type would actually be kinda cool.
@BulletHeadPL
@BulletHeadPL Жыл бұрын
im so happy i can listen to u again
@Yash42189
@Yash42189 Жыл бұрын
ure the best programming related youtube content creator. keep up the good work
@lucifer-5ybtn
@lucifer-5ybtn Жыл бұрын
good to see you’re back🎉
@morgengabe1
@morgengabe1 Жыл бұрын
dude, great to see you're safe! was worried when you went quiet after the draft was announced!
@LordMardur
@LordMardur Жыл бұрын
18:30 I think the "intention" of Windows (or DOS) having both line feed and carriage return together is a simpler printer driver, and laziness. Early matrix printers had different commands for line feed (moving the paper) and carriage return (returning the print head to the home position, this is where the name comes from). With having both commands directly in the text document, a printer driver can simply send the file byte by byte to the printer and it does the right thing. Unix and Mac preferred a single command inside text files, since in a text document there is not really a concept of carriage return or line feed, just new line. For parsing binary data from bytes, I recommend struct.unpack. It is a standard package, which allows for easier reading (and writing) of entire structures and can handle endianness as well.
@5omebody
@5omebody Жыл бұрын
i feel like it's less laziness, and more... DOS probably cared more about compatibility with existing standards, whereas unix and max (also unix) *probably* just figured, you're probably not printing your text files, let alone your code, so why not keep it simple
Жыл бұрын
I love that there is the development process captured in this! Building custom JVM is cool, but I like to see you adding new features and suddenly saying "this can go to a separate function". It is such a great learning material! I wish something like this was done 15 years ago when I started to code :)
@TenderBug
@TenderBug Жыл бұрын
Someone is overly funny and sarcastic than usual in this stream 🤣 Nice vid Tsoding. Learned lot.
@JanBebendorf
@JanBebendorf Жыл бұрын
We built a transpiler that can target multiple languages instead (we made backends for lua and php but built it to be extensible). The subset of the stdlib that we implemented is very small as it stands but also built to be extended using Java classes with native methods and annotations that provide the code for the different languages. The produced code also doesn't look great because it replicates the behavior instruction by instruction but it actually works quite good.
@coder4937
@coder4937 Жыл бұрын
I was waiting for your video
@L0wPressure
@L0wPressure Жыл бұрын
My man, every time i watch your videos i feel stupid, but at the same time i always learn something new :) Let's hope all that shit ends soon, i wish us all peace.
@filipmajetic1174
@filipmajetic1174 Жыл бұрын
Such a shame we had to give up Turing completenss to get Unicode in python 3... Btw, Java 18 or 19 finally got "script" files, where you can just start writing code without a public static void main and it just works™
@Rene-tu3fc
@Rene-tu3fc Жыл бұрын
maybe by java 23443 we'll have static function files, where we don't need to encapsulate public static functions within classes
@sagnikc4
@sagnikc4 Жыл бұрын
jshell ?
@keineangabe8993
@keineangabe8993 Жыл бұрын
@@Rene-tu3fc I actually dont have a problem with that, we need some way of accessing functions like that anyway, I see utility classes as some kind of namespace.
@orizach01
@orizach01 Жыл бұрын
JavaScript in real life
@rogo7330
@rogo7330 Жыл бұрын
By the way, try to disable "Turbo" (also called p-state). You can do that with `echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo`. This will disable your CPU from running on extra sShpPpiIieeed and will no longer give you a heatstroke while you using your computer.
@jonasls
@jonasls Жыл бұрын
Super cool, can't wait for more! Maybe an interpreter?
@claudiusraphael9423
@claudiusraphael9423 7 ай бұрын
Just "reading" that title alone made me want to comment: You really are the Sado-Masochistic Dominatrix of Programming. G-sus Krajst: This is the epitome of perversion, lol - and i thought generating 6502-assembly from inside a BASIC V2 program and poking it live to replace the running kernel by triggering a soft-reset would be nasty - this is a whole nother level of dark-arts. Razpackt!
@salamemilano
@salamemilano Жыл бұрын
1:23:11 the best part of the entire live
@ShotgunLlama
@ShotgunLlama Жыл бұрын
Well this definitely got me down a deep rabbit hole
@thegate8985
@thegate8985 Жыл бұрын
Hi (or privet, as a Russian I hear russian accent in your speech :D)! Thanks for the video :)
@alpers.2123
@alpers.2123 Жыл бұрын
def pprint(obj): print(json.dumps(obj, indent=4, sort_keys=False))
@DanCojocaru2000
@DanCojocaru2000 Жыл бұрын
obj is not JSON serializable
@superscatboy
@superscatboy Жыл бұрын
You're a lunatic, man. Never change :)
@marceloxsweet1358
@marceloxsweet1358 10 ай бұрын
Jython, perfect name dude ❤
@alexandrohdez3982
@alexandrohdez3982 Жыл бұрын
Again GREAT VIDEO 👏👏👏👏
@ecampo123
@ecampo123 Жыл бұрын
The real OOP were the friends we made along the way
@rafagd
@rafagd Жыл бұрын
I know it's too late to sugest a name, but if Jython is Python on JVM, JVM in Python needs to be Pava or PVM
@paulfragemann3333
@paulfragemann3333 Жыл бұрын
There is a lot more incompatible change in Python 2 vs 3 but the print is the most noticable syntactically. The way strings work completely changed, splitting the str type of Python 2 that was basically just a list of bytes into 3 different type: str (unicode string), bytes (immutable list of bytes), bytearray (mutable list of bytes), breaking a lot of programms messing around with binary files. And a lot more stuffs even less noticeable than that.
@laurensweyn
@laurensweyn Жыл бұрын
Exactly, the differences are far bigger than print() -- most libraries wouldn't take nearly so long to port to Python 3 if that was the only change, especially since most use proper logging instead of prints which were unchanged. The division operator '/' always returning a floating point number in Python 3 instead of also doing integer division like in Python 2 (which is now '//') is a particularly nasty one I remember for example.
@CraftMine1000
@CraftMine1000 Жыл бұрын
Let's not forget import pathing changed slightly from 2 to 3 also
@TsodingDaily
@TsodingDaily Жыл бұрын
@Elsevar Asadov I mean, to realize that this was a joke you need to watch that bit until the end. You can't expect such a huge attention span from an average KZfaq commenter especially after introduction of KZfaq Shorts.
@laurensweyn
@laurensweyn Жыл бұрын
@@TsodingDaily I had this 2.5 hour video in my recommendations, never seen this channel before, and first impressions matter. I got the impression you didn't know what you were talking about (and I've heard plenty of beginners complain about this very thing during early Python 3 days), and if that were a sign of what's to come for the rest of the video, I'm not sitting through 2.5 hours of this, especially if I have many more creators to choose from. I'm sorry my judgement was incorrect, but I'm sure I wasn't the only one to come to this conclusion. Maybe something to consider for future videos. Or don't, I won't stop you.
@sandworm9528
@sandworm9528 Жыл бұрын
@@laurensweyn you only have to watch 4m 15s to hear him say he's joking. But go ahead and explain how valuable your opinions are
@amosaidoo5741
@amosaidoo5741 9 ай бұрын
That was fun to watch
@BalintCsala
@BalintCsala Жыл бұрын
I admittedly haven't watched through the whole video, but since you are using python 3 I recommend using format strings in prints, you can do a lot of the stuff you did effortlessly e.g. print(f"{foo = }") results in "foo = "
@zohnannor
@zohnannor Жыл бұрын
but without pretty-printing, although he could've used `pprint.pformat`.
@BalintCsala
@BalintCsala Жыл бұрын
@@zohnannor I was mostly talking about stuff around 20 minutes Also, for pretty printing as others mentioned json _is_ better
@zohnannor
@zohnannor Жыл бұрын
@@BalintCsala yes i laughed when he tried `json.dump` without `indent` parameter, saw that it didn't print like he thought and immediately threw that code away xD so close yet so far
@annybodykila
@annybodykila 4 ай бұрын
Knowledge of reflection and injection would be helpful for a project like this 😉
Жыл бұрын
1:47:28 When you said "holy fucken shit"... I felt it in my bones.
@brvtalcake
@brvtalcake Жыл бұрын
I really like your spying videos
@devqbasic2384
@devqbasic2384 Жыл бұрын
can you write assembly on an os level ? It's fun and easy if you stay 16bit because you still have the bios.
@1495978707
@1495978707 Жыл бұрын
6:00 for the thing about open source as a means to exploit young enthusiastic programmers
@white_145
@white_145 7 ай бұрын
2:08:58 could use the ,= operator (which is just weird tuple syntax)
@hwstar9416
@hwstar9416 Жыл бұрын
I think this is the third time you've changed the thumbnail now 😂
@jerssh
@jerssh Жыл бұрын
19:35 Once a bunch of files i was reading in were getting cut of at random points, ends up the binary info contained EOF markers coincidentally, and reading it in non-binary mode would just make it quit reading the file when it ran into them.
@aciddev_
@aciddev_ Жыл бұрын
imagine running this through jython
@hatkidchan_
@hatkidchan_ Жыл бұрын
Hehe... Пива... Ehehehhehhehhh...
@samholland209
@samholland209 5 күн бұрын
Since you did this, why not also write a program in Python that can decompile Java bytecode?
@CarterColeisInfamous
@CarterColeisInfamous Жыл бұрын
3:26 that is correct
@remrevo3944
@remrevo3944 Жыл бұрын
Javas interpretation of UTF-8 is going to be a pain. Because if you start using emojis in the java strings there are going to be problems.
@kvikende
@kvikende Жыл бұрын
Tsoding adding all those parantheses might be his unconcious telling him to learn LISP
Жыл бұрын
2:03:50 Yes! This is me programming in PHP 15 years ago. "Why does the function return allways null? Ah, because I haven't included `return result` at the end..."
@berndeckenfels
@berndeckenfels 2 ай бұрын
1:38:10 Descriptor is the ()V (void) return signature with no args
@arthurlokhov6856
@arthurlokhov6856 Жыл бұрын
what font are you using?
@thirtysixnanoseconds1086
@thirtysixnanoseconds1086 Жыл бұрын
ioevska
@i007c
@i007c 11 ай бұрын
python struct module is also a good option
Жыл бұрын
1:23:10 As a CS graduate, I confirm.
@rogo7330
@rogo7330 Жыл бұрын
How on the Earth Java compiles simple write to stdout so long?
@pishax3056
@pishax3056 Жыл бұрын
пива))
@replikvltyoutube3727
@replikvltyoutube3727 Жыл бұрын
Make porth compile to jvm
@ilikegeorgiabutiveonlybeen6705
@ilikegeorgiabutiveonlybeen6705 2 ай бұрын
гагага пива
@fullstack_journey
@fullstack_journey Жыл бұрын
Oh the inexplicably fantastic horror. I cannot look at it but i cannot look away from it
@donovanvanderlinde3478
@donovanvanderlinde3478 Жыл бұрын
Hmm Feels like Porth all over again You say it’s just for hello world but I bet this will end up being a lot more 😂😂
@Richarddesk
@Richarddesk Жыл бұрын
oracle jdk😄
@Lars-ce4rd
@Lars-ce4rd Ай бұрын
I guess tsoding was so afraid of enabling JVM developers that he decided to use python for this task.
@TheBasyx
@TheBasyx Жыл бұрын
print without () had security issues
@meaningfulname9437
@meaningfulname9437 Жыл бұрын
So you were in Russia that time?😀
@jebarchives
@jebarchives Жыл бұрын
:D
@akam9919
@akam9919 Жыл бұрын
My insides feel weird reading the title.
@theodorealenas3171
@theodorealenas3171 Ай бұрын
1:04:00 it's hard to convince my peers to do this versus blop chunks of code and debug little by little
@skr-kute1677
@skr-kute1677 Жыл бұрын
i love the jokes here n there
@skr-kute1677
@skr-kute1677 Жыл бұрын
bruh, like really as im watchin the vid, it do be extra funny and interesting to watch
@rodelias9378
@rodelias9378 Жыл бұрын
"It's doable"
@D0Samp
@D0Samp Жыл бұрын
Next step, writing a Java library to parse CPython byte code.
@ErikOrjehag
@ErikOrjehag Жыл бұрын
Did you move apartment?
@mbarrio
@mbarrio Жыл бұрын
Maybe he got back to parents house, Kemerovo, or Novokuznetsk.
@cycomkid
@cycomkid Жыл бұрын
I liked the video but dislike the fact that you are not getting the money, if there is anything i can do let me know, i will be happy to support. I am from india and Russia is a good friend of India
@gargleblasta
@gargleblasta Жыл бұрын
I want to code something simple today he says 😂
@Un0rdin4rYPr0gr4mmeR
@Un0rdin4rYPr0gr4mmeR Жыл бұрын
Has nobody commented on "P0rn folder size at 14:45" - Too smol PepeHands :D
@frechjo
@frechjo Жыл бұрын
Mi vidas komentojn en la angla, mi vidas komentojn en la rusa, sed kie estas la komentoj en la plej bona lingvo? Ŝajnas ke mi mem devas zorgi pri tio! Ankaŭ, algoritma engaĝiĝo.
@roiproutii
@roiproutii Жыл бұрын
21:10 it's because return is a keyword and print is a function but was a keyword in py2
@l.iwakura6553
@l.iwakura6553 Жыл бұрын
sorry, but how doesnt you back hurt when you stay sit for quite a time?
@joaomendoncayt
@joaomendoncayt Жыл бұрын
are we not going to talk about 2:52? Edit: Ok, I should've just kept watching...
@ThePoke151
@ThePoke151 Жыл бұрын
23:45 I came, but only because I like pain or something
@valshaped
@valshaped Жыл бұрын
The most important thing we can do to combat AI code generator agents is write massive piles of the sh*ttiest code on the planet, like bash scripts that generate bash scripts
@MultiSuperUnicorn
@MultiSuperUnicorn Жыл бұрын
open source and hackathons are one and the same :D
@skeleton_craftGaming
@skeleton_craftGaming Жыл бұрын
Yeah, the whole point of Java is that you don't need to know how Java works internally.
@replikvltyoutube3727
@replikvltyoutube3727 Жыл бұрын
Maybe yer laptop needs to be cleaned from dust ?
@replikvltyoutube3727
@replikvltyoutube3727 Жыл бұрын
It would be rly cool if you could help free pascal with jvm backend
@superscatboy
@superscatboy Жыл бұрын
I think Free Pascal can already target the JVM.
@replikvltyoutube3727
@replikvltyoutube3727 Жыл бұрын
@@superscatboy it does but is not upstream last time I checked and it is based on really old Jasmin library
@superscatboy
@superscatboy Жыл бұрын
@@replikvltyoutube3727 Fair enough, I just remember hearing that it was a thing it could do.
@MrOboema
@MrOboema Жыл бұрын
Java Bytecode in Python. Wow. How's the performance? 🤣
@objectobject5889
@objectobject5889 Жыл бұрын
3x faster. In the development time domain ;)
@MrOboema
@MrOboema Жыл бұрын
@@objectobject5889 but 10x slower in execution and the next Python version wont be able to run it without major changes. Got it, like usual Python code...got it 😁
@thehackr258
@thehackr258 2 ай бұрын
14:07 is really hot 🔥 😂😂😂!! in Russia 😂
@nibrobb
@nibrobb 7 ай бұрын
1:41:00 incoming call
@zgliu8018
@zgliu8018 Жыл бұрын
Un-staticize your interpreted language 😈
@sossupummi
@sossupummi Жыл бұрын
first!
@aciddev_
@aciddev_ Жыл бұрын
может тебе создать русский канал? и заливать туда озвучки, на русском, или сюда добавить субтитры?
@aqqq4097
@aqqq4097 Жыл бұрын
Whyyyyy? Just whyyy
@toastedgralic4868
@toastedgralic4868 3 ай бұрын
8:50 en.wikipedia.org/wiki/Java_class_file#:~:text=the%20sourcefile%2C%20etc.)-,Magic%20Number,-%5Bedit%5D
I made JVM in Python just to run "Hello, World" (JelloVM Ep.02)
1:49:09
Заметили?
00:11
Double Bubble
Рет қаралды 3,4 МЛН
A pack of chips with a surprise 🤣😍❤️ #demariki
00:14
Demariki
Рет қаралды 11 МЛН
狼来了的故事你们听过吗?#天使 #小丑 #超人不会飞
00:42
超人不会飞
Рет қаралды 65 МЛН
КАКОЙ ВАШ ЛЮБИМЫЙ ЦВЕТ?😍 #game #shorts
00:17
Poopigirl
Рет қаралды 10 МЛН
Async Rust Is A Bad Language | Prime Reacts
28:46
ThePrimeTime
Рет қаралды 85 М.
I regret doing this...
1:20:07
Tsoding Daily
Рет қаралды 62 М.
microsoft's new AI feature is a privacy nightmare
9:34
Low Level Learning
Рет қаралды 99 М.
SOME UNIQUE C++ CODE! // Pacman Clone Code Review
26:42
The Cherno
Рет қаралды 254 М.
NixOS: Everything Everywhere All At Once
15:10
No Boilerplate
Рет қаралды 262 М.
tree-sitter explained
15:00
TJ DeVries
Рет қаралды 68 М.
Harder Drive: Hard drives we didn't want or need
36:47
suckerpinch
Рет қаралды 1,6 МЛН
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 789 М.
Rust and RAII Memory Management - Computerphile
24:22
Computerphile
Рет қаралды 214 М.
C++ vs Rust: which is faster?
21:15
fasterthanlime
Рет қаралды 373 М.
How charged your battery?
0:14
V.A. show / Магика
Рет қаралды 3,8 МЛН
Карточка Зарядка 📱 ( @ArshSoni )
0:23
EpicShortsRussia
Рет қаралды 650 М.