Hacker News new | past | comments | ask | show | jobs | submit login

It interesting that they compile into the UCSD P-Code.

Arguably, why not. It’s specifically designed to execute Pascal. Why reinvent the wheel.

One of the most interesting p-code instructions is LOD. This get the value of a local variable. The trick is that it takes two arguments. One them is simply the offset to the variable. The other, however, is from which procedure environment.

Pascal supports nested procedures. And because of that, within each nested procedure, they have access to all of the local variables in scope. So in order to access a parent local variable, the engine has to walk the stack references to the parent scope.

This walk is a first class concept in the p-code. It’s not just simple primitives like CPU. Most are, but much of the meat are the very architecture specific operations.

Similarly, calling procedures work hand in hand with the segment concept built into the system. A segment is much like a library. A collection of procedures, with an offset table for routing.

Much of this segment concept was pretty much lifted wholesale by the original Mac OS, as well as the Apple II GS. It’s a strikingly powerful system lurking within a pretty simple OS.




So "LOD" = "Line of Descent", or some such?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: