2 days ago · Tech · 0 comments

The first thing to look at is the Fibonacci benchmark. The source code is here: (in-package "CLRHACK") (progn (defun fib (n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2))))) (defun main () (print "Fibonacci of 10:") (print (fib 10))) (main)) And it compiles to this IL code: (commentary after the code) .assembly extern mscorlib {} .assembly extern LispBase {} .assembly 'FibBenchmark' {} .module 'FibBenchmark.exe' .class public auto ansi beforefieldinit Program extends [mscorlib]System.Object { .field public static class [LispBase]Lisp.Symbol 'SYM_G545' .method public static hidebysig specialname rtspecialname void '.cctor'() cil managed { .maxstack 8 ldsfld class [LispBase]Lisp.Package [LispBase]Lisp.Package::CommonLisp ldstr "T" callvirt instance class [LispBase]Lisp.Symbol [LispBase]Lisp.Package::'Intern'(string) stsfld class [LispBase]Lisp.Symbol Program::'SYM_G545' ret } .method public static hidebysig object 'FIB'(object) cil managed { .maxstack 8 .locals (object TEMP_B) ldarg 0…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.