Hi, not only SBCL but all Common Lisp platforms must implement DISASSEMBLE [1] as it’s part of the standard (although outputs are platform-dependent). In ML world, such facility must be platform dependent, if it exists.
[1] http://www.lispworks.com/documentation/HyperSpec/Body/f_disass.htm#disassemble For Poly/ML, if you try to see the exported function inside its Compiler package, there’s actually a “assemblyCode” switch doing the same thing (or even more detailed): Poly/ML 5.7.1 Release > open PolyML.Compiler; val allocationProfiling = ref false: bool ref val assemblyCode = ref false: bool ref val codetree = ref false: bool ref val codetreeAfterOpt = ref false: bool ref So I enabled this switch: > PolyML.Compiler.assemblyCode := true; val it = (): unit Then, I try to define a very simple function and now I can see how it is compiled: > fun f () = print "foo\n"; f(1): CmpRR rsp <= 24(rbp) JumpNotBefore L0 PredictTaken CallRTS StackOverflowCall L0: MoveRR r14 <= LIT <long word data> MoveRR rax <= 0(r14) MoveRR rbx <= BYTE data\^D\^@\^@\^@\^@\^@\^@\^@foo\n\^@\^@\^@\^@ CallFunction code=CODE "TextIO.TextStreamIO.output(2)" MoveRR r14 <= LIT <long word data> MoveRR rax <= 0(r14) MoveRR r8 <= 32(rax) MoveRR rbx <= FUN "BasicStreamIO().flushOut'(1)" JumpToFunction code=CODE "ThreadLib.protect(3)" f(1): CmpRR rsp <= 24(rbp) JumpNotBefore L0 PredictTaken CallRTS StackOverflowCall L0: MoveRR r14 <= LIT <long word data> MoveRR rax <= 0(r14) MoveRR rbx <= BYTE data\^D\^@\^@\^@\^@\^@\^@\^@foo\n\^@\^@\^@\^@ CallFunction code=CODE "TextIO.TextStreamIO.output(2)" MoveRR r14 <= LIT <long word data> MoveRR rax <= 0(r14) MoveRR r8 <= 32(rax) MoveRR rbx <= FUN "BasicStreamIO().flushOut'(1)" JumpToFunction code=CODE "ThreadLib.protect(3)" f(1): 0 cmp rsp,qword ptr 24[rbp] 4 jnb B 6 call qword ptr 88[rbp] 9 SAVE rax B mov r14,4304861880 15 mov rax,qword ptr [r14] 18 mov rbx,4308857224 22 call qword ptr .+72 28 mov r14,4304861880 32 mov rax,qword ptr [r14] 35 mov r8,qword ptr 32[rax] 39 mov rbx,4299595784 43 jmp qword ptr .+31 <top level>: CmpRR rsp <= 24(rbp) JumpNotBefore L0 PredictTaken CallRTS StackOverflowCall L0: MoveRR rax <= LIT <long word data> ReturnFromFunction 0 <top level>: CmpRR rsp <= 24(rbp) JumpNotBefore L0 PredictTaken CallRTS StackOverflowCall L0: MoveRR rax <= LIT <long word data> ReturnFromFunction 0 <top level>: 0 cmp rsp,qword ptr 24[rbp] 4 jnb B 6 call qword ptr 88[rbp] 9 SAVE rax B mov rax,4309121520 15 ret val f = fn: unit -> unit Hope this helps, (and I don’t need to read any PolyML document or go to its web site to find out this) Chun > Il giorno 17 mag 2018, alle ore 18:38, Mario Xerxes Castelán Castro > <marioxcc...@yandex.com> ha scritto: > > I want to see the generated code from the REPL, as with Common Lisp’s > SBCL, to have an idea of what optimizations have been made since it is > not easy to tell when writing high level code (especially higher order > functions). Is this possible? > > > On 17/05/18 11:35, Ramana Kumar wrote: >> You could build a binary using polyc. Would that suffice? Or do you >> need to see the machine code while running the REPL? >> >> On 17 May 2018 at 17:13, Mario Xerxes Castelán Castro >> <marioxcc...@yandex.com <mailto:marioxcc...@yandex.com>> wrote: >> >> Hello. The Poly/ML mailing list appears to be down at the moment. How >> can I see the machine code generated by Poly/ML? >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> _______________________________________________ >> hol-info mailing list >> hol-info@lists.sourceforge.net <mailto:hol-info@lists.sourceforge.net> >> https://lists.sourceforge.net/lists/listinfo/hol-info >> <https://lists.sourceforge.net/lists/listinfo/hol-info> >> >> > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > hol-info mailing list > hol-info@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/hol-info
signature.asc
Description: Message signed with OpenPGP
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ hol-info mailing list hol-info@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hol-info