Skip to content

Commit 0b3416a

Browse files
committedJan 7, 2014
Merge branch 'incoming' into llvm-3.4
Conflicts: tests/test_benchmark.py tools/shared.py
2 parents 6fee37f + e4e8063 commit 0b3416a

19 files changed

+670
-162
lines changed
 

‎ChangeLog

+34-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,40 @@ Not all changes are documented here. In particular, new features, user-oriented
1010
Current trunk code
1111
------------------
1212
- To see a list of commits in the active development branch 'incoming', which have not yet been packaged in a release, see
13-
https://github.com/kripken/emscripten/compare/1.7.8...incoming
13+
https://github.com/kripken/emscripten/compare/1.8.2...incoming
14+
15+
v1.8.2: 1/4/2013
16+
------------------
17+
- Fixed glGetFramebufferAttachmentParameteriv and an issue with glGetXXX when the returned value was null.
18+
- Full list of changes: https://github.com/kripken/emscripten/compare/1.8.1...1.8.2
19+
20+
v1.8.1: 1/3/2013
21+
------------------
22+
- Added support for WebGL hardware instancing extension.
23+
- Improved fastcomp native LLVM backend support.
24+
- Added support for #include filename.js to JS libraries.
25+
- Deprecated --compression emcc command line parameter that manually compressed output JS files, due to performance issues. Instead, it is best to rely on the web server to serve compressed JS files.
26+
- Full list of changes: https://github.com/kripken/emscripten/compare/1.8.0...1.8.1
27+
28+
v1.8.0: 12/28/2013
29+
------------------
30+
- Fix two issues with function outliner and relooper.
31+
- Full list of changes: https://github.com/kripken/emscripten/compare/1.7.9...1.8.0
32+
33+
v1.7.9: 12/27/2013
34+
------------------
35+
- Added new command line parameter --em-config that allows specifying a custom location for the .emscripten configuration file.
36+
- Reintroduced relaxed asm.js heap sizes, which no longer need to be power of 2, but a multiple of 16MB is sufficient.
37+
- Added emrun command line tool that allows launching .html pages from command line on desktop and Android as if they were native applications. See https://groups.google.com/forum/#!topic/emscripten-discuss/t2juu3q1H8E . Adds --emrun compiler link flag.
38+
- Began initial work on the "fastcomp" compiler toolchain, a rewrite of the previous JS LLVM AST parsing and codegen via a native LLVM backend.
39+
- Added --exclude-file command line flag to emcc and a matching --exclude command line flag to file packager, which allows specifying files and directories that should be excluded while packaging a VFS data blob.
40+
- Improved GLES2 and EGL support libraries to be more spec-conformant.
41+
- Optimized legacy GL emulation code path. Added new GL_FFP_ONLY optimization path to fixed function pipeline emulation.
42+
- Added new core functions emscripten_log() and emscripten_get_callstack() that allow printing out log messages with demangled and source-mapped callstack information.
43+
- Improved BSD Sockets support. Implemented getprotobyname() for BSD Sockets library.
44+
- Fixed issues with simd support.
45+
- Various bugfixes: #1573, #1846, #1886, #1908, #1918, #1930, #1931, #1942, #1948, ..
46+
- Full list of changes: https://github.com/kripken/emscripten/compare/1.7.8...1.7.9
1447

1548
v1.7.8: 11/19/2013
1649
------------------

‎emcc

+3
Original file line numberDiff line numberDiff line change
@@ -1916,6 +1916,9 @@ try:
19161916

19171917
js_optimizer_queue += [get_eliminate()]
19181918

1919+
if shared.Settings.AGGRESSIVE_VARIABLE_ELIMINATION:
1920+
js_optimizer_queue += ['aggressiveVariableElimination']
1921+
19191922
if opt_level >= 2:
19201923
js_optimizer_queue += ['simplifyExpressions']
19211924

