Permalink
Browse files

Merge branch 'master' into komax_ast_tool_rewrite

  • Loading branch information...
2 parents 4aedd40 + 783b8a5 commit d8f367d735f2a314e48ee69eb86917619dc0d801 @komax komax committed Jul 11, 2013
View
@@ -50,6 +50,8 @@ See [README.test](docs/README.test.md) for more information.
Visit http://jruby.org for more information.
+Visit http://jruby.github.io/jruby for the Maven Site documentation.
+
## License
Read the [COPYING](COPYING) file.
View
@@ -32,12 +32,11 @@
<developerConnection>scm:git:ssh://git@github.com/jruby/jruby.git</developerConnection>
<url>http://github.com/jruby/jruby</url>
</scm>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jruby.joni</groupId>
@@ -90,7 +89,7 @@
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jffi</artifactId>
- <version>1.2.5</version>
+ <version>1.2.7</version>
<type>jar</type>
</dependency>
<dependency>
@@ -102,7 +101,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
- <version>1.11</version>
+ <version>1.12</version>
<type>jar</type>
</dependency>
<dependency>
@@ -120,21 +119,21 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>4.3.1</version>
+ <version>5.0.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.8.4</version>
+ <version>1.9.1</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jay-yydebug</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
<type>jar</type>
</dependency>
<dependency>
@@ -172,7 +171,7 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>yecht</groupId>
+ <groupId>org.jruby</groupId>
<artifactId>yecht</artifactId>
<version>1.0</version>
<type>jar</type>
@@ -229,6 +228,7 @@
<!-- any version which is on maven repo will do -->
<tzdata.jar.version>2013c</tzdata.jar.version>
<tzdata.scope>provided</tzdata.scope>
+ <main.basedir>${project.parent.basedir}</main.basedir>
</properties>
<build>
<defaultGoal>package</defaultGoal>
@@ -503,8 +503,10 @@ public void runFromMain(InputStream inputStream, String filename) {
Node scriptNode = parseFromMain(inputStream, filename);
- // done with the stream, shut it down
- try {inputStream.close();} catch (IOException ioe) {}
+ // if no DATA, we're done with the stream, shut it down
+ if (fetchGlobalConstant("DATA") == null) {
+ try {inputStream.close();} catch (IOException ioe) {}
+ }
ThreadContext context = getCurrentContext();
@@ -1093,11 +1095,26 @@ public void setKCode(KCode kcode) {
}
/** rb_define_global_const
- *
+ * Define a constant on the global namespace (i.e. Object) with the given
+ * name and value.
+ *
+ * @param name the name
+ * @param value the value
*/
public void defineGlobalConstant(String name, IRubyObject value) {
objectClass.defineConstant(name, value);
}
+
+ /**
+ * Fetch a constant from the global namespace (i.e. Object) with the given
+ * name.
+ *
+ * @param name the name
+ * @return the value
+ */
+ public IRubyObject fetchGlobalConstant(String name) {
+ return objectClass.fetchConstant(name, false);
+ }
public boolean isClassDefined(String name) {
return getModule(name) != null;
@@ -1631,7 +1648,6 @@ private void initBuiltins() {
addLazyBuiltin("ffi-internal.jar", "ffi-internal", "org.jruby.ext.ffi.FFIService");
addLazyBuiltin("tempfile.jar", "tempfile", "org.jruby.ext.tempfile.TempfileLibrary");
addLazyBuiltin("fcntl.rb", "fcntl", "org.jruby.ext.fcntl.FcntlLibrary");
- addLazyBuiltin("rubinius.jar", "rubinius", "org.jruby.ext.rubinius.RubiniusLibrary");
addLazyBuiltin("yecht.jar", "yecht", "YechtService");
addLazyBuiltin("io/try_nonblock.jar", "io/try_nonblock", "org.jruby.ext.io.try_nonblock.IOTryNonblockLibrary");
addLazyBuiltin("pathname_ext.jar", "pathname_ext", "org.jruby.ext.pathname.PathnameLibrary");
@@ -57,8 +57,7 @@
protected final Node receiverNode;
private String name;
private Node argsNode;
- public CallSite variableCallAdapter;
- public CallSite normalCallAdapter;
+ public CallSite callAdapter;
public AttrAssignNode(ISourcePosition position, Node receiverNode, String name, Node argsNode) {
super(position);
@@ -72,8 +71,9 @@ public AttrAssignNode(ISourcePosition position, Node receiverNode, String name,
this.receiverNode = receiverNode;
this.name = name;
setArgsInternal(argsNode);
- this.normalCallAdapter = MethodIndex.getCallSite(name);
- this.variableCallAdapter = MethodIndex.getVariableCallSite(name);
+ this.callAdapter = receiverNode instanceof SelfNode ?
+ MethodIndex.getFunctionalCallSite(name) :
+ MethodIndex.getCallSite(name);
}
public NodeType getNodeType() {
@@ -198,7 +198,7 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
// If reciever is self then we do the call the same way as vcall
CallSite callSite;
- callSite = selectCallSite(self, receiver);
+ callSite = callAdapter;
callSite.call(context, self, receiver, args);
return args[args.length - 1];
@@ -212,10 +212,6 @@ protected static String receiverClassName(IRubyObject object) {
return object.getClass().getName();
}
- protected CallSite selectCallSite( IRubyObject self,IRubyObject receiver) {
- return (receiver == self) ? variableCallAdapter : normalCallAdapter;
- }
-
@Override
public IRubyObject assign(Ruby runtime, ThreadContext context, IRubyObject self, IRubyObject value, Block block, boolean checkArity) {
IRubyObject receiver = receiverNode.interpret(runtime, context, self, block);
@@ -35,7 +35,7 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
assert hasMetaClass(receiver) : receiverClassName(receiver);
// If reciever is self then we do the call the same way as vcall
- CallSite callSite = selectCallSite(self, receiver);
+ CallSite callSite = callAdapter;
callSite.call(context, self, receiver, param1);
return param1;
@@ -50,7 +50,7 @@ public IRubyObject assign(Ruby runtime, ThreadContext context, IRubyObject self,
assert hasMetaClass(receiver) : receiverClassName(receiver);
// If reciever is self then we do the call the same way as vcall
- CallSite callSite = selectCallSite(self, receiver);
+ CallSite callSite = callAdapter;
callSite.call(context, self, receiver, param1, value);
return runtime.getNil();
@@ -42,7 +42,7 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
assert hasMetaClass(receiver) : receiverClassName(receiver);
// If reciever is self then we do the call the same way as vcall
- CallSite callSite = selectCallSite(self, receiver);
+ CallSite callSite = callAdapter;
callSite.call(context, self, receiver, param1, param2, param3);
return param3;
@@ -59,7 +59,7 @@ public IRubyObject assign(Ruby runtime, ThreadContext context, IRubyObject self,
assert hasMetaClass(receiver) : receiverClassName(receiver);
// If reciever is self then we do the call the same way as vcall
- CallSite callSite = selectCallSite(self, receiver);
+ CallSite callSite = callAdapter;
callSite.call(context, self, receiver, param1, param2, param3, value);
return runtime.getNil();
@@ -38,7 +38,7 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
assert hasMetaClass(receiver) : receiverClassName(receiver);
// If reciever is self then we do the call the same way as vcall
- CallSite callSite = selectCallSite(self, receiver);
+ CallSite callSite = callAdapter;
callSite.call(context, self, receiver, param1, param2);
return param2;
@@ -54,7 +54,7 @@ public IRubyObject assign(Ruby runtime, ThreadContext context, IRubyObject self,
assert hasMetaClass(receiver) : receiverClassName(receiver);
// If reciever is self then we do the call the same way as vcall
- CallSite callSite = selectCallSite(self, receiver);
+ CallSite callSite = callAdapter;
callSite.call(context, self, receiver, param1, param2, value);
return runtime.getNil();
@@ -88,7 +88,7 @@ public void call(BodyCompiler context) {
}
public void invokeAttrAssign(String name, CompilerCallback receiverCallback, ArgumentsCallback argsCallback, boolean isSelf, boolean expr) {
- methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, name, isSelf ? CallType.VARIABLE : CallType.NORMAL);
+ methodCompiler.getScriptCompiler().getCacheCompiler().cacheCallSite(methodCompiler, name, isSelf ? CallType.FUNCTIONAL : CallType.NORMAL);
methodCompiler.loadThreadContext(); // [adapter, tc]
@@ -12,6 +12,8 @@
public class InputStreamLexerSource extends LexerSource {
private static final int INITIAL_PUSHBACK_SIZE = 100;
+ public static final int DATA_READ_BUFFER_SIZE = 65536;
+
// Where we get our newest char's
private final InputStream in;
@@ -317,20 +319,6 @@ public ByteList readUntil(char marker) throws IOException {
@Override
public InputStream getRemainingAsStream() throws IOException {
- return bufferEntireStream(in);
- }
-
- private InputStream bufferEntireStream(InputStream stream) throws IOException {
- byte[] allBytes = new byte[0];
- byte[] b = new byte[1024];
- int bytesRead;
- while ((bytesRead = stream.read(b)) != -1) {
- byte[] newbuf = new byte[allBytes.length + bytesRead];
- System.arraycopy(allBytes, 0, newbuf, 0, allBytes.length);
- System.arraycopy(b, 0, newbuf, allBytes.length, bytesRead);
- allBytes = newbuf;
- }
-
- return new ByteArrayInputStream(allBytes);
+ return in;
}
}
@@ -1,6 +1,6 @@
# Create convenience methods for top-level java packages so we do not need to prefix
# with 'Java::'. We undef these methods within Package in case we run into 'com.foo.com'.
-[:java, :javax, :com, :org].each do |meth|
+[:java, :javax, :javafx, :com, :org].each do |meth|
Kernel.module_eval <<-EOM
def #{meth}
JavaUtilities.get_package_module_dot_format('#{meth}')
Oops, something went wrong.

0 comments on commit d8f367d

Please sign in to comment.