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 "
1348 /* Look up a type kind from the output mapping, given a type hash value. */
1356 /* Precondition: the output mapping is populated. */
1360 /* Look up some GID from the output hash for this type. (They are all
1362 function wrongly, but do assert if the output mapping knows about the hash,
1716 /* Free the per-output state. */
1733 ctf_dedup_multiple_input_dicts (ctf_dict_t *output, ctf_dict_t **inputs,
1736 ctf_dedup_t *d = &output->ctf_dedup;
1751 if (!ctf_assert (output, type_ids))
1785 ctf_err_warn (output, 0, err, _("iteration error "
1787 return ctf_set_errno (output, err);
1798 if (!ctf_assert (output, type_id))
1811 if ((decorated = ctf_decorate_type_name (output, name,
1828 ctf_dedup_conflictify_unshared (ctf_dict_t *output, ctf_dict_t **inputs)
1830 ctf_dedup_t *d = &output->ctf_dedup;
1848 conflicting = !ctf_dedup_multiple_input_dicts (output, inputs, hval);
1864 if (ctf_dedup_mark_conflicting_hash (output, hval) < 0)
1875 ctf_set_errno (output, errno);
1877 err = ctf_errno (output);
1881 ctf_err_warn (output, 0, err, _("conflictifying unshared types"));
1882 return ctf_set_errno (output, err);
1885 /* The core deduplicator. Populate cd_output_mapping in the output ctf_dedup
1888 is conflicted or not. OUTPUT is the top-level output: INPUTS is the array of
1894 mapping: only one output will result.
1896 Only deduplicates: does not emit the types into the output. Call
1900 ctf_dedup (ctf_dict_t *output, ctf_dict_t **inputs, uint32_t ninputs,
1903 ctf_dedup_t *d = &output->ctf_dedup;
1907 if (ctf_dedup_init (output) < 0)
1916 ctf_set_errno (output, errno);
1917 ctf_err_warn (output, 0, errno, _("ctf_dedup: cannot initialize: %s\n"),
1924 because there is only one output and we really don't want to end up marking
1927 d->cd_link_flags = output->ctf_link_flags;
1946 if (ctf_dedup_hash_type (output, inputs[i], inputs,
1953 ctf_set_errno (output, ctf_errno (inputs[i]));
1954 ctf_err_warn (output, 0, 0, _("iteration failure "
1963 conflicting in the output. */
1966 if (ctf_dedup_detect_name_ambiguity (output, inputs) < 0)
1970 types whose output mapping references only one input dict into a
1976 if (ctf_dedup_conflictify_unshared (output, inputs) < 0)
1982 ctf_dedup_fini (output, NULL, 0);
1987 ctf_dedup_rwalk_output_mapping (ctf_dict_t *output, ctf_dict_t **inputs,
1992 ctf_dict_t *output,
2007 ctf_dedup_rwalk_one_output_mapping (ctf_dict_t *output,
2014 ctf_dict_t *output,
2026 ctf_dedup_t *d = &output->ctf_dedup;
2044 return visit_fun (hval, output, inputs, ninputs, parents, visited, fp,
2060 type_id = CTF_DEDUP_GID (output, cited_type_input_num, type); \
2071 if (!ctf_assert (output, hashval)) \
2079 ret = ctf_dedup_rwalk_output_mapping (output, inputs, ninputs, parents, \
2175 return visit_fun (hval, output, inputs, ninputs, parents, visited, fp, type,
2179 ctf_set_errno (output, ctf_errno (fp));
2180 ctf_err_warn (output, 0, 0, _("%s in input file %s at type ID %lx"),
2185 /* Recursively traverse the output mapping, and do something with each type
2191 ctf_dedup_rwalk_output_mapping (ctf_dict_t *output, ctf_dict_t **inputs,
2196 ctf_dict_t *output,
2208 ctf_dedup_t *d = &output->ctf_dedup;
2220 ctf_err_warn (output, 0, ECTF_INTERNAL,
2222 return ctf_set_errno (output, ECTF_INTERNAL);
2238 ctf_err_warn (output, 0, ENOMEM,
2240 return ctf_set_errno (output, ENOMEM);
2251 if (!ctf_assert (output, id))
2254 return ctf_dedup_rwalk_one_output_mapping (output, inputs, ninputs,
2264 ret = ctf_dedup_rwalk_one_output_mapping (output, inputs, ninputs,
2276 ctf_err_warn (output, 0, err, _("cannot walk conflicted type"));
2277 return ctf_set_errno (output, err);
2290 /* Sort the output mapping into order: types first appearing in earlier inputs
2351 ctf_dedup_walk_output_mapping (ctf_dict_t *output, ctf_dict_t **inputs,
2354 ctf_dict_t *output,
2375 return ctf_set_errno (output, ENOMEM);
2379 sort_arg.d = &output->ctf_dedup;
2381 while ((err = ctf_dynhash_next_sorted (output->ctf_dedup.cd_output_mapping,
2387 err = ctf_dedup_rwalk_output_mapping (output, inputs, ninputs, parents,
2398 ctf_err_warn (output, 0, err, _("cannot recurse over output mapping"));
2399 ctf_set_errno (output, err);
2414 ctf_dedup_maybe_synthesize_forward (ctf_dict_t *output, ctf_dict_t *target,
2418 ctf_dedup_t *od = &output->ctf_dedup;
2439 if (!ctf_assert (output, name))
2442 if ((decorated = ctf_decorate_type_name (output, name, fwdkind)) == NULL)
2451 ctf_set_errno (output, ctf_errno (target));
2459 ctf_set_errno (output, ENOMEM);
2473 into a GID in a target output dict. If it returns 0, this is the
2492 ctf_dedup_id_to_target (ctf_dict_t *output, ctf_dict_t *target,
2497 ctf_dedup_t *od = &output->ctf_dedup;
2523 if (!ctf_assert (output, parents[input_num] <= ninputs))
2530 CTF_DEDUP_GID (output, input_num, id));
2532 if (!ctf_assert (output, hval && td->cd_output_emission_hashes))
2542 emitted_forward = ctf_dedup_maybe_synthesize_forward (output, target,
2549 ctf_set_errno (err_fp, ctf_errno (output));
2565 if (!ctf_assert (output, (target != output)
2571 emitted_forward = ctf_dedup_maybe_synthesize_forward (output, output,
2578 ctf_err_warn (err_fp, 0, ctf_errno (output),
2581 return ctf_set_errno (err_fp, ctf_errno (output));
2586 if (!ctf_assert (output, target_id))
2600 is emitted directly into the output. No struct/union members are emitted.
2608 ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs,
2613 ctf_dedup_t *d = &output->ctf_dedup;
2616 ctf_dict_t *target = output;
2641 /* Conflicting types go into a per-CU output dictionary, unless this is a
2643 ctf_link_outputs dict of the output that is its parent. */
2660 ctf_err_warn (output, 0, err,
2663 return ctf_set_errno (output, err);
2666 ctf_import_unref (target, output);
2683 ctf_err_warn (output, 0, ctf_errno (input),
2686 return ctf_set_errno (output, ctf_errno (input));
2764 return ctf_set_errno (output, ctf_errno (target));
2776 if ((ref = ctf_dedup_id_to_target (output, target, inputs, ninputs,
2792 if ((ref = ctf_dedup_id_to_target (output, target, inputs, ninputs,
2808 if ((ref = ctf_dedup_id_to_target (output, target, inputs, ninputs,
2825 ar.ctr_contents = ctf_dedup_id_to_target (output, target, inputs,
2828 ar.ctr_index = ctf_dedup_id_to_target (output, target, inputs, ninputs,
2851 fi.ctc_return = ctf_dedup_id_to_target (output, target, inputs, ninputs,
2872 args[j] = ctf_dedup_id_to_target (output, target, inputs, ninputs,
2905 out_id = CTF_DEDUP_GID (output, output_num, new_type);
2917 ctf_err_warn (output, 0, ECTF_CORRUPT, _("%s: unknown type kind for "
2920 return ctf_set_errno (output, ECTF_CORRUPT);
2928 ctf_err_warn (output, 0, ENOMEM, _("out of memory tracking deduplicated "
2930 return ctf_set_errno (output, ENOMEM);
2941 ctf_err_warn (output, 0, ENOMEM, _("out of memory creating emission-tracking "
2943 return ctf_set_errno (output, ENOMEM);
2946 ctf_err_warn (output, 0, ctf_errno (input),
2950 return ctf_set_errno (output, ctf_errno (input));
2952 ctf_err_warn (output, 0, ctf_errno (target),
2957 return ctf_set_errno (output, ctf_errno (target));
2965 ctf_dedup_emit_struct_members (ctf_dict_t *output, ctf_dict_t **inputs,
2968 ctf_dedup_t *d = &output->ctf_dedup;
2991 /* The output is either -1 (for the shared, parent output dict) or the
2995 target = output;
2999 if (!ctf_assert (output, target))
3001 err_fp = output;
3013 if ((membtype = ctf_dedup_id_to_target (output, target, inputs,
3047 ctf_err_warn (output, 0, ctf_errno (err_fp),
3050 return ctf_set_errno (output, ctf_errno (err_fp));
3052 ctf_err_warn (output, 0, err, _("iteration failure emitting "
3054 return ctf_set_errno (output, err);
3067 mapping: only one output will result. */
3070 ctf_dedup_emit (ctf_dict_t *output, ctf_dict_t **inputs, uint32_t ninputs,
3073 size_t num_outputs = 1; /* Always at least one output: us. */
3079 if (ctf_dedup_walk_output_mapping (output, inputs, ninputs, parents,
3084 if (ctf_dedup_emit_struct_members (output, inputs, ninputs, parents) < 0)
3093 if (!ctf_assert (output, !cu_mapped || (cu_mapped && num_outputs == 1)))
3098 ctf_err_warn (output, 0, ENOMEM,
3100 ctf_set_errno (output, ENOMEM);
3106 *walk = output;
3107 output->ctf_refcnt++;
3130 ctf_dict_t *output = NULL;
3139 this with an FP that is not a per-CU output or shared output dict, or with
3146 output = fp;
3148 output = fp->ctf_parent;
3154 "deduplicated output"), (void *) fp);
3161 d = &output->ctf_dedup;
3164 if (!ctf_assert (output, found != 0))
3169 CTF_DEDUP_GID (output, input_num, src_type));
3171 if (!ctf_assert (output, hval != NULL))