Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more optimization attempts
  • Loading branch information
diakopter committed Nov 8, 2011
1 parent 2941d14 commit 6fc09fa
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
19 changes: 16 additions & 3 deletions lua/compiler/IndexersReplacements.txt
@@ -1,16 +1,29 @@
%.STable [1] # on every RakudoObject impl (inner classes of the repr classes)
%.Value [2] # some RakudoObject impl
%.FormWith%( [1]( # on SharedTable
%.FindMethod%( [2]( # on SharedTable
%.Invoke%( [3]( # on SharedTable
%.TypeCheck%( [4]( # on SharedTable
%.REPR [5] # on SharedTable
%.HOW [6] # on SharedTable
%.WHAT [7] # on SharedTable
%.SpecialInvoke [8] # on SharedTable
%.CachedInvoke [9] # on SharedTable
%.TypeCheckCache [10] # on SharedTable
%.new%( [1]( # all classes with constructors named new
Ops%.box_int%( Ops[1](
Ops%.box_num%( Ops[2](
Ops%.box_str%( Ops[3](
Ops%.unbox_int%( Ops[4](
Ops%.unbox_num%( Ops[5](
Ops%.unbox_str%( Ops[6](
Ops%.unbox_str%( Ops[6](
Ops%.type_object_for%( Ops[43](
Ops%.instance_of%( Ops[44](
%.STable [1] # on every RakudoObject impl (inner classes of the repr classes)
%.Value [2] # some RakudoObject impl
%.type_object_for%( [2]( # all RakudoObject impl
%.instance_of%( [3]( # all RakudoObject impl
%.defined%( [4]( # all RakudoObject impl
%.hint_for%( [5]( # all RakudoObject impl
Hints%.NO_HINT=%-1 unused=0
Hints%.NO_HINT -1
%.DefaultStrBoxType [2] # on ThreadContext
%.DefaultBoolBoxType [3] # on ThreadContext
2 changes: 1 addition & 1 deletion lua/runtime/Metamodel/REPRRegistry.lua
Expand Up @@ -28,4 +28,4 @@ function makeREPRRegistry ()
end
REPRRegistry = makeREPRRegistry();
Hints = {};
Hints.NO_HINT = -1;
Hints.NO_HINT=-1;
30 changes: 15 additions & 15 deletions lua/runtime/Runtime/Ops/Metamodel.lua
@@ -1,23 +1,23 @@
function Ops.type_object_for(TC, HOW, REPRName)
function Ops.type_object_for (TC, HOW, REPRName)
local REPRNameStr = Ops.unbox_str(TC, REPRName);
local REPR = REPRRegistry.get_REPR_by_name(REPRNameStr);
return REPR.type_object_for(REPR, TC, HOW);
end
Ops[43] = Ops.type_object_for;

function Ops.instance_of(TC, WHAT)
function Ops.instance_of (TC, WHAT)
local REPR = WHAT.STable.REPR;
return REPR.instance_of(REPR, TC, WHAT);
end
Ops[44] = Ops.instance_of;

function Ops.repr_defined(TC, Obj)
function Ops.repr_defined (TC, Obj)
local REPR = Obj.STable.REPR;
return Ops.box_int(TC, REPR.defined(REPR, TC, Obj) and 1 or 0, TC.DefaultBoolBoxType);
end
Ops[45] = Ops.repr_defined;

function Ops.get_attr(TC, Object, Class, Name)
function Ops.get_attr (TC, Object, Class, Name)
if (Name.Value ~= nil) then
Name = Ops.unbox_str(TC, Name);
end
Expand All @@ -26,13 +26,13 @@ function Ops.get_attr(TC, Object, Class, Name)
end
Ops[46] = Ops.get_attr;

function get_attr_with_hint(TC, Object, Class, name, Hint)
function get_attr_with_hint (TC, Object, Class, name, Hint)
local REPR = Object.STable.REPR;
return REPR.get_attribute_with_hint(REPR, TC, Object, Class, Name, Hint);
end
Ops[47] = Ops.get_attr_with_hint;

function Ops.bind_attr(TC, Object, Class, Name, Value)
function Ops.bind_attr (TC, Object, Class, Name, Value)
if (Name.Value ~= nil) then
Name = Ops.unbox_str(TC, Name);
end
Expand All @@ -42,7 +42,7 @@ function Ops.bind_attr(TC, Object, Class, Name, Value)
end
Ops[48] = Ops.bind_attr;

function Ops.bind_attr_with_hint(TC, Object, Class, Name, Value, Hint)
function Ops.bind_attr_with_hint (TC, Object, Class, Name, Value, Hint)
if (Name.Value ~= nil) then
Name = Ops.unbox_str(TC, Name);
end
Expand All @@ -52,46 +52,46 @@ function Ops.bind_attr_with_hint(TC, Object, Class, Name, Value, Hint)
end
Ops[49] = Ops.bind_attr_with_hint;

function Ops.find_method(TC, Object, Name)
function Ops.find_method (TC, Object, Name)
local STable = Object.STable;
return STable.FindMethod(STable, TC, Object, Name, Hints.NO_HINT);
end
Ops[50] = Ops.find_method;

function Ops.find_method_with_hint(TC, Object, Name, Hint)
function Ops.find_method_with_hint (TC, Object, Name, Hint)
local STable = Object.STable;
return STable.FindMethod(STable, TC, Object, Name, Hint);
end
Ops[51] = Ops.find_method_with_hint;

function Ops.invoke(TC, Invokee, Capture)
function Ops.invoke (TC, Invokee, Capture)
local STable = Invokee.STable;
return STable.Invoke(STable, TC, Invokee, Capture);
end
Ops[52] = Ops.invoke;

function Ops.get_how(TC, Obj)
function Ops.get_how (TC, Obj)
return Obj.STable.HOW;
end
Ops[53] = Ops.get_how;

function Ops.get_what(TC, Obj)
function Ops.get_what (TC, Obj)
return Obj.STable.WHAT;
end
Ops[54] = Ops.get_what;

function Ops.type_check(TC, ToCheck, WantedType)
function Ops.type_check (TC, ToCheck, WantedType)
local STable = ToCheck.STable;
return STable.TypeCheck(STable, TC, ToCheck, WantedType);
end
Ops[55] = Ops.type_check;

function Ops.publish_type_check_cache(TC, WHAT, TypeList)
function Ops.publish_type_check_cache (TC, WHAT, TypeList)
WHAT.STable.TypeCheckCache = TypeList.Storage:Clone();
end
Ops[56] = Ops.publish_type_check_cache;

function Ops.publish_method_cache(TC, WHAT, MethodCacheHash)
function Ops.publish_method_cache (TC, WHAT, MethodCacheHash)
WHAT.STable.MethodCache = MethodCacheHash.Storage;
return MethodCacheHash;
end
Expand Down

0 comments on commit 6fc09fa

Please sign in to comment.