Page 1 of 2
Something Interesting. Javascript x86 emulator
Posted: Tue May 17, 2011 3:24 pm
by cxzuk
Heya all!
Something i think everyone should have a go with and to take apart! A javascript x86 emulator from the creator of qemu, tcc, ffmpeg and much more.
Fabrice Bellard - A truly talented programmer.
http://bellard.org/jslinux/
Re: Something Interesting. Javascript x86 emulator
Posted: Wed May 18, 2011 5:35 am
by UX
I saw that on LWN yesterday...I will just quote him:
I happen to be interested by the implementation of Javascript engines these days - but I don't know yet if I will write my own any time soon ! Anyway, this emulator was a way to learn how to write optimized code for recent Javascript engines, in particular Jaeger Monkey (for Firefox 4) and V8 (for Chrome).
Wow...does this guy even eat?
What do you think, how much it would take you to program a C complier, VM, mpeg lib, and PC emulator in ugly js...a lifetime?
I feel dumb.
Re: Something Interesting. Javascript x86 emulator
Posted: Wed May 18, 2011 7:03 am
by cxzuk
His organisational skills must be amazing. Most of my time is pretty much wasted time.
http://www.softwarequalityconnection.co ... rogrammer/
Re: Something Interesting. Javascript x86 emulator
Posted: Wed May 18, 2011 8:54 am
by UX
Thanks for the article...it can all be summed up with this one:
” Bellard doesn’t appear to promote himself" -> and that is the key...usualy programmers, eventhoug they are very interested in coding, as soon as they gain some knowledge, they like to show off and scream about it.
Difference is, Bellard obviously has much _love_ for his job and love is always very creative and simple, humble.
Just look at his homepage...plain HTML with projects that can put almost any company, programmer to shame.
Yeah...very rare role model in this industry. I bet he's an exceptional person too.
Re: Something Interesting. Javascript x86 emulator
Posted: Fri May 20, 2011 6:33 pm
by Love4Boobies
UX wrote:Wow...does this guy even eat?
What do you think, how much it would take you to program a C complier, VM, mpeg lib, and PC emulator in ugly js...a lifetime?
I feel dumb.
There are people on this very forum who have already accomplished more than that. I'm not trying to imply that Fabrice Bellard isn't a good programmer, I'm just saying that it's not all that uncommon at all. Also, note that he's not magically developing a bajillion projects at once; most of them are either unmaintained or have other maintainers now.
As for JS, it's a pretty good language and its usage outside client-side programming (i.e., for application programming and even for systems programming) has greatly increased in the last couple of years. I recommend that you look into it.
Re: Something Interesting. Javascript x86 emulator
Posted: Sun May 22, 2011 11:11 pm
by Solar
Love4Boobies wrote:As for JS, it's a pretty good language...
*cough*
Ahem.
I beg to differ.
JavaScript is successful, and it does have advantages, but being "a pretty good language" (as language
per se) is not one of them.
In this, it can be grouped with e.g. Perl: It does the job it was designed for, and
can be used for things it wasn't designed for, and it might even be the best choice because "everybody knows it" and tremendous work has been done with regards to frameworks and support libraries, but
technologically it's a second-rate citizen.
Re: Something Interesting. Javascript x86 emulator
Posted: Mon May 23, 2011 3:24 am
by Solar
Even stupidity can be standardized (and certified, ref. ISO 9001...).
But to each his own. I wouldn't touch JavaScript with a ten-foot-pole, but that's just me.
Re: Something Interesting. Javascript x86 emulator
Posted: Mon May 23, 2011 5:30 am
by Owen
JavaScript - or, rather, ECMAScript - is just a Lisp in C/Java's clothing. It is a very elegant language, with acknowledgement that using doubles as the only number representation was probably a mistake. It has its flaws, but, well, it was implemented on a deadline; if it hadn't been, something worse would have happened.
Browser-based JavaScript, however, is a different matter...
Re: Something Interesting. Javascript x86 emulator
Posted: Mon May 23, 2011 12:42 pm
by Love4Boobies
Indeed. It's nothing like Perl---most people have bad preconceptions regarding JavaScript (I was guilty of this as well), but after using it for a little while, one starts to realize that it's better than most general-purpose programming languages out there. I would also recommend it for systems programming. Programming is not the place for preconceptions.
Re: Something Interesting. Javascript x86 emulator
Posted: Mon May 23, 2011 1:55 pm
by Combuster
Owen wrote:Browser-based JavaScript, however, is a different matter...
Which is exactly why I wouldn't touch it with that 10-foot pole Solar mentioned. A language is worthless if you can't trust its implementation.
Re: Something Interesting. Javascript x86 emulator
Posted: Mon May 23, 2011 2:23 pm
by Love4Boobies
Combuster wrote:Owen wrote:Browser-based JavaScript, however, is a different matter...
Which is exactly why I wouldn't touch it with that 10-foot pole Solar mentioned. A language is worthless if you can't trust its implementation.
Well, there
are good implementations of it. That aside, I don't really agree with you on this one. While good tools are clearly very important, generally speaking, good design & poor implementation -> everyone says the thing is useless -> unpopular -> no good implementations (ever?).
Re: Something Interesting. Javascript x86 emulator
Posted: Mon May 23, 2011 2:37 pm
by JamesM
Solar wrote:Love4Boobies wrote:As for JS, it's a pretty good language...
*cough*
Ahem.
I beg to differ.
JavaScript is successful, and it does have advantages, but being "a pretty good language" (as language
per se) is not one of them.
In this, it can be grouped with e.g. Perl: It does the job it was designed for, and
can be used for things it wasn't designed for, and it might even be the best choice because "everybody knows it" and tremendous work has been done with regards to frameworks and support libraries, but
technologically it's a second-rate citizen.
Am I the only person who really likes Javascript's purity? Classes are functions, everything is in weak JSON... The things that frameworks like jQuery can do with it are rather incredible.
I know some V8 developers, and there are a good number of things that make Javascript a *pig* to write a compiler for, but as a programmer... I like it.
Re: Something Interesting. Javascript x86 emulator
Posted: Mon May 23, 2011 3:15 pm
by Love4Boobies
@JamesM: I think we've already established that most of us like it.
Re: Something Interesting. Javascript x86 emulator
Posted: Sat Jul 16, 2011 2:11 am
by miker00lz
an x86 emu in javascript... that is twisted and abnormal. somebody needs to put it out of it's misery! seriously though, that is pretty cool. i haven't tried it, but i'm going to guess the performance isn't very good.
i've always had huge respect for bellard, the guy is seriously talented.
Re: Something Interesting. Javascript x86 emulator
Posted: Sat Jul 16, 2011 4:39 am
by Neolander
Well, the sample code is fast, but it is quite limited, and the emulator has several major limitations due to performance concerns already (e.g. no FPU emulation, no real mode so probably no BIOS emulation either...)