8010404: Lambda debugging: redundant LineNumberTable entry for lambda capture
Ignore indy entries in LineNumberTable Reviewed-by: jjg
This commit is contained in:
parent
08df98aa3c
commit
b4b6e4f82e
langtools
src/share/classes/com/sun/tools/javac/jvm
test/tools/javac/lambda
@ -470,7 +470,15 @@ public class Code {
|
|||||||
public void emitInvokedynamic(int desc, Type mtype) {
|
public void emitInvokedynamic(int desc, Type mtype) {
|
||||||
// N.B. this format is under consideration by the JSR 292 EG
|
// N.B. this format is under consideration by the JSR 292 EG
|
||||||
int argsize = width(mtype.getParameterTypes());
|
int argsize = width(mtype.getParameterTypes());
|
||||||
|
int prevPos = pendingStatPos;
|
||||||
|
try {
|
||||||
|
//disable line number generation (we could have used 'emit1', that
|
||||||
|
//bypasses stackmap generation - which is needed for indy calls)
|
||||||
|
pendingStatPos = Position.NOPOS;
|
||||||
emitop(invokedynamic);
|
emitop(invokedynamic);
|
||||||
|
} finally {
|
||||||
|
pendingStatPos = prevPos;
|
||||||
|
}
|
||||||
if (!alive) return;
|
if (!alive) return;
|
||||||
emit2(desc);
|
emit2(desc);
|
||||||
emit2(0);
|
emit2(0);
|
||||||
|
@ -1748,10 +1748,13 @@ public class Gen extends JCTree.Visitor {
|
|||||||
// Generate code for all arguments, where the expected types are
|
// Generate code for all arguments, where the expected types are
|
||||||
// the parameters of the method's external type (that is, any implicit
|
// the parameters of the method's external type (that is, any implicit
|
||||||
// outer instance of a super(...) call appears as first parameter).
|
// outer instance of a super(...) call appears as first parameter).
|
||||||
|
MethodSymbol msym = (MethodSymbol)TreeInfo.symbol(tree.meth);
|
||||||
genArgs(tree.args,
|
genArgs(tree.args,
|
||||||
TreeInfo.symbol(tree.meth).externalType(types).getParameterTypes());
|
msym.externalType(types).getParameterTypes());
|
||||||
|
if (!msym.isDynamic()) {
|
||||||
code.statBegin(tree.pos);
|
code.statBegin(tree.pos);
|
||||||
code.markStatBegin();
|
code.markStatBegin();
|
||||||
|
}
|
||||||
result = m.invoke();
|
result = m.invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 7194586
|
* @bug 7194586
|
||||||
* @bug 8003280 8006694
|
* @bug 8003280 8006694 8010404
|
||||||
* @summary Add lambda tests
|
* @summary Add lambda tests
|
||||||
* Add back-end support for invokedynamic
|
* Add back-end support for invokedynamic
|
||||||
* temporarily workaround combo tests are causing time out in several platforms
|
* temporarily workaround combo tests are causing time out in several platforms
|
||||||
@ -48,6 +48,7 @@ import com.sun.tools.classfile.ClassFile;
|
|||||||
import com.sun.tools.classfile.Code_attribute;
|
import com.sun.tools.classfile.Code_attribute;
|
||||||
import com.sun.tools.classfile.ConstantPool.*;
|
import com.sun.tools.classfile.ConstantPool.*;
|
||||||
import com.sun.tools.classfile.Instruction;
|
import com.sun.tools.classfile.Instruction;
|
||||||
|
import com.sun.tools.classfile.LineNumberTable_attribute;
|
||||||
import com.sun.tools.classfile.Method;
|
import com.sun.tools.classfile.Method;
|
||||||
|
|
||||||
import com.sun.tools.javac.api.JavacTaskImpl;
|
import com.sun.tools.javac.api.JavacTaskImpl;
|
||||||
@ -239,7 +240,7 @@ public class TestInvokeDynamic
|
|||||||
int id = checkCount.incrementAndGet();
|
int id = checkCount.incrementAndGet();
|
||||||
JavaSource source = new JavaSource(id);
|
JavaSource source = new JavaSource(id);
|
||||||
JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
|
JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
|
||||||
null, null, Arrays.asList(source));
|
Arrays.asList("-g"), null, Arrays.asList(source));
|
||||||
Context context = ct.getContext();
|
Context context = ct.getContext();
|
||||||
Symtab syms = Symtab.instance(context);
|
Symtab syms = Symtab.instance(context);
|
||||||
Names names = Names.instance(context);
|
Names names = Names.instance(context);
|
||||||
@ -349,6 +350,16 @@ public class TestInvokeDynamic
|
|||||||
bsm_ref.getNameAndTypeInfo().getType() + " " +
|
bsm_ref.getNameAndTypeInfo().getType() + " " +
|
||||||
asBSMSignatureString());
|
asBSMSignatureString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LineNumberTable_attribute lnt =
|
||||||
|
(LineNumberTable_attribute)ea.attributes.get(Attribute.LineNumberTable);
|
||||||
|
|
||||||
|
if (lnt == null) {
|
||||||
|
throw new Error("No LineNumberTable attribute");
|
||||||
|
}
|
||||||
|
if (lnt.line_number_table_length != 2) {
|
||||||
|
throw new Error("Wrong number of entries in LineNumberTable");
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new Error("error reading " + compiledTest +": " + e);
|
throw new Error("error reading " + compiledTest +": " + e);
|
||||||
@ -376,7 +387,10 @@ public class TestInvokeDynamic
|
|||||||
"}\n" +
|
"}\n" +
|
||||||
"class Test#ID {\n" +
|
"class Test#ID {\n" +
|
||||||
" void m() { }\n" +
|
" void m() { }\n" +
|
||||||
" void test() { m(); }\n" +
|
" void test() {\n" +
|
||||||
|
" Object o = this; // marker statement \n" +
|
||||||
|
" m();\n" +
|
||||||
|
" }\n" +
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
String source;
|
String source;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user