8011
|
1 |
(* Title: HOL/MicroJava/JVM/JVMState.thy
|
|
2 |
ID: $Id$
|
|
3 |
Author: Cornelia Pusch
|
|
4 |
Copyright 1999 Technische Universitaet Muenchen
|
|
5 |
*)
|
|
6 |
|
10057
|
7 |
|
|
8 |
header {* State of the JVM *}
|
8011
|
9 |
|
|
10 |
|
10057
|
11 |
theory JVMState = Store:
|
8011
|
12 |
|
10057
|
13 |
|
|
14 |
text {* frame stack :*}
|
8011
|
15 |
types
|
|
16 |
opstack = "val list"
|
|
17 |
locvars = "val list"
|
|
18 |
p_count = nat
|
|
19 |
|
10057
|
20 |
frame = "opstack \<times>
|
|
21 |
locvars \<times>
|
|
22 |
cname \<times>
|
|
23 |
sig \<times>
|
|
24 |
p_count"
|
8011
|
25 |
|
|
26 |
(* operand stack *)
|
|
27 |
(* local variables *)
|
|
28 |
(* name of def. class defined *)
|
|
29 |
(* meth name+param_desc *)
|
|
30 |
(* program counter within frame *)
|
|
31 |
|
|
32 |
|
10057
|
33 |
text {* exceptions: *}
|
8011
|
34 |
constdefs
|
10057
|
35 |
raise_xcpt :: "bool => xcpt => xcpt option"
|
|
36 |
"raise_xcpt c x == (if c then Some x else None)"
|
8011
|
37 |
|
|
38 |
|
10057
|
39 |
text {* runtime state: *}
|
|
40 |
types
|
|
41 |
jvm_state = "xcpt option \<times> aheap \<times> frame list"
|
8011
|
42 |
|
|
43 |
|
10057
|
44 |
text {* dynamic method lookup: *}
|
8011
|
45 |
constdefs
|
10057
|
46 |
dyn_class :: "'code prog \<times> sig \<times> cname => cname"
|
|
47 |
"dyn_class == \<lambda>(G,sig,C). fst(the(method(G,C) sig))"
|
|
48 |
|
8011
|
49 |
end
|