lisp - Understanding the SBCL entry/exit assembly boiler plate code -


background

When using the 64 bit steel bank common lisp on Windows for comparable identification functions: (Fixnum x) (declun (fixnum x)) (declare (speed 3) (security 0))) ((fixnum x)) ()) < / Pre>

I think disassembly is given as follows:

  * (separated 'a'); Disassembly for A; Size: 13 bytes; 02D7DFA6: 84042500000F20 Test Al, [# x200f0000]; Securepoint; No-arg-parsing entry point; Eddie: 488 BE 5 MOV RSP, RBP; B: F8 CLC; B1: 5D POP RBP; B2: C3Ret  

I think the lines:

  mov rsp, rbp pop  

Display function standard return from operation, but I do not understand why the lines are:

  test al, [# x200f0000] // I understand that it is not supported by bitwise and AL Sets on the basis and the content of memory 0x200F0000  

and

  CLC // I understand that this clears the carrier flag.  

question

  1. Why SBCL is a test subsidiary Term, but does not flag used ever arise?
  2. Why did SBCL clear the carrier flag before returning from a function?

As a dissaaselar signage, TEST The point is it is used to synchronize the thread for the garbage collector. Safe spaces have been put in places where the compiler knows that the thread is in a safe condition for garbage collection.

A safe point is defined as:

  #! + Sb-safepoint (defun emit-safepoint () (inst test al-tn (make-ea: byte: disp sb! Vm :: gc-safepoint-page-addr)))  

You are absolutely right about the outcome of the operation being used. In this case, SBCL is interested in a side effect of the operation. Specifically, if the address page is preserved, the instructions page causes the error. If the page is accessible, then the instruction reduces the time of just a very short time let me know that it is probably much faster than checking a global variable, is very fast.

In Windows, the C is used to map and unmount the page in map_gc_page and unmap_gc_page :

  Zero map_gc_page () {DWORD oldProt; Ever (Virtual poll ((* Zero *) GC_SAFEPOINT_PAGE_ADDR, SizeOff (ElisPobase), PAGE_READWRITE, and Prefix)); } Zero unmap_gc_page () {DWORD oldProt; Ever (Virtual poll ((* ZERO *) GC_SAFEPOINT_PAGE_ADDR, Size (ALISOPOB), PAGE_NOACCESS, and PREVIOUSLY)); }  

Unfortunately I am not able to track page fault handler, but the general idea is that when a collection is required, then unmap_gc_page To be called. Each thread will continue until one of these is safe point, and then a page fault occurs. Possibly the page fault handler will stop that thread, and then when all the threads were stopped, the garbage collection is run, and then called map_gc_page and restarting threads Is allowed.

Anton Kovalenko is honored with the introduction of this mechanism.

On Linux and Mac OS X, a different synchronization mechanism is used by default, that is why the instructions are not generated by default on them platforms. (I'm not sure if the PowerPC port uses safe points by default, but obviously they do not use the x86 instructions.)

On the other side, let me see the CLC < / Code> instructions.


Comments