The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SPVM - Static Perl Virtual Machine. Fast Calculation, Fast Array Operation, and Easy C/C++ Binding.

CAUTHION

SPVM is yet before 1.0 released. SPVM is changed without warnings. There will be quite a lot of changes until I feel enough good.

SYNOPSIS

SPVM Module:

  # lib/SPVM/MyMath.spvm
  class MyMath {
    static method sum : int ($nums : int[]) {

      my $total = 0;
      for (my $i = 0; $i < @$nums; $i++) {
        $total += $nums->[$i];
      }

      return $total;
    }
  }

Call SPVM method from Perl

  # spvm.pl
  use strict;
  use warnings;
  use FindBin;
  use lib "$FindBin::Bin/lib";

  use SPVM 'MyMath';

  # Call method
  my $total = SPVM::MyMath->sum([3, 6, 8, 9]);

  print "Total: $total\n";

  # Call method with packed data
  my $nums_packed = pack('l*', 3, 6, 8, 9);
  my $sv_nums = SPVM::new_int_array_from_bin($nums_packed);
  my $total_packed = SPVM::MyMath->sum($sv_nums);

  print "Total Packed: $total_packed\n";

Precompiled SPVM Method. This code is converted to C language and then converted to a shared library.

  # lib/SPVM/MyMath.spvm
  class MyMath : precompile {
    static method sum : int ($nums : int[]) {

      my $total = 0;
      for (my $i = 0; $i < @$nums; $i++) {
        $total += $nums->[$i];
      }

      return $total;
    }
  }

DESCRIPTION

SPVM is Static Perl Virtual Machine. SPVM is a programming language which has Perlish syntax. SPVM provides fast Calculation & easy C/C++ Binding.

FEATURES

  • Fast culcuration, Fast array operation

  • Precompile Method, Easy way to C/C++ binding, C99 math functions

  • Perlish syntax, Static typing, Type inference

  • Reference count GC, Weaken reference, Exception, Module

  • Object oriented programming

DOCUMENT

SPVM documents.

Tutorial

SPVM Tutorial.

Language Specification

SPVM Language Specification.

Standard Functions

SPVM Standard Functions

Standard Modules

SPVM Starndard Modules.

Performance Benchmark

SPVM Performance Benchmark.

Exchagne API

SPVM Exchange API is APIs which convert Perl data structures to SPVM data structures, and the reverse.

Native API

SPVM Native APIs is C APIs used in SPVM native method.

Generate Execution File

spvmcc is a compiler to compile SPVM source codes to a execution file. The execution file can be run by itself.

ENVIRONMENT VARIABLE

SPVM_BUILD_DIR

SPVM build directory for precompile and native method.

If SPVM_BUILD_DIR environment variable is not set, SPVM can't compile precompile method and native method, and a exception occur. You see error message "SPVM_BUILD_DIR environment variable must be set ...".

In bash, you can set SPVM_BUILD_DIR to the following.

  export SPVM_BUILD_DIR=~/.spvm_build

SPVM_CC_DEBUG

Print SVPM::Builder::CC compile and link outputs to stderr.

SPVM_CC_FORCE

Force SVPM::Builder::CC compile and link.

CAUTION

This release is beta release before SPVM 1.0. The features is changed without warnings.

REPOSITORY

SPVM - Github

BUG REPORT

GitHub Issue

SUPPORT

Github Discussions

AUTHOR

Yuki Kimoto <kimoto.yuki@gmail.com>

CORE DEVELOPERS

moti<motohiko.ave@gmail.com>

CONTRIBUTERS

  • Mohammad S Anwar

  • akinomyoga

  • NAGAYASU Shinya

  • Reini Urban

  • chromatic

  • Kazutake Hiramatsu

  • Yasuaki Omokawa

COPYRIGHT & LICENSE

Copyright 2018-2021 Yuki Kimoto, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.