‎src/closure-externs.js

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/**
2+
* This file contains definitions for things that we'd really rather the closure compiler *didn't* minify.
3+
* See http://code.google.com/p/closure-compiler/wiki/FAQ#How_do_I_write_an_externs_file
4+
* See also the discussion here: https://github.com/kripken/emscripten/issues/1979
5+
*
6+
* The closure_compiler() method in tools/shared.py refers to this file when calling closure.
7+
*/
8+
9+
// Closure externs used by library_uuid.js
10+
11+
/**
12+
* @param {Array} typedArray
13+
*/
14+
crypto.getRandomValues = function(typedArray) {};
15+
16+
/**
17+
BEGIN_NODE_INCLUDE
18+
var crypto = require('crypto');
19+
END_NODE_INCLUDE
20+
*/
21+
22+
/**
23+
* @type {Object.<string,*>}
24+
*/
25+
var crypto = {};
26+
27+
/**
28+
* @param {number} size
29+
* @param {function(Error, buffer.Buffer)} callback
30+
*/
31+
crypto.randomBytes = function(size, callback) {};
32+
33+
34+
// Closure externs used by library_sockfs.js
35+
36+
/**
37+
BEGIN_NODE_INCLUDE
38+
var ws = require('ws');
39+
END_NODE_INCLUDE
40+
*/
41+
42+
/**
43+
* @type {Object.<string,*>}
44+
*/
45+
var ws = {};
46+
47+
/**
48+
* @param {string} event
49+
* @param {function()} callback
50+
*/
51+
ws.on = function(event, callback) {};
52+
53+
/**
54+
* @param {Object} data
55+
* @param {Object} flags
56+
* @param {function()=} callback
57+
*/
58+
ws.send = function(data, flags, callback) {};
59+
60+
/**
61+
* @type {boolean}
62+
*/
63+
ws.binaryType;
64+
65+
/**
66+
* @type {Object.<string,*>}
67+
*/
68+
var wss = ws.Server;
69+
70+
/**
71+
* @param {string} event
72+
* @param {function()} callback
73+
*/
74+
wss.on = function(event, callback) {};
75+
76+
/**
77+
* @param {function()} callback
78+
*/
79+
wss.broadcast = function(callback) {};
80+
81+
/**
82+
* @type {Object.<string,*>}
83+
*/
84+
wss._socket;
85+
86+
/**
87+
* @type {string}
88+
*/
89+
wss.url;
90+
91+
/**
92+
* @type {string}
93+
*/
94+
wss._socket.remoteAddress;
95+
96+
/**
97+
* @type {number}
98+
*/
99+
wss._socket.remotePort;
100+
101+
/**
102+
* @type {Object.<string,*>}
103+
*/
104+
var flags = {};
105+
/**
106+
* @type {boolean}
107+
*/
108+
flags.binary;
109+
110+

