Enhance exception thrown when pausable methods are called from within a synchronized block #15

tstockwell opened this Issue Oct 30, 2012 · 0 comments

2 participants


Hi - I'm working on an Eclipse plugin for Kilim, http://kilimbuilder.googlecode.com.

In order to mark methods in Eclipse that have Kilim problems I parse Kilim exceptions and extract information about the methods that contains the problem. The exception thrown when when pausable methods are called from within a synchronized block do not contain enough information, they just have the method name, no class info. So I have enhance the exception so that it contains a complete method descriptor.

In the kilim.analysis.BasicBlock.interpret method I have changed the INVOKEINTERFACE case so that it looks like this (just the line that throws the exception has changed)....

                case INVOKEINTERFACE:
                    // pop args, push return value
                    MethodInsnNode min = ((MethodInsnNode) ain);
                    String desc = min.desc;
                    if (flow.isPausableMethodInsn(min) && frame.numMonitorsActive > 0) {
                        throw new KilimException("Error: Can not call pausable nethods from within a synchronized block\n" +
                                "Caller: " + this.flow.classFlow.name.replace('/', '.') + "." + this.flow.name + this.flow.desc +
                                "\nCallee: " + ((MethodInsnNode)ain).name); 
                    canThrowException = true;
                    if (opcode != INVOKESTATIC) {
                        v = frame.pop(); // "this" ref
                        //assert checkReceiverType(v, min) : "Method " + flow.name + " calls " + min.name + " on a receiver with incompatible type " + v.getTypeDesc() ;
                    desc = TypeDesc.getReturnTypeDesc(desc);
                    if (desc != D_VOID) {
                        frame.push(Value.make(i, desc));
@kilim kilim pushed a commit that referenced this issue Oct 31, 2012
@sriram-srinivasan sriram-srinivasan Fix for issue #15. Contribution by tstockwell.
	modified:   src/kilim/analysis/BasicBlock.java
@kilim kilim closed this Oct 31, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment