aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler.js8
-rw-r--r--src/parseTools.js8
-rw-r--r--src/preamble.js4
-rw-r--r--src/settings.js13
4 files changed, 21 insertions, 12 deletions
diff --git a/src/compiler.js b/src/compiler.js
index 15dd8dc3..3d33ed22 100644
--- a/src/compiler.js
+++ b/src/compiler.js
@@ -47,6 +47,12 @@ if (SAFE_HEAP >= 2) {
SAFE_HEAP_LINES = set(SAFE_HEAP_LINES); // for fast checking
}
+if (PGO) { // by default, correct everything during PGO
+ CORRECT_SIGNS = CORRECT_SIGNS || 1;
+ CORRECT_OVERFLOWS = CORRECT_OVERFLOWS || 1;
+ CORRECT_ROUNDINGS = CORRECT_ROUNDINGS || 1;
+}
+
EXPORTED_FUNCTIONS = set(EXPORTED_FUNCTIONS);
EXPORTED_GLOBALS = set(EXPORTED_GLOBALS);
@@ -57,7 +63,7 @@ assert(!(USE_TYPED_ARRAYS === 2 && QUANTUM_SIZE !== 4), 'For USE_TYPED_ARRAYS ==
// Output some info and warnings based on settings
if (!OPTIMIZE || !RELOOP || ASSERTIONS || CHECK_SIGNS || CHECK_OVERFLOWS || INIT_STACK || INIT_HEAP ||
- !SKIP_STACK_IN_SMALL || SAFE_HEAP || AUTO_OPTIMIZE || PROFILE || !DISABLE_EXCEPTION_CATCHING) {
+ !SKIP_STACK_IN_SMALL || SAFE_HEAP || PGO || PROFILE || !DISABLE_EXCEPTION_CATCHING) {
print('// Note: Some Emscripten settings will significantly limit the speed of the generated code.');
} else {
print('// Note: For maximum-speed code, see "Optimizing Code" on the Emscripten wiki, https://github.com/kripken/emscripten/wiki/Optimizing-Code');
diff --git a/src/parseTools.js b/src/parseTools.js
index 423ed0cb..d7514ef5 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1342,8 +1342,8 @@ function handleOverflow(text, bits) {
if (!bits) return text;
var correct = correctOverflows();
warn(!correct || bits <= 32, 'Cannot correct overflows of this many bits: ' + bits + ' at line ' + Framework.currItem.lineNum);
- if (CHECK_OVERFLOWS) return 'CHECK_OVERFLOW(' + text + ', ' + bits + ', ' + Math.floor(correctSpecificOverflow() && !AUTO_OPTIMIZE) + (
- AUTO_OPTIMIZE ? ', "' + Debugging.getIdentifier() + '"' : ''
+ if (CHECK_OVERFLOWS) return 'CHECK_OVERFLOW(' + text + ', ' + bits + ', ' + Math.floor(correctSpecificOverflow() && !PGO) + (
+ PGO ? ', "' + Debugging.getIdentifier() + '"' : ''
) + ')';
if (!correct) return text;
if (bits <= 32) {
@@ -1398,8 +1398,8 @@ function makeSignOp(value, type, op, force) {
var bits, full;
if (type in Runtime.INT_TYPES) {
bits = parseInt(type.substr(1));
- full = op + 'Sign(' + value + ', ' + bits + ', ' + Math.floor(correctSpecificSign() && !AUTO_OPTIMIZE) + (
- AUTO_OPTIMIZE ? ', "' + Debugging.getIdentifier() + '"' : ''
+ full = op + 'Sign(' + value + ', ' + bits + ', ' + Math.floor(correctSpecificSign() && !PGO) + (
+ PGO ? ', "' + Debugging.getIdentifier() + '"' : ''
) + ')';
// Always sign/unsign constants at compile time, regardless of CHECK/CORRECT
if (isNumber(value)) {
diff --git a/src/preamble.js b/src/preamble.js
index 4bdb4333..9df6bf60 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -187,7 +187,7 @@ function SAFE_HEAP_COPY_HISTORY(dest, src) {
#endif
var CorrectionsMonitor = {
-#if AUTO_OPTIMIZE
+#if PGO
MAX_ALLOWED: Infinity,
#else
MAX_ALLOWED: 0, // XXX
@@ -200,7 +200,7 @@ var CorrectionsMonitor = {
this.corrections++;
if (this.corrections >= this.MAX_ALLOWED) abort('\n\nToo many corrections!');
}
-#if AUTO_OPTIMIZE
+#if PGO
if (!sig)
sig = (new Error().stack).toString().split('\n')[2].split(':').slice(-1)[0]; // Spidermonkey-specific FIXME
sig = type + '|' + sig;
diff --git a/src/settings.js b/src/settings.js
index e8f65f58..1d64f143 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -125,11 +125,14 @@ CORRECT_ROUNDINGS = 1; // C rounds to 0 (-5.5 to -5, +5.5 to 5), while JS has no
// Math.floor is to negative, ceil to positive. With CORRECT_ROUNDINGS,
// we will do slow but correct C rounding operations.
-AUTO_OPTIMIZE = 0; // When run with the CHECK_* options, will not fail on errors. Instead, will
- // keep a record of which checks succeeded and which failed. On shutdown, will
- // print out that information. This is useful for knowing which lines need
- // checking enabled and which do not, that is, this is a way to automate the
- // generation of line data for CORRECT_*_LINES options
+PGO = 0; // Profile-guided optimization.
+ // When run with the CHECK_* options, will not fail on errors. Instead, will
+ // keep a record of which checks succeeded and which failed. On shutdown, will
+ // print out that information. This is useful for knowing which lines need
+ // checking enabled and which do not, that is, this is a way to automate the
+ // generation of line data for CORRECT_*_LINES options.
+ // All CORRECT_* options default to 1 with PGO builds.
+ // See https://github.com/kripken/emscripten/wiki/Optimizing-Code for more info
PROFILE = 0; // Enables runtime profiling. See test_profiling for a usage example.