Skip to content

Commit b53fdb4

Browse files
committed
Hide DeeThreadObject.t_deepassoc under CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
1 parent 8c45393 commit b53fdb4

File tree

6 files changed

+35
-7
lines changed

6 files changed

+35
-7
lines changed

include/deemon/thread.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ struct Dee_trepr_frame {
140140
DeeTypeObject *rf_type; /* [1..1][const] The type of object that is being converted to a string. */
141141
};
142142

143+
#ifndef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
143144
struct Dee_deep_assoc_entry {
144145
DREF DeeObject *de_old; /* [0..1] The old object that is being copied.
145146
* NOTE: NULL is used to indicate a sentinel entry.
@@ -214,6 +215,7 @@ struct Dee_deep_assoc {
214215
DFUNDEF WUNUSED NONNULL((1, 2)) DeeObject *DCALL
215216
Dee_DeepCopyAddAssoc(DeeObject *new_object,
216217
DeeObject *old_object);
218+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
217219

218220

219221
#ifdef CONFIG_BUILDING_DEEMON
@@ -351,9 +353,11 @@ typedef struct Dee_thread_object {
351353
struct Dee_repr_frame *t_hash_curr; /* [lock(PRIVATE(DeeThread_Self()))][0..1]
352354
* [valid_if(Dee_THREAD_STATE_STARTED && !Dee_THREAD_STATE_TERMINATED)]
353355
* Chain of GC objects currently invoking the `__hash__' operator. */
356+
#ifndef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
354357
struct Dee_deep_assoc t_deepassoc; /* [lock(PRIVATE(DeeThread_Self()))]
355358
* [valid_if(Dee_THREAD_STATE_STARTED && !Dee_THREAD_STATE_TERMINATED)]
356359
* Deepcopy association map. */
360+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
357361
struct Dee_code_frame *t_exec; /* [lock(PRIVATE(DeeThread_Self()))][0..1][(!= NULL) == (t_execsz != 0)]
358362
* [if(!Dee_THREAD_STATE_STARTED || Dee_THREAD_STATE_TERMINATED, [0..0])]
359363
* [const_if(Dee_THREAD_STATE_TERMINATED)]
@@ -734,7 +738,7 @@ DeeThread_RemoveInterruptHook(struct Dee_thread_interrupt_hook *__restrict hook)
734738

735739

736740
/* The max stack-depth during execution before a stack-overflow is raised. */
737-
DDATDEF uint16_t DeeExec_StackLimit;
741+
DDATDEF uint16_t DeeExec_StackLimit; /* TODO: Change this to uint32_t (we want to allow the user to set stack limits > 2**16, plus 32-bit arithmetic is probably faster than 16-bit!) */
738742

739743
#ifndef Dee_EXEC_DEFAULT_STACK_LIMIT
740744
#define Dee_EXEC_DEFAULT_STACK_LIMIT 1024

src/deemon/execute/asm/exec.gas-386.S

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,15 @@ END(_impl_assert_failed)
413413
#endif /* !CONFIG_EXPERIMENTAL_MODULE_DIRECTORIES */
414414
#define t_repr_curr (t_str_curr+4) /* struct Dee_repr_frame *t_repr_curr; */
415415
#define t_hash_curr (t_str_curr+8) /* struct Dee_repr_frame *t_hash_curr; */
416+
#ifdef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
417+
#define t_exec (t_str_curr+12) /* struct Dee_code_frame *t_exec; */
418+
#else /* CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
416419
#define t_deepassoc (t_str_curr+12) /* struct Dee_deep_assoc t_deepassoc; */
417420
#define t_exec (t_str_curr+28) /* struct Dee_code_frame *t_exec; */
418-
#define t_except (t_str_curr+32) /* struct Dee_except_frame *t_except; */
419-
#define t_execsz (t_str_curr+36) /* uint16_t t_execsz; */
420-
#define t_exceptsz (t_str_curr+38) /* uint16_t t_exceptsz; */
421+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
422+
#define t_except (t_exec+4) /* struct Dee_except_frame *t_except; */
423+
#define t_execsz (t_exec+8) /* uint16_t t_execsz; */
424+
#define t_exceptsz (t_exec+10) /* uint16_t t_exceptsz; */
421425
/* }; */
422426

423427
/* struct Dee_except_handler { */

src/deemon/linker-scripts/link-deemon-gcc-i386-cygwin.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,6 @@ EXPORTS
15251525
_Dee_Decref_traced@12=Dee_Decref_traced@12
15261526
_Dee_Decrefv@8=Dee_Decrefv@8
15271527
_Dee_Decrefv_traced@16=Dee_Decrefv_traced@16
1528-
_Dee_DeepCopyAddAssoc@8=Dee_DeepCopyAddAssoc@8
15291528
_Dee_DumpReferenceLeaks@0=Dee_DumpReferenceLeaks@0
15301529
_Dee_Exit@8=Dee_Exit@8
15311530
_Dee_Free@4=Dee_Free@4
@@ -1601,6 +1600,7 @@ EXPORTS
16011600
_Dee_attriterchain_builder_init@12=Dee_attriterchain_builder_init@12
16021601
_Dee_bytes_printer_alloc@8=Dee_bytes_printer_alloc@8
16031602
_Dee_bytes_printer_append@12=Dee_bytes_printer_append@12
1603+
_Dee_bytes_printer_init_ex@8=Dee_bytes_printer_init_ex@8
16041604
_Dee_bytes_printer_pack@4=Dee_bytes_printer_pack@4
16051605
_Dee_bytes_printer_print@12=Dee_bytes_printer_print@12
16061606
_Dee_bytes_printer_putb@8=Dee_bytes_printer_putb@8

src/deemon/linker-scripts/link-deemon-msvc-i386-win32.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,6 @@ EXPORTS
15251525
Dee_Decref_traced@12=_Dee_Decref_traced@12
15261526
Dee_Decrefv@8=_Dee_Decrefv@8
15271527
Dee_Decrefv_traced@16=_Dee_Decrefv_traced@16
1528-
Dee_DeepCopyAddAssoc@8=_Dee_DeepCopyAddAssoc@8
15291528
Dee_DumpReferenceLeaks@0=_Dee_DumpReferenceLeaks@0
15301529
Dee_Exit@8=_Dee_Exit@8
15311530
Dee_Free@4=_Dee_Free@4
@@ -1601,6 +1600,7 @@ EXPORTS
16011600
Dee_attriterchain_builder_init@12=_Dee_attriterchain_builder_init@12
16021601
Dee_bytes_printer_alloc@8=_Dee_bytes_printer_alloc@8
16031602
Dee_bytes_printer_append@12=_Dee_bytes_printer_append@12
1603+
Dee_bytes_printer_init_ex@8=_Dee_bytes_printer_init_ex@8
16041604
Dee_bytes_printer_pack@4=_Dee_bytes_printer_pack@4
16051605
Dee_bytes_printer_print@12=_Dee_bytes_printer_print@12
16061606
Dee_bytes_printer_putb@8=_Dee_bytes_printer_putb@8

src/deemon/runtime/thread.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ PRIVATE DEFINE_STRING(main_thread_name, "MainThread");
863863
PUBLIC uint16_t DeeExec_StackLimit = Dee_EXEC_DEFAULT_STACK_LIMIT;
864864

865865

866+
#ifndef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
866867
PRIVATE struct Dee_deep_assoc_entry empty_deep_assoc[] = {
867868
{ NULL, NULL }
868869
};
@@ -1040,6 +1041,7 @@ deepcopy_clear(struct Dee_thread_object *__restrict thread_self) {
10401041
Dee_Free(begin);
10411042
}
10421043
}
1044+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
10431045

