|
From: <sv...@va...> - 2012-04-24 11:49:13
|
sewardj 2012-04-24 12:49:03 +0100 (Tue, 24 Apr 2012)
New Revision: 2313
Log:
(stats only) Let the callers of LibVEX_Translate know how many guest
instructions got incorporated into the IRSB.
Modified files:
trunk/priv/guest_generic_bb_to_IR.c
trunk/priv/guest_generic_bb_to_IR.h
trunk/priv/main_main.c
trunk/pub/libvex.h
Modified: trunk/priv/guest_generic_bb_to_IR.h (+1 -0)
===================================================================
--- trunk/priv/guest_generic_bb_to_IR.h 2012-04-23 12:21:12 +01:00 (rev 2312)
+++ trunk/priv/guest_generic_bb_to_IR.h 2012-04-24 12:49:03 +01:00 (rev 2313)
@@ -164,6 +164,7 @@
IRSB* bb_to_IR (
/*OUT*/VexGuestExtents* vge,
/*OUT*/UInt* n_sc_extents,
+ /*OUT*/UInt* n_guest_instrs, /* stats only */
/*IN*/ void* callback_opaque,
/*IN*/ DisOneInstrFn dis_instr_fn,
/*IN*/ UChar* guest_code,
Modified: trunk/priv/guest_generic_bb_to_IR.c (+3 -0)
===================================================================
--- trunk/priv/guest_generic_bb_to_IR.c 2012-04-23 12:21:12 +01:00 (rev 2312)
+++ trunk/priv/guest_generic_bb_to_IR.c 2012-04-24 12:49:03 +01:00 (rev 2313)
@@ -180,6 +180,7 @@
IRSB* bb_to_IR (
/*OUT*/VexGuestExtents* vge,
/*OUT*/UInt* n_sc_extents,
+ /*OUT*/UInt* n_guest_instrs, /* stats only */
/*IN*/ void* callback_opaque,
/*IN*/ DisOneInstrFn dis_instr_fn,
/*IN*/ UChar* guest_code,
@@ -245,6 +246,7 @@
so far gone. */
delta = 0;
n_instrs = 0;
+ *n_guest_instrs = 0;
/* Guest addresses as IRConsts. Used in self-checks to specify the
restart-after-discard point. */
@@ -756,6 +758,7 @@
vex_printf( "\n");
}
+ *n_guest_instrs = n_instrs;
return irsb;
}
Modified: trunk/pub/libvex.h (+3 -0)
===================================================================
--- trunk/pub/libvex.h 2012-04-23 12:21:12 +01:00 (rev 2312)
+++ trunk/pub/libvex.h 2012-04-24 12:49:03 +01:00 (rev 2313)
@@ -491,6 +491,9 @@
/* Offset in generated code of the profile inc, or -1 if
none. Needed for later patching. */
Int offs_profInc;
+ /* Stats only: the number of guest insns included in the
+ translation. It may be zero (!). */
+ UInt n_guest_instrs;
}
VexTranslateResult;
Modified: trunk/priv/main_main.c (+5 -3)
===================================================================
--- trunk/priv/main_main.c 2012-04-23 12:21:12 +01:00 (rev 2312)
+++ trunk/priv/main_main.c 2012-04-24 12:49:03 +01:00 (rev 2313)
@@ -528,9 +528,10 @@
/* Set up result struct. */
VexTranslateResult res;
- res.status = VexTransOK;
- res.n_sc_extents = 0;
- res.offs_profInc = -1;
+ res.status = VexTransOK;
+ res.n_sc_extents = 0;
+ res.offs_profInc = -1;
+ res.n_guest_instrs = 0;
/* yet more sanity checks ... */
if (vta->arch_guest == vta->arch_host) {
@@ -549,6 +550,7 @@
irsb = bb_to_IR ( vta->guest_extents,
&res.n_sc_extents,
+ &res.n_guest_instrs,
vta->callback_opaque,
disInstrFn,
vta->guest_bytes,
|