From b82ab24bbf9b6dc6bf7cdccb516ea196f3d0a71f Mon Sep 17 00:00:00 2001 From: John Kåre Alsaker Date: Wed, 10 Apr 2019 19:47:55 +0200 Subject: Preallocate BUILTIN_ATTRIBUTES symbols and use a hash map instead of looping --- src/libsyntax_pos/symbol.rs | 131 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 121 insertions(+), 10 deletions(-) (limited to 'src/libsyntax_pos') diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index c89bccd5afb..cdbfabae7ce 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -100,8 +100,127 @@ symbols! { // Other symbols that can be referred to with syntax_pos::symbols::* Other { - doc, cfg, masked, spotlight, alias, keyword, feature, include, simd, align, stable, - unstable, rustc_const_unstable, + alias, + align, + alloc_error_handler, + allow, + allow_fail, + allow_internal_unsafe, + allow_internal_unstable, + automatically_derived, + cfg, + cfg_attr, + cold, + compiler_builtins, + crate_id, + crate_name, + crate_type, + default_lib_allocator, + deny, + deprecated, + derive, + doc, + export_name, + feature, + ffi_returns_twice, + forbid, + fundamental, + global_allocator, + ignore, + include, + inline, + keyword, + lang, + link, + link_args, + link_name, + link_section, + linkage, + macro_escape, + macro_export, + macro_use, + main, + marker, + masked, + may_dangle, + must_use, + naked, + needs_allocator, + needs_panic_runtime, + no_builtins, + no_core, + no_debug, + no_implicit_prelude, + no_link, + no_main, + no_mangle, + no_start, + no_std, + non_exhaustive, + omit_gdb_pretty_printer_section, + optimize, + panic_handler, + panic_runtime, + path, + plugin, + plugin_registrar, + prelude_import, + proc_macro, + proc_macro_attribute, + proc_macro_derive, + profiler_runtime, + recursion_limit, + reexport_test_harness_main, + repr, + rustc_args_required_const, + rustc_clean, + rustc_const_unstable, + rustc_conversion_suggestion, + rustc_copy_clone_marker, + rustc_def_path, + rustc_deprecated, + rustc_dirty, + rustc_dump_program_clauses, + rustc_dump_user_substs, + rustc_error, + rustc_expected_cgu_reuse, + rustc_if_this_changed, + rustc_inherit_overflow_checks, + rustc_layout, + rustc_layout_scalar_valid_range_end, + rustc_layout_scalar_valid_range_start, + rustc_mir, + rustc_on_unimplemented, + rustc_outlives, + rustc_paren_sugar, + rustc_partition_codegened, + rustc_partition_reused, + rustc_proc_macro_decls, + rustc_regions, + rustc_std_internal_symbol, + rustc_symbol_name, + rustc_synthetic, + rustc_test_marker, + rustc_then_this_would_need, + rustc_transparent_macro, + rustc_variance, + sanitizer_runtime, + should_panic, + simd, + spotlight, + stable, + start, + structural_match, + target_feature, + test_runner, + thread_local, + type_length_limit, + unsafe_destructor_blind_to_params, + unstable, + unwind, + used, + warn, + windows_subsystem, } } @@ -237,14 +356,6 @@ newtype_index! { pub struct SymbolIndex { .. } } -// The interner is pointed to by a thread local value which is only set on the main thread -// with parallelization is disabled. So we don't allow `Symbol` to transfer between threads -// to avoid panics and other errors, even though it would be memory safe to do so. -#[cfg(not(parallel_compiler))] -impl !Send for Symbol { } -#[cfg(not(parallel_compiler))] -impl !Sync for Symbol { } - impl Symbol { const fn new(n: u32) -> Self { Symbol(SymbolIndex::from_u32_const(n)) -- cgit 1.4.1-3-g733a5