void symmetric_hash_join::remove_from_special_cache( hash_table& table, int idx, tuple_ptr tup) { boost::interprocess::scoped_lock<boost::interprocess::interprocess_recursive_mutex> lock (m_mutex); LOG_DEBUG("==>try to remove: " << *tup); // print_hash_table(left_htable); std::pair<hash_table::const_iterator, hash_table::const_iterator> range = table.equal_range((*tup)[idx]); hash_table::const_iterator to_remove = range.first; for (; to_remove != range.second; ++to_remove) { if ((to_remove->second == tup) &&(to_remove->second->timestamp() == tup->timestamp())) break; } if (to_remove != range.second) { table.erase(to_remove); LOG_DEBUG("\tdrop: " << to_remove->second << " from hash table"); } }
void symmetric_hash_join::print_hash_table(hash_table& htable) { hash_table::iterator it = htable.begin(); for (; it != htable.end(); it++) { std::pair<boost::any, tuple_ptr> item = *it; std::cout << "\t" << item.first << " : <" << item.second << ">" << std::endl; } }
void solaris_elf_asm_comdat_section (const char *name, unsigned int flags, tree decl) { const char *signature; char *section; comdat_entry entry, **slot; if (TREE_CODE (decl) == IDENTIFIER_NODE) signature = IDENTIFIER_POINTER (decl); else signature = IDENTIFIER_POINTER (DECL_COMDAT_GROUP (decl)); /* Sun as requires group sections to be fragmented, i.e. to have names of the form <section>%<fragment>. Strictly speaking this is only necessary to support cc -xF, but is enforced globally in violation of the ELF gABI. We keep the section names generated by GCC (generally of the form .text.<signature>) and append %<signature> to pacify as, despite the redundancy. */ section = concat (name, "%", signature, NULL); /* Clear SECTION_LINKONCE flag so targetm.asm_out.named_section only emits this as a regular section. Emit section before .group directive since Sun as treats undeclared sections as @progbits, which conflicts with .bss* sections which are @nobits. */ targetm.asm_out.named_section (section, flags & ~SECTION_LINKONCE, decl); /* Sun as separates declaration of a group section and of the group itself, using the .group directive and the #comdat flag. */ fprintf (asm_out_file, "\t.group\t%s," SECTION_NAME_FORMAT ",#comdat\n", signature, section); /* Unlike GNU as, group signature symbols need to be defined explicitly for Sun as. With a few exceptions, this is already the case. To identify the missing ones without changing the affected frontents, remember the signature symbols and emit those not marked TREE_SYMBOL_REFERENCED in solaris_file_end. */ if (!solaris_comdat_htab.is_created ()) solaris_comdat_htab.create (37); entry.sig = signature; slot = solaris_comdat_htab.find_slot (&entry, INSERT); if (*slot == NULL) { *slot = XCNEW (comdat_entry); /* Remember fragmented section name. */ (*slot)->name = section; /* Emit as regular section, .group declaration has already been done. */ (*slot)->flags = flags & ~SECTION_LINKONCE; (*slot)->decl = decl; (*slot)->sig = signature; } }
void lto_orig_address_remove (tree t) { struct tree_hash_entry ent; struct tree_hash_entry **slot; ent.key = t; slot = tree_htab.find_slot (&ent, NO_INSERT); gcc_assert (slot); free (*slot); tree_htab.clear_slot (slot); }
/* For given name, return descriptor, create new if needed. */ static struct alloc_pool_descriptor * allocate_pool_descriptor (const char *name) { struct alloc_pool_descriptor **slot; if (!alloc_pool_hash.is_created ()) alloc_pool_hash.create (10); slot = alloc_pool_hash.find_slot_with_hash (name, htab_hash_pointer (name), INSERT); if (*slot) return *slot; *slot = XCNEW (struct alloc_pool_descriptor); (*slot)->name = name; return *slot; }
static struct redirection_data * lookup_redirection_data (edge e, enum insert_option insert) { struct redirection_data **slot; struct redirection_data *elt; vec<jump_thread_edge *> *path = THREAD_PATH (e); /* Build a hash table element so we can see if E is already in the table. */ elt = XNEW (struct redirection_data); elt->path = path; elt->dup_block = NULL; elt->incoming_edges = NULL; slot = redirection_data.find_slot (elt, insert); /* This will only happen if INSERT is false and the entry is not in the hash table. */ if (slot == NULL) { free (elt); return NULL; } /* This will only happen if E was not in the hash table and INSERT is true. */ if (*slot == NULL) { *slot = elt; elt->incoming_edges = XNEW (struct el); elt->incoming_edges->e = e; elt->incoming_edges->next = NULL; return elt; }
void symmetric_hash_join::add_to_special_cache( hash_table& table, int idx, tuple_ptr tup) { boost::interprocess::scoped_lock<boost::interprocess::interprocess_recursive_mutex> lock (m_mutex); LOG_METHOD_TRACE; table.insert(hash_table::value_type((*tup)[idx], tup)); }
intptr_t lto_orig_address_get (tree t) { struct tree_hash_entry ent; struct tree_hash_entry **slot; ent.key = t; slot = tree_htab.find_slot (&ent, NO_INSERT); return (slot ? (*slot)->value : 0); }
static tree TB_up_expr (tree node) { tree res; if (node == NULL_TREE) return NULL_TREE; res = TB_up_ht.find (node); return res; }
void lto_orig_address_map (tree t, intptr_t orig_t) { struct tree_hash_entry ent; struct tree_hash_entry **slot; ent.key = t; ent.value = orig_t; slot = tree_htab.find_slot (&ent, INSERT); gcc_assert (!*slot); *slot = XNEW (struct tree_hash_entry); **slot = ent; }
void lto_streamer_init (void) { /* Check that all the TS_* handled by the reader and writer routines match exactly the structures defined in treestruct.def. When a new TS_* astructure is added, the streamer should be updated to handle it. */ streamer_check_handled_ts_structures (); #ifdef LTO_STREAMER_DEBUG tree_htab.create (31); #endif }
void read_and_delta (file_reader & reader , xdelta_stream & stream , const hash_table & hashes , std::set<hole_t> & hole_set , const int blk_len , bool need_split_hole) { bool adddiff = !need_split_hole; char_buffer<uchar_t> buf (XDELTA_BUFFER_LEN); typedef std::set<hole_t>::iterator it_t; std::list<hole_t> holes2remove; for (it_t begin = hole_set.begin (); begin != hole_set.end (); ++begin) { const hole_t & hole = *begin; uint64_t offset = reader.seek_file (hole.offset, FILE_BEGIN); if (offset != hole.offset) { std::string errmsg = fmt_string ("Can't seek file %s(%s)." , reader.get_fname ().c_str (), error_msg ().c_str ()); THROW_XDELTA_EXCEPTION (errmsg); } uint32_t buflen = XDELTA_BUFFER_LEN; uint32_t to_read_bytes = (uint32_t)hole.length; buflen = to_read_bytes > buflen ? buflen : to_read_bytes; uchar_t * rdbuf = buf.begin (); uint32_t size = reader.read_file (rdbuf, buflen); if (size != buflen) { std::string errmsg = fmt_string ("Can't read file %s(%s)." , reader.get_fname ().c_str (), error_msg ().c_str ()); THROW_XDELTA_EXCEPTION (errmsg); } to_read_bytes -= size; const uchar_t * endbuf = rdbuf + size; rdbuf = buf.begin (); if ((int32_t)(endbuf - rdbuf) >= blk_len) { uchar_t * sentrybuf = rdbuf; rolling_hasher hasher; hasher.eat_hash (rdbuf, blk_len); while (true) { bool newhash = false; const slow_hash * bsh = hashes.find_block (hasher.hash_value (), rdbuf, blk_len); uchar_t outchar = 0; if (bsh) { // a match was found. uint32_t slipsize = (uint32_t)(rdbuf - sentrybuf); if (slipsize > 0 && adddiff) stream.add_block (sentrybuf, slipsize, offset); offset += slipsize; stream.add_block (bsh->tpos, blk_len, offset); if (need_split_hole) { hole_t newhole; newhole.offset = offset; newhole.length = blk_len; holes2remove.push_back (newhole); } rdbuf += blk_len; sentrybuf = rdbuf; newhash = true; offset += blk_len; } else { // slip the window by one bytes which size is blk_len. outchar = *rdbuf; ++rdbuf; } // // beyond the buffer. int remain = (int)(endbuf - rdbuf); if (remain < blk_len) { if (to_read_bytes == 0) { // no more to read. uint32_t slipsize = (uint32_t)(endbuf - sentrybuf); if (slipsize > 0 && adddiff) stream.add_block (sentrybuf, slipsize, offset); goto end; } else { memmove (buf.begin (), rdbuf, remain); rdbuf = buf.begin (); sentrybuf = rdbuf; buflen = XDELTA_BUFFER_LEN - remain; buflen = to_read_bytes > buflen ? buflen : to_read_bytes; size = reader.read_file (rdbuf + remain, buflen); if (size != buflen) { std::string errmsg = fmt_string ("Can't read file %s(%s)." , reader.get_fname ().c_str (), error_msg ().c_str ()); THROW_XDELTA_EXCEPTION (errmsg); } to_read_bytes -= size; endbuf = rdbuf + remain + size; remain += size; if (remain >= blk_len) { if (newhash) hasher.eat_hash (rdbuf, blk_len); else hasher.update (outchar, *(rdbuf + blk_len)); } else { // // one read must complement data which length plus // remain must be more than one block length of @f_blk_len, // so if remain less than that, it must be reach the end of // file // if (adddiff) stream.add_block (rdbuf, remain, offset); offset += remain; goto end; } } } else { if (newhash) hasher.eat_hash (rdbuf, blk_len); else hasher.update (outchar, *(rdbuf + blk_len - 1)); } } } else { if (adddiff) stream.add_block (rdbuf, size, offset); } end: continue; } if (need_split_hole) { typedef std::list<hole_t>::iterator it_t; for (it_t begin = holes2remove.begin (); begin != holes2remove.end (); ++begin) split_hole (hole_set, *begin); } return; }
void browse_tree (tree begin) { tree head; TB_CODE tbc = TB_UNUSED_COMMAND; ssize_t rd; char *input = NULL; long input_size = 0; fprintf (TB_OUT_FILE, "\nTree Browser\n"); #define TB_SET_HEAD(N) do { \ vec_safe_push (TB_history_stack, N); \ head = N; \ if (TB_verbose) \ if (head) \ { \ print_generic_expr (TB_OUT_FILE, head, 0); \ fprintf (TB_OUT_FILE, "\n"); \ } \ } while (0) TB_SET_HEAD (begin); /* Store in a hashtable information about previous and upper statements. */ { TB_up_ht.create (1023); TB_update_up (head); } while (24) { fprintf (TB_OUT_FILE, "TB> "); rd = TB_getline (&input, &input_size, TB_IN_FILE); if (rd == -1) /* EOF. */ goto ret; if (rd != 1) /* Get a new command. Otherwise the user just pressed enter, and thus she expects the last command to be reexecuted. */ tbc = TB_get_command (input); switch (tbc) { case TB_UPDATE_UP: TB_update_up (head); break; case TB_MAX: if (head && (INTEGRAL_TYPE_P (head) || TREE_CODE (head) == REAL_TYPE || TREE_CODE (head) == FIXED_POINT_TYPE)) TB_SET_HEAD (TYPE_MAX_VALUE (head)); else TB_WF; break; case TB_MIN: if (head && (INTEGRAL_TYPE_P (head) || TREE_CODE (head) == REAL_TYPE || TREE_CODE (head) == FIXED_POINT_TYPE)) TB_SET_HEAD (TYPE_MIN_VALUE (head)); else TB_WF; break; case TB_ELT: if (head && TREE_CODE (head) == TREE_VEC) { /* This command takes another argument: the element number: for example "elt 1". */ TB_NIY; } else if (head && TREE_CODE (head) == VECTOR_CST) { /* This command takes another argument: the element number: for example "elt 1". */ TB_NIY; } else TB_WF; break; case TB_VALUE: if (head && TREE_CODE (head) == TREE_LIST) TB_SET_HEAD (TREE_VALUE (head)); else TB_WF; break; case TB_PURPOSE: if (head && TREE_CODE (head) == TREE_LIST) TB_SET_HEAD (TREE_PURPOSE (head)); else TB_WF; break; case TB_IMAG: if (head && TREE_CODE (head) == COMPLEX_CST) TB_SET_HEAD (TREE_IMAGPART (head)); else TB_WF; break; case TB_REAL: if (head && TREE_CODE (head) == COMPLEX_CST) TB_SET_HEAD (TREE_REALPART (head)); else TB_WF; break; case TB_BLOCK: if (head && TREE_CODE (head) == BIND_EXPR) TB_SET_HEAD (TREE_OPERAND (head, 2)); else TB_WF; break; case TB_SUBBLOCKS: if (head && TREE_CODE (head) == BLOCK) TB_SET_HEAD (BLOCK_SUBBLOCKS (head)); else TB_WF; break; case TB_SUPERCONTEXT: if (head && TREE_CODE (head) == BLOCK) TB_SET_HEAD (BLOCK_SUPERCONTEXT (head)); else TB_WF; break; case TB_VARS: if (head && TREE_CODE (head) == BLOCK) TB_SET_HEAD (BLOCK_VARS (head)); else if (head && TREE_CODE (head) == BIND_EXPR) TB_SET_HEAD (TREE_OPERAND (head, 0)); else TB_WF; break; case TB_REFERENCE_TO_THIS: if (head && TYPE_P (head)) TB_SET_HEAD (TYPE_REFERENCE_TO (head)); else TB_WF; break; case TB_POINTER_TO_THIS: if (head && TYPE_P (head)) TB_SET_HEAD (TYPE_POINTER_TO (head)); else TB_WF; break; case TB_BASETYPE: if (head && TREE_CODE (head) == OFFSET_TYPE) TB_SET_HEAD (TYPE_OFFSET_BASETYPE (head)); else TB_WF; break; case TB_ARG_TYPES: if (head && (TREE_CODE (head) == FUNCTION_TYPE || TREE_CODE (head) == METHOD_TYPE)) TB_SET_HEAD (TYPE_ARG_TYPES (head)); else TB_WF; break; case TB_METHOD_BASE_TYPE: if (head && (TREE_CODE (head) == FUNCTION_TYPE || TREE_CODE (head) == METHOD_TYPE) && TYPE_METHOD_BASETYPE (head)) TB_SET_HEAD (TYPE_METHOD_BASETYPE (head)); else TB_WF; break; case TB_FIELDS: if (head && (TREE_CODE (head) == RECORD_TYPE || TREE_CODE (head) == UNION_TYPE || TREE_CODE (head) == QUAL_UNION_TYPE)) TB_SET_HEAD (TYPE_FIELDS (head)); else TB_WF; break; case TB_DOMAIN: if (head && TREE_CODE (head) == ARRAY_TYPE) TB_SET_HEAD (TYPE_DOMAIN (head)); else TB_WF; break; case TB_VALUES: if (head && TREE_CODE (head) == ENUMERAL_TYPE) TB_SET_HEAD (TYPE_VALUES (head)); else TB_WF; break; case TB_ARG_TYPE: if (head && TREE_CODE (head) == PARM_DECL) TB_SET_HEAD (DECL_ARG_TYPE (head)); else TB_WF; break; case TB_INITIAL: if (head && DECL_P (head)) TB_SET_HEAD (DECL_INITIAL (head)); else TB_WF; break; case TB_RESULT: if (head && DECL_P (head)) TB_SET_HEAD (DECL_RESULT_FLD (head)); else TB_WF; break; case TB_ARGUMENTS: if (head && DECL_P (head)) TB_SET_HEAD (DECL_ARGUMENTS (head)); else TB_WF; break; case TB_ABSTRACT_ORIGIN: if (head && DECL_P (head)) TB_SET_HEAD (DECL_ABSTRACT_ORIGIN (head)); else if (head && TREE_CODE (head) == BLOCK) TB_SET_HEAD (BLOCK_ABSTRACT_ORIGIN (head)); else TB_WF; break; case TB_ATTRIBUTES: if (head && DECL_P (head)) TB_SET_HEAD (DECL_ATTRIBUTES (head)); else if (head && TYPE_P (head)) TB_SET_HEAD (TYPE_ATTRIBUTES (head)); else TB_WF; break; case TB_CONTEXT: if (head && DECL_P (head)) TB_SET_HEAD (DECL_CONTEXT (head)); else if (head && TYPE_P (head) && TYPE_CONTEXT (head)) TB_SET_HEAD (TYPE_CONTEXT (head)); else TB_WF; break; case TB_OFFSET: if (head && TREE_CODE (head) == FIELD_DECL) TB_SET_HEAD (DECL_FIELD_OFFSET (head)); else TB_WF; break; case TB_BIT_OFFSET: if (head && TREE_CODE (head) == FIELD_DECL) TB_SET_HEAD (DECL_FIELD_BIT_OFFSET (head)); else TB_WF; break; case TB_UNIT_SIZE: if (head && DECL_P (head)) TB_SET_HEAD (DECL_SIZE_UNIT (head)); else if (head && TYPE_P (head)) TB_SET_HEAD (TYPE_SIZE_UNIT (head)); else TB_WF; break; case TB_SIZE: if (head && DECL_P (head)) TB_SET_HEAD (DECL_SIZE (head)); else if (head && TYPE_P (head)) TB_SET_HEAD (TYPE_SIZE (head)); else TB_WF; break; case TB_TYPE: if (head && TREE_TYPE (head)) TB_SET_HEAD (TREE_TYPE (head)); else TB_WF; break; case TB_DECL_SAVED_TREE: if (head && TREE_CODE (head) == FUNCTION_DECL && DECL_SAVED_TREE (head)) TB_SET_HEAD (DECL_SAVED_TREE (head)); else TB_WF; break; case TB_BODY: if (head && TREE_CODE (head) == BIND_EXPR) TB_SET_HEAD (TREE_OPERAND (head, 1)); else TB_WF; break; case TB_CHILD_0: if (head && EXPR_P (head) && TREE_OPERAND (head, 0)) TB_SET_HEAD (TREE_OPERAND (head, 0)); else TB_WF; break; case TB_CHILD_1: if (head && EXPR_P (head) && TREE_OPERAND (head, 1)) TB_SET_HEAD (TREE_OPERAND (head, 1)); else TB_WF; break; case TB_CHILD_2: if (head && EXPR_P (head) && TREE_OPERAND (head, 2)) TB_SET_HEAD (TREE_OPERAND (head, 2)); else TB_WF; break; case TB_CHILD_3: if (head && EXPR_P (head) && TREE_OPERAND (head, 3)) TB_SET_HEAD (TREE_OPERAND (head, 3)); else TB_WF; break; case TB_PRINT: if (head) debug_tree (head); else TB_WF; break; case TB_PRETTY_PRINT: if (head) { print_generic_stmt (TB_OUT_FILE, head, 0); fprintf (TB_OUT_FILE, "\n"); } else TB_WF; break; case TB_SEARCH_NAME: break; case TB_SEARCH_CODE: { enum tree_code code; char *arg_text; arg_text = strchr (input, ' '); if (arg_text == NULL) { fprintf (TB_OUT_FILE, "First argument is missing. This isn't a valid search command. \n"); break; } code = TB_get_tree_code (arg_text + 1); /* Search in the subtree a node with the given code. */ { tree res; res = walk_tree (&head, find_node_with_code, &code, NULL); if (res == NULL_TREE) { fprintf (TB_OUT_FILE, "There's no node with this code (reachable via the walk_tree function from this node).\n"); } else { fprintf (TB_OUT_FILE, "Achoo! I got this node in the tree.\n"); TB_SET_HEAD (res); } } break; } #define TB_MOVE_HEAD(FCT) do { \ if (head) \ { \ tree t; \ t = FCT (head); \ if (t) \ TB_SET_HEAD (t); \ else \ TB_WF; \ } \ else \ TB_WF; \ } while (0) case TB_FIRST: TB_MOVE_HEAD (TB_first_in_bind); break; case TB_LAST: TB_MOVE_HEAD (TB_last_in_bind); break; case TB_UP: TB_MOVE_HEAD (TB_up_expr); break; case TB_PREV: TB_MOVE_HEAD (TB_prev_expr); break; case TB_NEXT: TB_MOVE_HEAD (TB_next_expr); break; case TB_HPREV: /* This command is a little bit special, since it deals with history stack. For this reason it should keep the "head = ..." statement and not use TB_MOVE_HEAD. */ if (head) { tree t; t = TB_history_prev (); if (t) { head = t; if (TB_verbose) { print_generic_expr (TB_OUT_FILE, head, 0); fprintf (TB_OUT_FILE, "\n"); } } else TB_WF; } else TB_WF; break; case TB_CHAIN: /* Don't go further if it's the last node in this chain. */ if (head && TREE_CODE (head) == BLOCK) TB_SET_HEAD (BLOCK_CHAIN (head)); else if (head && TREE_CHAIN (head)) TB_SET_HEAD (TREE_CHAIN (head)); else TB_WF; break; case TB_FUN: /* Go up to the current function declaration. */ TB_SET_HEAD (current_function_decl); fprintf (TB_OUT_FILE, "Current function declaration.\n"); break; case TB_HELP: /* Display a help message. */ { int i; fprintf (TB_OUT_FILE, "Possible commands are:\n\n"); for (i = 0; i < TB_UNUSED_COMMAND; i++) { fprintf (TB_OUT_FILE, "%20s - %s\n", TB_COMMAND_TEXT (i), TB_COMMAND_HELP (i)); } } break; case TB_VERBOSE: if (TB_verbose == 0) { TB_verbose = 1; fprintf (TB_OUT_FILE, "Verbose on.\n"); } else { TB_verbose = 0; fprintf (TB_OUT_FILE, "Verbose off.\n"); } break; case TB_EXIT: case TB_QUIT: /* Just exit from this function. */ goto ret; default: TB_NIY; } } ret:; TB_up_ht.dispose (); return; }