C# Class Rakudo.Metamodel.Representations.P6opaque

This is a first cut implementation of the P6opaque representation. Eventually it's going to need to handle native types too, and we want to get an instance down to a single object allocation if we can. Alas, that's Quite Tricky to write, so for now we just do something easy, but at least with the hints.
Inheritance: Representation
Afficher le fichier Open project: jnthn/6model

Méthodes publiques

Méthode Description
bind_attribute ( ThreadContext TC, RakudoObject Object, RakudoObject ClassHandle, string Name, RakudoObject Value ) : void

bind_attribute_with_hint ( ThreadContext TC, RakudoObject Object, RakudoObject ClassHandle, string Name, int Hint, RakudoObject Value ) : void

Bind the attribute, using the hint if possible.

defined ( ThreadContext TC, RakudoObject Object ) : bool

Checks if the object is defined, which boils down to "is this a type object", which in trun means "did we allocate any storage".

get_attribute ( ThreadContext TC, RakudoObject Object, RakudoObject ClassHandle, string Name ) : RakudoObject

Gets an attribute.

get_attribute_with_hint ( ThreadContext TC, RakudoObject Object, RakudoObject ClassHandle, string Name, int Hint ) : RakudoObject

Gets the attribute, using the hint if possible.

get_int ( ThreadContext TC, RakudoObject Object ) : int
get_num ( ThreadContext TC, RakudoObject Object ) : double
get_str ( ThreadContext TC, RakudoObject Object ) : string
hint_for ( ThreadContext TC, RakudoObject ClassHandle, string Name ) : int

Checks if we have a hint for the given class and name, and if so returns it.

instance_of ( ThreadContext TC, RakudoObject WHAT ) : RakudoObject

Allocates and returns a new object based upon the type object supplied. Also, computes the slot allocation if we didn't do that yet.

set_int ( ThreadContext TC, RakudoObject Object, int Value ) : void
set_num ( ThreadContext TC, RakudoObject Object, double Value ) : void
set_str ( ThreadContext TC, RakudoObject Object, string Value ) : void
type_object_for ( ThreadContext TC, RakudoObject MetaPackage ) : RakudoObject

Creates a type object that references the given HOW and sets up the STable with a new REPR instance too.

Private Methods

Méthode Description
ComputeSlotAllocation ( ThreadContext TC, RakudoObject WHAT ) : void

Computes the slot allocation for this representation.

Method Details

bind_attribute() public méthode

public bind_attribute ( ThreadContext TC, RakudoObject Object, RakudoObject ClassHandle, string Name, RakudoObject Value ) : void
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
ClassHandle RakudoObject
Name string
Value RakudoObject
Résultat void

bind_attribute_with_hint() public méthode

Bind the attribute, using the hint if possible.
public bind_attribute_with_hint ( ThreadContext TC, RakudoObject Object, RakudoObject ClassHandle, string Name, int Hint, RakudoObject Value ) : void
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
ClassHandle RakudoObject
Name string
Hint int
Value RakudoObject
Résultat void

defined() public méthode

Checks if the object is defined, which boils down to "is this a type object", which in trun means "did we allocate any storage".
public defined ( ThreadContext TC, RakudoObject Object ) : bool
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
Résultat bool

get_attribute() public méthode

Gets an attribute.
public get_attribute ( ThreadContext TC, RakudoObject Object, RakudoObject ClassHandle, string Name ) : RakudoObject
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
ClassHandle RakudoObject
Name string
Résultat RakudoObject

get_attribute_with_hint() public méthode

Gets the attribute, using the hint if possible.
public get_attribute_with_hint ( ThreadContext TC, RakudoObject Object, RakudoObject ClassHandle, string Name, int Hint ) : RakudoObject
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
ClassHandle RakudoObject
Name string
Hint int
Résultat RakudoObject

get_int() public méthode

public get_int ( ThreadContext TC, RakudoObject Object ) : int
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
Résultat int

get_num() public méthode

public get_num ( ThreadContext TC, RakudoObject Object ) : double
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
Résultat double

get_str() public méthode

public get_str ( ThreadContext TC, RakudoObject Object ) : string
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
Résultat string

hint_for() public méthode

Checks if we have a hint for the given class and name, and if so returns it.
public hint_for ( ThreadContext TC, RakudoObject ClassHandle, string Name ) : int
TC Rakudo.Runtime.ThreadContext
ClassHandle RakudoObject
Name string
Résultat int

instance_of() public méthode

Allocates and returns a new object based upon the type object supplied. Also, computes the slot allocation if we didn't do that yet.
public instance_of ( ThreadContext TC, RakudoObject WHAT ) : RakudoObject
TC Rakudo.Runtime.ThreadContext
WHAT RakudoObject
Résultat RakudoObject

set_int() public méthode

public set_int ( ThreadContext TC, RakudoObject Object, int Value ) : void
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
Value int
Résultat void

set_num() public méthode

public set_num ( ThreadContext TC, RakudoObject Object, double Value ) : void
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
Value double
Résultat void

set_str() public méthode

public set_str ( ThreadContext TC, RakudoObject Object, string Value ) : void
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
Value string
Résultat void

type_object_for() public méthode

Creates a type object that references the given HOW and sets up the STable with a new REPR instance too.
public type_object_for ( ThreadContext TC, RakudoObject MetaPackage ) : RakudoObject
TC Rakudo.Runtime.ThreadContext
MetaPackage RakudoObject
Résultat RakudoObject