Skip to content

Commit

Permalink
Introduce a new execution engine and IR using atomic instructions
Browse files Browse the repository at this point in the history
This commit changes the internal intermediate representation used to run Pine programs, introducing a new compiler for that IR and a corresponding execution engine.
One immediate benefit was an improvement in runtime efficiency: In workloads parsing Elm module syntax, I saw a more than 30 percent reduction in response times for larger files.
Another benefit is improved performance profiling. The count of instructions performed is now a better proxy for runtime expenses than the previous interpreter, where each instruction could contain a subexpression tree of arbitrary size.
This switch to an IR with flat/atomic instructions makes it easier to further compile to IRs like WebAssembly or .NET CIL.
  • Loading branch information
Viir committed Jan 3, 2025
1 parent 6b938dc commit 93bdf60
Show file tree
Hide file tree
Showing 8 changed files with 2,222 additions and 673 deletions.
15 changes: 9 additions & 6 deletions implement/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,27 @@ Expand the Elm compiler and core libraries to support `Float` literals and `Stri
+ Added a framework to integrate the various interfaces we want to use in command-line interface applications (`Platform.CommandLineApp`), including stdIn/stdOut/stdErr streams and environment variables.
+ Introduced the `pine run` command as a common way to run an app.

## 2024-10-26 - Added VSCode Extension and Language Server
## 2024-10-26 - Added VS Code Extension and Language Server

Published the first version of the Elm developer tools VSCode extension, with a command to format Elm modules.
Published the first version of the Elm developer tools VS Code extension, with a command to format Elm modules.

## 2024-12-08 - Expanded VSCode Extension and Language Server
## 2024-12-08 - Expanded VS Code Extension and Language Server

+ Added feature: Completions: Shows completion suggestions matching the current context
+ Added feature: Hover tips: Shows type annotations and documentation for a type alias, module, custom type or function

## 2024-12-15 - Expanded VSCode Extension and Language Server
## 2024-12-15 - Expanded VS Code Extension and Language Server

+ Added feature: 'Go to Definition'

## 2024-12-19 - Expanded VSCode Extension and Language Server
## 2024-12-19 - Expanded VS Code Extension and Language Server

+ Added feature: 'Find All References'

## 2024-12-22 - Expanded VSCode Extension and Language Server
## 2024-12-22 - Expanded VS Code Extension and Language Server

+ Added feature: 'Rename Symbol'

## 2025-01-03 - Introduced New Execution Engine And IR

+ Changed the internal intermediate representation used to run Pine programs, introducing a new compiler for that IR and a corresponding execution engine.
14 changes: 14 additions & 0 deletions implement/Pine.Core/KernelFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,13 @@ public static PineValue bit_shift_left(PineValue value)
return PineValue.EmptyList;
}

return bit_shift_left(shiftCount, blobValue);
}

public static PineValue bit_shift_left(
BigInteger shiftCount,
PineValue.BlobValue blobValue)
{
var offsetBytes = (int)(shiftCount / 8);
var offsetBits = (int)(shiftCount % 8);

Expand Down Expand Up @@ -669,6 +676,13 @@ public static PineValue bit_shift_right(PineValue value)
return PineValue.EmptyList;
}

return bit_shift_right(shiftCount, blobValue);
}

public static PineValue bit_shift_right(
BigInteger shiftCount,
PineValue.BlobValue blobValue)
{
var offsetBytes = (int)(shiftCount / 8);
var offsetBits = (int)(shiftCount % 8);

Expand Down
Loading

0 comments on commit 93bdf60

Please sign in to comment.