Javascript bytecode

Walter Bright newshound2 at digitalmars.com
Fri Dec 21 02:28:56 PST 2012


On 12/21/2012 12:37 AM, Rainer Schuetze wrote:
>
>
> On 21.12.2012 08:02, Walter Bright wrote:
>> On 12/20/2012 10:05 PM, deadalnix wrote:
>>> No you explained that java's bytecode doesn't solve that problem.
>>> Which is quite
>>> different.
>>
>> I did, but obviously you did not find that satisfactory. Let me put it
>> this way:
>>
>> Design a bytecode format, and present it here, that is CTFEable and is
>> not able to be automatically decompiled.
>
> Sorry, can't resist: How about feeding the x86 machine byte code (including some
> fixup information) into an interpreter? Maybe not realistic, but a data point in
> the field of possible "byte codes". The interpreter might even enjoy hardware
> support ;-)

Not going to work, as CTFE needs type information. CTFE needs to interact with 
the current symbols and types in the compilation unit.

Just think about what you'd need to do to get CTFE to read the object file for a 
module and try to execute the code in it, feeding it data and types and symbols 
from the current compilation unit? Consider:

     add EAX,37
     mov [EAX],EBX

what the heck is EAX pointing at?



More information about the Digitalmars-d mailing list