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: acc2b9de38f5^
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2bd6be997996
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Nov 8, 2016

  1. Use a simpler approach to compute class flags

    * The concerned core classes are all subclasses of Object,
      so there is only one set of shared flags and no need
      to decide that at runtime with complex logic.
    * Avoids loading core classes in Constants.java.
    eregon committed Nov 8, 2016
    Copy the full SHA
    acc2b9d View commit details
  2. Copy the full SHA
    991890e View commit details
  3. Copy the full SHA
    2bd6be9 View commit details
75 changes: 0 additions & 75 deletions core/src/main/java/org/jruby/FlagRegistry.java

This file was deleted.

1 change: 0 additions & 1 deletion core/src/main/java/org/jruby/ext/stringio/StringIO.java
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@

import org.jcodings.Encoding;
import org.jcodings.specific.ASCIIEncoding;
import org.jruby.FlagRegistry;
import org.jruby.Ruby;
import org.jruby.RubyArray;
import org.jruby.RubyClass;
1 change: 0 additions & 1 deletion core/src/main/java/org/jruby/util/StringSupport.java
Original file line number Diff line number Diff line change
@@ -35,7 +35,6 @@
import org.jcodings.specific.UTF8Encoding;
import org.jcodings.util.IntHash;
import org.joni.Matcher;
import org.jruby.FlagRegistry;
import org.jruby.Ruby;
import org.jruby.RubyArray;
import org.jruby.RubyEncoding;
55 changes: 22 additions & 33 deletions core/src/main/resources/org/jruby/runtime/Constants.java
Original file line number Diff line number Diff line change
@@ -30,15 +30,6 @@
***** END LICENSE BLOCK *****/
package org.jruby.runtime;

import org.jruby.FlagRegistry;
import org.jruby.RubyArray;
import org.jruby.RubyBasicObject;
import org.jruby.RubyHash;
import org.jruby.RubyMatchData;
import org.jruby.RubyModule;
import org.jruby.RubyString;
import org.jruby.ext.stringio.StringIO;

public final class Constants {
public static final String PLATFORM = "java";

@@ -81,36 +72,34 @@ public final class Constants {
*/
public static final int JIT_THRESHOLD = 50;

private static final FlagRegistry registry = new FlagRegistry();

// These flags must be registered from top of hierarchy down to maintain order.
// TODO: Replace these during the build with their calculated values.
public static final int FALSE_F = registry.newFlag(RubyBasicObject.class);
public static final int NIL_F = registry.newFlag(RubyBasicObject.class);
public static final int FROZEN_F = registry.newFlag(RubyBasicObject.class);
public static final int TAINTED_F = registry.newFlag(RubyBasicObject.class);
// Flags for all Ruby objects, other flags must go after these
public static final int FALSE_F = 1 << 0;
public static final int NIL_F = 1 << 1;
public static final int FROZEN_F = 1 << 2;
public static final int TAINTED_F = 1 << 3;

public static final int CACHEPROXY_F = registry.newFlag(RubyModule.class);
public static final int NEEDSIMPL_F = registry.newFlag(RubyModule.class);
public static final int REFINED_MODULE_F = registry.newFlag(RubyModule.class);
public static final int IS_OVERLAID_F = registry.newFlag(RubyModule.class);
// All these core classes have Object as superclass, so flags start at 1 << 4
// Module flags
public static final int CACHEPROXY_F = 1 << 4;
public static final int NEEDSIMPL_F = 1 << 5;
public static final int REFINED_MODULE_F = 1 << 6;
public static final int IS_OVERLAID_F = 1 << 7;

public static final int CR_7BIT_F = registry.newFlag(RubyString.class);
public static final int CR_VALID_F = registry.newFlag(RubyString.class);
// String flags
public static final int CR_7BIT_F = 1 << 4;
public static final int CR_VALID_F = 1 << 5;

public static final int STRIO_READABLE = registry.newFlag(StringIO.class);
public static final int STRIO_WRITABLE = registry.newFlag(StringIO.class);
// StringIO flags
public static final int STRIO_READABLE = 1 << 4;
public static final int STRIO_WRITABLE = 1 << 5;

public static final int MATCH_BUSY = registry.newFlag(RubyMatchData.class);
// MatchData flags
public static final int MATCH_BUSY = 1 << 4;

public static final int COMPARE_BY_IDENTITY_F = registry.newFlag(RubyHash.class);
public static final int PROCDEFAULT_HASH_F = registry.newFlag(RubyHash.class);
// Hash flags
public static final int COMPARE_BY_IDENTITY_F = 1 << 4;
public static final int PROCDEFAULT_HASH_F = 1 << 5;

private static final boolean DEBUG = false;
static {
if (DEBUG) registry.printFlags();
}

private static String jruby_revision = "@jruby.revision@";

@Deprecated