10441046

10451047
typedef struct os_thread_object {
@@ -1158,7 +1160,9 @@ INTERN DeeOSThreadObject DeeThread_Main = {
11581160
/* .t_str_curr = */ NULL,
11591161
/* .t_repr_curr = */ NULL,
11601162
/* .t_hash_curr = */ NULL,
1163+
#ifndef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
11611164
/* .t_deepassoc = */ { 0, 0, empty_deep_assoc, 0 },
1165+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
11621166
/* .t_exec = */ NULL,
11631167
/* .t_except = */ NULL,
11641168
/* .t_execsz = */ 0,
@@ -1793,7 +1797,9 @@ DeeThread_AllocateCurrentThread(void) {
17931797
if unlikely(result == NULL)
17941798
return NULL;
17951799
DeeObject_Init(&result->at_os_thread.ot_thread, &DeeThread_Type);
1800+
#ifndef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
17961801
result->at_os_thread.ot_thread.t_deepassoc.da_list = empty_deep_assoc;
1802+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
17971803

17981804
/* Set expected thread flags. */
17991805
result->at_os_thread.ot_thread.t_state = 0 |
@@ -1962,9 +1968,11 @@ DeeThread_Secede(DREF DeeObject *thread_result) {
19621968
ASSERTF(self->t_str_curr == NULL, "Calling thread still has active calls to `DeeObject_Str'");
19631969
ASSERTF(self->t_repr_curr == NULL, "Calling thread still has active calls to `DeeObject_Repr'");
19641970
ASSERTF(self->t_hash_curr == NULL, "Calling thread still has active calls to `DeeObject_Hash'");
1971+
#ifndef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
19651972
ASSERTF(self->t_deepassoc.da_used == 0, "Calling thread still has active calls to `DeeObject_DeepCopy'");
19661973
ASSERT((self->t_deepassoc.da_mask != 0) ==
19671974
(self->t_deepassoc.da_list != empty_deep_assoc));
1975+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
19681976
ASSERT(!self->t_threadname || DeeString_Check(self->t_threadname));
19691977

19701978
/* Set the TERMINATING flag to prevent further interrupts from being scheduled. */
@@ -2199,12 +2207,14 @@ INTERN void DCALL DeeThread_SubSystemFini(void) {
21992207
/* Finalize the main-thread object */
22002208
_DeeThread_FiniMainThread();
22012209

2210+
#ifndef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
22022211
/* Do some cleanup on the main-thread object */
22032212
if (DeeThread_Main.ot_thread.t_deepassoc.da_list != empty_deep_assoc)
22042213
Dee_Free(DeeThread_Main.ot_thread.t_deepassoc.da_list);
22052214
DeeThread_Main.ot_thread.t_deepassoc.da_used = 0;
22062215
DeeThread_Main.ot_thread.t_deepassoc.da_mask = 0;
22072216
DeeThread_Main.ot_thread.t_deepassoc.da_list = empty_deep_assoc;
2217+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
22082218

22092219
DBG_ALIGNMENT_ENABLE();
22102220
}
@@ -3578,9 +3588,11 @@ thread_fini(DeeThreadObject *__restrict self) {
35783588
#ifndef CONFIG_NO_THREADS
35793589
ASSERT(!LIST_ISBOUND(self, t_global));
35803590
#endif /* !CONFIG_NO_THREADS */
3591+
#ifndef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
35813592
ASSERT(self->t_deepassoc.da_used == 0);
35823593
ASSERT(self->t_deepassoc.da_mask == 0);
35833594
ASSERT(self->t_deepassoc.da_list == empty_deep_assoc);
3595+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
35843596
#ifndef CONFIG_NO_THREADS
35853597
ASSERT(self->t_threadname == NULL);
35863598
#endif /* !CONFIG_NO_THREADS */
@@ -3605,11 +3617,13 @@ thread_fini(DeeThreadObject *__restrict self) {
36053617
#endif /* !... */
36063618
}
36073619

3620+
#ifndef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
36083621
ASSERT(!self->t_deepassoc.da_used);
36093622
ASSERT((self->t_deepassoc.da_mask != 0) ==
36103623
(self->t_deepassoc.da_list != empty_deep_assoc));
36113624
if (self->t_deepassoc.da_list != empty_deep_assoc)
36123625
Dee_Free(self->t_deepassoc.da_list);
3626+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
36133627
Dee_XDecref(self->t_threadname);
36143628
if (self->t_state & Dee_THREAD_STATE_STARTED) {
36153629
if (self->t_state & Dee_THREAD_STATE_TERMINATED) {
@@ -3653,7 +3667,9 @@ PUBLIC WUNUSED DREF DeeObject *DCALL DeeThread_FromTid(Dee_pid_t tid) {
36533667
Dee_THREAD_STATE_HASTID |
36543668
Dee_THREAD_STATE_UNMANAGED;
36553669
result->ot_tid = tid;
3670+
#ifndef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
36563671
result->ot_thread.t_deepassoc.da_list = empty_deep_assoc;
3672+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
36573673
DeeObject_Init(&result->ot_thread, &DeeThread_Type);
36583674
return DeeGC_Track(Dee_AsObject(&result->ot_thread));
36593675
err:
@@ -3851,10 +3867,12 @@ thread_init(DeeThreadObject *__restrict self,
38513867
me->ot_thread.t_str_curr = NULL;
38523868
me->ot_thread.t_repr_curr = NULL;
38533869
me->ot_thread.t_hash_curr = NULL;
3870+
#ifndef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
38543871
me->ot_thread.t_deepassoc.da_used = 0;
38553872
me->ot_thread.t_deepassoc.da_mask = 0;
38563873
me->ot_thread.t_deepassoc.da_list = empty_deep_assoc;
38573874
me->ot_thread.t_deepassoc.da_recursion = 0;
3875+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
38583876
me->ot_thread.t_exec = NULL;
38593877
me->ot_thread.t_except = NULL;
38603878
me->ot_thread.t_execsz = 0;
@@ -3938,10 +3956,12 @@ thread_init(DeeThreadObject *__restrict self,
39383956
self->t_interrupt.ti_args = NULL;
39393957
self->t_global.le_prev = NULL;
39403958
DBG_memset(&self->t_global.le_next, 0xcc, sizeof(self->t_global.le_next));
3959+
#ifndef CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR
39413960
self->t_deepassoc.da_used = 0;
39423961
self->t_deepassoc.da_mask = 0;
39433962
self->t_deepassoc.da_list = empty_deep_assoc;
39443963
self->t_deepassoc.da_recursion = 0;
3964+
#endif /* !CONFIG_EXPERIMENTAL_SERIALIZE_OPERATOR */
39453965
#ifdef CONFIG_EXPERIMENTAL_CUSTOM_HEAP
39463966
self->t_heap = NULL;
39473967
#endif /* CONFIG_EXPERIMENTAL_CUSTOM_HEAP */

src/deemon/system/system-nt.c.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2243,7 +2243,7 @@ again:
22432243
if (memcasecmp(filename_str, pipe_prefix, COMPILER_STRLEN(pipe_prefix) * sizeof(char)) == 0) {
22442244
DBG_ALIGNMENT_DISABLE();
22452245
if (GetFileType(hFile) == FILE_TYPE_PIPE) {
2246-
DWORD new_mode = /*!(oflags & OPEN_FNONBLOCK) ? PIPE_WAIT :*/ PIPE_NOWAIT;
2246+
DWORD new_mode = /* !(oflags & OPEN_FNONBLOCK) ? PIPE_WAIT : */ PIPE_NOWAIT;
22472247
(void)SetNamedPipeHandleState(hFile, &new_mode, NULL, NULL);
22482248
}
22492249
DBG_ALIGNMENT_ENABLE();

0 commit comments

Comments
 (0)