Version française
Home     About     Download     Resources     Contact us    
Browse thread
Compiler internals question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: sperber@i...
Subject: Compiler internals question

[ Many thanks, Xavier, for your previous answer to my byterun
question! ]

Consider the following O'Caml fragment:

type bla = A of int | B of int * int | C of int * int * int

match f 5 with B(_, _) -> 17

The latter line is compiled into Lambda intermediate code as:

(catch
  (let (match/51 (apply (global f/49g) 5))
    (catch
      (switch match/51
       case tag 1:
        (let (match/52 (field 0 match/51) match/53 (field 1 match/51)) 17))
     with exit))
 with (raise (makeblock 0 (global Match_failure/12g) [0: "" 0 28])))

Does the inner "catch" serve any purpose or is it redundant?

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla