aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2010-12-15 22:43:58 -0800
committerAlon Zakai <azakai@mozilla.com>2010-12-15 22:43:58 -0800
commitf7d04701e5562dd3dfdda8213fa0ce747f69bc38 (patch)
treedb755cf84e434956cc22a4d68f39f2a7c1720dea
parent3939368ad428f86e0d21674e13c7ff684c2cfb3c (diff)
clean up enzymatic ==> framework
--HG-- rename : src/enzymatic.js => src/framework.js
-rw-r--r--src/analyzer.js20
-rw-r--r--src/compiler.js2
-rw-r--r--src/framework.js (renamed from src/enzymatic.js)92
-rw-r--r--src/intertyper.js48
-rw-r--r--src/jsifier.js54
-rw-r--r--src/settings.js2
6 files changed, 114 insertions, 104 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 3924b4aa..936482a3 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -15,7 +15,7 @@ function analyzer(data, givenTypes) {
substrate = new Substrate('Analyzer');
// Sorter
- substrate.addZyme('Sorter', {
+ substrate.addActor('Sorter', {
processItem: function(item) {
item.items.sort(function (a, b) { return a.lineNum - b.lineNum });
this.forwardItem(item, 'Gatherer');
@@ -23,7 +23,7 @@ function analyzer(data, givenTypes) {
});
// Gatherer
- substrate.addZyme('Gatherer', {
+ substrate.addActor('Gatherer', {
processItem: function(item) {
// Single-liners
['globalVariable', 'functionStub', 'type', 'unparsedFunction'].forEach(function(intertype) {
@@ -72,7 +72,7 @@ function analyzer(data, givenTypes) {
});
// IdentiNicer
- substrate.addZyme('Identinicer', {
+ substrate.addActor('Identinicer', {
processItem: function(output) {
walkJSON(output, function(item) {
['', '2', '3', '4', '5'].forEach(function(ext) {
@@ -131,7 +131,7 @@ function analyzer(data, givenTypes) {
}
// Typevestigator
- substrate.addZyme('Typevestigator', {
+ substrate.addActor('Typevestigator', {
processItem: function(data) {
// Convert types list to dict
if (data.types.length !== undefined) {
@@ -161,7 +161,7 @@ function analyzer(data, givenTypes) {
});
// Type analyzer
- substrate.addZyme('Typeanalyzer', {
+ substrate.addActor('Typeanalyzer', {
processItem: function(item) {
// 'fields' is the raw list of LLVM fields. However, we embed
// child structures into parent structures, basically like C.
@@ -215,7 +215,7 @@ function analyzer(data, givenTypes) {
});
// Variable analyzer
- substrate.addZyme('VariableAnalyzer', {
+ substrate.addActor('VariableAnalyzer', {
processItem: function(item) {
item.functions.forEach(function(func) {
dprint('vars', 'Analyzing variables in ' + func.ident);
@@ -316,7 +316,7 @@ function analyzer(data, givenTypes) {
});
// Label analyzer
- substrate.addZyme('LabelAnalyzer', {
+ substrate.addActor('LabelAnalyzer', {
processItem: function(item) {
item.functions.forEach(function(func) {
func.labelsDict = {};
@@ -349,7 +349,7 @@ function analyzer(data, givenTypes) {
});
// Stack analyzer - calculate the base stack usage
- substrate.addZyme('StackAnalyzer', {
+ substrate.addActor('StackAnalyzer', {
processItem: function(data) {
data.functions.forEach(function(func) {
var total = 0;
@@ -436,7 +436,7 @@ function analyzer(data, givenTypes) {
}
// ReLooper - reconstruct nice loops, as much as possible
- substrate.addZyme('Relooper', {
+ substrate.addActor('Relooper', {
processItem: function(item) {
var that = this;
function finish() {
@@ -770,7 +770,7 @@ function analyzer(data, givenTypes) {
// logically correct. The LoopOptimizer works on that, doing further optimizations
// like switching to BNOPP when possible, etc.
- substrate.addZyme('LoopOptimizer', {
+ substrate.addActor('LoopOptimizer', {
processItem: function(item) {
var that = this;
function finish() {
diff --git a/src/compiler.js b/src/compiler.js
index 3a21de33..bc53a5c2 100644
--- a/src/compiler.js
+++ b/src/compiler.js
@@ -11,7 +11,7 @@ if (!this['read']) {
load('settings.js');
load('utility.js');
-load('enzymatic.js');
+load('framework.js');
load('parseTools.js');
load('intertyper.js');
load('analyzer.js');
diff --git a/src/enzymatic.js b/src/framework.js
index 8b936a23..8fd396b6 100644
--- a/src/enzymatic.js
+++ b/src/framework.js
@@ -1,37 +1,47 @@
-/**
- * An implementation of an 'enzymatic programming' paradigm.
- */
+//
+// A framework to make building Emscripten easier. Lets you write modular
+// code to handle specific issues.
+//
+// Actor - Some code that processes items.
+// Item - Some data that is processed by actors.
+// Substrate - A 'world' with some actors and some items.
+//
+// The idea is to create a substrate, fill it with the proper items
+// and actors, and then run it to completion. Actors will process
+// the items they are given, and forward the results to other actors,
+// until we are finished. Some of the results are then the final
+// output of the entire calculation done in the substrate.
+//
-DEBUG = true;
DEBUG = false;
Substrate = function(name_) {
this.name_ = name_;
- this.zymes = {};
+ this.actors = {};
this.currUid = 1;
};
Substrate.prototype = {
- addItem: function(item, targetZyme) {
- if (targetZyme == '/dev/null') return;
- if (targetZyme == '/dev/stdout') {
+ addItem: function(item, targetActor) {
+ if (targetActor == '/dev/null') return;
+ if (targetActor == '/dev/stdout') {
this.results.push(item);
return;
}
- this.zymes[targetZyme].inbox.push(item);
+ this.actors[targetActor].inbox.push(item);
},
- addItems: function(items, targetZyme) {
- if (targetZyme == '/dev/null') return;
- if (targetZyme == '/dev/stdout') {
+ addItems: function(items, targetActor) {
+ if (targetActor == '/dev/null') return;
+ if (targetActor == '/dev/stdout') {
this.results = this.results.concat(items);
return;
}
- this.zymes[targetZyme].inbox = this.zymes[targetZyme].inbox.concat(items);
+ this.actors[targetActor].inbox = this.actors[targetActor].inbox.concat(items);
},
- checkInbox: function(zyme) {
- var items = zyme.inbox;
+ checkInbox: function(actor) {
+ var items = actor.inbox;
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (!item.__uid__) {
@@ -39,24 +49,24 @@ Substrate.prototype = {
this.currUid ++;
}
}
- zyme.inbox = [];
- zyme.items = zyme.items.concat(items);
+ actor.inbox = [];
+ actor.items = actor.items.concat(items);
},
- addZyme: function(name_, zyme) {
- assert(name_ && zyme);
- zyme.name_ = name_;
- zyme.items = [];
- zyme.inbox = [];
- zyme.forwardItem = bind(this, this.addItem);
- zyme.forwardItems = bind(this, this.addItems);
- this.zymes[name_] = zyme;
- if (!zyme.process) zyme.process = Zyme.prototype.process;
- return zyme;
+ addActor: function(name_, actor) {
+ assert(name_ && actor);
+ actor.name_ = name_;
+ actor.items = [];
+ actor.inbox = [];
+ actor.forwardItem = bind(this, this.addItem);
+ actor.forwardItems = bind(this, this.addItems);
+ this.actors[name_] = actor;
+ if (!actor.process) actor.process = Actor.prototype.process;
+ return actor;
},
solve: function() {
- dprint('enzymatic', "// Solving " + this.name_ + "...");
+ dprint('framework', "// Solving " + this.name_ + "...");
var startTime = Date.now();
var midTime = startTime;
@@ -64,12 +74,12 @@ Substrate.prototype = {
function midComment(force) {
var curr = Date.now();
if (curr - midTime > 1000 || force) {
- dprint('enzymatic', '// Working on ' + that.name_ + ', so far ' + ((curr-startTime)/1000).toString().substr(0,10) + ' seconds.');
+ dprint('framework', '// Working on ' + that.name_ + ', so far ' + ((curr-startTime)/1000).toString().substr(0,10) + ' seconds.');
midTime = curr;
}
}
function finalComment() {
- dprint('enzymatic', '// Completed ' + that.name_ + ' in ' + ((Date.now() - startTime)/1000).toString().substr(0,10) + ' seconds.');
+ dprint('framework', '// Completed ' + that.name_ + ' in ' + ((Date.now() - startTime)/1000).toString().substr(0,10) + ' seconds.');
}
var finalResult = null;
@@ -77,22 +87,22 @@ Substrate.prototype = {
var finished = false;
var that = this;
while (!finished) {
- dprint('enzymatic', "Cycle start, items: ");// + values(this.zymes).map(function(zyme) zyme.items).reduce(function(x,y) x+y, 0));
+ dprint('framework', "Cycle start, items: ");// + values(this.actors).map(function(actor) actor.items).reduce(function(x,y) x+y, 0));
var hadProcessing = false;
- values(this.zymes).forEach(function(zyme) {
+ values(this.actors).forEach(function(actor) {
midComment();
- that.checkInbox(zyme);
- if (zyme.items.length == 0) return;
+ that.checkInbox(actor);
+ if (actor.items.length == 0) return;
- var inputs = zyme.items.slice(0);
+ var inputs = actor.items.slice(0);
var outputs;
var currResultCount = that.results.length;
try {
- dprint('enzymatic', 'Processing using ' + zyme.name_ + ': ' + inputs.length);
- zyme.items = []; // More may be added in process(); we'll get to them next time
- outputs = zyme.process(inputs);
- dprint('enzymatic', 'New results: ' + (outputs.length + that.results.length - currResultCount) + ' out of ' + (that.results.length + outputs.length));
+ dprint('framework', 'Processing using ' + actor.name_ + ': ' + inputs.length);
+ actor.items = []; // More may be added in process(); we'll get to them next time
+ outputs = actor.process(inputs);
+ dprint('framework', 'New results: ' + (outputs.length + that.results.length - currResultCount) + ' out of ' + (that.results.length + outputs.length));
} catch (e) {
//print("Exception, current selected are: " + inputs.map(dump).join('\n\n'));
print("Stack: " + new Error().stack);
@@ -131,8 +141,8 @@ Substrate.prototype = {
}
};
-Zyme = function() { };
-Zyme.prototype = {
+Actor = function() { };
+Actor.prototype = {
process: function(items) {
var ret = [];
for (var i = 0; i < items.length; i++) {
diff --git a/src/intertyper.js b/src/intertyper.js
index 7f4ae864..9b7ebe06 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -26,7 +26,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
substrate = new Substrate('Intertyper');
// Line splitter.
- substrate.addZyme('LineSplitter', {
+ substrate.addActor('LineSplitter', {
processItem: function(item) {
var lines = item.llvmLines;
var ret = [];
@@ -93,7 +93,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
};
// Line tokenizer
- var tokenizer = substrate.addZyme('Tokenizer', {
+ var tokenizer = substrate.addActor('Tokenizer', {
processItem: function(item, inner) {
//assert(item.lineNum != 40000);
//if (item.lineNum) print(item.lineNum);
@@ -237,7 +237,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
MATHOPS = set(['add', 'sub', 'sdiv', 'udiv', 'mul', 'icmp', 'zext', 'urem', 'srem', 'fadd', 'fsub', 'fmul', 'fdiv', 'fcmp', 'uitofp', 'sitofp', 'fpext', 'fptrunc', 'fptoui', 'fptosi', 'trunc', 'sext', 'select', 'shl', 'shr', 'ashl', 'ashr', 'lshr', 'lshl', 'xor', 'or', 'and', 'ptrtoint', 'inttoptr']);
- substrate.addZyme('Triager', {
+ substrate.addActor('Triager', {
processItem: function(item) {
function triage() {
if (!item.intertype) {
@@ -309,7 +309,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
// Line parsers to intermediate form
// globals: type or variable
- substrate.addZyme('Global', {
+ substrate.addActor('Global', {
processItem: function(item) {
if (item.tokens[2].text == 'alias') {
return; // TODO: handle this. See raytrace.cpp
@@ -383,7 +383,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// function header
- funcHeader = substrate.addZyme('FuncHeader', {
+ funcHeader = substrate.addActor('FuncHeader', {
processItem: function(item) {
item.tokens = item.tokens.filter(function(token) {
return !(token.text in LLVM.LINKAGES || token.text in set('noalias', 'hidden', 'signext', 'zeroext', 'nounwind', 'define', 'inlinehint', '{', 'fastcc'));
@@ -408,7 +408,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// label
- substrate.addZyme('Label', {
+ substrate.addActor('Label', {
processItem: function(item) {
return [{
__result__: true,
@@ -422,7 +422,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
});
// assignment
- substrate.addZyme('Assign', {
+ substrate.addActor('Assign', {
processItem: function(item) {
var opIndex = findTokenText(item, '=');
var pair = splitItem({
@@ -438,7 +438,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
- substrate.addZyme('Reintegrator', makeReintegrator(function(parent, child) {
+ substrate.addActor('Reintegrator', makeReintegrator(function(parent, child) {
// Special re-integration behaviors
if (child.intertype == 'fastgetelementptrload') {
parent.intertype = 'fastgetelementptrload';
@@ -447,7 +447,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}));
// 'load'
- substrate.addZyme('Load', {
+ substrate.addActor('Load', {
processItem: function(item) {
if (item.tokens[0].text == 'volatile') item.tokens.shift(0);
item.pointerType = item.tokens[1].text;
@@ -474,7 +474,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// 'extractvalue'
- substrate.addZyme('ExtractValue', {
+ substrate.addActor('ExtractValue', {
processItem: function(item) {
var last = getTokenIndexByText(item.tokens, ';');
item.intertype = 'extractvalue';
@@ -485,7 +485,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// 'bitcast'
- substrate.addZyme('Bitcast', {
+ substrate.addActor('Bitcast', {
processItem: function(item) {
item.intertype = 'bitcast';
item.type = item.tokens[1].text;
@@ -495,7 +495,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// 'getelementptr'
- substrate.addZyme('GEP', {
+ substrate.addActor('GEP', {
processItem: function(item) {
var first = 0;
while (!isType(item.tokens[first].text)) first++;
@@ -512,7 +512,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// 'call'
- substrate.addZyme('Call', {
+ substrate.addActor('Call', {
processItem: function(item) {
item.intertype = 'call';
if (['tail'].indexOf(item.tokens[0].text) != -1) {
@@ -551,7 +551,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// 'invoke'
- substrate.addZyme('Invoke', {
+ substrate.addActor('Invoke', {
processItem: function(item) {
item.intertype = 'invoke';
item.functionType = '';
@@ -577,7 +577,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
});
// 'alloca'
- substrate.addZyme('Alloca', {
+ substrate.addActor('Alloca', {
processItem: function(item) {
item.intertype = 'alloca';
item.allocatedType = item.tokens[1].text;
@@ -588,7 +588,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// 'phi'
- substrate.addZyme('Phi', {
+ substrate.addActor('Phi', {
processItem: function(item) {
item.intertype = 'phi';
item.type = item.tokens[1].text;
@@ -604,7 +604,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// mathops
- substrate.addZyme('Mathops', {
+ substrate.addActor('Mathops', {
processItem: function(item) {
item.intertype = 'mathop';
item.op = item.tokens[0].text;
@@ -633,7 +633,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// 'store'
- substrate.addZyme('Store', {
+ substrate.addActor('Store', {
processItem: function(item) {
if (item.tokens[0].text == 'volatile') item.tokens.shift(0);
var segments = splitTokenList(item.tokens.slice(1));
@@ -651,7 +651,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// 'br'
- substrate.addZyme('Branch', {
+ substrate.addActor('Branch', {
processItem: function(item) {
if (item.tokens[1].text == 'label') {
return [{
@@ -673,7 +673,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// 'ret'
- substrate.addZyme('Return', {
+ substrate.addActor('Return', {
processItem: function(item) {
return [{
__result__: true,
@@ -685,7 +685,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// 'switch'
- substrate.addZyme('Switch', {
+ substrate.addActor('Switch', {
processItem: function(item) {
function parseSwitchLabels(item) {
var ret = [];
@@ -711,7 +711,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// function end
- substrate.addZyme('FuncEnd', {
+ substrate.addActor('FuncEnd', {
processItem: function(item) {
return [{
__result__: true,
@@ -721,7 +721,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// external function stub
- substrate.addZyme('External', {
+ substrate.addActor('External', {
processItem: function(item) {
if (item.tokens[1].text == 'noalias') {
item.tokens.splice(1, 1);
@@ -737,7 +737,7 @@ function intertyper(data, parseFunctions, baseLineNum) {
}
});
// 'unreachable'
- substrate.addZyme('Unreachable', {
+ substrate.addActor('Unreachable', {
processItem: function(item) {
return [{
__result__: true,
diff --git a/src/jsifier.js b/src/jsifier.js
index 1d1b35df..4a65d927 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -24,7 +24,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
}
// type
- substrate.addZyme('Type', {
+ substrate.addActor('Type', {
processItem: function(item) {
var type = TYPES[item.name_];
var niceName = toNiceIdent(item.name_);
@@ -225,7 +225,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
}
// globalVariable
- substrate.addZyme('GlobalVariable', {
+ substrate.addActor('GlobalVariable', {
processItem: function(item) {
item.intertype = 'GlobalVariableStub';
item.__result__ = true;
@@ -266,7 +266,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
});
// functionStub
- substrate.addZyme('FunctionStub', {
+ substrate.addActor('FunctionStub', {
processItem: function(item) {
var shortident = item.ident.substr(1);
if (shortident in Library) {
@@ -294,7 +294,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
});
// function splitter
- substrate.addZyme('FunctionSplitter', {
+ substrate.addActor('FunctionSplitter', {
processItem: function(item) {
var ret = [item];
item.splitItems = 0;
@@ -313,7 +313,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
});
// function reconstructor & post-JS optimizer
- substrate.addZyme('FunctionReconstructor', {
+ substrate.addActor('FunctionReconstructor', {
funcs: {},
seen: {},
processItem: function(item) {
@@ -460,7 +460,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
}
}
- substrate.addZyme('FuncLineTriager', {
+ substrate.addActor('FuncLineTriager', {
processItem: function(item) {
if (item.intertype == 'function') {
this.forwardItem(item, 'FunctionReconstructor');
@@ -477,14 +477,14 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
});
// assignment
- substrate.addZyme('Intertype:assign', {
+ substrate.addActor('Intertype:assign', {
processItem: function(item) {
var pair = splitItem(item, 'value', ['funcData']);
this.forwardItem(pair.parent, 'AssignReintegrator');
this.forwardItem(pair.child, 'FuncLineTriager');
}
});
- substrate.addZyme('AssignReintegrator', makeReintegrator(function(item, child) {
+ substrate.addActor('AssignReintegrator', makeReintegrator(function(item, child) {
// 'var', since this is SSA - first assignment is the only assignment, and where it is defined
item.JS = (item.overrideSSA ? '' : 'var ') + toNiceIdent(item.ident);
@@ -514,8 +514,8 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
}));
// Function lines
- function makeFuncLineZyme(intertype, func) {
- substrate.addZyme('Intertype:' + intertype, {
+ function makeFuncLineActor(intertype, func) {
+ substrate.addActor('Intertype:' + intertype, {
processItem: function(item) {
item.JS = func(item);
if (!item.JS) throw "XXX - no JS generated for " + dump(item);
@@ -523,7 +523,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
}
});
}
- makeFuncLineZyme('store', function(item) {
+ makeFuncLineActor('store', function(item) {
var value = indexizeFunctions(finalizeLLVMParameter(item.value));
if (pointingLevels(item.pointerType) == 1) {
value = parseNumerical(value, removePointing(item.pointerType));
@@ -548,7 +548,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
}
});
- makeFuncLineZyme('deleted', function(item) { return ';' });
+ makeFuncLineActor('deleted', function(item) { return ';' });
var LABEL_IDs = {};
var LABEL_ID_COUNTER = 0;
@@ -588,7 +588,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
}
}
- makeFuncLineZyme('branch', function(item) {
+ makeFuncLineActor('branch', function(item) {
if (item.stolen) return ';'; // We will appear where we were stolen to
if (!item.ident) {
return makeBranch(item.label, item.currLabelId);
@@ -609,7 +609,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
}
}
});
- makeFuncLineZyme('switch', function(item) {
+ makeFuncLineActor('switch', function(item) {
var ret = '';
var first = true;
item.switchLabels.forEach(function(switchLabel) {
@@ -630,7 +630,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
}
return ret;
});
- makeFuncLineZyme('return', function(item) {
+ makeFuncLineActor('return', function(item) {
var ret = RuntimeGenerator.stackExit(item.funcData.initialStack) + ';\n';
if (LABEL_DEBUG) {
ret += "print(INDENT + 'Exiting: " + item.funcData.ident + "');\n"
@@ -642,7 +642,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
}
return ret + ';';
});
- makeFuncLineZyme('invoke', function(item) {
+ makeFuncLineActor('invoke', function(item) {
// Wrapping in a function lets us easily return values if we are
// in an assignment
var ret = '(function() { try { __THREW__ = false; return '
@@ -654,7 +654,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
+ ' } else { ' + makeBranch(item.unwindLabel, item.currLabelId) + ' }';
return ret;
});
- makeFuncLineZyme('load', function(item) {
+ makeFuncLineActor('load', function(item) {
var ident = toNiceIdent(item.ident);
var impl = getVarImpl(item.funcData, item.ident);
switch (impl) {
@@ -665,12 +665,12 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
default: throw "unknown [load] impl: " + impl;
}
});
- makeFuncLineZyme('extractvalue', function(item) {
+ makeFuncLineActor('extractvalue', function(item) {
assert(item.indexes.length == 1); // TODO: use getelementptr parsing stuff, for depth. For now, we assume that LLVM aggregates are flat,
// and we emulate them using simple JS objects { f1: , f2: , } etc., for speed
return item.ident + '.f' + item.indexes[0][0].text;
});
- makeFuncLineZyme('alloca', function(item) {
+ makeFuncLineActor('alloca', function(item) {
if (typeof item.allocatedIndex === 'number') {
if (item.allocatedSize === 0) return ''; // This will not actually be shown - it's nativized
return getFastValue('__stackBase__', '+', item.allocatedIndex.toString());
@@ -678,7 +678,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
return RuntimeGenerator.stackAlloc(getFastValue(calcAllocatedSize(item.allocatedType, TYPES), '*', item.allocatedNum));
}
});
- makeFuncLineZyme('phi', function(item) {
+ makeFuncLineActor('phi', function(item) {
var params = item.params;
function makeOne(i) {
if (i === params.length-1) {
@@ -697,7 +697,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
}
}
- makeFuncLineZyme('mathop', function(item) { with(item) {
+ makeFuncLineActor('mathop', function(item) { with(item) {
for (var i = 1; i <= 4; i++) {
if (item['param'+i]) {
item['ident'+i] = indexizeFunctions(finalizeLLVMParameter(item['param'+i]));
@@ -896,7 +896,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
}
}
- makeFuncLineZyme('bitcast', function(item) {
+ makeFuncLineActor('bitcast', function(item) {
// XXX Don't we need to copy ptr - i.e. create new ones (at least if uses > just the next line)?
// XXX hardcoded ptr impl - as ptrs are ints, we don't need to copy
var ident = toNiceIdent(item.ident);
@@ -948,21 +948,21 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
return ident + '(' + args.concat(varargs).join(', ') + ')';
}
- makeFuncLineZyme('getelementptr', function(item) { return finalizeLLVMFunctionCall(item) });
- makeFuncLineZyme('call', function(item) {
+ makeFuncLineActor('getelementptr', function(item) { return finalizeLLVMFunctionCall(item) });
+ makeFuncLineActor('call', function(item) {
return makeFunctionCall(item.ident, item.params, item.funcData) + (item.standalone ? ';' : '');
});
// Optimzed intertypes
- makeFuncLineZyme('fastgetelementptrload', function(item) {
+ makeFuncLineActor('fastgetelementptrload', function(item) {
return 'var ' + item.ident + ' = ' + makeGetValue(parseNumerical(item.value.ident), getGetElementPtrIndexes(item.value), true, item.value.valueType) + ';';
});
- makeFuncLineZyme('fastgetelementptrstore', function(item) {
+ makeFuncLineActor('fastgetelementptrstore', function(item) {
return makeSetValue(item.value.ident, getGetElementPtrIndexes(item.value), parseNumerical(item.ident), true, item.type) + ';';
});
- makeFuncLineZyme('unreachable', function(item) { return 'throw "Reached an unreachable! Original .ll line: ' + item.lineNum + '";' });
+ makeFuncLineActor('unreachable', function(item) { return 'throw "Reached an unreachable! Original .ll line: ' + item.lineNum + '";' });
// Final combiner
diff --git a/src/settings.js b/src/settings.js
index 98b95035..04bfa79a 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -38,7 +38,7 @@ EXECUTION_TIMEOUT = -1; // Throw an exception after X seconds - useful to debug
// Compiler debugging options
DEBUG_TAGS_SHOWING = [];
// Some useful items:
- // enzymatic
+ // framework
// gconst
// types
// vars