HenryCase wrote:
Yes it can. Let's say you rewrite the compiler to add a "-MPAROS" compiler flag. Then whenever you try and compile programs with this flag it follows certain rules to make programs compatible with an MP kernel. The resultant code is different from compiling it normally, but crucially you wouldn't need to rewrite the application code yourself.
Let me give you an idea as to how difficult this would be. An MP version of the Amiga OS API would have to place restrictions on memory used in messages. All memory referenced in a message would have to be shared, or at least shared with the recipient. Old programs could use any memory, and might even allocate a message on the stack (which would be private). So the first step would be to re-allocate the message in shared memory.
So far so good. Unfortunately, this message could contain pointers to other memory. A compiler might know that some are pointers. However, coders have a tendency to do naughty things, and might write a pointer into a variable declared as an integer. Even if a coder does follow the rules, a pointer to an array or image, won't tell you how big that array or image is; and, if it's a dynamically allocated memory, you won't know at compile time (i.e., the compiler won't be able to do anything).
Now, to top everything off, this whole thing is recursive. The memory that is pointed to could point to other memory, which would point to other memory, etc.
This is why old apps would
have to run in a sand-boxed environment. Old apps would collectively run in a shared memory space (so yes, they can interfere with one-another), and any interaction with the OS would have to go through a compatibility layer that would repackage calls to use the new API.
Hans