Charles Oliver Nutter wrote:
Attached is a simple patch that adds enough basic method annotation
support to JRuby to eliminate manually binding zero, one, two, and
three-parameter non-static "fast" methods.
Attached is the latest update. This version does all of the following:
- adds optional arg count, alias, singleton (metaclass) details to
JRubyMethod annotation
- adds logic to RubyModule to handle optional args, aliases, singleton
methods, and static target methods
- replaces all Fixnum initialization with annotation logic
- upgrades to ASM 3.0 (needed for Retroweaver)
- adds a "jar-1.4" target that uses Retroweaver to replace jruby.jar
with a 1.4-compatible version
- modifies the build to produce Java 1.5 output
The updated JARs aren't included in this patch, but you get the idea.
This passes all tests under Java 5 and Java 6, and the jar-1.4 jruby.jar
passes all tests I've tried under Java 1.4 (can't test Java 1.4 during
the build at the moment).
What do you say, folks?
- Charlie
Index: nbproject/project.xml
===================================================================
--- nbproject/project.xml (revision 4083)
+++ nbproject/project.xml (working copy)
@@ -63,14 +63,14 @@
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
<compilation-unit>
<package-root>src</package-root>
- <classpath
mode="compile">lib/bsf.jar:lib/junit.jar:lib/asm-2.2.3.jar:lib/asm-commons-2.2.3.jar:lib/jline-0.9.91.jar:lib/backport-util-concurrent.jar:lib/ant.jar:lib/asm-util-2.2.3.jar</classpath>
- <source-level>1.4</source-level>
+ <classpath
mode="compile">lib/bsf.jar:lib/junit.jar:lib/jline-0.9.91.jar:lib/backport-util-concurrent.jar:lib/ant.jar:lib/asm-3.0.jar:lib/asm-commons-3.0.jar:lib/asm-util-3.0.jar</classpath>
+ <source-level>1.5</source-level>
</compilation-unit>
<compilation-unit>
<package-root>test</package-root>
<unit-tests/>
<classpath
mode="compile">lib/bsf.jar:lib/junit.jar:src</classpath>
- <source-level>1.4</source-level>
+ <source-level>1.5</source-level>
</compilation-unit>
</java-data>
</configuration>
Index: src/org/jruby/runtime/callback/InvocationCallbackFactory.java
===================================================================
--- src/org/jruby/runtime/callback/InvocationCallbackFactory.java
(revision 4083)
+++ src/org/jruby/runtime/callback/InvocationCallbackFactory.java
(working copy)
@@ -93,7 +93,7 @@
}
private ClassWriter createCtor(String namePath) throws Exception {
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cw.visit(V1_4, ACC_PUBLIC + ACC_SUPER, namePath, null, SUPER_CLASS,
null);
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null,
null);
mv.visitCode();
@@ -106,7 +106,7 @@
}
private ClassWriter createCtorDispatcher(String namePath, Map switchMap)
throws Exception {
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cw.visit(V1_4, ACC_PUBLIC + ACC_SUPER, namePath, null,
cg.p(Dispatcher.class), null);
SkinnyMethodAdapter mv = new
SkinnyMethodAdapter(cw.visitMethod(ACC_PUBLIC, "<init>", cg.sig(Void.TYPE,
cg.params(Ruby.class)), null, null));
mv.visitCode();
@@ -147,7 +147,7 @@
}
private ClassWriter createCtorFast(String namePath) throws Exception {
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cw.visit(V1_4, ACC_PUBLIC + ACC_SUPER, namePath, null,
FAST_SUPER_CLASS, null);
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null,
null);
mv.visitCode();
@@ -160,7 +160,7 @@
}
private ClassWriter createBlockCtor(String namePath) throws Exception {
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cw.visit(V1_4, ACC_PUBLIC + ACC_SUPER, namePath, null,
cg.p(Object.class),
new String[] { cg.p(CompiledBlockCallback.class) });
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null,
null);
Index: src/org/jruby/internal/runtime/methods/InvocationMethodFactory.java
===================================================================
--- src/org/jruby/internal/runtime/methods/InvocationMethodFactory.java
(revision 4083)
+++ src/org/jruby/internal/runtime/methods/InvocationMethodFactory.java
(working copy)
@@ -81,7 +81,7 @@
}
private ClassWriter createCompiledCtor(String namePath, String sup) throws
Exception {
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cw.visit(V1_4, ACC_PUBLIC + ACC_SUPER, namePath, null, sup, null);
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>",
COMPILED_SUPER_SIG, null, null);
mv.visitCode();
Index:
src/org/jruby/internal/runtime/methods/DumpingInvocationMethodFactory.java
===================================================================
--- src/org/jruby/internal/runtime/methods/DumpingInvocationMethodFactory.java
(revision 4083)
+++ src/org/jruby/internal/runtime/methods/DumpingInvocationMethodFactory.java
(working copy)
@@ -71,7 +71,7 @@
}
private ClassWriter createCompiledCtor(String namePath, String sup) throws
Exception {
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cw.visit(V1_4, ACC_PUBLIC + ACC_SUPER, namePath, null, sup, null);
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>",
COMPILED_SUPER_SIG, null, null);
mv.visitCode();
Index: src/org/jruby/RubyJRuby.java
===================================================================
--- src/org/jruby/RubyJRuby.java (revision 4083)
+++ src/org/jruby/RubyJRuby.java (working copy)
@@ -42,6 +42,7 @@
import org.jruby.compiler.ASTInspector;
import org.jruby.compiler.NodeCompilerFactory;
import org.jruby.compiler.impl.StandardASMCompiler;
+import org.objectweb.asm.ClassReader;
/**
* Module which defines JRuby-specific methods for use.
@@ -177,7 +178,7 @@
java.io.StringWriter sw = new java.io.StringWriter();
org.objectweb.asm.ClassReader cr = new
org.objectweb.asm.ClassReader((byte[])org.jruby.javasupport.JavaUtil.convertRubyToJava(recv.getInstanceVariable("@code"),byte[].class));
org.objectweb.asm.util.TraceClassVisitor cv = new
org.objectweb.asm.util.TraceClassVisitor(new java.io.PrintWriter(sw));
- cr.accept(cv, true);
+ cr.accept(cv, ClassReader.SKIP_DEBUG);
return recv.getRuntime().newString(sw.toString());
}
Index: src/org/jruby/javasupport/proxy/JavaProxyClassFactory.java
===================================================================
--- src/org/jruby/javasupport/proxy/JavaProxyClassFactory.java (revision 4083)
+++ src/org/jruby/javasupport/proxy/JavaProxyClassFactory.java (working copy)
@@ -269,7 +269,7 @@
private static ClassWriter beginProxyClass(final String targetClassName,
final Class superClass, final Class[] interfaces) {
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
int access = Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL |
Opcodes.ACC_STATIC;
String name = toInternalClassName(targetClassName);
Index: src/org/jruby/RubyModule.java
===================================================================
--- src/org/jruby/RubyModule.java (revision 4083)
+++ src/org/jruby/RubyModule.java (working copy)
@@ -35,6 +35,8 @@
***** END LICENSE BLOCK *****/
package org.jruby;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -43,6 +45,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.jruby.anno.JRubyMethod;
import org.jruby.internal.runtime.methods.AliasMethod;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.internal.runtime.methods.FullFunctionCallbackMethod;
@@ -581,7 +584,65 @@
Visibility.PRIVATE : Visibility.PUBLIC;
addMethod(name, new FullFunctionCallbackMethod(this, method,
visibility));
}
+
+ public void defineAnnotatedMethods(Class clazz, CallbackFactory
callbackFactory) {
+ Method[] methods = clazz.getDeclaredMethods();
+ for (Method method: methods) {
+ JRubyMethod jrubyMethod = method.getAnnotation(JRubyMethod.class);
+
+ if (jrubyMethod == null) continue;
+
+ // select current module or module's metaclass for singleton
methods
+ RubyModule module = this;
+ if (jrubyMethod.singleton()) module = getMetaClass();
+ if (jrubyMethod.optional() != 0) {
+ if (Modifier.isStatic(method.getModifiers())) {
+ module.defineFastMethod(jrubyMethod.name(),
callbackFactory.getFastOptSingletonMethod(method.getName()));
+ } else {
+ module.defineFastMethod(jrubyMethod.name(),
callbackFactory.getFastOptMethod(method.getName()));
+ }
+ } else {
+ switch (jrubyMethod.required()) {
+ case 0:
+ if (Modifier.isStatic(method.getModifiers())) {
+ module.defineFastMethod(jrubyMethod.name(),
callbackFactory.getFastSingletonMethod(method.getName()));
+ } else {
+ module.defineFastMethod(jrubyMethod.name(),
callbackFactory.getFastMethod(method.getName()));
+ }
+ break;
+ case 1:
+ if (Modifier.isStatic(method.getModifiers())) {
+ module.defineFastMethod(jrubyMethod.name(),
callbackFactory.getFastSingletonMethod(method.getName(), IRubyObject.class));
+ } else {
+ module.defineFastMethod(jrubyMethod.name(),
callbackFactory.getFastMethod(method.getName(), IRubyObject.class));
+ }
+ break;
+ case 2:
+ if (Modifier.isStatic(method.getModifiers())) {
+ module.defineFastMethod(jrubyMethod.name(),
callbackFactory.getFastSingletonMethod(method.getName(), IRubyObject.class,
IRubyObject.class));
+ } else {
+ module.defineFastMethod(jrubyMethod.name(),
callbackFactory.getFastMethod(method.getName(), IRubyObject.class,
IRubyObject.class));
+ }
+ break;
+ case 3:
+ if (Modifier.isStatic(method.getModifiers())) {
+ module.defineFastMethod(jrubyMethod.name(),
callbackFactory.getFastSingletonMethod(method.getName(), IRubyObject.class,
IRubyObject.class, IRubyObject.class));
+ } else {
+ module.defineFastMethod(jrubyMethod.name(),
callbackFactory.getFastMethod(method.getName(), IRubyObject.class,
IRubyObject.class, IRubyObject.class));
+ }
+ break;
+ default:
+ throw new RuntimeException("Invalid number of required
args for annotated method");
+ }
+ }
+
+ if (jrubyMethod.alias() != "") {
+ module.defineAlias(jrubyMethod.alias(), jrubyMethod.name());
+ }
+ }
+ }
+
public void defineFastMethod(String name, Callback method) {
Visibility visibility = name.equals("initialize") ?
Visibility.PRIVATE : Visibility.PUBLIC;
Index: src/org/jruby/anno/JRubyMethod.java
===================================================================
--- src/org/jruby/anno/JRubyMethod.java (revision 0)
+++ src/org/jruby/anno/JRubyMethod.java (revision 0)
@@ -0,0 +1,29 @@
+/*
+ * JRubyMethod.java
+ *
+ * Created on Aug 4, 2007, 3:07:36 PM
+ *
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jruby.anno;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * @author headius
+ */
[EMAIL PROTECTED](RetentionPolicy.RUNTIME)
[EMAIL PROTECTED](ElementType.METHOD)
+public @interface JRubyMethod {
+ String name();
+ int required() default 0;
+ int optional() default 0;
+ String alias() default "";
+ boolean singleton() default false;
+}
Index: src/org/jruby/compiler/impl/StandardASMCompiler.java
===================================================================
--- src/org/jruby/compiler/impl/StandardASMCompiler.java (revision 4083)
+++ src/org/jruby/compiler/impl/StandardASMCompiler.java (working copy)
@@ -175,7 +175,7 @@
}
public void startScript() {
- classWriter = new ClassWriter(true);
+ classWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS);
// Create the class with the appropriate class name and source file
classWriter.visit(V1_4, ACC_PUBLIC + ACC_SUPER, classname, null,
cg.p(Object.class), new String[]{cg.p(Script.class)});
Index: src/org/jruby/compiler/impl/SkinnyMethodAdapter.java
===================================================================
--- src/org/jruby/compiler/impl/SkinnyMethodAdapter.java (revision 4083)
+++ src/org/jruby/compiler/impl/SkinnyMethodAdapter.java (working copy)
@@ -391,4 +391,8 @@
mv.visitTableSwitchInsn(min, max, defaultLabel, cases);
}
+ public void visitFrame(int arg0, int arg1, Object[] arg2, int arg3,
Object[] arg4) {
+ mv.visitFrame(arg0, arg1, arg2, arg3, arg4);
+ }
+
}
Index: src/org/jruby/RubyFixnum.java
===================================================================
--- src/org/jruby/RubyFixnum.java (revision 4083)
+++ src/org/jruby/RubyFixnum.java (working copy)
@@ -36,6 +36,7 @@
package org.jruby;
import java.math.BigInteger;
+import org.jruby.anno.JRubyMethod;
import org.jruby.runtime.Arity;
import org.jruby.runtime.CallbackFactory;
import org.jruby.runtime.ClassIndex;
@@ -57,48 +58,9 @@
CallbackFactory callbackFactory =
runtime.callbackFactory(RubyFixnum.class);
fixnum.includeModule(runtime.getModule("Precision"));
- fixnum.getMetaClass().defineFastMethod("induced_from",
callbackFactory.getFastSingletonMethod(
- "induced_from", RubyKernel.IRUBY_OBJECT));
-
- fixnum.defineFastMethod("to_s",
callbackFactory.getFastOptMethod("to_s"));
-
- fixnum.defineFastMethod("id2name",
callbackFactory.getFastMethod("id2name"));
- fixnum.defineFastMethod("to_sym",
callbackFactory.getFastMethod("to_sym"));
-
- fixnum.defineFastMethod("-@", callbackFactory.getFastMethod("uminus"));
- fixnum.defineFastMethod("+", callbackFactory.getFastMethod("plus",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("-", callbackFactory.getFastMethod("minus",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("*", callbackFactory.getFastMethod("mul",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("/",
callbackFactory.getFastMethod("div_slash", RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("div",
callbackFactory.getFastMethod("div_div", RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("%", callbackFactory.getFastMethod("mod",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("modulo", callbackFactory.getFastMethod("mod",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("divmod",
callbackFactory.getFastMethod("divmod", RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("quo", callbackFactory.getFastMethod("quo",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("**", callbackFactory.getFastMethod("pow",
RubyKernel.IRUBY_OBJECT));
-
- fixnum.defineFastMethod("abs", callbackFactory.getFastMethod("abs"));
-
- fixnum.defineFastMethod("==", callbackFactory.getFastMethod("equal",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("<=>", callbackFactory.getFastMethod("cmp",
RubyKernel.IRUBY_OBJECT));
-
- fixnum.defineFastMethod(">", callbackFactory.getFastMethod("gt",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod(">=", callbackFactory.getFastMethod("ge",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("<", callbackFactory.getFastMethod("lt",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("<=", callbackFactory.getFastMethod("le",
RubyKernel.IRUBY_OBJECT));
-
- fixnum.defineFastMethod("~", callbackFactory.getFastMethod("rev"));
- fixnum.defineFastMethod("&", callbackFactory.getFastMethod("and",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("|", callbackFactory.getFastMethod("or",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("^", callbackFactory.getFastMethod("xor",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("[]", callbackFactory.getFastMethod("aref",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod("<<", callbackFactory.getFastMethod("lshift",
RubyKernel.IRUBY_OBJECT));
- fixnum.defineFastMethod(">>", callbackFactory.getFastMethod("rshift",
RubyKernel.IRUBY_OBJECT));
-
- fixnum.defineFastMethod("to_f", callbackFactory.getFastMethod("to_f"));
- fixnum.defineFastMethod("size", callbackFactory.getFastMethod("size"));
- fixnum.defineFastMethod("zero?",
callbackFactory.getFastMethod("zero_p"));
+ fixnum.defineAnnotatedMethods(RubyFixnum.class, callbackFactory);
+
fixnum.dispatcher = callbackFactory.createDispatcher(fixnum);
return fixnum;
@@ -212,6 +174,7 @@
/** fix_to_s
*
*/
+ @JRubyMethod(name = "to_s", optional = 1)
public RubyString to_s(IRubyObject[] args) {
Arity.checkArgumentCount(getRuntime(), args, 0, 1);
@@ -225,6 +188,7 @@
/** fix_id2name
*
*/
+ @JRubyMethod(name = "id2name")
public IRubyObject id2name() {
String symbol = RubySymbol.getSymbol(getRuntime(), value);
if (symbol != null) {
@@ -236,6 +200,7 @@
/** fix_to_sym
*
*/
+ @JRubyMethod(name = "to_sym")
public IRubyObject to_sym() {
String symbol = RubySymbol.getSymbol(getRuntime(), value);
if (symbol != null) {
@@ -247,6 +212,7 @@
/** fix_uminus
*
*/
+ @JRubyMethod(name = "-@")
public IRubyObject uminus() {
if (value == MIN) { // a gotcha
return RubyBignum.newBignum(getRuntime(),
BigInteger.valueOf(value).negate());
@@ -257,6 +223,7 @@
/** fix_plus
*
*/
+ @JRubyMethod(name = "+", required = 1)
public IRubyObject plus(IRubyObject other) {
if (other instanceof RubyFixnum) {
long otherValue = ((RubyFixnum) other).value;
@@ -278,6 +245,7 @@
/** fix_minus
*
*/
+ @JRubyMethod(name = "-", required = 1)
public IRubyObject minus(IRubyObject other) {
if (other instanceof RubyFixnum) {
long otherValue = ((RubyFixnum) other).value;
@@ -297,6 +265,7 @@
/** fix_mul
*
*/
+ @JRubyMethod(name = "*", required = 1)
public IRubyObject mul(IRubyObject other) {
if (other instanceof RubyFixnum) {
long otherValue = ((RubyFixnum) other).value;
@@ -327,10 +296,12 @@
*
* also note that RubyFloat doesn't override Numeric.div
*/
+ @JRubyMethod(name = "div", required = 1)
public IRubyObject div_div(IRubyObject other) {
return idiv(other, "div");
}
+ @JRubyMethod(name = "/", required = 1)
public IRubyObject div_slash(IRubyObject other) {
return idiv(other, "/");
}
@@ -359,6 +330,7 @@
/** fix_mod
*
*/
+ @JRubyMethod(name = "%", required = 1, alias = "modulo")
public IRubyObject mod(IRubyObject other) {
if (other instanceof RubyFixnum) {
// Java / and % are not the same as ruby
@@ -383,6 +355,7 @@
/** fix_divmod
*
*/
+ @JRubyMethod(name = "divmod", required = 1)
public IRubyObject divmod(IRubyObject other) {
if (other instanceof RubyFixnum) {
long x = value;
@@ -413,6 +386,7 @@
/** fix_quo
*
*/
+ @JRubyMethod(name = "quo", required = 1)
public IRubyObject quo(IRubyObject other) {
if (other instanceof RubyFixnum) {
return RubyFloat.newFloat(getRuntime(), (double) value
@@ -424,6 +398,7 @@
/** fix_pow
*
*/
+ @JRubyMethod(name = "**", required = 1)
public IRubyObject pow(IRubyObject other) {
if(other instanceof RubyFixnum) {
long b = ((RubyFixnum) other).value;
@@ -447,16 +422,18 @@
/** fix_abs
*
*/
+ @JRubyMethod(name = "abs")
public IRubyObject abs() {
if (value < 0) {
return RubyFixnum.newFixnum(getRuntime(), -value);
- }
+ }
return this;
}
/** fix_equal
*
*/
+ @JRubyMethod(name = "==", required = 1)
public IRubyObject equal(IRubyObject other) {
if (other instanceof RubyFixnum) {
return RubyBoolean.newBoolean(getRuntime(), value == ((RubyFixnum)
other).value);
@@ -467,6 +444,7 @@
/** fix_cmp
*
*/
+ @JRubyMethod(name = "<=>", required = 1)
public IRubyObject cmp(IRubyObject other) {
if (other instanceof RubyFixnum) {
long otherValue = ((RubyFixnum) other).value;
@@ -484,6 +462,7 @@
/** fix_gt
*
*/
+ @JRubyMethod(name = ">", required = 1)
public IRubyObject gt(IRubyObject other) {
if (other instanceof RubyFixnum) {
return RubyBoolean.newBoolean(getRuntime(), value > ((RubyFixnum)
other).value);
@@ -494,6 +473,7 @@
/** fix_ge
*
*/
+ @JRubyMethod(name = ">=", required = 1)
public IRubyObject ge(IRubyObject other) {
if (other instanceof RubyFixnum) {
return RubyBoolean.newBoolean(getRuntime(), value >= ((RubyFixnum)
other).value);
@@ -504,6 +484,7 @@
/** fix_lt
*
*/
+ @JRubyMethod(name = "<", required = 1)
public IRubyObject lt(IRubyObject other) {
if (other instanceof RubyFixnum) {
return RubyBoolean.newBoolean(getRuntime(), value < ((RubyFixnum)
other).value);
@@ -514,6 +495,7 @@
/** fix_le
*
*/
+ @JRubyMethod(name = "<=", required = 1)
public IRubyObject le(IRubyObject other) {
if (other instanceof RubyFixnum) {
return RubyBoolean.newBoolean(getRuntime(), value <= ((RubyFixnum)
other).value);
@@ -524,6 +506,7 @@
/** fix_rev
*
*/
+ @JRubyMethod(name = "~")
public IRubyObject rev() {
return newFixnum(~value);
}
@@ -531,6 +514,7 @@
/** fix_and
*
*/
+ @JRubyMethod(name = "&", required = 1)
public IRubyObject and(IRubyObject other) {
if (other instanceof RubyBignum) {
return ((RubyBignum) other).and(this);
@@ -541,6 +525,7 @@
/** fix_or
*
*/
+ @JRubyMethod(name = "|", required = 1)
public IRubyObject or(IRubyObject other) {
if (other instanceof RubyFixnum) {
return newFixnum(value | ((RubyFixnum) other).value);
@@ -558,6 +543,7 @@
/** fix_xor
*
*/
+ @JRubyMethod(name = "^", required = 1)
public IRubyObject xor(IRubyObject other) {
if(other instanceof RubyFixnum) {
return newFixnum(value ^ ((RubyFixnum) other).value);
@@ -575,6 +561,7 @@
/** fix_aref
*
*/
+ @JRubyMethod(name = "[]", required = 1)
public IRubyObject aref(IRubyObject other) {
if(other instanceof RubyBignum) {
RubyBignum big = (RubyBignum) other;
@@ -606,6 +593,7 @@
/** fix_lshift
*
*/
+ @JRubyMethod(name = "<<", required = 1)
public IRubyObject lshift(IRubyObject other) {
long width = num2long(other);
@@ -627,6 +615,7 @@
/** fix_rshift
*
*/
+ @JRubyMethod(name = ">>", required = 1)
public IRubyObject rshift(IRubyObject other) {
long width = num2long(other);
@@ -651,6 +640,7 @@
/** fix_to_f
*
*/
+ @JRubyMethod(name = "to_f")
public IRubyObject to_f() {
return RubyFloat.newFloat(getRuntime(), (double) value);
}
@@ -658,6 +648,7 @@
/** fix_size
*
*/
+ @JRubyMethod(name = "size")
public IRubyObject size() {
return newFixnum((long) ((BIT_SIZE + 7) / 8));
}
@@ -665,6 +656,7 @@
/** fix_zero_p
*
*/
+ @JRubyMethod(name = "zero?")
public IRubyObject zero_p() {
return RubyBoolean.newBoolean(getRuntime(), value == 0);
}
@@ -695,8 +687,8 @@
/** rb_fix_induced_from
*
*/
-
+ @JRubyMethod(name = "induced_from", required = 1, singleton = true)
public static IRubyObject induced_from(IRubyObject recv, IRubyObject
other) {
return RubyNumeric.num2fix(other);
+ }
}
-}
Index: build.xml
===================================================================
--- build.xml (revision 4083)
+++ build.xml (working copy)
@@ -36,6 +36,8 @@
<patternset id="other.src.pattern">
<include name="**/*.properties"/>
</patternset>
+
+ <taskdef name="retro"
classname="net.sourceforge.retroweaver.ant.RetroWeaverTask"
classpathref="build.classpath"/>
<target name="init" description="initialize the build">
<xmlproperty file="build-config.xml" keepRoot="false"
collapseAttributes="true"/>
@@ -148,11 +150,16 @@
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="org.jruby.Main"/>
- <attribute name="Class-Path" value="asm-2.2.3.jar
asm-commons-2.2.3.jar asm-util-2.2.3.jar jline-0.9.91.jar bsf.jar
backport-util-concurrent.jar"/>
+ <attribute name="Class-Path" value="asm-3.0.jar asm-commons-3.0.jar
asm-util-3.0.jar jline-0.9.91.jar bsf.jar backport-util-concurrent.jar"/>
</manifest>
</jar>
</target>
+ <target name="jar-1.4" depends="jar-jruby">
+ <copy file="${lib.dir}/jruby.jar" tofile="${lib.dir}/jruby1.5.jar"/>
+ <retro inputjar="${lib.dir}/jruby1.5.jar"
outputjar="${lib.dir}/jruby.jar"/>
+ <delete file="${lib.dir}/jruby1.5.jar"/>
+ </target>
<target name="jar-complete" depends="generate-method-classes"
description="Create the 'complete' JRuby jar. Pass 'mainclass' and 'filename'
to adjust.">
<property name="mainclass" value="org.jruby.Main"/>
@@ -165,9 +172,9 @@
<fileset dir="${basedir}/lib/ruby/1.8">
<include name="**/*.rb"/>
</fileset>
- <zipfileset src="${lib.dir}/asm-2.2.3.jar"/>
- <zipfileset src="${lib.dir}/asm-commons-2.2.3.jar"/>
- <zipfileset src="${lib.dir}/asm-util-2.2.3.jar"/>
+ <zipfileset src="${lib.dir}/asm-3.0.jar"/>
+ <zipfileset src="${lib.dir}/asm-commons-3.0.jar"/>
+ <zipfileset src="${lib.dir}/asm-util-3.0.jar"/>
<zipfileset src="${lib.dir}/jline-0.9.91.jar"/>
<zipfileset src="${lib.dir}/backport-util-concurrent.jar"/>
<rule pattern="org.objectweb.asm.**" result="[EMAIL PROTECTED]"/>
@@ -216,9 +223,9 @@
<exclude name="**/xmlrpc/**"/>
<exclude name="**/xsd/**"/>
</fileset>
- <zipfileset src="${lib.dir}/asm-2.2.3.jar"/>
- <zipfileset src="${lib.dir}/asm-commons-2.2.3.jar"/>
- <zipfileset src="${lib.dir}/asm-util-2.2.3.jar"/>
+ <zipfileset src="${lib.dir}/asm-3.0.jar"/>
+ <zipfileset src="${lib.dir}/asm-commons-3.0.jar"/>
+ <zipfileset src="${lib.dir}/asm-util-3.0.jar"/>
<zipfileset src="${lib.dir}/jline-0.9.91.jar"/>
<zipfileset src="${lib.dir}/backport-util-concurrent.jar"/>
<manifest>
Index: lib/asm-3.0.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: lib/asm-3.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Index: lib/asm-2.2.3.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: lib/retroweaver-rt-2.0.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: lib/retroweaver-rt-2.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Index: lib/asm-commons-3.0.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: lib/asm-commons-3.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Index: lib/asm-commons-2.2.3.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: lib/asm-util-3.0.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: lib/asm-util-3.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Index: lib/asm-util-2.2.3.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: lib/retroweaver-2.0.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: lib/retroweaver-2.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Index: default.build.properties
===================================================================
--- default.build.properties (revision 4083)
+++ default.build.properties (working copy)
@@ -15,4 +15,4 @@
test.results.dir=${build.dir}/test-results
html.test.results.dir=${test.results.dir}/html
html.test.coverage.results.dir=${test.results.dir}/html-coverage
-javac.version=1.4
+javac.version=1.5
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email