2.7.0 features: compiler::watch

Camm Maguire <[email protected]>
Newsgroups gmane.lisp.gcl.devel
Message-ID <[email protected]>
Greetings!  I will try over the succeeding days to describe some of the
new gcl internals for posterity and those interested.

#'compiler::watch takes as its single argument a variable or function
 name, or a name of several predefined keys.  Important steps in the
 compilation process are then traced.  #'compiler::unwatch reverses the
 trace, and when given no arguments, reverses all traces.  Some
 predefined keys currently are (all symbols in the compiler package):

 tagbody-iteration
 tagbody-label
 branch-elimination
 block-set
 init-type
 type
 type-propagation
 type-restriction
 type-inference
 inline
 inline-abort
 notinline
 local
 provisional
 var-trim
 var-ref
 var-bind
 var-store
 ref
 recursion
 tail-recursion
 return-type
 nil-arg
 nil-return
 signatures

 This list will be refined with time.  Example:

=============================================================================
GCL (GNU Common Lisp)  2.7.0 ANSI    Dec 20 2023 11:13:47
Source License: LGPL(gcl,gmp,pargcl), GPL(unexec,bfd,xgcl)
Binary License:  GPL due to GPL'ed components: (XGCL UNEXEC)
Modifications of this banner must retain notice of a compatible license
Dedicated to the memory of W. Schelter

Use (help) to get some basic information on how to use GCL.
Temporary directory for compiler files set to /tmp/

>(in-package :compiler)

#<"COMPILER" package>

COMPILER>(setq *disassemble-objdump* nil)

NIL

COMPILER>(disassemble '(lambda (x) (when (consp x) (when (listp x) 'f))))

;; Compiling /tmp/gazonk_729566_0.lsp.
;; End of Pass 1.  
;; End of Pass 2.  
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
;; Finished compiling /tmp/gazonk_729566_0.o.

#include "gazonk_729566_0.h"
void init_code(){do_init((void *)VV);}
/*	local entry for function COMPILER::CMP-ANON	*/

static object LI1__CMP_ANON___gazonk_729566_0(object V2)
{	 VMB1 VMS1 VMV1
	if(((V2))==Cnil){
	goto T4;
	}
	V3= tp2(V2);
	if(!((V3)==(0))){
	goto T7;
	}
	goto T3;
	
	goto T7;
T7:;
	goto T1;
	
	goto T4;
T4:;
	goto T1;
	
	goto T3;
T3:;
	{object V4 = ((object)VV[0]);
	VMR1(V4);}
	goto T1;
T1:;
	{object V5 = Cnil;
	VMR1(V5);}
}
(2 (MAPC 'EVAL *COMPILER-COMPILE-DATA*))
static object LI1__CMP_ANON___gazonk_729566_0(object V2)
;
#define VMB1  int8_t  V3;
#define VMS1
#define VMV1
#define VMRV1(a_,b_) return(a_);
#define VMR1(a_) VMRV1(a_,0);
#define VM1 0
static void * VVi[2]={
#define Cdata VV[1]
(void *)(LI1__CMP_ANON___gazonk_729566_0)
};
#define VV (VVi)
NIL

COMPILER>(watch 'branch-elimination)

(BRANCH-ELIMINATION)

COMPILER>(disassemble '(lambda (x) (when (consp x) (when (listp x) 'f))))

;; Compiling /tmp/gazonk_729566_0.lsp.
; (DEFUN CMP-ANON) is being compiled.
;   inlining (LISTP #<TAG TTL426 27BE4C0> ...)
;; Note: Test form (= (TP2 SYSTEM::X) 0) is T,
;; eliminating branch (INFER-TP
                       SYSTEM::X
                       #*11111111111111111111111111111111111111111111110011111111111111111111111111111111111111111111111111111111111111111111111110111111
                       NIL)

;; End of Pass 1.  
;; End of Pass 2.  
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
;; Finished compiling /tmp/gazonk_729566_0.o.

#include "gazonk_729566_0.h"
void init_code(){do_init((void *)VV);}
/*	local entry for function COMPILER::CMP-ANON	*/

static object LI1__CMP_ANON___gazonk_729566_0(object V2)
{	 VMB1 VMS1 VMV1
	if(((V2))==Cnil){
	goto T4;
	}
	V3= tp2(V2);
	if(!((V3)==(0))){
	goto T7;
	}
	goto T3;
	
	goto T7;
T7:;
	goto T1;
	
	goto T4;
T4:;
	goto T1;
	
	goto T3;
T3:;
	{object V4 = ((object)VV[0]);
	VMR1(V4);}
	goto T1;
T1:;
	{object V5 = Cnil;
	VMR1(V5);}
}
(2 (MAPC 'EVAL *COMPILER-COMPILE-DATA*))
static object LI1__CMP_ANON___gazonk_729566_0(object V2)
;
#define VMB1  int8_t  V3;
#define VMS1
#define VMV1
#define VMRV1(a_,b_) return(a_);
#define VMR1(a_) VMRV1(a_,0);
#define VM1 0
static void * VVi[2]={
#define Cdata VV[1]
(void *)(LI1__CMP_ANON___gazonk_729566_0)
};
#define VV (VVi)
NIL

COMPILER>
=============================================================================

Take care,
-- 
Camm Maguire			     		    [email protected]
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.