Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deltas in frametables #6487

Closed
vicuna opened this issue Oct 19, 2002 · 1 comment
Closed

Deltas in frametables #6487

vicuna opened this issue Oct 19, 2002 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Oct 19, 2002

Original bug ID: 1444
Reporter: administrator
Status: closed (set by @mshinwell on 2016-12-07T13:58:29Z)
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Tags: patch
Monitored by: jm

Bug description

Full_Name: Vassili Karpov
Version: 3.06
OS: Linux/Windows
Submission from: cache1-kh.comex.ru (217.10.35.250)

Size of object files and libraries can be slightly reduced
by using deltas(instead of offsets) in frametables, linking
time will also be reduced (less relocations to consider).
Following small patch implements this for i386:

diff -ur ocaml/asmcomp/i386/emit.mlp work/asmcomp/i386/emit.mlp
--- ocaml/asmcomp/i386/emit.mlp Mon Jul 22 20:37:50 2002
+++ work/asmcomp/i386/emit.mlp Sat Oct 19 19:07:48 2002
@@ -178,7 +178,7 @@
let lbl = record_frame_label live in {emit_label lbl}:\n

let emit_frame fd =

  • .long {emit_label fd.fd_lbl}\n;
  • .long {emit_label fd.fd_lbl} - bias\n;
    {emit_string word_dir} {emit_int fd.fd_frame_size}\n;
    {emit_string word_dir} {emit_int (List.length fd.fd_live_offset)}\n;
    List.iter
    @@ -812,6 +812,7 @@
    {emit_symbol lbl_begin}:\n;
    let lbl_begin = Compilenv.current_unit_name() ^ "__code_begin" in
    .text\n;
  • bias={emit_symbol lbl_begin}\n;
    .globl {emit_symbol lbl_begin}\n;
    {emit_symbol lbl_begin}:\n

@@ -826,6 +827,7 @@
{emit_symbol lbl_end}:\n;
.long 0\n;
let lbl = Compilenv.current_unit_name() ^ "__frametable" in

  • .data 1\n;
    .globl {emit_symbol lbl}\n;
    {emit_symbol lbl}:\n;
    .long {emit_int (List.length !frame_descriptors)}\n;
    diff -ur ocaml/asmcomp/i386/emit_nt.mlp work/asmcomp/i386/emit_nt.mlp
    --- ocaml/asmcomp/i386/emit_nt.mlp Fri Feb 8 19:55:31 2002
    +++ work/asmcomp/i386/emit_nt.mlp Sat Oct 19 19:27:17 2002
    @@ -161,7 +161,7 @@
    let lbl = record_frame_label live in {emit_label lbl}:\n

let emit_frame fd =

  • DWORD {emit_label fd.fd_lbl}\n;
  • DWORD {emit_label fd.fd_lbl} - bias\n;
    WORD {emit_int fd.fd_frame_size}\n;
    WORD {emit_int (List.length fd.fd_live_offset)}\n;
    List.iter
    @@ -797,7 +797,8 @@
    let lbl_begin = Compilenv.current_unit_name() ^ "__code_begin" in
    add_def_symbol lbl_begin;
    PUBLIC {emit_symbol lbl_begin}\n;
  • {emit_symbol lbl_begin} LABEL DWORD\n
  • {emit_symbol lbl_begin} LABEL DWORD\n;
  • bias LABEL DWORD\n

let end_assembly() =
.CODE\n;
diff -ur ocaml/asmrun/roots.c work/asmrun/roots.c
--- ocaml/asmrun/roots.c Mon Jan 21 01:20:51 2002
+++ work/asmrun/roots.c Sat Oct 19 19:12:10 2002
@@ -46,12 +46,16 @@
#define Hash_retaddr(addr)
(((unsigned long)(addr) >> 3) & frame_descriptors_mask)

+struct segment { char * begin; char * end; };
+
static void init_frame_descriptors(void)
{

  • extern struct segment caml_code_segments[];
    long num_descr, tblsize, i, j, len;
    long * tbl;
    frame_descr * d;
  • unsigned long h;
  • unsigned long h, bias;

  • struct segment *seg = caml_code_segments;

    /* Count the frame descriptors */
    num_descr = 0;
    @@ -73,8 +77,13 @@
    for (i = 0; caml_frametable[i] != 0; i++) {
    tbl = caml_frametable[i];
    len = *tbl;

  • if (i != 1) {

  •  bias = (unsigned long)seg->begin;
    
  •  seg++;
    
  • } else bias = 0;
    d = (frame_descr *)(tbl + 1);
    for (j = 0; j < len; j++) {

  •  d->retaddr += bias;
     h = Hash_retaddr(d->retaddr);
     while (frame_descriptors[h] != NULL) {
       h = (h+1) & frame_descriptors_mask;
    
@vicuna
Copy link
Author

vicuna commented Dec 7, 2016

Comment author: @mshinwell

This is very old, and I think unlikely to be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant