12 ms·
Slim Binaries (1997)
- dleslie 7y agoPDF is invalid and won't load.
- aloknnikhil 7y agoWorks fine on Safari for me.
- dleslie 7y agoFailed on Drive PDF on Android
- stronglikedan 7y agoAcrobat (Pro) isn't complaining. Looks like Drive PDF is what's invalid and won't load (the valid PDF).
- skykooler 7y agoWorks fine in Firefox.
- dunham 7y agoIt works in Chrome, but most viewers will fix minor corruption in PDFs. qpdf/poppler will tell you if they detect any issues, and they both say it's fine. So I suspect the issue is either your viewer, or the file somehow got corrupted on the path from the website to your viewer.
- jacinabox 7y agoIn the early aughts I was kicking around an idea for minimization of binaries/libraries. The idea was to take a compiled binary plus debug information, and use disassembly to work out which code paths are reachable from a selected set of entry points (say the ones used by your application). Then code paths which are considered "dead" would be zeroed out, preparing a minimized binary.
- ronsor 7y agosolution: run the application and find out what functions are/are not called.
- mrec 7y agoThat only tells you what functions got called on that run, for that run's sequence of inputs. https://fgiesen.wordpress.com/2012/04/08/metaprogramming-for-madmen/ https://fgiesen.wordpress.com/2012/04/08/metaprogramming-for... Taster: > In the menu at the start, cursor-down works, but cursor-up doesn’t (he never hit cursor-up in menus during the test run). The small enemies at the start can hit you, but he didn’t get hit by any enemy shots, so in the released version of .kkrieger enemy shots deal no damage.
- thefreeman 7y agoDon't most compilers already do this?
- acqq 7y agoSpeaking about C and C++ on Linux, I have an impression that the compilers seldom can decide that the whole functions aren't used, especially because most libraries and programs "export" "everything" by default, so only on run-time it can be decided what will be actually used -- the last linking step happens only when you start the program, by the loader.
- saagarjha 7y agoYeah, isn't this just link-time optimization?
- throwaway542134 7y agoIt's called dead code elimination/optimization and compilers can do it without LTO, with LTO you can can get more savings but ymmv.
- 7y ago
- sedatk 7y agoI was thinking to myself “why did these guys talk about inventing another Java, like it was a new thing?” then it hit me that the article was written in 1997. I mean Java existed back then but HotSpot JIT didn’t.
- lnanek2 7y agoYeah, this part: " We have implemented a system taking a wholly different approach that we call “slim binaries.” The object files in our system do not really contain native code for any particular processor at all, but a highly compact, architecture-neutral intermediate program representation " is basically the definition of Java byte code. Wikipedia search of the author seems to say he came up with it first, though: " His doctoral dissertation, entitled "Code Generation On-The-Fly: A Key To Portable Software"[11] proposed to make software portable among different target computer architectures by way of using on-the-fly compilation from a compressed intermediate data structure at load time. Two years later, the Java programming language and system were launched and took this idea mainstream, albeit using the term "just-in-time compilation" instead of the term "on-the-fly compilation" that Franz had used. " https://en.wikipedia.org/wiki/Michael_Franz https://en.wikipedia.org/wiki/Michael_Franz
- eterps 7y ago> is basically the definition of Java byte code Except that the slim binaries concept is not based on byte code at all, but more like a Huffman compressed abstract syntax tree. Not only are the binaries smaller, they can potentially be optimised further because no semantic information is lost. See also this blog post for more details: https://hokstad.com/semantic-dictionary-encoding https://hokstad.com/semantic-dictionary-encoding Original website on Wayback machine: https://web.archive.org/web/20020617132121/http://caesar.ics.uci.edu/oberon/research.html https://web.archive.org/web/20020617132121/http://caesar.ics...
- kragen 7y agoThe Self bytecode was pretty close to an abstract syntax tree, though not huffman-compressed. How is it that nobody has mentioned Self yet in this thread? Self was doing JIT compiling from a platform-independent bytecode in the late 80s and getting within a factor of 2 of C performance by the early 90s.
- rbanffy 7y agoHow architecture neutral is llvm's intermediate representation? It's interesting how not having the source code drove technology in the 90's.
- saagarjha 7y agoLLVM IR is relatively agnostic, but not so much so that you can use it to recompile for another architecture (unless you take effort to design an entire ABI to work around the platform-specific things that creep into it, as Apple did with arm64_32).
- wmf 7y agoIIRC, LLVM IR has ABI, word length, and endianness baked in so you could generate IR that's portable to, say, any 32-bit LE processor. Basically that was Chrome PNaCl.
- EdwardCoffin 7y agoThis reminds me of a technique used by another language I read about in the early nineties, used by a language called (I think) 'C@T' (don't bother Googling that: I found nothing relevant, and the results seem to be mostly NSFW). The technique was instruction interleaving. They supported several very different architectures from one platform-independent binary. I think they were x86, 68k, MIPS and SPARC. Each executable started with a boilerplate header: a bit of black magic which worked on all of the platforms (more on that below). When execution emerged at the end of the header, the instruction pointer was pointed at the entry point appropriate for the architecture it was executing on. Each entry point (one for each architecture) made sure that the instruction pointer would always jump over parts with the other architectures, to the next applicable instruction in the correct architecture. The boilerplate header worked something like this: the first few bytes, when interpreted on one particular architecture, would jump to the address immediately following the header, which was the starting point for that architecture's thread-of-control. All other architectures interpreted that instruction as something that was effectively a no-op for the purpose of flow control (like maybe added two registers into another register). Consequently, the next instruction would only be seen by one of the remaining architectures, and a similar process would peel off the remaining architectures, one-by-one, directing each to the appropriate real entry point for that architecture. As I recall they did not do something simple like have monolithic blocks of code separated by architecture: if there was a loop, the body of the loop had interleaved instructions for all architectures. I'm sure this was in the days before instruction caches were a thing. I think they were able to get some space savings with this, at least by sharing constant data segments (maybe). At the time I read it I did not appreciate some of what they did, and now I could but I can't find the article I read nor any papers about it. I probably read it in Computer Language or Dr. Dobbs or something like that, probably in the early nineties. If anyone else remembers this and can point me to a source, I'd love to revisit it. I think it might have been a project out of AT&T labs.
- kazinator 7y ago> I'm sure this was in the days before instruction caches were a thing. This would have to be before paged virtual memory was a thing, too.
- 7y ago
- saagarjha 7y ago> And since each fat binary usually contains only a single code image per supported architecture, rather than separate versions for different implementations of each architecture, fat binaries still do not solve the problem of intra-architectural hardware variation. $ lipo -info /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation Architectures in the fat file: /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation are: x86_64 x86_64h
- juliangoldsmith 7y agoHaswell wasn't quite out yet when the article was written, so that was true at the time.
- saagarjha 7y agoYeah, I know. Just pointing out that this is no longer true.
- Scaevolus 7y agoMicrosoft Office used a vaguely similar VM-based technique in the 90s, called P-Code. Cold functions in Office were compild to a space-efficient stack-based bytecode, minimizing how much native code had to be written and validated for each architecture. https://web.archive.org/web/20010222035711/http://msdn.microsoft.com/library/backgrnd/html/msdn_c7pcode2.htm https://web.archive.org/web/20010222035711/http://msdn.micro...
- acqq 7y agoNot similar at all, if you'd compare what which did. The p-code is practically assembly for a virtual CPU which uses more or less the same resources that assembly code for the "real" CPU would do, only does that with less bytes per instruction.
- NieDzejkob 7y agoPlease add [pdf] to the title next time. > If you submit a link to a video or pdf, please warn us by appending [video] or [pdf] to the title. https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html