aboutsummaryrefslogtreecommitdiff
path: root/kernel/vmemitcodes.ml
diff options
context:
space:
mode:
authorcoqbot-app[bot]2020-09-24 07:38:19 +0000
committerGitHub2020-09-24 07:38:19 +0000
commit39fe24769d18c21379f1123754fd606cdf8cd4c8 (patch)
treef5e8387763e390780f3457ecedd8c054c2967ea6 /kernel/vmemitcodes.ml
parent8a149d0162e3f871f11f672dfca3a8d6265c225d (diff)
parent27695b52413f9fd6bcb60d77e0bdba538c16201f (diff)
Merge PR #12894: Modify bytecode representation of closures to please OCamls GC (fix #12636).
Reviewed-by: maximedenes Ack-by: bgregoir Ack-by: proux01
Diffstat (limited to 'kernel/vmemitcodes.ml')
-rw-r--r--kernel/vmemitcodes.ml16
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/vmemitcodes.ml b/kernel/vmemitcodes.ml
index 2dfc9a2941..f913cb906c 100644
--- a/kernel/vmemitcodes.ml
+++ b/kernel/vmemitcodes.ml
@@ -270,12 +270,12 @@ let emit_instr env = function
| Kacc n ->
if n < 8 then out env(opACC0 + n) else (out env opACC; out_int env n)
| Kenvacc n ->
- if n >= 1 && n <= 4
- then out env(opENVACC1 + n - 1)
+ if n >= 0 && n <= 3
+ then out env(opENVACC0 + n)
else (out env opENVACC; out_int env n)
| Koffsetclosure ofs ->
- if Int.equal ofs (-2) || Int.equal ofs 0 || Int.equal ofs 2
- then out env (opOFFSETCLOSURE0 + ofs / 2)
+ if Int.equal ofs 0 || Int.equal ofs 1
+ then out env (opOFFSETCLOSURE0 + ofs)
else (out env opOFFSETCLOSURE; out_int env ofs)
| Kpush ->
out env opPUSH
@@ -385,13 +385,13 @@ let rec emit env insns remaining = match insns with
if n < 8 then out env(opPUSHACC0 + n) else (out env opPUSHACC; out_int env n);
emit env c remaining
| Kpush :: Kenvacc n :: c ->
- if n >= 1 && n <= 4
- then out env(opPUSHENVACC1 + n - 1)
+ if n >= 0 && n <= 3
+ then out env(opPUSHENVACC0 + n)
else (out env opPUSHENVACC; out_int env n);
emit env c remaining
| Kpush :: Koffsetclosure ofs :: c ->
- if Int.equal ofs (-2) || Int.equal ofs 0 || Int.equal ofs 2
- then out env(opPUSHOFFSETCLOSURE0 + ofs / 2)
+ if Int.equal ofs 0 || Int.equal ofs 1
+ then out env(opPUSHOFFSETCLOSURE0 + ofs)
else (out env opPUSHOFFSETCLOSURE; out_int env ofs);
emit env c remaining
| Kpush :: Kgetglobal id :: c ->