Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 663037 Details for
Bug 877128
Ocaml tries to allocate a ridiculous amount of memory
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
ocaml r12907
ocaml-12907.patch (text/plain), 7.16 KB, created by
Richard W.M. Jones
on 2012-12-13 16:11:26 UTC
(
hide
)
Description:
ocaml r12907
Filename:
MIME Type:
Creator:
Richard W.M. Jones
Created:
2012-12-13 16:11:26 UTC
Size:
7.16 KB
patch
obsolete
>From b74594c13561d411c563051d5ae5195a27d39110 Mon Sep 17 00:00:00 2001 >From: Xavier Leroy <Xavier.Leroy@inria.fr> >Date: Thu, 13 Dec 2012 16:06:55 +0000 >Subject: [PATCH] Backport OCaml r12907 from upstream. Possible fix for: Ocaml > tries to allocate a ridiculous amount of memory (RHBZ#877128) > >--- > Changes | 2 ++ > asmcomp/amd64/emit.mlp | 15 +++++++-------- > asmcomp/amd64/emit_nt.mlp | 6 +++--- > asmcomp/amd64/proc.ml | 21 ++++++++++++--------- > asmrun/amd64.S | 12 ++++++------ > asmrun/amd64nt.asm | 12 ++++++------ > 6 files changed, 36 insertions(+), 32 deletions(-) > >diff --git a/Changes b/Changes >index 3f87623..b4301d6 100644 >--- a/Changes >+++ b/Changes >@@ -100,6 +100,8 @@ Installation procedure: > (-runtime-variant) to select the debug runtime. > > Bug Fixes: >+- PR#5707: AMD64 code generator: do not use r10 and r11 for parameter passing, >+ as these registers can be destroyed by the dynamic loader > - PR#1643: functions of the Lazy module whose named started with 'lazy_' have > been deprecated, and new ones without the prefix added > - PR#3571: in Bigarrays, call msync() before unmapping to commit changes >diff --git a/asmcomp/amd64/emit.mlp b/asmcomp/amd64/emit.mlp >index 47f652d..071eb05 100644 >--- a/asmcomp/amd64/emit.mlp >+++ b/asmcomp/amd64/emit.mlp >@@ -110,13 +110,13 @@ let emit_reg = function > > let reg_low_8_name = > [| "%al"; "%bl"; "%dil"; "%sil"; "%dl"; "%cl"; "%r8b"; "%r9b"; >- "%r10b"; "%r11b"; "%bpl"; "%r12b"; "%r13b" |] >+ "%r12b"; "%r13b"; "%bpl"; "%r10b"; "%r11b" |] > let reg_low_16_name = > [| "%ax"; "%bx"; "%di"; "%si"; "%dx"; "%cx"; "%r8w"; "%r9w"; >- "%r10w"; "%r11w"; "%bp"; "%r12w"; "%r13w" |] >+ "%r12w"; "%r13w"; "%bp"; "%r10w"; "%r11w" |] > let reg_low_32_name = > [| "%eax"; "%ebx"; "%edi"; "%esi"; "%edx"; "%ecx"; "%r8d"; "%r9d"; >- "%r10d"; "%r11d"; "%ebp"; "%r12d"; "%r13d" |] >+ "%r12d"; "%r13d"; "%ebp"; "%r10d"; "%r11d" |] > > let emit_subreg tbl r = > match r.loc with >@@ -670,14 +670,13 @@ let emit_profile () = > match Config.system with > | "linux" | "gnu" -> > (* mcount preserves rax, rcx, rdx, rsi, rdi, r8, r9 explicitly >- and rbx, rbp, r12-r15 like all C functions. >- We need to preserve r10 and r11 ourselves, since OCaml can >- use them for argument passing. *) >+ and rbx, rbp, r12-r15 like all C functions. This includes >+ all the registers used for argument passing, so we don't >+ need to preserve other regs. We do need to initialize rbp >+ like mcount expects it, though. *) > ` pushq %r10\n`; > ` movq %rsp, %rbp\n`; >- ` pushq %r11\n`; > ` {emit_call "mcount"}\n`; >- ` popq %r11\n`; > ` popq %r10\n` > | _ -> > () (*unsupported yet*) >diff --git a/asmcomp/amd64/emit_nt.mlp b/asmcomp/amd64/emit_nt.mlp >index 48646b7..fb81b81 100644 >--- a/asmcomp/amd64/emit_nt.mlp >+++ b/asmcomp/amd64/emit_nt.mlp >@@ -110,13 +110,13 @@ let emit_reg = function > > let reg_low_8_name = > [| "al"; "bl"; "dil"; "sil"; "dl"; "cl"; "r8b"; "r9b"; >- "r10b"; "r11b"; "bpl"; "r12b"; "r13b" |] >+ "r12b"; "r13b"; "bpl"; "r10b"; "r11b" |] > let reg_low_16_name = > [| "ax"; "bx"; "di"; "si"; "dx"; "cx"; "r8w"; "r9w"; >- "r10w"; "r11w"; "bp"; "r12w"; "r13w" |] >+ "r12w"; "r13w"; "bp"; "r10w"; "r11w" |] > let reg_low_32_name = > [| "eax"; "ebx"; "edi"; "esi"; "edx"; "ecx"; "r8d"; "r9d"; >- "r10d"; "r11d"; "ebp"; "r12d"; "r13d" |] >+ "r12d"; "r13d"; "ebp"; "r10d"; "r11d" |] > > let emit_subreg tbl pref r = > match r.loc with >diff --git a/asmcomp/amd64/proc.ml b/asmcomp/amd64/proc.ml >index d308213..5383421 100644 >--- a/asmcomp/amd64/proc.ml >+++ b/asmcomp/amd64/proc.ml >@@ -45,18 +45,18 @@ let masm = > rcx 5 > r8 6 > r9 7 >- r10 8 >- r11 9 >+ r12 8 >+ r13 9 > rbp 10 >- r12 11 >- r13 12 >+ r10 11 >+ r11 12 > r14 trap pointer > r15 allocation pointer > > xmm0 - xmm15 100 - 115 *) > > (* Conventions: >- rax - r11: OCaml function arguments >+ rax - r13: OCaml function arguments > rax: OCaml and C function results > xmm0 - xmm9: OCaml function arguments > xmm0: OCaml and C function results >@@ -70,16 +70,19 @@ let masm = > xmm0 - xmm3: C function arguments > rbx, rbp, rsi, rdi r12-r15 are preserved by C > xmm6-xmm15 are preserved by C >+ Note (PR#5707): r11 should not be used for parameter passing, as it >+ can be destroyed by the dynamic loader according to SVR4 ABI. >+ Linux's dynamic loader also destroys r10. > *) > > let int_reg_name = > match Config.ccomp_type with > | "msvc" -> > [| "rax"; "rbx"; "rdi"; "rsi"; "rdx"; "rcx"; "r8"; "r9"; >- "r10"; "r11"; "rbp"; "r12"; "r13" |] >+ "r12"; "r13"; "rbp"; "r10"; "r11" |] > | _ -> > [| "%rax"; "%rbx"; "%rdi"; "%rsi"; "%rdx"; "%rcx"; "%r8"; "%r9"; >- "%r10"; "%r11"; "%rbp"; "%r12"; "%r13" |] >+ "%r12"; "%r13"; "%rbp"; "%r10"; "%r11" |] > > let float_reg_name = > match Config.ccomp_type with >@@ -241,12 +244,12 @@ let destroyed_at_c_call = > if win64 then > (* Win64: rbx, rbp, rsi, rdi, r12-r15, xmm6-xmm15 preserved *) > Array.of_list(List.map phys_reg >- [0;4;5;6;7;8;9; >+ [0;4;5;6;7;11;12; > 100;101;102;103;104;105]) > else > (* Unix: rbp, rbx, r12-r15 preserved *) > Array.of_list(List.map phys_reg >- [0;2;3;4;5;6;7;8;9; >+ [0;2;3;4;5;6;7;11;12; > 100;101;102;103;104;105;106;107; > 108;109;110;111;112;113;114;115]) > >diff --git a/asmrun/amd64.S b/asmrun/amd64.S >index fd26e19..64c69f4 100644 >--- a/asmrun/amd64.S >+++ b/asmrun/amd64.S >@@ -249,11 +249,11 @@ LBL(caml_call_gc): > addq $32768, %rsp > #endif > /* Build array of registers, save it into caml_gc_regs */ >- pushq %r13 >- pushq %r12 >- pushq %rbp > pushq %r11 > pushq %r10 >+ pushq %rbp >+ pushq %r13 >+ pushq %r12 > pushq %r9 > pushq %r8 > pushq %rcx >@@ -318,11 +318,11 @@ LBL(caml_call_gc): > popq %rcx > popq %r8 > popq %r9 >- popq %r10 >- popq %r11 >- popq %rbp > popq %r12 > popq %r13 >+ popq %rbp >+ popq %r10 >+ popq %r11 > CFI_ADJUST(-232) > /* Return to caller */ > ret >diff --git a/asmrun/amd64nt.asm b/asmrun/amd64nt.asm >index 76a4732..09d82db 100644 >--- a/asmrun/amd64nt.asm >+++ b/asmrun/amd64nt.asm >@@ -51,11 +51,11 @@ L105: > mov caml_young_ptr, r15 > mov caml_exception_pointer, r14 > ; Build array of registers, save it into caml_gc_regs >- push r13 >- push r12 >- push rbp > push r11 > push r10 >+ push rbp >+ push r13 >+ push r12 > push r9 > push r8 > push rcx >@@ -113,11 +113,11 @@ L105: > pop rcx > pop r8 > pop r9 >- pop r10 >- pop r11 >- pop rbp > pop r12 > pop r13 >+ pop rbp >+ pop r10 >+ pop r11 > ; Restore caml_young_ptr, caml_exception_pointer > mov r15, caml_young_ptr > mov r14, caml_exception_pointer >-- >1.8.0.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 877128
:
645910
|
645911
|
656039
| 663037