harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Egor Pasko <egor.pa...@gmail.com>
Subject Re: [drlvm][jit] array bounds check implementation
Date Thu, 21 Sep 2006 04:40:32 GMT
On the 0x1EB day of Apache Harmony Geir Magnusson, Jr. wrote:
> On Sep 20, 2006, at 10:40 PM, Naveen Neelakantam wrote:
> 
> > Very clever!  It seems like an array bounds check is converted into
> > an unsigned comparison followed by a JNB on Ia32.  This single
> > compare-and-branch sequence correctly implements both the upper
> > bound and lower bound checks.  Because the comparison is unsigned,
> > a negative index will look like a very large positive index and
> > will fail the check.
> 
> Isn't that really just "faith based"?  What if you really do have a
> very large upper bound?

upper bounds are not larger than Integer.MAX_VALUE, and any negative
value in unsigned arithmetic is larger. I love this hack.

> >
> > Naveen
> >
> > On Sep 20, 2006, at 4:06 PM, Naveen Neelakantam wrote:
> >
> >> Hello,
> >>
> >> It seems that the Op_TauCheckBounds opcode in the HIR is converted
> >> into an upper bounds check during HIR->LIR conversion (see
> >> CodeGenerator.cpp and Ia32InstCodeSelector.cpp).  It does not seem
> >> that the corresponding lower bounds check is ever generated.
> >>
> >> Am I misunderstanding the code somehow?  It doesn't seem correct
> >> to me.
> >>
> >> Thanks,
> >> Naveen
> >>
> >> ---------------------------------------------------------------------
> >> Terms of use : http://incubator.apache.org/harmony/mailing.html
> >> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> >> For additional commands, e-mail: harmony-dev-
> >> help@incubator.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> 
> 

-- 
Egor Pasko, Intel Managed Runtime Division


---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message