From 48c7e45535b37f804c4cdb8e390430460a0ba474 Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Tue, 30 Sep 2025 17:14:59 -0700 Subject: [PATCH] helper for determining if bytecode has dependency on TLS --- src/lib_rdi_make/rdi_make.c | 19 ++++++++++++++++++- src/lib_rdi_make/rdi_make.h | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/lib_rdi_make/rdi_make.c b/src/lib_rdi_make/rdi_make.c index 25fc7f63..19cf6a31 100644 --- a/src/lib_rdi_make/rdi_make.c +++ b/src/lib_rdi_make/rdi_make.c @@ -941,7 +941,7 @@ rdim_inline_site_chunk_list_concat_in_place(RDIM_InlineSiteChunkList *dst, RDIM_ //- rjf: bytecode -RDI_PROC void +RDI_PROC RDIM_EvalBytecodeOp * rdim_bytecode_push_op(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode, RDI_EvalOp op, RDI_U64 p) { RDI_U16 ctrlbits = rdi_eval_op_ctrlbits_table[op]; @@ -955,6 +955,8 @@ rdim_bytecode_push_op(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode, RDI_EvalOp RDIM_SLLQueuePush(bytecode->first_op, bytecode->last_op, node); bytecode->op_count += 1; bytecode->encoded_size += 1 + p_size; + + return node; } RDI_PROC void @@ -1022,6 +1024,21 @@ rdim_bytecode_concat_in_place(RDIM_EvalBytecode *left_dst, RDIM_EvalBytecode *ri } } +RDI_PROC B32 +rdim_is_bytecode_tls_dependent(RDIM_EvalBytecode bytecode) +{ + B32 result = 0; + for(RDIM_EvalBytecodeOp *n = bytecode.first_op; n != 0; n = n->next) + { + if(n->op == RDI_EvalOp_TLSOff) + { + result = 1; + break; + } + } + return result; +} + //- rjf: locations RDI_PROC RDI_U64 diff --git a/src/lib_rdi_make/rdi_make.h b/src/lib_rdi_make/rdi_make.h index cab8df40..015bb7c3 100644 --- a/src/lib_rdi_make/rdi_make.h +++ b/src/lib_rdi_make/rdi_make.h @@ -1648,10 +1648,11 @@ RDI_PROC void rdim_inline_site_chunk_list_concat_in_place(RDIM_InlineSiteChunkLi //~ rjf: [Building] Location Info Building //- rjf: bytecode -RDI_PROC void rdim_bytecode_push_op(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode, RDI_EvalOp op, RDI_U64 p); +RDI_PROC RDIM_EvalBytecodeOp * rdim_bytecode_push_op(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode, RDI_EvalOp op, RDI_U64 p); RDI_PROC void rdim_bytecode_push_uconst(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode, RDI_U64 x); RDI_PROC void rdim_bytecode_push_sconst(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode, RDI_S64 x); RDI_PROC void rdim_bytecode_concat_in_place(RDIM_EvalBytecode *left_dst, RDIM_EvalBytecode *right_destroyed); +RDI_PROC B32 rdim_is_bytecode_tls_dependent(RDIM_EvalBytecode bytecode); //- rjf: locations RDI_PROC RDI_U64 rdim_encoded_size_from_location_info(RDIM_LocationInfo *info);