Commit graph

52 commits

Author SHA1 Message Date
Fabian 3e18e05272 Move loop safety back to beginning of loop 2020-12-31 19:14:33 -06:00
Fabian 06f656ffdd Avoid recompiling pages if they don't have new entry points 2020-12-31 19:14:33 -06:00
Fabian a1f35beb8c Generate better condition functions for zf/sf/be/l/le immediately after cmp/sub/add/inc/dec/test/or/xor/and 2020-12-31 19:14:33 -06:00
Fabian 59f0fdc1e8 Add config to profiling infos 2020-12-31 19:14:33 -06:00
Fabian 0b80ef9448 expression stats 2020-12-31 19:14:33 -06:00
Fabian 37c3d1f83c Generate direct control flow, using wasm blocks and loops 2020-12-31 19:14:33 -06:00
Fabian 6352bfe3ed Multi-page wasm modules 2020-12-31 19:14:32 -06:00
Fabian d446c09fb3 print stats: Add wasm memory size 2020-12-31 19:14:32 -06:00
Fabian c835023c0c Dead code 2020-12-31 19:14:32 -06:00
Fabian 9b79278bb9 Much simpler implementation of jit cache 2020-12-31 19:14:32 -06:00
Fabian c88391d7fc Track whether segment offset is optimised away 2020-12-31 19:14:32 -06:00
Fabian 14fd138357 More precise stats for 32-bit addresses 2020-12-31 19:14:29 -06:00
Fabian 48a9847d16 s/oxide// 2020-12-31 19:14:29 -06:00
Fabian 1278672998 Split modrm stat into reg_with_offset and complex 2020-12-31 19:14:28 -06:00
Fabian 0e8c8a1dda More opstats 2020-12-31 19:14:28 -06:00
Fabian e0473dae18 profiler: Count generated simple/complex modrm address expressions 2020-12-31 19:14:28 -06:00
Fabian c086c710ad Stat: Count duplicate entries 2020-08-30 19:37:15 -05:00
Fabian 56dc1af7cc Split SAFE_WRITE stat into WRITE and READ_WRITE 2020-08-30 19:37:15 -05:00
Fabian 8838e263c3 Profiler: Track number of page faults and wasm bytes generated 2020-08-30 19:37:15 -05:00
Fabian 04281702ed Track jit exits to same/different page 2020-08-30 19:37:15 -05:00
Fabian 71093270cd Add stat to track running out of wasm indices 2020-08-30 19:37:15 -05:00
Fabian 3f3446b5dd Update linux-boot benchmark script 2020-08-30 19:37:15 -05:00
Fabian afcce9b371 Record compiled instructions per opcode 2020-08-30 19:29:54 -05:00
Fabian 7e1d398e05 Track last executed jump instruction, check for missed entry points while looking for compiled code 2020-08-30 19:29:54 -05:00
Fabian 014e745810 Clean up dead code from old exceptions 2020-08-30 19:29:54 -05:00
Fabian bf895ff1b2 profiler: Keep track of fast/slow path for jitted memory access 2020-08-30 19:29:54 -05:00
Fabian 36a46bca80 Remove non-faulting stat 2020-08-30 19:29:54 -05:00
Fabian 22ba923f9a Track number of module invalidations 2020-08-30 19:29:54 -05:00
Fabian 8919079209 Print current state of has_flat_segmentation 2020-08-30 19:29:54 -05:00
Fabian 62dd6be561 Track missed entry points 2020-08-30 19:29:54 -05:00
Fabian a832a74a36 Fix profiler 2020-08-30 19:29:53 -05:00
Fabian 33b0084aa5 Stats for global/non-global tlb entries 2020-08-30 19:29:53 -05:00
Fabian 3a8d644d75 Port jit to Rust
The following files and functions were ported:
- jit.c
- codegen.c
- _jit functions in instructions*.c and misc_instr.c
- generate_{analyzer,jit}.js (produces Rust code)
- jit_* from cpu.c

And the following data structures:
- hot_code_addresses
- wasm_table_index_free_list
- entry_points
- jit_cache_array
- page_first_jit_cache_entry

Other miscellaneous changes:
- Page is an abstract type
- Addresses, locals and bitflags are unsigned
- Make the number of entry points a growable type
- Avoid use of global state wherever possible
- Delete string packing
- Make CachedStateFlags abstract
- Make AnalysisType product type
- Make BasicBlockType product type
- Restore opcode assertion
- Set opt-level=2 in debug mode (for test performance)
- Delete JIT_ALWAYS instrumentation (now possible via api)
- Refactor generate_analyzer.js
- Refactor generate_jit.js
2020-08-30 19:29:13 -05:00
Fabian a35825b362 Stat for current tlb utilisation 2020-08-30 19:27:07 -05:00
Fabian 0fde39d22b Stats for safe_{read,write}32 fast/slow path 2020-08-30 19:27:07 -05:00
Fabian b37a086cb2 Delete dead code 2020-08-30 19:27:07 -05:00
Fabian 94b0376186 Remove timing profiler 2020-08-30 19:27:07 -05:00
Fabian ede7b705b5 JIT: Record entry points before compilation
This changes the strategy of finding basic blocks. Instead of starting
at a single address (the current instruction pointer, which was found to
be hot), we record all entries of control flow per page while
interpreting code; we also determine hotness per page. Once a page is
hot, all entries that were recorded in this page are compiled into a
single wasm module.

The code generator didn't need much changes, as it already supported
multiple entry points.
2020-08-30 19:27:07 -05:00
Fabian 38a36d2e32 Minor 2020-08-30 19:27:07 -05:00
Fabian e0b67557e9 Profiler: Track cpu exceptions 2020-08-30 19:27:07 -05:00
Fabian 62673c0990 Optimise away max iteration limit in jit code 2020-08-30 19:27:07 -05:00
Fabian c7cc131e19 Simplify expression 2020-08-30 19:27:02 -05:00
Fabian df6bc4fd28 Record more stats, improve some existing stats
- How often do_many_cycles is run and how much time it takes per call
- How many entries are currently being compiled ("pending")
- Relative frequencies of opcodes
- Reason for interpreting code (not hot, at end of page, pending or no
  block boundary)
- Number of compiled basic blocks and entry blocks
- How many pages and entries are invalidated
- How often cycle_internal, do_many_cycles and do_run are called
2020-08-30 19:27:02 -05:00
Fabian f5799991cb Collect stats for block duplication 2020-08-30 19:27:02 -05:00
Fabian 7201f9616d Delete unused stats 2020-08-30 19:27:02 -05:00
Fabian 34549fa10e Remove unused function 2020-08-30 19:27:02 -05:00
Fabian f2c8957319 Fix Closure Compiler warning 2020-08-30 19:27:02 -05:00
Fabian cba5491fc4 Multiple jit block entry points
- introduce multiple entry points per compiled wasm module, by passing
  the initial state to the generated function.
- continue analysing and compiling after instructions that change eip, but
  will eventually return to the next instruction, in particular CALLs
  (and generate an entry point for the following instruction)

This commit is incomplete in the sense that the container will crash
after some time of execution, as wasm table indices are never freed
2020-08-30 19:27:02 -05:00
Fabian 84fd5fb0b5 Avoid for-in 2020-08-30 19:27:02 -05:00
Fabian 7bde6a2691 Split printing of stats into multiple functions 2020-08-30 19:27:02 -05:00