Re: Null check elimination & other stuff
Miroslaw Dobrzanski-Neumann <[email protected]>
| Newsgroups | gmane.comp.gnu.dotgnu.developer |
|---|---|
| Message-ID | <[email protected]> |
Hello, Althou, fully implementing POSIX On Wed, Jun 16, 2004 at 12:55:49AM +1200, Thong (Tum) Nguyen wrote: > Hi guys, > > I've just checked in support for null check elimination from PNET. PNET > will still use the classical check for null references using an if/else > statement on unsupported platforms but now there is infrastructure to allow > it to not bother checking on supported platforms. It does this by trapping > and responding to segmentation faults that occur while the engine is > executing managed code. Most of the implementation is in support/interrupt* > and is platform & CPU specific (because registers need to be saved & > restored after the CVM recovers) but has been sufficiently (IMHO) abstracted > to keep PNET portable. I've added implementations for POSIX & WIN32 systems > though full POSIX support is only enabled for Linux until I can find other > systems to test on (see support/interrupt.h). I do not know it exactly but does POSIX require an exception when reading from address 0x0? Anyway, AIX Operating Systems (IBM), although fully POSIX compatible, do not forbid reading from the first page of process address space!! Writes are forbidden since AIX 4.x. This means that you get no SEGV for the following code: char *p = (char *)0x0; char c = *p; The IBM Visual Age C Compiler (xlc) has an option to enable this check -qcheck=nullptr. The IBM compiler generates a trap machine instructions like "twllti rA,256" where rA is the value to check but only if null ptr check is enabled. If you want to get rid of "if (a == nullptr) Reexecute_In_Cvm" you must use traps on plattforms like AIX and optimize their usage doing full featured null check elimination. Of course you must install SIGTRAP handler to handle it Regards, -- Mirosław Dobrzański-Neumann E-mail: [email protected] This message is utf-8 encoded