IntelLabs / ParallelAccelerator.jl

The ParallelAccelerator package, part of the High Performance Scripting project at Intel Labs
BSD 2-Clause "Simplified" License
294 stars 32 forks source link

CGen improvements #74

Open ninegua opened 8 years ago

ninegua commented 8 years ago

Currently CGen produces C program using identifier names that come from Julia without much modification. However, there could be potential conflict with existing identifiers or keywords in C, or with temporary C variables produced in CGen itself. I suggest we add a prefix (e.g., underscore) to all names that come from Julia into C.

ninegua commented 8 years ago

Besides name sanity (mentioned above), there are several other improvements that should be made:

  1. Eliminate the use of global state. Currently it is rather ad-hoc for cgen to recurse into invoking itself (see from_root_entry and from_root_noentry) due to its use of global variables.
  2. Proper treatment of Module names. Ignoring module names led to some function name conflict that I've fixed in 08216e87e276a42172d0a35d728a19592925781e, but there could be more issues.
  3. Use symbol for name comparisons and lookups as much as possible. Strings are simply not as fast.
jsreeram commented 8 years ago

+1 to prefixing and all 3 above. Better to create an environment (or a stack of environments, not sure) and pass it around.