- Notifications
You must be signed in to change notification settings - Fork749
Commitbc3ba6a
committed
Replaced magic offsets with per-type calculation
removed some macro-like method copy-pastes from CPython and bits of dead codeAll Python types created to represent CLR concepts derive from `CLR MetaType` (as before), which now has two new fields:- `tp_clr_inst_offset`, which is similar to `tp_dictoffset` in that it tells where to find `GCHandle` in instances of this type (e.g. where to find `GCHandle` pointing to `System.Uri` in corresponding Python object)- `tp_clr_inst`, which holds an optional instance of `ManagedType`, that implements the behavior of the type itself (e.g. `GCHandle` pointing to `ClassObject(type = System.Uri)`)So the layout of all Python types created by Python.NET is PyType type; nint tp_clr_inst_offset; GCHandel tp_clr_inst; (points, for example, to an instance of `ClassObject`)When a Python type, that reflects CLR type is created, the layout of instances will be: BaseTypeFields base; optional (if not in base): IntPtr dict; optional (if not in base): IntPtr weaklist; GCHandle gcHandle; (points to `CLRObject` instance, which in turn, for example, points to the actual instance of `System.Uri`)The offset to GC handle is recorded in the Python type's `tp_clr_inst_offset`, and can be found as `PyObject_Type(inst).tp_clr_inst_offset`. Or, preferably, accessor functions in `ManagedType` should be used.1 parent23527d1 commitbc3ba6a
File tree
18 files changed
+266
-507
lines changed- src
- embed_tests
- runtime
- native
18 files changed
+266
-507
lines changedLines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
1 | 2 |
| |
2 | 3 |
| |
3 | 4 |
| |
| |||
30 | 31 |
| |
31 | 32 |
| |
32 | 33 |
| |
33 |
| - | |
| 34 | + | |
34 | 35 |
| |
35 | 36 |
| |
36 | 37 |
| |
|
Lines changed: 8 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
4 |
| - | |
5 |
| - | |
6 |
| - | |
7 | 4 |
| |
8 | 5 |
| |
9 | 6 |
| |
| |||
355 | 352 |
| |
356 | 353 |
| |
357 | 354 |
| |
358 |
| - | |
359 |
| - | |
360 |
| - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
361 | 358 |
| |
362 | 359 |
| |
363 | 360 |
| |
364 | 361 |
| |
365 | 362 |
| |
366 |
| - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
367 | 366 |
| |
368 | 367 |
| |
369 | 368 |
| |
370 |
| - | |
| 369 | + | |
371 | 370 |
| |
372 | 371 |
| |
373 | 372 |
| |
| |||
391 | 390 |
| |
392 | 391 |
| |
393 | 392 |
| |
394 |
| - | |
| 393 | + | |
395 | 394 |
| |
396 | 395 |
| |
397 | 396 |
| |
|
Lines changed: 4 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
| 3 | + | |
3 | 4 |
| |
4 | 5 |
| |
5 | 6 |
| |
| |||
75 | 76 |
| |
76 | 77 |
| |
77 | 78 |
| |
78 |
| - | |
79 |
| - | |
| 79 | + | |
| 80 | + | |
80 | 81 |
| |
81 | 82 |
| |
82 | 83 |
| |
| |||
106 | 107 |
| |
107 | 108 |
| |
108 | 109 |
| |
109 |
| - | |
| 110 | + | |
110 | 111 |
| |
111 | 112 |
| |
112 | 113 |
| |
| |||
883 | 884 |
| |
884 | 885 |
| |
885 | 886 |
| |
886 |
| - | |
887 |
| - | |
888 |
| - | |
889 |
| - | |
890 |
| - | |
891 | 887 |
| |
892 | 888 |
| |
893 | 889 |
| |
|
Lines changed: 8 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
17 |
| - | |
18 |
| - | |
19 |
| - | |
20 |
| - | |
21 |
| - | |
22 |
| - | |
23 |
| - | |
24 |
| - | |
25 |
| - | |
26 |
| - | |
27 |
| - | |
28 |
| - | |
29 |
| - | |
30 | 17 |
| |
31 | 18 |
| |
32 | 19 |
| |
33 | 20 |
| |
| 21 | + | |
| 22 | + | |
| 23 | + | |
34 | 24 |
| |
35 | 25 |
| |
36 |
| - | |
| 26 | + | |
37 | 27 |
| |
38 | 28 |
| |
39 | 29 |
| |
| |||
78 | 68 |
| |
79 | 69 |
| |
80 | 70 |
| |
| 71 | + | |
| 72 | + | |
| 73 | + | |
81 | 74 |
| |
82 | 75 |
| |
83 | 76 |
| |
| |||
101 | 94 |
| |
102 | 95 |
| |
103 | 96 |
| |
104 |
| - | |
| 97 | + | |
105 | 98 |
| |
106 | 99 |
| |
107 | 100 |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
580 | 580 |
| |
581 | 581 |
| |
582 | 582 |
| |
583 |
| - | |
| 583 | + | |
584 | 584 |
| |
585 | 585 |
| |
586 | 586 |
| |
| |||
606 | 606 |
| |
607 | 607 |
| |
608 | 608 |
| |
609 |
| - | |
| 609 | + | |
610 | 610 |
| |
611 | 611 |
| |
612 | 612 |
| |
| |||
632 | 632 |
| |
633 | 633 |
| |
634 | 634 |
| |
635 |
| - | |
| 635 | + | |
636 | 636 |
| |
637 | 637 |
| |
638 | 638 |
| |
|
Lines changed: 5 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
156 | 156 |
| |
157 | 157 |
| |
158 | 158 |
| |
159 |
| - | |
| 159 | + | |
160 | 160 |
| |
161 |
| - | |
162 |
| - | |
163 |
| - | |
164 |
| - | |
165 |
| - | |
166 |
| - | |
167 |
| - | |
168 | 161 |
| |
169 | 162 |
| |
170 | 163 |
| |
| |||
177 | 170 |
| |
178 | 171 |
| |
179 | 172 |
| |
180 |
| - | |
| 173 | + | |
| 174 | + | |
181 | 175 |
| |
182 | 176 |
| |
183 | 177 |
| |
184 | 178 |
| |
185 |
| - | |
186 |
| - | |
| 179 | + | |
| 180 | + | |
187 | 181 |
| |
188 | 182 |
| |
189 | 183 |
| |
|
Lines changed: 7 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
36 |
| - | |
| 36 | + | |
37 | 37 |
| |
38 | 38 |
| |
39 |
| - | |
| 39 | + | |
40 | 40 |
| |
41 | 41 |
| |
42 |
| - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 |
| |
44 | 47 |
| |
45 | 48 |
| |
| |||
106 | 109 |
| |
107 | 110 |
| |
108 | 111 |
| |
109 |
| - | |
| 112 | + | |
110 | 113 |
| |
111 | 114 |
| |
112 | 115 |
|
Lines changed: 1 addition & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
18 |
| - | |
19 |
| - | |
20 |
| - | |
21 |
| - | |
22 |
| - | |
23 |
| - | |
24 |
| - | |
25 |
| - | |
26 |
| - | |
27 |
| - | |
28 |
| - | |
29 |
| - | |
30 |
| - | |
31 |
| - | |
32 |
| - | |
33 |
| - | |
34 |
| - | |
35 |
| - | |
36 |
| - | |
37 |
| - | |
38 | 18 |
| |
39 | 19 |
| |
40 | 20 |
| |
| |||
90 | 70 |
| |
91 | 71 |
| |
92 | 72 |
| |
93 |
| - | |
94 |
| - | |
| 73 | + | |
95 | 74 |
| |
96 | 75 |
| |
97 | 76 |
| |
| |||
116 | 95 |
| |
117 | 96 |
| |
118 | 97 |
| |
119 |
| - | |
120 | 98 |
| |
121 | 99 |
| |
122 |
| - | |
123 |
| - | |
124 |
| - | |
125 |
| - | |
126 | 100 |
| |
127 | 101 |
| |
128 | 102 |
| |
|
0 commit comments
Comments
(0)