Skip to content

Commit

Permalink
Merge branch 'incoming' into linking
Browse files Browse the repository at this point in the history
Conflicts:
	emcc
	src/jsifier.js
	src/shell_sharedlib.js
  • Loading branch information
kripken committed Apr 26, 2015
2 parents 7c5403b + 43141c8 commit 657a2ac
Show file tree
Hide file tree
Showing 23 changed files with 252 additions and 921 deletions.
49 changes: 16 additions & 33 deletions emcc
Original file line number Diff line number Diff line change
Expand Up @@ -928,19 +928,13 @@ try:
fastcomp_opts += ['-emscripten-asyncify-functions=' + ','.join(shared.Settings.ASYNCIFY_FUNCTIONS)]
fastcomp_opts += ['-emscripten-asyncify-whitelist=' + ','.join(shared.Settings.ASYNCIFY_WHITELIST)]

if shared.Settings.CORRECT_SIGNS != 1:
logging.warning('setting CORRECT_SIGNS to 1 for asm.js code generation')
shared.Settings.CORRECT_SIGNS = 1
if shared.Settings.CORRECT_OVERFLOWS != 1:
logging.warning('setting CORRECT_OVERFLOWS to 1 for asm.js code generation')
shared.Settings.CORRECT_OVERFLOWS = 1
assert not shared.Settings.PGO, 'cannot run PGO in ASM_JS mode'

if shared.Settings.SAFE_HEAP and not js_opts:
js_opts = True
logging.warning('enabling js opts for SAFE_HEAP')

if shared.Settings.CORRECT_SIGNS >= 2 or shared.Settings.CORRECT_OVERFLOWS >= 2 or shared.Settings.CORRECT_ROUNDINGS >= 2 or shared.Settings.SAFE_HEAP >= 2:
if shared.Settings.SAFE_HEAP >= 2:
debug_level = 4 # must keep debug info to do line-by-line operations

if debug_level > 1 and closure:
Expand Down Expand Up @@ -993,7 +987,7 @@ try:
else:
logging.debug('using response file for EXPORTED_FUNCTIONS, make sure it includes _malloc and _free')

if shared.Settings.ASM_JS and shared.Settings.RELOCATABLE:
if shared.Settings.RELOCATABLE:
assert shared.Settings.DISABLE_EXCEPTION_CATCHING, 'no exceptions support with relocatable modules yet'

assert not (bind and shared.Settings.NO_DYNAMIC_EXECUTION), 'NO_DYNAMIC_EXECUTION disallows embind'
Expand Down Expand Up @@ -1392,10 +1386,9 @@ try:

def run_passes(passes, title, just_split, just_concat):
global final, minify_whitespace, emit_symbol_map, target
if shared.Settings.ASM_JS:
passes = ['asm'] + passes
if shared.Settings.PRECISE_F32:
passes = ['asmPreciseF32'] + passes
passes = ['asm'] + passes
if shared.Settings.PRECISE_F32:
passes = ['asmPreciseF32'] + passes
if emit_symbol_map and 'minifyNames' in passes:
passes += ['symbolMap='+target+'.symbols']
if profiling_funcs and 'minifyNames' in passes:
Expand Down Expand Up @@ -1488,55 +1481,45 @@ try:

if shared.Settings.PRECISE_F32: js_optimizer_queue += ['optimizeFrounds']

if closure and not shared.Settings.ASM_JS:
flush_js_optimizer_queue()

logging.debug('running closure')
# no need to add this to js_transform_tempfiles, because closure and
# debug_level > 0 are never simultaneously true
final = shared.Building.closure_compiler(final)
if DEBUG: save_intermediate('closure')

def do_minify():
global js_optimizer_queue

if opt_level >= 2:
if debug_level < 2 and shared.Settings.ASM_JS and not closure == 2:
if debug_level < 2 and not closure == 2:
js_optimizer_queue += ['minifyNames']
if debug_level == 0:
global minify_whitespace
minify_whitespace = True

if shared.Settings.ASM_JS:
if closure == 1:
js_optimizer_queue += ['closure']
elif debug_level <= 2 and not shared.Settings.MAIN_MODULE and shared.Settings.FINALIZE_ASM_JS and not closure:
js_optimizer_queue += ['cleanup']
if closure == 1:
js_optimizer_queue += ['closure']
elif debug_level <= 2 and not shared.Settings.MAIN_MODULE and shared.Settings.FINALIZE_ASM_JS and not closure:
js_optimizer_queue += ['cleanup']

