summaryrefslogtreecommitdiff
path: root/asmcomp/i386
diff options
context:
space:
mode:
authorStephen Dolan <mu@netsoc.tcd.ie>2019-05-04 09:01:23 +0100
committerXavier Leroy <xavierleroy@users.noreply.github.com>2019-05-04 10:01:23 +0200
commitc24e5b5c8aff88a116ae543e06cf44a07e44949e (patch)
tree6f70671094d4c4c070894d42b250ff6f22961584 /asmcomp/i386
parentb818e2af91b4c2c0f52074a2bd1760dbb78073da (diff)
downloadocaml-c24e5b5c8aff88a116ae543e06cf44a07e44949e.tar.gz
Ensure that Gc.minor_words remains accurate after a GC (#8619)
If an allocation fails, the decrement of young_ptr should be undone before the GC is entered. This happened correctly on bytecode but not on native code. This commit (squash of pull request #8619) fixes it for all the platforms supported by ocamlopt. amd64: add alternate entry points caml_call_gc{1,2,3} for code size optimisation. powerpc: introduce one GC call point per allocation size per function. Each call point corrects the allocation pointer r31 before calling caml_call_gc. i386, arm, arm64, s390x: update the allocation pointer after the conditional branch to the GC, not before. arm64: simplify the code generator: Ialloc can assume that less than 0x1_0000 bytes are allocated, since the max allocation size for the minor heap is less than that. This is a partial cherry-pick of commit 8ceec on multicore.
Diffstat (limited to 'asmcomp/i386')
-rw-r--r--asmcomp/i386/emit.mlp2
1 files changed, 1 insertions, 1 deletions
diff --git a/asmcomp/i386/emit.mlp b/asmcomp/i386/emit.mlp
index 9f55cd293a..9262151343 100644
--- a/asmcomp/i386/emit.mlp
+++ b/asmcomp/i386/emit.mlp
@@ -600,11 +600,11 @@ let emit_instr fallthrough i =
def_label lbl_redo;
I.mov (sym32 "caml_young_ptr") eax;
I.sub (int n) eax;
- I.mov eax (sym32 "caml_young_ptr");
I.cmp (sym32 "caml_young_limit") eax;
let lbl_call_gc = new_label() in
let lbl_frame = record_frame_label i.live false Debuginfo.none in
I.jb (label lbl_call_gc);
+ I.mov eax (sym32 "caml_young_ptr");
I.lea (mem32 NONE 4 RAX) (reg i.res.(0));
call_gc_sites :=
{ gc_lbl = lbl_call_gc;