From 1532c501a6ab2a8b685212fbdc89d56ce9b274f8 Mon Sep 17 00:00:00 2001 From: Erin Date: Sat, 22 Jul 2023 02:42:21 +0200 Subject: [PATCH] added contribution guide to instructions --- hbvm/src/vm/mod.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hbvm/src/vm/mod.rs b/hbvm/src/vm/mod.rs index ff81de4..4e466ac 100644 --- a/hbvm/src/vm/mod.rs +++ b/hbvm/src/vm/mod.rs @@ -137,6 +137,24 @@ impl<'a, PfHandler: HandlePageFault, const TIMER_QUOTIENT: usize> } // Big match + // + // Contribution guide: + // - Zero register shall never be overwitten. It's value has to always be 0. + // - Prefer `Self::read_reg` and `Self::write_reg` functions + // - Extract parameters using `param!` macro + // - Prioritise speed over code size + // - Memory is cheap, CPUs not that much + // - Do not heap allocate at any cost + // - Yes, user-provided trap handler may allocate, + // but that is not our »fault«. + // - Unsafe is kinda must, but be sure you have validated everything + // - Your contributions have to pass sanitizers and Miri + // - Strictly follow the spec + // - The spec does not specify how you perform actions, in what order, + // just that the observable effects have to be performed in order and + // correctly. + // - Yes, we assume you run 64 bit CPU. Else ?conradluget a better CPU + // sorry 8 bit fans, HBVM won't run on your Speccy :( unsafe { match *self.program.get_unchecked(self.pc) { UN => {