Is it possible you are not optimizing the source files, and only passing in
the optimization flag during linking? Or vice versa? Either can cause that.
See
http://kripken.github.io/emscripten-site/docs/compiling/Building-Projects.html#building-projects-with-optimizations

If that's not it, please make a standalone testcase, you might be hitting a
bug here (although I am not aware of anything open right now that could
cause that).

- Alon


On Sat, Feb 14, 2015 at 9:12 AM, Clifford Wolf <[email protected]>
wrote:

> On Saturday, February 14, 2015 at 8:07:59 AM UTC+1, Clifford Wolf wrote:
>
>> My default is -Os without the other options. With that I get a JavaScript
>> function with 10530 local variables.
>>
>
> I have now done a little more analysis over my project. This is not even
> the function with the most local variables, there are two larger ones. One
> with 12919 and one with 16594 variables:
>
> <skipping first 4979 results>
>   4302
> __ZN12_GLOBAL__N_114dump_cell_exprERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS3_NS0_9allocatorIcEEEEPN5Yosys5RTLIL4CellE
>   4554 __Z24frontend_verilog_yyparsev
>   4592
> __ZN12_GLOBAL__N_110ExposePass7executeENSt3__16vectorINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS6_IS8_EEEEPN5Yosys5RTLIL6DesignE
>   4700 __ZN12_GLOBAL__N_110BtorDumper9dump_cellEPKN5Yosys5RTLIL4CellE
>   5023 __ZN5Yosys3AST7AstNode8genRTLILEib
>   5212
> __ZN12_GLOBAL__N_113TechmapWorker14techmap_moduleEPN5Yosys5RTLIL6DesignEPNS2_6ModuleES4_RNSt3__13setIPNS2_4CellENS7_4lessISA_EENS7_9allocatorISA_EEEERKNS7_3mapINS2_8IdStringENS8_ISI_NS2_14sort_by_id_strENSD_ISI_EEEENSB_ISI_EENSD_INS7_4pairIKSI_SL_EEEEEEb
>   5512
> __ZN12_GLOBAL__N_112replace_cellEPN5Yosys5RTLIL4CellERKNS_7rules_tERKNS4_6bram_tERKNS4_7match_tERNS0_7hashlib4dictINSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEiNSD_8hash_opsISL_EEEEi
>  10604 __ZN5Yosys3AST7AstNode8simplifyEbbbiibb
>  12919 __ZN5Yosys6SatGen10importCellEPNS_5RTLIL4CellEi
>  16594
> __ZN12_GLOBAL__N_119replace_const_cellsEPN5Yosys5RTLIL6DesignEPNS1_6ModuleEbbbbb
>
>
>      0 -   100 vars:  4270 functions
>    100 -   200 vars:   365 functions
>    200 -   500 vars:   188 functions
>    500 -  1000 vars:    76 functions
>   1000 -  2000 vars:    51 functions
>   2000 -  5000 vars:    33 functions
>   5000 - 10000 vars:     3 functions
>  10000 - 16594 vars:     3 functions
>
> (the difference in number of variables for the simply() function is most
> likely because I am now using a script to count, before it was just doing
> some hacks in my text editor..)
>
> The frontend_verilog_yyparse at 4554 variables is a parser generated with
> bison. So whatever that looks like should not be too uncommon in larger
> projects. (But I'm not sure how many of those are ported to JavaScript. ;)
>
> On Saturday, February 14, 2015 at 5:44:36 AM UTC+1, Alon Zakai wrote:
>>
>> 7044 local variables? wow! :) Is this on an unoptimized build, or -O1? I
>> would be surprised to see that on -O2 or -O3.
>>
>
> So either I am doing something fundamentally wrong in my project or
> functions with thousands of local javascript variables is something one
> just gets on occasion..
>
> Under what circumstances does emcc create additional local variables? I
> would have assumed that the number local variables would rather be in the
> order of number of register you'd usually have in a CPU.. I'm thankful for
> any insights or pointers to documentation. (I haven't found any
> documentation on those implementation details, but maybe I was just looking
> in the wrong places..).
>
> What this functions in my list above all have in common is that they are
> rather large, usually built around one large switch statement or series of
> if-statements. The sourcecode to the two functions with the most javascript
> vars (importCell and replace_cost_cells) can be found here, just an case
> anyone is curious:
>
>
> https://github.com/cliffordwolf/yosys/blob/bc86b4a7e9c847180e6fd7ed81e0a15d5aee00a0/kernel/satgen.h
>
> https://github.com/cliffordwolf/yosys/blob/a8f4a099b5f1c51ccd46d875c874bbb1e7e5766b/passes/opt/opt_const.cc
>
> regards,
>  - clifford
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to