author | eberlm |
Wed, 25 May 2016 12:24:00 +0200 | |
changeset 63144 | 76130b7cc450 |
parent 62042 | 6c6ccf573479 |
child 67443 | 3abf6a722518 |
permissions | -rw-r--r-- |
9376 | 1 |
(* Title: HOL/MicroJava/JVM/JVMInstructions.thy |
41589 | 2 |
Author: Gerwin Klein, Technische Universitaet Muenchen |
9376 | 3 |
*) |
4 |
||
61361 | 5 |
section \<open>Instructions of the JVM\<close> |
10057 | 6 |
|
7 |
||
16417 | 8 |
theory JVMInstructions imports JVMState begin |
9376 | 9 |
|
9550
19a6d1289f5e
Invoke instruction gets fully qualified method name (class+name+sig) as
kleing
parents:
9376
diff
changeset
|
10 |
|
58310 | 11 |
datatype |
62042 | 12 |
instr = Load nat \<comment> "load from local variable" |
13 |
| Store nat \<comment> "store into local variable" |
|
14 |
| LitPush val \<comment> "push a literal (constant)" |
|
15 |
| New cname \<comment> "create object" |
|
16 |
| Getfield vname cname \<comment> "Fetch field from object" |
|
17 |
| Putfield vname cname \<comment> "Set field in object " |
|
18 |
| Checkcast cname \<comment> "Check whether object is of given type" |
|
19 |
| Invoke cname mname "(ty list)" \<comment> "inv. instance meth of an object" |
|
20 |
| Return \<comment> "return from method" |
|
21 |
| Pop \<comment> "pop top element from opstack" |
|
22 |
| Dup \<comment> "duplicate top element of opstack" |
|
23 |
| Dup_x1 \<comment> "duplicate top element and push 2 down" |
|
24 |
| Dup_x2 \<comment> "duplicate top element and push 3 down" |
|
25 |
| Swap \<comment> "swap top and next to top element" |
|
26 |
| IAdd \<comment> "integer addition" |
|
27 |
| Goto int \<comment> "goto relative address" |
|
28 |
| Ifcmpeq int \<comment> "branch if int/ref comparison succeeds" |
|
29 |
| Throw \<comment> "throw top of stack as exception" |
|
9376 | 30 |
|
42463 | 31 |
type_synonym |
9376 | 32 |
bytecode = "instr list" |
42463 | 33 |
type_synonym |
12519 | 34 |
exception_entry = "p_count \<times> p_count \<times> p_count \<times> cname" |
62042 | 35 |
\<comment> "start-pc, end-pc, handler-pc, exception type" |
42463 | 36 |
type_synonym |
12519 | 37 |
exception_table = "exception_entry list" |
42463 | 38 |
type_synonym |
12519 | 39 |
jvm_method = "nat \<times> nat \<times> bytecode \<times> exception_table" |
62042 | 40 |
\<comment> "max stacksize, size of register set, instruction sequence, handler table" |
42463 | 41 |
type_synonym |
12519 | 42 |
jvm_prog = "jvm_method prog" |
9376 | 43 |
|
44 |
end |