samiam95124 / Pascal-P6

6th version of Niklaus Wirth's original Pascal language compiler system
Other
28 stars 9 forks source link

Feature addition: Move to pulldown marks #4

Closed samiam95124 closed 1 year ago

samiam95124 commented 6 years ago

Proposed is we move to what I call "pulldown" marks for displays. The current mark/display system used in P5 matches no real machine, is inefficient, and is difficult/impossible to use with a real machine. Proposed is we go to "pull down" marks. This system is used in the I80386 processors, and works well with other machine types as well. The idea is that each time a block is entered, some number of display pointers are coped onto the stack from the old mark/display position. This is according to static depth. Ie, for a procedure nested within a procedure, which is itself nested in the program block, a total of 2 display pointers are "pulled down" with the newly executed procedure. Then, the location of locals/parameters in any given procedure/function/program can be accessed by simply fetching the display pointer copy from the stack (this scheme is outlined in the I80386 machine language manual). This system has more overhead on block invocation, but far less to access non-local variables. It is implemented in the I80386 "enter/leave" instructions but is easy to implement in other machine types (in fact it is not instruction implemented in amd64 mode).

samiam95124 commented 2 years ago

The code was analyzed, and decided there is no immediate advantage. So this is closed for now.

samiam95124 commented 2 years ago

I decided that framing is to ugly to implement as is. I have been going through the test suite and (re)applying it to P6. The idea is that major surgery like changing the framing will go better using TDD, so the test series must be as complete as possible.

samiam95124 commented 1 year ago

Implemented. Passes ISO 7185 PAT, implementation in pmach and cmach still needed, but the system works.

samiam95124 commented 1 year ago

Reopened pending completion of cmach implementation and subsequent regression (hey, I'm improving my professionalisim).

samiam95124 commented 1 year ago

Implemented in cmach, needs testing.

samiam95124 commented 1 year ago

Note this is being held for #14.

samiam95124 commented 1 year ago

Done, closing.