Slashdot Mirror


The Next Browser Scripting Language Is — C?

mad.frog writes to tell us that in a recent talk by Adobe's Scott Petersen he demonstrated a new toolchain that he has been working on (and soon to be open-sourced) that allows C code to be run by the Tamarin virtual machine. "The toolchain includes lots of other details, such as a custom POSIX system call API and a C multimedia library that provides access to Flash. And there's some things that Petersen had to add to Tamarin, such as a native byte array that maps directly to RAM, thereby allowing the VM's "emulation" of memory to have only a minor overhead over the real thing. The end result is the ability to run a wide variety of existing C code in Flash at acceptable speeds. Petersen demonstrated a version of Quake running in a Flash app, as well as a C-based Nintendo emulator running Zelda; both were eminently playable, and included sound effects and music."

14 of 375 comments (clear)

  1. Re:Browser-based OS by rustalot42684 · · Score: 2, Informative

    Er, disregard that, I was wrong

  2. Re:Sound and Music? by 2nd+Post! · · Score: 4, Informative

    Nope. SFX is generally event driven (hit a key, hear the sword swing) where music is not (enter an area and music plays continuously in the background).

    SFX requires timing, latency, and speed to be accurate. Music requires bandwidth and a minimum level of continuous CPU cycles.

    Both have different needs so you can have one without the other (when you are talking emulation).

  3. But is it secure? by Animats · · Score: 4, Informative

    If the "byte array mapped to RAM" installed in Tamarin allows the code to store anywhere in the interpreter's space, that's a huge security hole. It can do anything the user process can do. If you're going to allow that, you may as well just load executable machine code directly, as with Active-X.

    Anyway, the article is a blog post that rehashes an interview from last year. The info in that article is better.

  4. Adobe Systems != Open Source by mpapet · · Score: 5, Informative

    The last time I checked, Adobe Systems is about as hostile to open source as possible. They are the seldom acknowledged masters of the "first hit on the crack pipe is free" scheme.

    http://labs.adobe.com/technologies/eula/air.html

    Multiple helper libraries licensed under the MPL doesn't change the fact they are promoting another information silo.

    --
    http://www.maxineudall.com/2010/02/should-economists-be-sued-for-malpractice.html
    1. Re:Adobe Systems != Open Source by obi · · Score: 2, Informative

      Well, Tamarin is completely open source (MPL/GPL/LGPL triple licensed - see http://www.mozilla.org/projects/tamarin/faq.html#license). The Flash specs are completely open now, see http://www.adobe.com/openscreenproject/. The Flex SDK has an open source compiler for your actionscript to swf bytecode needs. You can also check http://opensource.adobe.com/ for more projects under a variety of licenses like MIT, LGPL3, etc.

      So what exactly are you complaining about? Air and the flash plugin are closed yes, but the specs and compilers and vm have been opened up by them. And there's already a lot of open source projects making use of these.

      Not that I think Adobe are the greatest thing since sliced bread; but I don't think they're "about as hostile to open source as possible", especially if you compare them to other companies their size/field.

  5. Re:Right... by twiddlingbits · · Score: 3, Informative

    And you realize all the overhead this created? It's why we needed dual core 3GHz 64 bit processors. C code, properly written is very tight and fast. Too many layers complicates the issue and introduces more chances of error. If you are looking inside Unix you'll find out the OS is written in C (and some assembler). You can have a GUI/Windows and still have C code..it's called X/MOTIF and has been around a long time, works well and is very fast. I'm pretty sure the current Linux GUIs owe a lot to to Motif.

  6. Guitar Hero and Lumines by tepples · · Score: 4, Informative

    Nope. SFX is generally event driven (hit a key, hear the sword swing) where music is not (enter an area and music plays continuously in the background).

    SFX requires timing, latency, and speed to be accurate. Music requires bandwidth and a minimum level of continuous CPU cycles.

    Both have different needs so you can have one without the other (when you are talking emulation).

    In Parappa the Rapper, Beatmania, Guitar Freaks, Drummania, Keyboard Mania, Frequency, Amplitude, Taiko Drum Master, Donkey Konga, Guitar Hero, Rock Band, and even scenes in the Mario Party and WarioWare series, the player triggers sound effects at specific times, and these sound effects represent music that the player is performing. If the background music becomes desynchronized from the sound effects that represent music, the emulated environment becomes unusable. Even games that aren't directly about performing music, such as Rez, Lumines, and some scenes in Super Mario RPG, indicate the timing of various game world events using the music.

  7. Re:Browser-based OS by trolltalk.com · · Score: 1, Informative

    It's not a browser-based OS - it's just a mapping of c source code to an interpreter running in flash.

    So it will be slowwww. In other words, it will turn your dual-core into a 386.

    Also, who the f*ck puts black text on a dark-brown background? If you don't want us to read the article, just say so ...

  8. A mighty hack, but of dubious use. by Peganthyrus · · Score: 4, Informative

    Hooray! Now C programmers can join the fun of writing sluggish applications that eat up huge amounts of CPU even when they're doing nothing!

    Deceptive headline, too, as this is just about compiling C to the bytecode that the Flash player interprets. Or even worse, now that I RTFA: "The LLVM instructions are converted into opcodes for a custom Virtual Machine that runs in ActionScript, a variant of ECMAScript and sibling of JavaScript." So your C is compiled to bytecode, that is interpreted by an interpreter that is, itself, a stream of the Flash player's bytecode.

    Moore's Law notwithstanding, this is a pretty insane use of processor cycles, guaranteed to make your program run a couple orders of magnitude slower than it would if you actually compiled it, or rewrote it in Actionscript!

    --
    egypt urnash minimal art.
  9. Re:Ah, the Memories... by JoshJ · · Score: 2, Informative

    Zelda was 1986 on the Family Computer. You're 12 years off.

  10. Re:Browser-based OS by Hairy+Heron · · Score: 5, Informative

    especially when the proprietary part is very large and complex (eg Java)

    You're about 3 years out of date on calling Java proprietary, kiddo. In case you forgot, it's been GPLed for over a year now.

  11. Re:what? by naasking · · Score: 4, Informative

    See The Better String Library. Haven't used it myself, but it's supposedly very portable, high performance, and has good interoperability with normal null terminated C strings.

  12. Re:what? by 42forty-two42 · · Score: 2, Informative

    Glib has something more or less exactly like this, minus the private_history_data (what's that supposed to be for?)

  13. Re:Browser-based OS by lena_10326 · · Score: 2, Informative

    X-Windows doesn't work well in HTTP environments because it does not handle latency well.

    While I understand your point, I don't know why you mentioned it. A low level correlation was not what I intended. I was speaking high level.

    If you spend a lot of money you may be able to get decent widgets

    There are tons of free frameworks and one off widgets. http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks

    For some, you do still have to style them a little to fit within your page design if you want a seamless look, but for the rest they work fine unmodified. Just drop them right in place and change a few text fields.

    --
    Camping on quad since 1996.