src/HOL/MicroJava/JVM/JVMExec.thy
changeset 8045 816f566c414f
parent 8034 6fc37b5c5e98
child 9376 c32c5696ec2a
equal deleted inserted replaced
8044:296b03b79505 8045:816f566c414f
    27 
    27 
    28 (** exec is not recursive. recdef is just used because for pattern matching **)
    28 (** exec is not recursive. recdef is just used because for pattern matching **)
    29 recdef exec "{}"
    29 recdef exec "{}"
    30  "exec (G, xp, hp, []) = None"
    30  "exec (G, xp, hp, []) = None"
    31 
    31 
    32  "exec (G, None, hp, (stk,loc,cn,ml,pc)#frs) = 
    32  "exec (G, None, hp, (stk,loc,C,sig,pc)#frs) =
    33    Some (case snd(snd(snd(the(method (G,cn) ml)))) ! pc of
    33    Some (case snd(snd(snd(the(method (G,C) sig)))) ! pc of
    34       LS ins \\<Rightarrow> let (stk',loc',pc') = exec_las ins stk loc pc
    34       LS ins \\<Rightarrow> let (stk',loc',pc') = exec_las ins stk loc pc
    35 		in
    35 		in
    36 		(None,hp,(stk',loc',cn,ml,pc')#frs)
    36 		(None,hp,(stk',loc',C,sig,pc')#frs)
    37 
    37 
    38     | CO ins \\<Rightarrow> let (xp',hp',stk',pc') = exec_co ins G hp stk pc
    38     | CO ins \\<Rightarrow> let (xp',hp',stk',pc') = exec_co ins G hp stk pc
    39 		in
    39 		in
    40 		(xp',hp',(stk',loc,cn,ml,pc')#frs)	    
    40 		(xp',hp',(stk',loc,C,sig,pc')#frs)	    
    41 
    41 
    42     | MO ins \\<Rightarrow> let (xp',hp',stk',pc') = exec_mo ins hp stk pc
    42     | MO ins \\<Rightarrow> let (xp',hp',stk',pc') = exec_mo ins hp stk pc
    43 		in
    43 		in
    44 		(xp',hp',(stk',loc,cn,ml,pc')#frs)
    44 		(xp',hp',(stk',loc,C,sig,pc')#frs)
    45 
    45 
    46     | CH ins \\<Rightarrow> let (xp',stk',pc') = exec_ch ins G hp stk pc
    46     | CH ins \\<Rightarrow> let (xp',stk',pc') = exec_ch ins G hp stk pc
    47 		in
    47 		in
    48 		(xp',hp,(stk',loc,cn,ml,pc')#frs)
    48 		(xp',hp,(stk',loc,C,sig,pc')#frs)
    49 
    49 
    50     | MI ins \\<Rightarrow> let (xp',frs',stk',pc') = exec_mi ins G hp stk pc 
    50     | MI ins \\<Rightarrow> let (xp',frs',stk',pc') = exec_mi ins G hp stk pc 
    51 		in
    51 		in
    52 		(xp',hp,frs'@(stk',loc,cn,ml,pc')#frs)
    52 		(xp',hp,frs'@(stk',loc,C,sig,pc')#frs)
    53 
    53 
    54     | MR ins \\<Rightarrow> let frs' = exec_mr ins stk frs in (None,hp,frs')
    54     | MR ins \\<Rightarrow> let frs' = exec_mr ins stk frs in (None,hp,frs')
    55 
    55 
    56     | OS ins \\<Rightarrow> let (stk',pc') = exec_os ins stk pc
    56     | OS ins \\<Rightarrow> let (stk',pc') = exec_os ins stk pc
    57 		in
    57 		in
    58 		(None,hp,(stk',loc,cn,ml,pc')#frs)
    58 		(None,hp,(stk',loc,C,sig,pc')#frs)
    59 
    59 
    60     | BR ins \\<Rightarrow> let (stk',pc') = exec_br ins stk pc
    60     | BR ins \\<Rightarrow> let (stk',pc') = exec_br ins stk pc
    61 		in
    61 		in
    62 		(None,hp,(stk',loc,cn,ml,pc')#frs))"
    62 		(None,hp,(stk',loc,C,sig,pc')#frs))"
    63 
    63 
    64  "exec (G, Some xp, hp, f#frs) = None"
    64  "exec (G, Some xp, hp, frs) = None"
    65 
    65 
    66 
    66 
    67 constdefs
    67 constdefs
    68  exec_all :: "[jvm_prog,jvm_state,jvm_state] \\<Rightarrow> bool"  ("_ \\<turnstile> _ -jvm\\<rightarrow> _" [61,61,61]60)
    68  exec_all :: "[jvm_prog,jvm_state,jvm_state] \\<Rightarrow> bool"  ("_ \\<turnstile> _ -jvm\\<rightarrow> _" [61,61,61]60)
    69  "G \\<turnstile> s -jvm\\<rightarrow> t \\<equiv> (s,t) \\<in> {(s,t). exec(G,s) = Some t}^*"
    69  "G \\<turnstile> s -jvm\\<rightarrow> t \\<equiv> (s,t) \\<in> {(s,t). exec(G,s) = Some t}^*"