NAME
SPVM - Static Perl Virtual Machine. Fast Calculation, Fast Array Operation, and Easy C/C++ Binding.
CAUTHION
SPVM is not yet 1.0. Please note SPVM can change without warnings. There can be a lot of changes until I feel good enough.
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 a Static Perl Virtual Machine. SPVM is a programming language which has Perlish syntax. SPVM provides fast calculation & easy C/C++ Binding.
FEATURES
Fast calculation, 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 Standard Modules.
Performance Benchmark
SPVM Performance Benchmark.
Exchange API
SPVM Exchange API converts Perl data structures to SPVM data structures, and vice versa.
Native API
SPVM Native API is C API 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.
Generate SPVM Native Modules
spvmgenlib is the command to generate SPVM native modules.
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 ...".
bash:
In bash, you can set SPVM_BUILD_DIR to the following.
export SPVM_BUILD_DIR=~/.spvm_build
csh:
In csh, you can set SPVM_BUILD_DIR to the following.
setenv 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 a beta release before SPVM 1.0. The features can change without notice. Use at your own risk.
REPOSITORY
BUG REPORT
SUPPORT
AUTHOR
Yuki Kimoto <kimoto.yuki@gmail.com>
CORE DEVELOPERS
moti<motohiko.ave@gmail.com>
CONTRIBUTORS
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.