├── HotPatch ├── CMakeLists.txt └── hotpatch.cpp ├── AsmExecute ├── CMakeLists.txt └── asmexecute.cpp ├── Cordic ├── benchmark.png ├── CMakeLists.txt ├── bit_test.cpp ├── functions.h ├── benchmark.cpp └── functions.cpp ├── FieldExtract ├── CMakeLists.txt ├── README.md ├── AsmCopyGen.h ├── AsmUtils.cpp ├── AsmUtils.h ├── AsmCopyGen.cpp └── selectfields.cpp ├── DivTests ├── CMakeLists.txt ├── libdiv.cpp └── testdiv.cpp ├── Calculator ├── CMakeLists.txt ├── Node.h ├── Writer.h ├── Predicates.h ├── calculator.cpp ├── FunctionOps.h ├── Pointer.h ├── TreeNodes.h ├── Lexer.h └── Calculator.h ├── CMakeLists.txt ├── CompileTimeSwitch ├── functions.h ├── caller_trivial.cpp ├── codegen.py ├── functions.cpp ├── Codegen.cmake ├── utils.h ├── switch.mako.cpp ├── caller_fred2.cpp ├── caller_caleth.cpp ├── caller_fred.cpp ├── CMakeLists.txt └── main.cpp ├── .clang-tidy ├── .clang-format ├── Target ├── main.cpp ├── README.md ├── functions.cpp ├── CMakeLists.txt ├── simple.cpp └── bench.cpp ├── .gitignore ├── README.md ├── CacheCheck ├── CMakeLists.txt ├── testcopy.cpp ├── testCycles.cpp └── testTrash.cpp ├── BenchmarkPatch ├── main.cpp ├── CMakeLists.txt └── compile_benchmark_results.py └── LICENSE /HotPatch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable( hotpatch hotpatch.cpp ) -------------------------------------------------------------------------------- /AsmExecute/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable( asmexecute asmexecute.cpp ) -------------------------------------------------------------------------------- /Cordic/benchmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HFTrader/AssemblyTales/HEAD/Cordic/benchmark.png -------------------------------------------------------------------------------- /FieldExtract/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable( selectfields selectfields.cpp AsmCopyGen.cpp AsmUtils.cpp ) -------------------------------------------------------------------------------- /DivTests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library( libdiv SHARED libdiv.cpp ) 2 | add_executable( testdiv testdiv.cpp ) 3 | target_link_libraries( testdiv libdiv ) -------------------------------------------------------------------------------- /Calculator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.12 ) 2 | project(calculator) 3 | 4 | set( CMAKE_CXX_STANDARD 17 ) 5 | 6 | add_executable( calculator calculator.cpp ) -------------------------------------------------------------------------------- /FieldExtract/README.md: -------------------------------------------------------------------------------- 1 | Documentation for this project is covered in these articles: 2 | 3 | http://www.vitorian.com/archives/2186 4 | 5 | http://www.vitorian.com/archives/2208 6 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(AssemblyTales) 2 | cmake_minimum_required(VERSION 3.2) 3 | 4 | add_subdirectory( FieldExtract ) 5 | add_subdirectory( HotPatch ) 6 | add_subdirectory( DivTests ) 7 | add_subdirectory( AsmExecute ) 8 | -------------------------------------------------------------------------------- /CompileTimeSwitch/functions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | struct Function { 7 | void* fnptr; 8 | size_t numargs; 9 | }; 10 | 11 | extern std::vector fntable; -------------------------------------------------------------------------------- /Cordic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.0 ) 2 | project( cordic ) 3 | 4 | find_package( benchmark REQUIRED ) 5 | add_executable( bit_test bit_test.cpp functions.cpp ) 6 | 7 | add_executable( benchmark benchmark.cpp functions.cpp ) 8 | target_link_libraries( benchmark benchmark::benchmark ) 9 | -------------------------------------------------------------------------------- /CompileTimeSwitch/caller_trivial.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "functions.h" 10 | 11 | namespace trivial { 12 | 13 | struct trivial { 14 | static double callfn(void* fn, const std::vector& args); 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /.clang-tidy: -------------------------------------------------------------------------------- 1 | --- 2 | Checks: '-*,clang-diagnostic-*,-clang-diagnostic-unused-value,clang-analyzer-*,-*,bugprone-*,performance-*,readability-*,-readability-magic-numbers,-readability-braces-around-statements,-readability-inconsistent-declaration-parameter-name,-readability-named-parameter' 3 | HeaderFilterRegex: '' 4 | WarningsAsErrors: '*' 5 | AnalyzeTemporaryDtors: false 6 | ... 7 | -------------------------------------------------------------------------------- /CompileTimeSwitch/codegen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys, os 3 | from mako.template import Template 4 | 5 | if len(sys.argv)<2: 6 | print( "Usage: codegen.py