#include "opjitconv.h"
#include "opd_printf.h"
#include "op_libiberty.h"
#include "op_types.h"
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
Go to the source code of this file.
Typedefs | |
typedef int(* | compare_symbol )(void const *, void const *) |
Functions | |
static u32 | count_entries (void) |
static void | fill_entry_array (struct jitentry *entries[]) |
static struct jitentry ** | create_sorted_array (compare_symbol compare) |
static int | cmp_symbolname (void const *a, void const *b) |
static int | cmp_address (void const *a, void const *b) |
static void | resort_address (void) |
static void | resort_symbol (void) |
void | create_arrays (void) |
static void | insert_entry (struct jitentry *entry) |
static char * | replacement_name (char *s, int i) |
static void | invalidate_entry (struct jitentry *e) |
static void | invalidate_earlybirds (unsigned long long start_time) |
static int | select_one (int start_idx, int end_idx) |
static void | split_entry (struct jitentry *split, struct jitentry const *keep) |
static unsigned long long | eliminate_overlaps (int start_idx, int end_idx, int keep_idx) |
static int | handle_overlap_region (int start_idx, int end_idx) |
static int | scan_overlaps (void) |
int | resolve_overlaps (unsigned long long start_time) |
void | disambiguate_symbol_names (void) |
Handle symbols found in jitted code dump
Copyright IBM Corporation 2007
Definition in file jitsymbol.c.
typedef int(* compare_symbol)(void const *, void const *) |
Definition at line 30 of file jitsymbol.c.
static int cmp_address | ( | void const * | a, | |
void const * | b | |||
) | [static] |
Definition at line 76 of file jitsymbol.c.
References jitentry::vma.
Referenced by create_arrays(), and resort_address().
static int cmp_symbolname | ( | void const * | a, | |
void const * | b | |||
) | [static] |
Definition at line 67 of file jitsymbol.c.
References jitentry::symbol_name.
Referenced by create_arrays(), disambiguate_symbol_names(), and resort_symbol().
static u32 count_entries | ( | void | ) | [static] |
Definition at line 34 of file jitsymbol.c.
References jitentry_list, and jitentry::next.
Referenced by create_arrays().
void create_arrays | ( | void | ) |
Definition at line 121 of file jitsymbol.c.
References cmp_address(), cmp_symbolname(), count_entries(), create_sorted_array(), entries_address_ascending, entries_symbols_ascending, entry_count, and max_entry_count.
Referenced by op_jit_convert().
static struct jitentry** create_sorted_array | ( | compare_symbol | compare | ) | [static, read] |
Definition at line 56 of file jitsymbol.c.
References entry_count, and fill_entry_array().
Referenced by create_arrays().
void disambiguate_symbol_names | ( | void | ) |
Definition at line 522 of file jitsymbol.c.
References cmp_symbolname(), disambiguate_symbol_names(), entries_symbols_ascending, entry_count, replacement_name(), jitentry::sym_name_malloced, and jitentry::symbol_name.
Referenced by disambiguate_symbol_names(), and op_jit_convert().
static unsigned long long eliminate_overlaps | ( | int | start_idx, | |
int | end_idx, | |||
int | keep_idx | |||
) | [static] |
Definition at line 315 of file jitsymbol.c.
References jitentry::code_size, debug, entries_address_ascending, jitentry::life_end, jitentry::life_start, split_entry(), verbprintf, and jitentry::vma.
Referenced by handle_overlap_region().
static void fill_entry_array | ( | struct jitentry * | entries[] | ) | [static] |
Definition at line 44 of file jitsymbol.c.
References jitentry_list, and jitentry::next.
Referenced by create_sorted_array().
static int handle_overlap_region | ( | int | start_idx, | |
int | end_idx | |||
) | [static] |
Definition at line 370 of file jitsymbol.c.
References jitentry::code_size, debug, eliminate_overlaps(), entries_address_ascending, jitentry::life_end, jitentry::life_start, OP_JIT_CONV_FAIL, OP_JIT_CONV_OK, select_one(), jitentry::sym_name_malloced, jitentry::symbol_name, verbprintf, and jitentry::vma.
Referenced by scan_overlaps().
static void insert_entry | ( | struct jitentry * | entry | ) | [static] |
Definition at line 131 of file jitsymbol.c.
References entries_address_ascending, entries_symbols_ascending, entry_count, and max_entry_count.
Referenced by split_entry().
static void invalidate_earlybirds | ( | unsigned long long | start_time | ) | [static] |
Definition at line 185 of file jitsymbol.c.
References entries_address_ascending, entry_count, invalidate_entry(), jitentry::life_end, resort_address(), and resort_symbol().
Referenced by resolve_overlaps().
static void invalidate_entry | ( | struct jitentry * | e | ) | [static] |
Definition at line 174 of file jitsymbol.c.
References debug, jitentry::symbol_name, verbprintf, and jitentry::vma.
Referenced by invalidate_earlybirds(), and split_entry().
static char* replacement_name | ( | char * | s, | |
int | i | |||
) | [static] |
Definition at line 154 of file jitsymbol.c.
Referenced by disambiguate_symbol_names().
int resolve_overlaps | ( | unsigned long long | start_time | ) |
Definition at line 498 of file jitsymbol.c.
References debug, invalidate_earlybirds(), OP_JIT_CONV_FAIL, OP_JIT_CONV_OK, resort_address(), resort_symbol(), scan_overlaps(), and verbprintf.
Referenced by op_jit_convert().
static void resort_address | ( | void | ) | [static] |
Definition at line 89 of file jitsymbol.c.
References cmp_address(), entries_address_ascending, entry_count, and jitentry::vma.
Referenced by invalidate_earlybirds(), and resolve_overlaps().
static void resort_symbol | ( | void | ) | [static] |
Definition at line 112 of file jitsymbol.c.
References cmp_symbolname(), entries_address_ascending, entries_symbols_ascending, and entry_count.
Referenced by invalidate_earlybirds(), and resolve_overlaps().
static int scan_overlaps | ( | void | ) | [static] |
Take a symbol [i] and look for the next symbol(s) [j] that are overlapping symbol [i]. If a symbol [j] is found that is not overlapping symbol [i] the symbols [i]..[j-1] are handled to be not overlapping anymore. See descriptions of handle_overlap_region() and eliminate_overlaps() for further details of this handling. E.g. possible cases to be handled could be:
sym1 |-----------| sym2 |---|
sym1 |--------| sym2 |--------|
sym1 |--------| sym2 |-------| sym3 |---------|
But in the following case
sym1 |--------| sym2 |-------------| sym3 |----------|
sym3 would not overlap with sym1. Therefore handle_overlap_regio() would only be called for sym1 up to sym2.
Definition at line 427 of file jitsymbol.c.
References jitentry::code_size, debug, entries_address_ascending, entry_count, handle_overlap_region(), OP_JIT_CONV_FAIL, verbprintf, and jitentry::vma.
Referenced by resolve_overlaps().
static int select_one | ( | int | start_idx, | |
int | end_idx | |||
) | [static] |
Definition at line 207 of file jitsymbol.c.
References entries_address_ascending, jitentry::life_end, jitentry::life_start, and OP_JIT_CONV_FAIL.
Referenced by handle_overlap_region().
Definition at line 243 of file jitsymbol.c.
References jitentry::code, jitentry::code_size, debug, insert_entry(), invalidate_entry(), jitentry::life_end, jitentry::life_start, jitentry::sym_name_malloced, jitentry::symbol_name, verbprintf, and jitentry::vma.
Referenced by eliminate_overlaps().