|
From: Kevin K. <kev...@gm...> - 2018-04-16 12:04:37
|
On 04/16/2018 04:31 AM, Donal K. Fellows wrote: > The variable list starts out as a temporary. It's probably[†] one of > the things that is only converted to a real value during finalisation > of the debug builder. That's done by calling the > *FinalizeDebuggingMetadata* method of module; after that, you can't > write more out. That in turn is called from the public *verify* and > *optimize* methods. I strongly suggest calling *verify* before getting > the *bitcode* of a module; it also catches quite a few other basic > errors and is pretty worthwhile. I'm not going to force finalization > before producing the LLVM IR (via *dump*) since that's a debugging > tool as well. > > Note that verifying a function is less effective and doesn't finalize > anything. (In particular, it doesn't say what's wrong; that's a fault > of the C API. I ought to fix that as there's never a good reason from > Tcl for a verifier to do anything other than produce a proper Tcl > error on failures. https://github.com/dkfellows/llvmtcl/issues/15 made > to track as the C++ API has no such restriction… Yet another example > of a poor-cousin partially-maintained C API causing us trouble. It's > not Jos's fault either; I get the impression that the LLVM C API > really doesn't get much love at all outside the most basic use cases.) CoroEarly gets the same crash from the public 'optimize' method, which supposedly does the finalization, so I'm still confused. I knew about the finalization requirement, and stuck a 'puts' next to the call, and it's definitely being done. I'm not aware of changing anything in 'jit.tcl' that would affect the finalization sequence. I'm pretty sure that I'm seeing unfinished temporaries on the trunk as well. Peculiarly, only the coroutine passes seem to care. If I patch out 'qsort', 'rectest' and 'mrtest' from tester.tcl, everything compiles in spite of them. (The .ll code is still unusable, though.) I've probably overlooked something. This is where a second pair of eyeballs might come in handy. |