ObjFW  Check-in [d5706b7070]

Overview
Comment:runtime: Prepare for having a glue library

A glue library is required as the compiler generates direct references
to some runtime functions.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d5706b7070d3180270fb994e858c75920816258ddf9458084e10ec15f55a064f
User & Date: js on 2017-07-17 23:02:26
Other Links: manifest | tags
Context
2017-07-17
23:05
gitignore: Add *.library and ppcinline.h check-in: de43b3e645 user: js tags: trunk
23:02
runtime: Prepare for having a glue library check-in: d5706b7070 user: js tags: trunk
2017-07-16
20:33
runtime: Add protos.h to generate ppcinline.h check-in: c132c14ed7 user: js tags: trunk
Changes

Modified src/runtime/Makefile from [2b063953cf] to [80fa148287].

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

47
48
49
OBJS_EXTRA = ${LOOKUP_ASM_LOOKUP_ASM_A}
LIB_OBJS_EXTRA = ${LOOKUP_ASM_LOOKUP_ASM_LIB_A}
MORPHOS_LIB_OBJS_EXTRA = morphos-library.o ${LOOKUP_ASM_LOOKUP_ASM_A}

include ../../buildsys.mk

${MORPHOS_LIB}: ppcinline.h
ppcinline.h: ObjFW-RT.fd ObjFW-RT.h
	cvinclude.pl			\
		--root ObjFW_RT		\
		--fd ObjFW-RT.fd	\
		--clib protos.h		\
		--inline $@

CPPFLAGS += -I. -I.. -I../..				\

	    -DOBJFW_RT_LIB_MAJOR=${OBJFW_RT_LIB_MAJOR}	\
	    -DOBJFW_RT_LIB_MINOR=${OBJFW_RT_LIB_MINOR}
LD = ${OBJC}







|







>



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
OBJS_EXTRA = ${LOOKUP_ASM_LOOKUP_ASM_A}
LIB_OBJS_EXTRA = ${LOOKUP_ASM_LOOKUP_ASM_LIB_A}
MORPHOS_LIB_OBJS_EXTRA = morphos-library.o ${LOOKUP_ASM_LOOKUP_ASM_A}

include ../../buildsys.mk

${MORPHOS_LIB}: ppcinline.h
ppcinline.h: ObjFW-RT.fd protos.h
	cvinclude.pl			\
		--root ObjFW_RT		\
		--fd ObjFW-RT.fd	\
		--clib protos.h		\
		--inline $@

CPPFLAGS += -I. -I.. -I../..				\
	    -DOF_COMPILING_OBJFW_RT			\
	    -DOBJFW_RT_LIB_MAJOR=${OBJFW_RT_LIB_MAJOR}	\
	    -DOBJFW_RT_LIB_MINOR=${OBJFW_RT_LIB_MINOR}
LD = ${OBJC}

Modified src/runtime/ObjFW-RT.fd from [1966873475] to [1cf82b39e9].

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
##base _ObjFWRTBase
##bias 30
##public
* Functions for the glue code
objc_set_exit()(sysv,r12base)
* Used by the compiler - these need glue code
__objc_exec_class()(sysv,r12base)
objc_msg_lookup()(sysv,r12base)
objc_msg_lookup_stret()(sysv,r12base)
objc_msg_lookup_super()(sysv,r12base)
objc_msg_lookup_super_stret()(sysv,r12base)
objc_lookUpClass()(sysv,r12base)
objc_getClass()(sysv,r12base)
objc_getRequiredClass()(sysv,r12base)
objc_exception_throw()(sysv,r12base)
objc_sync_enter()(sysv,r12base)
objc_sync_exit()(sysv,r12base)
objc_getProperty()(sysv,r12base)
objc_setProperty()(sysv,r12base)
objc_getPropertyStruct()(sysv,r12base)
objc_setPropertyStruct()(sysv,r12base)
objc_enumerationMutation()(sysv,r12base)
* Functions declared in ObjFW-RT.h
sel_registerName()(sysv,r12base)
sel_getName()(sysv,r12base)
sel_isEqual()(sysv,r12base)
objc_allocateClassPair()(sysv,r12base)
objc_registerClassPair()(sysv,r12base)
objc_getClassList()(sysv,r12base)






