You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2005/04/07 21:42:49 UTC

svn commit: r160444 - incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/compiler/MethodBuilder.java incubator/derby/code/trunk/java/engine/org/apache/derby/impl/services/bytecode/BCMethod.java

Author: djd
Date: Thu Apr  7 12:42:47 2005
New Revision: 160444

URL: http://svn.apache.org/viewcvs?view=rev&rev=160444
Log:
Derby-167 (partial)
Add pop() method to byte code compiler.


Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/compiler/MethodBuilder.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/services/bytecode/BCMethod.java

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/compiler/MethodBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/compiler/MethodBuilder.java?view=diff&r1=160443&r2=160444
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/compiler/MethodBuilder.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/compiler/MethodBuilder.java Thu Apr  7 12:42:47 2005
@@ -303,7 +303,16 @@
 		</PRE>.
 	*/
 	public void isInstanceOf(String className);
-
+	
+	/**
+	 * Pop the top value off the stack
+		<PRE>
+		Stack ..., value =>
+		      ...
+		</PRE>.
+	*/
+	public void pop();
+		
 	/**
 		End a statement.
 		Pops the top-word of the stack, if any.

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/services/bytecode/BCMethod.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/services/bytecode/BCMethod.java?view=diff&r1=160443&r2=160444
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/services/bytecode/BCMethod.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/services/bytecode/BCMethod.java Thu Apr  7 12:42:47 2005
@@ -77,7 +77,7 @@
 
 	private int currentVarNum;
 	private int statementNum;
-
+	
 	BCMethod(ClassBuilder cb,
 			String returnType,
 			String methodName,
@@ -87,7 +87,6 @@
 
 		this.cb = (BCClass) cb;
 		modClass = this.cb.modify();
-		//this.modifiers = modifiers;
 
 		if (SanityManager.DEBUG) {
    			this.cb.validateType(returnType);
@@ -834,13 +833,21 @@
 	public void completeConditional() {
 		condition = condition.end(myCode, stackTypeOffset);
 	}
+	
+	public void pop() {
+		if (SanityManager.DEBUG) {
+			if (stackDepth == 0)
+				SanityManager.THROWASSERT("pop when stack is empty!");
+		}
+		Type toPop = popStack();
 
-	public void endStatement() {
-		if (stackDepth != 0) {
-			Type toPop = popStack();
+		myCode.addInstr(toPop.width() == 2  ? VMOpcode.POP2 : VMOpcode.POP);
 
-			myCode.addInstr(toPop.width() == 2  ? VMOpcode.POP2 : VMOpcode.POP);
+	}	
 
+	public void endStatement() {
+		if (stackDepth != 0) {
+			pop();
 		}
 
 		//if (SanityManager.DEBUG) {
@@ -973,5 +980,6 @@
 			return false;
 		}
 	}
+	
 }