As far as I know, the first general-purpose portable dynamic code generator is dcg, by Dawson R. Engler and T. A. Proebsting. Further work by Dawson R. Engler resulted in the vcode system; unlike dcg, vcode used no intermediate representation and directly inspired gnu lightning.
Thanks go to Ian Piumarta, who kindly accepted to release his own program ccg under the GNU General Public License, thereby allowing gnu lightning to use the run-time assemblers he had wrote for ccg. ccg provides a way of dynamically assemble programs written in the underlying architecture's assembly language. So it is not portable, yet very interesting.
I also thank Steve Byrne for writing GNU Smalltalk, since gnu lightning was first developed as a tool to be used in GNU Smalltalk's dynamic translator from bytecodes to native code.