Index: test/test_unit_index =================================================================== --- test/test_unit_index (revision 3713) +++ test/test_unit_index (working copy) @@ -135,7 +135,7 @@ #externals/mri/ruby/test_rand externals/mri/ruby/test_range #externals/mri/ruby/test_readpartial -#externals/mri/ruby/test_settracefunc +externals/mri/ruby/test_settracefunc #externals/mri/ruby/test_signal externals/mri/ruby/test_string externals/mri/ruby/test_stringchar Index: src/org/jruby/runtime/MethodSelectorTable.java =================================================================== --- src/org/jruby/runtime/MethodSelectorTable.java (revision 3713) +++ src/org/jruby/runtime/MethodSelectorTable.java (working copy) @@ -97,7 +97,7 @@ // Symbol table[ClassIndex.SYMBOL] = new byte[MethodIndex.MAX_METHODS]; table[ClassIndex.SYMBOL][MethodIndex.NIL_P] = RubySymbol.NIL_P_SWITCHVALUE; - table[ClassIndex.SYMBOL][MethodIndex.EQUALEQUAL] = RubySymbol.EQUALEQUAL_SWITCHVALUE; + // table[ClassIndex.SYMBOL][MethodIndex.EQUALEQUAL] = RubySymbol.EQUALEQUAL_SWITCHVALUE; table[ClassIndex.SYMBOL][MethodIndex.TO_S] = RubySymbol.TO_S_SWITCHVALUE; table[ClassIndex.SYMBOL][MethodIndex.TO_I] = RubySymbol.TO_I_SWITCHVALUE; table[ClassIndex.SYMBOL][MethodIndex.TO_SYM] = RubySymbol.TO_SYM_SWITCHVALUE; Index: src/org/jruby/runtime/ThreadContext.java =================================================================== --- src/org/jruby/runtime/ThreadContext.java (revision 3719) +++ src/org/jruby/runtime/ThreadContext.java (working copy) @@ -306,6 +306,10 @@ return getCurrentFrame().getName(); } + public String getPreviousFrameName() { + return getPreviousFrame().getName(); + } + public IRubyObject[] getFrameArgs() { return getCurrentFrame().getArgs(); } @@ -330,6 +334,10 @@ return getCurrentFrame().getKlazz(); } + public RubyModule getPreviousFrameKlazz() { + return getPreviousFrame().getKlazz(); + } + public Block getFrameBlock() { return getCurrentFrame().getBlock(); } Index: src/org/jruby/RubyFloat.java =================================================================== --- src/org/jruby/RubyFloat.java (revision 3713) +++ src/org/jruby/RubyFloat.java (working copy) @@ -92,13 +92,13 @@ floatc.defineFastMethod("modulo", callbackFactory.getFastMethod("mod", RubyKernel.IRUBY_OBJECT)); floatc.defineFastMethod("divmod", callbackFactory.getFastMethod("divmod", RubyKernel.IRUBY_OBJECT)); floatc.defineFastMethod("**", callbackFactory.getFastMethod("pow", RubyKernel.IRUBY_OBJECT)); - floatc.defineFastMethod("==", callbackFactory.getFastMethod("equal", RubyKernel.IRUBY_OBJECT)); - floatc.defineFastMethod("<=>", callbackFactory.getFastMethod("cmp", RubyKernel.IRUBY_OBJECT)); + floatc.defineFastMethod("==", callbackFactory.getFastMethod("flo_eq", RubyKernel.IRUBY_OBJECT)); + floatc.defineFastMethod("<=>", callbackFactory.getFastMethod("flo_cmp", RubyKernel.IRUBY_OBJECT)); floatc.defineFastMethod(">", callbackFactory.getFastMethod("gt", RubyKernel.IRUBY_OBJECT)); floatc.defineFastMethod(">=", callbackFactory.getFastMethod("ge", RubyKernel.IRUBY_OBJECT)); floatc.defineFastMethod("<", callbackFactory.getFastMethod("lt", RubyKernel.IRUBY_OBJECT)); floatc.defineFastMethod("<=", callbackFactory.getFastMethod("le", RubyKernel.IRUBY_OBJECT)); - floatc.defineFastMethod("eql?", callbackFactory.getFastMethod("eql_p", RubyKernel.IRUBY_OBJECT)); + floatc.defineFastMethod("eql?", callbackFactory.getFastMethod("flo_eql", RubyKernel.IRUBY_OBJECT)); floatc.defineFastMethod("hash", callbackFactory.getFastMethod("hash")); floatc.defineFastMethod("to_f", callbackFactory.getFastMethod("to_f")); floatc.defineFastMethod("abs", callbackFactory.getFastMethod("abs")); @@ -329,7 +329,7 @@ /** flo_eq * */ - public IRubyObject equal(IRubyObject other) { + public IRubyObject flo_eq(IRubyObject other) { if (Double.isNaN(value)) { return getRuntime().getFalse(); } @@ -337,15 +337,14 @@ return RubyBoolean.newBoolean(getRuntime(), value == ((RubyNumeric) other) .getDoubleValue()); } - // Numeric.equal - return super.equal(other); + return super.num_equal(other); } /** flo_cmp * */ - public IRubyObject cmp(IRubyObject other) { + public IRubyObject flo_cmp(IRubyObject other) { if (other instanceof RubyNumeric) { double b = ((RubyNumeric) other).getDoubleValue(); return dbl_cmp(getRuntime(), value, b); @@ -400,7 +399,7 @@ /** flo_eql * */ - public IRubyObject eql_p(IRubyObject other) { + public IRubyObject flo_eql(IRubyObject other) { if (other instanceof RubyFloat) { double b = ((RubyFloat) other).value; if (Double.isNaN(value) || Double.isNaN(b)) { Index: src/org/jruby/RubySymbol.java =================================================================== --- src/org/jruby/RubySymbol.java (revision 3713) +++ src/org/jruby/RubySymbol.java (working copy) @@ -65,12 +65,13 @@ public static RubyClass createSymbolClass(Ruby runtime) { RubyClass symbolClass = runtime.defineClass("Symbol", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); - CallbackFactory callbackFactory = runtime.callbackFactory(RubySymbol.class); + CallbackFactory callbackFactory = runtime.callbackFactory(RubySymbol.class); + CallbackFactory objectCallbackFactory = runtime.callbackFactory(RubyObject.class); RubyClass symbolMetaClass = symbolClass.getMetaClass(); symbolClass.index = ClassIndex.SYMBOL; - symbolClass.defineFastMethod("==", callbackFactory.getFastMethod("equal", RubyKernel.IRUBY_OBJECT)); + symbolClass.defineFastMethod("===", objectCallbackFactory.getFastMethod("obj_equal", RubyKernel.IRUBY_OBJECT)); symbolClass.defineFastMethod("freeze", callbackFactory.getFastMethod("freeze")); symbolClass.defineFastMethod("hash", callbackFactory.getFastMethod("hash")); symbolClass.defineFastMethod("inspect", callbackFactory.getFastMethod("inspect")); @@ -93,7 +94,7 @@ } public static final byte NIL_P_SWITCHVALUE = 1; - public static final byte EQUALEQUAL_SWITCHVALUE = 2; + // public static final byte EQUALEQUAL_SWITCHVALUE = 2; public static final byte TO_S_SWITCHVALUE = 3; public static final byte TO_I_SWITCHVALUE = 4; public static final byte TO_SYM_SWITCHVALUE = 5; @@ -108,9 +109,9 @@ case NIL_P_SWITCHVALUE: if (args.length != 0) throw context.getRuntime().newArgumentError("wrong number of arguments(" + args.length + " for " + 0 + ")"); return nil_p(); - case EQUALEQUAL_SWITCHVALUE: - if (args.length != 1) throw context.getRuntime().newArgumentError("wrong number of arguments(" + args.length + " for " + 1 + ")"); - return equal(args[0]); +// case EQUALEQUAL_SWITCHVALUE: +// if (args.length != 1) throw context.getRuntime().newArgumentError("wrong number of arguments(" + args.length + " for " + 1 + ")"); +// return equal(args[0]); case TO_S_SWITCHVALUE: if (args.length != 0) throw context.getRuntime().newArgumentError("wrong number of arguments(" + args.length + " for " + 0 + ")"); return to_s(); @@ -176,11 +177,11 @@ return result; } - public IRubyObject equal(IRubyObject other) { - // Symbol table ensures only one instance for every name, - // so object identity is enough to compare symbols. - return RubyBoolean.newBoolean(getRuntime(), this == other); - } +// public IRubyObject equal(IRubyObject other) { +// // Symbol table ensures only one instance for every name, +// // so object identity is enough to compare symbols. +// return RubyBoolean.newBoolean(getRuntime(), this == other); +// } public RubyFixnum to_i() { return getRuntime().newFixnum(id); Index: src/org/jruby/evaluator/EvaluationState.java =================================================================== --- src/org/jruby/evaluator/EvaluationState.java (revision 3713) +++ src/org/jruby/evaluator/EvaluationState.java (working copy) @@ -266,6 +266,11 @@ return hashNode(runtime, context, node, self, aBlock); case NodeTypes.IFNODE: { IfNode iVisited = (IfNode) node; + + if (isTrace(runtime)) { + callTraceFunction(runtime, context, "line", self); + } + IRubyObject result = evalInternal(runtime,context, iVisited.getCondition(), self, aBlock); if (result.isTrue()) { @@ -280,7 +285,8 @@ case NodeTypes.INSTVARNODE: return instVarNode(runtime, node, self); case NodeTypes.ITERNODE: - assert false: "Call nodes deal with these directly"; + assert false: "Call nodes deal with these directly"; + break; case NodeTypes.LOCALASGNNODE: return localAsgnNode(runtime, context, node, self, aBlock); case NodeTypes.LOCALVARNODE: @@ -799,8 +805,7 @@ } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getScope(), - iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef()); - + iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef(), iVisited.getPosition()); containingClass.addMethod(name, newMethod); if (context.getCurrentVisibility().isModuleFunction()) { @@ -858,7 +863,7 @@ DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), - Visibility.PUBLIC, context.peekCRef()); + Visibility.PUBLIC, context.peekCRef(), iVisited.getPosition()); rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod(context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); Index: src/org/jruby/internal/runtime/methods/DefaultMethod.java =================================================================== --- src/org/jruby/internal/runtime/methods/DefaultMethod.java (revision 3714) +++ src/org/jruby/internal/runtime/methods/DefaultMethod.java (working copy) @@ -72,16 +72,18 @@ private SinglyLinkedList cref; private int callCount = 0; private Script jitCompiledScript; + private ISourcePosition methodPosition; - public DefaultMethod(RubyModule implementationClass, StaticScope staticScope, Node body, - ArgsNode argsNode, Visibility visibility, SinglyLinkedList cref) { + public DefaultMethod(RubyModule implementationClass, StaticScope staticScope, Node body, + ArgsNode argsNode, Visibility visibility, SinglyLinkedList cref, ISourcePosition methodPosition) { super(implementationClass, visibility); this.body = body; this.staticScope = staticScope; this.argsNode = argsNode; this.cref = cref; - - assert argsNode != null; + this.methodPosition = methodPosition; + + assert argsNode != null; } public void preMethod(ThreadContext context, RubyModule clazz, IRubyObject self, String name, @@ -142,7 +144,10 @@ throw je; } finally { - if (binding != null) { + if (runtime.getTraceFunction() != null) { + if (binding == null) { + binding = RubyBinding.newBinding(runtime); + } traceReturn(context, runtime, binding, name); } } @@ -329,24 +334,20 @@ if (runtime.getTraceFunction() == null) { return; } + runtime.callTraceFunction(context, "return", body != null ? body.getPosition() : methodPosition, binding, name, getImplementationClass()); + } - ISourcePosition position = context.getPreviousFramePosition(); - runtime.callTraceFunction(context, "return", position, binding, name, getImplementationClass()); - } - private void traceCall(ThreadContext context, Ruby runtime, RubyBinding binding, String name) { if (runtime.getTraceFunction() == null) return; - ISourcePosition position = body != null ? body.getPosition() : context.getPosition(); - - runtime.callTraceFunction(context, "call", position, binding, name, getImplementationClass()); + runtime.callTraceFunction(context, "call", methodPosition, binding, name, getImplementationClass()); } public Arity getArity() { return argsNode.getArity(); } - + public DynamicMethod dup() { - return new DefaultMethod(getImplementationClass(), staticScope, body, argsNode, getVisibility(), cref); + return new DefaultMethod(getImplementationClass(), staticScope, body, argsNode, getVisibility(), cref, methodPosition); } } Index: src/org/jruby/exceptions/RaiseException.java =================================================================== --- src/org/jruby/exceptions/RaiseException.java (revision 3713) +++ src/org/jruby/exceptions/RaiseException.java (working copy) @@ -110,8 +110,8 @@ } if (runtime.getTraceFunction() != null) { - runtime.callTraceFunction(context, "return", context.getPosition(), - RubyBinding.newBinding(runtime), context.getFrameName(), context.getFrameKlazz()); + runtime.callTraceFunction(context, "raise", context.getFramePosition(), + RubyBinding.newBinding(runtime), context.getPreviousFrameName(), context.getPreviousFrameKlazz()); } this.exception = newException; Index: src/org/jruby/Ruby.java =================================================================== --- src/org/jruby/Ruby.java (revision 3714) +++ src/org/jruby/Ruby.java (working copy) @@ -1165,6 +1165,7 @@ Node node = parse(source, scriptName, null, 0); EvaluationState.eval(this, context, node, self, Block.NULL_BLOCK); } catch (JumpException je) { + je.printStackTrace(); if (je.getJumpType() == JumpException.JumpType.ReturnJump) { // Make sure this does not bubble out to java caller. } else { Index: src/org/jruby/RubyModule.java =================================================================== --- src/org/jruby/RubyModule.java (revision 3713) +++ src/org/jruby/RubyModule.java (working copy) @@ -163,35 +163,37 @@ } public static RubyClass createModuleClass(Ruby runtime, RubyClass moduleClass) { - CallbackFactory callbackFactory = runtime.callbackFactory(RubyModule.class); + CallbackFactory callbackFactory = runtime.callbackFactory(RubyModule.class); + CallbackFactory objectCallbackFactory = runtime.callbackFactory(RubyObject.class); RubyClass moduleMetaClass = moduleClass.getMetaClass(); moduleClass.index = ClassIndex.MODULE; - moduleClass.defineFastMethod("===", callbackFactory.getFastMethod("op_eqq", IRubyObject.class)); - moduleClass.defineFastMethod("<=>", callbackFactory.getFastMethod("op_cmp", IRubyObject.class)); - moduleClass.defineFastMethod("<", callbackFactory.getFastMethod("op_lt", IRubyObject.class)); - moduleClass.defineFastMethod("<=", callbackFactory.getFastMethod("op_le", IRubyObject.class)); - moduleClass.defineFastMethod(">", callbackFactory.getFastMethod("op_gt", IRubyObject.class)); - moduleClass.defineFastMethod(">=", callbackFactory.getFastMethod("op_ge", IRubyObject.class)); + moduleClass.defineFastMethod("==", objectCallbackFactory.getFastMethod("obj_equal", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod("===", callbackFactory.getFastMethod("op_eqq", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod("<=>", callbackFactory.getFastMethod("op_cmp", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod("<", callbackFactory.getFastMethod("op_lt", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod("<=", callbackFactory.getFastMethod("op_le", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod(">", callbackFactory.getFastMethod("op_gt", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod(">=", callbackFactory.getFastMethod("op_ge", RubyKernel.IRUBY_OBJECT)); moduleClass.defineFastMethod("ancestors", callbackFactory.getFastMethod("ancestors")); moduleClass.defineFastMethod("class_variables", callbackFactory.getFastMethod("class_variables")); - moduleClass.defineFastMethod("const_defined?", callbackFactory.getFastMethod("const_defined", IRubyObject.class)); - moduleClass.defineFastMethod("const_get", callbackFactory.getFastMethod("const_get", IRubyObject.class)); - moduleClass.defineMethod("const_missing", callbackFactory.getMethod("const_missing", IRubyObject.class)); - moduleClass.defineFastMethod("const_set", callbackFactory.getFastMethod("const_set", IRubyObject.class, IRubyObject.class)); + moduleClass.defineFastMethod("const_defined?", callbackFactory.getFastMethod("const_defined", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod("const_get", callbackFactory.getFastMethod("const_get", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineMethod("const_missing", callbackFactory.getMethod("const_missing", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod("const_set", callbackFactory.getFastMethod("const_set", RubyKernel.IRUBY_OBJECT, RubyKernel.IRUBY_OBJECT)); moduleClass.defineFastMethod("constants", callbackFactory.getFastMethod("constants")); - moduleClass.defineMethod("extended", callbackFactory.getMethod("extended", IRubyObject.class)); - moduleClass.defineFastMethod("include?", callbackFactory.getFastMethod("include_p", IRubyObject.class)); - moduleClass.defineFastMethod("included", callbackFactory.getFastMethod("included", IRubyObject.class)); + moduleClass.defineMethod("extended", callbackFactory.getMethod("extended", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod("include?", callbackFactory.getFastMethod("include_p", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod("included", callbackFactory.getFastMethod("included", RubyKernel.IRUBY_OBJECT)); moduleClass.defineFastMethod("included_modules", callbackFactory.getFastMethod("included_modules")); moduleClass.defineMethod("initialize", callbackFactory.getOptMethod("initialize")); - moduleClass.defineFastMethod("initialize_copy", callbackFactory.getFastMethod("initialize_copy", IRubyObject.class)); - moduleClass.defineFastMethod("instance_method", callbackFactory.getFastMethod("instance_method", IRubyObject.class)); + moduleClass.defineFastMethod("initialize_copy", callbackFactory.getFastMethod("initialize_copy", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod("instance_method", callbackFactory.getFastMethod("instance_method", RubyKernel.IRUBY_OBJECT)); moduleClass.defineFastMethod("instance_methods",callbackFactory.getFastOptMethod("instance_methods")); - moduleClass.defineFastMethod("method_defined?", callbackFactory.getFastMethod("method_defined", IRubyObject.class)); - moduleClass.defineFastMethod("public_method_defined?", callbackFactory.getFastMethod("public_method_defined", IRubyObject.class)); - moduleClass.defineFastMethod("protected_method_defined?", callbackFactory.getFastMethod("protected_method_defined", IRubyObject.class)); - moduleClass.defineFastMethod("private_method_defined?", callbackFactory.getFastMethod("private_method_defined", IRubyObject.class)); + moduleClass.defineFastMethod("method_defined?", callbackFactory.getFastMethod("method_defined", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod("public_method_defined?", callbackFactory.getFastMethod("public_method_defined", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod("protected_method_defined?", callbackFactory.getFastMethod("protected_method_defined", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastMethod("private_method_defined?", callbackFactory.getFastMethod("private_method_defined", RubyKernel.IRUBY_OBJECT)); moduleClass.defineMethod("module_eval", callbackFactory.getOptMethod("module_eval")); moduleClass.defineFastMethod("name", callbackFactory.getFastMethod("name")); moduleClass.defineFastMethod("private_class_method", callbackFactory.getFastOptMethod("private_class_method")); @@ -203,28 +205,28 @@ moduleClass.defineAlias("class_eval", "module_eval"); - moduleClass.defineFastPrivateMethod("alias_method", callbackFactory.getFastMethod("alias_method", IRubyObject.class, IRubyObject.class)); - moduleClass.defineFastPrivateMethod("append_features", callbackFactory.getFastMethod("append_features", IRubyObject.class)); + moduleClass.defineFastPrivateMethod("alias_method", callbackFactory.getFastMethod("alias_method", RubyKernel.IRUBY_OBJECT, RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastPrivateMethod("append_features", callbackFactory.getFastMethod("append_features", RubyKernel.IRUBY_OBJECT)); moduleClass.defineFastPrivateMethod("attr", callbackFactory.getFastOptMethod("attr")); moduleClass.defineFastPrivateMethod("attr_reader", callbackFactory.getFastOptMethod("attr_reader")); moduleClass.defineFastPrivateMethod("attr_writer", callbackFactory.getFastOptMethod("attr_writer")); moduleClass.defineFastPrivateMethod("attr_accessor", callbackFactory.getFastOptMethod("attr_accessor")); - moduleClass.defineFastPrivateMethod("class_variable_get", callbackFactory.getFastMethod("class_variable_get", IRubyObject.class)); - moduleClass.defineFastPrivateMethod("class_variable_set", callbackFactory.getFastMethod("class_variable_set", IRubyObject.class, IRubyObject.class)); + moduleClass.defineFastPrivateMethod("class_variable_get", callbackFactory.getFastMethod("class_variable_get", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastPrivateMethod("class_variable_set", callbackFactory.getFastMethod("class_variable_set", RubyKernel.IRUBY_OBJECT, RubyKernel.IRUBY_OBJECT)); moduleClass.definePrivateMethod("define_method", callbackFactory.getOptMethod("define_method")); - moduleClass.defineFastPrivateMethod("extend_object", callbackFactory.getFastMethod("extend_object", IRubyObject.class)); + moduleClass.defineFastPrivateMethod("extend_object", callbackFactory.getFastMethod("extend_object", RubyKernel.IRUBY_OBJECT)); moduleClass.defineFastPrivateMethod("include", callbackFactory.getFastOptMethod("include")); - moduleClass.definePrivateMethod("method_added", callbackFactory.getMethod("method_added", IRubyObject.class)); - moduleClass.definePrivateMethod("method_removed", callbackFactory.getMethod("method_removed", IRubyObject.class)); - moduleClass.definePrivateMethod("method_undefined", callbackFactory.getMethod("method_undefined", IRubyObject.class)); + moduleClass.definePrivateMethod("method_added", callbackFactory.getMethod("method_added", RubyKernel.IRUBY_OBJECT)); + moduleClass.definePrivateMethod("method_removed", callbackFactory.getMethod("method_removed", RubyKernel.IRUBY_OBJECT)); + moduleClass.definePrivateMethod("method_undefined", callbackFactory.getMethod("method_undefined", RubyKernel.IRUBY_OBJECT)); moduleClass.defineFastPrivateMethod("module_function", callbackFactory.getFastOptMethod("module_function")); moduleClass.defineFastPrivateMethod("public", callbackFactory.getFastOptMethod("rbPublic")); moduleClass.defineFastPrivateMethod("protected", callbackFactory.getFastOptMethod("rbProtected")); moduleClass.defineFastPrivateMethod("private", callbackFactory.getFastOptMethod("rbPrivate")); - moduleClass.defineFastPrivateMethod("remove_class_variable", callbackFactory.getFastMethod("remove_class_variable", IRubyObject.class)); - moduleClass.defineFastPrivateMethod("remove_const", callbackFactory.getFastMethod("remove_const", IRubyObject.class)); + moduleClass.defineFastPrivateMethod("remove_class_variable", callbackFactory.getFastMethod("remove_class_variable", RubyKernel.IRUBY_OBJECT)); + moduleClass.defineFastPrivateMethod("remove_const", callbackFactory.getFastMethod("remove_const", RubyKernel.IRUBY_OBJECT)); moduleClass.defineFastPrivateMethod("remove_method", callbackFactory.getFastOptMethod("remove_method")); - moduleClass.defineFastPrivateMethod("undef_method", callbackFactory.getFastMethod("undef_method", IRubyObject.class)); + moduleClass.defineFastPrivateMethod("undef_method", callbackFactory.getFastMethod("undef_method", RubyKernel.IRUBY_OBJECT)); moduleMetaClass.defineMethod("nesting", callbackFactory.getSingletonMethod("nesting")); Index: src/org/jruby/RubyNumeric.java =================================================================== --- src/org/jruby/RubyNumeric.java (revision 3713) +++ src/org/jruby/RubyNumeric.java (working copy) @@ -68,9 +68,9 @@ numeric.defineFastMethod("+@", callbackFactory.getFastMethod("uplus")); numeric.defineFastMethod("-@", callbackFactory.getFastMethod("uminus")); - numeric.defineFastMethod("<=>", callbackFactory.getFastMethod("cmp", RubyKernel.IRUBY_OBJECT)); + numeric.defineFastMethod("<=>", callbackFactory.getFastMethod("num_cmp", RubyKernel.IRUBY_OBJECT)); numeric.defineFastMethod("quo", callbackFactory.getFastMethod("quo", RubyKernel.IRUBY_OBJECT)); - numeric.defineFastMethod("eql?", callbackFactory.getFastMethod("eql_p", RubyKernel.IRUBY_OBJECT)); + numeric.defineFastMethod("eql?", callbackFactory.getFastMethod("num_eql", RubyKernel.IRUBY_OBJECT)); numeric.defineFastMethod("div", callbackFactory.getFastMethod("div", RubyKernel.IRUBY_OBJECT)); numeric.defineFastMethod("divmod", callbackFactory.getFastMethod("divmod", RubyKernel.IRUBY_OBJECT)); numeric.defineFastMethod("modulo", callbackFactory.getFastMethod("modulo", RubyKernel.IRUBY_OBJECT)); @@ -505,7 +505,7 @@ /** num_cmp * */ - public IRubyObject cmp(IRubyObject other) { + public IRubyObject num_cmp(IRubyObject other) { if (this == other) { // won't hurt fixnums return RubyFixnum.zero(getRuntime()); } @@ -515,7 +515,7 @@ /** num_eql * */ - public IRubyObject eql_p(IRubyObject other) { + public IRubyObject num_eql(IRubyObject other) { if (getMetaClass() != other.getMetaClass()) { return getRuntime().getFalse(); } @@ -719,20 +719,11 @@ } return this; } - - // /** num_equal - // * - // */ - // public RubyBoolean veryEqual(IRubyObject other) { - // IRubyObject truth = super.equal(other); - // - // return truth == getRuntime().getNil() ? getRuntime().getFalse() : (RubyBoolean) truth; - // } - // + /** num_equal * */ - public IRubyObject equal(IRubyObject other) { + public IRubyObject num_equal(IRubyObject other) { if (this == other) { // it won't hurt fixnums return getRuntime().getTrue(); } Index: src/org/jruby/RubyFixnum.java =================================================================== --- src/org/jruby/RubyFixnum.java (revision 3713) +++ src/org/jruby/RubyFixnum.java (working copy) @@ -82,8 +82,8 @@ 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("fix_equal", RubyKernel.IRUBY_OBJECT)); + fixnum.defineFastMethod("<=>", callbackFactory.getFastMethod("fix_cmp", RubyKernel.IRUBY_OBJECT)); fixnum.defineFastMethod(">", callbackFactory.getFastMethod("gt", RubyKernel.IRUBY_OBJECT)); fixnum.defineFastMethod(">=", callbackFactory.getFastMethod("ge", RubyKernel.IRUBY_OBJECT)); @@ -169,13 +169,13 @@ return mul(args[0]); case EQUALEQUAL_SWITCHVALUE: if (args.length != 1) throw context.getRuntime().newArgumentError("wrong number of arguments(" + args.length + " for " + 1 + ")"); - return equal(args[0]); + return fix_equal(args[0]); case OP_LE_SWITCHVALUE: if (args.length != 1) throw context.getRuntime().newArgumentError("wrong number of arguments(" + args.length + " for " + 1 + ")"); return le(args[0]); case OP_SPACESHIP_SWITCHVALUE: if (args.length != 1) throw context.getRuntime().newArgumentError("wrong number of arguments(" + args.length + " for " + 1 + ")"); - return cmp(args[0]); + return fix_cmp(args[0]); case 0: default: return super.callMethod(context, rubyclass, name, args, callType, block); @@ -518,17 +518,17 @@ /** fix_equal * */ - public IRubyObject equal(IRubyObject other) { + public IRubyObject fix_equal(IRubyObject other) { if (other instanceof RubyFixnum) { return RubyBoolean.newBoolean(getRuntime(), value == ((RubyFixnum) other).value); } - return super.equal(other); + return super.num_equal(other); } /** fix_cmp * */ - public IRubyObject cmp(IRubyObject other) { + public IRubyObject fix_cmp(IRubyObject other) { if (other instanceof RubyFixnum) { long otherValue = ((RubyFixnum) other).value; if (value == otherValue) { Index: src/org/jruby/RubyKernel.java =================================================================== --- src/org/jruby/RubyKernel.java (revision 3713) +++ src/org/jruby/RubyKernel.java (working copy) @@ -664,11 +664,20 @@ } IRubyObject exception; - ThreadContext context = recv.getRuntime().getCurrentContext(); + ThreadContext context = runtime.getCurrentContext(); if (args.length == 1) { if (args[0] instanceof RubyString) { - throw new RaiseException((RubyException)runtime.getClass("RuntimeError").newInstance(args, block)); + RubyException runtimeError = (RubyException)runtime.getClass("RuntimeError").callMethod(context, "new", args, block); + + // FIXME: These two lines make test_settracefunc pass one section, showing that + // we should be invoking backtrace and set_backtrace as part of setting + // up a simple RuntimeError. We use the default here, because I don't + // know what else it should be. + IRubyObject backtrace = runtimeError.callMethod(context, "backtrace"); + runtimeError.callMethod(context, "set_backtrace", new IRubyObject[] {backtrace}); + + throw new RaiseException(runtimeError); } if (!args[0].respondsTo("exception")) { @@ -733,7 +742,7 @@ } } - int line = args.length > 3 ? RubyNumeric.fix2int(args[3]) - 1 : 1; + int line = args.length > 3 ? RubyNumeric.fix2int(args[3]) - 1 : 0; recv.getRuntime().checkSafeString(src); ThreadContext context = recv.getRuntime().getCurrentContext();