size_t dedup_methods_helper( const Scope& scope, const std::vector<DexMethod*>& to_dedup, std::vector<DexMethod*>& replacements, boost::optional<std::unordered_map<DexMethod*, MethodOrderedSet>>& new_to_old) { if (to_dedup.size() <= 1) { replacements = to_dedup; return 0; } size_t dedup_count = 0; auto grouped_methods = group_identical_methods(to_dedup); std::unordered_map<DexMethod*, DexMethod*> duplicates_to_replacement; for (auto& group : grouped_methods) { auto replacement = *group.begin(); for (auto m : group) { duplicates_to_replacement[m] = replacement; // Update dedup map if (new_to_old == boost::none) { continue; } if (new_to_old->count(m) > 0) { auto orig_old_list = new_to_old->at(m); new_to_old->erase(m); for (auto orig_old : orig_old_list) { new_to_old.get()[replacement].insert(orig_old); } } new_to_old.get()[replacement].insert(m); } if (new_to_old != boost::none) { new_to_old.get()[replacement].insert(replacement); } replacements.push_back(replacement); if (group.size() > 1) { dedup_count += group.size() - 1; TRACE(METH_DEDUP, 9, "dedup: group %d replacement %s\n", group.size(), SHOW(replacement)); } } method_reference::update_call_refs_simple(scope, duplicates_to_replacement); return dedup_count; }
espeak_ERROR sync_espeak_Synth(unsigned int unique_identifier, const void *text, size_t size, unsigned int position, espeak_POSITION_TYPE position_type, unsigned int end_position, unsigned int flags, void* user_data) {//=========================================================================== #ifdef DEBUG_ENABLED ENTER("sync_espeak_Synth"); SHOW("sync_espeak_Synth > position=%d, position_type=%d, end_position=%d, flags=%d, user_data=0x%x, text=%s\n", position, position_type, end_position, flags, user_data, text); #endif espeak_ERROR aStatus; InitText(flags); my_unique_identifier = unique_identifier; my_user_data = user_data; for (int i=0; i < N_SPEECH_PARAM; i++) saved_parameters[i] = param_stack[0].parameter[i]; switch(position_type) { case POS_CHARACTER: skip_characters = position; break; case POS_WORD: skip_words = position; break; case POS_SENTENCE: skip_sentences = position; break; } if(skip_characters || skip_words || skip_sentences) skipping_text = 1; end_character_position = end_position; aStatus = Synthesize(unique_identifier, text, flags); #ifdef USE_ASYNC wave_flush(my_audio); #endif SHOW_TIME("LEAVE sync_espeak_Synth"); return aStatus; } // end of sync_espeak_Synth
espeak_ERROR fifo_add_commands (t_espeak_command* command1, t_espeak_command* command2) { ENTER("fifo_add_command"); int a_status = pthread_mutex_lock(&my_mutex); espeak_ERROR a_error = EE_OK; if (!a_status) { SHOW_TIME("fifo_add_commands > locked\n"); if (node_counter+1 >= MAX_NODE_COUNTER) { SHOW("push > %s\n", "EE_BUFFER_FULL"); a_error = EE_BUFFER_FULL; } else { push(command1); push(command2); } SHOW_TIME("fifo_add_command > unlocking\n"); a_status = pthread_mutex_unlock(&my_mutex); } if (!a_status && !my_command_is_running && (a_error == EE_OK)) { // quit when one command is actually started // (for possible forthcoming 'end of command' checks) SHOW_TIME("fifo_add_command > post my_sem_start_is_required\n"); sem_post(&my_sem_start_is_required); int val=1; while (val > 0) { usleep(50000); // TBD: event? sem_getvalue(&my_sem_start_is_required, &val); } } if (a_status != 0) { a_error = EE_INTERNAL_ERROR; } SHOW_TIME("LEAVE fifo_add_commands"); return a_error; }
/** * Change the visibility of members accessed in a callee as they are moved * to the caller context. * We make everything public but we could be more precise and only * relax visibility as needed. */ void MultiMethodInliner::change_visibility(DexMethod* callee) { TRACE(MMINL, 6, "checking visibility usage of members in %s\n", SHOW(callee)); for (auto insn : callee->get_code()->get_instructions()) { if (insn->has_fields()) { auto fop = static_cast<DexOpcodeField*>(insn); auto field = fop->field(); field = resolve_field(field, is_sfield_op(insn->opcode()) ? FieldSearch::Static : FieldSearch::Instance); if (field != nullptr && field->is_concrete()) { TRACE(MMINL, 6, "changing visibility of %s.%s %s\n", SHOW(field->get_class()), SHOW(field->get_name()), SHOW(field->get_type())); set_public(field); set_public(type_class(field->get_class())); fop->rewrite_field(field); } continue; } if (insn->has_methods()) { auto mop = static_cast<DexOpcodeMethod*>(insn); auto method = mop->get_method(); method = resolver(method, opcode_to_search(insn)); if (method != nullptr && method->is_concrete()) { TRACE(MMINL, 6, "changing visibility of %s.%s: %s\n", SHOW(method->get_class()), SHOW(method->get_name()), SHOW(method->get_proto())); set_public(method); set_public(type_class(method->get_class())); mop->rewrite_method(method); } continue; } if (insn->has_types()) { auto type = static_cast<DexOpcodeType*>(insn)->get_type(); auto cls = type_class(type); if (cls != nullptr && !cls->is_external()) { TRACE(MMINL, 6, "changing visibility of %s\n", SHOW(type)); set_public(cls); } continue; } } }
int main() { START_MACHINE; JUMP(CONTINUE); #include "char.lib" #include "io.lib" #include "math.lib" #include "string.lib" #include "system.lib" #include "scheme.lib" CONTINUE: PUSH(IMM(64)); CALL(MALLOC); SHOW("MALLOC RETURNED ", R0); DROP(1); PUSH(R0); OUT(IMM(2), IMM('?')); OUT(IMM(2), IMM(' ')); CALL(READLINE); SHOW("READ IN STRING AT ADDRESS ", R0); PUSH(R0); CALL(STRING_TO_NUMBER); DROP(1); SHOW("READ IN ", R0); MUL(R0, R0); SHOW("SQUARE IS ", R0); PUSH(R0); CALL(NUMBER_TO_STRING); DROP(1); PUSH(R0); SHOW("STR[0] = ", INDD(R0, 0)); SHOW("STR[1] = ", INDD(R1, 0)); SHOW("STR[2] = ", INDD(R2, 0)); SHOW("STR[3] = ", INDD(R3, 0)); CALL(WRITELN); DROP(1); STOP_MACHINE; return 0; }
DispatchMethod create_virtual_dispatch( const Spec& spec, const std::map<SwitchIndices, DexMethod*>& indices_to_callee) { size_t num_switch_needed = estimate_num_switch_dispatch_needed( indices_to_callee, spec.max_num_dispatch_target); if (num_switch_needed == 1) { auto main_dispatch = create_simple_switch_dispatch(spec, indices_to_callee); dispatch::DispatchMethod dispatch{main_dispatch}; return dispatch; } TRACE(SDIS, 5, "splitting large dispatch %s.%s into %d\n", SHOW(spec.owner_type), spec.name.c_str(), num_switch_needed); return create_two_level_switch_dispatch(num_switch_needed, spec, indices_to_callee); }
bool DexesStructure::add_class_to_current_dex(const MethodRefs& clazz_mrefs, const FieldRefs& clazz_frefs, const TypeRefs& clazz_trefs, DexClass* clazz) { always_assert_log(m_classes.count(clazz) == 0, "Can't emit the same class twice!\n", SHOW(clazz)); if (m_current_dex.add_class_if_fits(clazz_mrefs, clazz_frefs, clazz_trefs, m_linear_alloc_limit, m_type_refs_limit, clazz)) { update_stats(clazz_mrefs, clazz_frefs, clazz); m_classes.emplace(clazz); return true; } return false; }
std::unordered_set<DexType*> get_kill_annos( const std::vector<std::string>& kill ) { std::unordered_set<DexType*> kill_annos; try { for (auto const& config_anno : kill) { DexType* anno = DexType::get_type(config_anno.c_str()); if (anno) { TRACE(CLASSKILL, 2, "kill anno: %s\n", SHOW(anno)); kill_annos.insert(anno); } } } catch (const std::exception&) { // Swallow exception if the config doesn't have any annos. } return kill_annos; }
void add_class(DexClass* new_cls, Scope& scope, DexStoresVector& stores) { always_assert(new_cls != nullptr); scope.push_back(new_cls); TRACE(TERA, 4, " TERA Adding class %s to scope %d \n", SHOW(new_cls), scope.size()); // TODO(emmasevastian): Handle this case in a better way. if (!stores.empty()) { DexClassesVector& root_store = stores.front().get_dexen(); // Add the class to the last dex. root_store.back().emplace_back(new_cls); } }
static void futex_init() { int x = 0; sys_futex(&x, FUTEX_WAIT, 1, 0); if (errno == ENOSYS) lose("This version of SBCL is compiled with threading support, but your kernel\n" "is too old to support this. Please use a more recent kernel or\n" "a version of SBCL without threading support.\n"); sys_futex(&x, FUTEX_WAIT_PRIVATE, 1, 0); if (errno == EWOULDBLOCK) { futex_private_supported_p = 1; } else { futex_private_supported_p = 0; SHOW("No futex private suppport\n"); } }
int wave_close(void* theHandler) { SHOW_TIME("wave_close > ENTER"); int a_status = pthread_mutex_lock(&pulse_mutex); if (a_status) { SHOW("Error: pulse_mutex lock=%d (%s)\n", a_status, __FUNCTION__); return PULSE_ERROR; } drain(); pthread_mutex_unlock(&pulse_mutex); SHOW_TIME("wave_close (ret)"); return PULSE_OK; }
unsigned DexOpcode::dests_size() const { auto format = opcode_format(opcode()); switch (format) { case FMT_f00x: case FMT_f10x: case FMT_f11x_s: case FMT_f10t: case FMT_f20t: case FMT_f21t: case FMT_f21c_s: case FMT_f23x_s: case FMT_f22t: case FMT_f22c_s: case FMT_f30t: case FMT_f31t: case FMT_f35c: case FMT_f3rc: case FMT_fopcode: return 0; case FMT_f12x: case FMT_f12x_2: case FMT_f11n: case FMT_f11x_d: case FMT_f22x: case FMT_f21s: case FMT_f21h: case FMT_f21c_d: case FMT_f23x_d: case FMT_f22b: case FMT_f22s: case FMT_f22c_d: case FMT_f32x: case FMT_f31i: case FMT_f31c: case FMT_f51l: return 1; case FMT_f20bc: case FMT_f22cs: case FMT_f35ms: case FMT_f35mi: case FMT_f3rms: case FMT_f3rmi: always_assert_log(false, "Unimplemented opcode `%s'", SHOW(this)); } not_reached(); }
int clear_annotation_references(Scope& scope, class_set_t& deadclasses) { /* * These annotations show in up method parameter annotations, * but they are still unused. We have to visit all the * method param annotations and remove them. */ int cleared_annos = 0; walk_methods( scope, [&](DexMethod* method) { /* Parameter annotations... */ auto pas = method->get_param_anno(); if (pas == nullptr) return; bool clear_pas = true; for (auto pa : *pas) { DexAnnotationSet* aset = pa.second; if (aset->size() == 0) continue; auto& annos = aset->get_annotations(); auto iter = annos.begin(); while (iter != annos.end()) { auto tokill = iter; DexAnnotation* da = *iter++; DexClass* clazz = type_class(da->type()); if (deadclasses.count(clazz)) { annos.erase(tokill); delete da; } } if (aset->size() != 0) { clear_pas = false; } } if (clear_pas) { for (auto pa : *pas) { delete pa.second; } pas->clear(); cleared_annos++; TRACE(CLASSKILL, 5, "Cleared parameter annotations for method %s\n", SHOW(method)); } }); return cleared_annos; }
/** * Rewrite all methods sigs by creating new ones. Remove old methods and push * the new to the proper class method list. */ void OptimizationImpl::set_method_defs(DexType* intf, SingleImplData& data) { for (auto method : data.methoddefs) { TRACE(INTF, 3, "(MDEF) %s\n", SHOW(method)); auto meth = method; auto meth_it = new_methods.find(meth); if (meth_it != new_methods.end()) { // if a method rewrite existed it must not be on a single impl // given we have escaped to next pass all collisions always_assert(meth_it->second->is_def()); meth = static_cast<DexMethod*>(meth_it->second); TRACE(INTF, 4, "(MDEF) current: %s\n", SHOW(meth)); assert(!single_impls->is_single_impl(method->get_class()) || single_impls->is_escaped(method->get_class())); assert(!single_impls->is_single_impl(meth->get_class()) || single_impls->is_escaped(meth->get_class())); } auto proto = get_or_make_proto(intf, data.cls, meth->get_proto()); TRACE(INTF, 5, "(MDEF) make_method: %s.%s - %s => %s\n", SHOW(meth->get_class()), SHOW(meth->get_name()), SHOW(meth->get_proto()), SHOW(proto)); assert(proto != meth->get_proto()); auto new_meth = static_cast<DexMethod*>(DexMethod::make_method( meth->get_class(), meth->get_name(), proto)); // new_meth may have already existed in RedexContext, so // we need to make sure it isn't concrete. // TODO: this is horrible. After we remove methods, we shouldn't // have these zombies lying around. new_meth->clear_annotations(); new_meth->make_non_concrete(); new_meth->set_deobfuscated_name(meth->get_deobfuscated_name()); new_meth->rstate = meth->rstate; assert(new_meth != meth); setup_method(meth, new_meth); new_methods[method] = new_meth; auto owner = type_class(new_meth->get_class()); owner->remove_method(meth); owner->add_method(new_meth); TRACE(INTF, 3, "(MDEF)\t=> %s\n", SHOW(new_meth)); } }
boost::optional<ParamIndex> find_return_param_index( cfg::ControlFlowGraph& cfg) { for (auto& mie : InstructionIterable(cfg)) { TRACE(RP, 2, " %s\n", SHOW(mie.insn)); } // find register that is being returned (if any) cfg.calculate_exit_block(); auto exit_block = cfg.exit_block(); auto it = exit_block->rbegin(); if (it == exit_block->rend() || !is_return_value(it->insn->opcode())) return boost::none; auto return_reg = it->insn->src(0); TRACE(RP, 2, " returns v%d\n", return_reg); ++it; if (it == exit_block->rend() || !is_move(it->insn->opcode())) return boost::none; auto src_reg = it->insn->src(0); TRACE(RP, 2, " move v%d, v%d\n", it->insn->dest(), src_reg); if (it->insn->dest() != return_reg) return boost::none; // let's see if it came from a unique load-param IRInstruction* load_param = nullptr; for (auto& mie : InstructionIterable(cfg)) { if (mie.insn->dests_size()) { if (mie.insn->dest() == src_reg) { if (opcode::is_load_param(mie.insn->opcode())) { load_param = mie.insn; } else { TRACE(RP, 2, " move_reg clobbered\n"); return boost::none; } } } } if (load_param != nullptr) { ParamIndex param_index = get_load_param_map(cfg).at(load_param); TRACE(RP, 2, " found matching load-param %d\n", param_index); return param_index; } else { TRACE(RP, 2, " did not find matching load-param\n"); return boost::none; } }
int32_t ilctts_set_dest(TTSRENDER_STATE_T *st, const char *name) { OMX_ERRORTYPE omx_err; OMX_CONFIG_BRCMAUDIODESTINATIONTYPE dest; char device[8]; if ( (strcmp(name, "local") != 0) && (strcmp(name, "hdmi") != 0) ) strcpy(device, "local"); else strcpy(device, name); OMX_INIT_STRUCTURE(dest); strcpy((char *)dest.sName, device); omx_err = OMX_SetConfig(ILC_GET_HANDLE(st->audio_render), OMX_IndexConfigBrcmAudioDestination, &dest); if (omx_err != OMX_ErrorNone) { ERROR("OMX_SetConfig returned error in ilctts_set_dest: %d", omx_err); return -1; } SHOW(LOGLEVEL_3, "Audio device set to: %s", device); return 0; } // end ilctts_set_dest
int wave_is_busy(void* theHandler) { PaError active=0; SHOW_TIME("wave_is_busy"); if (pa_stream) { #if USE_PORTAUDIO == 18 active = Pa_StreamActive(pa_stream) && (mInCallbackFinishedState == false); #else active = Pa_IsStreamActive(pa_stream) && (mInCallbackFinishedState == false); #endif } SHOW("wave_is_busy: %d\n",active); return (active==1); }
void IRList::remove_opcode(const IRList::iterator& it) { always_assert(it->type == MFLOW_OPCODE); auto insn = it->insn; always_assert(!opcode::is_move_result_pseudo(insn->opcode())); if (insn->has_move_result_pseudo()) { auto move_it = std::next(it); always_assert_log( move_it->type == MFLOW_OPCODE && opcode::is_move_result_pseudo(move_it->insn->opcode()), "No move-result-pseudo found for %s", SHOW(insn)); delete move_it->insn; move_it->type = MFLOW_FALLTHROUGH; move_it->insn = nullptr; } if (is_branch(insn->opcode())) { remove_branch_targets(insn); } it->type = MFLOW_FALLTHROUGH; it->insn = nullptr; delete insn; }
int main(int, char**) { SHOW(); boost::function<void()> fn = boost::bind(&locky, 10); boost::thread th(boost::bind(&lockwhile<boost::recursive_mutex>, fn, boost::ref(mtx))); usleep(10000); boost::recursive_mutex::scoped_lock triedlock(mtx, boost::defer_lock); std::cout << "try lock = " << triedlock.try_lock() << "\n"; std::cout << "try lock = " << triedlock.try_lock() << "\n"; std::cout << "try lock = " << triedlock.try_lock() << "\n"; std::cout << "owns lock = " << triedlock.owns_lock() << "\n"; std::cout << "get lock in other thread\n"; boost::recursive_mutex::scoped_lock otherlock(mtx); std::cout << "GOT\ntrying again...\n"; std::cout << "try lock = " << triedlock.try_lock() << "\n"; std::cout << "owns lock = " << triedlock.owns_lock() << "\n"; std::cout << "wait and join\n"; th.join(); }
DexClass* CrossDexRefMinimizer::worst() const { auto max_it = m_class_infos.begin(); for (auto it = m_class_infos.begin(); it != m_class_infos.end(); ++it) { const CrossDexRefMinimizer::ClassInfo& max_class_info = max_it->second; const CrossDexRefMinimizer::ClassInfo& class_info = it->second; if (class_info.get_primary_priority_denominator() > max_class_info.get_primary_priority_denominator()) { max_it = it; } } TRACE(IDEX, 3, "[dex ordering] Picked worst class {%s} with priority %016lx; " "index %u; %u applied refs weight, %s infrequent refs weights, %u " "total refs\n", SHOW(max_it->first), max_it->second.get_priority(), max_it->second.index, max_it->second.applied_refs_weight, format_infrequent_refs_array(max_it->second.infrequent_refs_weight) .c_str(), max_it->second.refs.size()); return max_it->first; }
static int insmod_do_insert_module(struct kmod_module *mod, const char *opts) { int flags = 0, err; SHOW("insmod %s %s\n", kmod_module_get_path(mod), opts ? opts : ""); if (dry_run) return 0; if (strip_modversion || force) flags |= KMOD_INSERT_FORCE_MODVERSION; if (strip_vermagic || force) flags |= KMOD_INSERT_FORCE_VERMAGIC; err = kmod_module_insert_module(mod, flags, opts); switch (err) { case -EEXIST: /* * We checked for EEXIST with an earlier call to * retrieve the initstate, but to avoid a race * condition, we don't make any assumptions and handle * the error again here */ if (!first_time) err = 0; else ERR("Module %s already in kernel.\n", kmod_module_get_name(mod)); break; case -EPERM: ERR("could not insert '%s': %s\n", kmod_module_get_name(mod), strerror(-err)); break; } return err; }
t_espeak_command* create_espeak_punctuation_list(const wchar_t *punctlist) { ENTER("create_espeak_punctuation_list"); int a_error=1; // wchar_t *a_list = NULL; t_espeak_command* a_command = (t_espeak_command*)malloc(sizeof(t_espeak_command)); if (!punctlist || !a_command) { goto list_error; } a_command->type = ET_PUNCTUATION_LIST; a_command->state = CS_UNDEFINED; { size_t len = (wcslen(punctlist) + 1)*sizeof(wchar_t); wchar_t* a_list = (wchar_t*)malloc(len); memcpy(a_list, punctlist, len); a_command->u.my_punctuation_list = a_list; } a_error=0; list_error: if (a_error) { if (a_command) { free (a_command); } a_command = NULL; } SHOW("command=0x%x\n", a_command); return a_command; }
DexInstruction* DexInstruction::set_dest(uint16_t vreg) { auto format = opcode_format(opcode()); switch (format) { case FMT_f12x: case FMT_f12x_2: case FMT_f11n: case FMT_f22s: case FMT_f22c_d: case FMT_f22cs: assert((vreg & 0xf) == vreg); m_opcode = (m_opcode & 0xf0ff) | (vreg << 8); return this; case FMT_f11x_d: case FMT_f22x: case FMT_f21s: case FMT_f21h: case FMT_f21c_d: case FMT_f23x_d: case FMT_f22b: case FMT_f31i: case FMT_f31c: case FMT_f51l: assert((vreg & 0xff) == vreg); m_opcode = (m_opcode & 0x00ff) | (vreg << 8); return this; case FMT_f32x: m_arg[0] = vreg; return this; case FMT_f41c_d: case FMT_f52c_d: m_arg[0] = vreg; return this; default: // All other formats do not define a destination register. always_assert_log(false, "Unhandled opcode: %s", SHOW(this)); } not_reached(); }
static int rmmod_do_remove_module(struct kmod_module *mod) { const char *modname = kmod_module_get_name(mod); int flags = 0, err; SHOW("rmmod %s\n", kmod_module_get_name(mod)); if (dry_run) return 0; if (force) flags |= KMOD_REMOVE_FORCE; err = kmod_module_remove_module(mod, flags); if (err == -EEXIST) { if (!first_time) err = 0; else LOG("Module %s is not in kernel.\n", modname); } return err; }
static unsigned int get_used_mem() { char* aRead = myRead; char* aWrite = myWrite; unsigned int used = 0; assert ((aRead >= myBuffer) && (aRead <= myBuffer + BUFFER_LENGTH) && (aWrite >= myBuffer) && (aWrite <= myBuffer + BUFFER_LENGTH)); if (aRead < aWrite) { used = aWrite - aRead; } else { used = aWrite + BUFFER_LENGTH - aRead; } SHOW("get_used_mem > %d\n", used); return used; }
void IRInstruction::normalize_registers() { if (is_invoke(opcode())) { auto& args = get_method()->get_proto()->get_args()->get_type_list(); size_t old_srcs_idx{0}; size_t srcs_idx{0}; if (m_opcode != OPCODE_INVOKE_STATIC) { ++srcs_idx; ++old_srcs_idx; } for (size_t args_idx = 0; args_idx < args.size(); ++args_idx) { always_assert_log( old_srcs_idx < srcs_size(), "Invalid arg indices in %s args_idx %d old_srcs_idx %d\n", SHOW(this), args_idx, old_srcs_idx); set_src(srcs_idx++, src(old_srcs_idx)); old_srcs_idx += is_wide_type(args.at(args_idx)) ? 2 : 1; } always_assert(old_srcs_idx == srcs_size()); set_arg_word_count(srcs_idx); } }
static void* pop() { ENTER("event > pop"); void* the_data = NULL; assert((!head && !tail) || (head && tail)); if (head != NULL) { node* n = head; the_data = n->data; head = n->next; free(n); node_counter--; SHOW("event > pop > event=0x%x (counter=%d, uid=%d)\n",the_data, node_counter,((espeak_EVENT*)the_data)->unique_identifier); } if(head == NULL) { tail = NULL; } return the_data; }
static int pulse_playing(const pa_timing_info *the_timing_info) { ENTER(__FUNCTION__); int r = 0; const pa_timing_info *i; assert(the_timing_info); CHECK_CONNECTED(0); pa_threaded_mainloop_lock(mainloop); for (;;) { CHECK_DEAD_GOTO(fail, 1); if ((i = pa_stream_get_timing_info(stream))) { break; } if (pa_context_errno(context) != PA_ERR_NODATA) { SHOW("pa_stream_get_timing_info() failed: %s", pa_strerror(pa_context_errno(context))); goto fail; } pa_threaded_mainloop_wait(mainloop); } r = i->playing; memcpy((void*)the_timing_info, (void*)i, sizeof(pa_timing_info)); // display_timing_info(i); fail: pa_threaded_mainloop_unlock(mainloop); return r; }
/** * Rewrite all methods sigs by creating new ones. Remove old methods and push * the new to the proper class method list. */ void OptimizationImpl::rewrite_method_defs(DexType* intf, SingleImplData& data) { for (auto method : data.methoddefs) { TRACE(INTF, 3, "(MDEF) %s\n", SHOW(method)); auto meth = method; auto meth_it = new_methods.find(meth); if (meth_it != new_methods.end()) { // if a method rewrite existed it must not be on a single impl // given we have escaped to next pass all collisions meth = meth_it->second; TRACE(INTF, 4, "(MDEF) current: %s\n", SHOW(meth)); assert(!single_impls->is_single_impl(method->get_class()) || single_impls->is_escaped(method->get_class())); assert(!single_impls->is_single_impl(meth->get_class()) || single_impls->is_escaped(meth->get_class())); } auto proto = get_or_make_proto(intf, data.cls, meth->get_proto()); TRACE(INTF, 5, "(MDEF) make_method: %s.%s - %s => %s\n", SHOW(meth->get_class()), SHOW(meth->get_name()), SHOW(meth->get_proto()), SHOW(proto)); assert(proto != meth->get_proto()); auto new_meth = DexMethod::make_method( meth->get_class(), meth->get_name(), proto); assert(new_meth != meth); setup_method(meth, new_meth); new_methods[method] = new_meth; auto owner = type_class(new_meth->get_class()); owner->remove_method(meth); owner->add_method(new_meth); TRACE(INTF, 3, "(MDEF)\t=> %s\n", SHOW(new_meth)); } }
void param_show(const param_t p) { printf("Using DNA parameters: %s\n", p->use_dna_params ? "yes" : "no"); #define SHOW(n,x) show##n(#x, &p->x) SHOW(4,coaxial); SHOW(4,coaxstack); SHOW(4,stack); SHOW(4,tstack); SHOW(4,tstackcoax); SHOW(4,tstackh); SHOW(4,tstacki); SHOW(4,tstacki1n); SHOW(4,tstacki23); SHOW(4,tstackm); #define SHOW_LOOP(x) show1(#x, p->x, LOOP_MAX+1) SHOW_LOOP(internal_loop_initiation); SHOW_LOOP(bulge_loop_initiation); SHOW_LOOP(hairpin_loop_initiation); #undef SHOW_LOOP printf("Extrapolation_for_large_loops = %g\n", p->prelog); //printf("Extrapolation_for_large_loops = %g\n", RT*p->Extrapolation_for_large_loops); #define SHOW_VAL(x) printf("%s = %d\n", #x, p->x) //#define SHOW_VAL(x) printf("%s = %d\n", #x, RT*p->x) SHOW_VAL(maximum_correction); SHOW_VAL(fm_array_first_element); SHOW_VAL(multibranched_loop_offset); SHOW_VAL(multibranched_loop_per_nuc_penalty); SHOW_VAL(multibranched_loop_helix_penalty); SHOW_VAL(terminal_AU_penalty); SHOW_VAL(bonus_for_GGG_hairpin); SHOW_VAL(c_hairpin_slope); SHOW_VAL(c_hairpin_intercept); SHOW_VAL(c_hairpin_of_3); SHOW_VAL(Bonus_for_Single_C_bulges_adjacent_to_C); #undef SHOW_VAL show_triloop(p); show_tloop(p); show_hexaloop(p); SHOW(3,dangle_3p); SHOW(3,dangle_5p); SHOW(6,int11); SHOW(8,int22); SHOW(7,int21); }