Skip to content

Commit

Permalink
Merge branch 'master' into truffle-head
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Apr 19, 2015
2 parents bff6243 + 156ac52 commit 259ab45
Show file tree
Hide file tree
Showing 35 changed files with 145 additions and 295 deletions.
19 changes: 8 additions & 11 deletions core/src/main/java/org/jruby/RubyString.java
Expand Up @@ -240,18 +240,15 @@ public final boolean isBrokenString() {
}

private void copyCodeRangeForSubstr(RubyString from, Encoding enc) {
int fromCr = from.getCodeRange();
if (fromCr == CR_7BIT) {
setCodeRange(fromCr);
} else if (fromCr == CR_VALID) {
if (!enc.isAsciiCompatible() || searchNonAscii(value) != -1) {
setCodeRange(CR_VALID);

if (value.getRealSize() == 0) {
setCodeRange(!enc.isAsciiCompatible() ? CR_VALID : CR_7BIT);
} else {
int fromCr = from.getCodeRange();
if (fromCr == CR_7BIT) {
setCodeRange(fromCr);
} else {
setCodeRange(CR_7BIT);
}
} else{
if (value.getRealSize() == 0) {
setCodeRange(!enc.isAsciiCompatible() ? CR_VALID : CR_7BIT);
setCodeRange(CR_UNKNOWN);
}
}
}
Expand Down
Expand Up @@ -17,9 +17,6 @@

public class MethodNodes {

// TODO(CS): MethodNodes will never leave this cache
private final static Map<String, MethodNodes> cache = new ConcurrentHashMap<>();

private final ArgsNode argsNode;
private final Node bodyNode;

Expand All @@ -39,13 +36,4 @@ public Node getBodyNode() {
return bodyNode;
}

public static void cache(String methodJavaName, MethodNodes nodes) {
cache.put(methodJavaName, nodes);
}

public static MethodNodes lookup(String methodJavaName) {
return cache.get(methodJavaName);
}


}
1 change: 0 additions & 1 deletion core/src/main/java/org/jruby/ir/IRMethod.java
Expand Up @@ -35,7 +35,6 @@ public IRMethod(IRManager manager, IRScope lexicalParent, MethodDefNode defn, St

if (!getManager().isDryRun() && staticScope != null) {
staticScope.setIRScope(this);
staticScope.setScopeType(this.getScopeType());
}
}

Expand Down
5 changes: 1 addition & 4 deletions core/src/main/java/org/jruby/ir/IRModuleBody.java
Expand Up @@ -15,10 +15,7 @@ public IRModuleBody(IRManager manager, IRScope lexicalParent, String name,

if (!getManager().isDryRun()) {
updateVersion();
if (staticScope != null) {
staticScope.setIRScope(this);
staticScope.setScopeType(this.getScopeType());
}
if (staticScope != null) staticScope.setIRScope(this);
}
}

Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/org/jruby/ir/IRScriptBody.java
Expand Up @@ -18,7 +18,6 @@ public IRScriptBody(IRManager manager, String sourceName, StaticScope staticScop
this.toplevelScope = null;
if (!getManager().isDryRun() && staticScope != null) {
staticScope.setIRScope(this);
staticScope.setScopeType(this.getScopeType());
}
}

Expand Down
42 changes: 3 additions & 39 deletions core/src/main/java/org/jruby/parser/StaticScope.java
Expand Up @@ -86,9 +86,8 @@ public class StaticScope implements Serializable {

private Type type;
private boolean isBlockOrEval;
private boolean isArgumentScope; // Is this block and argument scope of a define_method (for the purposes of zsuper).
private boolean isArgumentScope; // Is this block and argument scope of a define_method.

private int scopeId;
private IRScope irScope; // Method/Closure that this static scope corresponds to

public enum Type {
Expand Down Expand Up @@ -134,10 +133,6 @@ public IRScope getIRScope() {
return irScope;
}

public int getScopeId() {
return scopeId;
}

public IRScopeType getScopeType() {
return scopeType;
}
Expand All @@ -146,16 +141,9 @@ public void setScopeType(IRScopeType scopeType) {
this.scopeType = scopeType;
}

public void setIRScope(IRScope irScope, boolean isForLoopBody) {
if (!isForLoopBody) {
this.irScope = irScope;
}
this.scopeId = irScope.getScopeId();
this.scopeType = irScope.getScopeType();
}

public void setIRScope(IRScope irScope) {
setIRScope(irScope, false);
this.irScope = irScope;
this.scopeType = irScope.getScopeType();
}

/**
Expand Down Expand Up @@ -233,18 +221,6 @@ public void setVariables(String[] names) {
System.arraycopy(names, 0, variableNames, 0, names.length);
}

/* Note: Only used by compiler until it can use getConstant again or use some other refactoring */
public IRubyObject getConstantWithConstMissing(String internedName) {
IRubyObject result = getConstantInner(internedName);

// If we could not find the constant from cref..then try getting from inheritence hierarchy
return result == null ? cref.getConstant(internedName) : result;
}

public boolean isConstantDefined(String internedName) {
return getConstant(internedName) != null;
}

public IRubyObject getConstant(String internedName) {
IRubyObject result = getConstantInner(internedName);

Expand All @@ -268,18 +244,6 @@ private IRubyObject getConstantInnerNoObject(String internedName) {
return getConstantInner(internedName);
}

public IRubyObject setConstant(String internedName, IRubyObject result) {
RubyModule module;

if ((module = getModule()) != null) {
module.setConstant(internedName, result);
return result;
}

// TODO: wire into new exception handling mechanism
throw result.getRuntime().newTypeError("no class/module to define constant");
}

/**
* Next outer most scope in list of scopes. An enclosing scope may have no direct scoping
* relationship to its child. If I am in a localScope and then I enter something which
Expand Down
12 changes: 1 addition & 11 deletions core/src/main/java/org/jruby/runtime/Helpers.java
Expand Up @@ -656,12 +656,6 @@ public static IRubyObject fetchClassVariable(Ruby runtime, StaticScope scope,
return rubyClass.getClassVar(name);
}

public static IRubyObject getConstant(ThreadContext context, String internedName) {
Ruby runtime = context.runtime;

return context.getCurrentScope().getStaticScope().getConstantWithConstMissing(internedName);
}

public static IRubyObject nullToNil(IRubyObject value, ThreadContext context) {
return value != null ? value : context.nil;
}
Expand Down Expand Up @@ -1195,15 +1189,11 @@ public static IRubyObject setConstantInModule(ThreadContext context, String name
if (!(module instanceof RubyModule)) {
throw context.runtime.newTypeError(module.toString() + " is not a class/module");
}
((RubyModule)module).setConstant(name, value);
((RubyModule) module).setConstant(name, value);

return value;
}

public static IRubyObject setConstantInCurrent(IRubyObject value, ThreadContext context, String name) {
return context.getCurrentStaticScope().setConstant(name, value);
}

public static final int MAX_SPECIFIC_ARITY_OBJECT_ARRAY = 10;

public static IRubyObject[] anewarrayIRubyObjects(int size) {
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/ruby/jruby/jruby.rb
Expand Up @@ -64,13 +64,15 @@ def parse(content = nil, filename = (default_filename = true; '-'), extra_positi

def compile_ir(content = nil, filename = (default_filename = true; '-'), extra_position_info = false, &block)
runtime = JRuby.runtime
manager = org.jruby.ir.IRManager.new(runtime.instance_config)
manager.dry_run = true
node = if default_filename
parse(content, &block)
else
parse(content, filename, extra_position_info, &block)
end

scope = org.jruby.ir.IRBuilder.build_root(runtime.getIRManager(), node).scope
scope = org.jruby.ir.IRBuilder.build_root(manager, node).scope
scope.top_level_binding_scope = node.scope

scope
Expand Down
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/monitor.rb
@@ -0,0 +1 @@
require_relative '../../stdlib/monitor'

This file was deleted.

65 changes: 0 additions & 65 deletions maven/jruby-complete/src/it/bouncycastle-with-bc-gem/pom.xml

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions maven/jruby-complete/src/it/bouncycastle/invoker.properties

This file was deleted.

43 changes: 0 additions & 43 deletions maven/jruby-complete/src/it/bouncycastle/pom.xml

This file was deleted.

This file was deleted.

Expand Up @@ -46,7 +46,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<bc.version>1.49</bc.version>
<bc.version>1.50</bc.version>
</properties>

<build>
Expand Down

0 comments on commit 259ab45

Please sign in to comment.