dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [DotGNU]Null check elimination & other stuff


From: Thong (Tum) Nguyen
Subject: RE: [DotGNU]Null check elimination & other stuff
Date: Wed, 16 Jun 2004 04:30:59 +1200

> -----Original Message-----
> From: Miroslaw Dobrzanski-Neumann [mailto:address@hidden
> Sent: Wednesday, 16 June 2004 01:44
> To: address@hidden
> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]