| author | nipkow | 
| Mon, 27 Feb 2012 10:27:21 +0100 | |
| changeset 46699 | ae3f30a5063a | 
| parent 42463 | f270e3e18be5 | 
| child 58249 | 180f1b3508ed | 
| permissions | -rw-r--r-- | 
| 9376 | 1 | (* Title: HOL/MicroJava/JVM/JVMInstructions.thy | 
| 41589 | 2 | Author: Gerwin Klein, Technische Universitaet Muenchen | 
| 9376 | 3 | *) | 
| 4 | ||
| 12911 | 5 | header {* \isaheader{Instructions of the JVM} *}
 | 
| 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: 
9376diff
changeset | 10 | |
| 9376 | 11 | datatype | 
| 12519 | 12 | instr = Load nat -- "load from local variable" | 
| 13 | | Store nat -- "store into local variable" | |
| 14 | | LitPush val -- "push a literal (constant)" | |
| 15 | | New cname -- "create object" | |
| 16 | | Getfield vname cname -- "Fetch field from object" | |
| 17 | | Putfield vname cname -- "Set field in object " | |
| 18 | | Checkcast cname -- "Check whether object is of given type" | |
| 19 | | Invoke cname mname "(ty list)" -- "inv. instance meth of an object" | |
| 20 | | Return -- "return from method" | |
| 21 | | Pop -- "pop top element from opstack" | |
| 22 | | Dup -- "duplicate top element of opstack" | |
| 13676 | 23 | | Dup_x1 -- "duplicate top element and push 2 down" | 
| 24 | | Dup_x2 -- "duplicate top element and push 3 down" | |
| 12519 | 25 | | Swap -- "swap top and next to top element" | 
| 26 | | IAdd -- "integer addition" | |
| 27 | | Goto int -- "goto relative address" | |
| 28 | | Ifcmpeq int -- "branch if int/ref comparison succeeds" | |
| 29 | | Throw -- "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" | 
| 35 | -- "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" | 
| 13676 | 40 | -- "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 |