Java Doc for BCMethod.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » services » bytecode » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.services.bytecode 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.services.bytecode.BCMethod

BCMethod
class BCMethod implements MethodBuilder(Code)
MethodBuilder is used to piece together a method when building a java class definition.

When a method is first created, it has:

  • a return type
  • modifiers
  • a name
  • an empty parameter list
  • an empty throws list
  • an empty statement block

MethodBuilder implementations are required to supply a way for Statements and Expressions to give them code. Most typically, they may have a stream to which their contents writes the code that is of the type to satisfy what the contents represent. MethodBuilder implementations also have to have a way to supply ClassBuilders with their code, that satisfies the type of class builder they are implemented with. This is implementation-dependent, so ClassBuilders, MethodBuilders, Statements, and Expressions all have to be of the same implementation in order to interact to generate a class.

Method Builder implementation for generating bytecode.



Field Summary
final static  intCODE_SPLIT_LENGTH
     Code length at which to split into sub-methods. Normally set to the maximim code length the JVM can support, but for testing the split code it can be reduced so that the standard tests cause some splitting.
final static  byteT_BOOLEAN
    
final  BCClasscb
    
 intmaxStack
     Maximum stack depth seen in this method, measured in words.
final protected  ClassHoldermodClass
    
 CodeChunkmyCode
    
protected  ClassMembermyEntry
    
final  StringmyReturnType
    
 BCLocalField[]parameters
     Fast access for the parametes, will be null if the method has no parameters.
 VectorthrownExceptions
    

Constructor Summary
 BCMethod(ClassBuilder cb, String returnType, String methodName, int modifiers, String[] parms, BCJava factory)
    

Method Summary
public  voidaddThrownException(String exceptionClass)
     a throwable can be added to the end of the list of thrownExceptions.
public  intcallMethod(Object methodDescriptor)
    
public  intcallMethod(short opcode, String declaringClass, String methodName, String returnType, int numArgs)
    
final  voidcallSubMethod(BCMethod subMethod)
     Call a sub-method created by getNewSubMethod handling parameters correctly.
public  voidcallSuper()
    
public  voidcast(String className)
    
public  voidcomplete()
     when the method has had all of its parameters and thrown exceptions defined, and its statement block has been completed, it can be completed and its class file information generated.
public  voidcompleteConditional()
    
public  voidconditionalIf()
    
public  voidconditionalIfNull()
    
 ClassHolderconstantPool()
     In their giveCode methods, the parts of the method body will want to get to the constant pool to add their constants.
public  ObjectdescribeMethod(short opcode, String declaringClass, String methodName, String returnType)
    
public  voiddup()
    
public  voidendStatement()
    
public  voidgetArrayElement(int element)
    
public  voidgetField(LocalField field)
    
public  voidgetField(String declaringClass, String fieldName, String fieldType)
    
public  StringgetName()
     Return the logical name of the method.
final  BCMethodgetNewSubMethod(String returnType, boolean withParameters)
     Create a sub-method from this method to allow the code builder to split a single logical method into multiple methods to avoid the 64k per-method code size limit.
public  voidgetParameter(int id)
    
public  voidgetStaticField(String declaringClass, String fieldName, String fieldType)
    
public  voidisInstanceOf(String className)
    
public  voidmethodReturn()
    
public  voidpop()
    
public  voidpush(byte value)
    
public  voidpush(boolean value)
    
public  voidpush(short value)
    
public  voidpush(int value)
    
public  voidpush(long value)
     Push a long value onto the stack. For the values zero and one the LCONST_0 and LCONST_1 instructions are used. For values betwee Short.MIN_VALUE and Short.MAX_VALUE inclusive an byte/short/int value is pushed using push(int, Type) followed by an I2L instruction. This saves using a constant pool entry for such values. All other values use a constant pool entry.
public  voidpush(float value)
    
public  voidpush(double value)
    
public  voidpush(String value)
    
public  voidpushNewArray(String className, int size)
     Create an array instance Stack ...
public  voidpushNewComplete(int numArgs)
    
public  voidpushNewStart(String className)
    
public  voidpushNull(String type)
    
public  voidpushThis()
    
public  voidputField(LocalField field)
     Upon entry the top word(s) on the stack is the value to be put into the field.
public  voidputField(String fieldName, String fieldType)
     Pop the top stack value and store it in the instance field of this class.
public  voidputField(String declaringClass, String fieldName, String fieldType)
     Pop the top stack value and store it in the field.
public  voidsetArrayElement(int element)
    
public  voidsetField(LocalField field)
     Set the field but don't duplicate its value so nothing is left on the stack after this call.
public  voidstartElseCode()
    
public  booleanstatementNumHitLimit(int noStatementsAdded)
     Tell if statement number in this method builder hits limit.
public  voidswap()
    
public  voidupCast(String className)
    
protected  voidwriteExceptions()
     sets exceptionBytes to the attribute_info needed for a method's Exceptions attribute.

Field Detail
CODE_SPLIT_LENGTH
final static int CODE_SPLIT_LENGTH(Code)
Code length at which to split into sub-methods. Normally set to the maximim code length the JVM can support, but for testing the split code it can be reduced so that the standard tests cause some splitting. Tested with value set to 2000.



T_BOOLEAN
final static byte T_BOOLEAN(Code)



cb
final BCClass cb(Code)



maxStack
int maxStack(Code)
Maximum stack depth seen in this method, measured in words. Corresponds to max_stack in the Code attribute of section 4.7.3 of the vm spec.



modClass
final protected ClassHolder modClass(Code)



myCode
CodeChunk myCode(Code)



