Skip to content

Commit 259ab45

Browse files
committed
Merge branch 'master' into truffle-head
2 parents bff6243 + 156ac52 commit 259ab45

File tree

35 files changed

+145
-295
lines changed

35 files changed

+145
-295
lines changed

core/src/main/java/org/jruby/RubyString.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -240,18 +240,15 @@ public final boolean isBrokenString() {
240240
}
241241

242242
private void copyCodeRangeForSubstr(RubyString from, Encoding enc) {
243-
int fromCr = from.getCodeRange();
244-
if (fromCr == CR_7BIT) {
245-
setCodeRange(fromCr);
246-
} else if (fromCr == CR_VALID) {
247-
if (!enc.isAsciiCompatible() || searchNonAscii(value) != -1) {
248-
setCodeRange(CR_VALID);
243+
244+
if (value.getRealSize() == 0) {
245+
setCodeRange(!enc.isAsciiCompatible() ? CR_VALID : CR_7BIT);
246+
} else {
247+
int fromCr = from.getCodeRange();
248+
if (fromCr == CR_7BIT) {
249+
setCodeRange(fromCr);
249250
} else {
250-
setCodeRange(CR_7BIT);
251-
}
252-
} else{
253-
if (value.getRealSize() == 0) {
254-
setCodeRange(!enc.isAsciiCompatible() ? CR_VALID : CR_7BIT);
251+
setCodeRange(CR_UNKNOWN);
255252
}
256253
}
257254
}

core/src/main/java/org/jruby/internal/runtime/methods/MethodNodes.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717

1818
public class MethodNodes {
1919

20-
// TODO(CS): MethodNodes will never leave this cache
21-
private final static Map<String, MethodNodes> cache = new ConcurrentHashMap<>();
22-
2320
private final ArgsNode argsNode;
2421
private final Node bodyNode;
2522

@@ -39,13 +36,4 @@ public Node getBodyNode() {
3936
return bodyNode;
4037
}
4138

42-
public static void cache(String methodJavaName, MethodNodes nodes) {
43-
cache.put(methodJavaName, nodes);
44-
}
45-
46-
public static MethodNodes lookup(String methodJavaName) {
47-
return cache.get(methodJavaName);
48-
}
49-
50-
5139
}

core/src/main/java/org/jruby/ir/IRMethod.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public IRMethod(IRManager manager, IRScope lexicalParent, MethodDefNode defn, St
3535

3636
if (!getManager().isDryRun() && staticScope != null) {
3737
staticScope.setIRScope(this);
38-
staticScope.setScopeType(this.getScopeType());
3938
}
4039
}
4140

core/src/main/java/org/jruby/ir/IRModuleBody.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ public IRModuleBody(IRManager manager, IRScope lexicalParent, String name,
1515

1616
if (!getManager().isDryRun()) {
1717
updateVersion();
18-
if (staticScope != null) {
19-
staticScope.setIRScope(this);
20-
staticScope.setScopeType(this.getScopeType());
21-
}
18+
if (staticScope != null) staticScope.setIRScope(this);
2219
}
2320
}
2421

core/src/main/java/org/jruby/ir/IRScriptBody.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public IRScriptBody(IRManager manager, String sourceName, StaticScope staticScop
1818
this.toplevelScope = null;
1919
if (!getManager().isDryRun() && staticScope != null) {
2020
staticScope.setIRScope(this);
21-
staticScope.setScopeType(this.getScopeType());
2221
}
2322
}
2423

core/src/main/java/org/jruby/parser/StaticScope.java

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,8 @@ public class StaticScope implements Serializable {
8686

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

91-
private int scopeId;
9291
private IRScope irScope; // Method/Closure that this static scope corresponds to
9392

9493
public enum Type {
@@ -134,10 +133,6 @@ public IRScope getIRScope() {
134133
return irScope;
135134
}
136135

137-
public int getScopeId() {
138-
return scopeId;
139-
}
140-
141136
public IRScopeType getScopeType() {
142137
return scopeType;
143138
}
@@ -146,16 +141,9 @@ public void setScopeType(IRScopeType scopeType) {
146141
this.scopeType = scopeType;
147142
}
148143

149-
public void setIRScope(IRScope irScope, boolean isForLoopBody) {
150-
if (!isForLoopBody) {
151-
this.irScope = irScope;
152-
}
153-
this.scopeId = irScope.getScopeId();
154-
this.scopeType = irScope.getScopeType();
155-
}
156-
157144
public void setIRScope(IRScope irScope) {
158-
setIRScope(irScope, false);
145+
this.irScope = irScope;
146+
this.scopeType = irScope.getScopeType();
159147
}
160148

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

236-
/* Note: Only used by compiler until it can use getConstant again or use some other refactoring */
237-
public IRubyObject getConstantWithConstMissing(String internedName) {
238-
IRubyObject result = getConstantInner(internedName);
239-
240-
// If we could not find the constant from cref..then try getting from inheritence hierarchy
241-
return result == null ? cref.getConstant(internedName) : result;
242-
}
243-
244-
public boolean isConstantDefined(String internedName) {
245-
return getConstant(internedName) != null;
246-
}
247-
248224
public IRubyObject getConstant(String internedName) {
249225
IRubyObject result = getConstantInner(internedName);
250226

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

271-
public IRubyObject setConstant(String internedName, IRubyObject result) {
272-
RubyModule module;
273-
274-
if ((module = getModule()) != null) {
275-
module.setConstant(internedName, result);
276-
return result;
277-
}
278-
279-
// TODO: wire into new exception handling mechanism
280-
throw result.getRuntime().newTypeError("no class/module to define constant");
281-
}
282-
283247
/**
284248
* Next outer most scope in list of scopes. An enclosing scope may have no direct scoping
285249
* relationship to its child. If I am in a localScope and then I enter something which

core/src/main/java/org/jruby/runtime/Helpers.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -656,12 +656,6 @@ public static IRubyObject fetchClassVariable(Ruby runtime, StaticScope scope,
656656
return rubyClass.getClassVar(name);
657657
}
658658

659-
public static IRubyObject getConstant(ThreadContext context, String internedName) {
660-
Ruby runtime = context.runtime;
661-
662-
return context.getCurrentScope().getStaticScope().getConstantWithConstMissing(internedName);
663-
}
664-
665659
public static IRubyObject nullToNil(IRubyObject value, ThreadContext context) {
666660
return value != null ? value : context.nil;
667661
}
@@ -1195,15 +1189,11 @@ public static IRubyObject setConstantInModule(ThreadContext context, String name
11951189
if (!(module instanceof RubyModule)) {
11961190
throw context.runtime.newTypeError(module.toString() + " is not a class/module");
11971191
}
1198-
((RubyModule)module).setConstant(name, value);
1192+
((RubyModule) module).setConstant(name, value);
11991193

12001194
return value;
12011195
}
12021196

1203-
public static IRubyObject setConstantInCurrent(IRubyObject value, ThreadContext context, String name) {
1204-
return context.getCurrentStaticScope().setConstant(name, value);
1205-
}
1206-
12071197
public static final int MAX_SPECIFIC_ARITY_OBJECT_ARRAY = 10;
12081198

12091199
public static IRubyObject[] anewarrayIRubyObjects(int size) {

core/src/main/ruby/jruby/jruby.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,15 @@ def parse(content = nil, filename = (default_filename = true; '-'), extra_positi
6464

6565
def compile_ir(content = nil, filename = (default_filename = true; '-'), extra_position_info = false, &block)
6666
runtime = JRuby.runtime
67+
manager = org.jruby.ir.IRManager.new(runtime.instance_config)
68+
manager.dry_run = true
6769
node = if default_filename
6870
parse(content, &block)
6971
else
7072
parse(content, filename, extra_position_info, &block)
7173
end
7274

73-
scope = org.jruby.ir.IRBuilder.build_root(runtime.getIRManager(), node).scope
75+
scope = org.jruby.ir.IRBuilder.build_root(manager, node).scope
7476
scope.top_level_binding_scope = node.scope
7577

7678
scope

lib/ruby/truffle/mri/monitor.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require_relative '../../stdlib/monitor'

maven/jruby-complete/src/it/bouncycastle-with-bc-gem/invoker.properties

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)