Skip to content

Commit c1a2023

Browse files
committed
move remaining parts of frontend to xxhash, eliminate blake2; sketch out test program for debug string performance testing
1 parent 812cea7 commit c1a2023

30 files changed

+62
-5864
lines changed

build.bat

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ if not "%no_meta%"=="1" (
106106
:: --- Build Everything (@build_targets) --------------------------------------
107107
pushd build
108108
if "%raddbg%"=="1" set didbuild=1 && %compile% ..\src\raddbg\raddbg_main.c %compile_link% %link_icon% %out%raddbg.exe || exit /b 1
109-
if "%radlink%"=="1" set didbuild=1 && %compile% ..\src\linker\lnk.c %compile_link% %link_natvis%"%~dp0\src\linker\linker.natvis" %out%radlink.exe || exit /b 1
109+
if "%radlink%"=="1" set didbuild=1 && %compile% ..\src\linker\lnk.c %compile_link% %link_natvis%"%~dp0\src\linker\linker.natvis" %out%radlink.exe || exit /b 1
110110
if "%rdi_from_pdb%"=="1" set didbuild=1 && %compile% ..\src\rdi_from_pdb\rdi_from_pdb_main.c %compile_link% %out%rdi_from_pdb.exe || exit /b 1
111111
if "%rdi_from_dwarf%"=="1" set didbuild=1 && %compile% ..\src\rdi_from_dwarf\rdi_from_dwarf.c %compile_link% %out%rdi_from_dwarf.exe || exit /b 1
112112
if "%rdi_dump%"=="1" set didbuild=1 && %compile% ..\src\rdi_dump\rdi_dump_main.c %compile_link% %out%rdi_dump.exe || exit /b 1
@@ -115,8 +115,9 @@ if "%tester%"=="1" set didbuild=1 && %compile% ..\src\tester
115115
if "%ryan_scratch%"=="1" set didbuild=1 && %compile% ..\src\scratch\ryan_scratch.c %compile_link% %out%ryan_scratch.exe || exit /b 1
116116
if "%textperf%"=="1" set didbuild=1 && %compile% ..\src\scratch\textperf.c %compile_link% %out%textperf.exe || exit /b 1
117117
if "%convertperf%"=="1" set didbuild=1 && %compile% ..\src\scratch\convertperf.c %compile_link% %out%convertperf.exe || exit /b 1
118+
if "%debugstringperf%"=="1" set didbuild=1 && %compile% ..\src\scratch\debugstringperf.c %compile_link% %out%debugstringperf.exe || exit /b 1
118119
if "%parse_inline_sites%"=="1" set didbuild=1 && %compile% ..\src\scratch\parse_inline_sites.c %compile_link% %out%parse_inline_sites.exe || exit /b 1
119-
if "%coffdump%"=="1" set didbuild=1 && %compile% ..\src\dumpers\coffdump.c %compile_link% %out%coffdump.exe || exit /b 1
120+
if "%coffdump%"=="1" set didbuild=1 && %compile% ..\src\dumpers\coffdump.c %compile_link% %out%coffdump.exe || exit /b 1
120121
if "%mule_main%"=="1" set didbuild=1 && del vc*.pdb mule*.pdb && %compile_release% %only_compile% ..\src\mule\mule_inline.cpp && %compile_release% %only_compile% ..\src\mule\mule_o2.cpp && %compile_debug% %EHsc% ..\src\mule\mule_main.cpp ..\src\mule\mule_c.c mule_inline.obj mule_o2.obj %compile_link% %no_aslr% %out%mule_main.exe || exit /b 1
121122
if "%mule_module%"=="1" set didbuild=1 && %compile% ..\src\mule\mule_module.cpp %compile_link% %link_dll% %out%mule_module.dll || exit /b 1
122123
if "%mule_hotload%"=="1" set didbuild=1 && %compile% ..\src\mule\mule_hotload_main.c %compile_link% %out%mule_hotload.exe & %compile% ..\src\mule\mule_hotload_module_main.c %compile_link% %link_dll% %out%mule_hotload_module.dll || exit /b 1

src/dbg_engine/dbg_engine_core.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,10 +1581,10 @@ d_next_cmd(D_Cmd **cmd)
15811581
////////////////////////////////
15821582
//~ rjf: Main Layer Top-Level Calls
15831583

1584-
#if !defined(BLAKE2_H)
1585-
#define HAVE_SSE2
1586-
#include "third_party/blake2/blake2.h"
1587-
#include "third_party/blake2/blake2b.c"
1584+
#if !defined(XXH_IMPLEMENTATION)
1585+
# define XXH_IMPLEMENTATION
1586+
# define XXH_STATIC_LINKING_ONLY
1587+
# include "third_party/xxHash/xxhash.h"
15881588
#endif
15891589

15901590
internal void
@@ -1856,7 +1856,8 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
18561856

18571857
// rjf: join & hash to produce result
18581858
String8 string = str8_list_join(scratch.arena, &strings, 0);
1859-
blake2b((U8 *)&ctrl_param_state_hash.u64[0], sizeof(ctrl_param_state_hash), string.str, string.size, 0, 0);
1859+
XXH128_hash_t hash = XXH3_128bits(string.str, string.size);
1860+
MemoryCopy(&ctrl_param_state_hash, &hash, sizeof(ctrl_param_state_hash));
18601861
}
18611862

