I am attempting to port a large C++ program that requires scanning the C++ 
stack (conservatively) for pointers.   I am looking to modify 
emscripten-fastcomp to maintain the necessary state on the explicit stack 
(e.g., in HEAP32).  Values stored in JS variables, i.e., which would 
normally reside only on the implicit JS stack, need to be copied to the 
explicit stack such that the copies are up-to-date at each procedure call. 
  This is similar in spirit to spilling registers around procedure calls, 
but the values must be stored in linear memory where the stack scanning 
code can get at them, and there is no need to reload from the "spilled" 
slots, as the JS engine will keep its own copy.  Note that what is required 
here is a bit more than would be needed for supporting a naive debugger, as 
temporary variables that are not named in the C++ source code need to be 
spilled as well.

Has anyone been down this road before?  I am fully prepared to jump into 
the LLVM code, but I'd like to avoid false starts and blind alleys if 
possible.  In particular, any documentation or notes on the internals of 
emscripten-fastcomp, particularly with respect to points of commonality and 
divergence with more conventional LLVM targets, would be most helpful.

I expect there will be a significant performance penalty for generating 
code in this way, but there are likely others similarly situated who would 
benefit from a compiler mode that could support stack scanning.   I'd be 
happy to contribute anything I come up with back to the project.

Thanks,

--Bill

-- 
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