/* See SMTSolver::get_command() */ std::string YicesSolver::get_command(const std::string &config_name) { #ifdef ROSE_YICES ASSERT_require(get_linkage() & LM_EXECUTABLE); return std::string(ROSE_YICES) + " --evidence --type-check " + config_name; #else return "false no yices command"; #endif }
/* See SMTSolver::generate_file() */ void YicesSolver::generate_file(std::ostream &o, const std::vector<SymbolicExpr::Ptr> &exprs, Definitions *defns) { ASSERT_require(get_linkage() & LM_EXECUTABLE); Definitions *allocated = NULL; if (!defns) defns = allocated = new Definitions; termNames.clear(); o <<";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n" <<"; Uninterpreted variables\n" <<";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"; out_define(o, exprs, defns); o <<"\n" <<";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n" <<"; Common subexpressions\n" <<";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"; out_common_subexpressions(o, exprs); out_comments(o, exprs); o <<"\n" <<";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n" <<"; Assertions\n" <<";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"; for (std::vector<SymbolicExpr::Ptr>::const_iterator ei=exprs.begin(); ei!=exprs.end(); ++ei) { o <<"\n" <<"; effective size = " <<StringUtility::plural((*ei)->nNodes(), "nodes") <<", actual size = " <<StringUtility::plural((*ei)->nNodesUnique(), "nodes") <<"\n"; out_assert(o, *ei); } o <<"\n(check)\n"; delete allocated; }
/* * Publicly-usable linkage-fetcher */ struct rlink_linkage * rlink_get_linkage( VALUE self ) { return get_linkage( self ); }
Definitions defns; for (std::vector<TreeNodePtr>::const_iterator ei=exprs.begin(); ei!=exprs.end(); ++ei) ctx_define(*ei, &defns); for (std::vector<TreeNodePtr>::const_iterator ei=exprs.begin(); ei!=exprs.end(); ++ei) ctx_assert(*ei); switch (yices_check(context)) { case l_false: return SAT_NO; case l_true: return SAT_YES; case l_undef: return SAT_UNKNOWN; } ASSERT_not_reachable("switch statement is incomplete"); } #endif ASSERT_require(get_linkage() & LM_EXECUTABLE); return SMTSolver::satisfiable(exprs); } /* See SMTSolver::get_command() */ std::string YicesSolver::get_command(const std::string &config_name) { #ifdef ROSE_YICES ASSERT_require(get_linkage() & LM_EXECUTABLE); return std::string(ROSE_YICES) + " --evidence --type-check " + config_name; #else return "false no yices command"; #endif }
static int _scan_seg(uint segno, int msgs) { // Dump the linkage info for an in-memory segment. // Can be invoked by an interactive command. // Also invoked by the CPU to discover entrypoint names and locations so // that the CPU can display location information. // Any entrypoints found are passed to seginfo_add_linkage(). // // Caller should preserve TPR.TSR -- only scan_seg() should call _scan_seg() t_uint64 word0, word1; if (opt_debug) log_msg(DEBUG_MSG, "scan-seg", "Starting for seg %#o\n", segno); /* Locate and report the last non-zero word of the segment */ if (msgs) { /* Get last word of segment -- but in-memory copy may be larger than original, so search for last non-zero word */ TPR.TSR = segno; if (fetch_word(0, &word0) != 0) { if (msgs) out_msg("xseginfo: Cannot read first word of segment %#o.\n", segno); } SDW_t *sdwp = get_sdw(); // Get SDW for TPR.TSR if (sdwp == 0) { out_msg("xseginfo: Cannot find SDW segment descriptor word for segment %#o.\n", segno); } else { out_msg("SDW segment descriptor word for %#o: %s\n", segno, sdw2text(sdwp)); int bound = 16 * (sdwp->bound + 1); t_uint64 last = 0; for (bound -= 2; bound > 0; bound -= 2) { if (fetch_pair(bound, &word0, &word1) != 0) { out_msg("xseginfo: Error reading %#o|%#o/2\n", segno, bound); break; } // don't stop for 'b' 'k' 'p' 't' if (word0 != 0 && word0 != 0142153160164) { last = word0; break; } if (word1 != 0 && word1 != 0142153160164) { last = word1; ++ bound; break; } } if (bound > 0) { out_msg("Last non-zero word might be at %#o|%#o: %012llo\n", segno, bound, last); } } } /* Read LOT, definitions pointer from linkage section, link pair info */ AR_PR_t linkage; uint first_link; uint last_link; AR_PR_t defs; int ret = get_linkage(msgs, segno, &linkage, &first_link, &last_link, &defs); if (ret == -1) return 0; if (ret != 0) return ret; TPR.TSR = defs.PR.snr; /* Definitions */ ret = scan_seg_defs(segno, &defs, 0, msgs); if (ret != 0) return ret; /* Linkage Section */ if (msgs && first_link != 0 && last_link != 0) { out_msg("\n"); out_msg("Linkage section:\n"); for (int link = first_link; link <= last_link; link += 2) { TPR.TSR = linkage.PR.snr; if (fetch_pair(linkage.wordno + link, &word0, &word1) != 0) return 2; if ((word0 & 077) == 043) { // snapped link AR_PR_t pr; if (words2its(word0, word1, &pr) != 0) out_msg("Link pair at %#o: %012llo %012llo: snapped link -- bad ptr\n", link, word0, word1); else out_msg("Link pair at %#o: %012llo %012llo: snapped link %o|%#o\n", link, word0, word1, pr.PR.snr, pr.wordno); } else if ((word0 & 077) == 046) { // unsnapped link uint exp_ptr = word1 >> 18; // out_msg("Link pair at %#o: %012llo %012llo: unsnapped link with exp-ptr %#o.\n", link, word0, word1, exp_ptr); out_msg("Link pair at %#o: %#o|%#04o: unsnapped link ", link, TPR.TSR, linkage.wordno + link); t_uint64 word2; TPR.TSR = defs.PR.snr; if (fetch_word(defs.wordno + exp_ptr, &word2) != 0) { out_msg("Cannot read expression word at %o|%o\n", TPR.TSR, defs.wordno + exp_ptr); return 2; } uint offset = word2 >> 18; t_uint64 a, q; if (fetch_word(defs.wordno + offset, &a) != 0) { out_msg("... exp-word at %o|%o: %012llo: offset %o|%o => <error>\n", linkage.PR.snr, exp_ptr, word2, TPR.TSR, offset); return 2; } if (fetch_word(defs.wordno + offset + 1, &q) != 0) { out_msg("... exp-word at %o|%o: %012llo: offset %o|%o => <error>\n", linkage.PR.snr, exp_ptr, word2, TPR.TSR, offset); return 2; } // out_msg("\texp-word %012llo: offset %o => type-pair (%#llo,%#llo)\n", word2, offset, a, q); int exp_offset = word2 & MASK18; int typ = a >> 18; if (typ == 0 || typ > 6) { out_msg("of unknown type %d.\n", typ); continue; } else if (typ == 1 || typ == 2 || typ == 5) { out_msg("of Type %d.\n", typ); continue; } else { // types 3, 4, and 6 char sname[513]; char ename[513]; int ql = q & MASK18; int qu = q >> 18; if (qu == 0) *sname = 0; else if (fetch_acc(defs.wordno + qu, sname) != 0) return 2; if (ql == 0) *ename = 0; else if (fetch_acc(defs.wordno + ql, ename) != 0) return 2; if (exp_offset == 0) out_msg("of type %d to %s$%s\n", typ, sname, ename); else out_msg("of type %d to %s$%s%+d\n", typ, sname, ename, exp_offset); } } else {