fix compiler locking so it only compiles once
don't call execute() from compile(), call separately
This commit is contained in:
@ -32,7 +32,7 @@ class Compiler {
|
||||
}
|
||||
|
||||
/*
|
||||
* Compile and execute
|
||||
* Compile only. Call execute() on success.
|
||||
*
|
||||
* @return success
|
||||
*/
|
||||
@ -69,18 +69,7 @@ class Compiler {
|
||||
if (!PRESERVE_PROGRAM)
|
||||
src.delete();
|
||||
}
|
||||
try {
|
||||
return execute(ctx, r);
|
||||
} catch (Throwable t) {
|
||||
synchronized(ctx) {
|
||||
can_compile = false;
|
||||
ctx.request_compile = false;
|
||||
ctx.compiled = false;
|
||||
ctx.compile_failed = true;
|
||||
}
|
||||
t.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,16 +64,18 @@ public class HashX {
|
||||
//print_registers("R", r, 8);
|
||||
if (ctx.code.length != GenCtx.REQUIREMENT_SIZE)
|
||||
throw new IllegalArgumentException();
|
||||
boolean executed = false;
|
||||
if (ctx.compiled) {
|
||||
executed = Compiler.execute(ctx, r);
|
||||
}
|
||||
if (!executed && ctx.request_compile && !ctx.compile_failed) {
|
||||
executed = Compiler.compile(ctx, r);
|
||||
if (!executed) {
|
||||
System.out.println("FAILED compiling program " + input);
|
||||
boolean compiled;
|
||||
synchronized(ctx) {
|
||||
compiled = ctx.compiled;
|
||||
if (!compiled && ctx.request_compile && !ctx.compile_failed) {
|
||||
compiled = Compiler.compile(ctx, r);
|
||||
if (!compiled)
|
||||
System.out.println("FAILED compiling program " + input);
|
||||
}
|
||||
}
|
||||
boolean executed = false;
|
||||
if (compiled)
|
||||
executed = Compiler.execute(ctx, r);
|
||||
if (!executed) {
|
||||
Exec.execute(ctx.code, r);
|
||||
}
|
||||
|
Reference in New Issue
Block a user