diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-05-07 18:25:43 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-05-07 18:25:43 -0700 |
commit | e74050ade4ae37f5e2cb2fc09af405dd5f03cd2c (patch) | |
tree | ec5ffc0b1dea309446e0e7a923158c7e592ce066 /mu_instructions | |
parent | 540fd664738dfb45d4373497c4a316828e9b1a33 (diff) | |
download | mu-e74050ade4ae37f5e2cb2fc09af405dd5f03cd2c.tar.gz |
always check for null in 'get' instructions
Diffstat (limited to 'mu_instructions')
-rw-r--r-- | mu_instructions | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mu_instructions b/mu_instructions index 945528ad..ea58866e 100644 --- a/mu_instructions +++ b/mu_instructions @@ -374,10 +374,14 @@ If a record (product) type T was defined to have elements a, b, c, ... of types T_a, T_b, T_c, ..., then accessing one of those elements f of type T_f: var/reg: (addr T_f) <- get var2/reg2: (addr T), f - => "8d/copy-address *(" reg2 "+" offset(f) ") " reg "/r32" + => "81 7/subop/compare %" reg2 " 0/imm32" + "0f 84/jump-if-= __mu-abort-null-get-base-address/disp32" + "8d/copy-address *(" reg2 "+" offset(f) ") " reg "/r32" var/reg: (addr T_f) <- get var2: T, f => "8d/copy-address *(ebp+" var2.stack-offset "+" offset(f) ") " reg "/r32" +When the base is an address we perform a null check. + # Allocating memory allocate in: (addr handle T) |