if (NUM_HW_REGS == 0) {
g_assert_not_reached ();
return -1;
- } else {
- return map_hw_reg_to_dwarf_reg [reg];
}
+
+ return map_hw_reg_to_dwarf_reg [reg];
}
static void
init_dwarf_reg_map (void)
{
- int i;
-
g_assert (NUM_HW_REGS > 0);
- for (i = 0; i < NUM_HW_REGS; ++i) {
+ for (int i = 0; i < NUM_HW_REGS; ++i) {
map_dwarf_reg_to_hw_reg [mono_hw_reg_to_dwarf_reg (i)] = i;
}
gint32 res = 0;
int shift = 0;
- while (TRUE) {
- guint8 b = *p;
+ guint8 b;
+
+ do {
+ b = *p;
p ++;
res = res | (((int)(b & 0x7f)) << shift);
shift += 7;
- if (!(b & 0x80)) {
- if (shift < 32 && (b & 0x40))
- res |= - (1 << shift);
- break;
- }
- }
+ } while (b & 0x80);
+
+ if (shift < 32 && (b & 0x40))
+ res |= - (1 << shift);
*endbuf = p;
guint8*
mono_unwind_ops_encode_full (GSList *unwind_ops, guint32 *out_len, gboolean enable_extensions)
{
- GSList *l;
MonoUnwindOp *op;
- int loc;
+ int loc = 0;
guint8 buf [4096];
guint8 *p, *res;
p = buf;
- loc = 0;
- l = unwind_ops;
- for (; l; l = l->next) {
+ for (GSList *l = unwind_ops; l; l = l->next) {
int reg;
op = (MonoUnwindOp *)l->data;
static G_GNUC_UNUSED void
print_dwarf_state (int cfa_reg, int cfa_offset, int ip, int nregs, Loc *locations, guint8 *reg_saved)
{
- int i;
-
printf ("\t%x: cfa=r%d+%d ", ip, cfa_reg, cfa_offset);
- for (i = 0; i < nregs; ++i)
+ for (int i = 0; i < nregs; ++i)
if (reg_saved [i] && locations [i].loc_type == LOC_OFFSET)
printf ("r%d@%d(cfa) ", i, locations [i].offset);
printf ("\n");
void
mono_unwind_cleanup (void)
{
- int i;
-
mono_os_mutex_destroy (&unwind_mutex);
if (!cached_info)
return;
- for (i = 0; i < cached_info_next; ++i) {
+ for (int i = 0; i < cached_info_next; ++i) {
MonoUnwindInfo *cached = cached_info [i];
g_free (cached);
decode_lsda (guint8 *lsda, guint8 *code, MonoJitExceptionInfo *ex_info, gpointer *type_info, guint32 *ex_info_len, int *this_reg, int *this_offset)
{
guint8 *p;
- int i, ncall_sites, this_encoding;
+ int ncall_sites, this_encoding;
guint32 mono_magic, version;
p = lsda;
if (ex_info_len)
*ex_info_len = ncall_sites;
- for (i = 0; i < ncall_sites; ++i) {
+ for (int i = 0; i < ncall_sites; ++i) {
int block_start_offset, block_size, landing_pad;
guint8 *tinfo;
while (p < cie + cie_len + 4) {
if (*p == DW_CFA_nop)
break;
- else
- decode_cie_op (p, &p);
+ decode_cie_op (p, &p);
}
memcpy (buf + i, cie_cfi, p - cie_cfi);
i += p - cie_cfi;
while (p < fde + fde_len + 4) {
if (*p == DW_CFA_nop)
break;
- else
- decode_cie_op (p, &p);
+ decode_cie_op (p, &p);
}
memcpy (buf + i, fde_cfi, p - fde_cfi);
i += p - fde_cfi;
/* Compute size of CIE unwind info it is DW_CFA_nop terminated */
p = cie_cfi;
- while (TRUE) {
- if (*p == DW_CFA_nop)
- break;
- else
- decode_cie_op (p, &p);
+ while (*p != DW_CFA_nop) {
+ decode_cie_op (p, &p);
}
cie_cfi_len = p - cie_cfi;
fde_cfi_len = (fde + fde_len - fde_cfi);