18621863
//////////////////////////////

src/hash_store/hash_store.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
////////////////////////////////
55
//~ rjf: Basic Helpers
66

7-
#if !defined(BLAKE2_H)
8-
#define HAVE_SSE2
9-
#include "third_party/blake2/blake2.h"
10-
#include "third_party/blake2/blake2b.c"
7+
#if !defined(XXH_IMPLEMENTATION)
8+
# define XXH_IMPLEMENTATION
9+
# define XXH_STATIC_LINKING_ONLY
10+
# include "third_party/xxHash/xxhash.h"
1111
#endif
1212

1313
internal U128
1414
hs_hash_from_data(String8 data)
1515
{
1616
U128 u128 = {0};
17-
blake2b((U8 *)&u128.u64[0], sizeof(u128), data.str, data.size, 0, 0);
17+
XXH128_hash_t hash = XXH3_128bits(data.str, data.size);
18+
MemoryCopy(&u128, &hash, sizeof(u128));
1819
return u128;
1920
}
2021

src/raddbg/raddbg_main.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
//
77
// [ ] breakpoints in optimized code? maybe early-terminating bp resolution loop? @bpmiss
88
// - actually this seems to be potentially because of incomplete src-line-map info...
9+
// [ ] Mohit-reported breakpoint not hitting - may be similar thing to @bpmiss
10+
//
911
// [ ] CLI argument over-mangling?
12+
//
1013
// [ ] OutputDebugString spam, keeping way too much around!
11-
// [ ] Mohit-reported breakpoint not hitting - may be similar thing to @bpmiss
1214
//
1315
// [ ] fix light themes
1416
// [ ] make `array` view rule work with actual array types, to change their
@@ -92,14 +94,12 @@
9294
// [ ] max view rule
9395
// [ ] min view rule
9496
//
95-
// [ ] filesystem drag/drop support
9697
// [ ] double-click vs. single-click for folder navigation, see if we can infer
97-
// [ ] use backslashes on windows by default, forward slashes elsewhere
98+
// [ ] use backslashes on windows by default, forward slashes elsewhere (?)
9899
//
99100
// [ ] investigate /DEBUG:FASTLINK - can we somehow alert that we do not
100101
// support it?
101102
//
102-
// [ ] ** Converter performance & heuristics for asynchronously doing it early
103103
//
104104
// [ ] visualize conversion failures
105105
//
@@ -174,12 +174,6 @@
174174
// [ ] default font size is too small for me - not only source code, but
175175
// menus/tab/watch names (which don't resize). Maybe you could query
176176
// Windows for initial font size?
177-
// [ ] icon fonts glyphs sometimes disappear for specific font size, but they
178-
// reappear if you go +1 higher or -1 lower. Mostly red triangle in watch
179-
// values for "unknown identifier". But also yellow arrow in call stack
180-
// disappears if font size gets too large.
181-
// [ ] undo close tab would be nice. If not for everything, then at least
182-
// just for source files
183177
// [ ] Jump table thunks, on code w/o /INCREMENTAL:NO
184178

185179
////////////////////////////////
@@ -202,6 +196,8 @@
202196
//
203197
// [ ] undo/redo
204198
// [ ] proper "go back" + "go forward" history navigations
199+
// [ ] undo close tab would be nice. If not for everything, then at least
200+
// just for source files
205201
//
206202
// [ ] globally disable/configure default view rule-like things (string
207203
// viz for u8s in particular)
@@ -219,7 +215,6 @@
219215
// table headers, etc.)
220216
// [ ] @cleanup straighten out index/number space & types & terminology for
221217
// scroll lists
222-
// [ ] @cleanup central worker thread pool - eliminate per-layer thread pools
223218
// [ ] @cleanup eliminate explicit font parameters in the various ui paths (e.g.
224219
// code slice params)
225220

@@ -276,6 +271,13 @@
276271
////////////////////////////////
277272
//~ rjf: Recently Completed Task Log
278273
//
274+
// [x] filesystem drag/drop support
275+
// [x] ** Converter performance & heuristics for asynchronously doing it early
276+
// [x] icon fonts glyphs sometimes disappear for specific font size, but they
277+
// reappear if you go +1 higher or -1 lower. Mostly red triangle in watch
278+
// values for "unknown identifier". But also yellow arrow in call stack
279+
// disappears if font size gets too large.
280+
// [x] @cleanup central worker thread pool - eliminate per-layer thread pools
279281

280282
////////////////////////////////
281283
//~ rjf: Build Options

src/scratch/debugstringperf.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <windows.h>
2+
3+
DWORD thread_entry_point(void *p)
4+
{
5+
for(int i = 0; i < 100000; i += 1)
6+
{
7+
OutputDebugString("this is a test\n");
8+
}
9+
return 0;
10+
}
11+
12+
int main(int argc, char **argv)
13+
{
14+
HANDLE threads[] =
15+
{
16+
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
17+
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
18+
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
19+
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
20+
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
21+
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
22+
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
23+
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
24+
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
25+
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
26+
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
27+
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
28+
};
29+
for(int i = 0; i < sizeof(threads)/sizeof(threads[0]); i += 1)
30+
{
31+
WaitForSingleObject(threads[i], INFINITE);
32+
}
33+
return 0;
34+
}

src/third_party/blake2/blake2-config.h

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)