Re: [rvm-research] Array bound check elimination

Erik Brangs <[email protected]>
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <[email protected]>
Hi,

On 29.04.2015 20:50, Ricardo Coelho wrote:
> I tried to look into the code to search for the areas were bound checking was being made so I could study this issue a bit more. Unfortunately I still haven't found neither the prototype or the places were this procedures are done.
> Can someone point me in the right direction, or provide me with some info that you have that might be relevant? I'm still new to this so I apologize if I'm missing the obvious.
> Any help would be much appreciated.
The array bound checks are not implemented in the Jikes RVM itself, i.e. an application method does not call back into the Jikes RVM to do array bounds checking. The compilers put the array bound checks directly into the code that is generated for the application method.

For the optimizing compiler, the initial array bound checks are generated during the transformation from bytecode to high-level intermediate representation in BC2IR. The switch statement in generateFrom() is responsible for generating the initial intermediate representation for all the bytecodes in the method. If you look at a bytecode for array accesses, e.g. aaload (search for "case JBC_aaload:" in BC2IR), you will see that it calls do_BoundsCheck(..) which inserts the bound check. You'll see that do_BoundsCheck(..) uses the BOUNDS_CHECK operator. To find all the places in the optimizing compiler that deal with BOUNDS_CHECK, you can search for BOUNDS_CHECK (and BOUNDS_CHECK_opcode). There may also be some places that deal with an IR operator by querying its properties via the Instruction
  class (e.g. by calling methods such as isMove() or isCompare()).

There are several approaches to finding the code for the removed prototype. For example, you could search through the Mercurial history of the project with some tool, e.g. hg grep. IMHO it is normally best to try to search the commit log first (e.g. by using hg log to redirect the log to some file and then searching that file). For example, you already found the JIRA issue about global bound check elimination at https://xtenlang.atlassian.net/browse/RVM-564 which mentions ABCD. That issue links to a Sourceforge tracker item where it's mentioned that the original ABCD prototype was removed in version 2.2.1. So you know that the commit log for the versions between 2.2.1 and its predecessor should have the commits for the removal of the array bound check elimintation. You could look at all th
 ose commits by hand but if you search for "ABCD", you will find a commit by Stephen Fink that claims to delete ABCD. That commit is incomplete but the the commit immediately following it removes the 
old ABCD ("Array Bound Check Elimination on Demand") implementation.


Kind regards,

Erik Brangs

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
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.