if js_opts:
if shared.Settings.ASM_JS and shared.Settings.SAFE_HEAP: js_optimizer_queue += ['safeHeap']
if shared.Settings.SAFE_HEAP: js_optimizer_queue += ['safeHeap']

if shared.Settings.OUTLINING_LIMIT > 0 and shared.Settings.ASM_JS:
if shared.Settings.OUTLINING_LIMIT > 0:
js_optimizer_queue += ['outline']
js_optimizer_extra_info['sizeToOutline'] = shared.Settings.OUTLINING_LIMIT

if opt_level >= 2 and (not closure or shared.Settings.ASM_JS or closure == 2) and debug_level < 3:
if shared.Settings.ASM_JS and (opt_level >= 3 or shrink_level > 0):
if opt_level >= 2 and debug_level < 3:
if opt_level >= 3 or shrink_level > 0:
js_optimizer_queue += ['registerizeHarder']
else:
js_optimizer_queue += ['registerize']

if not shared.Settings.EMTERPRETIFY:
do_minify()

if opt_level >= 2 and shared.Settings.ASM_JS:
if opt_level >= 2:
js_optimizer_queue += ['asmLastOpts']

if shared.Settings.FINALIZE_ASM_JS: js_optimizer_queue += ['last']

flush_js_optimizer_queue()

if shared.Settings.ASM_JS and closure == 2:
if closure == 2:
flush_js_optimizer_queue()

logging.debug('running closure')
Expand Down
12 changes: 6 additions & 6 deletions emscripten.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
funcs = backend_output[start_funcs+len(start_funcs_marker):end_funcs]
metadata_raw = backend_output[metadata_split+len(metadata_split_marker):]
#if DEBUG: print >> sys.stderr, "METAraw", metadata_raw
metadata = json.loads(metadata_raw)
try:
metadata = json.loads(metadata_raw)
except Exception, e:
logging.error('emscript: failure to parse metadata output from compiler backend. raw output is: \n' + metadata_raw)
raise e
mem_init = backend_output[end_funcs+len(end_funcs_marker):metadata_split]
#if DEBUG: print >> sys.stderr, "FUNCS", funcs
#if DEBUG: print >> sys.stderr, "META", metadata
Expand Down Expand Up @@ -187,7 +191,7 @@ def save_settings():
# Call js compiler
if DEBUG: t = time.time()
out = jsrun.run_js(path_from_root('src', 'compiler.js'), compiler_engine,
[settings_file, ';', 'glue'] + libraries, stdout=subprocess.PIPE, stderr=STDERR_FILE,
[settings_file] + libraries, stdout=subprocess.PIPE, stderr=STDERR_FILE,
cwd=path_from_root('src'), error_limit=300)
assert '//FORWARDED_DATA:' in out, 'Did not receive forwarded data in pre output - process failed?'
glue, forwarded_data = out.split('//FORWARDED_DATA:')
Expand All @@ -202,10 +206,6 @@ def save_settings():

last_forwarded_json['Functions']['tables'] = metadata['tables']

'''indexed_functions = set()
for key in forwarded_json['Functions']['indexedFunctions'].iterkeys():
indexed_functions.add(key)'''

pre, post = glue.split('// EMSCRIPTEN_END_FUNCS')

#print >> sys.stderr, 'glue:', pre, '\n\n||||||||||||||||\n\n', post, '...............'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


#the directory, relative to \source for the API reference
api_reference_directory = '.\\docs\\api_reference\\'
api_reference_directory = './docs/api_reference/'

#name to write API items to. Note, this is used by the get-wiki.py script, so if you change here, change everywhere.
api_item_filename = 'api_items.py'
Expand Down
4 changes: 2 additions & 2 deletions site/source/get_wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


wiki_repo = 'https://github.com/kripken/emscripten.wiki.git'
wiki_directory = '.\\wiki_static\\'
wiki_directory = './wiki_static/'
logfilename='log-get-wiki.txt'


Expand All @@ -45,7 +45,7 @@



wiki_temp_directory = wiki_directory + 'temp\\'
wiki_temp_directory = wiki_directory + 'temp/'
temp_set_of_codemarkup=set()
logfile=open(logfilename,'w')
#snapshot_version_information='.. note:: This is a **snapshot** of the wiki: %s\n\n' % strftime("%a, %d %b %Y %H:%M", gmtime())
Expand Down
57 changes: 13 additions & 44 deletions src/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,7 @@ load('utility.js');
load('settings.js');

