Skip to content

SpecPriv

Ziyang Xu edited this page Feb 10, 2021 · 3 revisions

Speculative Privatization Profiler

Points-to Profiler

Description in the paper (Johnson et al. PLDI '12)

The profiler names dynamic objects (e.g., malloc or new) or stack slots according to the instruction which allocates them and a dynamic context. The dynamic context distinguishes dynamic instances of a static instruction by listing the function and loop invocations which enclose that instruction. The points-to-object profiler instruments the program to maintain a interval map from ranges of memory addresses to the name of the memory object which occupies the space. This interval map enables the profiled program to determine the name of the object referenced by any pointer during a profiling run. The profiler instruments every pointer that cannot be mapped to a unique object at compile time. The profiler accumulates this information over program execution. Finally, this profiler tracks the allocation and deallocation of memory objects with respect to dynamic contexts. This information allows the compiler to characterize the lifetime of objects and distinguish between short- and long-lived objects, supporting object lifetime speculation. Short-lived objects exist only within a single iteration of a loop.

Profile API

  • __prof_begin()

    guaranteed to be called before any other...

  • void __prof_malloc(const char *name, void *ptr, uin64_t size)

    report that a heap allocation occurred in the current context.

  • void __prof_realloc(const char *name, void *old_ptr, void *new_ptr, uint64_t size)

    report that a heap object was allocated/resized/freed.

  • void __prof_free(const char *name, void *ptr)

    report that a heap object was freed in the current context.

  • void __prof_report_global(const char *name, void *base, uint64_t size)

    called at program startup; reports base and size of a static allocation unit.

  • void __prof_report_constant(const char *name, void *base, uint64_t size)

    • called at program startup; reports base and size of a symbol in constant memory.
    • constants may have overlapping addresses with one another.
  • void __prof_report_stack(const char *name, void *base, uint64_t array_size, uint64_t elt_size)

    report that a stack object was allocated in the current context.

  • void __prof_begin_function(const char *name)

    report that a function invocation has begun.

  • void __prof_end_function(const char *name)

    • report that a function invocation has ended.
    • Implicitly frees all stack allocation units.
  • void __prof_begin_iter(const char *loop_name)

    report that a new iteration of the loop has begun.

  • void __prof_end_iter(const char *loop_name)

    report that the current iteration of the loop has ended.

  • void __prof_find_underlying_object(const char *name, void *ptr)

    • asks the runtime system to determine which allocation unit the pointer belongs to.
    • record that in the underlying object table for name.
  • void __prof_predict_int(const char *name, uint64_t zext_value)

    asks the runtime system to determine if the given value is predictable for a given loop. Record that in the predictable integer table for name at the given context.

  • void __prof_predict_ptr(const char *name, void *ptr)

    asks the runtime system to determine if the given pointer is predictable (i.e. null or a consistent offset within a consistent allocation unit). Record that in the predictable pointer table for name at the given context.

Clone this wiki locally