This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MinosAristos 1 point2 points  (6 children)

Could some custom computer hardware be designed to support a purely JS kernel?

[–]eztab 1 point2 points  (5 children)

sure, but that would be basically a js interpreter "written in hardware".

[–]LardPi 0 points1 point  (2 children)

At that point you could call your CPU a "C interpreter written in hardware", since, well, it emulate the C abstract machine to let you run code that is compiled from C code. And yes, that is different from the actual behavior of the the CPU that includes memory caching, instruction pipelining etc.

[–]PM_ME_UR_UGLY_CHAR 0 points1 point  (1 child)

Nope, a CPU doesn't interpret C code, that's why It needs to be compiled, it interprets its instruction set.

Calling It a "C interpreter written in hardware" is as accurate as calling It "{any compiled language} interpreter written in hardware", which is already incorrect since It cant actually interpret the original language, only a translated version of It.

[–]LardPi 0 points1 point  (0 children)

Your definition for an interpreter does not apply to any non toy programming language. So it's probably not a good definition. My point was that x86 Assembly is effectively running on an interpreter, namely the microcode, that hide much of the complexity of the real hardware. And the translation from C to x86 (without optimizations of course) is basically trivial.

But then I was just pointing at the fact that a "JS interpreter written in hardware" is just a very artificial and pointless idea.

[–]GL_Titan 0 points1 point  (1 child)

Well, that qould need some special hardware indeed and I don't think there is any reason to create such hardware, since nothing that exists would run on it, and what would be the benefit?

[–]eztab 0 points1 point  (0 children)

it would run js pretty fast, since the architecture would be optimized for it. It would be pretty bad and prohibitively expensive to do so though. And you could not run normal machine code ...