Various little changes like cmethd -> method and cfield -> field.
1 (* Title: HOL/MicroJava/JVM/JVMExec.thy
4 Copyright 1999 Technische Universitaet Muenchen
9 JVMExec = LoadAndStore + Object + Method + Opstack + Control +
12 instr = LS load_and_store
14 | MO manipulate_object
23 jvm_prog = "(nat \\<times> bytecode)prog"
26 exec :: "jvm_prog \\<times> jvm_state \\<Rightarrow> jvm_state option"
28 (** exec is not recursive. recdef is just used because for pattern matching **)
30 "exec (G, xp, hp, []) = None"
32 "exec (G, None, hp, (stk,loc,cn,ml,pc)#frs) =
33 Some (case snd(snd(snd(the(method (G,cn) ml)))) ! pc of
34 LS ins \\<Rightarrow> let (stk',loc',pc') = exec_las ins stk loc pc
36 (None,hp,(stk',loc',cn,ml,pc')#frs)
38 | CO ins \\<Rightarrow> let (xp',hp',stk',pc') = exec_co ins G hp stk pc
40 (xp',hp',(stk',loc,cn,ml,pc')#frs)
42 | MO ins \\<Rightarrow> let (xp',hp',stk',pc') = exec_mo ins hp stk pc
44 (xp',hp',(stk',loc,cn,ml,pc')#frs)
46 | CH ins \\<Rightarrow> let (xp',stk',pc') = exec_ch ins G hp stk pc
48 (xp',hp,(stk',loc,cn,ml,pc')#frs)
50 | MI ins \\<Rightarrow> let (xp',frs',stk',pc') = exec_mi ins G hp stk pc
52 (xp',hp,frs'@(stk',loc,cn,ml,pc')#frs)
54 | MR ins \\<Rightarrow> let frs' = exec_mr ins stk frs in (None,hp,frs')
56 | OS ins \\<Rightarrow> let (stk',pc') = exec_os ins stk pc
58 (None,hp,(stk',loc,cn,ml,pc')#frs)
60 | BR ins \\<Rightarrow> let (stk',pc') = exec_br ins stk pc
62 (None,hp,(stk',loc,cn,ml,pc')#frs))"
64 "exec (G, Some xp, hp, f#frs) = None"
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}^*"