MysoreScript
Classes | Namespaces | Typedefs | Functions
runtime.hh File Reference
#include <stdint.h>
#include <assert.h>
#include <string>
#include "gc.h"
Include dependency graph for runtime.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MysoreScript::Method
 Methods in a class's method list. More...
 
struct  MysoreScript::Class
 Struct holding metadata about a class. More...
 
struct  MysoreScript::Object
 A generic MysoreScript object. More...
 
struct  MysoreScript::Array
 The layout of the primitive Array class in MysoreScript. More...
 
struct  MysoreScript::String
 The primitive String class in MysoreScript. More...
 
struct  MysoreScript::Closure
 The layout of all closures in MysoreScript. More...
 

Namespaces

 anonymous_namespace{runtime.hh}
 
 AST
 
 MysoreScript
 

Typedefs

typedef Object * MysoreScript::Obj
 Object pointer. More...
 
typedef uint32_t MysoreScript::Selector
 Selectors are unique identifiers for methods. More...
 
typedef Object *(* MysoreScript::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 *(* MysoreScript::ClosureInvoke) (Closure *,...)
 A compiled closure invoke function. More...
 

Functions

template<typename T >
T * anonymous_namespace{runtime.hh}::gcAlloc (size_t extraBytes=0)
 Typesafe helper function for allocating garbage-collected memory. More...
 
bool MysoreScript::isInteger (Obj o)
 Is this object a small integer (lowest bit is 1, next two bits are 0). More...
 
intptr_t MysoreScript::getInteger (Obj o)
 Assuming that o is a small integer (an integer embedded in a pointer), return it as a C integer. More...
 
Obj MysoreScript::createSmallInteger (intptr_t i)
 Construct a small integer object from the given integer. More...
 
void MysoreScript::registerClass (const std::string &name, struct Class *cls)
 Register a newly constructed class. More...
 
struct ClassMysoreScript::lookupClass (const std::string &name)
 Look up an existing class. More...
 
Obj MysoreScript::newObject (struct Class *cls)
 Instantiate an object. More...
 
Obj MysoreScript::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 MysoreScript::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 MysoreScript::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 MysoreScript::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 MysoreScript::compiledMethodForSelector (Obj obj, Selector sel)
 Look up the compiled method to call for a specific selector. More...
 
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. More...
 
MethodMysoreScript::methodForSelector (Class *, Selector)
 Looks up the Method that should be invoked for the specified selector on this class. More...
 
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. More...
 
Obj MysoreScript::callCompiledClosure (ClosureInvoke m, Closure *receiver, Obj *args, int argCount)
 Calls a compiled closure from the specified argument list. More...