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
Mostra file Open project: jnthn/6model

Public Methods

Method 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

Method Description
ComputeSlotAllocation ( ThreadContext TC, RakudoObject WHAT ) : void

Computes the slot allocation for this representation.

Method Details

bind_attribute() public method

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
return void

bind_attribute_with_hint() public method

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
return void

defined() public method

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
return bool

get_attribute() public method

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
return RakudoObject

get_attribute_with_hint() public method

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
return RakudoObject

get_int() public method

public get_int ( ThreadContext TC, RakudoObject Object ) : int
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
return int

get_num() public method

public get_num ( ThreadContext TC, RakudoObject Object ) : double
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
return double

get_str() public method

public get_str ( ThreadContext TC, RakudoObject Object ) : string
TC Rakudo.Runtime.ThreadContext
Object RakudoObject
return string

hint_for() public method

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
return int

instance_of() public method

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
return RakudoObject

set_int() public method

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

set_num() public method

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

set_str() public method

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

type_object_for() public method

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
return RakudoObject