SPVM - Static Perl Virtual Machine. Fast Calculation, Fast Array Operation, and Easy C/C++ Binding.
SPVM Module:
# lib/MyMath.spvm package MyMath { sub sum : int ($nums : int[]) { my $total = 0; for (my $i = 0; $i < @$nums; $i++) { $total += $nums->[$i]; } return $total; } }
Call SPVM subroutine from Perl
# spvm.pl use strict; use warnings; use FindBin; use lib "$FindBin::Bin/lib"; use SPVM 'MyMath'; # Call subroutine my $total = MyMath->sum([3, 6, 8, 9]); print "Total: $total\n"; # Call subroutine 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 = MyMath->sum($sv_nums); print "Total Packed: $total_packed\n";
Precompiled SPVM Subroutine. This code is converted to C language and then converted to a shared library.
# lib/MyMath.spvm package MyMath : precompile { sub sum : int ($nums : int[]) { my $total = 0; for (my $i = 0; $i < @$nums; $i++) { $total += $nums->[$i]; } return $total; } }
SPVM is Static Perl Virtual Machine. SPVM is a programming language which has Perlish syntax. SPVM provides fast Calculation & easy C/C++ Binding.
Fast culcuration, Fast array operation
Precompile Subroutine, 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
SPVM documents.
SPVM Tutorial.
SPVM::Document::Tutorial
SPVM Language Specification.
SPVM::Document::LanguageSpecification
SPVM Core Modules.
SPVM::Document::Modules
SPVM Performance Benchmark.
SPVM::Document::Benchmark
SPVM Exchange API is APIs which convert Perl data structures to SPVM data structures, and the reverse.
SPVM::Document::ExchangeAPI
SPVM Native APIs is C APIs used in SPVM native method.
SPVM::Document::NativeAPI
spvmcc is a compiler to compile SPVM source codes to a execution file. The execution file can be run by itself.
spvmcc
SPVM build directory for precompile and native subroutine.
If SPVM_BUILD_DIR environment variable is not set, SPVM can't compile precompile subroutine and native subroutine, 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
This release is beta release before SPVM 1.0. The features is changed without warnings.
SPVM - Github
GitHub Issue
Github Discussions
Yuki Kimoto <kimoto.yuki@gmail.com>
moti<motohiko.ave@gmail.com>
Mohammad S Anwar
akinomyoga
NAGAYASU Shinya
Reini Urban
chromatic
Kazutake Hiramatsu
Yasuaki Omokawa
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.
To install SPVM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SPVM
CPAN shell
perl -MCPAN -e shell install SPVM
For more information on module installation, please visit the detailed CPAN module installation guide.