O_oDebating with myself whether this is a contradiction or a paradox.
Enigma.
Soma
O_oDebating with myself whether this is a contradiction or a paradox.
Enigma.
Soma
“Salem Was Wrong!” -- Pedant Necromancer
“Four isn't random!” -- Gibbering Mouther
Looks like you all scared MutantJohn (and ME xD) with all your highbrow talk. I believe a *very basic* VM problem could have been described to him in a much more easy way. (Confession: I know next to nothing about VMs, except having made a scripting language that Really Really Sucks).
I think my fundamental question was, how do you write an executable?
Is it really as simple as just opening a binary file and writing to it? That sounds almost too easy. I'm just curious, what do you write to it? Do you have an external table with a list of instructions available for the architecture? Like, you would parse the source and break it down and you have a basic set of instructions in a certain order. Is all you do then really just look up which assembly commands would be required and then write them to a binary file?
That sounds kind of easy. Which is why I think I can't be right which I know sounds weird but I've learned never to trust my own brain.
It's actually only a little more complicated than that. An executable tends to have several sections, including at least the following: code, read-only static data, and read-write static data. String constants often go in read-only data, unless they are used to initialize a writable char array. The executable also includes a table, whose location is known to the operating system, that defines where in the file all these sections are. The operating system loads the table, and then loads the various sections into their appropriate regions in memory.
Last edited by Elkvis; 10-14-2014 at 10:58 AM.
What can this strange device be?
When I touch it, it gives forth a sound
It's got wires that vibrate and give music
What can this thing be that I found?
O_oThat sounds kind of easy.
In the early days of some "DOS" (286?) systems, you could use the keyboard to directly write a headless binary (a COM variant) file to print a smiley face character. The binary was literally six or seven bytes.
*shrug*
Compared to optimizing, parsing and code generation really aren't that difficult at all.
Soma
“Salem Was Wrong!” -- Pedant Necromancer
“Four isn't random!” -- Gibbering Mouther
See PE and ELF. In that order, since the Portable Executable article is more extensive and better describes the purpose of an executable format. In short an executable must obey a rigid file format in order for the embedded instructions to be executed by the operating system. An executable is thus a file format no different than an image file, or a PDF file format. The distinguishing factor is that the operating system recognizes that format out of the box and knows it has to map the file onto memory and process its instructions.
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.