mirror of
https://gitlab.com/c3d/db48x.git
synced 2024-09-29 05:36:58 +02:00
simulator: Cache key value in stack instrumentation
Just make sure that we read the value only once, as it's possibly written by another thread, so it's better to have a single value in the instrumentation. Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
parent
fcea67bdd6
commit
3aca2e871b
1 changed files with 10 additions and 5 deletions
15
src/stack.cc
15
src/stack.cc
|
@ -130,6 +130,7 @@ void stack::draw_stack()
|
|||
{
|
||||
graph = obj->graph(g);
|
||||
} while (!graph && Settings.AutoScaleStack() && g.reduce_font());
|
||||
|
||||
if (graph)
|
||||
{
|
||||
size gh = graph->height();
|
||||
|
@ -140,15 +141,17 @@ void stack::draw_stack()
|
|||
#ifdef SIMULATOR
|
||||
if (level == 0)
|
||||
{
|
||||
extern int last_key;
|
||||
bool ml = (level ? Settings.MultiLineStack()
|
||||
: Settings.MultiLineResult());
|
||||
renderer r(nullptr, ~0U, true, ml);
|
||||
size_t len = obj->render(r);
|
||||
utf8 out = r.text();
|
||||
output(last_key, obj->type(), out, len);
|
||||
int key = last_key;
|
||||
output(key, obj->type(), out, len);
|
||||
record(tests,
|
||||
"Key %d X-reg %+s size %u %s",
|
||||
last_key, object::name(obj->type()), len, out);
|
||||
key, object::name(obj->type()), len, out);
|
||||
}
|
||||
#endif // SIMULATOR
|
||||
}
|
||||
|
@ -177,10 +180,12 @@ void stack::draw_stack()
|
|||
#ifdef SIMULATOR
|
||||
if (level == 0)
|
||||
{
|
||||
output(last_key, obj->type(), out, len);
|
||||
extern int last_key;
|
||||
int key = last_key;
|
||||
output(key, obj->type(), out, len);
|
||||
record(tests,
|
||||
"Key %d X-reg %+s size %u %s",
|
||||
last_key, object::name(obj->type()), len, out);
|
||||
"Stack key %d X-reg %+s size %u %s",
|
||||
key, object::name(obj->type()), len, out);
|
||||
}
|
||||
#endif
|
||||
w = font->width(out, len);
|
||||
|
|
Loading…
Reference in a new issue