Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000770OCaml~DO NOT USE (was: OCaml general)public2002-01-02 22:412017-11-05 18:40
Reporteradministrator 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000770: Out of range jumps on PowerPC Linux
DescriptionFull_Name: Mark Brown
Version: 3.04
OS: Debian GNU/Linux unstable
Submission from: 62.31.64.2 (62.31.64.2)


ocaml currently fails to build on PowerPC. The failing portion of
output is:

make[3]: Entering directory `/tmp/ocaml/ocaml-3.04/camlp4/meta'
../../boot/ocamlrun ../boot/camlp4r -nolib -I ../boot pa_extend.cmo
q_MLast.cmo -o pa_r.ppo pa_r.ml
../../boot/ocamlrun ../../ocamlopt -I ../../stdlib -I ../camlp4 -I
../boot -I ../../utils -c -impl pa_r.ppo
/tmp/camlasm0.s: Assembler messages:
/tmp/camlasm0.s:26869: Error: operand out of range (54196 not between
-32768 and 32767)
/tmp/camlasm0.s:27246: Error: operand out of range (52688 not between
-32768 and 32767)

and so on. Looking at the assembler output the failures appear to be
branch instructions attempting to call into what looks like a garbage
collector:

| .L1145: bltl .L1144

...

| .L1144:
| b caml_call_gc
| .section ".text"
| .globl Pa_r_code_end
| .type Pa_r_code_end, @object

Grovelling around in asmcomp/power it appears that the only place where
a bltl is emitted is:

| | Lop(Ialloc n) ->
| if !call_gc_label = 0 then call_gc_label := new_label();
| ` addi {emit_gpr 31}, {emit_gpr 31}, {emit_int(-n)}\n`;
| ` cmplw {emit_gpr 31}, {emit_gpr 30}\n`;
| ` addi {emit_reg i.res.(0)}, {emit_gpr 31}, 4\n`;
| record_frame i.live;
| ` bltl {emit_label !call_gc_label}\n`

The compiler either needs to be smarter about how it branches into the
GC routine (perhaps inserting the hooks at a higher level) or it needs
to assume that call_gc_label will be out of the range of a conditional jump.
This patch (hopefully) takes the latter approach:

--- ocaml-3.04/asmcomp/power/emit.mlp.orig Tue Jan 1 19:40:55 2002
+++ ocaml-3.04/asmcomp/power/emit.mlp Tue Jan 1 19:40:19 2002
@@ -545,12 +545,15 @@
           | _ -> "stw" in
         emit_load_store storeinstr addr i.arg 1 i.arg.(0)
     | Lop(Ialloc n) ->
+ let skip_label = new_label() in
         if !call_gc_label = 0 then call_gc_label := new_label();
         ` addi {emit_gpr 31}, {emit_gpr 31}, {emit_int(-n)}\n`;
         ` cmplw {emit_gpr 31}, {emit_gpr 30}\n`;
         ` addi {emit_reg i.res.(0)}, {emit_gpr 31}, 4\n`;
+ ` bgt {emit_label skip_label}\n`;
         record_frame i.live;
- ` bltl {emit_label !call_gc_label}\n`
+ ` bl {emit_label !call_gc_label}\n`;
+ `{emit_label skip_label}:\n`;
     | Lop(Iintop Isub) -> (* subf has swapped arguments *)
         (* Use subfc instead of subf for RS6000 compatibility. *)
         ` subfc {emit_reg i.res.(0)}, {emit_reg i.arg.(1)}, {emit_reg
i.
arg.(0)}\n`

TagsNo tags attached.
Attached Files

- Relationships
related to 0007667acknowledged Out of range jumps to caml_call_gc labels 

-  Notes
(0000791)
administrator (administrator)
2002-01-04 14:27

Same bug as PR#723

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)
2017-11-05 18:40 xleroy Relationship added related to 0007667


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker