4 ms·
> in theory, there’s no way to translate assembler code. They way it runs is not how it reads Wat?
by monocasa 9y ago
> in theory, there’s no way to translate assembler code. They way it runs is not how it reads
Wat?
- anfilt 9y agoOh wow the article says that. "It does not run how it reads really..." that is the polar opposite of assembly. Compiled languages are more likely do thing under the head you don't expect especially a language ran in VM with garbage collection like Java. Also Java why? I would not trust a language system dependent oracle. The days of Sun Microsystems is sadly gone. =(
- pavel_lishin 9y agojhayward elsewhere in these comments explains what they might mean: https://news.ycombinator.com/item?id=16378486 https://news.ycombinator.com/item?id=16378486
- slededit 9y agoIf you do crazy "tricks" to get the space down like self modifying code or jumping into data then it won't run how it reads. It's a lot easier to do this in assembly because data and code aren't distinct.
- monocasa 9y agos360 has a lot of cool features for self modifying code like the 'ex' instruction. That tends to point out exactly what's happening when you read it. https://en.wikibooks.org/wiki/360_Assembly/360_Instructions/EX https://en.wikibooks.org/wiki/360_Assembly/360_Instructions/...
- tzs 9y agoOn the other hands, there are some "tricks" that someone trying to duplicate that functionality in a higher level language can do, too. For example, our computers nowadays are much faster and have much more memory. So suppose you have some long, tricky section of assembly code that you know computers some sort of function of a single 32-bit input. You could simply run that section, in a simulator, with all possible 32-bit inputs and make a table of the results. Then instead of trying to understand what is going on by following the convoluted assembly, your task is to implement the function given by that table. With the function in table form you can do things like look for sections that are linear, or constant, of follow other common patterns. Hopefully you can get some idea from context in the assembly code what, at a high level, the function is doing, and that should further help you see patterns in the table.
- slededit 9y agoAt that point you might as well embed an emulator with a facility to call to/from plain java code. Then you could gradually move things over as needed.
- phaedrus 9y agoI actually thought that sounds like an elegant starting premise (on the part of Jian Wang). That is, instead of starting with the assumption that you can translate it, start with the assumption that you can't (directly) translate it (and ask, "well then what can you do?") I believe a consequence of Rice's Theorem is that the quoted statement is more or less correct. However the technique of translating it to a simpler intermediate language, and moreover factoring out data as an explicit and separate stream, changes an intractable problem into a not-quite-intractable one. I'm pretty sure I've seen a pure-theory computer science paper, recently, which applies a similar technique on a completely different problem, but I can't remember where I saw it.
- InclinedPlane 9y agoI'll just leave this here: https://www.cs.utah.edu/~elb/folklore/mel.html https://www.cs.utah.edu/~elb/folklore/mel.html
- Terr_ 9y agoPerhaps https://en.wikipedia.org/wiki/Self-modifying_code https://en.wikipedia.org/wiki/Self-modifying_code