Re: [drlvm][jit] array bounds check implementation

2006-09-21 Thread Anton Luht

Hello, Egor,


 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.


Maybe it's worth to comment it and other tricks like this? Seems it's
not too obvious :)

--
Regards,
Anton Luht,
Intel Middleware Products Division

-
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [drlvm][jit] array bounds check implementation

2006-09-21 Thread Geir Magnusson Jr.


On Sep 21, 2006, at 8:01 AM, Anton Luht wrote:


Hello, Egor,


 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.


Maybe it's worth to comment it and other tricks like this? Seems it's
not too obvious :)


I agree.  As long as you are utterly convinced that this hack won't  
fail (rather than it be highly unlikely), sure...




--
Regards,
Anton Luht,
Intel Middleware Products Division

-
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [drlvm][jit] array bounds check implementation

2006-09-21 Thread Naveen Neelakantam


On Sep 21, 2006, at 5:01 AM, Anton Luht wrote:


Hello, Egor,


 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.


Maybe it's worth to comment it and other tricks like this? Seems it's
not too obvious :)


Yes please!

-
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[drlvm][jit] array bounds check implementation

2006-09-20 Thread Naveen Neelakantam

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [drlvm][jit] array bounds check implementation

2006-09-20 Thread Naveen Neelakantam
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.


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [drlvm][jit] array bounds check implementation

2006-09-20 Thread Geir Magnusson Jr.


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?




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: [EMAIL PROTECTED]
For additional commands, e-mail: harmony-dev- 
[EMAIL PROTECTED]





-
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [drlvm][jit] array bounds check implementation

2006-09-20 Thread Egor Pasko
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: [EMAIL PROTECTED]
  For additional commands, e-mail: harmony-dev-
  [EMAIL PROTECTED]
 
 
 
  -
  Terms of use : http://incubator.apache.org/harmony/mailing.html
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 Terms of use : http://incubator.apache.org/harmony/mailing.html
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-- 
Egor Pasko, Intel Managed Runtime Division


-
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]