var settings_file = arguments_[0];
var ll_file = arguments_[1];
phase = arguments_[2];
if (phase == 'pre' || phase == 'glue') {
additionalLibraries = Array.prototype.slice.call(arguments_, 3);
} else {
var forwardedDataFile = arguments_[3];
additionalLibraries = Array.prototype.slice.call(arguments_, 4);
}
additionalLibraries = Array.prototype.slice.call(arguments_, 1);

if (settings_file) {
var settings = JSON.parse(read(settings_file));
Expand All @@ -158,15 +151,6 @@ if (settings_file) {
}


if (CORRECT_SIGNS >= 2) {
CORRECT_SIGNS_LINES = set(CORRECT_SIGNS_LINES); // for fast checking
}
if (CORRECT_OVERFLOWS >= 2) {
CORRECT_OVERFLOWS_LINES = set(CORRECT_OVERFLOWS_LINES); // for fast checking
}
if (CORRECT_ROUNDINGS >= 2) {
CORRECT_ROUNDINGS_LINES = set(CORRECT_ROUNDINGS_LINES); // for fast checking
}
if (SAFE_HEAP >= 2) {
SAFE_HEAP_LINES = set(SAFE_HEAP_LINES); // for fast checking
}
Expand Down Expand Up @@ -196,19 +180,6 @@ assert(!(!NAMED_GLOBALS && BUILD_AS_SHARED_LIB), 'shared libraries must have nam

// Output some info and warnings based on settings

if (phase == 'pre') {
if (!MICRO_OPTS || ASSERTIONS || CHECK_SIGNS || CHECK_OVERFLOWS || INIT_HEAP ||
!SKIP_STACK_IN_SMALL || SAFE_HEAP || !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, http://kripken.github.io/emscripten-site/docs/optimizing/Optimizing-Code.html');
}

if (DOUBLE_MODE || CORRECT_SIGNS || CORRECT_OVERFLOWS || CORRECT_ROUNDINGS || CHECK_HEAP_ALIGN) {
print('// Note: Some Emscripten settings may limit the speed of the generated code.');
}
}

if (VERBOSE) printErr('VERBOSE is on, this generates a lot of output and can slow down compilation');

if (!BOOTSTRAPPING_STRUCT_INFO) {
Expand Down Expand Up @@ -241,20 +212,18 @@ Runtime.QUANTUM_SIZE = QUANTUM_SIZE;
B = new Benchmarker();

try {
if (ll_file) {
var dummyData = {functionStubs: []}
JSify(dummyData);

//dumpInterProf();
//printErr(phase + ' paths (fast, slow): ' + [fastPaths, slowPaths]);
B.print(phase);

if (DEBUG_MEMORY) {
print('zzz. last gc: ' + gc());
MemoryDebugger.dump();
print('zzz. hanging now!');
while(1){};
}
var dummyData = {functionStubs: []}
JSify(dummyData);

//dumpInterProf();
//printErr('paths (fast, slow): ' + [fastPaths, slowPaths]);
B.print('glue');

if (DEBUG_MEMORY) {
print('zzz. last gc: ' + gc());
MemoryDebugger.dump();
print('zzz. hanging now!');
while(1){};
}
} catch(err) {
if (err.toString().indexOf('Aborting compilation due to previous errors') != -1) {
Expand Down
4 changes: 2 additions & 2 deletions src/emrun_postjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ function emrun_register_handlers() {
var prevErr = Module['printErr'];
function emrun_exit() { post('^exit^'+EXITSTATUS); };
Module['addOnExit'](emrun_exit);
Module['print'] = function emrun_print(text) { post('^out^'+(emrun_http_sequence_number++)+'^'+text); prevPrint(text); }
Module['printErr'] = function emrun_printErr(text) { post('^err^'+(emrun_http_sequence_number++)+'^'+text); prevErr(text); }
Module['print'] = function emrun_print(text) { post('^out^'+(emrun_http_sequence_number++)+'^'+encodeURIComponent(text)); prevPrint(text); }
Module['printErr'] = function emrun_printErr(text) { post('^err^'+(emrun_http_sequence_number++)+'^'+encodeURIComponent(text)); prevErr(text); }
}
// Notify emrun web server that this browser has successfully launched the page.
post('^pageload^');
Expand Down
Loading

0 comments on commit 657a2ac

Please sign in to comment.