Raymond Toy pushed to branch sparc64-dev at cmucl / cmucl
Commits: df1d4899 by Raymond Toy at 2016-12-30T10:39:57-08:00 More 64-bit changes.
o The trap instructions should use xcc, not icc for the condition reg. o sll should be slln (or sllx) o Don'te use store when storing to foreign_function_call_active because that stores a 64-bit value and foreign_function_call_active is an int (32-bit).
- - - - - e8296572 by Raymond Toy at 2016-12-30T14:05:06-08:00 Use correct offset when printing lispobj function address
The previous version had a hardwired #x17 (23 dec) to get the object address from the function code offset address. Compute this value from function-code-offset instead so that it will work for 64-bit lisps too.
Also increase the size of the field to 12 hex digits. That should be enough bits (48 bits) of address space for any thing we're likely to run on.
- - - - - 52c67424 by Raymond Toy at 2016-12-31T19:12:00-08:00 Map ldn/stn/slln/srln/sran to 64-bit versions of the instructions
- - - - - e76eb9b7 by Raymond Toy at 2016-12-31T19:22:19-08:00 Print out correct info for sparc (and ppc)
The values for the initially defined functions in lisp.map were incorrect for sparc and ppc where the raw-addr slot of function is not the address of the code. It is has function-pointer-type so the code actually starts at the function-code-offset. So for sparc and ppc, continue to print out the raw-addr slot, but print out the actual code start too (instead of some number preceding the function object).
Add comment in the code for this too.
- - - - - 35f9363b by Raymond Toy at 2016-12-31T19:22:51-08:00 Use just -g not -g3
My version of Sun Studio only supports -g, so just use -g.
- - - - -
4 changed files:
- src/compiler/generic/new-genesis.lisp - src/compiler/sparc64/insts.lisp - src/lisp/Config.sparc64_sunc - src/lisp/sparc64-assem.S
Changes:
===================================== src/compiler/generic/new-genesis.lisp ===================================== --- a/src/compiler/generic/new-genesis.lisp +++ b/src/compiler/generic/new-genesis.lisp @@ -2832,9 +2832,20 @@ funs))))) *fdefn-objects*) (format t "~%~|~%Initially defined functions:~2%") - (dolist (info (sort funs #'< :key #'cdr)) - (format t "0x~8,'0X: ~S #x~8,'0X~%" (cdr info) (car info) - (- (cdr info) #x17))) + (let ((offset (- (* vm:word-bytes vm:function-code-offset) + vm:function-pointer-type))) + (dolist (info (sort funs #'< :key #'cdr)) + ;; Note: The cdr is the raw-addr slot of an fdefn. For + ;; sparc and ppc, this isn't a raw address---it's a function + ;; pointer object. For other architectures, it is the + ;; raw-addr slot where the code actually starts. For + ;; consistency, we'll print out the raw-addr slot on all + ;; platforms. However, the last item will be the function + ;; object pointer for x86 and other archs, but the code + ;; start for sparc and ppc. + (format t "0x~12,'0X: ~S #x~12,'0X~%" (cdr info) (car info) + #-(or sparc ppc) (- (cdr info) offset) + #+(or sparc ppc) (+ (cdr info) offset)))) (format t "~%~|~%Undefined function references:~2%") (labels ((key (name) (etypecase name
===================================== src/compiler/sparc64/insts.lisp ===================================== --- a/src/compiler/sparc64/insts.lisp +++ b/src/compiler/sparc64/insts.lisp @@ -2141,11 +2141,11 @@ about function addresses and register values.") (macrolet ((frob (name inst) `(define-instruction-macro ,name (dst src1 &optional src2) `(inst ,',inst ,dst ,src1 ,src2)))) - (frob ldn ld) - (frob stn st) - (frob slln sll) - (frob srln srl) - (frob sran sra)) + (frob ldn ldx) + (frob stn stx) + (frob slln sllx) + (frob srln srlx) + (frob sran srax))
;;; Jal to a full 32-bit address. Tmpreg is trashed. (define-instruction jali (segment link tmpreg value)
===================================== src/lisp/Config.sparc64_sunc ===================================== --- a/src/lisp/Config.sparc64_sunc +++ b/src/lisp/Config.sparc64_sunc @@ -26,7 +26,7 @@ AS_V8PLUS = -m64 $(MEM_MODEL) endif
ASSEM_SRC = sparc64-assem.S -CFLAGS += $(MEM_MODEL) -xlibmieee -g3 -DPRINTNOISE +CFLAGS += $(MEM_MODEL) -xlibmieee -g -DPRINTNOISE DEPEND_FLAGS = -xM ASFLAGS = $(AS_V8PLUS) OS_LINK_FLAGS = -m64 $(MEM_MODEL) -M /usr/lib/ld/map.noexstk
===================================== src/lisp/sparc64-assem.S ===================================== --- a/src/lisp/sparc64-assem.S +++ b/src/lisp/sparc64-assem.S @@ -85,10 +85,10 @@ call_into_lisp: /* No longer atomic, and check for interrupt. */ andn reg_ALLOC, pseudo_atomic_Value, reg_ALLOC andcc reg_ALLOC, pseudo_atomic_InterruptedValue, reg_ZERO - tne trap_PseudoAtomic + tne %xcc, trap_PseudoAtomic
/* Pass in the args. */ - sll %i2, 2, reg_NARGS + slln %i2, 2, reg_NARGS mov %i1, reg_CFP mov %i0, reg_LEXENV ldn [reg_CFP + 0*WORD_BYTES], reg_A0 @@ -129,12 +129,17 @@ lra: store(reg_CFP,current_control_frame_pointer)
/* No longer in Lisp. */ +#if 0 store(reg_NL1,foreign_function_call_active) +#else + sethi %hi(foreign_function_call_active), reg_L0 + st reg_NL1, [reg_L0 + %lo(foreign_function_call_active)] +#endif
/* Were we interrupted? */ andn reg_ALLOC, pseudo_atomic_Value, reg_ALLOC andcc reg_ALLOC, pseudo_atomic_InterruptedValue, reg_ZERO - tne trap_PseudoAtomic + tne %xcc, trap_PseudoAtomic
/* Back to C we go. */ ld [%sp + STACK_BIAS +FRAMESIZE-WORD_BYTES], %i7 @@ -181,12 +186,17 @@ call_into_c: load(current_control_frame_pointer, reg_CFP)
/* No longer in Lisp. */ +#if 0 store(reg_CSP,foreign_function_call_active) +#else + sethi %hi(foreign_function_call_active), reg_L0 + st reg_CSP, [reg_L0 + %lo(foreign_function_call_active)] +#endif
/* Were we interrupted? */ andn reg_ALLOC, pseudo_atomic_Value, reg_ALLOC andcc reg_ALLOC, pseudo_atomic_InterruptedValue, reg_ZERO - tne trap_PseudoAtomic + tne %xcc, trap_PseudoAtomic
/* Into C we go. */ call reg_CFUNC @@ -224,7 +234,7 @@ call_into_c: /* No longer atomic. */ andn reg_ALLOC, pseudo_atomic_Value, reg_ALLOC andcc reg_ALLOC, pseudo_atomic_InterruptedValue, reg_ZERO - tne trap_PseudoAtomic + tne %xcc, trap_PseudoAtomic
/* Reset the lisp stack. */ /* Note: OCFP is in one of the locals, it gets preserved across C. */
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/compare/566a6888220df3f0ae75d2314...