Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b163f4bd56d5^
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 345e33bcca5e
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Apr 13, 2017

  1. Copy the full SHA
    b163f4b View commit details
  2. Copy the full SHA
    345e33b View commit details
3,894 changes: 3,894 additions & 0 deletions core/src/main/java/org/jruby/parser/FlatRubyParser.java

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion core/src/main/java/org/jruby/parser/Parser.java
Original file line number Diff line number Diff line change
@@ -47,6 +47,7 @@
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.load.LoadServiceResourceInputStream;
import org.jruby.util.ByteList;
import org.jruby.util.cli.Options;

/**
* Serves as a simple facade for all the parsing magic.
@@ -122,7 +123,9 @@ public Node parse(String file, LexerSource lexerSource, DynamicScope blockScope,
}

long startTime = System.nanoTime();
RubyParser parser = new RubyParser(lexerSource, runtime.getWarnings());
RubyParser parser = Options.FLAT_PARSER.load() ?
new FlatRubyParser(lexerSource, runtime.getWarnings()) :
new RubyParser(lexerSource, runtime.getWarnings());
RubyParserResult result;
try {
result = parser.parse(configuration);
1 change: 1 addition & 0 deletions core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -172,6 +172,7 @@ public class Options {
public static final Option<Boolean> USE_FIXNUM_CACHE = bool(MISCELLANEOUS, "fixnum.cache", true, "Use a cache of low-valued Fixnum objects.");
public static final Option<Integer> FIXNUM_CACHE_RANGE = integer(MISCELLANEOUS, "fixnum.cache.size", 256, "Values to retrieve from Fixnum cache, in the range -X..(X-1).");
public static final Option<Boolean> PACKED_ARRAYS = bool(MISCELLANEOUS, "packed.arrays", true, "Toggle whether to use \"packed\" arrays for small tuples.");
public static final Option<Boolean> FLAT_PARSER = bool(MISCELLANEOUS, "parser.flat", false, "Toggle whether to use the \"flat\" parser rather than the command-based version.");

public static final Option<Boolean> DEBUG_LOADSERVICE = bool(DEBUG, "debug.loadService", false, "Log require/load file searches.");
public static final Option<Boolean> DEBUG_LOADSERVICE_TIMING = bool(DEBUG, "debug.loadService.timing", false, "Log require/load parse+evaluate times.");
6 changes: 5 additions & 1 deletion tool/generate_parser
Original file line number Diff line number Diff line change
@@ -47,8 +47,12 @@ $JAY $DEBUG_FLAG $PARSER_BASE.y < skeleton.parser | grep -v $DEBUG_STRIP >$PARSE

# Patch file to get around Java static initialization issues plus extract
# a bunch of stuff to seperate file (yytables).
$RUBY ../../../../../../../tool/patch_parser.rb $PARSER_BASE.out $YYTABLE_PREFIX > $PARSER_BASE.out2
$RUBY ../../../../../../../tool/patch_parser.rb $PARSER_BASE.out $YYTABLE_PREFIX > $PARSER_BASE.java

# Comment out the following two lines to skip breaking the parser's "big switch" into individual functions.
mv $PARSER_BASE.java $PARSER_BASE.out2
$RUBY ../../../../../../../tool/optimize_parser.rb $PARSER_BASE.out2 $YYTABLE_PREFIX > $PARSER_BASE.java

rm -f $PARSER_BASE.out $PARSER_BASE.out2

popd