aboutsummaryrefslogtreecommitdiff
path: root/src/runtime.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime.js')
-rw-r--r--src/runtime.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/runtime.js b/src/runtime.js
index a9265e70..0c724e50 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -487,6 +487,19 @@ var Runtime = {
}
},
+#if RETAIN_COMPILER_SETTINGS
+ compilerSettings: {},
+#endif
+
+ getCompilerSetting: function(name) {
+#if RETAIN_COMPILER_SETTINGS == 0
+ throw 'You must build with -s RETAIN_COMPILER_SETTINGS=1 for Runtime.getCompilerSetting or emscripten_get_compiler_setting to work';
+#else
+ if (!(name in Runtime.compilerSettings)) return 'invalid compiler setting: ' + name;
+ return Runtime.compilerSettings[name];
+#endif
+ },
+
#if RUNTIME_DEBUG
debug: true, // Switch to false at runtime to disable logging at the right times
@@ -612,3 +625,12 @@ function reSign(value, bits, ignore) {
// Then 'dynamic' memory for sbrk.
Runtime.GLOBAL_BASE = Runtime.alignMemory(1);
+if (RETAIN_COMPILER_SETTINGS) {
+ var blacklist = set('RELOOPER', 'STRUCT_INFO');
+ for (var x in this) {
+ try {
+ if (x[0] !== '_' && !(x in blacklist) && x == x.toUpperCase() && (typeof this[x] === 'number' || typeof this[x] === 'string' || this.isArray())) Runtime.compilerSettings[x] = this[x];
+ } catch(e){}
+ }
+}
+