13

OK so... project I've been working on! It's a virtual processor that runs in the browser coded in JavaScript. OK so I know, I know, you must be thinking, "this is crazy!" "Why would she do this?!?!" and I understand that.

The idea of Tangible is is to see if I can get any tangible performance over JavaScript. I've posted a poorly drawn diagram below showing how tangible works.

The goal for tangible is to not use html, javascript, or CSS. Instead, you would use, say for instance, c++ and write your web page in that, then you compile it using my clang plugins and out pops your bytecode for Tangible. No more CSS, no more html, and no more javascript. Instead everything from a textbox to a video on your web page is an object, each object can be placed into a container, each container follows specific flag rules like: centerHorizontal or centerVertical.

Added to all of this you get the optimization of the llvm optimizer.

Comments
  • 1
    Pleez write flash plugin in js and we are all done... ehm... doomed 😳
  • 0
    This sounds interesting, would love to hear more about it, how would it work? How does your virtual processor interact with engine or is it something else?
  • 0
    @coookie sorry was out.

    Tangible is written in JavaScript. The way it works is it just interprets instructions and does what the instruction tells it to do.

    here's an example program:

    mov reg0, 5;
    mov reg1, 6;
    add reg0, reg1, reg0;

    although technically, if this is unused clang will remove it...

    the equivalent javascript:

    var a = 5 + 6;

    interesting thing with this I can also simulate a GPU (which is a lot harder) and you can make opengl calls instead of webgl.
  • 0
    @mclovinit oh I have no idea 😅
  • 0
    @coookie the other thing you could do if this caught on, is to rewrite the specification for the processor in c++ for web browsers native instead of javascript, vastly increasing the performance.
  • 0
    @coookie one problem I ran into is integers... javascript supports 52 bit variables, which is a problem for me, so I had to redefine a new class for variables, memblocks! Memblocks are blocks of memory that get allocated using Mallorca, reallocated, and free. it contains the number of bytes you wanted and an Id tag.
  • 1
    Got you, but I don't think I understood what Tangible is exactly?
  • 0
    I want to see where this goes on :)
  • 0
    @coookie tangible is a processor simulation. Which means you write assembly for it, or use a compiler to compile to the assembly. It replaces the need to use CSS, html, or javascript.
  • 0
    @mclovinit yes, it has assembly instructions like. real processor, it uses 256 registers and a stack.
    the move instruction is 0x01.
  • 0
    @Etrunon thanks, git is gitlab.com/letItRain/Tangible 😀
  • 0
    @mclovinit wow thanks! 😀

    I am very, very far from done...
  • 0
    How are those assembly instructions executed in browser? Sorry if this question sounds dumb 😶
  • 0
    @coookie oh no, it's not dumb 😋

    basically it loops over the bytecode you've compiled to and then has a giant switch case.

    so:

    switch (byte_from_stream)
    {
    case 0x00:
    {
    // null, do nothing
    }
    case 0x01:
    {
    // move value to register or place in ram.
    }
    ..... and so on
    }
  • 0
    @coookie the various instructions can also do things like there's a call instruction. The call instruction can call a function. This is how you program interacts with the web browser.

    so when you tell a video player object to render, it sends a signal through Tangible and tangible updates everything and renders the video frame.
  • 0
    Oh so that means, Tangible has to be pretty deep inside the browser, probably sitting along side with v8 or any other engine?
  • 0
    @coookie Tangible is a specification as well as a piece of software, meaning you could implement it in any language, c++, javascript, PHP, anything Turing complete. However, if it were running not in JavaScript but in the browser natively it would be much, much faster.
  • 0
    Oh that clears it up, would like to see the perf gains though.
Add Comment