aboutsummaryrefslogtreecommitdiff
path: root/src/compiler.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler.js')
-rw-r--r--src/compiler.js38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/compiler.js b/src/compiler.js
index e9197a5d..7d768c3d 100644
--- a/src/compiler.js
+++ b/src/compiler.js
@@ -206,12 +206,12 @@ if (phase == 'pre') {
if (VERBOSE) printErr('VERBOSE is on, this generates a lot of output and can slow down compilation');
// Load struct and define information.
-try {
+//try {
var temp = JSON.parse(read(STRUCT_INFO));
-} catch(e) {
- printErr('cannot load struct info at ' + STRUCT_INFO + ' : ' + e + ', trying in current dir');
- temp = JSON.parse(read('struct_info.compiled.json'));
-}
+//} catch(e) {
+// printErr('cannot load struct info at ' + STRUCT_INFO + ' : ' + e + ', trying in current dir');
+// temp = JSON.parse(read('struct_info.compiled.json'));
+//}
C_STRUCTS = temp.structs;
C_DEFINES = temp.defines;
@@ -224,12 +224,12 @@ load('analyzer.js');
load('jsifier.js');
if (phase == 'funcs' && RELOOP) { // XXX handle !singlePhase
RelooperModule = { TOTAL_MEMORY: ceilPowerOfTwo(2*RELOOPER_BUFFER_SIZE) };
- try {
+ //try {
load(RELOOPER);
- } catch(e) {
- printErr('cannot load relooper at ' + RELOOPER + ' : ' + e + ', trying in current dir');
- load('relooper.js');
- }
+ //} catch(e) {
+ // printErr('cannot load relooper at ' + RELOOPER + ' : ' + e + ', trying in current dir');
+ // load('relooper.js');
+ //}
assert(typeof Relooper != 'undefined');
}
globalEval(processMacros(preprocess(read('runtime.js'))));
@@ -267,7 +267,7 @@ function compile(raw) {
function runPhase(currPhase) {
//printErr('// JS compiler in action, phase ' + currPhase + typeof lines + (lines === null));
phase = currPhase;
- if (phase != 'pre') {
+ if (phase != 'pre' && phase != 'glue') {
if (singlePhase) PassManager.load(read(forwardedDataFile));
if (phase == 'funcs') {
@@ -311,12 +311,18 @@ function compile(raw) {
B = new Benchmarker();
-if (ll_file) {
- if (ll_file.indexOf(String.fromCharCode(10)) == -1) {
- compile(read(ll_file));
- } else {
- compile(ll_file); // we are given raw .ll
+try {
+ if (ll_file) {
+ if (phase === 'glue') {
+ compile(';');
+ } else if (ll_file.indexOf(String.fromCharCode(10)) == -1) {
+ compile(read(ll_file));
+ } else {
+ compile(ll_file); // we are given raw .ll
+ }
}
+} catch(err) {
+ printErr('aborting from js compiler due to exception: ' + err + ' | ' + err.stack);
}
//var M = keys(tokenCacheMisses).map(function(m) { return [m, misses[m]] }).sort(function(a, b) { return a[1] - b[1] });