Skip to content

Commit

Permalink
Avoid making a cursor uselessly for alternation
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Sep 14, 2010
1 parent e698589 commit 664f420
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lib/Cursor.cs
Expand Up @@ -235,6 +235,8 @@ public sealed class RxFrame {
return st.ns.quant;
}

public DynMetaObject GetClass() { return st.ns.klass; }

public Cursor MakeCursor() {
return new Cursor(st.ns.klass, st.ns, bt, orig_s, orig, st.pos);
}
Expand Down Expand Up @@ -885,12 +887,12 @@ public class Lexer {
public static bool LtmTrace =
Environment.GetEnvironmentVariable("NIECZA_LTM_TRACE") != null;

public static Lexer GetLexer(IP6 cursor, LAD[] lads, string title) {
LexerCache lc = cursor.GetMO().GetLexerCache();
public static Lexer GetLexer(DynMetaObject kl, LAD[] lads, string title) {
LexerCache lc = kl.GetLexerCache();
Lexer ret;
if (lc.nfas.TryGetValue(lads, out ret))
return ret;
ret = new Lexer(cursor.GetMO(), title, lads);
ret = new Lexer(kl, title, lads);
lc.nfas[lads] = ret;
return ret;
}
Expand Down
1 change: 1 addition & 0 deletions src/CodeGen.pm
Expand Up @@ -64,6 +64,7 @@ use 5.010;
'RxFrame' =>
{ Exact => [m => 'Boolean'],
Exact1 => [m => 'Boolean'],
GetClass => [m => 'DynMetaObject'],
IncQuant => [m => 'Void'],
GetQuant => [m => 'Int32'],
OpenQuant => [m => 'Void'],
Expand Down
2 changes: 1 addition & 1 deletion src/RxOp.pm
Expand Up @@ -529,7 +529,7 @@ use CgOp;
my @code;
push @code, CgOp::rxcall("LTMPushAlts",
CgOp::rawscall('Lexer.GetLexer',
CgOp::rawcall(CgOp::rxframe, 'MakeCursor'),
CgOp::rxcall('GetClass'),
CgOp::const(RxOp::lad2cgop($self->lads)),
CgOp::clr_string('')),
CgOp::const(CgOp::rawnewarr('Int32', map { CgOp::labelid($_) } @ls)));
Expand Down

0 comments on commit 664f420

Please sign in to comment.