myEntry
protected ClassMember myEntry(Code)



myReturnType
final String myReturnType(Code)



parameters
BCLocalField[] parameters(Code)
Fast access for the parametes, will be null if the method has no parameters.



thrownExceptions
Vector thrownExceptions(Code)




Constructor Detail
BCMethod
BCMethod(ClassBuilder cb, String returnType, String methodName, int modifiers, String[] parms, BCJava factory)(Code)




Method Detail
addThrownException
public void addThrownException(String exceptionClass)(Code)
a throwable can be added to the end of the list of thrownExceptions.



callMethod
public int callMethod(Object methodDescriptor)(Code)



callMethod
public int callMethod(short opcode, String declaringClass, String methodName, String returnType, int numArgs)(Code)



callSubMethod
final void callSubMethod(BCMethod subMethod)(Code)
Call a sub-method created by getNewSubMethod handling parameters correctly.



callSuper
public void callSuper()(Code)



cast
public void cast(String className)(Code)



complete
public void complete()(Code)
when the method has had all of its parameters and thrown exceptions defined, and its statement block has been completed, it can be completed and its class file information generated.

further alterations of the method will not be reflected in the code generated for it.




completeConditional
public void completeConditional()(Code)



conditionalIf
public void conditionalIf()(Code)



conditionalIfNull
public void conditionalIfNull()(Code)



constantPool
ClassHolder constantPool()(Code)
In their giveCode methods, the parts of the method body will want to get to the constant pool to add their constants. We really only want them treating it like a constant pool inclusion mechanism, we could write a wrapper to limit it to that.



describeMethod
public Object describeMethod(short opcode, String declaringClass, String methodName, String returnType)(Code)



dup
public void dup()(Code)



endStatement
public void endStatement()(Code)



getArrayElement
public void getArrayElement(int element)(Code)



getField
public void getField(LocalField field)(Code)



getField
public void getField(String declaringClass, String fieldName, String fieldType)(Code)



getName
public String getName()(Code)
Return the logical name of the method. The current myEntry refers to the sub method we are currently overflowing to. Those sub-methods are hidden from any caller.



getNewSubMethod
final BCMethod getNewSubMethod(String returnType, boolean withParameters)(Code)
Create a sub-method from this method to allow the code builder to split a single logical method into multiple methods to avoid the 64k per-method code size limit. The sub method with inherit the thrown exceptions of this method.
Parameters:
  returnType - Return type of the new method
Parameters:
  withParameters - True to define the method with matching parameters false todefine it with no parameters. A valid empty sub method.



getParameter
public void getParameter(int id)(Code)



getStaticField
public void getStaticField(String declaringClass, String fieldName, String fieldType)(Code)
Push the contents of the described static field onto the stack.



isInstanceOf
public void isInstanceOf(String className)(Code)



methodReturn
public void methodReturn()(Code)



pop
public void pop()(Code)



push
public void push(byte value)(Code)



push
public void push(boolean value)(Code)



push
public void push(short value)(Code)



push
public void push(int value)(Code)



push
public void push(long value)(Code)
Push a long value onto the stack. For the values zero and one the LCONST_0 and LCONST_1 instructions are used. For values betwee Short.MIN_VALUE and Short.MAX_VALUE inclusive an byte/short/int value is pushed using push(int, Type) followed by an I2L instruction. This saves using a constant pool entry for such values. All other values use a constant pool entry. For values in the range of an Integer an integer constant pool entry is created to allow sharing with integer constants and to reduce constant pool slot entries.



push
public void push(float value)(Code)



push
public void push(double value)(Code)



push
public void push(String value)(Code)



pushNewArray
public void pushNewArray(String className, int size)(Code)
Create an array instance Stack ... => ...,arrayref



pushNewComplete
public void pushNewComplete(int numArgs)(Code)



pushNewStart
public void pushNewStart(String className)(Code)



pushNull
public void pushNull(String type)(Code)



pushThis
public void pushThis()(Code)



putField
public void putField(LocalField field)(Code)
Upon entry the top word(s) on the stack is the value to be put into the field. Ie. we have
 word
 
Before the call we need
 word
 this
 word
 
word2,word1 -> word2, word1, word2 So that we are left with word after the put.



putField
public void putField(String fieldName, String fieldType)(Code)
Pop the top stack value and store it in the instance field of this class.



putField
public void putField(String declaringClass, String fieldName, String fieldType)(Code)
Pop the top stack value and store it in the field. This call requires the instance to be pushed by the caller.



setArrayElement
public void setArrayElement(int element)(Code)



setField
public void setField(LocalField field)(Code)
Set the field but don't duplicate its value so nothing is left on the stack after this call.



startElseCode
public void startElseCode()(Code)



statementNumHitLimit
public boolean statementNumHitLimit(int noStatementsAdded)(Code)
Tell if statement number in this method builder hits limit. This method builder keeps a counter of how many statements are added to it. Caller should call this function every time it tries to add a statement to this method builder (counter is increased by 1), then the function returns whether the accumulated statement number hits a limit. The reason of doing this is that Java compiler has a limit of 64K code size for each method. We might hit this limit if an extremely long insert statement is issued, for example (see beetle 4293). Counting statement number is an approximation without too much overhead.



swap
public void swap()(Code)



upCast
public void upCast(String className)(Code)



writeExceptions
protected void writeExceptions()(Code)
sets exceptionBytes to the attribute_info needed for a method's Exceptions attribute. The ClassUtilities take care of the header 6 bytes for us, so they are not included here. See The Java Virtual Machine Specification Section 4.7.5, Exceptions attribute.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.