[Openmcl-cvs-notifications] r11913 - in /trunk/source: lisp-kernel/pmcl-kernel.c lisp-kernel/x86-spentry64.s objc-bridge/objc-support.lisp

gb at clozure.com gb at clozure.com
Wed Apr 8 21:35:20 EDT 2009


Author: gb
Date: Wed Apr  8 21:35:20 2009
New Revision: 11913

Log:
pmcl-kernel.c: don't define __objc_personality_v0, since in the Wacky World
Of Mach-O this can have the effect of shadowing the real ObjC runtime symbo=
l.

x86-spentry64.s: in ffcall_return_registers: after saving return registers
relative to %csave0, restore them from there (not from %csave3).  Most
callers don't care (will just look at the register buffer that csave0 =

pointed to), but if we're returning/raising an ObjC exception we want to get
it from the right place.

In the ObjC exception gunk, reference the new 'lisp_objc_personality' via
a 64-bit absolute address.  This seems to be OK with the Leopard linker;
we'll see about other versions.

objc-support.lisp: in SETUP-OBJC-EXCEPTION-GLOBALS, try to ensure that
this only happens once per session (since we're using a kludge to =

detect whether or not indirection is necessary.)

Modified:
    trunk/source/lisp-kernel/pmcl-kernel.c
    trunk/source/lisp-kernel/x86-spentry64.s
    trunk/source/objc-bridge/objc-support.lisp

Modified: trunk/source/lisp-kernel/pmcl-kernel.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/pmcl-kernel.c (original)
+++ trunk/source/lisp-kernel/pmcl-kernel.c Wed Apr  8 21:35:20 2009
@@ -1493,7 +1493,7 @@
 =

 #ifdef DARWIN
 #if WORD_SIZE=3D=3D64
-void *__objc_personality_v0 =3D NULL;
+void *lisp_objc_personality =3D NULL;
 #endif
 #endif
 =

@@ -1763,7 +1763,7 @@
 #endif
 #ifdef DARWIN
 #if WORD_SIZE=3D=3D64
-  lisp_global(OBJC_2_PERSONALITY) =3D (LispObj) &__objc_personality_v0;
+  lisp_global(OBJC_2_PERSONALITY) =3D (LispObj) &lisp_objc_personality;
 #endif
 #endif
 =


Modified: trunk/source/lisp-kernel/x86-spentry64.s
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/x86-spentry64.s (original)
+++ trunk/source/lisp-kernel/x86-spentry64.s Wed Apr  8 21:35:20 2009
@@ -4268,10 +4268,10 @@
          /* %rax/%rdx contains the return value (maybe), %save0 still
             contains the linear tcr address.  Preserve %rax/%rdx here. */
          __(set_gs_base(%csave1))
-         __(movq (%csave3),%rax)
-         __(movq 8(%csave3),%rdx)
-         __(movsd 16(%csave3),%xmm0)
-         __(movsd 24(%csave3),%xmm1)
+         __(movq (%csave0),%rax)
+         __(movq 8(%csave0),%rdx)
+         __(movsd 16(%csave0),%xmm0)
+         __(movsd 24(%csave0),%xmm1)
         __endif
 	__ifdef([WINDOWS])
 	__(movq %csave1, %rcontext_reg)
@@ -5098,9 +5098,9 @@
 	.byte	0x1	/* uleb128 0x1; CIE Code Alignment Factor */
 	.byte	0x78	/* sleb128 -8; CIE Data Alignment Factor */
 	.byte	0x10	/* CIE RA Column */
-	.byte	0x7
-	.byte	0x9b
-	.long	___objc_personality_v0+4 at GOTPCREL
+	.byte	0xb
+	.byte	0x8c
+	.quad	_lisp_objc_personality
 	.byte	0x10	/* LSDA Encoding (pcrel) */
 	.byte	0x10	/* FDE Encoding (pcrel) */
 	.byte	0xc	/* DW_CFA_def_cfa */

Modified: trunk/source/objc-bridge/objc-support.lisp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/objc-bridge/objc-support.lisp (original)
+++ trunk/source/objc-bridge/objc-support.lisp Wed Apr  8 21:35:20 2009
@@ -140,23 +140,26 @@
 =

 #+apple-objc-2.0
 (progn
+(defloadvar *objc-exception-globals-setup* nil)  =

 (defun setup-objc-exception-globals ()
   (flet ((set-global (offset name)
-	   (with-macptrs (p (%int-to-ptr (+ (target-nil-value) (%kernel-global-of=
fset offset))))
-            (unless (%null-ptr-p (%get-ptr p))
-              (%setf-macptr p (%get-ptr p)))
-	    (setf (%get-ptr p)
-                  (foreign-symbol-address name)))))
-    (set-global 'objc-2-personality "___objc_personality_v0")
-    (set-global 'objc-2-begin-catch "_objc_begin_catch")
-    (set-global 'objc-2-end-catch "_objc_end_catch")
-    (set-global 'unwind-resume "__Unwind_Resume")))
+	   (let* ((p (%int-to-ptr (+ (target-nil-value) (%kernel-global-offset of=
fset))))
+                  (q (%get-ptr p)))
+             (unless (%null-ptr-p q)
+               (setq p q))
+             (setf (%get-ptr p)
+                   (foreign-symbol-address name)))))
+    (unless *objc-exception-globals-setup*
+      (setq *objc-exception-globals-setup* t)
+      (set-global 'objc-2-personality "___objc_personality_v0")
+      (set-global 'objc-2-begin-catch "_objc_begin_catch")
+      (set-global 'objc-2-end-catch "_objc_end_catch")
+      (set-global 'unwind-resume "__Unwind_Resume"))))
 =

 =

 (def-ccl-pointers setup-objc-exception-handling ()
   (setup-objc-exception-globals))
 =

-(setup-objc-exception-globals)
 )
 =

 =




More information about the Openmcl-cvs-notifications mailing list