The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

SPVM::Native::Runtime - Native::Runtime

Description

SPVM::Native::Runtime is the Native::Runtime class in the SPVM language.

The instance has the runtime information such as operation codes, classes, methods, fields, class variables, constant strings.

This class provides only the minimal methods to get the information of classes and methods.

An instance of the Native::Runtime class is build by the get_runtime method in the Native::Compiler class.

Usage

  use Native::Runtime;
  
  my $runtime = $compiler->get_runtime;
  
  my $stack = $env->new_stack;

Pointer

The Native::Runtime class is a pointer class.

Its insntace has a pointer to a runtime object.

Instance Methods

get_basic_types_length

method get_basic_types_length : int ();

Returns the length of the all basic types in the runtime.

get_basic_type_by_id

method get_basic_type_by_id : Native::BasicType ($id : int);

Returns a Native::BasicType object by a basic type ID.

Exceptions:

If The basic type cannot be found, an exception is throen.

get_basic_type_by_name

method get_basic_type_by_name : Native::BasicType ($name : string);

Returns a Native::BasicType object by a basic type name.

Exceptions:

If The basic type cannot be found, an exception is throen.

build_precompile_class_source

method build_precompile_class_source : string ($basic_type : Native::BasicType);

Builds the C source code of the class that contains precompile methods and returns it.

build_precompile_method_source

method method build_precompile_method_source : string ($method : Native::Method);

Builds the C source code of a precompile method and returns it.

get_compiler

method get_compiler : Native::Compiler ();

Gets the compiler that built this runtime.

new_env

static method new_env : Native::Env ();

Creates a new Native::Env ojbect, and returns it.

get_basic_type_names

method get_basic_type_names : string[] ();

Gets all basic type names owned by the runtime, and return it.

get_class_names

method get_class_names : string[] ();

Gets all basic type names by defined class keyword owned by the runtime, and return it.

These contains the names of interface types and multi-numeric types.

get_method_names

method get_method_names : string[] ($class_name : string);

Returns all method names owned by the class given the class name $class_name.

get_field_names

method get_field_names : string[] ($class_name : string);

Returnsall field names owned by the class given the class name $class_name.

get_class_var_names

method get_class_var_names : string[] ($class_name : string);

Returnsall class variable names owned by the class given the class name $class_name.

get_method_by_name

method get_method_by_name : Native::Method ($class_name : string, $method_name : string);

Gets a method given the class name $class_name and the method name $method_name, returns it.

get_field_by_name

method get_field_by_name : Native::Field ($class_name : string, $field_name : string);

Gets a field given the class name $class_name and the method name $method_name, returns it.

get_class_var_by_name

method get_class_var_by_name : Native::ClassVar ($class_name : string, $class_var_name : string);

Gets a class variable given the class name $class_name and the method name $method_name, returns it.

See Also

Native::Compiler

The get_runtime method in the Native::Compiler class builds a rutnime.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License