Print this page
libdtrace: attempt to resolve FORWARD types to concrete types

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdtrace/common/dt_cg.c
          +++ new/usr/src/lib/libdtrace/common/dt_cg.c
↓ open down ↓ 33 lines elided ↑ open up ↑
  34   34  #include <sys/isa_defs.h>
  35   35  
  36   36  #include <strings.h>
  37   37  #include <stdlib.h>
  38   38  #include <setjmp.h>
  39   39  #include <assert.h>
  40   40  #include <errno.h>
  41   41  
  42   42  #include <dt_impl.h>
  43   43  #include <dt_grammar.h>
       44 +#include <dt_module.h>
  44   45  #include <dt_parser.h>
  45   46  #include <dt_provider.h>
  46   47  
  47   48  static void dt_cg_node(dt_node_t *, dt_irlist_t *, dt_regset_t *);
  48   49  
  49   50  static dt_irnode_t *
  50   51  dt_cg_node_alloc(uint_t label, dif_instr_t instr)
  51   52  {
  52   53          dt_irnode_t *dip = malloc(sizeof (dt_irnode_t));
  53   54  
↓ open down ↓ 9 lines elided ↑ open up ↑
  63   64  }
  64   65  
  65   66  /*
  66   67   * Code generator wrapper function for ctf_member_info.  If we are given a
  67   68   * reference to a forward declaration tag, search the entire type space for
  68   69   * the actual definition and then call ctf_member_info on the result.
  69   70   */
  70   71  static ctf_file_t *
  71   72  dt_cg_membinfo(ctf_file_t *fp, ctf_id_t type, const char *s, ctf_membinfo_t *mp)
  72   73  {
  73      -        while (ctf_type_kind(fp, type) == CTF_K_FORWARD) {
  74      -                char n[DT_TYPE_NAMELEN];
  75      -                dtrace_typeinfo_t dtt;
  76      -
  77      -                if (ctf_type_name(fp, type, n, sizeof (n)) == NULL ||
  78      -                    dt_type_lookup(n, &dtt) == -1 || (
  79      -                    dtt.dtt_ctfp == fp && dtt.dtt_type == type))
  80      -                        break; /* unable to improve our position */
  81      -
  82      -                fp = dtt.dtt_ctfp;
  83      -                type = ctf_type_resolve(fp, dtt.dtt_type);
  84      -        }
       74 +        dt_resolve_forward_decl(&fp, &type);
  85   75  
  86   76          if (ctf_member_info(fp, type, s, mp) == CTF_ERR)
  87   77                  return (NULL); /* ctf_errno is set for us */
  88   78  
  89   79          return (fp);
  90   80  }
  91   81  
  92   82  static void
  93   83  dt_cg_xsetx(dt_irlist_t *dlp, dt_ident_t *idp, uint_t lbl, int reg, uint64_t x)
  94   84  {
↓ open down ↓ 2045 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX