From e74050ade4ae37f5e2cb2fc09af405dd5f03cd2c Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 7 May 2021 18:25:43 -0700 Subject: always check for null in 'get' instructions --- mu_instructions | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mu_instructions') 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) -- cgit 1.4.1-2-gfad0