[jboss-svn-commits] JBL Code SVN: r29463 - labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/rule/expression.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Sep 25 06:19:11 EDT 2009
Author: adinn
Date: 2009-09-25 06:19:11 -0400 (Fri, 25 Sep 2009)
New Revision: 29463
Modified:
labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/rule/expression/ReturnExpression.java
Log:
corrected error in return operation compilation -- fixes BYTEMAN-40
Modified: labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/rule/expression/ReturnExpression.java
===================================================================
--- labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/rule/expression/ReturnExpression.java 2009-09-25 10:18:19 UTC (rev 29462)
+++ labs/jbosstm/workspace/adinn/byteman/trunk/src/org/jboss/byteman/rule/expression/ReturnExpression.java 2009-09-25 10:19:11 UTC (rev 29463)
@@ -168,7 +168,7 @@
public void compile(MethodVisitor mv, StackHeights currentStackHeights, StackHeights maxStackHeights) throws CompileException
{
- Type returnType = (returnValue == null ? Type.VOID : returnValue.getType());
+ Type valueType = (returnValue == null ? Type.VOID : returnValue.getType());
int currentStack = currentStackHeights.stackCount;
int expected = 1;
int extraSlots = 0;
@@ -193,13 +193,17 @@
// stack any required return value or null -- adds 1 to stack but may use 2 slots
if (returnValue != null) {
returnValue.compile(mv, currentStackHeights, maxStackHeights);
- if (returnType.isPrimitive()) {
+ // we may need to convert from the value type to the return type
+ if (valueType != type) {
+ compileTypeConversion(valueType, type, mv, currentStackHeights, maxStackHeights);
+ }
+ if (type.isPrimitive()) {
// if the intermediate value used 2 words then at the peak we needed an extra stack slot
- if (returnType.getNBytes() > 4) {
+ if (valueType.getNBytes() > 4) {
extraSlots++;
}
// we need an object not a primitive
- compileBox(Type.boxType(returnType), mv, currentStackHeights, maxStackHeights);
+ compileBox(Type.boxType(type), mv, currentStackHeights, maxStackHeights);
}
} else {
// just push null
More information about the jboss-svn-commits
mailing list