|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







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
##base _ObjFWRTBase
##bias 30
##public
* Functions for the glue code
objc_set_exit()(sysv,r12base)
* Used by the compiler - these need glue code
__objc_exec_class_inline()(sysv,r12base)
objc_msg_lookup_inline()(sysv,r12base)
objc_msg_lookup_stret_inline()(sysv,r12base)
objc_msg_lookup_super_inline()(sysv,r12base)
objc_msg_lookup_super_stret_inline()(sysv,r12base)
objc_lookUpClass_inline()(sysv,r12base)
objc_getClass_inline()(sysv,r12base)
objc_getRequiredClass_inline()(sysv,r12base)
objc_exception_throw_inline()(sysv,r12base)
objc_sync_enter_inline()(sysv,r12base)
objc_sync_exit_inline()(sysv,r12base)
objc_getProperty_inline()(sysv,r12base)
objc_setProperty_inline()(sysv,r12base)
objc_getPropertyStruct_inline()(sysv,r12base)
objc_setPropertyStruct_inline()(sysv,r12base)
objc_enumerationMutation_inline()(sysv,r12base)
* Functions declared in ObjFW-RT.h
sel_registerName()(sysv,r12base)
sel_getName()(sysv,r12base)
sel_isEqual()(sysv,r12base)
objc_allocateClassPair()(sysv,r12base)
objc_registerClassPair()(sysv,r12base)
objc_getClassList()(sysv,r12base)
44
45
46
47
48
49
50
51
52

53
object_getClassName()(sysv,r12base)
protocol_getName()(sysv,r12base)
protocol_isEqual()(sysv,r12base)
protocol_conformsToProtocol()(sysv,r12base)
objc_exit()(sysv,r12base)
objc_setUncaughtExceptionHandler()(sysv,r12base)
objc_setForwardHandler()(sysv,r12base)
objc_zero_weak_references()(sysv,r12base)
objc_setEnumerationMutationHandler()(sysv,r12base)

##end







<

>

44
45
46
47
48
49
50

51
52
53
object_getClassName()(sysv,r12base)
protocol_getName()(sysv,r12base)
protocol_isEqual()(sysv,r12base)
protocol_conformsToProtocol()(sysv,r12base)
objc_exit()(sysv,r12base)
objc_setUncaughtExceptionHandler()(sysv,r12base)
objc_setForwardHandler()(sysv,r12base)

objc_setEnumerationMutationHandler()(sysv,r12base)
objc_zero_weak_references()(sysv,r12base)
##end

Modified src/runtime/ObjFW-RT.h from [8f35574758] to [58330b8a4d].

23
24
25
26
27
28
29


30
31
32
33
34
35
36
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
#endif

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>



#ifndef __has_feature
# define __has_feature(x) 0
#endif

#ifndef __has_attribute
# define __has_attribute(x) 0







>
>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
#endif

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#import "platform.h"

#ifndef __has_feature
# define __has_feature(x) 0
#endif

#ifndef __has_attribute
# define __has_attribute(x) 0
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

struct objc_protocol_list {
	struct objc_protocol_list *_Nullable next;
	long count;
	Protocol *__unsafe_unretained _Nonnull list[1];
};


