|
From: <sv...@va...> - 2012-11-26 18:17:09
|
weidendo 2012-11-26 18:16:58 +0000 (Mon, 26 Nov 2012)
New Revision: 13143
Log:
Before LL, instrument outstanding helper calls.
Callgrind, Cachegrind, and Lackey call
helpers for memory accesses in bunches, to reduce
register save/restore overhead (and merge load/store
within same instruction into a "modify" event).
The calls should not be done within a RMW section
enclosed by LL/SC instructions, as this reduces the
chance of SC to succeed, and can result in hangs.
For Callgrind, this definitly helped MIPS, and was
committed in r13136. Do the same for Cachegrind/Lackey.
Modified files:
trunk/cachegrind/cg_main.c
trunk/lackey/lk_main.c
Modified: trunk/lackey/lk_main.c (+6 -2)
===================================================================
--- trunk/lackey/lk_main.c 2012-11-25 15:33:42 +00:00 (rev 13142)
+++ trunk/lackey/lk_main.c 2012-11-26 18:16:58 +00:00 (rev 13143)
@@ -428,7 +428,8 @@
At various points the list will need to be flushed, that is, IR
generated from it. That must happen before any possible exit from
the block (the end, or an IRStmt_Exit). Flushing also takes place
- when there is no space to add a new event.
+ when there is no space to add a new event, and before entering a
+ RMW (read-modify-write) section on processors supporting LL/SC.
If we require the simulation statistics to be up to date with
respect to possible memory exceptions, then the list would have to
@@ -825,9 +826,12 @@
if (st->Ist.LLSC.storedata == NULL) {
/* LL */
dataTy = typeOfIRTemp(tyenv, st->Ist.LLSC.result);
- if (clo_trace_mem)
+ if (clo_trace_mem) {
addEvent_Dr( sbOut, st->Ist.LLSC.addr,
sizeofIRType(dataTy) );
+ /* flush events before LL, helps SC to succeed */
+ flushEvents(sbOut);
+ }
if (clo_detailed_counts)
instrument_detail( sbOut, OpLoad, dataTy );
} else {
Modified: trunk/cachegrind/cg_main.c (+2 -0)
===================================================================
--- trunk/cachegrind/cg_main.c 2012-11-25 15:33:42 +00:00 (rev 13142)
+++ trunk/cachegrind/cg_main.c 2012-11-26 18:16:58 +00:00 (rev 13143)
@@ -1154,6 +1154,8 @@
dataTy = typeOfIRTemp(tyenv, st->Ist.LLSC.result);
addEvent_Dr( &cgs, curr_inode,
sizeofIRType(dataTy), st->Ist.LLSC.addr );
+ /* flush events before LL, should help SC to succeed */
+ flushEvents( &cgs );
} else {
/* SC */
dataTy = typeOfIRExpr(tyenv, st->Ist.LLSC.storedata);
|