switch rdi_from_pdb to new async layer, off of old task system

This commit is contained in:
Ryan Fleury
2024-11-01 14:44:56 -07:00
parent 86d9b792d8
commit 79bcbe4b39
7 changed files with 3055 additions and 216 deletions
+18 -4
View File
@@ -1,6 +1,16 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Basic Type Functions
internal ASYNC_Task
async_task_zero(void)
{
ASYNC_Task task = {0};
return task;
}
////////////////////////////////
//~ rjf: Top-Level Layer Initialization
@@ -103,10 +113,14 @@ async_task_launch_(ASYNC_WorkFunctionType *work_function, ASYNC_WorkParams *para
internal void *
async_task_join(ASYNC_Task task)
{
os_semaphore_take(task.semaphore, max_U64);
os_semaphore_release(task.semaphore);
MemoryZeroStruct(&task.semaphore);
void *result = (void *)ins_atomic_u64_eval(&task.output);
void *result = 0;
if(!os_handle_match(task.semaphore, os_handle_zero()))
{
os_semaphore_take(task.semaphore, max_U64);
os_semaphore_release(task.semaphore);
MemoryZeroStruct(&task.semaphore);
result = (void *)ins_atomic_u64_eval(&task.output);
}
return result;
}
+6 -1
View File
@@ -85,6 +85,11 @@ struct ASYNC_Shared
global ASYNC_Shared *async_shared = 0;
////////////////////////////////
//~ rjf: Basic Type Functions
internal ASYNC_Task async_task_zero(void);
////////////////////////////////
//~ rjf: Top-Level Layer Initialization
@@ -106,7 +111,7 @@ internal B32 async_push_work_(ASYNC_WorkFunctionType *work_function, ASYNC_WorkP
internal void async_task_list_push(Arena *arena, ASYNC_TaskList *list, ASYNC_Task t);
internal ASYNC_Task async_task_launch_(ASYNC_WorkFunctionType *work_function, ASYNC_WorkParams *params);
#define async_task_kickoff(work_function, ...) async_task_kickoff_((work_function), &(ASYNC_WorkParams){.endt_us = max_U64, __VA_ARGS__})
#define async_task_launch(work_function, ...) async_task_launch_((work_function), &(ASYNC_WorkParams){.endt_us = max_U64, __VA_ARGS__})
internal void *async_task_join(ASYNC_Task task);
#define async_task_join_struct(task, T) (T *)async_task_join(task)
+3
View File
@@ -30,6 +30,9 @@ main_thread_base_entry_point(void (*entry_point)(CmdLine *cmdline), char **argum
#if defined(ASYNC_H) && !defined(ASYNC_INIT_MANUAL)
async_init();
#endif
#if defined(RDI_FROM_PDB_H) && !defined(P2R_INIT_MANUAL)
p2r_init();
#endif
#if defined(TASK_SYSTEM_H) && !defined(TS_INIT_MANUAL)
ts_init();
#endif
+4
View File
@@ -559,6 +559,7 @@
#define FNT_INIT_MANUAL 1
#define D_INIT_MANUAL 1
#define RD_INIT_MANUAL 1
#define P2R_INIT_MANUAL 1
////////////////////////////////
//~ rjf: Includes
@@ -1072,6 +1073,9 @@ entry_point(CmdLine *cmd_line)
{
Temp scratch = scratch_begin(0, 0);
//- rjf: initializer pdb -> rdi conversion layer
p2r_init();
//- rjf: parse arguments
P2R_User2Convert *user2convert = p2r_user2convert_from_cmdln(scratch.arena, cmd_line);
File diff suppressed because it is too large Load Diff
+29
View File
@@ -524,6 +524,22 @@ struct P2R_BakeIdxRunsIn
RDIM_BakeIdxRunMap *idx_runs;
};
////////////////////////////////
//~ rjf: Top-Level State
typedef struct P2R_State P2R_State;
struct P2R_State
{
Arena *arena;
U64 work_thread_arenas_count;
Arena **work_thread_arenas;
};
////////////////////////////////
//~ rjf: Globals
global P2R_State *p2r_state = 0;
////////////////////////////////
//~ rjf: Basic Helpers
@@ -559,6 +575,14 @@ internal void p2r_location_over_lvar_addr_range(Arena *arena, RDIM_ScopeChunkLis
////////////////////////////////
//~ rjf: Initial Parsing & Preparation Pass Tasks
ASYNC_WORK_DEF(p2r_exe_hash_work);
ASYNC_WORK_DEF(p2r_tpi_hash_parse_work);
ASYNC_WORK_DEF(p2r_tpi_leaf_work);
ASYNC_WORK_DEF(p2r_symbol_stream_parse_work);
ASYNC_WORK_DEF(p2r_c13_stream_parse_work);
ASYNC_WORK_DEF(p2r_comp_unit_parse_work);
ASYNC_WORK_DEF(p2r_comp_unit_contributions_parse_work);
internal TS_TASK_FUNCTION_DEF(p2r_exe_hash_task__entry_point);
internal TS_TASK_FUNCTION_DEF(p2r_tpi_hash_parse_task__entry_point);
internal TS_TASK_FUNCTION_DEF(p2r_tpi_leaf_parse_task__entry_point);
@@ -638,6 +662,11 @@ internal TS_TASK_FUNCTION_DEF(p2r_bake_type_nodes_task__entry_point);
internal TS_TASK_FUNCTION_DEF(p2r_bake_name_map_task__entry_point);
internal TS_TASK_FUNCTION_DEF(p2r_bake_idx_runs_task__entry_point);
////////////////////////////////
//~ rjf: Top-Level Initialization
internal void p2r_init(void);
////////////////////////////////
//~ rjf: Top-Level Baking Entry Point
+2 -2
View File
@@ -24,7 +24,7 @@
#include "base/base_inc.h"
#include "os/os_inc.h"
#include "async/async.h"
#include "task_system/task_system.h"
// #include "task_system/task_system.h"
#include "rdi_make/rdi_make_local.h"
#include "coff/coff.h"
#include "codeview/codeview.h"
@@ -40,7 +40,7 @@
#include "base/base_inc.c"
#include "os/os_inc.c"
#include "async/async.c"
#include "task_system/task_system.c"
//#include "task_system/task_system.c"
#include "rdi_make/rdi_make_local.c"
#include "coff/coff.c"
#include "codeview/codeview.c"