}
auto *mapper = get_mapper (main_source_loc);
+ mapper->Cork();
+
/* Execute the LTRANS stage for each input file (or prepare a
makefile to invoke this in parallel). */
for (i = 0; i < nr; ++i)
}
else
{
- //fprintf(stderr, "\tRAVI PRINT: %s ", new_argv[0]);
- mapper->Cork();
-
// TODO: better way to figure out the number of arguments?
for (j = 1; new_argv[j] != NULL; ++j);
fprintf(stderr, "argc: %d\n", j);
- //std::vector<const char*> v_new_argv(new_argv, new_argv + j);
- //mapper->LTOCompile(v_new_argv);
- mapper->LTOCompile(new_argv, j);
- const char **arg_it = new_argv + 1;
-
- while(*arg_it != NULL)
- {
- //fprintf(stderr, "\tRAVI PRINT: %s\n", *arg_it);
- fprintf(stderr, " \'%s\' ", *arg_it);
- //mapper->LTOCompile(*arg_it);
- arg_it++;
- }
- ////fprintf(stderr, "\n");
- auto response = mapper->Uncork();
- auto r_iter = response.begin ();
-
- while(r_iter != response.end()) {
- Cody::Packet const &p = *r_iter;
-
- if(p.GetCode() == Cody::Client::PC_LTO_COMPILED) {
- if(strcmp(p.GetString().c_str(), "success") == 0) {
- // fprintf(stderr, "\tlto compilation succeeded\n");
- }
- else {
- fprintf(stderr, "\tlto compilation failure message: %s\n", p.GetString().c_str());
- }
- }
- else {
- fprintf(stderr, "\tlto compilation unknown failure\n");
- }
-
- ++r_iter;
- }
-
- //fprintf(stderr, "\tRAVI PRINT: %s\n", new_argv[0]);
- //fork_execute (new_argv[0], CONST_CAST (char **, new_argv),
- // true);
- maybe_unlink (input_name);
+ mapper->InvokeSubProcess(new_argv, j);
+
+ // TODO: unlink input file somewhere
+ // maybe_unlink (input_name);
}
output_names[i] = output_name;
}
+
+ auto response = mapper->Uncork();
+ auto r_iter = response.begin ();
+
+ while(r_iter != response.end()) {
+ Cody::Packet const &p = *r_iter;
+
+ if(p.GetCode() == Cody::Client::PC_INVOKED) {
+ if(strcmp(p.GetString().c_str(), "success") == 0) {
+ fprintf(stderr, "\tlto compilation succeeded\n");
+ }
+ else {
+ fprintf(stderr, "\tlto compilation failure message: %s\n", p.GetString().c_str());
+ }
+ }
+ else {
+ fprintf(stderr, "\tlto compilation unknown failure\n");
+ }
+
+ ++r_iter;
+ }
+
+ fprintf(stderr, "\n");
+
if (parallel)
{
struct pex_obj *pex;
return 0;
}
-int module_resolver::LTOCompileRequest (Cody::Server *s, std::vector<std::string> &args) {
+int module_resolver::InvokeSubProcessRequest (Cody::Server *s, std::vector<std::string> &args) {
char **new_argv = (char **)malloc((args.size()) * sizeof(char *));
new_argv[args.size()-1] = NULL;
int i = 0;
for (std::vector<std::string>::iterator arg = args.begin() ; arg != args.end(); ++arg, ++i) {
- // ignore "LTO-COMPILE"
+ // ignore "INVOKE"
if(i == 0) continue;
//new_argv[i++] = (char *)malloc(args[i].length() * sizeof(char));
fork_execute (new_argv[0], new_argv, true);
// TODO: send back a compile status response
- s->LTOResponse("success");
+ s->InvokedResponse("success");
return 0;
}