The Linux 64 bit Implementation - bobjervis/parasol GitHub Wiki

Overview

The Linux 64-bit implementation supports running Parasol programs on Linux with an Intel x86-64 compatible instruction set. This version has been tested on Ubuntu Linux, but other versions of 64-bit Linux will probably work.

Starting a Parasol Program

You must either name the bin directory under the folder where you installed from https://github.com/bobjervis/parasol/tree/master when running the command, or put the bin directory in your path. Running pc will launch the runtime. The form of the command line is:

pcoptions main-file program-options

If you type the command-line:

pc --help

The command will print a help page describing each of the command-line options.

The program-options are passed to any appropriate main function in the main file.

The Parasol Runtime

Multi-Platform Support

It is a goal of this runtime design to target the 64-bit Intel architecture primarily.
Nevertheless, attention is paid to designing language features and the runtime itself to make porting to different environments feasible.

Memory Layout

The language provides a variety of ways to define static data storage:

  • String literals
  • Vtables
  • Static variables
  • Code

In order to avoid wasting much static storage, static variables are grouped according to the memory alignment they require.
Thus, a byte variable will be placed alongside other byte variables, while int and unsigned variables are similarly grouped.
Note that string literals are stored with an int length, so they are aligned with each other on int boundaries, so a few gaps appear in string literal storage. Similarly, functions are stored with a null address preceding the first instruction of the function. This null value is used during a delete operation to discirminate between simple functions and closures.

Memory is arranged as follows:

  1. code,
  2. exception tables
  3. built-in addresses (static abstract function references + native binding vectors),
  4. vtables,
  5. run-time type information (reflection data)
  6. 8-aligned static variables,
  7. literals (string, vector, long),
  8. 4-aligned static variables,
  9. 2-aligned static variables,
  10. 1-aligned static variables

The code generator works by packing functions and thunks into the code array as it finishes the generation of each function. It isn't possible, then, to know the offsets of the various literals and variables when the code is packed in. During code generation, a list of fixups is maintained. For example, each string literal referenced in code will use a 32-bit ip-relative address mode containing the offset to the string literal itself. The offset must be computed once the full memory layout has been fixed.

Once the ip-relative offsets are resolved, any remaining absolute addresses in the image are then stored as fixups in the PXI file.

⚠️ **GitHub.com Fallback** ⚠️