1 (* Title: HOL/MicroJava/JVM/JVMExec.thy |
1 (* Title: HOL/MicroJava/JVM/JVMExec.thy |
2 ID: $Id$ |
|
3 Author: Cornelia Pusch, Gerwin Klein |
2 Author: Cornelia Pusch, Gerwin Klein |
4 Copyright 1999 Technische Universitaet Muenchen |
3 Copyright 1999 Technische Universitaet Muenchen |
5 *) |
4 *) |
6 |
5 |
7 header {* \isaheader{Program Execution in the JVM} *} |
6 header {* \isaheader{Program Execution in the JVM} *} |
24 in Some (find_handler G xcpt' hp' frs'))" |
23 in Some (find_handler G xcpt' hp' frs'))" |
25 |
24 |
26 "exec (G, Some xp, hp, frs) = None" |
25 "exec (G, Some xp, hp, frs) = None" |
27 |
26 |
28 |
27 |
29 constdefs |
28 definition exec_all :: "[jvm_prog,jvm_state,jvm_state] => bool" |
30 exec_all :: "[jvm_prog,jvm_state,jvm_state] => bool" |
29 ("_ |- _ -jvm-> _" [61,61,61]60) where |
31 ("_ |- _ -jvm-> _" [61,61,61]60) |
|
32 "G |- s -jvm-> t == (s,t) \<in> {(s,t). exec(G,s) = Some t}^*" |
30 "G |- s -jvm-> t == (s,t) \<in> {(s,t). exec(G,s) = Some t}^*" |
33 |
31 |
34 |
32 |
35 syntax (xsymbols) |
33 syntax (xsymbols) |
36 exec_all :: "[jvm_prog,jvm_state,jvm_state] => bool" |
34 exec_all :: "[jvm_prog,jvm_state,jvm_state] => bool" |
40 The start configuration of the JVM: in the start heap, we call a |
38 The start configuration of the JVM: in the start heap, we call a |
41 method @{text m} of class @{text C} in program @{text G}. The |
39 method @{text m} of class @{text C} in program @{text G}. The |
42 @{text this} pointer of the frame is set to @{text Null} to simulate |
40 @{text this} pointer of the frame is set to @{text Null} to simulate |
43 a static method invokation. |
41 a static method invokation. |
44 *} |
42 *} |
45 constdefs |
43 definition start_state :: "jvm_prog \<Rightarrow> cname \<Rightarrow> mname \<Rightarrow> jvm_state" where |
46 start_state :: "jvm_prog \<Rightarrow> cname \<Rightarrow> mname \<Rightarrow> jvm_state" |
|
47 "start_state G C m \<equiv> |
44 "start_state G C m \<equiv> |
48 let (C',rT,mxs,mxl,i,et) = the (method (G,C) (m,[])) in |
45 let (C',rT,mxs,mxl,i,et) = the (method (G,C) (m,[])) in |
49 (None, start_heap G, [([], Null # replicate mxl undefined, C, (m,[]), 0)])" |
46 (None, start_heap G, [([], Null # replicate mxl undefined, C, (m,[]), 0)])" |
50 |
47 |
51 end |
48 end |