void generate_unfolded_entries()

in src/c/perf-map-agent.c [110:157]


void generate_unfolded_entries(
        jvmtiEnv *jvmti,
        jmethodID method,
        jint code_size,
        const void* code_addr,
        jint map_length,
        const jvmtiAddrLocationMap* map,
        const void* compile_info) {
    int i;
    const jvmtiCompiledMethodLoadRecordHeader *header = compile_info;
    char root_name[1000];
    char entry_name[1000];
    char entry[1000];
    sig_string(jvmti, method, root_name, sizeof(root_name));
    if (header->kind == JVMTI_CMLR_INLINE_INFO) {
        const char *entry_p;
        const jvmtiCompiledMethodLoadInlineRecord *record = (jvmtiCompiledMethodLoadInlineRecord *) header;

        const void *start_addr = code_addr;
        jmethodID cur_method = method;
        for (i = 0; i < record->numpcs; i++) {
            PCStackInfo *info = &record->pcinfo[i];
            jmethodID top_method = info->methods[0];
            if (cur_method != top_method) {
                void *end_addr = info->pc;

                if (top_method != method) {
                    generate_unfolded_entry(jvmti, top_method, entry, sizeof(entry), root_name);
                    entry_p = entry;
                } else
                    entry_p = root_name;

                perf_map_write_entry(method_file, start_addr, end_addr - start_addr, entry_p);

                start_addr = info->pc;
                cur_method = top_method;
            }
        }
        if (start_addr != code_addr + code_size) {
            const void *end_addr = code_addr + code_size;

            generate_unfolded_entry(jvmti, cur_method, entry, sizeof(entry), root_name);

            perf_map_write_entry(method_file, start_addr, end_addr - start_addr, entry_p);
        }
    } else
        generate_single_entry(jvmti, method, code_addr, code_size);
}