RE: Null check elimination & other stuff

"Thong (Tum) Nguyen" <tum-x2aT3/[email protected]>
Newsgroups gmane.comp.gnu.dotgnu.developer
Message-ID <[email protected]>

> -----Original Message-----
> From: Miroslaw Dobrzanski-Neumann [mailto:[email protected]]
> Sent: Wednesday, 16 June 2004 01:44
> To: [email protected]
> Subject: Re: [DotGNU]Null check elimination & other stuff
> 
> 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?

I doubt it dictates addresses either.

> 
> 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.

Weird.  Is it possible to simply mark the first page as not readable?

> 
> 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

Yeah, I wasn't so sure about what would happen with platforms that aren't
windows or linux which is why those platforms are the only ones with it
currently enabled :).  It'd be good if I could find a book on such issues..

Regards,

^Tum
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.