5 ms·
I agree with you. However, a quick personal anecdote: I tried to create "assembler", in python, for just one instruction, MOV. And not even 64, or 32-bit, (it
by fizixer 7y ago
I agree with you. However, a quick personal anecdote:
I tried to create "assembler", in python, for just one instruction, MOV. And not even 64, or 32-bit, (it was either 16-bit or 8-bit).
After scratching my head with all the corner cases, and handling about 80% of them, my python code looked like a complete mess.
There is an article floating around (posted here multiple times) that says MOV is turing complete [0].
[0] https://www.google.com/search?q=MOV+is+turing+complete https://www.google.com/search?q=MOV+is+turing+complete
- nikeee 7y agoOne simple way to show that MOV is turing complete is how this project does it: https://github.com/xoreaxeaxeax/movfuscator https://github.com/xoreaxeaxeax/movfuscator This compiler compiles C to MOV instructions only.
- blattimwind 7y agoMOV+ is a mnemonic for at least something like two or three dozen different opcodes though.
- vidarh 7y agoBut a compiler does not need to be able to generate every version in a generic way. You only need to generate the variations you're specifically intending to use.
- wolfgke 7y ago> There is an article floating around (posted here multiple times) that says MOV is turing complete [0]. Don't believe this claim - any computer has only access to a finite amount of memory while a Turing machine needs an infinite tape to work. So the proof must be false. In other words: only a mathematically idealized version of MOV might be Turing complete - but this cannot be the MOV that x86 implements.
- chrisseaton 7y agoCone on... anyone reading the claim knows it has a silent ‘(but obviously with a machine-bound tape)’ at the end of it.
- wolfgke 7y agoThe class of machines with the ‘(but obviously with a machine-bound tape)’ are even weaker than finite-state machines (because the number of states is bound by a fixed constant instead of "just" assumed to be finite). So if you argue that the silent ‘(but obviously with a machine-bound tape)’ assumption is OK, you argue that it is OK to identify Turing machines with a class of machines that is even weaker than finite-state machines. Any professor for (theoretical) computer science will be horrified by such claims.
- chrisseaton 7y agoIf your program finishes without reaching the limit of tape then it doesn’t matter that the tape was limited. It’s not about classes of machines. A machine with a limited tape is a perfect approximation for the proper class of a machine with an unlimited tape if the limit is not reached for all programs you care about. Professors won’t be horrified - they also use the silent parenthetical constraint. Look for example at formal publications like Dolan’s and see how academics talk about it.
- msla 7y agoIf you want to be pedantic, let's get pedantic. Turing-completeness isn't a property of computational models, it's a property of problems. A problem is Turing-complete when it cannot be solved by any computational model less powerful than a Turing Machine, or other Turing-equivalent computational system, such as the Lambda Calculus. Moreover, a Turing machine does not have an infinite tape. It has an unbounded tape. Its tape is not limitless, it is extensible, such that a computation cannot fail due to running out of tape. Hey, you wanted to get pedantic. Finally, in practical land, the distinction between Turing-equivalent and non-Turing-equivalent is very relevant to real programming languages: Epigram is pointedly not Turing-equivalent, and therefore it's possible to prove programs in that language will halt. Moving away from Turing-equivalence frees you from the tyranny of the Halting Problem. https://scienceblogs.com/goodmath/2007/01/05/turing-equivalent-vs-turing-co https://scienceblogs.com/goodmath/2007/01/05/turing-equivale... https://en.wikipedia.org/wiki/Epigram_(programming_language) https://en.wikipedia.org/wiki/Epigram_(programming_language)
- userbinator 7y agoI'm not sure what you mean by "corner cases" with MOV, unless you mean things like segment registers (which are rarely if ever going to be emitted by a compiler.) There's reg<imm, m/r<imm, and m/r<>reg. That last one makes up the majority of MOV instructions a compiler will emit. Also, the opcodes (and especially the ModRM) make far more sense when written in Octal - see http://www.dabo.de/ccc99/www.camp.ccc.de/radio/help.txt http://www.dabo.de/ccc99/www.camp.ccc.de/radio/help.txt
- cpeterso 7y agoLike the one instruction set computer (OISC) architecture? https://en.wikipedia.org/wiki/One_instruction_set_computer https://en.wikipedia.org/wiki/One_instruction_set_computer