ObjFW  Diff

Differences From Artifact [2f0f690e96]:

To Artifact [a631c06b73]:


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
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







-
+



-
-
+
+
-
-
+




-
-

-
+
+







#import "private.h"

#import "macros.h"
#ifdef OF_HAVE_THREADS
# import "OFPlainMutex.h"
#endif

#ifdef HAVE_SEH_EXCEPTIONS
#ifdef __SEH__
# include <windows.h>
#endif

#if defined(HAVE_DWARF_EXCEPTIONS)
# define PERSONALITY __gnu_objc_personality_v0
#if defined(__SEH__)
# define PERSONALITY	 gnu_objc_personality
# define CXX_PERSONALITY_STR "__gxx_personality_v0"
#elif defined(HAVE_SJLJ_EXCEPTIONS)
#elif defined(__USING_SJLJ_EXCEPTIONS__)
# define PERSONALITY __gnu_objc_personality_sj0
# define CXX_PERSONALITY_STR "__gxx_personality_sj0"
# define _Unwind_RaiseException _Unwind_SjLj_RaiseException
# define __builtin_eh_return_data_regno(i) (i)
#elif defined(HAVE_SEH_EXCEPTIONS)
# define PERSONALITY	 gnu_objc_personality
#else
# error Unknown exception type!
# define PERSONALITY __gnu_objc_personality_v0
# define CXX_PERSONALITY_STR "__gxx_personality_v0"
#endif

#if defined(OF_ARM) && !defined(__ARM_DWARF_EH__)
# define HAVE_ARM_EHABI_EXCEPTIONS
#endif

#ifndef HAVE_ARM_EHABI_EXCEPTIONS
126
127
128
129
130
131
132
133

134
135
136
137
138
139
140
124
125
126
127
128
129
130

131
132
133
134
135
136
137
138







-
+








struct objc_exception {
	struct _Unwind_Exception {
		uint64_t class;
		void (*cleanup)(
		    _Unwind_Reason_Code, struct _Unwind_Exception *);
#ifndef HAVE_ARM_EHABI_EXCEPTIONS
# ifndef HAVE_SEH_EXCEPTIONS
# ifndef __SEH__
		/*
		 * The Itanium Exception ABI says to have those and never touch
		 * them.
		 */
		uint64_t private1, private2;
# else
		uint64_t private[6];
239
240
241
242
243
244
245
246

247
248
249
250
251
252
253
237
238
239
240
241
242
243

244
245
246
247
248
249
250
251







-
+







}
#endif

#ifdef CXX_PERSONALITY
static PERSONALITY_FUNC(cxx_personality) OF_WEAK_REF(CXX_PERSONALITY_STR);
#endif

#ifdef HAVE_SEH_EXCEPTIONS
#ifdef __SEH__
extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, void *,
    PCONTEXT, PDISPATCHER_CONTEXT, _Unwind_Reason_Code (*)(int, int, uint64_t,
    struct _Unwind_Exception *, struct _Unwind_Context *));
#endif

static objc_uncaught_exception_handler uncaughtExceptionHandler;
static struct objc_exception emergencyExceptions[numEmergencyExceptions];
442
443
444
445
446
447
448
449

450
451
452
453
454
455
456
440
441
442
443
444
445
446

447
448
449
450
451
452
453
454







-
+







{
	uintptr_t IP = _Unwind_GetIP(ctx);
	const uint8_t *ptr = LSDA->callsites;

	*landingpad = 0;
	*actionRecords = NULL;

#ifndef HAVE_SJLJ_EXCEPTIONS
#ifndef __USING_SJLJ_EXCEPTIONS__
	while (ptr < LSDA->actionTable) {
		uintptr_t callsiteStart, callsiteLength, callsiteLandingpad;
		uintptr_t callsiteAction;

		callsiteStart = LSDA->regionStart +
		    (uintptr_t)readValue(LSDA->callsitesEnc, &ptr);
		callsiteLength = (uintptr_t)readValue(LSDA->callsitesEnc, &ptr);
576
577
578
579
580
581
582
583

584
585
586
587
588
589
590
574
575
576
577
578
579
580

581
582
583
584
585
586
587
588







-
+







		else if (filter < 0)
			OBJC_ERROR("Invalid filter!");
	} while (displacement != 0);

	return 0;
}

#ifdef HAVE_SEH_EXCEPTIONS
#ifdef __SEH__
static
#endif
PERSONALITY_FUNC(PERSONALITY)
{
#ifdef HAVE_ARM_EHABI_EXCEPTIONS
	int version = 1;
	uint64_t exClass = ex->class;
782
783
784
785
786
787
788
789

790
791
792
793
794
795
796
780
781
782
783
784
785
786

787
788
789
790
791
792
793
794







-
+







{
	objc_uncaught_exception_handler old = uncaughtExceptionHandler;
	uncaughtExceptionHandler = handler;

	return old;
}

#ifdef HAVE_SEH_EXCEPTIONS
#ifdef __SEH__
typedef EXCEPTION_DISPOSITION (*seh_personality_fn)(PEXCEPTION_RECORD, void *,
    PCONTEXT, PDISPATCHER_CONTEXT);
static seh_personality_fn __gxx_personality_seh0;

OF_CONSTRUCTOR()
{
	/*