Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dlang/dmd
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 971b319e45c4
Choose a base ref
...
head repository: dlang/dmd
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 941808dc44a0
Choose a head ref
  • 3 commits
  • 38 files changed
  • 3 contributors

Commits on Jul 11, 2015

  1. Implement basic support for Objective-C methods.

    Basic support for classes, interfaces and instance methods.
    This is implemented by adding a new linkage attribute, `Objective-C`,
    and a compiler recognized UDA, `@selector`. The linkage attribute is
    to be used on a class or interface. The UDA is attached to a method.
    
    The linkage attribute tells the compiler that the class should use the
    name mangling that matches the one used by Objective-C
    (same as C, no mangling) and that all methods in the class
    should use the Objective-C way of calling methods, see below.
    The calling convention for Objective-C methods and functions is the
    same as for C.
    
    The selector UDA tells the compiler what Objective-C selector the
    method should have. The selector is used in the Objective-C runtime
    to find the implementation of a given method.
    
    An Objective-C method call is implemented by making a regular C call
    to the `objc_msgSend` function in the Objective-C runtime.
    The signature of `objc_msgSend` looks something like this:
    
    `id objc_msgSend(id self, SEL op, ...);`
    
    * The first parameter is the object (this/self pointer)
    * The second parameter is the selector attached to the method
    * The last parameter is for all the arguments that the
    implementation expects
    
    The call to `objc_msgSend` should not be performed as a variadic
    call but instead as if it had the same signature as the method
    that should be called but with the two additional parameter,
    `self` and `op`, added first. The implementation of `objc_msgSend`
    will jump to the method instead of calling it.
    
    Because of the above, multiple versions exist of `objc_msgSend`.
    Depending on the return type of the method that is called the correct
    version need to be used. This depends on the ABI. This is a list of
    functions and for which types they're used on OS X 64bit:
    
    * objc_msgSend_stret - Used for structs too large to be returned in
    registries
    * objc_msgSend_fpret - Used for `long double`
    * objc_msgSend_fp2ret - Used for `_Complex long double`
    * objc_msgSend - Used for everything else
    michelf authored and jacob-carlborg committed Jul 11, 2015
    Configuration menu
    Copy the full SHA
    867d547 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    929b56c View commit details
    Browse the repository at this point in the history
  3. Merge pull request #4321 from jacob-carlborg/dobjc_instance_methods

    Implement basic support for Objective-C methods.
    WalterBright committed Jul 11, 2015
    Configuration menu
    Copy the full SHA
    941808d View commit details
    Browse the repository at this point in the history
Loading