Re: Similar Function Elimination

2017-08-23 Thread arnab choudhury
, 2017 at 8:31:44 AM UTC-7, arnab choudhury wrote: > > Hi Caiiycuk > > Given that you are still reproing your bug on the RollABall project, can > you tell me what your development configuration is (what OS are you using, > what version of nodejs are you using, etc.)? I just dou

Re: Similar Function Elimination

2017-08-22 Thread arnab choudhury
August 22, 2017 at 12:36:23 PM UTC-7, arnab choudhury wrote: > > Thanks for catching this caiiycuk - I can repro and will have a fix out > shortly. Looks like a name-clash bug in the minified name generator SFE > uses. > > On Tuesday, August 22, 2017 at 10:17:15 AM UTC-7, caii

Re: Similar Function Elimination

2017-08-22 Thread arnab choudhury
xtureEv > (file:///home/caiiiycuk/emscripten/sdk/emscripten/cocos2d/cocos.js:10311:1666246) > > > > > Error only occurs in chrome, or is you disable asm.js mode (for > example by debugger) > > 2017-08-22 23:42 GMT+07:00 arnab choudhury <achou...@gmail.com > >: >

Re: Similar Function Elimination

2017-08-22 Thread arnab choudhury
ngEPKcRKNS_14FontDefinitionE > > > (file:///home/caiiiycuk/emscripten/sdk/emscripten/cocos2d/cocos.js:10311:1778238) > > > > at > __ZN7cocos2d9Texture2D14initWithStringEPKcS2_fRKNS_4SizeENS_14TextHAlignmentENS_14TextVAlignmentE > > > > > (file:///home/ca

Re: Similar Function Elimination

2017-08-22 Thread arnab choudhury
asm.js bug. Btw, if you build > roll-a-ball project in Unity, then output will be in Unity format > (also js, but with Unity loader, Unity staff). You can find emscripten > output in Project/Library/webgl_cache/linkresult_asm/ folder. > > 2017-08-22 23:15 GMT+07:00 arnab choudhury &l

Re: Similar Function Elimination

2017-08-22 Thread arnab choudhury
nator.srcToAst > >> > (/home/caiiiycuk/sdk/Similar-Function-Elimination/src/similar_function_eliminator.js:35:20) > > > >> > >> > >> Maybe I doing something wrong. Can you try? Resulting js is here > (build.asm.js): > >> > &

Re: Similar Function Elimination

2017-08-21 Thread arnab choudhury
Hello Caiiycuk This may be because there might be some code wrapping the asm.js. I'll try building UnityJS and get back to you. You currently have to run SFE separately after all optimizations and it has not been integrated into Emscripten (although if there is enough demand, we can consider

Re: Similar Function Elimination

2017-08-18 Thread arnab choudhury
> Am Freitag, 18. August 2017 17:24:32 UTC+2 schrieb arnab choudhury: >> >> Hello Emscripten-Discuss >> >> I just wanted to bring folks' attention to a new post-build optimization >> pass for Emscripten generated asm.js called Similar Function Elimination >&g

Similar Function Elimination

2017-08-18 Thread arnab choudhury
Hello Emscripten-Discuss I just wanted to bring folks' attention to a new post-build optimization pass for Emscripten generated asm.js called Similar Function Elimination (SFE) that Tableau recently open sourced. I discussed with Alon, and our thinking is that we will be adding this pass to

Re: Bug in embind's JS optimizer that affects enum registration

2016-04-26 Thread arnab choudhury
I've also logged an issue in the issue tracker for this: https://github.com/kripken/emscripten/issues/4276 On Tuesday, April 26, 2016 at 9:48:54 AM UTC-7, arnab choudhury wrote: > > FYI - I've posted the repro files to: > https://github.com/achoudhury85/Embind-Enum-Registration-Issu

Re: Bug in embind's JS optimizer that affects enum registration

2016-04-26 Thread arnab choudhury
UTC-7, arnab choudhury wrote: > > The other strange thing I've noticed is that debug versions of the ASM JS > do not have this problem (since the constructor function is not removed). > Even stranger, manually disabling the minifyNames pass also makes the > problem go away. Doe

Bug in embind's JS optimizer that affects enum registration

2016-04-26 Thread arnab choudhury
Hey guys On 1.36.2, I've found a bug where Emscripten's JS optimizer seems to be removing a local function within the __embind_register_enum function in embind.js if built with -O3 optimization. This is the piece of code that's being removed: _embind_register_enum: function( rawType,

Re: Embind registrations for 64 bit types

2016-03-10 Thread arnab choudhury
at 6:14:59 PM UTC-8, arnab choudhury wrote: > > It looks like _embind_register_float may do the trick - although I wonder > if I can use that for 64 bit integral types (e.g. unsigned long long). > > On Wednesday, March 9, 2016 at 5:57:04 PM UTC-8, arnab choudhury wrote: >> >

Re: Embind registrations for 64 bit types

2016-03-09 Thread arnab choudhury
It looks like _embind_register_float may do the trick - although I wonder if I can use that for 64 bit integral types (e.g. unsigned long long). On Wednesday, March 9, 2016 at 5:57:04 PM UTC-8, arnab choudhury wrote: > > Hey guys > > Embind doesn't seem to have implicit registration

Embind registrations for 64 bit types

2016-03-09 Thread arnab choudhury
Hey guys Embind doesn't seem to have implicit registrations for native C++ types that are 64 bits (e.g. unsigned long long). Anyone else run into this? I could call _embind_register_integer, but that ends up truncating the maximum range of the type. Is there any known workaround for this?

Re: Order of includes issue while linking libraries with Emscripten

2016-02-22 Thread arnab choudhury
start-group >> etc. flags, which keep looping until everything is resolved. >> >> .a files can make linking faster since they avoid .o files in a quick >> way. But it's usually fine to avoid .a files and just use .bc/.o files that >> just contain plain bitcode. >>

Re: Duplicate Function Elimination Support on Incoming

2016-02-18 Thread arnab choudhury
t; The ability to get a list of removed function names is very useful! > > If anybody is using my fips cmake wrapper, I added a new cmake option for > this: > https://github.com/floooh/fips/commit/10a9f97b0a2ea3aa4b8a729298486eecaee4480f > > Cheers, > -Floh. > > Am Diensta

Order of includes issue while linking libraries with Emscripten

2016-02-17 Thread arnab choudhury
Hey guys I just ran into an issue where I was seeing unresolved externals when using Emscripten to transpile my test c++ file to JS. After digging for a while, I figured out that the order of includes of the .a files is important. For example, if you have 2 static libraries foo.a and bar.a,

Duplicate Function Elimination Support on Incoming

2016-02-16 Thread arnab choudhury
Hello all You may have noticed a new feature on the incoming branch - a new pass called Duplicate Function Elimination (or DFE) has been added to the JavaScript optimizer. It's a bit computationally intensive and is hence not enabled by default. In order to use it, you have to be building at

Re: Determine type of heap pointer in debugger

2016-02-02 Thread arnab choudhury
for this purpose? On Tuesday, February 2, 2016 at 1:08:15 PM UTC-8, arnab choudhury wrote: > > Hey guys, > > I know that emscripten/embind use some type of type registry to go back > and forth between C++ objects and Javascript. I was wondering if it was > possible to determine

Re: Seeing sporadic "missing function" errors after updating to 1.35.17

2016-01-27 Thread arnab choudhury
nistic. > > Perhaps build with EMCC_DEBUG=1 in the env, then if you see the error, > that log could help. > > On Tue, Jan 26, 2016 at 6:02 PM, arnab choudhury <achou...@gmail.com > > wrote: > >> Unfortunately I don't have a repro :-/. About one in 150 builds of a &g

Re: Seeing sporadic "missing function" errors after updating to 1.35.17

2016-01-27 Thread arnab choudhury
first then writes), but that should result in a link error, not in > missing symbols. > > > On Wed, Jan 27, 2016 at 9:54 AM, arnab choudhury <achou...@gmail.com > > wrote: > >> I think I have identified what may be the problem, although since I can't >> repro on de

Re: Seeing sporadic "missing function" errors after updating to 1.35.17

2016-01-27 Thread arnab choudhury
-copyfile-atomic On Wednesday, January 27, 2016 at 10:26:51 AM UTC-8, arnab choudhury wrote: > > Thanks Alon - that makes sense. The part that got me thinking along this > path was - is shutil.copy_file atomic? Consider the following code from > cache.py: > > # Request a cached

Re: Seeing sporadic "missing function" errors after updating to 1.35.17

2016-01-26 Thread arnab choudhury
e problem? > > On Thu, Jan 21, 2016 at 12:17 PM, arnab choudhury <achou...@gmail.com > > wrote: > >> Another thing to note is that only optimized builds are showing this >> behavior - we are not seeing this on debug (unoptimized) builds. >> >> >>

Seeing sporadic "missing function" errors after updating to 1.35.17

2016-01-21 Thread arnab choudhury
Hey guys After updating my local fork of Emscripten to 1.35.17, I am seeing sporadic runtime failures where Emscripten identifies certain STL functions as missing: Some examples of functions: _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcj (Demangled:

Re: Seeing sporadic "missing function" errors after updating to 1.35.17

2016-01-21 Thread arnab choudhury
Another thing to note is that only optimized builds are showing this behavior - we are not seeing this on debug (unoptimized) builds. On Thursday, January 21, 2016 at 12:04:56 PM UTC-8, arnab choudhury wrote: > > Hey guys > > After updating my local fork of Emscripten to 1.35.17,

Re: Hard to debug large JS files

2016-01-04 Thread arnab choudhury
, maybe people are so harmed > by this, that we should make the effort. > > On Mon, Jan 4, 2016 at 11:32 AM, arnab choudhury <achou...@gmail.com > > wrote: > >> All variables that are local to the ASM JS scope become contained within >> the asmJSPrivateSt

Re: Embind return C++ STL objects and transcribe to c++

2015-12-28 Thread arnab choudhury
Just use Javascript's TypedArray support (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays) to expose the underlying array (note that you'll have to ensure that the memory is not reclaimed by keeping the vector saved off). Here's a sample implementation of

Re: Embind: sharing bindings between javascript and compiled C++ code.

2015-12-28 Thread arnab choudhury
At Tableau, we have had a similar problem where we wanted to reuse a set of bindings to emit non JS code. We came up with a clean solution where we modified embind.js to contain "hooks" for each embind function. This ensures that you only have one set of bindings, reducing the risk of bugs. To

Re: Hard to debug large JS files

2015-12-28 Thread arnab choudhury
, unless you really care about that (that is, if the bug you are trying to fix actually relies on this), you should be just fine. On Monday, December 28, 2015 at 12:44:30 PM UTC-8, arnab choudhury wrote: > > FYI - In order to work around the problem, I went ahead and wrote a python &g

Re: Hard to debug large JS files

2015-12-28 Thread arnab choudhury
cripten/wiki/Linking >> >> This can be a solution for this problem, by splitting things up into >> smaller files. >> >> In practice, personally, I tend to use print debugging and I open the >> file in a text editor on the side that can handle massive text files. >&

Re: Hard to debug large JS files

2015-12-28 Thread arnab choudhury
t;> >> This can be a solution for this problem, by splitting things up into >> smaller files. >> >> In practice, personally, I tend to use print debugging and I open the >> file in a text editor on the side that can handle massive text files. >> >> On Fri,

Re: Hard to debug large JS files

2015-12-28 Thread arnab choudhury
se print debugging and I open the >> file in a text editor on the side that can handle massive text files. >> >> On Fri, Dec 4, 2015 at 12:02 PM, arnab choudhury <achou...@gmail.com >> > wrote: >> >>> Hey all >>> >>> I'm using Emscrip

Re: Hard to debug large JS files

2015-12-28 Thread arnab choudhury
tion for this problem, by splitting things up into >> smaller files. >> >> In practice, personally, I tend to use print debugging and I open the >> file in a text editor on the side that can handle massive text files. >> >> On Fri, Dec 4, 2015 at 12:

Re: Hard to debug large JS files

2015-12-28 Thread arnab choudhury
y, I tend to use print debugging and I open the >> file in a text editor on the side that can handle massive text files. >> >> On Fri, Dec 4, 2015 at 12:02 PM, arnab choudhury <achou...@gmail.com >> > wrote: >> >>> Hey all >>> >>> I'm

Re: Hard to debug large JS files

2015-12-28 Thread arnab choudhury
PM UTC-8, arnab choudhury wrote: > > Now, it becomes easy to split up the ASM JS functions into multiple files > since each file is just updating the asmJSPrivateState variable. We can > then modify the Emscripten HTML to include multiple script files instead of > the origin

Re: Hard to debug large JS files

2015-12-28 Thread arnab choudhury
cripten/wiki/Linking >> >> This can be a solution for this problem, by splitting things up into >> smaller files. >> >> In practice, personally, I tend to use print debugging and I open the >> file in a text editor on the side that can handle massive text files. >&

Re: Hard to debug large JS files

2015-12-28 Thread arnab choudhury
>> >> In practice, personally, I tend to use print debugging and I open the >> file in a text editor on the side that can handle massive text files. >> >> On Fri, Dec 4, 2015 at 12:02 PM, arnab choudhury <achou...@gmail.com >> > wrote: >> &

Re: Hard to debug large JS files

2015-12-28 Thread arnab choudhury
nt debugging and I open the >> file in a text editor on the side that can handle massive text files. >> >> On Fri, Dec 4, 2015 at 12:02 PM, arnab choudhury <achou...@gmail.com >> > wrote: >> >>> Hey all >>> >>> I'm using Emscripten to

Re: embind: EMSCRIPTEN_BINDINGS and .a files

2015-12-09 Thread arnab choudhury
, 2015 at 12:12:56 PM UTC-8, arnab choudhury wrote: > > Hi there > > I am currently using embind to generate bindings for my C++ code so that > it can be invoked from non ASM JS code. I have a number of .a files that my > project is generating. My goal initially was to add e

Re: embind: EMSCRIPTEN_BINDINGS and .a files

2015-12-09 Thread arnab choudhury
: ___cxx_global_var_init __GLOBAL__sub_I_bind_cpp asm.__GLOBAL__sub_I_bind_cpp __ATINIT__.push.func callRuntimeCallbacks ensureInitRuntime doRun run ... Module.runMain On Wednesday, December 9, 2015 at 3:48:18 PM UTC-8, arnab choudhury wrote: > > The issue seems to be related to static variable initializat

Hard to debug large JS files

2015-12-04 Thread arnab choudhury
Hey all I'm using Emscripten to convert a decent sized C++ codebase to Javascript. As part of this process, I'm finding that debugging the unoptimized generated JS can be quite painful. Specifically, some JS files can be up to 1 million lines long and this completely breaks my browser's node

embind: EMSCRIPTEN_BINDINGS and .a files

2015-12-04 Thread arnab choudhury
Hi there I am currently using embind to generate bindings for my C++ code so that it can be invoked from non ASM JS code. I have a number of .a files that my project is generating. My goal initially was to add emscripten bindings to each .a file that my project was generating since each .a

embind - Cannot bind multiple constructors with same number of parameters

2015-11-25 Thread arnab choudhury
Hello all embind seems to have an issue with binding constructors for a class with the same number of parameters. And select_overload doesn't seem to solve the problem. I'm trying to get bindings for the copy constructor and a constructor for a custom string class: class SomeString {

embind and stack allocated C++ objects

2015-11-24 Thread arnab choudhury
Hello there I was wondering if embind supports stack allocated C++ objects (rather than heap allocated)? This is for things like: for (auto pair : keyMap->GetKeyValuePairs()) { // Do something } where keyMap could be a custom collection implementation and GetKeyValuePairs() would return a

Re: embind and stack allocated C++ objects

2015-11-24 Thread arnab choudhury
I think - looking at the documentation on embind that the answer is to use value_object (and value_array). Please let me know if this is wrong. Thanks, Arnab On Tuesday, November 24, 2015 at 3:19:15 PM UTC-8, arnab choudhury wrote: > > Hello there > > I was wondering if embind su

embind - Polymorphic Invocation

2015-11-23 Thread arnab choudhury
Hey guys I have a question about whether we can use embind to invoke polymorphic functions on derived classes (when the derived class type definitions may not be known). For example, say I have a class Foo which derives from a pure virtual class IFoo. However, we don't publicly expose the

Emscripten's JS optimizer can hang sometimes - seems to be an issue with Uglify's JS parser

2015-09-23 Thread arnab choudhury
Hello there I am seeing some odd behavior when using emscripten to transpile a decent size codebase to Javascript. Sometimes, Emscripten's JS optimizer hangs - this doesn't happen all the time though. When the problem does occur, node.exe is taking up 1.2 to 1.3 Gb of memory - I suspect that

Re: Emscripten's JS optimizer can hang sometimes - seems to be an issue with Uglify's JS parser

2015-09-23 Thread arnab choudhury
BTW - this is on a fairly new version of emscripten (1.34.8). On Wednesday, September 23, 2015 at 5:20:34 PM UTC-7, arnab choudhury wrote: > > Hello there > > I am seeing some odd behavior when using emscripten to transpile a decent > size codebase to Javascript. Sometimes,