Talk:NEWP
This article has not yet been rated on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
|
Memory array M?
[edit]I have included my recollections and understanding about the global memory array M and restriction of scope to blocks annotated with UNSAFE (MEMORY). Perhaps someone more familiar with M could confirm that is correct, or modify accordingly. Ian.joyner (talk) 00:13, 16 September 2024 (UTC)
Machine instructions are generated directly from each source statement?
[edit]The article claims that "...the machine instructions are generated directly from each source statement."
What does "directly" mean here?
A statement such as a := (b*c) + (d*e*f);
would, on a stack machine, generate code with a combination of push, arithmetic, and pop instructions; that's not direct. There's more than one sequence of code that could be generated; for example, it could be compiled into
push b
push c
mul
push d
push e
push f
mul
mul
add
pop a
push d
push e
push f
mul
mul
push b
push c
mul
add
pop a
or into
push d
push e
mul
push f
mul
push b
push c
mul
add
pop a
If your stack machine has two top-of-stack registers, so that up to two stacked operands can be accessed without fetching from memory or a cache, the third of those is the best code, as it only has to spill a top-of-stack register to memory on one occasion (the push c
instruction). Even if it has three top-of-stack registers, both the second and third of those are better than the first.
And neither of those are direct images of the code, as NEWP, like most programming languages, uses algebraic notation, not reverse-Polish notation, for arithmetic expressions. Guy Harris (talk) 19:05, 16 October 2024 (UTC)
- Good point. It is a bit vague. I have modified the paragraph to "NEWP is closely tied to the features and semantics of the platform and MCP itself. Since this is the case, there has never been a need for assembly language on these systems since ESPOL in 1961, and no assembler is provided, even for internal Burroughs/Unisys use. NEWP (and ESPOL) programmers are familiar with the way the machine works as a stack machine and the instruction set, since each source statement relates closely to the generated machine instructions. This contributes to the platform as a secure multiprocessing system, since general programmers cannot use any assembler and NEWP is itself limited mostly to writing an operating system, particularly the MCP."
- The intent of that paragraph is to explain why there is no need for assembler and the security comment also clarified to reflect that since general programming cannot be done either in assembler and not even in NEWP itself for the dangerous facilities.
- Does this make it clearer for readers? Ian.joyner (talk) 01:40, 17 October 2024 (UTC)
- Again, in what way does "each source statement relates closely to the generated machine instructions"? Programmers may know thet arithmetic and logical (bitwise) operations are evaluated using an evaluation stack, but 1) do they know the exact sequence of operations with which a particular expression (other than, say, a trivial expression with two operands, where it's obviously going to be push, push, operation) will be implemented, or do they just know that it'll be some sequence of pushes and arithmetic operations, and 2) does it matter and do they care what the sequence is? That strikes me as something that's "below the language layer" even for a low-level language. The only place where the particular instructions matter might be
UNSAFE
code such as the intrinsics that correspond to machine instructions. - As for the security, that sounds as if the "they know what machine code is generated" (to what extent that's true) isn't relevant there, and the part that's relevant is that NEWP in
UNSAFE
mode is the only place where unsafe code is generated is what matters. (I'm assuming here that some forms ofUNSAFE
mode code can be executed outside control state, so that, whilst some protection is provided by privileged instructions being executable only in control state, other protection is provided by only allowing "blessed"UNSAFE
mode code to be executed at all. If not, then it's just "privileged mode vs. unprivileged mode", as on the other general-purpose computers out there.) Guy Harris (talk) 05:45, 17 October 2024 (UTC)- Specifying how each source statement relates to the generated instructions would be too detailed for an encyclopaedia article where people are coming for general information for background interest, even more so for the introductory section (which is far too long in many WP entries).
- The statement is true, which anyone who has used Burroughs system languages will tell you from setting the $list code options.
- "1) do they know the exact sequence of operations"
- No the sequence does not need to be exact.
- "2) does it matter and do they care what the sequence is?"
- Actually, less than most other architectures or languages. However, remember NEWP is for writing the MCP OS, not for general programming. In fact, if someone writes a program in NEWP, it won't run without special steps taken securely (which most installations simply would not do).
- I don't think the second paragraph is relevant to the discussion or article. Ian.joyner (talk) 08:50, 18 October 2024 (UTC)
Actually, less than most other architectures or languages.
So the sequence of operations generated for a NEWP statement matters less than does the sequence of operations generated for ALGOL, DCALGOL, DMALGOL, COBOL, or FORTRAN 77? Or NEWP programmers care less about the generated sequence of operations than do ALGOL, DCALGOL, DMALGOL, COBOL, or FORTRAN 77 programmers?However, remember NEWP is for writing the MCP OS, not for general programming.
Why, except in a tiny number of places, would the exact sequence of operations matter more, or less, for OS programming? I've worked on a fair bit of OS code and rarely, if ever, have had to know or care about the sequence of operations generated by the optimizing compilers used to compile that code. Guy Harris (talk) 18:04, 28 October 2024 (UTC)
- Again, in what way does "each source statement relates closely to the generated machine instructions"? Programmers may know thet arithmetic and logical (bitwise) operations are evaluated using an evaluation stack, but 1) do they know the exact sequence of operations with which a particular expression (other than, say, a trivial expression with two operands, where it's obviously going to be push, push, operation) will be implemented, or do they just know that it'll be some sequence of pushes and arithmetic operations, and 2) does it matter and do they care what the sequence is? That strikes me as something that's "below the language layer" even for a low-level language. The only place where the particular instructions matter might be