You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider (and I'll use Rust syntax because I'm lazy) code like this:
traitT{fnm();}// A mappable modulestructS1;implTforS1{fnm(){ ...}}// An unmappable modulestructS2;implTforS2{fnm(){ ...}}fnmain(){let x:Box<dynT> = if ...{Box::new(S1)}else{Box::new(S2)};
x.m();
...}
We don't know statically if the indirect call x.m() will call S1::m or S2::m.
hwt solves this because PT merrily traces through both mappable and unmappable functions, so we know at run-time which m was called.
swt, though, doesn't know which m will be called. We could say "if the call to x.m() is followed by a mappable block that isn't ... then we called S1::m otherwise we called S2::m. However, there is a wonderful pathological case where we call S2::m which then calls S1::m: we can't distinguish that case from calling S1::m directly.
The problem is that swt needs to "look into" unmappable functions, but it can't do so. Fortunately we have a probable solution (in conjunction with @ptersilie and @Pavel-Durov). First, swt adds a func_record function at every indirect function which records the function pointer that's about to be called. So our main should be transformed by ykllvm into something like:
fnmain(){let x:Box<dynT> = if ...{Box::new(S1)}else{Box::new(S2)};func_record(x.m);
x.m();
...}
func_record allows us to check with 100% precision "do we have mapped blocks for the function pointed to by x?". We then change TraceAction from talking about "Mapped" and "Unmapped" blocks to "Mapped blocks" and "Indirect calls". This allows us to distinguish all the cases we could come up with so far.
This will also require a change in hwt so that it deals with this change to TraceAction.
The text was updated successfully, but these errors were encountered:
Consider (and I'll use Rust syntax because I'm lazy) code like this:
We don't know statically if the indirect call
x.m()
will callS1::m
orS2::m
.hwt solves this because PT merrily traces through both mappable and unmappable functions, so we know at run-time which
m
was called.swt, though, doesn't know which
m
will be called. We could say "if the call tox.m()
is followed by a mappable block that isn't...
then we calledS1::m
otherwise we calledS2::m
. However, there is a wonderful pathological case where we callS2::m
which then callsS1::m
: we can't distinguish that case from callingS1::m
directly.The problem is that swt needs to "look into" unmappable functions, but it can't do so. Fortunately we have a probable solution (in conjunction with @ptersilie and @Pavel-Durov). First, swt adds a
func_record
function at every indirect function which records the function pointer that's about to be called. So ourmain
should be transformed by ykllvm into something like:func_record
allows us to check with 100% precision "do we have mapped blocks for the function pointed to byx
?". We then changeTraceAction
from talking about "Mapped" and "Unmapped" blocks to "Mapped blocks" and "Indirect calls". This allows us to distinguish all the cases we could come up with so far.This will also require a change in hwt so that it deals with this change to
TraceAction
.The text was updated successfully, but these errors were encountered: