summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asmcomp/alpha/emit.mlp16
-rw-r--r--asmcomp/alpha/proc.ml10
-rw-r--r--asmrun/alpha.S29
3 files changed, 15 insertions, 40 deletions
diff --git a/asmcomp/alpha/emit.mlp b/asmcomp/alpha/emit.mlp
index 4bcd092b5..1b163098e 100644
--- a/asmcomp/alpha/emit.mlp
+++ b/asmcomp/alpha/emit.mlp
@@ -429,8 +429,8 @@ let emit_instr i =
end
| Lop(Iextcall(s, alloc)) ->
if alloc then begin
- ` lda $27, {emit_symbol s}\n`;
- liveregs i live_27;
+ ` lda $25, {emit_symbol s}\n`;
+ liveregs i live_25;
`{record_frame i.live} bsr $26, caml_c_call\n`
end else begin
` jsr {emit_symbol s}\n`
@@ -674,17 +674,6 @@ let emit_instr i =
let rec emit_all i =
match i.desc with Lend -> () | _ -> emit_instr i; emit_all i.next
-(* Emission of profiling prelude *)
-
-let emit_profile() =
- match Config.system with
- "digital" ->
- ` nop\n`;
- ` unop\n`;
- ` nop\n`;
- ` unop\n`
- | _ -> () (*not supported yet*)
-
(* Emission of a function declaration *)
let emit_fundecl (fundecl, needs_gp) =
@@ -699,7 +688,6 @@ let emit_fundecl (fundecl, needs_gp) =
` .align 4\n`;
` .globl {emit_symbol fundecl.fun_name}\n`;
` .ent {emit_symbol fundecl.fun_name}\n`;
- if !Clflags.gprofile then emit_profile();
`{emit_symbol fundecl.fun_name}:\n`;
let n = frame_size() in
if n > 0 then
diff --git a/asmcomp/alpha/proc.ml b/asmcomp/alpha/proc.ml
index f2e88177b..4d91140e7 100644
--- a/asmcomp/alpha/proc.ml
+++ b/asmcomp/alpha/proc.ml
@@ -204,11 +204,11 @@ let contains_calls = ref false
(* Calling the assembler *)
-let as_cmd =
- if digital_asm
- then "as -O2 -nocpp -o "
- else "as -o "
-
let assemble_file infile outfile =
+ let as_cmd =
+ if digital_asm
+ then if !Clflags.gprofile then "as -O2 -nocpp -pg -o "
+ else "as -O2 -nocpp -o "
+ else "as -o " in
Ccomp.command (as_cmd ^ outfile ^ " " ^ infile)
diff --git a/asmrun/alpha.S b/asmrun/alpha.S
index 821f8ee74..da77eba5d 100644
--- a/asmrun/alpha.S
+++ b/asmrun/alpha.S
@@ -13,12 +13,6 @@
/* Asm part of the runtime system, Alpha processor */
-#if defined(PROFILING) && defined(SYS_digital)
-#define PROFILE nop; unop; nop; unop
-#else
-#define PROFILE
-#endif
-
/* Allocation */
.text
@@ -27,13 +21,15 @@
.globl caml_alloc
.globl caml_call_gc
+/* Note: the profiling code sets $27 to the address of the "normal" entrypoint.
+ So don't pass parameters to those routines in $27. */
+
/* caml_alloc* : all code generator registers preserved,
$gp preserved, $27 not necessarily valid on entry */
.globl caml_alloc1
.ent caml_alloc1
.align 3
- PROFILE
caml_alloc1:
.prologue 0
subq $13, 16, $13
@@ -47,7 +43,6 @@ $100: ldiq $25, 16
.globl caml_alloc2
.ent caml_alloc2
.align 3
- PROFILE
caml_alloc2:
.prologue 0
subq $13, 24, $13
@@ -61,7 +56,6 @@ $101: ldiq $25, 24
.globl caml_alloc3
.ent caml_alloc3
.align 3
- PROFILE
caml_alloc3:
.prologue 0
subq $13, 32, $13
@@ -75,7 +69,6 @@ $102: ldiq $25, 32
.globl caml_alloc
.ent caml_alloc
.align 3
- PROFILE
caml_alloc:
.prologue 0
subq $13, $25, $13
@@ -89,7 +82,6 @@ caml_alloc:
.globl caml_call_gc
.ent caml_call_gc
.align 3
- PROFILE
caml_call_gc:
.prologue 0
ldiq $25, 0
@@ -219,20 +211,19 @@ $103: ldgp $gp, 0($27)
.end caml_call_gc
/* Call a C function from Caml */
-/* Function to call is in $27 */
+/* Function to call is in $25 */
.globl caml_c_call
.ent caml_c_call
.align 3
- PROFILE
caml_c_call:
.prologue 0
/* Preserve return address and caller's $gp in callee-save registers */
mov $26, $9
mov $gp, $10
/* Rebuild $gp */
- br $25, $104
-$104: ldgp $gp, 0($25)
+ br $27, $104
+$104: ldgp $gp, 0($27)
/* Record lowest stack address and return address */
lda $11, caml_last_return_address
stq $26, 0($11)
@@ -243,7 +234,8 @@ $104: ldgp $gp, 0($25)
lda $14, young_limit
stq $15, caml_exception_pointer
/* Call the function */
- jsr ($27)
+ mov $25, $27
+ jsr ($25)
/* Reload alloc ptr and alloc limit */
ldq $13, 0($12) /* $12 still points to young_ptr */
ldq $14, 0($14) /* $14 still points to young_limit */
@@ -261,7 +253,6 @@ $104: ldgp $gp, 0($25)
.globl caml_start_program
.ent caml_start_program
.align 3
- PROFILE
caml_start_program:
ldgp $gp, 0($27)
lda $25, caml_program
@@ -372,7 +363,6 @@ $109: ldgp $gp, 0($26)
.globl raise_caml_exception
.ent raise_caml_exception
.align 3
- PROFILE
raise_caml_exception:
ldgp $gp, 0($27)
mov $16, $0 /* Move exn bucket */
@@ -391,7 +381,6 @@ raise_caml_exception:
.globl callback
.ent callback
.align 3
- PROFILE
callback:
/* Initial shuffling of arguments */
ldgp $gp, 0($27)
@@ -405,7 +394,6 @@ callback:
.globl callback2
.ent callback2
.align 3
- PROFILE
callback2:
ldgp $gp, 0($27)
mov $16, $25
@@ -419,7 +407,6 @@ callback2:
.globl callback3
.ent callback3
.align 3
- PROFILE
callback3:
ldgp $gp, 0($27)
mov $16, $25