21.01.2013 Views

Lecture Notes in Computer Science 4917

Lecture Notes in Computer Science 4917

Lecture Notes in Computer Science 4917

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Fast Bounds Check<strong>in</strong>g Us<strong>in</strong>g Debug Register 101<br />

The general bounds check<strong>in</strong>g problem requires check<strong>in</strong>g for each memory reference,<br />

<strong>in</strong>clud<strong>in</strong>g references to a field with<strong>in</strong> a C-like structure. Because Boud<br />

<strong>in</strong>curs a per-array-use set-up overhead, the debug register approach only makes<br />

sense for array-like references <strong>in</strong>side a loop, i.e., those of the form A[i], A++,<br />

++A, A--, or --A, whereA could be a po<strong>in</strong>ter to a static array or a dynamically<br />

allocated buffer. For example, if a dynamic buffer is allocated through a<br />

malloc() call of the follow<strong>in</strong>g form<br />

X = (* TYPE) malloc(N * sizeof(TYPE))<br />

where N is larger than 1, then Boud takes X as a po<strong>in</strong>ter <strong>in</strong>to an array of N elements,<br />

and Boud will check the references based on X if these references are used<br />

<strong>in</strong>side a loop. For array-like references outside loops, Boud applies conventional<br />

software-based bounds check<strong>in</strong>g.<br />

The rest of this paper is organized as follows. Section 2 reviews previous work<br />

on array bound check<strong>in</strong>g and contrasts Boud with these efforts. Section 3 describes<br />

the detailed design decisions of the Boud compiler and their rationale.<br />

Section 4 presents a performance evaluation of the Boud compiler based on a set<br />

of array-<strong>in</strong>tensive programs, and a discussion of various performance overheads<br />

associated with the Boud approach. Section 5 concludes this paper with a summary<br />

of the ma<strong>in</strong> research ideas and a brief outl<strong>in</strong>e of the on-go<strong>in</strong>g improvements<br />

to the Boud prototype.<br />

2 Related Work<br />

Most previous array bounds check<strong>in</strong>g research focused on the m<strong>in</strong>imization of<br />

run-time performance overhead. One notable exception is the work from the<br />

Imperial College group [13], which chose to attack the reference/objection association<br />

problem <strong>in</strong> the presence of legacy library rout<strong>in</strong>es. The general approach<br />

towards optimiz<strong>in</strong>g array bounds check<strong>in</strong>g overhead is to elim<strong>in</strong>ate unnecessary<br />

checks, so that the number of checks is reduced. Gupta [17, 18] proposed a flow<br />

analysis technique that avoids redundant bounds checks <strong>in</strong> such a way that it<br />

still guaranteed to identify any array bound violation <strong>in</strong> the <strong>in</strong>put programs,<br />

although it does not necessarily detect these violations immediately after they<br />

occur at run time. By trad<strong>in</strong>g detection immediacy for reduced overhead, this<br />

approach is able to hoist some of the bounds check<strong>in</strong>g code outside the loop<br />

and thus reduce the performance cost of array bounds check<strong>in</strong>g significantly.<br />

Asuru [12] and Kolte and Wolfe [14] extended this work with more detailed<br />

analysis to further reduce the range check overhead.<br />

Concurrent array bounds check<strong>in</strong>g [7] first derives from a given program a<br />

reduce version that conta<strong>in</strong>s all the array references and their associated bounds<br />

check<strong>in</strong>g code, and then runs the derived version and the orig<strong>in</strong>al version on separate<br />

processors <strong>in</strong> parallel. With the aid of a separate processor, this approach<br />

is able to achieve the lowest array bounds check<strong>in</strong>g overhead reported until the<br />

arrival of Boud.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!