void GLshape::draw(int i_mode) { glPushMatrix(); glMultMatrixd(m_trans); if (m_requestCompile){ m_shadingList = doCompile(false); m_wireFrameList = doCompile(true); m_requestCompile = false; } glCallList(i_mode == GLlink::DM_SOLID ? m_shadingList : m_wireFrameList); glPopMatrix(); }
nmethod* compilingLookup::compileNMethod() { nmethod* other; nmln* diDeps = NULL; if (dc != NULL) { diDeps = dc->dependency(); assert(diDeps->isEmpty(), "should be empty"); // make sure that other method won't be flushed from the zone other = nmethod::findNMethod(dc); other->save_unlinked_frame_chain(); } nmethod* nm = doCompile(diDeps); if (dc != NULL) { assert(diDeps->notEmpty(), "should be rebound now"); other->unlink_saved_frame_chain(); } return nm; }
int main(int argc, char* argv[]) { uint8 testBuf[4] = { 0x11, 0x22, 0x33, 0x44 }; if (*(uint32*)testBuf != 0x44332211) { printf("Sorry, this program only works on little endian systems.\nGoodbye.\n"); return 0; } TextFile *cptDef = new TextFile("COMPACT.TXT"); FILE *inf = fopen("COMPACT.TXT", "r"); FILE *dbg = fopen("compact.dbg", "wb"); FILE *out = fopen("compact.bin", "wb"); FILE *sve = fopen("savedata.txt", "r"); assert(inf && dbg && out && sve); doCompile(inf, dbg, out, cptDef, sve); fclose(inf); fclose(dbg); fclose(out); fclose(sve); printf("done\n"); return 0; }
// Compiles a new version of the function with the given signature and adds it to the list; // should only be called after checking to see if the other versions would work. CompiledFunction* compileFunction(CLFunction* f, FunctionSignature* sig, EffortLevel::EffortLevel effort, const OSREntryDescriptor* entry) { Timer _t("for compileFunction()"); assert(sig); ASSERT(f->versions.size() < 20, "%ld", f->versions.size()); SourceInfo* source = f->source; assert(source); std::string name = source->getName(); const std::vector<AST_expr*>& arg_names = source->getArgNames(); AST_arguments* args = source->getArgsAST(); if (args) { // args object can be NULL if this is a module scope assert(!args->vararg.size()); assert(!args->kwarg.size()); assert(!args->defaults.size()); } if (VERBOSITY("irgen") >= 1) { std::string s; llvm::raw_string_ostream ss(s); ss << "\033[34;1mJIT'ing " << name << " with signature ("; for (int i = 0; i < sig->arg_types.size(); i++) { if (i > 0) ss << ", "; ss << sig->arg_types[i]->debugName(); // sig->arg_types[i]->llvmType()->print(ss); } ss << ") -> "; ss << sig->rtn_type->debugName(); // sig->rtn_type->llvmType()->print(ss); ss << " at effort level " << effort; if (entry != NULL) { ss << "\nDoing OSR-entry partial compile, starting with backedge to block " << entry->backedge->target->idx << '\n'; } ss << "\033[0m"; printf("%s\n", ss.str().c_str()); } // Do the analysis now if we had deferred it earlier: if (source->cfg == NULL) { assert(source->ast); source->cfg = computeCFG(source->ast->type, source->getBody()); source->liveness = computeLivenessInfo(source->cfg); source->phis = computeRequiredPhis(args, source->cfg, source->liveness, source->scoping->getScopeInfoForNode(source->ast)); } CompiledFunction* cf = doCompile(source, entry, effort, sig, arg_names, name); compileIR(cf, effort); f->addVersion(cf); assert(f->versions.size()); long us = _t.end(); static StatCounter us_compiling("us_compiling"); us_compiling.log(us); static StatCounter num_compiles("num_compiles"); num_compiles.log(); switch (effort) { case EffortLevel::INTERPRETED: { static StatCounter us_compiling("us_compiling_0_interpreted"); us_compiling.log(us); static StatCounter num_compiles("num_compiles_0_interpreted"); num_compiles.log(); break; } case EffortLevel::MINIMAL: { static StatCounter us_compiling("us_compiling_1_minimal"); us_compiling.log(us); static StatCounter num_compiles("num_compiles_1_minimal"); num_compiles.log(); break; } case EffortLevel::MODERATE: { static StatCounter us_compiling("us_compiling_2_moderate"); us_compiling.log(us); static StatCounter num_compiles("num_compiles_2_moderate"); num_compiles.log(); break; } case EffortLevel::MAXIMAL: { static StatCounter us_compiling("us_compiling_3_maximal"); us_compiling.log(us); static StatCounter num_compiles("num_compiles_3_maximal"); num_compiles.log(); break; } } return cf; }
int main( int argc, char *argv[] ) { int ch; char *source; /* Scan options */ while ((ch = getopt( argc, argv, "dhvlVo:" )) != -1) { switch ((char) ch) { case 'd': option_debug = TRUE; break; case 'o': option_outputfile = ec_stringdup( optarg ); break; case 'h': usage(); exit( EXIT_SUCCESS ); break; case 'v': option_verbose = TRUE; break; case 'l': option_lazy = TRUE; break; case 'V': version(); exit( EXIT_SUCCESS ); break; default: usage(); exit( EXIT_FAILURE ); break; } } if (optind >= argc) { usage(); exit( EXIT_FAILURE ); } source = argv[optind]; #ifdef EC_THREADING if (! EcThreadingInit() || ! EcInit()) #else if (! EcInit()) #endif { error( "can't initialize elastiC environment" ); goto onError; } if (! doCompile( source, option_outputfile, option_lazy )) { error( "error during compilation" ); goto onError; } /* OK */ ec_free( option_outputfile ); EcCleanup(); exit( EXIT_SUCCESS ); onError: ec_free( option_outputfile ); EcCleanup(); exit( EXIT_FAILURE ); }