This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][libstdc++-v3 parallel mode] Uglification of internal identifiers


The attached patch (compressed due to size) uglifies the internals of
the libstdc++ parallel mode.
Since the uglification changes the line length, the line breaks have to
be updated.  I will do this for the (to be proposed) final patch when
the uglification itself is approved in principle (its style).

Tested x86_64-unknown-linux-gnu: No regressions


2009-09-10  Johannes Singler  <singler@ira.uka.de>

        * include/parallel/*:  Uglify internal identifiers.

Shall I specify all files explicitly in the changelog entry?
The following lines give an impression on what was changed (add to
changelog?):


#!/bin/bash
MASK="*"
svn revert $MASK
replace-all "begin(begin)" "__begin(__begin)" "$MASK"
replace-all "end(end)" "__end(__end)" "$MASK"
replace-all "RandomAccessIterator" _RAIter "$MASK"
replace-all "InputIterator" _IIter "$MASK"
replace-all "IteratorTag" _IteratorTag "$MASK"
replace-all "\bComparator\b" _Compare "$MASK"
replace-all "\bbegin\b\([^(]\)" "__begin\1" "$MASK"
replace-all "\bend\b\([^(]\)" "__end\1" "$MASK"
replace-all "__end namespace" "end namespace" "$MASK"
replace-all "\b\([a-z0-9_]\+_switch\)\b" "__\1" "$MASK"
replace-all "\b\([a-z0-9_]\+_selector\)\b" "__\1" "$MASK"
replace-all "\([^:]\)value_type\b" "\1_ValueType" "$MASK"
replace-all "typedef void _ValueType" "typedef void value_type" "$MASK"
replace-all "\bvaluei_type\b" "_IValueType" "$MASK"
replace-all "\bvaluef_type\b" "_FValueType" "$MASK"
replace-all "\bpair_type\b" "_SpotType" "$MASK"
replace-all "\bequal_from_less\b" "_EqualFromLess" "$MASK"
replace-all "\bequal_type\b" "_EqualFromLessCompare" "$MASK"
replace-all "\bvalue1_type\b" "_ValueType1" "$MASK"
replace-all "\bvalue2_type\b" "_ValueType2" "$MASK"
replace-all "\btraits1_type\b" "_TraitsType1" "$MASK"
replace-all "\btraits2_type\b" "_TraitsType2" "$MASK"
replace-all "\btraitso_type\b" "_OTraitsType" "$MASK"
replace-all "\biterator1_category\b" "_IteratorCategory1" "$MASK"
replace-all "\biterator2_category\b" "_IteratorCategory2" "$MASK"
replace-all "\biteratori_category\b" "_IIteratorCategory" "$MASK"
replace-all "\bless_type\b" "_LessType" "$MASK"
replace-all "\biterator_triple\b" "_IteratorTriple" "$MASK"
replace-all "\bip\b" "_ItTrip" "$MASK"
replace-all "\bdummy_reduct\b" "_DummyReduct" "$MASK"
replace-all "\btag1\b" "_Tag1" "$MASK"
replace-all "\btag2\b" "_Tag2" "$MASK"
replace-all "\btag3\b" "_Tag3" "$MASK"
replace-all "\biteratori_traits\b" "_IIterTraits" "$MASK"
replace-all "\biteratori1_traits\b" "_IIterTraits1" "$MASK"
replace-all "\biteratori2_traits\b" "_IIterTraits2" "$MASK"
replace-all "\biteratoro_traits\b" "_OIterTraits" "$MASK"
replace-all "\biteratori1_category\b" "_IIterCategory1" "$MASK"
replace-all "\biteratori2_category\b" "_IIterCategory2" "$MASK"
replace-all "\biteratoro_category\b" "_OIterCategory" "$MASK"
replace-all "\bT\b" "_Tp" "$MASK"
replace-all "\brand\b\([^(]\)" "__rand\1" "$MASK"
replace-all "\btraits_type\b" "_TraitsType" "$MASK"
replace-all "\b\([a-z0-9_]\+_template\)\b" "__\1" "$MASK"
replace-all "\b\([a-z0-9_]\+_reduct\)\b" "__\1" "$MASK"
replace-all "\([^:]\)\biterator_traits\b\([^<]\)" "\1_IteratorTraits\2"
"$MASK"
replace-all "\bless\b" "_Less" "$MASK"
replace-all "\bstd::_Less\b" "std::less" "$MASK"
replace-all "\bIteratorCategory\b" "_IteratorCategory" "$MASK"
replace-all "\([^:]\)iterator_category\b" "\1_IteratorCategory" "$MASK"
replace-all "\btypedef _IteratorCategory _IteratorCategory\b" "typedef
_IteratorCategory iterator_category" "$MASK"
replace-all "                             _IteratorCategory" "
                   iterator_category" "$MASK"
replace-all "\bguarded_iterator\b" "_GuardedIterator" "$MASK"
replace-all "\bsequence_index_t\b" "_SequenceIndex" "$MASK"
replace-all "\bloser_tree_traits\b" "_LoserTreeTraits" "$MASK"
replace-all "\bsampling_sorter\b" "_SamplingSorter" "$MASK"
replace-all "\b\(s[0-9]\{3\}\)\b" "__\1" "$MASK"
replace-all "thread_index_t" "_ThreadIndex" "$MASK"
replace-all "\bdifference_type1\b" "_DifferenceType1" "$MASK"
replace-all "\bdifference_type3\b" "_DifferenceType3" "$MASK"
replace-all "\btls_type\b" "_TLSType" "$MASK"
replace-all "lcas_t" "_CASable" "$MASK"
replace-all "\bfirst_argument_type\b" "_FirstArgumentType" "$MASK"
replace-all "\bsecond_argument_type\b" "_SecondArgumentType" "$MASK"
replace-all "\bresult_type\b" "_ResultType" "$MASK"
replace-all "\([^:]\)\b\plus\b" "\1_Plus" "$MASK"
replace-all "\b__gnu_parallel::plus\b" "__gnu_parallel::_Plus" "$MASK"
replace-all "\([^:]\)\bmultiplies\b" "\1_Multiplies" "$MASK"
replace-all "\b__gnu_parallel::multiplies\b"
"__gnu_parallel::_Multiplies" "$MASK"
replace-all "\bpseudo_sequence\b" "_PseudoSequence" "$MASK"
replace-all "\bpseudo_sequence_iterator\b" "_PseudoSequenceIterator" "$MASK"
replace-all "\btype\b" "_Self" "$MASK"
replace-all "\bvoid_functor\b" "_VoidFunctor" "$MASK"
replace-all "\bComp\b" "_Compare" "$MASK"
replace-all "\bnothing\b" "_Nothing" "$MASK"
replace-all "\biterator_pair\b" "_IteratorPair" "$MASK"

replace-all "\([^:]\)\bdifference_type\b" "\1_DifferenceType" "$MASK"
replace-all "\b_DifferenceType\b" "difference_type" "iterator.h"
replace-all "_DifferenceType _DifferenceType" "difference_type
_DifferenceType" "$MASK"
replace-all "_DifferenceType bound" "difference_type bound" "$MASK"
replace-all "_DifferenceType max_length" "difference_type max_length"
"$MASK"
replace-all "\blexicographic\b" "_Lexicographic" "$MASK"
replace-all "\blexicographic_reverse\b" "_LexicographicReverse" "$MASK"
replace-all "\bsplit_consistently\b" "_SplitConsistently" "$MASK"
replace-all "\bbin_index\b" "_BinIndex" "$MASK"
replace-all "\brandom_number\b" "_RandomNumber" "$MASK"
replace-all "\bmust_be_int\b" "_MustBeInt" "$MASK"
#replace-all "\b\b" "_" "$MASK"
#replace-all "\b\b" "_" "$MASK"
#replace-all "\b\b" "_" "$MASK"
#replace-all "\b\b" "_" "$MASK"
#replace-all "\b\b" "_" "$MASK"
#replace-all "\b\b" "_" "$MASK"

replace-all "\([^\.]\)\blast\b" "\1__last" "$MASK"

replace-all "\([^\.]\)\bfirst\b" "\1__first" "$MASK"
replace-all "\bmy_job\.first\b" "my_job.__first" "$MASK"
replace-all "\bmy_job\.last\b" "my_job.__last" "$MASK"
replace-all "\bjob\[victim \* stride\].first\b" "job[victim *
stride].__first" "$MASK"
replace-all "\bjob\[victim \* stride\].last\b" "job[victim *
stride].__last" "$MASK"
replace-all "\bbase_type::__first\b" "base_type::first" "$MASK"
replace-all "\bother\.first\b" "other.__first" "$MASK"
replace-all "*i\.first\b" "*i.__first" "$MASK"
replace-all "{ return base_type::first - other\.__first; }" "{ return
base_type::first - other.first; }" "$MASK"
replace-all "base_type::first = other.__first;" "base_type::first =
other.first;" "$MASK"
replace-all "\*i\.second = o(\*i\.__first);" "*i.second = o(*i.first);"
"$MASK"

replace-all "\([^\.>]\)\bsecond\b" "\1__second" "$MASK"
replace-all "\bmy_job\.second\b" "my_job.__second" "$MASK"
replace-all "\bmy_job\.last\b" "my_job.__last" "$MASK"
replace-all "\bjob\[victim \* stride\].second\b" "job[victim *
stride].__second" "$MASK"
replace-all "\bjob\[victim \* stride\].last\b" "job[victim *
stride].__last" "$MASK"
replace-all "\bbase_type::__second\b" "base_type::second" "$MASK"
replace-all "\bother\.second\b" "other.__second" "$MASK"
replace-all "*i\.second\b" "*i.__second" "$MASK"
replace-all "{ return base_type::second - other\.__second; }" "{ return
base_type::second - other.second; }" "$MASK"
replace-all "base_type::second = other.__second;" "base_type::second =
other.second;" "$MASK"
replace-all "\*i\.__second = o(\*i\.first);" "*i.second = o(*i.first);"
"$MASK"

replace-all "\bbase_type\b" "_Base" "$MASK"
replace-all "\bnum_threads\b" "__num_threads" "$MASK"
replace-all "\bomp parallel __num_threads\b" "omp parallel num_threads"
"$MASK"
replace-all ") __num_threads(__num_threads)" ")
num_threads(__num_threads)" "$MASK"
replace-all "sections __num_threads" "sections num_threads" "$MASK"

replace-all "\bmultiplies_result_type\b" "_MultipliesResultType" "$MASK"


replace-all "\bit\b" "__it" "list_partition.h"
replace-all "\bS\b" "__S" "multiseq_selection.h"

# replace-all "\b\(parallel_[a-z0-9_]\+\)\b" "__\1" "$MASK"
for variable in dist_lim__it prev num_bins_cache former_front middle
num_chunks borderstart minrightset pq end_seqs next1 next2 index
reduction bound iteration_start old nw inc first_failure ps binary_pred
stolen_first stride my_first supposed_first supposed_last supposed_load
iam_working output_lock job load end_output iter_out begin_output
counter parallelism block_begin sequence lengths block_begins op e
pos_in_pattern found_pattern advances splitters input_length
pattern_length off elements dist0 dist1 oracles global_offset oracle pus
bins_begin bins_end seed bin_proc num_bins num_bits temporaries
bits_left cache supremum_reciprocal supremum mt num_threads_left
pivot_rank new_borders former_back max_size former_borders split
max_size nth final_left final_right swapstart iam_finished thread_left
thread_left_border thread_left_border thread_right_border leftover_left
leftover_right leftnew rightnew reserved_left reserved_right chunk_size
sums border_start reduct constructed thread_results base bin_op first1
last1 first2 binary_op1 binary_op2 length_local length_am temporary
exact sd es temporary maxleftset maxleft minright j sample lrcomp addend
after arbitrary_element b base_case_n before begin1 begin2
begin1_iterator begin_offsets begin_seqs begin_triple bi1 bi2 binop
binary_op block_size borders busy c chunk_length chunks comp comparand
count_to_two cur current delta dist dist_limit dummy element1 element2
elements_done end1 end2 end_triple f find_seq_result first_insert
functionality gen go_back_one k i i1 i2 iam ik l lcomp left leftsize
length lenghts limit lmax lmax_seq local_result losers lt m make_twice
max_length mm mult my_job n N new_val new_value next next_block_start
ne_seqs nmax ns num_longer_chunks num_parts num_samples
num_threads_leftside o offset offsets ok old_value other out output
os_starts oversampling p1 p2 parallelism_tag pieces pivot_pos pos
pos_in_candidates position pred ptr queue_size r range_length raii rank
recent reduction_start replacement res result result_lock return_target
right rng root s samples se search_start selector sentinel sentinels seq
seq0 seq1 seq2 seq3 seqs_begin seqs_end sequential_search_size
seq_length size_greater size_part skew slab split_pos split_pos1
split_pos2 stable steal start starts stop successfully_stolen t t1 t2
tag target target_end target_position third thread_no tight total
total_length total_elements_done tl tls user_op val value v victim wait
x y; do
    replace-all "\b$variable\b" "__$variable" "$MASK"
done
replace-all "__c++" "c++" "$MASK"
replace-all "__base\.h" "base.h" "$MASK"
replace-all "_RandomNumber\.h" "random_number.h" "$MASK"

#members
replace-all "\binitial\b" "_M_initial" "balanced_quicksort.h"
replace-all "\bleftover_parts\b" "_M_leftover_parts" "balanced_quicksort.h"
replace-all "\belements_leftover\b" "_M_elements_leftover"
"balanced_quicksort.h"
replace-all "\bglobal\b" "_M_global" "balanced_quicksort.h"

replace-all "\b__finish_iterator\b" "_M_finish_iterator" "$MASK"
# replace-all "\bfirst\b" "_M_first" "iterator.h"
# replace-all "\bfirst\b" "_M_first" "for_each_selectors.h"
# replace-all "\bsecond\b" "_M_second" "iterator.h"
# replace-all "\bsecond\b" "_M_second" "for_each_selectors.h"
replace-all "\bthird\b" "_M_third" "iterator.h"
replace-all "\bthird\b" "_M_third" "for_each_selectors.h"

replace-all "\bsup\b" "_M_sup" "losertree.h"
replace-all "\bsource\b" "_M_source" "losertree.h"
replace-all "\bsource\b" "_M_source" "multiway_mergesort.h"
replace-all "\bsource\b" "_M_source" "random_shuffle.h"
replace-all "\bkey\b" "_M_key" "losertree.h"
replace-all "\bkeyp\b" "_M_keyp" "losertree.h"

replace-all "\buse_pointer\b" "_M_use_pointer" "$MASK"

#comp

replace-all "\__op\b" "_M_op" "base.h"
replace-all "\__value\b" "_M_value" "base.h"
replace-all "\__val\b" "_M_val" "base.h"
replace-all "\__pos\b" "_M_pos" "base.h"
replace-all "\__count\b" "_M_count" "base.h"

replace-all "\__current\b" "_M_current" "multiway_merge.h"
replace-all "\__end\b" "_M_end" "multiway_merge.h"

replace-all "\__base\b" "_M_base" "queue.h"
replace-all "\__max_size\b" "_M_max_size" "queue.h"
replace-all "\__borders\b" "_M_borders" "queue.h"

replace-all "\__mt\b" "_M_mt" "random_number.h"
replace-all "\__supremum\b" "_M_supremum" "random_number.h"
replace-all "\_RAND_SUP\b" "_M_rand_sup" "random_number.h"
replace-all "\__supremum_reciprocal\b" "_M_supremum_reciprocal"
"random_number.h"
replace-all "\_RAND_SUP_REC\b" "_M_rand_sup_rec" "random_number.h"

#num_threads, comp
# replace-all "\b__begin\b" "_M_begin" "multiway_mergesort.h"
# replace-all "\b__end\b" "_M_end" "losertree.h"
replace-all "\b__starts\b" "_M_starts" "multiway_mergesort.h"
replace-all "\b__temporary\b" "_M_temporary" "multiway_mergesort.h"
replace-all "\b__samples\b" "_M_samples" "multiway_mergesort.h"
replace-all "\b__offsets\b" "_M_offsets" "multiway_mergesort.h"
replace-all "\b__pieces\b" "_M_pieces" "multiway_mergesort.h"

replace-all "\b__temporaries\b" "_M_temporaries" "random_shuffle.h"
replace-all "\b__dist\b" "_M_dist" "random_shuffle.h"
replace-all "\b__starts\b" "_M_starts" "random_shuffle.h"
replace-all "\b__bin_proc\b" "_M_bin_proc" "random_shuffle.h"
replace-all "\b__num_bins\b" "_M_num_bins" "random_shuffle.h"
replace-all "\b__num_bits\b" "_M_num_bits" "random_shuffle.h"
replace-all "\b__bins_begin\b" "_M_bins_begin" "random_shuffle.h"
replace-all "\b__bins_end\b" "__bins_end" "random_shuffle.h"
replace-all "\b__seed\b" "_M_seed" "random_shuffle.h"
replace-all "\b__sd\b" "_M_sd" "random_shuffle.h"

replace-all "\binvoke\b" "_M_invoke" "set_operations.h"
replace-all "\b__count\b" "_M_count" "random_shuffle.h"




for function in random_number_pow2 sequential_random_shuffle
parallel_random_shuffle_drs round_up_to_pow2
parallel_random_shuffle_drs_pu parallel_partial_sum_basecase
parallel_unique_copy parallel_set_union parallel_set_intersection
parallel_set_difference parallel_set_symmetric_difference
parallel_set_operation union_func intersection_func difference_func
second_empty first_empty calc_borders parallel_random_shuffle
genrand_bits scale_down parallel_sort_qs parallel_sort_qs_conquer
parallel_sort_qs_divide encode2 parallel_partial_sum_linear
parallel_partial_sum possibly_stable_multiway_merge possibly_stable_sort
determine_samples binder1st cas32 cas64 compare_and_swap
compare_and_swap_32 compare_and_swap_64 delete_min_insert faa32 faa64
fetch_and_add fetch_and_add_32 fetch_and_add_64
for_each_template_random_access get_min_source get_max_threads
get_num_threads init init_winner insert_start is_parallel is_sorted
median_of_three_iterators merge_advance merge_advance_usual
merge_advance_movc parallel_merge_advance parallel_partition
parallel_sort_qsb parent_wait qsb_conquer qsb_divide
qsb_local_sort_with_helping sequential_multiway_merge shrink
shrink_and_double unary_negate yield; do
    replace-all "\b$function\b" "__$function" "$MASK"
done
replace-all "sequential_algorithm" "_M_sequential_algorithm" "$MASK"

for type in UnaryOperation Fu UserOp Functionality Red Pred Selector
Integer Job DRSSorterPU DRandomShufflingGlobalData RAND_SUP RAND_SUP_REC
PMWMSSortingData SortingPlacesIterator Addend BinaryOperation
BinaryPredicate BinOp Diff ForwardIterator Function FunctorType It
Iterator Iterator1 Iterator2 Iterator3 Loser LoserTreePointerBase
LoserTreePointer LoserTreeUnguardedBase LoserTreeUnguarded Op
OutputIterator Output_RAIter Parallelism Piece Predicate QSBThreadLocal
RanSeqs RankIterator RankType RestrictedBoundedConcurrentQueue Result
Size StrictWeakOrdering T1 T2; do
    replace-all "\b$type\b" "_$type" "$MASK"
done

replace-all "\ba\b" "__a" "base.h"
replace-all "\ba\b" "__a" "multiseq_selection.h"
replace-all "\ba\b" "__a" "multiway_merge.h"
replace-all "\ba\b" "__a" "set_operations.h"

replace-all "\bcount\b" "__count" "base.h"
replace-all "\bcount\b" "__count" "set_operations.h"

replace-all "\\\\__n\b" "\\\\n" "$MASK"


plus restoration of comment phrases

Johannes






Attachment: uglifying1.patch.gz
Description: GNU Zip compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]