Comment: | runtime: Add glue functions for Amiga library |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4c72b5544f767ee2cea68125296f89d4 |
User & Date: | js on 2018-04-29 20:27:23 |
Other Links: | manifest | tags |
2018-04-30
| ||
10:15 | runtime: Have the Amiga glue the other way around check-in: dec9500ab6 user: js tags: trunk | |
2018-04-29
| ||
20:27 | runtime: Add glue functions for Amiga library check-in: 4c72b5544f user: js tags: trunk | |
19:26 | runtime: Specify m68k registers for most functions check-in: 2d8aa8b1e6 user: js tags: trunk | |
Modified src/runtime/Makefile from [bedf1cf816] to [f20a53b036].
︙ | ︙ | |||
28 29 30 31 32 33 34 | SRCS_THREADS = threading.m \ ../threading.m INCLUDES = ObjFW_RT.h includesubdir = ObjFW_RT OBJS_EXTRA = ${LOOKUP_ASM_LOOKUP_ASM_A} LIB_OBJS_EXTRA = ${LOOKUP_ASM_LOOKUP_ASM_LIB_A} | | > > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | SRCS_THREADS = threading.m \ ../threading.m INCLUDES = ObjFW_RT.h includesubdir = ObjFW_RT OBJS_EXTRA = ${LOOKUP_ASM_LOOKUP_ASM_A} LIB_OBJS_EXTRA = ${LOOKUP_ASM_LOOKUP_ASM_LIB_A} AMIGA_LIB_OBJS_EXTRA = amiga-glue.amigalib.o \ amiga-library.amigalib.o \ ${LOOKUP_ASM_LOOKUP_ASM_A} include ../../buildsys.mk ppcinline.h: ObjFW_RT.fd protos.h cvinclude.pl \ --root ObjFW_RT \ --fd ObjFW_RT.fd \ |
︙ | ︙ |
Modified src/runtime/ObjFW_RT.fd from [d70fc3dd9b] to [3b5722b1a8].
1 2 3 4 | ##base _ObjFWRTBase ##bias 30 ##public * Functions for the glue code | | | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ##base _ObjFWRTBase ##bias 30 ##public * Functions for the glue code objc_set_libc(libc)(A0) * Used by the compiler - these need glue code glue___objc_exec_class(module)(A0) glue_objc_msg_lookup(obj, sel)(A0/A1) glue_objc_msg_lookup_stret(obj, sel)(A0/A1) glue_objc_msg_lookup_super(super, sel)(A0/A1) glue_objc_msg_lookup_super_stret(super, sel)(A0/A1) glue_objc_lookUpClass(name)(A0) glue_objc_getClass(name)(A0) glue_objc_getRequiredClass(name)(A0) glue_objc_exception_throw(object)(A0) glue_objc_sync_enter(object)(A0) glue_objc_sync_exit(object)(A0) glue_objc_getProperty(self, _cmd, offset, atomic)(A0/A1/D0/D1) glue_objc_setProperty(self, _cmd, offset, value, atomic, copy)(A0/A1/D0/A2/D1/D2) glue_objc_getPropertyStruct(dest, src, size, atomic, strong)(A0/A1/D0/D1/D2) glue_objc_setPropertyStruct(dest, src, size, atomic, strong)(A0/A1/D0/D1/D2) glue_objc_enumerationMutation(obj)(A0) * Functions declared in ObjFW_RT.h sel_registerName(name)(A0) sel_getName(sel)(A0) sel_isEqual(sel1, sel2)(A0/A1) objc_allocateClassPair(superclass, name, extra_bytes)(A0/A1/D0) objc_registerClassPair(cls)(A0) objc_getClassList(buf, count)(A0/D0) objc_copyClassList(len)(A0) class_isMetaClass(cls)(A0) class_getName(cls)(A0) class_getSuperclass(cls)(A0) class_getInstanceSize(cls)(A0) class_respondsToSelector(cls, sel)(A0/A1) class_conformsToProtocol(cls, p)(A0/A1) |
︙ | ︙ |
Modified src/runtime/ObjFW_RT.h from [ab282aaff9] to [f934c05953].
︙ | ︙ | |||
60 61 62 63 64 65 66 | #if defined(__amigaos__) && !defined(__MORPHOS__) && !defined(__amigaos4__) # define OBJC_M68K_REG(reg) __asm__(reg) #else # define OBJC_M68K_REG(reg) #endif #if defined(__MORPHOS__) && defined(OBJC_AMIGA_LIBRARY) | | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #if defined(__amigaos__) && !defined(__MORPHOS__) && !defined(__amigaos4__) # define OBJC_M68K_REG(reg) __asm__(reg) #else # define OBJC_M68K_REG(reg) #endif #if defined(__MORPHOS__) && defined(OBJC_AMIGA_LIBRARY) # define OBJC_M68K_FUNC(name, ...) name(void) # define OBJC_M68K_ARG(type, name, reg) type name = (type)reg; #else # define OBJC_M68K_FUNC(name, ...) name(__VA_ARGS__) # define OBJC_M68K_ARG(type, name, reg) #endif typedef struct objc_class *Class; |
︙ | ︙ | |||
287 288 289 290 291 292 293 | # ifdef OF_AMIGAOS extern struct Library *ObjFWRTBase; # endif /* * Used by the compiler, but can also be called manually. * | < < | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | > | > | > | | | | > | | > > | | > | > | > | > | > | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | # ifdef OF_AMIGAOS extern struct Library *ObjFWRTBase; # endif /* * Used by the compiler, but can also be called manually. * * These declarations are also required to prevent Clang's implicit * declarations which include __declspec(dllimport) on Windows. */ struct objc_abi_module; extern void __objc_exec_class(void *_Nonnull module); extern IMP _Nonnull objc_msg_lookup(id _Nullable obj, SEL _Nonnull sel); extern IMP _Nonnull objc_msg_lookup_stret(id _Nullable obj, SEL _Nonnull sel); extern IMP _Nonnull objc_msg_lookup_super(struct objc_super *_Nonnull super, SEL _Nonnull sel); extern IMP _Nonnull objc_msg_lookup_super_stret( struct objc_super *_Nonnull super, SEL _Nonnull sel); extern id _Nullable objc_lookUpClass(const char *_Nonnull name); extern id _Nullable objc_getClass(const char *_Nonnull name); extern id _Nonnull objc_getRequiredClass(const char *_Nonnull name); extern void objc_exception_throw(id _Nullable object); extern int objc_sync_enter(id _Nullable object); extern int objc_sync_exit(id _Nullable object); extern id _Nullable objc_getProperty(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, bool atomic); extern void objc_setProperty(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, id _Nullable value, bool atomic, signed char copy); extern void objc_getPropertyStruct(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong); extern void objc_setPropertyStruct(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong); extern void objc_enumerationMutation(id _Nonnull obj); # ifdef OBJC_AMIGA_LIBRARY extern void glue___objc_exec_class(void *_Nonnull module OBJC_M68K_REG("a0")); extern IMP _Nonnull glue_objc_msg_lookup(id _Nullable obj OBJC_M68K_REG("a0"), SEL _Nonnull sel OBJC_M68K_REG("a1")); extern IMP _Nonnull glue_objc_msg_lookup_stret( id _Nullable obj OBJC_M68K_REG("a0"), SEL _Nonnull sel OBJC_M68K_REG("a1")); extern IMP _Nonnull glue_objc_msg_lookup_super( struct objc_super *_Nonnull super OBJC_M68K_REG("a0"), SEL _Nonnull sel OBJC_M68K_REG("a1")); extern IMP _Nonnull glue_objc_msg_lookup_super_stret( struct objc_super *_Nonnull super OBJC_M68K_REG("a0"), SEL _Nonnull sel OBJC_M68K_REG("a1")); extern id _Nullable glue_objc_lookUpClass( const char *_Nonnull name OBJC_M68K_REG("a0")); extern id _Nullable glue_objc_getClass( const char *_Nonnull name OBJC_M68K_REG("a0")); extern id _Nonnull glue_objc_getRequiredClass( const char *_Nonnull name OBJC_M68K_REG("a0")); extern void glue_objc_exception_throw(id _Nullable object OBJC_M68K_REG("a0")); extern int glue_objc_sync_enter(id _Nullable object OBJC_M68K_REG("a0")); extern int glue_objc_sync_exit(id _Nullable object OBJC_M68K_REG("a0")); extern id _Nullable glue_objc_getProperty(id _Nonnull self OBJC_M68K_REG("a0"), SEL _Nonnull _cmd OBJC_M68K_REG("a1"), ptrdiff_t offset OBJC_M68K_REG("d0"), bool atomic OBJC_M68K_REG("d1")); extern void glue_objc_setProperty(id _Nonnull self OBJC_M68K_REG("a0"), SEL _Nonnull _cmd OBJC_M68K_REG("a1"), ptrdiff_t offset OBJC_M68K_REG("d0"), id _Nullable value OBJC_M68K_REG("a2"), bool atomic OBJC_M68K_REG("d1"), signed char copy OBJC_M68K_REG("d2")); extern void glue_objc_getPropertyStruct(void *_Nonnull dest OBJC_M68K_REG("a0"), const void *_Nonnull src OBJC_M68K_REG("a1"), ptrdiff_t size OBJC_M68K_REG("d0"), bool atomic OBJC_M68K_REG("d1"), bool strong OBJC_M68K_REG("d2")); extern void glue_objc_setPropertyStruct(void *_Nonnull dest OBJC_M68K_REG("a0"), const void *_Nonnull src OBJC_M68K_REG("a1"), ptrdiff_t size OBJC_M68K_REG("d0"), bool atomic OBJC_M68K_REG("d1"), bool strong OBJC_M68K_REG("d2")); extern void glue_objc_enumerationMutation(id _Nonnull obj OBJC_M68K_REG("a0")); # endif #ifdef __cplusplus } #endif #endif |
Added src/runtime/amiga-glue.m version [85119172c8].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | /* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, * 2018 * Jonathan Schleifer <js@heap.zone> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "ObjFW_RT.h" #import "private.h" #import "macros.h" void __objc_exec_class(void *module) { glue___objc_exec_class(module); } IMP objc_msg_lookup(id obj, SEL sel) { return glue_objc_msg_lookup(obj, sel); } IMP objc_msg_lookup_stret(id obj, SEL sel) { return glue_objc_msg_lookup_stret(obj, sel); } IMP objc_msg_lookup_super(struct objc_super *super, SEL sel) { return glue_objc_msg_lookup_super(super, sel); } IMP objc_msg_lookup_super_stret(struct objc_super *super, SEL sel) { return glue_objc_msg_lookup_super_stret(super, sel); } id objc_lookUpClass(const char *name) { return glue_objc_lookUpClass(name); } id objc_getClass(const char *name) { return glue_objc_getClass(name); } id objc_getRequiredClass(const char *name) { return glue_objc_getRequiredClass(name); } void objc_exception_throw(id object) { glue_objc_exception_throw(object); OF_UNREACHABLE } int objc_sync_enter(id object) { return glue_objc_sync_enter(object); } int objc_sync_exit(id object) { return glue_objc_sync_exit(object); } id objc_getProperty(id self, SEL _cmd, ptrdiff_t offset, bool atomic) { return glue_objc_getProperty(self, _cmd, offset, atomic); } void objc_setProperty(id self, SEL _cmd, ptrdiff_t offset, id value, bool atomic, signed char copy) { glue_objc_setProperty(self, _cmd, offset, value, atomic, copy); } void objc_getPropertyStruct(void *dest, const void *src, ptrdiff_t size, bool atomic, bool strong) { glue_objc_getPropertyStruct(dest, src, size, atomic, strong); } void objc_setPropertyStruct(void *dest, const void *src, ptrdiff_t size, bool atomic, bool strong) { glue_objc_setPropertyStruct(dest, src, size, atomic, strong); } void objc_enumerationMutation(id obj) { glue_objc_enumerationMutation(obj); } |
Modified src/runtime/amiga-library.m from [27909fb1e5] to [bfdf0302ef].
︙ | ︙ | |||
191 192 193 194 195 196 197 | (ULONG)lib_open, (ULONG)lib_close, (ULONG)lib_expunge, (ULONG)lib_null, /* Functions for the glue code */ (ULONG)objc_set_libc, /* Used by the compiler - these need glue code */ | | | | | | | | | | | | | | | | | | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | (ULONG)lib_open, (ULONG)lib_close, (ULONG)lib_expunge, (ULONG)lib_null, /* Functions for the glue code */ (ULONG)objc_set_libc, /* Used by the compiler - these need glue code */ (ULONG)glue___objc_exec_class, (ULONG)glue_objc_msg_lookup, (ULONG)glue_objc_msg_lookup_stret, (ULONG)glue_objc_msg_lookup_super, (ULONG)glue_objc_msg_lookup_super_stret, (ULONG)glue_objc_lookUpClass, (ULONG)glue_objc_getClass, (ULONG)glue_objc_getRequiredClass, (ULONG)glue_objc_exception_throw, (ULONG)glue_objc_sync_enter, (ULONG)glue_objc_sync_exit, (ULONG)glue_objc_getProperty, (ULONG)glue_objc_setProperty, (ULONG)glue_objc_getPropertyStruct, (ULONG)glue_objc_setPropertyStruct, (ULONG)glue_objc_enumerationMutation, /* Functions declared in ObjFW_RT.h */ (ULONG)sel_registerName, (ULONG)sel_getName, (ULONG)sel_isEqual, (ULONG)objc_allocateClassPair, (ULONG)objc_registerClassPair, (ULONG)objc_getClassList, |
︙ | ︙ |
Modified src/runtime/class.m from [8d78186ef9] to [dc95510919].
︙ | ︙ | |||
476 477 478 479 480 481 482 | process_load_queue(); objc_global_mutex_unlock(); } id | | | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | process_load_queue(); objc_global_mutex_unlock(); } id OBJC_GLUE(objc_lookUpClass, const char *name OBJC_GLUE_M68K_REG("a0")) { Class cls; if ((cls = objc_classname_to_class(name, true)) == NULL) return Nil; if (cls->info & OBJC_CLASS_INFO_SETUP) |
︙ | ︙ | |||
499 500 501 502 503 504 505 | if (!(cls->info & OBJC_CLASS_INFO_SETUP)) return Nil; return cls; } id | | | | | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | if (!(cls->info & OBJC_CLASS_INFO_SETUP)) return Nil; return cls; } id OBJC_GLUE(objc_getClass, const char *name OBJC_GLUE_M68K_REG("a0")) { return OBJC_GLUE(objc_lookUpClass, name); } id OBJC_GLUE(objc_getRequiredClass, const char *name OBJC_GLUE_M68K_REG("a0")) { Class cls; if ((cls = OBJC_GLUE(objc_getClass, name)) == Nil) OBJC_ERROR("Class %s not found!", name); return cls; } Class objc_lookup_class(const char *name) |
︙ | ︙ |
Modified src/runtime/exception.m from [f8288a7f27] to [d4191ceef9].
︙ | ︙ | |||
712 713 714 715 716 717 718 | #ifdef OF_HAVE_THREADS if (!of_spinlock_unlock(&emergency_exceptions_spinlock)) OBJC_ERROR("Cannot unlock spinlock!"); #endif } void | | | 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 | #ifdef OF_HAVE_THREADS if (!of_spinlock_unlock(&emergency_exceptions_spinlock)) OBJC_ERROR("Cannot unlock spinlock!"); #endif } void OBJC_GLUE(objc_exception_throw, id object OBJC_GLUE_M68K_REG("a0")) { struct objc_exception *e = malloc(sizeof(*e)); bool emergency = false; if (e == NULL) { #ifdef OF_HAVE_THREADS if (!of_spinlock_lock(&emergency_exceptions_spinlock)) |
︙ | ︙ |
Modified src/runtime/init.m from [9ac67071b3] to [efb27b1cf2].
︙ | ︙ | |||
17 18 19 20 21 22 23 | #include "config.h" #import "ObjFW_RT.h" #import "private.h" void | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include "config.h" #import "ObjFW_RT.h" #import "private.h" void OBJC_GLUE(__objc_exec_class, void *module_ OBJC_GLUE_M68K_REG("a0")) { struct objc_abi_module *module = module_; objc_global_mutex_lock(); objc_register_all_selectors(module->symtab); objc_register_all_classes(module->symtab); |
︙ | ︙ |
Modified src/runtime/lookup.m from [61e54bb565] to [97e097af52].
︙ | ︙ | |||
154 155 156 157 158 159 160 | if (imp == (IMP)0) return not_found(obj, sel); return imp; } IMP | | > | > | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | if (imp == (IMP)0) return not_found(obj, sel); return imp; } IMP OBJC_GLUE(objc_msg_lookup, id obj OBJC_GLUE_M68K_REG("a0"), SEL sel OBJC_GLUE_M68K_REG("a1")) { return common_lookup(obj, sel, objc_method_not_found); } IMP OBJC_GLUE(objc_msg_lookup_stret, id obj OBJC_GLUE_M68K_REG("a0"), SEL sel OBJC_GLUE_M68K_REG("a1")) { return common_lookup(obj, sel, objc_method_not_found_stret); } static OF_INLINE IMP common_lookup_super(struct objc_super *super, SEL sel, IMP (*not_found)(id, SEL)) |
︙ | ︙ | |||
183 184 185 186 187 188 189 | if (imp == (IMP)0) return not_found(super->self, sel); return imp; } IMP | | > > | > > | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | if (imp == (IMP)0) return not_found(super->self, sel); return imp; } IMP OBJC_GLUE(objc_msg_lookup_super, struct objc_super *super OBJC_GLUE_M68K_REG("a0"), SEL sel OBJC_GLUE_M68K_REG("a1")) { return common_lookup_super(super, sel, objc_method_not_found); } IMP OBJC_GLUE(objc_msg_lookup_super_stret, struct objc_super *super OBJC_GLUE_M68K_REG("a0"), SEL sel OBJC_GLUE_M68K_REG("a1")) { return common_lookup_super(super, sel, objc_method_not_found_stret); } #endif |
Modified src/runtime/misc.m from [938c4e7c92] to [b15d677d1a].
︙ | ︙ | |||
22 23 24 25 26 27 28 | #include "ObjFW_RT.h" #include "private.h" static objc_enumeration_mutation_handler enumeration_mutation_handler = NULL; void | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #include "ObjFW_RT.h" #include "private.h" static objc_enumeration_mutation_handler enumeration_mutation_handler = NULL; void OBJC_GLUE(objc_enumerationMutation, id obj OBJC_GLUE_M68K_REG("a0")) { if (enumeration_mutation_handler != NULL) enumeration_mutation_handler(obj); else OBJC_ERROR("Object was mutated during enumeration!"); } void objc_setEnumerationMutationHandler( objc_enumeration_mutation_handler handler OBJC_M68K_REG("a0")) { enumeration_mutation_handler = handler; } |
Modified src/runtime/private.h from [3320990765] to [51fe416316].
︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # ifndef _Nonnull # define _Nonnull # endif # ifndef _Nullable # define _Nullable # endif #endif struct objc_abi_class { struct objc_abi_class *_Nonnull metaclass; const char *_Nullable superclass; const char *_Nonnull name; unsigned long version; unsigned long info; | > > > > > > > > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # ifndef _Nonnull # define _Nonnull # endif # ifndef _Nullable # define _Nullable # endif #endif #ifdef OBJC_AMIGA_LIBRARY # define OBJC_GLUE(name, ...) glue_##name(__VA_ARGS__) # define OBJC_GLUE_M68K_REG(reg) OBJC_M68K_REG(reg) #else # define OBJC_GLUE(name, ...) name(__VA_ARGS__) # define OBJC_GLUE_M68K_REG(reg) #endif struct objc_abi_class { struct objc_abi_class *_Nonnull metaclass; const char *_Nullable superclass; const char *_Nonnull name; unsigned long version; unsigned long info; |
︙ | ︙ |
Modified src/runtime/property.m from [e9bfb6f639] to [d73c3bd6a6].
︙ | ︙ | |||
37 38 39 40 41 42 43 | for (size_t i = 0; i < NUM_SPINLOCKS; i++) if (!of_spinlock_new(&spinlocks[i])) OBJC_ERROR("Failed to initialize spinlocks!") } #endif id | > > | > | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | for (size_t i = 0; i < NUM_SPINLOCKS; i++) if (!of_spinlock_new(&spinlocks[i])) OBJC_ERROR("Failed to initialize spinlocks!") } #endif id OBJC_GLUE(objc_getProperty, id self OBJC_GLUE_M68K_REG("a0"), SEL _cmd OBJC_GLUE_M68K_REG("a1"), ptrdiff_t offset OBJC_GLUE_M68K_REG("d0"), bool atomic OBJC_GLUE_M68K_REG("d1")) { if (atomic) { id *ptr = (id *)(void *)((char *)self + offset); #ifdef OF_HAVE_THREADS unsigned hash = SPINLOCK_HASH(ptr); OF_ENSURE(of_spinlock_lock(&spinlocks[hash])); |
︙ | ︙ | |||
59 60 61 62 63 64 65 | #endif } return *(id *)(void *)((char *)self + offset); } void | > > | > | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | #endif } return *(id *)(void *)((char *)self + offset); } void OBJC_GLUE(objc_setProperty, id self OBJC_GLUE_M68K_REG("a0"), SEL _cmd OBJC_GLUE_M68K_REG("a1"), ptrdiff_t offset OBJC_GLUE_M68K_REG("d0"), id value OBJC_GLUE_M68K_REG("a2"), bool atomic OBJC_GLUE_M68K_REG("d1"), signed char copy OBJC_GLUE_M68K_REG("d2")) { if (atomic) { id *ptr = (id *)(void *)((char *)self + offset); #ifdef OF_HAVE_THREADS unsigned hash = SPINLOCK_HASH(ptr); OF_ENSURE(of_spinlock_lock(&spinlocks[hash])); |
︙ | ︙ | |||
112 113 114 115 116 117 118 | } [old release]; } /* The following methods are only required for GCC >= 4.6 */ void | | > > | | > > | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | } [old release]; } /* The following methods are only required for GCC >= 4.6 */ void OBJC_GLUE(objc_getPropertyStruct, void *dest OBJC_GLUE_M68K_REG("a0"), const void *src OBJC_GLUE_M68K_REG("a1"), ptrdiff_t size OBJC_GLUE_M68K_REG("d0"), bool atomic OBJC_GLUE_M68K_REG("d1"), bool strong OBJC_GLUE_M68K_REG("d2")) { if (atomic) { #ifdef OF_HAVE_THREADS unsigned hash = SPINLOCK_HASH(src); OF_ENSURE(of_spinlock_lock(&spinlocks[hash])); #endif memcpy(dest, src, size); #ifdef OF_HAVE_THREADS OF_ENSURE(of_spinlock_unlock(&spinlocks[hash])); #endif return; } memcpy(dest, src, size); } void OBJC_GLUE(objc_setPropertyStruct, void *dest OBJC_GLUE_M68K_REG("a0"), const void *src OBJC_GLUE_M68K_REG("a1"), ptrdiff_t size OBJC_GLUE_M68K_REG("d0"), bool atomic OBJC_GLUE_M68K_REG("d1"), bool strong OBJC_GLUE_M68K_REG("d2")) { if (atomic) { #ifdef OF_HAVE_THREADS unsigned hash = SPINLOCK_HASH(src); OF_ENSURE(of_spinlock_lock(&spinlocks[hash])); #endif |
︙ | ︙ |
Modified src/runtime/static-instances.m from [88afa289a1] to [297c42eb6a].
︙ | ︙ | |||
29 30 31 32 33 34 35 | void objc_init_static_instances(struct objc_abi_symtab *symtab) { struct objc_abi_static_instances **si; /* Check if the class for a static instance became available */ for (size_t i = 0; i < static_instances_cnt; i++) { | > | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | void objc_init_static_instances(struct objc_abi_symtab *symtab) { struct objc_abi_static_instances **si; /* Check if the class for a static instance became available */ for (size_t i = 0; i < static_instances_cnt; i++) { Class cls = OBJC_GLUE(objc_lookUpClass, static_instances[i]->class_name); if (cls != Nil) { for (id *instances = static_instances[i]->instances; *instances != nil; instances++) object_setClass(*instances, cls); static_instances_cnt--; |
︙ | ︙ | |||
70 71 72 73 74 75 76 | si = (struct objc_abi_static_instances **) symtab->defs[symtab->cls_def_cnt + symtab->cat_def_cnt]; if (si == NULL) return; for (; *si != NULL; si++) { | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | si = (struct objc_abi_static_instances **) symtab->defs[symtab->cls_def_cnt + symtab->cat_def_cnt]; if (si == NULL) return; for (; *si != NULL; si++) { Class cls = OBJC_GLUE(objc_lookUpClass, (*si)->class_name); if (cls != Nil) { for (id *instances = (*si)->instances; *instances != nil; instances++) object_setClass(*instances, cls); } else { static_instances = realloc(static_instances, |
︙ | ︙ |
Modified src/runtime/synchronized.m from [9c9179113a] to [0e4fc2baa0].
︙ | ︙ | |||
39 40 41 42 43 44 45 | { if (!of_mutex_new(&mutex)) OBJC_ERROR("Failed to create mutex!") } #endif int | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | { if (!of_mutex_new(&mutex)) OBJC_ERROR("Failed to create mutex!") } #endif int OBJC_GLUE(objc_sync_enter, id object OBJC_GLUE_M68K_REG("a0")) { if (object == nil) return 0; #ifdef OF_HAVE_THREADS struct lock_s *lock; |
︙ | ︙ | |||
90 91 92 93 94 95 96 | OBJC_ERROR("Failed to lock mutex!"); #endif return 0; } int | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | OBJC_ERROR("Failed to lock mutex!"); #endif return 0; } int OBJC_GLUE(objc_sync_exit, id object OBJC_GLUE_M68K_REG("a0")) { if (object == nil) return 0; #ifdef OF_HAVE_THREADS struct lock_s *lock, *last = NULL; |
︙ | ︙ |