[Openmcl-devel] Creating a function from its disassembly

Gary Byers gb at clozure.com
Thu Jun 9 18:48:03 PDT 2005



On Thu, 9 Jun 2005, Gary King wrote:

> Suppose I have the listing returned by disassemble (for example as a string). 
> Is there some way for me to compile this assembly code into a callable 
> function?
>
> Thanks,
> -- 
> Gary Warren King
> metabang.com
> http://www.metabang.com/
>
>

I'm not sure that I understand the question, but you can do:

? (ccl::ppc-xdisassemble #'cdr :for-lap t)
(NFUNCTION CDR
   (LAMBDA (CCL::&LAP)
     (CCL::PPC-LAP-FUNCTION CDR ()
       (TWNEI NARGS 4)
       (MFLR LOC-PC)
       (BLA .SPSAVECONTEXTVSP)
       (VPUSH ARG_Z)
       (LWZ ARG_Z 0 VSP)
       (CLRLWI IMM0 ARG_Z 30)
       (TWNEI IMM0 1)
       (LWZ ARG_Z -1 ARG_Z)
       (BA .SPPOPJ))))

That pretty-prints a form and returns (VALUES); it might be better if
it returned the form.  If you mouse on that "NFUNCTION" form and
execute it, it'll create a function (a "named function", in fact).

Is that the sort of thing that you meant ?



More information about the Openmcl-devel mailing list