Theory JVMExec

Up to index of Isabelle/HOL/objinit

theory JVMExec = JVMExecInstr + JVMExceptions:
(*  Title:      HOL/MicroJava/JVM/JVMExec.thy
    ID:         $Id: JVMExec.html,v 1.1 2002/11/28 14:12:09 kleing Exp $
    Author:     Cornelia Pusch, Gerwin Klein
    Copyright   1999 Technische Universitaet Muenchen
*)

header {* \isaheader{Program Execution in the JVM} *}

theory JVMExec = JVMExecInstr + JVMExceptions:


consts
  exec :: "jvm_prog × jvm_state => jvm_state option"


-- "recdef only used for pattern matching"
recdef exec "{}"
  "exec (G, xp, hp, ihp, []) = None"

  "exec (G, None, hp, ihp, (stk,loc,C,sig,pc,z)#frs) =
  (let 
     i = fst(snd(snd(snd(snd(the(method (G,C) sig)))))) ! pc;
     (xcpt', hp', ihp', frs') = exec_instr i G hp ihp stk loc C sig pc z frs
   in Some (find_handler G xcpt' hp' ihp' frs'))"

  "exec (G, Some xp, hp, ihp, frs) = None" 


constdefs
  exec_all :: "[jvm_prog,jvm_state,jvm_state] => bool"
              ("_ |- _ -jvm-> _" [61,61,61]60)
  "G |- s -jvm-> t == (s,t) \<in> {(s,t). exec(G,s) = Some t}^*"


syntax (xsymbols)
  exec_all :: "[jvm_prog,jvm_state,jvm_state] => bool"
              ("_ \<turnstile> _ -jvm\<rightarrow> _" [61,61,61]60)

text {*
  The start configuration of the JVM: in the start heap, we call a 
  method @{text m} of class @{text C} in program @{text G}. The 
  @{text this} pointer of the frame is set to @{text Null} to simulate
  a static method invokation.
*}
constdefs  
  start_state :: "jvm_prog \<Rightarrow> cname \<Rightarrow> mname \<Rightarrow> jvm_state"
  "start_state G C m \<equiv>
  let (C',rT,mxs,mxl,ins,et) = the (method (G,C) (m,[])) in
  (None, start_heap G, start_iheap, 
   [([], Null # replicate mxl arbitrary, C, (m,[]), 0, (Null,Null))])"

end