Skip to content

JIT Compilation: Fast: x86_64 (TD)

Pieter van Ginkel edited this page Jul 20, 2015 · 6 revisions

This page describes the implementation of the fast JIT compiler for the x84_64.

Calling convention

There are two types of calling conventions: for JIT generated methods and for interop methods.

JIT generated methods

The calling convention for JIT generated methods is as follows:

Input arguments

  • [0] globals: A pointer to the global data (see JIT Compilation (TD)),
  • [1] argc: The number of arguments provided to the function;
  • [2] args: A pointer to the arguments provided to the function with the following layout:
    • [0] return: Allocated space for the return value;
    • [1] this: The this value;
    • [2] function: The function being called;
    • [3..args + 3] arguments: The arguments to the function.

Result

The result of a function is a Boolean specifying whether the function completed successfully. If this is set to false, the exception in flight will be assigned to the global data.

Interop methods

Interop methods are methods that expose standard functionality like e.g. JsEnv::add. These methods wrap methods on JsEnv so that this functionality can be used in JIT generated methods.

These methods have the following calling convention:

Input arguments

  • [0] globals: A pointer to the global data (see JIT Compilation (TD)),
  • [1] argc: The number of arguments provided to the function;
  • [2] args: A pointer to the arguments provided to the function with the following layout:
    • [0..args] arguments: The arguments to the function.

Result

The first position of the args array is also used for the return value. This means that when argc is 0, the length of the args array is still one to accommodate the return value.

The result of a function is a Boolean specifying whether the function completed successfully. If this is set to false, the exception in flight will be assigned to the global data.

Clone this wiki locally