polar-objc 5.44
An Objective-C runtime library
Loading...
Searching...
No Matches
polar-selector-table-node.h
1/* Internal API: selector table node type for polar-objc.
2 Copyright (C) 2022-2025 Michael Malicoat <[email protected]>
3
4 This file is part of polar-objc.
5
6 polar-objc is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
8
9 polar-objc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
10 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11 details.
12
13 You should have received a copy of the GNU General Public License along with this program; see the file LICENSE. If
14 not, see <http://www.gnu.org/licenses/>.
15*/
16#ifndef POLAR_SELECTOR_TABLE_NODE_H
17#define POLAR_SELECTOR_TABLE_NODE_H
18// polar_selector_table_node *******************************************************************************************
19
22
24{
26 struct objc_selector *instance_first; // First recorded selector with this name, also in list of instances
27 intptr_t count_instances; // How many uses of this selector are recorded by the compilar across modules?
28 polar_simple_data_node *list_instances; // All selectors with the same method name, even if type encodings differ
29 polar_typed_selector_tree *tree_type_encodings; // Subset of above, just for differing type encodings
30 polar_selector_table_node *list_instance_count_next; // Used only to assign primary selector IDs
31};
32
37
38#define POLAR_TYPE_SELECTOR_TABLE_NODE ( polar_selector_table_node_get_type() )
39
40#define POLAR_SELECTOR_TABLE_NODE(inst) ( POLAR_INTERNAL_TYPE_CHECK_INSTANCE_CAST((inst), POLAR_TYPE_SELECTOR_TABLE_NODE, polar_selector_table_node) )
41#define POLAR_IS_SELECTOR_TABLE_NODE(inst) ( POLAR_INTERNAL_TYPE_CHECK_INSTANCE_TYPE((inst), POLAR_TYPE_SELECTOR_TABLE_NODE) )
42#define POLAR_SELECTOR_TABLE_NODE_CLASS(klass) ( POLAR_INTERNAL_TYPE_CHECK_CLASS_CAST((klass), POLAR_TYPE_SELECTOR_TABLE_NODE, polar_selector_table_node_class) )
43#define POLAR_IS_SELECTOR_TABLE_NODE_CLASS(klass) ( POLAR_INTERNAL_TYPE_CHECK_CLASS_TYPE((klass), POLAR_TYPE_SELECTOR_TABLE_NODE) )
44#define POLAR_SELECTOR_TABLE_NODE_GET_CLASS(inst) ( POLAR_INTERNAL_TYPE_INSTANCE_GET_CLASS((inst), POLAR_TYPE_SELECTOR_TABLE_NODE, polar_selector_table_node_class) )
45
46POLAR_FUNCTION_INTERNAL OBJC_FUNCTION_CONSTANT polar_internal_type
47polar_selector_table_node_get_type( void );
48
49POLAR_FUNCTION_INTERNAL void
50polar_selector_table_node_set_selector_index( polar_selector_table_node *self, intptr_t idx_new );
51
52POLAR_FUNCTION_INTERNAL void
53polar_selector_table_node_record_selector_instance( polar_selector_table_node *self,
54 struct objc_selector *instance_new );
55
56static inline const char *
57polar_selector_table_node_get_selector_name( polar_selector_table_node *self )
58{
59 assert( POLAR_IS_SELECTOR_TABLE_NODE(self) );
60
61 return (const char *)( ((polar_hash_table_node *)self )->node_key );
62}
63
64static inline intptr_t
65polar_selector_table_node_get_selector_index( polar_selector_table_node *self )
66{
67 if( self != NULL )
68 {
69 assert( POLAR_IS_SELECTOR_TABLE_NODE(self) );
70
71 return objc_selector_decode_index( (SEL)(self->instance_first) );
72 }
73
74 return 0;
75}
76
77#endif // POLAR_SELECTOR_TABLE_NODE_H
Definition polar-hash-table-node-string-key.h:31
Definition polar-hash-table-node-string-key.h:25
Definition polar-hash-table-node.h:25
Definition polar-selector-table-node.h:34
Definition polar-selector-table-node.h:24
Definition polar-simple-data-node.h:25
Definition polar-typed-selector-tree.h:9