aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-06-29 20:28:57 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-06-29 20:28:57 -0700
commita326e6a1ec7c124dd4e74a38d3c8948b3ace92bc (patch)
treef95402e3c50a04c59921813389daef29efe51552 /src
parent0e9344a42800afd65b3c74c86e79ed78c15161f0 (diff)
backout previous broken commit
Diffstat (limited to 'src')
-rw-r--r--src/jsifier.js26
-rw-r--r--src/library.js15
-rw-r--r--src/modules.js2
-rw-r--r--src/parseTools.js2
4 files changed, 10 insertions, 35 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 5a92ba52..62acf8d7 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -3,10 +3,8 @@
// Main function
function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
- var mainPass = !functionsOnly;
-
// Add additional necessary items for the main pass
- if (mainPass) {
+ if (!functionsOnly) {
var libFuncsToInclude;
if (INCLUDE_FULL_LIBRARY) {
assert(!BUILD_AS_SHARED_LIB, 'Cannot have both INCLUDE_FULL_LIBRARY and BUILD_AS_SHARED_LIB set.')
@@ -33,15 +31,11 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
substrate = new Substrate('JSifyer');
- var GLOBAL_VARIABLES = !mainPass ? givenGlobalVariables : data.globalVariables;
-
- Functions.currFunctions = !mainPass ? givenFunctions : {};
- if (mainPass) {
- Functions.currExternalFunctions = set(data.functionStubs.map(function(item) { return item.ident }));
- }
+ var GLOBAL_VARIABLES = functionsOnly ? givenGlobalVariables : data.globalVariables;
- // Now that first-pass analysis has completed (so we have basic types, etc.), we can get around to handling unparsedFunctions
- (!mainPass ? data.functions : data.unparsedFunctions.concat(data.functions)).forEach(function(func) {
+ Functions.currFunctions = functionsOnly ? givenFunctions : {};
+ // Now that analysis has completed, we can get around to handling unparsedFunctions
+ (functionsOnly ? data.functions : data.unparsedFunctions.concat(data.functions)).forEach(function(func) {
// Save just what we need, to save memory
Functions.currFunctions[func.ident] = {
hasVarArgs: func.hasVarArgs,
@@ -63,11 +57,7 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
if (data.unparsedFunctions.length > 0) {
// We are now doing the final JS generation
dprint('unparsedFunctions', '== Completed unparsedFunctions ==\n');
-
- // Save some memory, before the final heavy lifting
- //Functions.currFunctions = null;
- //Functions.currExternalFunctions = null;
- //Debugging.clear();
+ //Debugging.clear(); // Save some memory, before the final heavy lifting
}
// Actors
@@ -781,12 +771,12 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
items = null;
var generated = [];
- if (mainPass) {
+ if (!functionsOnly) {
generated = generated.concat(itemsDict.type).concat(itemsDict.GlobalVariableStub).concat(itemsDict.functionStub);
}
generated = generated.concat(itemsDict.function).concat(data.unparsedFunctions);
- if (!mainPass) return generated.map(function(item) { return item.JS }).join('\n');
+ if (functionsOnly) return generated.map(function(item) { return item.JS }).join('\n');
// We are ready to print out the data, but must do so carefully - we are
// dealing with potentially *huge* strings. Convenient replacements and
diff --git a/src/library.js b/src/library.js
index 685f839a..284f093d 100644
--- a/src/library.js
+++ b/src/library.js
@@ -1476,17 +1476,7 @@ var Library = {
// ==========================================================================
- // dlfcn.h - Dynamic library loading
- //
- // Some limitations:
- //
- // * Minification on each file separately may not work, as they will
- // have different shortened names. You can in theory combine them, then
- // minify, then split... perhaps.
- //
- // * LLVM optimizations may fail. If the child wants to access a function
- // in the parent, LLVM opts may remove it from the parent when it is
- // being compiled. Not sure how to tell LLVM to not do so.
+ // dlfcn.h
// ==========================================================================
// Data for dlfcn.h.
@@ -1520,9 +1510,6 @@ var Library = {
try {
var lib_module = eval(lib_data)(FUNCTION_TABLE.length);
} catch (e) {
-#if ASSERTIONS
- print('Error in loading dynamic library: ' + e);
-#endif
DLFCN_DATA.isError = true;
return 0;
}
diff --git a/src/modules.js b/src/modules.js
index f9185725..91758609 100644
--- a/src/modules.js
+++ b/src/modules.js
@@ -124,8 +124,6 @@ var Types = {
var Functions = {
// The list of function datas which are being processed in the jsifier, currently
currFunctions: [],
- // The list of functions that are external'ly defined
- currExternalFunctions: [],
indexedFunctions: [0, 0], // Start at a non-0 (even, see below) value
diff --git a/src/parseTools.js b/src/parseTools.js
index fe71ff3b..4f0cda35 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -695,7 +695,7 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned) {
}
function indexizeFunctions(value) {
- if (value in Functions.currFunctions || value in Functions.currExternalFunctions) {
+ if (value in Functions.currFunctions) {
if (BUILD_AS_SHARED_LIB) {
return '(FUNCTION_TABLE_OFFSET + ' + Functions.getIndex(value) + ')';
} else {