Ticket #516 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

send/stret macro produces Error: unknown arg spec :REGISTERS

Reported by: rongarret Owned by:
Priority: normal Milestone:
Component: Objective-C Bridge Version: trunk
Keywords: Cc:

Description

With e bound to e.g. an event object, I get the following error:

? (ccl::slet ((l (send e 'location-In-Window))))
;Compiler warnings :
;   In an anonymous lambda form: Undeclared free variable E
> Error: unknown arg spec :REGISTERS
> While executing: %FF-CALL, in process Listener(7).

The form eventually macroexpands (through an amazingly byzantine process) into something containing:

(%FF-CALL (%REFERENCE-EXTERNAL-ENTRY-POINT
                            (LOAD-TIME-VALUE (EXTERNAL "_objc_msgSend")))
                          :REGISTERS
                          #:G37
                          :ADDRESS
                          E
                          :ADDRESS
                          (OBJC:@SELECTOR "locationInWindow")
                          :VOID)

which %FF-CALL doesn't seem to know what to do with.

Change History

comment:1 Changed 5 years ago by rme

I would recommend that you don't use SEND, which is basically obsolete. (Yes, the Objective-C bridge chapter in the manual is horribly out-of-date.)

(defclass clicky-view (ns:ns-view)
  ()
  (:metaclass ns:+ns-object))

(objc:defmethod (#/mouseDown: :void) ((self clicky-view) event)
  (let ((p (#/locationInWindow event)))
    (#_NSLog #@"you clicked at %@" :id (#_NSStringFromPoint p))))

comment:2 Changed 5 years ago by gb

An explanation for why the error is happening (there's a deeper problem, but this is the short version) is that something's causing the trunk IDE to start out with:

? (ccl:declaration-information 'optimize nil)
((SPEED 0) (SAFETY 3) (COMPILATION-SPEED 0) (SPACE 0) (DEBUG 3))

in effect.

That discourages the compiler from inlining the call to %FF-CALL (and from doing lots of other things), and exposes the fact that the %FF-CALL function doesn't understand what :registers is all about.

comment:3 Changed 5 years ago by rme

  • Status changed from new to closed
  • Resolution set to fixed

r12241 should fix this

Note: See TracTickets for help on using tickets.