Lines 799-815
Link Here
|
799 |
Evaluator.class, |
799 |
Evaluator.class, |
800 |
"CTL_UnsupportedOperationException" |
800 |
"CTL_UnsupportedOperationException" |
801 |
)); |
801 |
)); |
802 |
return method.instanceContext.invokeMethod(frameThread, method.method, method.args, |
802 |
return invokeVirtual ( |
803 |
ObjectReference.INVOKE_SINGLE_THREADED | ObjectReference.INVOKE_NONVIRTUAL); |
803 |
method.instanceContext, |
804 |
} catch (InvalidTypeException e) { |
804 |
method.method, |
|
|
805 |
frameThread, |
806 |
method.args, |
807 |
ObjectReference.INVOKE_SINGLE_THREADED | |
808 |
ObjectReference.INVOKE_NONVIRTUAL |
809 |
); |
810 |
} catch (InvalidExpressionException e) { |
805 |
Assert.error(node, "callException", e, ctx); |
811 |
Assert.error(node, "callException", e, ctx); |
806 |
} catch (ClassNotLoadedException e) { |
812 |
} catch (TimeoutException e) { |
807 |
// TODO: load the class |
|
|
808 |
Assert.error(node, "callException", e, ctx); |
809 |
} catch (IncompatibleThreadStateException e) { |
810 |
Assert.error(node, "callException", e, ctx); |
813 |
Assert.error(node, "callException", e, ctx); |
811 |
} catch (InvocationException e) { |
|
|
812 |
Assert.error(node, "calleeException", e, ctx); |
813 |
} |
814 |
} |
814 |
finally { |
815 |
finally { |
815 |
try { |
816 |
try { |
Lines 836-843
Link Here
|
836 |
Evaluator.class, |
837 |
Evaluator.class, |
837 |
"CTL_UnsupportedOperationException" |
838 |
"CTL_UnsupportedOperationException" |
838 |
)); |
839 |
)); |
839 |
return classContext.invokeMethod(frameThread, method.method, method.args, ClassType.INVOKE_SINGLE_THREADED); |
840 |
return invokeVirtual ( |
|
|
841 |
classContext, |
842 |
method.method, |
843 |
frameThread, |
844 |
method.args, |
845 |
ClassType.INVOKE_SINGLE_THREADED |
846 |
); |
840 |
} |
847 |
} |
|
|
848 |
} catch (TimeoutException e) { |
849 |
Assert.error(node, "callException", e, ctx); |
850 |
} catch (InvalidExpressionException e) { |
851 |
Assert.error(node, "callException", e, ctx); |
841 |
} catch (InvalidTypeException e) { |
852 |
} catch (InvalidTypeException e) { |
842 |
Assert.error(node, "callException", e, ctx); |
853 |
Assert.error(node, "callException", e, ctx); |
843 |
} catch (ClassNotLoadedException e) { |
854 |
} catch (ClassNotLoadedException e) { |
Lines 1173-1179
Link Here
|
1173 |
Evaluator.class, |
1184 |
Evaluator.class, |
1174 |
"CTL_UnsupportedOperationException" |
1185 |
"CTL_UnsupportedOperationException" |
1175 |
)); |
1186 |
)); |
1176 |
return (PrimitiveValue) reference.invokeMethod(frameThread, toCall, new ArrayList(0), ObjectReference.INVOKE_SINGLE_THREADED); |
1187 |
return (PrimitiveValue) invokeVirtual ( |
|
|
1188 |
reference, |
1189 |
toCall, |
1190 |
frameThread, |
1191 |
new ArrayList(0), |
1192 |
ObjectReference.INVOKE_SINGLE_THREADED |
1193 |
); |
1177 |
} catch (Exception e) { |
1194 |
} catch (Exception e) { |
1178 |
// this should never happen, indicates an internal error |
1195 |
// this should never happen, indicates an internal error |
1179 |
throw new RuntimeException("Unexpected exception while invoking unboxing method", e); |
1196 |
throw new RuntimeException("Unexpected exception while invoking unboxing method", e); |
Lines 1534-1543
Link Here
|
1534 |
static int INVOKE_TIMEOUT_MILLIS = 700; |
1551 |
static int INVOKE_TIMEOUT_MILLIS = 700; |
1535 |
|
1552 |
|
1536 |
public static Value invokeVirtual ( |
1553 |
public static Value invokeVirtual ( |
1537 |
ObjectReference objectReference, |
1554 |
Object objectReference, |
1538 |
Method method, |
1555 |
Method method, |
|
|
1556 |
ThreadReference evaluationThread, |
1557 |
List args |
1558 |
) throws TimeoutException, InvalidExpressionException { |
1559 |
return invokeVirtual ( |
1560 |
objectReference, |
1561 |
method, |
1562 |
evaluationThread, |
1563 |
args, |
1564 |
ObjectReference.INVOKE_SINGLE_THREADED |
1565 |
); |
1566 |
} |
1567 |
|
1568 |
public static Value invokeVirtual ( |
1569 |
Object objectReference, |
1570 |
Method method, |
1539 |
ThreadReference evaluationThread, |
1571 |
ThreadReference evaluationThread, |
1540 |
List args |
1572 |
List args, |
|
|
1573 |
int options |
1541 |
) throws TimeoutException, InvalidExpressionException { |
1574 |
) throws TimeoutException, InvalidExpressionException { |
1542 |
|
1575 |
|
1543 |
EvaluationThread evalThread = new EvaluationThread ( |
1576 |
EvaluationThread evalThread = new EvaluationThread ( |
Lines 1545-1551
Link Here
|
1545 |
evaluationThread, |
1578 |
evaluationThread, |
1546 |
method, |
1579 |
method, |
1547 |
args, |
1580 |
args, |
1548 |
ObjectReference.INVOKE_SINGLE_THREADED |
1581 |
options |
1549 |
); |
1582 |
); |
1550 |
synchronized (evalThread) { |
1583 |
synchronized (evalThread) { |
1551 |
evalThread.start(); |
1584 |
evalThread.start(); |
Lines 1554-1560
Link Here
|
1554 |
} catch (InterruptedException e) { |
1587 |
} catch (InterruptedException e) { |
1555 |
} |
1588 |
} |
1556 |
if (!evalThread.isFinished ()) { |
1589 |
if (!evalThread.isFinished ()) { |
1557 |
evalThread.stop(); // we cannot gracefully finish the thread, it's stuck in JDI |
1590 |
evalThread.stop (); // we cannot gracefully finish the thread, it's stuck in JDI |
1558 |
throw new TimeoutException (); |
1591 |
throw new TimeoutException (); |
1559 |
} |
1592 |
} |
1560 |
if (evalThread.getException () != null) |
1593 |
if (evalThread.getException () != null) |
Lines 1568-1574
Link Here
|
1568 |
|
1601 |
|
1569 |
private static class EvaluationThread extends Thread { |
1602 |
private static class EvaluationThread extends Thread { |
1570 |
|
1603 |
|
1571 |
private ObjectReference obj; |
1604 |
private Object obj; |
1572 |
private ThreadReference evaluationThread; |
1605 |
private ThreadReference evaluationThread; |
1573 |
private Method method; |
1606 |
private Method method; |
1574 |
private List args; |
1607 |
private List args; |
Lines 1578-1584
Link Here
|
1578 |
private Value value; |
1611 |
private Value value; |
1579 |
private Throwable exception; |
1612 |
private Throwable exception; |
1580 |
|
1613 |
|
1581 |
public EvaluationThread(ObjectReference obj, ThreadReference evaluationThread, Method method, List args, int options) { |
1614 |
public EvaluationThread ( |
|
|
1615 |
Object obj, |
1616 |
ThreadReference evaluationThread, |
1617 |
Method method, |
1618 |
List args, |
1619 |
int options |
1620 |
) { |
1582 |
super("EvalThread"); |
1621 |
super("EvalThread"); |
1583 |
this.obj = obj; |
1622 |
this.obj = obj; |
1584 |
this.evaluationThread = evaluationThread; |
1623 |
this.evaluationThread = evaluationThread; |
Lines 1594-1600
Link Here
|
1594 |
Evaluator.class, |
1633 |
Evaluator.class, |
1595 |
"CTL_UnsupportedOperationException" |
1634 |
"CTL_UnsupportedOperationException" |
1596 |
)); |
1635 |
)); |
1597 |
value = obj.invokeMethod(evaluationThread, method, args, options); |
1636 |
if (obj instanceof ClassType) |
|
|
1637 |
value = ((ClassType) obj).invokeMethod |
1638 |
(evaluationThread, method, args, options); |
1639 |
else |
1640 |
value = ((ObjectReference) obj).invokeMethod |
1641 |
(evaluationThread, method, args, options); |
1598 |
} catch (ThreadDeath e) { |
1642 |
} catch (ThreadDeath e) { |
1599 |
return; // killed by the caller, no need to notify |
1643 |
return; // killed by the caller, no need to notify |
1600 |
} catch (Throwable e) { |
1644 |
} catch (Throwable e) { |