summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-12-21 11:56:36 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2007-12-21 11:56:36 +0000
commit1b92dad28f9ab2058aff0c1bc688107f4d4c56f1 (patch)
treec90bffd7e66c6c3c2ed307b24aed2cdea1280d57
parentd8a4f8c23d23f62ca81cc47f8284ec29adb7050a (diff)
Ensure the frames are translated before use.
-rw-r--r--src/app.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/app.c b/src/app.c
index b607aff..2f8d015 100644
--- a/src/app.c
+++ b/src/app.c
@@ -106,8 +106,10 @@ client_perm_alloc (Client *client, guint size)
client->perm_chunks = c;
}
+#define align(x, y) (((x) + ((y)-1)) & -(y))
mem = c->mem + c->used;
- c->used += size;
+ c->used += align (size, 2 * sizeof (gpointer));
+#undef align
#else
mem = g_malloc (size);
#endif
@@ -609,6 +611,23 @@ app_set_blocks (App *app, Block *blocks)
}
static void
+_client_lookup_frames (Client *client)
+{
+ Allocator *A;
+ guint n;
+
+ for (A = client->allocators; A != NULL; A = A->next) {
+ if (A->alloc_fn_serial)
+ break;
+
+ for (n = 0; n < A->n_frames; n++) {
+ A->frames[n] = frames_get (&client->frames,
+ ((gulong *)A->frames)[n]);
+ }
+ }
+}
+
+static void
_client_update_alloc_fn (Client *client)
{
Allocator *A;
@@ -619,13 +638,6 @@ _client_update_alloc_fn (Client *client)
if (A->alloc_fn_serial == serial)
break;
- if (A->alloc_fn_serial == 0) {
- for (n = 0; n < A->n_frames; n++) {
- A->frames[n] = frames_get (&client->frames,
- ((gulong *)A->frames)[n]);
- }
- }
-
for (n = 0; n < A->n_frames - 1; n++) {
if (! frames_is_alloc_fn (&client->frames, A->frames[n]))
break;
@@ -1880,12 +1892,12 @@ _update_client (App *app)
app_set_busy (app, TRUE);
shared_objects_lookup_symbols (&app->client.objects);
-
- app_set_blocks (app, app->client.blocks);
-
+ _client_lookup_frames (&app->client);
_client_update_alloc_fn (&app->client);
_client_update_max_bytes (&app->client);
+ app_set_blocks (app, app->client.blocks);
+
call_graph_store_update (app->client.call_graph,
app,
app->client.allocators,