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

New ARM backend #5433

Closed
vicuna opened this issue Dec 18, 2011 · 4 comments
Closed

New ARM backend #5433

vicuna opened this issue Dec 18, 2011 · 4 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Dec 18, 2011

Original bug ID: 5433
Reporter: meurer
Assigned to: meurer
Status: closed (set by meurer on 2013-05-08T13:26:27Z)
Resolution: fixed
Priority: normal
Severity: major
Platform: ARM
OS: Linux
Version: 3.12.1
Fixed in version: 4.00.0+beta2/+rc1
Category: ~DO NOT USE (was: OCaml general)
Has duplicate: #5404
Monitored by: mehdi @glondu Camarade_Tux @hcarty

Bug description

The following is basically copy&paste from https://github.com/bmeurer/ocaml-arm/wiki:

This patch contains my work on a new ARM backend for the OCaml native code compiler, currently based on the 3.12.1 release. Compared to the old ARM backend, this one does the following:

  • Support for both software and hardware floating-point (VFPv3).
  • Properly supports interworking with Thumb/Thumb-2 code for both OCaml and C code.
  • Supports dynamic linking and large memory models.
  • Optional support for position-independent code via a command line option -fPIC. This is disabled by default and not required for natdynlink.
  • Can emit both ARM and Thumb-2 code, with avg. code size savings of 27% for Thumb-2 (quite close the optimal 30% advertised by ARM Ltd.).
  • Supports both AAPCS (armel) as well as extended VFP calling conventions (armhf).
  • Supports several special ARM instructions to reduce code size and latency.
  • Uses standard ARM EABI runtime functions instead of relying on GCC internals.
  • Supports exception backtraces.
  • Supports profiling using gprof.

See https://github.com/bmeurer/ocaml-arm/wiki for up-to-date information about the current state of the patch.

The latest patch is attached, but it's not necessarily the final patch. It's almost a complete rewrite of the ARM backend, so it will need some more testing.

File attachments

@vicuna
Copy link
Author

vicuna commented Dec 22, 2011

Comment author: meurer

Attached a new patch, which does no longer includes the config.guess/config.sub upgrade (see #5439 for that), therefore only half the size of the previous patch.

@vicuna
Copy link
Author

vicuna commented Jan 23, 2012

Comment author: @xavierleroy

I have a concern about Proc.destroyed_at_oper, case Iop(Iextcall(, true)): the result should really be all_phys_regs as in the original code. Indeed, an allocating extcall can raise a Caml exception, which will not reload any of the callee-save registers. Also, such an extcall can trigger a GC, and if GC roots are stored in callee-save regs across the Iextcall, the GC assumes that these callee-save regs have been saved in memory in a location pointed to by caml_gc_regs (cf. caml_call_gc in asmrun/.S). For both reasons, all Caml values live across a Iextcall(, true) must be stack-allocated, and this is achieved by saying that the Iextcall destroys all registers.

@vicuna
Copy link
Author

vicuna commented Jan 23, 2012

Comment author: meurer

Ok, makes sense. It's fixed in ocaml-arm:

bmeurer/ocaml-arm@7658da0

@vicuna
Copy link
Author

vicuna commented Feb 4, 2012

Comment author: meurer

I just merged the latest commit ec5b444c7f of my development repository at https://github.com/bmeurer/ocaml-arm/tree/ec5b444c7f into trunk with revision 12124.

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

No branches or pull requests

1 participant