#define HASH_SIZE 9371
#define SMALL_HASH_SIZE 31
+#if defined(__native_client__) || defined(__native_client_codegen__)
+volatile int __nacl_thread_suspension_needed = 0;
+void __nacl_suspend_thread_if_needed() {}
+#endif
+
static int debug = 0;
static int collect_traces = 0;
static int show_traces = 0;
typedef struct {
uint64_t created;
uint64_t destroyed;
+ uint64_t live;
uint64_t max_live;
TraceDesc traces;
} HandleInfo;
if (htype > 3)
return 0;
handle_info [htype].created++;
+ handle_info [htype].live++;
add_trace_thread (thread, &handle_info [htype].traces, 1);
/* FIXME: we don't take into account timing here */
- if (handle_info [htype].created > handle_info [htype].max_live)
- handle_info [htype].max_live = handle_info [htype].created;
+ if (handle_info [htype].live > handle_info [htype].max_live)
+ handle_info [htype].max_live = handle_info [htype].live;
if (num_tracked_objects)
track_handle (OBJ_ADDR (objdiff), htype, handle);
if (debug)
uint32_t handle = decode_uleb128 (p, &p);
if (htype > 3)
return 0;
- handle_info [htype].created--;
+ handle_info [htype].destroyed ++;
+ handle_info [htype].live--;
if (debug)
fprintf (outfile, "handle (%s) %u destroyed\n", get_handle_name (htype), handle);
}