‎src/library_uuid.js

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
// Implementation of libuuid creating RFC4122 version 4 random UUIDs.
2+
3+
mergeInto(LibraryManager.library, {
4+
// Clear a 'compact' UUID.
5+
uuid_clear: function(uu) {
6+
// void uuid_clear(uuid_t uu);
7+
_memset(uu, 0, 16);
8+
},
9+
10+
// Compare whether or not two 'compact' UUIDs are the same.
11+
// Returns an integer less than, equal to, or greater than zero if uu1 is found, respectively, to be
12+
// lexigraphically less than, equal, or greater than uu2.
13+
uuid_compare__deps: ['memcmp'],
14+
uuid_compare: function(uu1, uu2) {
15+
// int uuid_compare(const uuid_t uu1, const uuid_t uu2);
16+
return _memcmp(uu1, uu2, 16);
17+
},
18+
19+
// Copies the 'compact' UUID variable from src to dst.
20+
uuid_copy: function(dst, src) {
21+
// void uuid_copy(uuid_t dst, const uuid_t src);
22+
_memcpy(dst, src, 16);
23+
},
24+
25+
// Write a RFC4122 version 4 compliant UUID largely based on the method found in
26+
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
27+
// tweaked slightly in order to use the 'compact' UUID form used by libuuid.
28+
uuid_generate: function(out) {
29+
// void uuid_generate(uuid_t out);
30+
var uuid = null;
31+
32+
if (ENVIRONMENT_IS_NODE) {
33+
// If Node.js try to use crypto.randomBytes
34+
try {
35+
var rb = require('crypto').randomBytes;
36+
uuid = rb(16);
37+
} catch(e) {}
38+
} else if (ENVIRONMENT_IS_WEB &&
39+
typeof(window.crypto) !== 'undefined' &&
40+
typeof(window.crypto.getRandomValues) !== 'undefined') {
41+
// If crypto.getRandomValues is available try to use it.
42+
uuid = new Uint8Array(16);
43+
window.crypto.getRandomValues(uuid);
44+
}
45+
46+
// Fall back to Math.random if a higher quality random number generator is not available.
47+
if (!uuid) {
48+
uuid = new Array(16);
49+
var d = new Date().getTime();
50+
for (var i = 0; i < 16; i++) {
51+
var r = (d + Math.random()*256)%256 | 0;
52+
d = Math.floor(d/256);
53+
uuid[i] = r;
54+
}
55+
}
56+
57+
uuid[6] = (uuid[6] & 0x0F) | 0x40;
58+
uuid[8] = (uuid[8] & 0x7F) | 0x80;
59+
writeArrayToMemory(uuid, out);
60+
},
61+
62+
// Compares the value of the supplied 'compact' UUID variable uu to the NULL value.
63+
// If the value is equal to the NULL UUID, 1 is returned, otherwise 0 is returned.
64+
uuid_is_null: function(uu) {
65+
// int uuid_is_null(const uuid_t uu);
66+
for (var i = 0; i < 4; i++, uu = (uu+4)|0) {
67+
var val = {{{ makeGetValue('uu', 0, 'i32') }}};
68+
if (val) {
69+
return 0;
70+
}
71+
}
72+
return 1;
73+
},
74+
75+
// converts the UUID string given by inp into the binary representation. The input UUID is a string of
76+
// the form "%08x-%04x-%04x-%04x-%012x" 36 bytes plus the trailing '\0'.
77+
// Upon successfully parsing the input string, 0 is returned, and the UUID is stored in the location
78+
// pointed to by uu, otherwise -1 is returned.
79+
uuid_parse: function(inp, uu) {
80+
// int uuid_parse(const char *in, uuid_t uu);
81+
var inp = Pointer_stringify(inp);
82+
if (inp.length === 36) {
83+
var i = 0;
84+
var uuid = new Array(16);
85+
inp.toLowerCase().replace(/[0-9a-f]{2}/g, function(byte) {
86+
if (i < 16) {
87+
uuid[i++] = parseInt(byte, 16);
88+
}
89+
});
90+
91+
if (i < 16) {
92+
return -1;
93+
} else {
94+
writeArrayToMemory(uuid, uu);
95+
return 0;
96+
}
97+
} else {
98+
return -1;
99+
}
100+
},
101+
102+
// Convert a 'compact' form UUID to a string, if the upper parameter is supplied make the string upper case.
103+
uuid_unparse: function(uu, out, upper) {
104+
// void uuid_unparse(const uuid_t uu, char *out);
105+
var i = 0;
106+
var uuid = 'xxxx-xx-xx-xx-xxxxxx'.replace(/[x]/g, function(c) {
107+
var r = upper ? ({{{ makeGetValue('uu', 'i', 'i8', 0, 1) }}}).toString(16).toUpperCase() :
108+
({{{ makeGetValue('uu', 'i', 'i8', 0, 1) }}}).toString(16);
109+
r = (r.length === 1) ? '0' + r : r; // Zero pad single digit hex values
110+
i++;
111+
return r;
112+
});
113+
writeStringToMemory(uuid, out);
114+
},
115+
116+
// Convert a 'compact' form UUID to a lower case string.
117+
uuid_unparse_lower__deps: ['uuid_unparse'],
118+
uuid_unparse_lower: function(uu, out) {
119+
// void uuid_unparse_lower(const uuid_t uu, char *out);
120+
_uuid_unparse(uu, out);
121+
},
122+
123+
// Convert a 'compact' form UUID to an upper case string.
124+
uuid_unparse_upper__deps: ['uuid_unparse'],
125+
uuid_unparse_upper: function(uu, out) {
126+
// void uuid_unparse_upper(const uuid_t uu, char *out);
127+
_uuid_unparse(uu, out, true);
128+
},
129+
130+
uuid_type: function(uu) {
131+
// int uuid_type(const uuid_t uu);
132+
return {{{ cDefine('UUID_TYPE_DCE_RANDOM') }}};
133+
},
134+
135+
uuid_variant: function(uu) {
136+
// int uuid_variant(const uuid_t uu);
137+
return {{{ cDefine('UUID_VARIANT_DCE') }}};
138+
}
139+
});
140+

