MysoreScript
|
Classes | |
struct | Array |
The layout of the primitive Array class in MysoreScript. More... | |
struct | Class |
Struct holding metadata about a class. More... | |
struct | Closure |
The layout of all closures in MysoreScript. More... | |
struct | Method |
Methods in a class's method list. More... | |
struct | Object |
A generic MysoreScript object. More... | |
struct | String |
The primitive String class in MysoreScript. More... | |
Typedefs | |
typedef Object * | Obj |
Object pointer. More... | |
typedef uint32_t | Selector |
Selectors are unique identifiers for methods. More... | |
typedef Object *(* | CompiledMethod) (Object *, Selector,...) |
A compiled method is a function that takes an object (the receiver) and the selector as implicit arguments and then any other explicit arguments. More... | |
typedef Object *(* | ClosureInvoke) (Closure *,...) |
A compiled closure invoke function. More... | |
Functions | |
Selector | lookupSelector (const std::string &) |
Looks up the selector for a specified string value, registering a new value if this is the first time the mapping has been needed. More... | |
void | registerClass (const std::string &name, struct Class *cls) |
Register a newly constructed class. More... | |
struct Class * | lookupClass (const std::string &name) |
Look up an existing class. More... | |
Obj | newObject (struct Class *cls) |
Instantiate an object. More... | |
Method * | methodForSelector (Class *, Selector) |
Looks up the Method that should be invoked for the specified selector on this class. More... | |
Obj | callCompiledMethod (CompiledMethod m, Obj receiver, Selector sel, Obj *args, int argCount) |
Calls a compiled method, constructing the correct argument frame based on the arguments. More... | |
Obj | callCompiledClosure (ClosureInvoke m, Closure *receiver, Obj *args, int argCount) |
Calls a compiled closure from the specified argument list. More... | |
Obj | mysoreScriptAdd (Obj lhs, Obj rhs) |
Helper function called by compiled code for the + operator on objects that are not small (embedded in a pointer) integers. More... | |
Obj | mysoreScriptSub (Obj lhs, Obj rhs) |
Helper function called by compiled code for the - operator on objects that are not small (embedded in a pointer) integers. More... | |
Obj | mysoreScriptMul (Obj lhs, Obj rhs) |
Helper function called by compiled code for the * operator on objects that are not small (embedded in a pointer) integers. More... | |
Obj | mysoreScriptDiv (Obj lhs, Obj rhs) |
Helper function called by compiled code for the / operator on objects that are not small (embedded in a pointer) integers. More... | |
CompiledMethod | compiledMethodForSelector (Obj obj, Selector sel) |
Look up the compiled method to call for a specific selector. More... | |
bool | isInteger (Obj o) |
Is this object a small integer (lowest bit is 1, next two bits are 0). More... | |
intptr_t | getInteger (Obj o) |
Assuming that o is a small integer (an integer embedded in a pointer), return it as a C integer. More... | |
Obj | createSmallInteger (intptr_t i) |
Construct a small integer object from the given integer. More... | |
Variables | |
struct Class | StringClass |
The String class structure. More... | |
struct Class | FileClass |
The File class structure. More... | |
struct Class | ArrayClass |
The Array class structure. More... | |
struct Class | SmallIntClass |
The SmallInt (Number ) class structure. More... | |
struct Class | ClosureClass |
The Closure class structure. More... | |
A compiled closure invoke function.
This takes the closure as an implicit argument and then other explicit arguments.
Definition at line 80 of file runtime.hh.
A compiled method is a function that takes an object (the receiver) and the selector as implicit arguments and then any other explicit arguments.
Definition at line 75 of file runtime.hh.
typedef Object* MysoreScript::Obj |
Object pointer.
Objects are either pointers or small objects hidden inside the pointer.
Definition at line 33 of file runtime.hh.
typedef uint32_t MysoreScript::Selector |
Selectors are unique identifiers for methods.
When a method name is registered, it is assigned a unique number.
Definition at line 70 of file runtime.hh.
Obj MysoreScript::callCompiledClosure | ( | ClosureInvoke | m, |
Closure * | receiver, | ||
Obj * | args, | ||
int | argCount | ||
) |
Calls a compiled closure from the specified argument list.
Definition at line 656 of file runtime.cc.
Obj MysoreScript::callCompiledMethod | ( | CompiledMethod | m, |
Obj | receiver, | ||
Selector | sel, | ||
Obj * | args, | ||
int | argCount | ||
) |
Calls a compiled method, constructing the correct argument frame based on the arguments.
Definition at line 632 of file runtime.cc.
CompiledMethod MysoreScript::compiledMethodForSelector | ( | Obj | obj, |
Selector | sel | ||
) |
Look up the compiled method to call for a specific selector.
This is called by compiled code to perform method lookups. If a method has not yet been compiled, the Method structure should be initialised with a trampoline function that jumps back into the interpreter.
Definition at line 697 of file runtime.cc.
|
inline |
Construct a small integer object from the given integer.
Definition at line 59 of file runtime.hh.
|
inline |
Assuming that o
is a small integer (an integer embedded in a pointer), return it as a C integer.
Definition at line 51 of file runtime.hh.
|
inline |
Is this object a small integer (lowest bit is 1, next two bits are 0).
Definition at line 43 of file runtime.hh.
struct Class * MysoreScript::lookupClass | ( | const std::string & | name | ) |
Look up an existing class.
Definition at line 601 of file runtime.cc.
Selector MysoreScript::lookupSelector | ( | const std::string & | ) |
Looks up the selector for a specified string value, registering a new value if this is the first time the mapping has been needed.
Definition at line 553 of file runtime.cc.
Looks up the Method
that should be invoked for the specified selector on this class.
Definition at line 615 of file runtime.cc.
Helper function called by compiled code for the + operator on objects that are not small (embedded in a pointer) integers.
Definition at line 681 of file runtime.cc.
Helper function called by compiled code for the / operator on objects that are not small (embedded in a pointer) integers.
Definition at line 693 of file runtime.cc.
Helper function called by compiled code for the * operator on objects that are not small (embedded in a pointer) integers.
Definition at line 689 of file runtime.cc.
Helper function called by compiled code for the - operator on objects that are not small (embedded in a pointer) integers.
Definition at line 685 of file runtime.cc.
Instantiate an object.
This returns a new instance of the class with all of its instance variables set to null.
Definition at line 606 of file runtime.cc.
void MysoreScript::registerClass | ( | const std::string & | name, |
struct Class * | cls | ||
) |
Register a newly constructed class.
Definition at line 596 of file runtime.cc.
struct Class MysoreScript::ArrayClass |
The Array
class structure.
Definition at line 516 of file runtime.cc.
struct Class MysoreScript::ClosureClass |
The Closure
class structure.
The class used for closures.
Definition at line 543 of file runtime.cc.
struct Class MysoreScript::FileClass |
The File
class structure.
Definition at line 504 of file runtime.cc.
struct Class MysoreScript::SmallIntClass |
The SmallInt
(Number
) class structure.
The class used for small integers.
This is distinct from Number because a future implementation may implement Number
as both SmallInt
and BigInt
classes internally, which both appear as instances of the Number
class.
Definition at line 531 of file runtime.cc.
struct Class MysoreScript::StringClass |
The String
class structure.
The class used for strings.
Definition at line 492 of file runtime.cc.