Manpage logo

SPVM::Native - Getting the current native environment, stack, runtime, compiler.

Name  Description  Usage  Class Methods  get_current_stack  get_current_env  get_current_runtime  get_current_compiler  check_bootstrap_method  use  use_anon_class  eval  inc  set_inc  push_inc  unshift_inc  Copyright & License 

Name

SPVM::Native − Getting the current native environment, stack, runtime, compiler.

Description

The Native class of SPVM has methods to get the current native environment, stack, runtime, compiler.

Usage

use Native;

Class Methods

get_current_stack

"static method get_current_stack : Native::Stack ();"

Returns the current execution stack.

get_current_env

"static get_current_env : Native::Env ();"

Returns the current execution environemnt.

get_current_runtime

"static method get_current_runtime : Native::Runtime ();"

Returns the current runtime.

get_current_compiler

"static method get_current_compiler : Native::Compiler ();"

Returns the current compiler.

check_bootstrap_method

"static method check_bootstrap_method : void ($basic_type_name : string);"

Check the bootstrap method in the basic type $basic_type_name.

use

"static method use : void (static method use : void ($class_name : string, $file : string = undef, $line : int = −1));"

Compiles the class $class_name using the compiler of the current runtime.

use_anon_class

"static method use_anon_class : string ($source : string, $file : string = undef, $line : int = −1);"

Compiles the anon class source $source using the compiler of the current runtime.

eval

"static method eval : object ($eval_source : string);"

This method emulates Perl's string eval <https://perldoc.perl.org/functions/eval#String-eval>.

This method creates the following source code.

"
class {
static method eval : object () {
#line 1
$eval_source
}
}
"

And calls "compile_anon_class" given this source code and gets the anon class name.

And calls call_class_method in the Native::MethodCall class.

Native::MethodCall−>call_class_method($anon_class_name, "eval");

Examples:

my $value = (Int)Native−>eval("my $total = 1 + 2; return $total;");
say $value−>value;

inc

"static method inc : string[] ();"

Returns the current serach directories of the class search directories of the compiler of the current runtime.

set_inc

"static method set_inc : void ($include_dirs : string[]);"

Set the current serach directories $include_dirs to the class search directories of the compiler of the current runtime.

push_inc

"static method push_inc : void ($include_dir : string);"

Add the class search directory $include_dir at the tail of the class search directories of the compiler of the current runtime.

unshift_inc

"static method unshift_inc : void ($include_dir : string);"

Add the class search directory $include_dir at the head of the class search directories of the compiler of the current runtime.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License


Updated 2026-06-01 - jenkler.se | uex.se