SPVM is now 6x faster than Perl 5.26. SPVM have the features of Fast calculation, GC, static typing, VM with perlish syntax
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
script
solo
spvm_build
t
yacc
.gitignore
Changes
MANIFEST
MANIFEST.SKIP
Makefile.PL
README
SPVM.xs
ppport.h

README

SPVM

  Provide Fast Calculation and Easy C/C++ Binding with perlish syntax and static typing to Perl
  
  See SPVM document
  
  https://metacpan.org/pod/SPVM

DEVELOPERS NOTE
  
  TESTS
    
    Do tests
    
      perl Makefile.PL
      make
      make test
    
    Cleanup
    
      make clean
      
    Create distribution
      
      perl Makefile.PL
      rm MANIFEST
      make manifest
      make disttest
      make dist

  SOLE TESTS
  
    SPVM solo test command

       # Normal run
       yacc/bison.sh && perl Makefile.PL && make && perl solo/solo_Makefile.PL && make -f solo/Makefile && ./solo/main foo bar

       # Debug run - Print AST, package information, operaion codes
       yacc/bison.sh && perl Makefile.PL --OPTIMIZE="-O0 -g" --DEFINE=SPVM_DEBUG_DUMP --DEFINE=SPVM_DEBUG_OBJECT_COUNT && make && perl solo/solo_Makefile.PL  --OPTIMIZE="-O0 -g" --DEFINE=SPVM_DEBUG_DUMP --DEFINE=SPVM_DEBUG_OBJECT_COUNT && make -f solo/Makefile && ./solo/main foo bar

       # Parser Debug run - Print yacc result
       yacc/bison.sh && perl Makefile.PL --OPTIMIZE="-O0 -g" --DEFINE=SPVM_DEBUG_YACC && make && perl solo/solo_Makefile.PL  --OPTIMIZE="-O0 -g" --DEFINE=SPVM_DEBUG_YACC && make -f solo/Makefile && ./solo/main foo bar

    See batcktrace of core dump

      gdb solo/main core.*

    What is solo test command?

      solo test is used for debgug.
      
      SPVM is compiled to dynamic link library by -O3 option.
      
      this is difficult to debug because debug information is removed and it is not simple machine code.
      
      If you use the above solo test commands, you can create
      
        solo/main
      
      "solo/main" can execute SPVM module by the following way.
      
        ./solo/main

    See core dump

      If you use Debug run, you can see core dump and back trace by gdb command

        gdb spvm core.*
        
        bt
  
  EXE TESTS
    
    SPVM can create exe file.
    
      perl Makefile.PL
      make && perl -Mblib -- blib/script/spvmcc -I t/default/lib TestCase::MyExe
      env LD_LIBRARY_PATH=spvm_build/exe spvm_build/exe/TestCase__MyExe
 
      gdb spvm_build/exe/MyExe core.*
    
    Debug mode
    
      perl Makefile.PL --OPTIMIZE="-O0 -g" --DEFINE=SPVM_DEBUG_DUMP && \
      make && perl -Mblib -- blib/script/spvmcc -I t/default/lib -B spvm_build/exe -n MyExe TestCase::MyExe && \
      gcc -o spvm_build/exe/MyExe spvm_build/exe/libmy_main.so && \
      spvm_build/exe/MyExe
      
  PORTABILITY NOTE
  
    Compiler type, version and working is various in different environments. 
    Main compiler targets is gcc and clang.
    Main OS targets is Linux/Unix, Windows, macOS.
    To keep maxmam portability, I have the following rule.
  
    - don't use realloc.
    - don't use global variables
    - don't use static keyword
    - don't use inline keyword
    - use -std=c99
    - fix all warnings before CPAN release
    - exception is spvm_yacc.c. This is automatically created by yacc/bison.
  
  CODING GUIDE LINE
    - use int8_t, int16_t, int32_t, int64_t instead of byte, short, int, long, _Bool.
    - char is used for only character.
    - char[] is used for only string.
    - constant value is defined by enum { } syntax.
    - constant name is ,for example, SPVM_TYPE_C_FLAG_REF.
      all character is upper case or under score. need _C_ between package name and constant base name