#ifdef __cplusplus
extern "C" {
#endif
extern SEL _Nonnull sel_registerName(const char *_Nonnull);
extern const char *_Nonnull sel_getName(SEL _Nonnull);
extern bool sel_isEqual(SEL _Nonnull, SEL _Nonnull);
extern Class _Nonnull objc_allocateClassPair(Class _Nullable,
    const char *_Nonnull, size_t);
extern void objc_registerClassPair(Class _Nonnull);
extern id _Nullable objc_lookUpClass(const char *_Nonnull);
extern id _Nullable objc_getClass(const char *_Nonnull);
extern id _Nonnull objc_getRequiredClass(const char *_Nonnull);
extern unsigned int objc_getClassList(Class _Nonnull *_Nullable, unsigned int);
extern Class _Nonnull *_Nonnull objc_copyClassList(unsigned int *_Nullable);
extern bool class_isMetaClass(Class _Nullable);
extern const char *_Nullable class_getName(Class _Nullable);
extern Class _Nullable class_getSuperclass(Class _Nullable);
extern unsigned long class_getInstanceSize(Class _Nullable);
extern bool class_respondsToSelector(Class _Nullable, SEL _Nonnull);







>
|

|






<
<
<







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213



214
215
216
217
218
219
220

struct objc_protocol_list {
	struct objc_protocol_list *_Nullable next;
	long count;
	Protocol *__unsafe_unretained _Nonnull list[1];
};

#if 1 /* !defined(OF_MORPHOS) || defined(OF_COMPILING_OBJFW_RT) */
# ifdef __cplusplus
extern "C" {
# endif
extern SEL _Nonnull sel_registerName(const char *_Nonnull);
extern const char *_Nonnull sel_getName(SEL _Nonnull);
extern bool sel_isEqual(SEL _Nonnull, SEL _Nonnull);
extern Class _Nonnull objc_allocateClassPair(Class _Nullable,
    const char *_Nonnull, size_t);
extern void objc_registerClassPair(Class _Nonnull);



extern unsigned int objc_getClassList(Class _Nonnull *_Nullable, unsigned int);
extern Class _Nonnull *_Nonnull objc_copyClassList(unsigned int *_Nullable);
extern bool class_isMetaClass(Class _Nullable);
extern const char *_Nullable class_getName(Class _Nullable);
extern Class _Nullable class_getSuperclass(Class _Nullable);
extern unsigned long class_getInstanceSize(Class _Nullable);
extern bool class_respondsToSelector(Class _Nullable, SEL _Nonnull);
236
237
238
239
240
241
242


243

244


















245
246


247
248
249
250
251
252
253
254
255
256
257
258



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
extern bool protocol_isEqual(Protocol *_Nonnull, Protocol *_Nonnull);
extern bool protocol_conformsToProtocol(Protocol *_Nonnull, Protocol *_Nonnull);
extern void objc_exit(void);
extern _Nullable objc_uncaught_exception_handler
    objc_setUncaughtExceptionHandler(
    objc_uncaught_exception_handler _Nullable);
extern void objc_setForwardHandler(IMP _Nullable, IMP _Nullable);


extern void objc_zero_weak_references(id _Nonnull);




















/*
 * 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);
extern IMP _Nonnull objc_msg_lookup(id _Nullable, SEL _Nonnull);
extern IMP _Nonnull objc_msg_lookup_stret(id _Nullable, SEL _Nonnull);
extern IMP _Nonnull objc_msg_lookup_super(struct objc_super *_Nonnull,
    SEL _Nonnull);
extern IMP _Nonnull objc_msg_lookup_super_stret(struct objc_super *_Nonnull,
    SEL _Nonnull);



extern void objc_exception_throw(id _Nullable);
extern int objc_sync_enter(id _Nullable);
extern int objc_sync_exit(id _Nullable);
extern id _Nullable objc_getProperty(id _Nonnull, SEL _Nonnull, ptrdiff_t,
    BOOL);
extern void objc_setProperty(id _Nonnull, SEL _Nonnull, ptrdiff_t, id _Nullable,
    BOOL, signed char);
extern void objc_getPropertyStruct(void *_Nonnull, const void *_Nonnull,
    ptrdiff_t, BOOL, BOOL);
extern void objc_setPropertyStruct(void *_Nonnull, const void *_Nonnull,
    ptrdiff_t, BOOL, BOOL);
extern void objc_enumerationMutation(id _Nonnull);
extern void objc_setEnumerationMutationHandler(
    objc_enumeration_mutation_handler _Nullable);
#ifdef __cplusplus
}
#endif

#endif







>
>

>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
>












>
>
>












<
<





236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296


297
298
299
300
301
extern bool protocol_isEqual(Protocol *_Nonnull, Protocol *_Nonnull);
extern bool protocol_conformsToProtocol(Protocol *_Nonnull, Protocol *_Nonnull);
extern void objc_exit(void);
extern _Nullable objc_uncaught_exception_handler
    objc_setUncaughtExceptionHandler(
    objc_uncaught_exception_handler _Nullable);
extern void objc_setForwardHandler(IMP _Nullable, IMP _Nullable);
extern void objc_setEnumerationMutationHandler(
    objc_enumeration_mutation_handler _Nullable);
extern void objc_zero_weak_references(id _Nonnull);
# ifdef __cplusplus
}
# endif
#else
# define BOOL EXEC_BOOL
# include <ppcinline/macros.h>
# undef BOOL
# ifdef __cplusplus
extern "C" {
# endif
extern struct Library *ObjFWRTBase;
# ifdef __cplusplus
}
# endif
# include "ppcinline.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif
/*
 * Used by the compiler, but can also be called manually.
 *
 * They need to be in the glue code for the MorphOS library.
 *
 * 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);
extern IMP _Nonnull objc_msg_lookup(id _Nullable, SEL _Nonnull);
extern IMP _Nonnull objc_msg_lookup_stret(id _Nullable, SEL _Nonnull);
extern IMP _Nonnull objc_msg_lookup_super(struct objc_super *_Nonnull,
    SEL _Nonnull);
extern IMP _Nonnull objc_msg_lookup_super_stret(struct objc_super *_Nonnull,
    SEL _Nonnull);
extern id _Nullable objc_lookUpClass(const char *_Nonnull);
extern id _Nullable objc_getClass(const char *_Nonnull);
extern id _Nonnull objc_getRequiredClass(const char *_Nonnull);
extern void objc_exception_throw(id _Nullable);
extern int objc_sync_enter(id _Nullable);
extern int objc_sync_exit(id _Nullable);
extern id _Nullable objc_getProperty(id _Nonnull, SEL _Nonnull, ptrdiff_t,
    BOOL);
extern void objc_setProperty(id _Nonnull, SEL _Nonnull, ptrdiff_t, id _Nullable,
    BOOL, signed char);
extern void objc_getPropertyStruct(void *_Nonnull, const void *_Nonnull,
    ptrdiff_t, BOOL, BOOL);
extern void objc_setPropertyStruct(void *_Nonnull, const void *_Nonnull,
    ptrdiff_t, BOOL, BOOL);
extern void objc_enumerationMutation(id _Nonnull);


#ifdef __cplusplus
}
#endif

#endif

Modified src/runtime/morphos-library.m from [9724385102] to [90367d03a6].

95
96
97
98
99
100
101
102
103

104
105
106
107
108
109
110
	(ULONG)object_getClassName,
	(ULONG)protocol_getName,
	(ULONG)protocol_isEqual,
	(ULONG)protocol_conformsToProtocol,
	(ULONG)objc_exit,
	(ULONG)objc_setUncaughtExceptionHandler,
	(ULONG)objc_setForwardHandler,
	(ULONG)objc_zero_weak_references,
	(ULONG)objc_setEnumerationMutationHandler,

	-1,
	FUNCARRAY_END
};

static struct Library *lib_init(struct ObjFWRTBase *base, BPTR seg_list,
    struct ExecBase *exec_base);








<

>







95
96
97
98
99
100
101

102
103
104
105
106
107
108
109
110
	(ULONG)object_getClassName,
	(ULONG)protocol_getName,
	(ULONG)protocol_isEqual,
	(ULONG)protocol_conformsToProtocol,
	(ULONG)objc_exit,
	(ULONG)objc_setUncaughtExceptionHandler,
	(ULONG)objc_setForwardHandler,

	(ULONG)objc_setEnumerationMutationHandler,
	(ULONG)objc_zero_weak_references,
	-1,
	FUNCARRAY_END
};

static struct Library *lib_init(struct ObjFWRTBase *base, BPTR seg_list,
    struct ExecBase *exec_base);

Modified src/runtime/protos.h from [5c7d2f9056] to [c5827facdf].

12
13
14
15
16
17
18




















19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 * 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.
 */

#error This file is only to generate ppcinline.h - do not use it!





















SEL sel_registerName(const char *);
const char *sel_getName(SEL);
bool sel_isEqual(SEL, SEL);
Class objc_allocateClassPair(Class, const char *, size_t);
void objc_registerClassPair(Class);
id objc_lookUpClass(const char *);
id objc_getClass(const char *);
id objc_getRequiredClass(const char *);
unsigned int objc_getClassList(Class *, unsigned int);
Class *objc_copyClassList(unsigned int *);
bool class_isMetaClass(Class);
const char *class_getName(Class);
Class class_getSuperclass(Class);
unsigned long class_getInstanceSize(Class);
bool class_respondsToSelector(Class, SEL);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





<
<
<







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
 * 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.
 */

#error This file is only to generate ppcinline.h - do not use it!

/*
 * Used by the glue code.
 */
void __objc_exec_class_inline(void *);
IMP objc_msg_lookup_inline(id, SEL);
IMP objc_msg_lookup_stret_inline(id, SEL);
IMP objc_msg_lookup_super_inline(struct objc_super *, SEL);
IMP objc_msg_lookup_super_stret_inline(struct objc_super *, SEL);
id objc_lookUpClass_inline(const char *);
id objc_getClass_inline(const char *);
id objc_getRequiredClass_inline(const char *);
void objc_exception_throw_inline(id);
int objc_sync_enter_inline(id);
int objc_sync_exit_inline(id);
id objc_getProperty_inline(id, SEL, ptrdiff_t, BOOL);
void objc_setProperty_inline(id, SEL, ptrdiff_t, id, BOOL, signed char);
void objc_getPropertyStruct_inline(void *, const void *, ptrdiff_t, BOOL, BOOL);
void objc_setPropertyStruct_inline(void *, const void *, ptrdiff_t, BOOL, BOOL);
void objc_enumerationMutation_inline(id);

SEL sel_registerName(const char *);
const char *sel_getName(SEL);
bool sel_isEqual(SEL, SEL);
Class objc_allocateClassPair(Class, const char *, size_t);
void objc_registerClassPair(Class);



unsigned int objc_getClassList(Class *, unsigned int);
Class *objc_copyClassList(unsigned int *);
bool class_isMetaClass(Class);
const char *class_getName(Class);
Class class_getSuperclass(Class);
unsigned long class_getInstanceSize(Class);
bool class_respondsToSelector(Class, SEL);
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

const char *protocol_getName(Protocol *);
bool protocol_isEqual(Protocol *, Protocol *);
bool protocol_conformsToProtocol(Protocol *, Protocol *);
void objc_exit(void);
objc_uncaught_exception_handler objc_setUncaughtExceptionHandler(
    objc_uncaught_exception_handler);
void objc_setForwardHandler(IMP, IMP);
void objc_zero_weak_references(id);

/*
 * Used by the compiler, but can also be called manually.
 */
void __objc_exec_class(void *);
IMP objc_msg_lookup(id, SEL);
IMP objc_msg_lookup_stret(id, SEL);
IMP objc_msg_lookup_super(struct objc_super *, SEL);
IMP objc_msg_lookup_super_stret(struct objc_super *, SEL);
void objc_exception_throw(id);
int objc_sync_enter(id);
int objc_sync_exit(id);
id objc_getProperty(id, SEL, ptrdiff_t, BOOL);
void objc_setProperty(id, SEL, ptrdiff_t, id, BOOL, signed char);
void objc_getPropertyStruct(void *, const void *, ptrdiff_t, BOOL, BOOL);
void objc_setPropertyStruct(void *, const void *, ptrdiff_t, BOOL, BOOL);
void objc_enumerationMutation(id);
void objc_setEnumerationMutationHandler(objc_enumeration_mutation_handler);








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

>
60
61
62
63
64
65
66


















67
68
const char *protocol_getName(Protocol *);
bool protocol_isEqual(Protocol *, Protocol *);
bool protocol_conformsToProtocol(Protocol *, Protocol *);
void objc_exit(void);
objc_uncaught_exception_handler objc_setUncaughtExceptionHandler(
    objc_uncaught_exception_handler);
void objc_setForwardHandler(IMP, IMP);


















void objc_setEnumerationMutationHandler(objc_enumeration_mutation_handler);
void objc_zero_weak_references(id);