aboutsummaryrefslogtreecommitdiff
path: root/kernel/vmbytecodes.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2020-11-19 16:34:54 +0100
committerPierre-Marie Pédrot2020-11-19 16:34:54 +0100
commit3037172c80190b74b2c0f3017420cc871e74c996 (patch)
tree830f06071a1fc4fd3afaf2c8588645c6d55fb7b8 /kernel/vmbytecodes.ml
parent01dea073194bf788414af549cc2753917540e964 (diff)
parent9815b5947a5c02ba9189a447f5b58d5bb81e4f93 (diff)
Merge PR #12959: Improve the bytecode interpreter
Ack-by: ppedrot Reviewed-by: proux01
Diffstat (limited to 'kernel/vmbytecodes.ml')
-rw-r--r--kernel/vmbytecodes.ml13
1 files changed, 5 insertions, 8 deletions
diff --git a/kernel/vmbytecodes.ml b/kernel/vmbytecodes.ml
index c156a21c86..4977aec00a 100644
--- a/kernel/vmbytecodes.ml
+++ b/kernel/vmbytecodes.ml
@@ -56,13 +56,12 @@ type instruction =
| Kfield of int
| Ksetfield of int
| Kstop
- | Ksequence of bytecodes * bytecodes
+ | Ksequence of bytecodes
| Kproj of Projection.Repr.t
| Kensurestackcapacity of int
| Kbranch of Label.t (* jump to label *)
- | Kprim of CPrimitives.t * pconstant option
+ | Kprim of CPrimitives.t * pconstant
| Kcamlprim of CPrimitives.t * Label.t
- | Kareint of int
and bytecodes = instruction list
@@ -146,21 +145,19 @@ let rec pp_instr i =
| Kensurestackcapacity size -> str "growstack " ++ int size
| Kprim (op, id) -> str (CPrimitives.to_string op) ++ str " " ++
- (match id with Some (id,_u) -> Constant.print id | None -> str "")
+ (Constant.print (fst id))
| Kcamlprim (op, lbl) ->
str "camlcall " ++ str (CPrimitives.to_string op) ++ spc () ++
pp_lbl lbl
- | Kareint n -> str "areint " ++ int n
-
and pp_bytecodes c =
match c with
| [] -> str ""
| Klabel lbl :: c ->
str "L" ++ int lbl ++ str ":" ++ fnl () ++
pp_bytecodes c
- | Ksequence (l1, l2) :: c ->
- pp_bytecodes l1 ++ pp_bytecodes l2 ++ pp_bytecodes c
+ | Ksequence l :: c ->
+ pp_bytecodes l ++ pp_bytecodes c
| i :: c ->
pp_instr i ++ fnl () ++ pp_bytecodes c