Skip to content

Commit ea9c9dd

Browse files
author
Nat!
committed
* MULLE_OBJC_UNIVERSE_CALL_BORING_TRACE_BIT used to be called MULLE_OBJC_UNIVERSE_CALL_SKIP_BORING_TRACE_BIT and had inverted semantics
* most `call` functions have internally been rewritten to make it easier with a C debugger to step over the boring parts to get into the Objective-C method quicker. You just step over the **imp** resolution part * two new environment variables `MULLE_OBJC_TRACE_LEAK` and `MULLE_OBJC_TRACE_ZOMBIE` greatly simplify two common debugging tasks and make the mulle-sde test output less daunting test for family bits fixed
1 parent 084c7b9 commit ea9c9dd

27 files changed

+234
-85
lines changed

Diff for: .mulle/share/env/environment-plugin.sh

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .mulle/share/env/version

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .mulle/share/sde/version/mulle-sde/cmake

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required( VERSION 3.14)
22

3-
project( mulle-objc-runtime VERSION 0.24.0 LANGUAGES C)
3+
project( mulle-objc-runtime VERSION 0.25.0 LANGUAGES C)
44

55
### mulle-sde environment
66

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ It is designed to be suitable for massive multi-threading.
1111

1212
| Release Version | Release Notes
1313
|-------------------------------------------------------|--------------
14-
| ![Mulle kybernetiK tag](https://img.shields.io/github/tag/mulle-objc/mulle-objc-runtime.svg?branch=release) [![Build Status](https://github.com/mulle-objc/mulle-objc-runtime/workflows/CI/badge.svg?branch=release)](//github.com/mulle-objc/mulle-objc-runtime/actions) | [RELEASENOTES](RELEASENOTES.md) |
14+
| ![Mulle kybernetiK tag](https://img.shields.io/github/tag/mulle-objc/mulle-objc-runtime.svg) [![Build Status](https://github.com/mulle-objc/mulle-objc-runtime/workflows/CI/badge.svg)](//github.com/mulle-objc/mulle-objc-runtime/actions) | [RELEASENOTES](RELEASENOTES.md) |
1515

1616

1717
## API

Diff for: RELEASENOTES.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 0.25.0
2+
3+
* `MULLE_OBJC_UNIVERSE_CALL_BORING_TRACE_BIT` used to be called `MULLE_OBJC_UNIVERSE_CALL_SKIP_BORING_TRACE_BIT` and had inverted semantics
4+
* most `call` functions have internally been rewritten to make it easier with a C debugger to step over the boring parts to get into the Objective-C method quicker. You just step over the **imp** resolution part
5+
* two new environment variables ``MULLE_OBJC_TRACE_LEAK`` and ``MULLE_OBJC_TRACE_ZOMBIE`` greatly simplify two common debugging tasks and make the mulle-sde test output less daunting
6+
7+
18
## 0.24.0
29

310

Diff for: cmake/share/InstallRpath.cmake

+9-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/mulle-objc-call.c

+135-42
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void *mulle_objc_object_call_super( void *obj,
131131
static int _mulle_objc_universe_is_boring_method( struct _mulle_objc_universe *universe,
132132
mulle_objc_methodid_t methodid)
133133
{
134-
if( ! (universe->debug.method_call & MULLE_OBJC_UNIVERSE_CALL_SKIP_BORING_TRACE_BIT))
134+
if( universe->debug.method_call & MULLE_OBJC_UNIVERSE_CALL_BORING_TRACE_BIT)
135135
return( 0);
136136

137137
// result can be NULL, if the search failed
@@ -357,14 +357,11 @@ void mulle_objc_object_taocheck_call( void *obj,
357357
# pragma mark - normal callbacks for memorycache
358358

359359

360-
//
361-
// MEMO: these callbacks obviously don't go through the memory cache vectors
362-
// again. Also here is tracing and toachecking implemented
363-
//
364-
static void *_mulle_objc_object_callback_class( void *obj,
365-
mulle_objc_methodid_t methodid,
366-
void *parameter,
367-
struct _mulle_objc_class *cls)
360+
static inline mulle_objc_implementation_t
361+
_mulle_objc_object_callback_class_get_implementation( void *obj,
362+
mulle_objc_methodid_t methodid,
363+
void *parameter,
364+
struct _mulle_objc_class *cls)
368365
{
369366
mulle_objc_implementation_t imp;
370367
mulle_functionpointer_t p;
@@ -410,18 +407,33 @@ static void *_mulle_objc_object_callback_class( void *obj,
410407

411408
/*->*/
412409
// do not use invoke in method calls
413-
return( (*imp)( obj, methodid, parameter));
410+
return( imp);
414411
}
415412

416413

417414
//
418-
// this function is called, when the first inline cache check gave a
419-
// collision, it skips the first found entry. This method is put into
420-
// the method cache, you don't call it directly.
415+
// MEMO: these callbacks obviously don't go through the memory cache vectors
416+
// again. Also here is tracing and toachecking implemented
421417
//
422-
static void *_mulle_objc_object_callback_cache_collision( void *obj,
423-
mulle_objc_methodid_t methodid,
424-
void *parameter)
418+
static void *_mulle_objc_object_callback_class( void *obj,
419+
mulle_objc_methodid_t methodid,
420+
void *parameter,
421+
struct _mulle_objc_class *cls)
422+
{
423+
mulle_objc_implementation_t imp;
424+
425+
imp = _mulle_objc_object_callback_class_get_implementation( obj, methodid, parameter, cls);
426+
/*->*/
427+
// do not use invoke in method calls
428+
return( (*imp)( obj, methodid, parameter));
429+
}
430+
431+
432+
433+
static inline mulle_objc_implementation_t
434+
_mulle_objc_object_callback_cache_collision_get_implementation( void *obj,
435+
mulle_objc_methodid_t methodid,
436+
void *parameter)
425437
{
426438
mulle_objc_implementation_t imp;
427439
mulle_functionpointer_t p;
@@ -464,7 +476,22 @@ static void *_mulle_objc_object_callback_cache_collision( void *obj,
464476
break;
465477
}
466478
}
479+
return( imp);
480+
}
467481

482+
483+
//
484+
// this function is called, when the first inline cache check gave a
485+
// collision, it skips the first found entry. This method is put into
486+
// the method cache, you don't call it directly.
487+
//
488+
static void *_mulle_objc_object_callback_cache_collision( void *obj,
489+
mulle_objc_methodid_t methodid,
490+
void *parameter)
491+
{
492+
mulle_objc_implementation_t imp;
493+
494+
imp = _mulle_objc_object_callback_cache_collision_get_implementation( obj, methodid, parameter);
468495
/*->*/
469496
return( (*imp)( obj, methodid, parameter));
470497
}
@@ -475,9 +502,11 @@ static void *_mulle_objc_object_callback_cache_collision( void *obj,
475502
// MEMO: if you see in the method trace this function not filling the cache
476503
// it's because of the method trace (duh)
477504
//
478-
static void *_mulle_objc_object_callback_cache_miss( void *obj,
479-
mulle_objc_methodid_t methodid,
480-
void *parameter)
505+
506+
static inline mulle_objc_implementation_t
507+
_mulle_objc_object_callback_cache_miss_get_implementation( void *obj,
508+
mulle_objc_methodid_t methodid,
509+
void *parameter)
481510
{
482511
mulle_objc_implementation_t imp;
483512
struct _mulle_objc_method *method;
@@ -495,21 +524,27 @@ static void *_mulle_objc_object_callback_cache_miss( void *obj,
495524
method = (*icache->callback.refresh_method_nofail)( cls, methodid);
496525
imp = _mulle_objc_method_get_implementation( method);
497526
imp = _mulle_objc_implementation_debug( imp, obj, methodid, parameter, cls);
527+
return( imp);
528+
}
529+
530+
531+
static void *_mulle_objc_object_callback_cache_miss( void *obj,
532+
mulle_objc_methodid_t methodid,
533+
void *parameter)
534+
{
535+
mulle_objc_implementation_t imp;
536+
537+
imp = _mulle_objc_object_callback_cache_miss_get_implementation( obj, methodid, parameter);
498538
return( (*imp)( obj, methodid, parameter));
499539
}
500540

501541

502-
//
503-
// This function is called, when the first inline cache check gave a
504-
// collision, it skips the first found entry. This is not called directly
505-
// but placed into the method cache.
506-
//
507-
static void *
508-
_mulle_objc_object_callback_super( void *obj,
509-
mulle_objc_methodid_t methodid,
510-
void *parameter,
511-
mulle_objc_superid_t superid,
512-
struct _mulle_objc_class *cls)
542+
static inline mulle_objc_implementation_t
543+
_mulle_objc_object_callback_super_get_implementation( void *obj,
544+
mulle_objc_methodid_t methodid,
545+
void *parameter,
546+
mulle_objc_superid_t superid,
547+
struct _mulle_objc_class *cls)
513548
{
514549
mulle_objc_implementation_t imp;
515550
struct _mulle_objc_cache *cache;
@@ -546,17 +581,39 @@ static void *
546581
}
547582
offset += sizeof( struct _mulle_objc_cacheentry);
548583
}
584+
return( imp);
549585
/*->*/
586+
}
587+
588+
//
589+
// This function is called, when the first inline cache check gave a
590+
// collision, it skips the first found entry. This is not called directly
591+
// but placed into the method cache.
592+
//
593+
static void *
594+
_mulle_objc_object_callback_super( void *obj,
595+
mulle_objc_methodid_t methodid,
596+
void *parameter,
597+
mulle_objc_superid_t superid,
598+
struct _mulle_objc_class *cls)
599+
{
600+
mulle_objc_implementation_t imp;
601+
602+
imp = _mulle_objc_object_callback_super_get_implementation( obj,
603+
methodid,
604+
parameter,
605+
superid,
606+
cls);
550607
return( (*imp)( obj, methodid, parameter));
551608
}
552609

553610

554-
static void *
555-
_mulle_objc_object_callback_super_cache_collision( void *obj,
556-
mulle_objc_methodid_t methodid,
557-
void *parameter,
558-
mulle_objc_superid_t superid,
559-
struct _mulle_objc_class *cls)
611+
static inline mulle_objc_implementation_t
612+
_mulle_objc_object_callback_super_cache_collision_get_implementation( void *obj,
613+
mulle_objc_methodid_t methodid,
614+
void *parameter,
615+
mulle_objc_superid_t superid,
616+
struct _mulle_objc_class *cls)
560617
{
561618
mulle_objc_implementation_t imp;
562619
struct _mulle_objc_cache *cache;
@@ -594,16 +651,34 @@ static void *
594651
break;
595652
}
596653
}
597-
return( (*imp)( obj, methodid, parameter));
654+
return( imp);
598655
}
599656

600657

601658
static void *
602-
_mulle_objc_object_callback_super_cache_miss( void *obj,
603-
mulle_objc_methodid_t methodid,
604-
void *parameter,
605-
mulle_objc_superid_t superid,
606-
struct _mulle_objc_class *cls)
659+
_mulle_objc_object_callback_super_cache_collision( void *obj,
660+
mulle_objc_methodid_t methodid,
661+
void *parameter,
662+
mulle_objc_superid_t superid,
663+
struct _mulle_objc_class *cls)
664+
{
665+
mulle_objc_implementation_t imp;
666+
667+
imp = _mulle_objc_object_callback_super_cache_collision_get_implementation( obj,
668+
methodid,
669+
parameter,
670+
superid,
671+
cls);
672+
return( (*imp)( obj, methodid, parameter));
673+
}
674+
675+
676+
static inline mulle_objc_implementation_t
677+
_mulle_objc_object_callback_super_cache_miss_get_implementation( void *obj,
678+
mulle_objc_methodid_t methodid,
679+
void *parameter,
680+
mulle_objc_superid_t superid,
681+
struct _mulle_objc_class *cls)
607682
{
608683
mulle_objc_implementation_t imp;
609684
struct _mulle_objc_method *method;
@@ -617,6 +692,24 @@ static void *
617692
method = (*icache->callback.refresh_supermethod_nofail)( cls, superid);
618693
imp = _mulle_objc_method_get_implementation( method);
619694
imp = _mulle_objc_implementation_debug( imp, obj, methodid, parameter, cls);
695+
return( imp);
696+
}
697+
698+
699+
static void *
700+
_mulle_objc_object_callback_super_cache_miss( void *obj,
701+
mulle_objc_methodid_t methodid,
702+
void *parameter,
703+
mulle_objc_superid_t superid,
704+
struct _mulle_objc_class *cls)
705+
{
706+
mulle_objc_implementation_t imp;
707+
708+
imp = _mulle_objc_object_callback_super_cache_miss_get_implementation( obj,
709+
methodid,
710+
parameter,
711+
superid,
712+
cls);
620713
return( (*imp)( obj, methodid, parameter));
621714
}
622715

Diff for: src/mulle-objc-jit.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
// JIT code.
4343
//
4444
#define MULLE_OBJC_RUNTIME_VERSION_MAJOR 0 // max 511
45-
#define MULLE_OBJC_RUNTIME_VERSION_MINOR 24 // max 1023
45+
#define MULLE_OBJC_RUNTIME_VERSION_MINOR 25 // max 1023
4646
#define MULLE_OBJC_RUNTIME_VERSION_PATCH 0 // max 255
4747

4848
//

Diff for: src/mulle-objc-object.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ struct _mulle_objc_method;
6767

6868
# pragma mark - isa handling
6969

70+
MULLE_C_ALWAYS_INLINE MULLE_C_CONST_RETURN
7071
static inline int mulle_objc_object_get_taggedpointerindex( void *obj)
7172
{
7273
#ifdef __MULLE_OBJC_TPS__
@@ -316,7 +317,7 @@ MULLE_C_ALWAYS_INLINE static inline void
316317
thread);
317318
}
318319

319-
return( _mulle_objc_objectheader_set_thread( header, thread));
320+
_mulle_objc_objectheader_set_thread( header, thread);
320321
#endif
321322
}
322323

Diff for: src/mulle-objc-objectheader.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,21 @@ struct _mulle_objc_object;
5858

5959

6060
#ifndef NDEBUG
61-
static inline void mulle_objc_object_assert_tao_object_header_no_tps( struct _mulle_objc_object *obj, int define)
61+
static inline void
62+
mulle_objc_object_assert_tao_object_header_no_tps( struct _mulle_objc_object *obj,
63+
int define)
6264
{
6365
MULLE_OBJC_RUNTIME_GLOBAL
64-
void _mulle_objc_object_assert_tao_object_header_no_tps( struct _mulle_objc_object *obj, int define);
66+
void _mulle_objc_object_assert_tao_object_header_no_tps( struct _mulle_objc_object *obj,
67+
int define);
6568

6669
if( obj)
6770
_mulle_objc_object_assert_tao_object_header_no_tps( obj, define);
6871
}
6972
#else
70-
static inline void mulle_objc_object_assert_tao_object_header_no_tps( struct _mulle_objc_object *obj, int define)
73+
static inline void
74+
mulle_objc_object_assert_tao_object_header_no_tps( struct _mulle_objc_object *obj,
75+
int define)
7176
{
7277
MULLE_C_UNUSED( obj);
7378
MULLE_C_UNUSED( define);

Diff for: src/mulle-objc-retain-release.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ static inline int _mulle_objc_object_decrement_retaincount_waszero( void *obj)
163163
header = _mulle_objc_object_get_objectheader( obj);
164164
rc = (intptr_t) _mulle_atomic_pointer_read( &header->_retaincount_1);
165165

166-
assert( rc != -1 && rc != INTPTR_MIN);
166+
assert( rc != -1 && "retainCount was already zero");
167+
assert( rc != INTPTR_MIN && "retainCount wraparound");
168+
167169
if( MULLE_C_LIKELY( rc <= MULLE_OBJC_INLINE_RELEASE))
168170
return( (intptr_t) _mulle_atomic_pointer_decrement( &header->_retaincount_1) <= 0);
169171

Diff for: src/mulle-objc-universe-fail.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ MULLE_C_NO_RETURN void
343343

344344
MULLE_C_NO_RETURN void
345345
_mulle_objc_object_abort_wrongthread( struct _mulle_objc_object *obj,
346-
mulle_thread_t affinity_thread,
347-
struct _mulle_objc_descriptor *desc)
346+
mulle_thread_t affinity_thread,
347+
struct _mulle_objc_descriptor *desc)
348348
{
349349
struct _mulle_objc_class *cls;
350350
int ismeta;

0 commit comments

Comments
 (0)