Annotation of objc/objc-msg-m68k-nolock.s, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * "Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.0 (the 'License').  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License."
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: #ifndef KERNEL
                     25: | _objc_entryPoints and _objc_exitPoints are used by moninitobjc() to setup
                     26: | objective-C messages for profiling.  The are made private_externs when in
                     27: | a shared library.
                     28:        .reference _moninitobjc
                     29:        .data
                     30: .globl _objc_entryPoints
                     31: _objc_entryPoints:
                     32:        .long _objc_msgSend
                     33:        .long _objc_msgSendSuper
                     34:        .long 0
                     35: 
                     36: .globl _objc_exitPoints
                     37: _objc_exitPoints:
                     38:        .long Lexit1
                     39:        .long Lexit5
                     40:        .long 0
                     41: #endif /* KERNEL */
                     42: 
                     43:        self = 4
                     44:        selector = 8
                     45:        cache = 32
                     46:        buckets = 8
                     47:        method_imp = 8
                     48: 
                     49: | optimized for 68040: 27 clocks (best case) + 16 clocks / probe
                     50: 
                     51:        .text
                     52:        .align 1
                     53:        .globl _objc_msgSend
                     54: _objc_msgSend:
                     55:        movel sp@(self),a0              | (1)
                     56:        tstl a0                         |     if (self == nil)
                     57:        jne L1                          |
                     58:        movel a0,d0                     |       return nil
                     59:        rts                             |
                     60: L1:    movel a0@,a0                    | (1) class = self->isa;
                     61:        movel a1,sp@-                   | (2) (save a1)
                     62:        movel a0@(cache),a1             | (1) cache = class->cache;
                     63:        movel sp@(selector+4),d1        | (1) index = selector;
                     64: L2:    andl a1@,d1                     | (1) index &= cache->mask;
                     65:        movel a1@(buckets,d1:l:4),d0    | (4) method = cache->buckets[index];
                     66:        movel d0,a0                     | (1) if (method == NULL)
                     67:        jne L3                          | (2)   goto cache_miss;
                     68:        jra L5                          |
                     69: L3:    movel sp@(selector+4),d0        | (1)
                     70:        cmpl a0@,d0                     | (1) if (method_name == selector)
                     71:        jeq L4                          | (2)   goto cache_hit;
                     72:        addql #1,d1                     |     index++
                     73:        jra L2                          |     goto loop;
                     74: L4:    movel a0@(method_imp),a0        | (1) imp = method->method_imp;
                     75:        movel sp@+,a1                   | (1) (restore a1)
                     76: Lexit1:        jmp a0@                         | (3) goto *imp;
                     77: #ifdef MONINIT
                     78:        .space 22                       | /* area for moninitobjc to write */
                     79: #endif
                     80: L5:    movel sp@(self+4),a0            |     cache_miss:
                     81:        movel sp@(selector+4),sp@-      |     imp =
                     82:        movel a0@,sp@-                  |     _class_lookupMethodAndLoadCache
                     83:        jbsr __class_lookupMethodAndLoadCache   |     (class, selector);
                     84:        addql #8,sp                     |
                     85:        movel d0,a0                     |
                     86:        movel sp@+,a1                   |     (restore a1)
                     87: Lexit2:        jmp a0@                         |     goto *imp;
                     88:        .space 22                       | /* area for moninitobjc to write */
                     89: 
                     90: 
                     91: 
                     92:        caller = 4
                     93: 
                     94: | optimized for 68040: 31 clocks (best case) + 16 clocks / probe
                     95: 
                     96:        .align 1
                     97:        .globl _objc_msgSendSuper
                     98: _objc_msgSendSuper:
                     99:        movel sp@(caller),a0            | (1)
                    100:        movel a2,sp@-                   | (2) (save a2)
                    101:        movel a0@+,sp@(self+4)          | (2) self = caller->receiver;
                    102:        movel a0@,a2                    | (1) class = caller->class;
                    103:        movel a1,sp@-                   | (2) (save a1)
                    104:        movel a2@(cache),a1             | (1) cache = class->cache;
                    105:        movel sp@(selector+8),d1        | (1) index = selector;
                    106: L6:    andl a1@,d1                     | (1) index &= cache->mask;
                    107:        movel a1@(buckets,d1:l:4),d0    | (4) method = cache->buckets[index];
                    108:        movel d0,a0                     | (1) if (method == NULL)
                    109:        jne L7                          | (2)   goto cache_miss;
                    110:        jra L9                          |
                    111: L7:    movel sp@(selector+8),d0        | (1)
                    112:        cmpl a0@,d0                     | (1) if (method_name == selector)
                    113:        jeq L8                          | (2)   goto cache_hit;
                    114:        addql #1,d1                     |     index++
                    115:        jra L6                          |     goto loop;
                    116: L8:    movel a0@(method_imp),a0        | (1) imp = method->method_imp;
                    117:        movel sp@+,a1                   | (1) (restore a1)
                    118:        movel sp@+,a2                   | (1) (restore a2)
                    119: Lexit5:        jmp a0@                         | (3) goto *imp;
                    120: #ifdef MONINIT
                    121:        .space 22                       | /* area for moninitobjc to write */
                    122: #endif
                    123: L9:    movel sp@(selector+8),sp@-      |     imp =
                    124:        movel a2,sp@-                   |     _class_lookupMethodAndLoadCache
                    125:        jbsr __class_lookupMethodAndLoadCache   |     (class, selector);
                    126:        addql #8,sp                     |
                    127:        movel d0,a0                     |
                    128:        movel sp@+,a1                   |     (restore a1)
                    129:        movel sp@+,a2                   |     (restore a2)
                    130: Lexit6:        jmp a0@                         |     goto *imp;
                    131: #ifdef MONINIT
                    132:        .space 22                       | /* area for moninitobjc to write */
                    133: #endif
                    134: 
                    135: 
                    136: 
                    137:        .objc_meth_var_names
                    138:        .align 1
                    139: L30:   .ascii "forward::\0"
                    140: 
                    141:        .objc_message_refs
                    142:        .align 2
                    143: L31:   .long L30
                    144: 
                    145:        .cstring
                    146:        .align 1
                    147: L32:   .ascii "Does not recognize selector %s\0"
                    148: 
                    149:        .text
                    150:        .align 1
                    151:        .globl __objc_msgForward
                    152: __objc_msgForward:
                    153:        linkw a6,#0x0                   |  set up frame pointer
                    154:        movel sp@(selector+4),d0        |  +n accounts for sp pushes
                    155:        cmpl L31,d0                     |  if (sel == @selector (forward::))
                    156:        bne L33                         |  
                    157:        pea L30                         |  __objc_error (self,
                    158:        pea L32                         |                _errDoesntRecognize
                    159:        movel sp@(self+12),sp@-         |                "forward::");
                    160:        bsr ___objc_error               |  
                    161: L33:    pea sp@(self+4)                        |  return [self forward: sel : &self];
                    162:        movel d0,sp@-                   |  
                    163:        movel L31,sp@-                  |  
                    164:        movel sp@(self+16),sp@-         |  
                    165:        bsr _objc_msgSend               |  
                    166:        unlk a6                         |  clear frame pointer
                    167:        rts                             |  
                    168: 
                    169: 
                    170:        size = 12
                    171:        args = 16
                    172: 
                    173:        .text
                    174:        .align 1
                    175:        .globl _objc_msgSendv
                    176: _objc_msgSendv:
                    177:        linkw a6,#0                     |  
                    178:        movel a6@(size+4),d0            |  
                    179:        addql #3,d0                     |  size = round_up (size, 4);
                    180:        andl #0xfffffffc,d0             |  
                    181:        movel a6@(args+4),a0            |  
                    182:        addl d0,a0                      |  arg_ptr = &args[size];
                    183:        subql #8,d0                     |  size -= 8;
                    184:        ble L35                         |  while (size > 0)
                    185: L34:   movel a0@-,sp@-                 |    *--sp = *--arg_ptr;
                    186:        subql #4,d0                     |    size -= 4;
                    187:        bgt L34                         |  
                    188: L35:   movel a6@(selector+4),sp@-      |  
                    189:        movel a6@(self+4),sp@-          |  objc_msgSend (self, selector, ...);
                    190:        bsr _objc_msgSend               |  
                    191:        unlk a6                         |  (deallocate variable storage)
                    192:        rts                             |  

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.