‎src/modules.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ var LibraryManager = {
424424
load: function() {
425425
if (this.library) return;
426426

427-
var libraries = ['library.js', 'library_path.js', 'library_fs.js', 'library_idbfs.js', 'library_memfs.js', 'library_nodefs.js', 'library_sockfs.js', 'library_tty.js', 'library_browser.js', 'library_sdl.js', 'library_gl.js', 'library_glut.js', 'library_xlib.js', 'library_egl.js', 'library_gc.js', 'library_jansson.js', 'library_openal.js', 'library_glfw.js'].concat(additionalLibraries);
427+
var libraries = ['library.js', 'library_path.js', 'library_fs.js', 'library_idbfs.js', 'library_memfs.js', 'library_nodefs.js', 'library_sockfs.js', 'library_tty.js', 'library_browser.js', 'library_sdl.js', 'library_gl.js', 'library_glut.js', 'library_xlib.js', 'library_egl.js', 'library_gc.js', 'library_jansson.js', 'library_openal.js', 'library_glfw.js', 'library_uuid.js'].concat(additionalLibraries);
428428
for (var i = 0; i < libraries.length; i++) {
429429
eval(processMacros(preprocess(read(libraries[i]))));
430430
}

‎src/parseTools.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ function preprocess(text) {
4949
showStack.push(ident in this && this[ident] > 0);
5050
}
5151
} else if (line[2] == 'n') { // include
52-
ret += '\n' + read(line.substr(line.indexOf(' ')+1)) + '\n'
52+
var included = read(line.substr(line.indexOf(' ')+1));
53+
ret += '\n' + preprocess(included) + '\n'
5354
}
5455
} else if (line[2] == 'l') { // else
5556
showStack.push(!showStack.pop());
@@ -1639,14 +1640,18 @@ function getFastValue(a, op, b, type) {
16391640
}
16401641

16411642
function getFastValues(list, op, type) {
1642-
assert(op == '+');
1643+
assert(op === '+' && type === 'i32');
1644+
for (var i = 0; i < list.length; i++) {
1645+
if (isNumber(list[i])) list[i] = (list[i]|0) + '';
1646+
}
16431647
var changed = true;
16441648
while (changed) {
16451649
changed = false;
16461650
for (var i = 0; i < list.length-1; i++) {
16471651
var fast = getFastValue(list[i], op, list[i+1], type);
16481652
var raw = list[i] + op + list[i+1];
16491653
if (fast.length < raw.length || fast.indexOf(op) < 0) {
1654+
if (isNumber(fast)) fast = (fast|0) + '';
16501655
list[i] = fast;
16511656
list.splice(i+1, 1);
16521657
i--;

‎src/settings.js

+2
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ var OUTLINING_LIMIT = 0; // A function size above which we try to automatically
156156
// with, but something around 20,000 to 100,000 might make sense.
157157
// (The unit size is number of AST nodes.)
158158

159+
var AGGRESSIVE_VARIABLE_ELIMINATION = 0; // Run aggressiveVariableElimination in js-optimizer.js
160+
159161
// Generated code debugging options
160162
var SAFE_HEAP = 0; // Check each write to the heap, for example, this will give a clear
161163
// error on what would be segfaults in a native build (like deferencing

‎src/struct_info.json

+12
Original file line numberDiff line numberDiff line change
@@ -1061,5 +1061,17 @@
10611061
"patch"
10621062
]
10631063
}
1064+
},
1065+
{
1066+
"file": "uuid/uuid.h",
1067+
"defines": [
1068+
"UUID_VARIANT_NCS",
1069+
"UUID_VARIANT_DCE",
1070+
"UUID_VARIANT_MICROSOFT",
1071+
"UUID_VARIANT_OTHER",
1072+
"UUID_TYPE_DCE_TIME",
1073+
"UUID_TYPE_DCE_RANDOM"
1074+
],
1075+
"structs": {}
10641076
}
10651077
]

0 commit comments

Comments
 (0)
Please sign in to comment.