Lines Matching defs:output
65 Note that thanks to ld -r, the deduplicator can be fed its own output, so the
69 the caller provides a mapping of input TU names to output child dict names.
73 repeatedly, once for every output name that has more than one input, to fuse
74 all the input TUs associated with a given output dict into one, and once again
77 intermediate state, all the output TUs are in memory at once and cannot be
81 because this output is meant to *become* a child in the next link stage and
96 value: it is also stashed in the *output mapping*, a mapping from hash value
105 data volume to deal with than later phases. Trace output is hidden behind
109 down the volume of output (hundreds of gigabytes of debug output are not
113 like to avoid emitting forwards in the final output if possible, because
183 traversing the output mapping and using ctf_dedup_multiple_input_dicts to
197 Emission involves another walk of the entire output mapping, this time
200 the type itself. We sort the output mapping before traversing it, for
210 input GIDs corresponding to conflicted output types. The traverser only
211 finds input types and calls a callback for them as many times as the output
212 needs to appear: it doesn't try to figure out anything about where the output
221 input ctf_id_t into the corresponding type in the output (dealing with input
255 Finally, we update the input -> output type ID mappings used by the ctf-link
991 /* Hash a TYPE in the INPUT: FP is the eventual output, where the ctf_dedup
1047 copy recursively-cited hashes from the parent's types into the output
1153 machinery: the output mapping, the cd_name_counts mapping from name -> hash
1171 ctf_dprintf ("Hash %s, %s, into output mapping for %i/%lx @ %s\n",
1191 /* Record the type in the output mapping: if this is the first time this type
1235 ctf_err_warn (fp, 1, 0, "added wrong kind to output mapping "
1347 /* Look up a type kind from the output mapping, given a type hash value. */
1355 /* Precondition: the output mapping is populated. */
1359 /* Look up some GID from the output hash for this type. (They are all
1361 function wrongly, but do assert if the output mapping knows about the hash,
1715 /* Free the per-output state. */
1732 ctf_dedup_multiple_input_dicts (ctf_dict_t *output, ctf_dict_t **inputs,
1735 ctf_dedup_t *d = &output->ctf_dedup;
1750 if (!ctf_assert (output, type_ids))
1784 ctf_err_warn (output, 0, err, _("iteration error "
1786 return ctf_set_errno (output, err);
1797 if (!ctf_assert (output, type_id))
1810 if ((decorated = ctf_decorate_type_name (output, name,
1827 ctf_dedup_conflictify_unshared (ctf_dict_t *output, ctf_dict_t **inputs)
1829 ctf_dedup_t *d = &output->ctf_dedup;
1847 conflicting = !ctf_dedup_multiple_input_dicts (output, inputs, hval);
1863 if (ctf_dedup_mark_conflicting_hash (output, hval) < 0)
1874 ctf_set_errno (output, errno);
1876 err = ctf_errno (output);
1880 ctf_err_warn (output, 0, err, _("conflictifying unshared types"));
1881 return ctf_set_errno (output, err);
1884 /* The core deduplicator. Populate cd_output_mapping in the output ctf_dedup
1887 is conflicted or not. OUTPUT is the top-level output: INPUTS is the array of
1893 mapping: only one output will result.
1895 Only deduplicates: does not emit the types into the output. Call
1899 ctf_dedup (ctf_dict_t *output, ctf_dict_t **inputs, uint32_t ninputs,
1902 ctf_dedup_t *d = &output->ctf_dedup;
1906 if (ctf_dedup_init (output) < 0)
1915 ctf_set_errno (output, errno);
1916 ctf_err_warn (output, 0, errno, _("ctf_dedup: cannot initialize: %s\n"),
1923 because there is only one output and we really don't want to end up marking
1926 d->cd_link_flags = output->ctf_link_flags;
1945 if (ctf_dedup_hash_type (output, inputs[i], inputs,
1952 ctf_set_errno (output, ctf_errno (inputs[i]));
1953 ctf_err_warn (output, 0, 0, _("iteration failure "
1962 conflicting in the output. */
1965 if (ctf_dedup_detect_name_ambiguity (output, inputs) < 0)
1969 types whose output mapping references only one input dict into a
1975 if (ctf_dedup_conflictify_unshared (output, inputs) < 0)
1981 ctf_dedup_fini (output, NULL, 0);
1986 ctf_dedup_rwalk_output_mapping (ctf_dict_t *output, ctf_dict_t **inputs,
1991 ctf_dict_t *output,
2006 ctf_dedup_rwalk_one_output_mapping (ctf_dict_t *output,
2013 ctf_dict_t *output,
2025 ctf_dedup_t *d = &output->ctf_dedup;
2043 return visit_fun (hval, output, inputs, ninputs, parents, visited, fp,
2059 type_id = CTF_DEDUP_GID (output, cited_type_input_num, type); \
2070 if (!ctf_assert (output, hashval)) \
2078 ret = ctf_dedup_rwalk_output_mapping (output, inputs, ninputs, parents, \
2174 return visit_fun (hval, output, inputs, ninputs, parents, visited, fp, type,
2178 ctf_set_errno (output, ctf_errno (fp));
2179 ctf_err_warn (output, 0, 0, _("%s in input file %s at type ID %lx"),
2184 /* Recursively traverse the output mapping, and do something with each type
2190 ctf_dedup_rwalk_output_mapping (ctf_dict_t *output, ctf_dict_t **inputs,
2195 ctf_dict_t *output,
2207 ctf_dedup_t *d = &output->ctf_dedup;
2219 ctf_err_warn (output, 0, ECTF_INTERNAL,
2221 return ctf_set_errno (output, ECTF_INTERNAL);
2237 ctf_err_warn (output, 0, ENOMEM,
2239 return ctf_set_errno (output, ENOMEM);
2250 if (!ctf_assert (output, id))
2253 return ctf_dedup_rwalk_one_output_mapping (output, inputs, ninputs,
2263 ret = ctf_dedup_rwalk_one_output_mapping (output, inputs, ninputs,
2275 ctf_err_warn (output, 0, err, _("cannot walk conflicted type"));
2276 return ctf_set_errno (output, err);
2289 /* Sort the output mapping into order: types first appearing in earlier inputs
2354 ctf_dedup_walk_output_mapping (ctf_dict_t *output, ctf_dict_t **inputs,
2357 ctf_dict_t *output,
2378 return ctf_set_errno (output, ENOMEM);
2382 sort_arg.d = &output->ctf_dedup;
2384 while ((err = ctf_dynhash_next_sorted (output->ctf_dedup.cd_output_mapping,
2390 err = ctf_dedup_rwalk_output_mapping (output, inputs, ninputs, parents,
2401 ctf_set_errno (output, err);
2402 ctf_err_warn (output, 0, 0, _("cannot recurse over output mapping"));
2417 ctf_dedup_maybe_synthesize_forward (ctf_dict_t *output, ctf_dict_t *target,
2421 ctf_dedup_t *od = &output->ctf_dedup;
2442 if (!ctf_assert (output, name))
2445 if ((decorated = ctf_decorate_type_name (output, name, fwdkind)) == NULL)
2453 return ctf_set_typed_errno (output, ctf_errno (target));
2458 return ctf_set_typed_errno (output, ENOMEM);
2470 into a GID in a target output dict. If it returns 0, this is the
2489 ctf_dedup_id_to_target (ctf_dict_t *output, ctf_dict_t *target,
2494 ctf_dedup_t *od = &output->ctf_dedup;
2520 if (!ctf_assert (output, parents[input_num] <= ninputs))
2527 CTF_DEDUP_GID (output, input_num, id));
2529 if (!ctf_assert (output, hval && td->cd_output_emission_hashes))
2539 emitted_forward = ctf_dedup_maybe_synthesize_forward (output, target,
2546 ctf_set_errno (err_fp, ctf_errno (output));
2562 if (!ctf_assert (output, (target != output)
2568 emitted_forward = ctf_dedup_maybe_synthesize_forward (output, output,
2575 ctf_err_warn (err_fp, 0, ctf_errno (output),
2578 return ctf_set_typed_errno (err_fp, ctf_errno (output));
2583 if (!ctf_assert (output, target_id))
2597 is emitted directly into the output. No struct/union members are emitted.
2605 ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs,
2610 ctf_dedup_t *d = &output->ctf_dedup;
2613 ctf_dict_t *target = output;
2638 /* Conflicting types go into a per-CU output dictionary, unless this is a
2640 ctf_link_outputs dict of the output that is its parent. */
2657 ctf_err_warn (output, 0, err,
2660 return ctf_set_errno (output, err);
2663 ctf_import_unref (target, output);
2680 ctf_err_warn (output, 0, ctf_errno (input),
2683 return ctf_set_errno (output, ctf_errno (input));
2761 return ctf_set_errno (output, ctf_errno (target));
2773 if ((ref = ctf_dedup_id_to_target (output, target, inputs, ninputs,
2789 if ((ref = ctf_dedup_id_to_target (output, target, inputs, ninputs,
2805 if ((ref = ctf_dedup_id_to_target (output, target, inputs, ninputs,
2822 ar.ctr_contents = ctf_dedup_id_to_target (output, target, inputs,
2825 ar.ctr_index = ctf_dedup_id_to_target (output, target, inputs, ninputs,
2848 fi.ctc_return = ctf_dedup_id_to_target (output, target, inputs, ninputs,
2869 args[j] = ctf_dedup_id_to_target (output, target, inputs, ninputs,
2902 out_id = CTF_DEDUP_GID (output, output_num, new_type);
2914 ctf_err_warn (output, 0, ECTF_CORRUPT, _("%s: unknown type kind for "
2917 return ctf_set_errno (output, ECTF_CORRUPT);
2925 ctf_err_warn (output, 0, ENOMEM, _("out of memory tracking deduplicated "
2927 return ctf_set_errno (output, ENOMEM);
2938 ctf_err_warn (output, 0, ENOMEM, _("out of memory creating emission-tracking "
2940 return ctf_set_errno (output, ENOMEM);
2943 ctf_err_warn (output, 0, ctf_errno (input),
2947 return ctf_set_errno (output, ctf_errno (input));
2949 ctf_err_warn (output, 0, ctf_errno (target),
2954 return ctf_set_errno (output, ctf_errno (target));
2962 ctf_dedup_emit_struct_members (ctf_dict_t *output, ctf_dict_t **inputs,
2965 ctf_dedup_t *d = &output->ctf_dedup;
2988 /* The output is either -1 (for the shared, parent output dict) or the
2992 target = output;
2996 if (!ctf_assert (output, target))
2998 err_fp = output;
3010 if ((membtype = ctf_dedup_id_to_target (output, target, inputs,
3044 ctf_err_warn (output, 0, ctf_errno (err_fp),
3047 return ctf_set_errno (output, ctf_errno (err_fp));
3049 ctf_err_warn (output, 0, err, _("iteration failure emitting "
3051 return ctf_set_errno (output, err);
3064 mapping: only one output will result. */
3067 ctf_dedup_emit (ctf_dict_t *output, ctf_dict_t **inputs, uint32_t ninputs,
3070 size_t num_outputs = 1; /* Always at least one output: us. */
3076 if (ctf_dedup_walk_output_mapping (output, inputs, ninputs, parents,
3081 if (ctf_dedup_emit_struct_members (output, inputs, ninputs, parents) < 0)
3090 if (!ctf_assert (output, !cu_mapped || (cu_mapped && num_outputs == 1)))
3095 ctf_set_errno (output, ENOMEM);
3096 ctf_err_warn (output, 0, 0,
3103 *walk = output;
3104 output->ctf_refcnt++;
3127 ctf_dict_t *output = NULL;
3136 this with an FP that is not a per-CU output or shared output dict, or with
3143 output = fp;
3145 output = fp->ctf_parent;
3151 "deduplicated output"), (void *) fp);
3158 d = &output->ctf_dedup;
3161 if (!ctf_assert (output, found != 0))
3166 CTF_DEDUP_GID (output, input_num, src_type));
3168 if (!ctf_assert (output, hval != NULL))