4 ms·
> Everything runs on what is essentially a virtualization layer... the AS/400 instruction set (MI, or "machine interface") doesn't exist in any hardware, it's j
by skissane 5y ago
> Everything runs on what is essentially a virtualization layer... the AS/400 instruction set (MI, or "machine interface") doesn't exist in any hardware, it's just run on top of a translation layer on top of (these days) POWER
To nitpick your nitpick – MI isn't interpreted, it is compiled to machine code. Not JIT, AOT: when you compile a program, it actually goes through two steps. First it compiles the source code to MI, and saves that in the executable (program object). Second, it compiles the MI to machine code, and saves that in the executable too, in a different section of it. At runtime, the MI is ignored and the machine code is run. There is even a command to delete the MI part of the executable (called deleting the "observability"), and your program will still work after the MI is deleting because it isn't actually used at runtime.
When they transitioned from custom CISC [0] to POWER, if you still had the MI in your executable, the system would automatically recompile it to POWER machine code. If you had deleted the observability, it wouldn't run, and you'd have to recompile it from source. Theoretically, the same would apply if IBM ever decided to move IBM i to some other platform than POWER (such as ARM or x86), although I doubt that is ever going to happen.
Also, there are actually two versions of MI, old MI and new MI. Old MI (OMI) was used with OPM (Original Program Model) executables. OMI was the original AS/400 machine interface, and is in fact descended from the System/38 machine interface. Around the same time they moved to RISC, they introduced a new program model (ILE, Integrated Language Environment) and new MI (NMI) to go with it. OPM programs still run, but now the system translates OMI to NMI, and then NMI to machine code. Now, the interesting thing about NMI – OMI was indigenous to the 38/400, whereas NMI was actually just the internal intermediate language used by IBM's compilers on other platforms (such as AIX and OS/2), known as "W-code", with some 400-specific extensions. So, in the contemporary ILE world, MI is really just a compiler intermediate language, like LLVM IR is, and so isn't really anything that different from what happens on AIX or Linux or Windows or z/OS – the history and the marketing make it sound a lot different.
Now, I agree that IBM i isn't necessarily that fast. It has a very complex software stack, and while I find that complexity fascinating, no doubt it imposes performance costs. But the "virtualisation" aspect in itself doesn't cost much at all. I think the widespread use of 128-bit pointers is likely a bigger issue – although, the 128-bit pointers don't get used directly, they get converted to 64-bit pointers before actually being used – still that has to have some performance cost which other systems don't have to deal with.
But you can opt out of that by running your code in a "teraspace", in which case you just use 64-bit pointers and the 128-bit pointers are not used. If you are running Java code or PASE code (AIX compatibility subsystem), both use teraspaces, and if you avoid invoking OS services (as in a compute-heavy workload), your performance should be close to that of AIX on the same hardware.
[0] the CISC instruction set, IMPI, was inspired by the 370 instruction set but not compatible with it. For AS/400, I don't believe it has ever been publicly documented, but I'm led to believe the 400 CISC instruction set was just an evolution of the 38 CISC instruction set, which was publicly documented in this manual: http://www.bitsavers.org/pdf/ibm/system38/SC21-9037-3_IBM_System_38_Internal_Microprogramming_Instructions_Formats_and_Functions_Reference_4th_ed_198508.pdf http://www.bitsavers.org/pdf/ibm/system38/SC21-9037-3_IBM_Sy...
- monocasa 5y agoI don't think the parent said that it's interpreted, only that it sits on a translation layer which is true.
- skissane 5y agoOh yes. But the parent made it sound like having a "translation layer" makes it somehow unique. Contemporary IBM i, the "translation layer" is a modified form of compiler intermediate language copied from IBM's AIX/etc compilers, and as such isn't really fundamentally different from what happens on other platforms. It also made it sound like the translation layer had a performance cost – in itself, it doesn't, any more than LLVM IR has a performance cost. Some of the entities the bytecode/IR allows you to manipulate – such as 128-bit pointers – likely have some cost, but that is a cost of those entities, not of having a bytecode/IR in itself. Not saying there is nothing unique about AS/400. The single-level store is a big one, although in more recent decades there has been a big move away from it (teraspaces, PASE, migration from Classic to J9 JVM). I think the history of 38/400/i could be described like this: it started out with some very innovative, even in some way alien ideas – capability addressing, single address space single-level store, having a bytecode (as opposed to the real hardware's assembly language be the public interface to the OS), primitive object-orientation backed into the OS, a relational database embedded in the operating system (although how deeply integrated it really is has never been that clear), etc. At the same time, it mixed that up with some far less innovative traditional IBM technologies – COBOL, RPG, EBCDIC, block mode terminals, SNA, etc – so even from the start it was some odd hybrid of cutting-edge and trailing-edge ideas. But, gradually since, it has been moving away from that odd mix towards become a much more mainstream system. While the old MI bytecode was a public interface, the new MI bytecode documentation is only available under NDA, and is basically the same as IBM's proprietary compiler intermediate representation on their other platforms. The single address space single-level store exists, but now programmers are encouraged to run their code in a more traditional separate address architecture (teraspace) instead. With the move to POWER, an AIX compatibility subsystem (PASE) was introduced, and more and more code was ported from AIX – and more recently open source packages from Linux. Java was ported to it, and programmers were encouraged to develop in Java – and while IBM's original AS/400 JVM, the "Classic JVM", integrated Java with the original AS/400 single address space world, at some point it was replaced by a port of IBM J9 from AIX running in a teraspace, and now it really behaves no differently than J9 on any other platform does. It is a system which started out as a weird hybrid of the innovative and the traditional, but which has been gradually evolving to be come more and more mainstream, without dropping the backward compatibility necessary to support that original weird hybrid.