Main Page | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

method.c File Reference


Detailed Description

Manipulate ClassFile methods.

Control

$URL: https://svn.apache.org/path/name/method.c $ $Id: method.c 0 09/28/2005 dlydick $

Copyright 2005 The Apache Software Foundation or its licensors, as applicable.

Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and limitations under the License.

Version:
$LastChangedRevision: 0 $
Date:
$LastChangedDate: 09/28/2005 $
Author:
$LastChangedBy: dlydick $ Original code contributed by Daniel Lydick on 09/28/2005.

Reference

Definition in file method.c.

#include "arch.h"
#include <stdlib.h>
#include <strings.h>
#include "jvmcfg.h"
#include "cfmacros.h"
#include "classfile.h"
#include "exit.h"
#include "jvm.h"
#include "jvmclass.h"
#include "linkage.h"
#include "nts.h"
#include "utf.h"

Go to the source code of this file.

Functions

static void method_c_dummy (void)
jvm_method_index method_find_by_cp_entry (jvm_class_index clsidx, cp_info_dup *mthname, cp_info_dup *mthdesc)
 Locate the method_info index for a normal method in a class using a constant_pool entry to the name and description of the method.
jvm_method_index method_find_by_prchar (jvm_class_index clsidx, rchar *mthname, rchar *mthdesc)
 Retrieve by (rchar *) name a method index to a method in a class.
jvm_basetype method_return_type (jvm_class_index clsidx, jvm_constant_pool_index mthdescidx)
 Extract method return type from descriptor.

Variables

static char * method_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/method.c $ $Id: method.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable."


Function Documentation

static void method_c_dummy void   )  [static]
 

Definition at line 40 of file method.c.

jvm_method_index method_find_by_cp_entry jvm_class_index  clsidx,
cp_info_dup mthname,
cp_info_dup mthdesc
 

Locate the method_info index for a normal method in a class using a constant_pool entry to the name and description of the method.

Parameters:
clsidx Class index of class whose method is to be located.
mthname UTF8 constant_pool entry of name of method in class.
mthdesc UTF8 constant_pool entry of description of method parameters and return type.
Returns:
method table index of this method in class or jvm_method_index_bad if not found.
Throws: nothing. Let caller throw an error like JVMCLASS_JAVA_LANG_NOSUCHMETHODERROR if it is useful at that point. The purpose of this function is simply to locate the method, not make a value judgment on the meaning of the search result.

Definition at line 86 of file method.c.

References CLASS_OBJECT_LINKAGE, CONSTANT_Utf8, EXIT_JVM_METHOD, exit_throw_exception(), jvm_class_index_null, jvm_method_index_bad, JVMCLASS_JAVA_LANG_INTERNALERROR, ClassFile::methods, ClassFile::methods_count, method_info::name_index, PTR_THIS_CP_Utf8, CONSTANT_Utf8_info::tag, and utf_pcfs_strcmp().

Referenced by linkage_resolve_class(), and method_find_by_prchar().

jvm_method_index method_find_by_prchar jvm_class_index  clsidx,
rchar mthname,
rchar mthdesc
 

Retrieve by (rchar *) name a method index to a method in a class.

Parameters:
clsidx Class index of class whose method is to be located.
mthname Null-terminated string of name of method in class.
mthdesc Null-terminated string of description of method parameters and return type.
Returns:
method index of located method in class, otherwise jvm_method_index_bad.

Definition at line 158 of file method.c.

References HEAP_FREE_DATA, method_find_by_cp_entry(), and nts_prchar2utf().

Referenced by class_load_from_prchar(), object_run_method(), and opcode_run().

jvm_basetype method_return_type jvm_class_index  clsidx,
jvm_constant_pool_index  mthdescidx
 

Extract method return type from descriptor.

Parameters:
clsidx Class table index of method to examine.
mthdescidx Class file constant_pool index of method descriptor to examine. This entry must be a CONSTANT_Utf8_info string containing the descriptor of an unqualified method name.
Returns:
Primative base type of method return value or LOCAL_BASETYPE_ERROR if not found.
< Open parameter list

< Signed byte

< Unicode character

< Double-precision floating-point value

< Single-precision floating-point value

< Integer

< Long integer

< an instance of class '/class/name'

< Signed short

< Boolean, true or false

< Reference to one array dimension

< No return type, instead: (rvoid) fn(p1,p2,...)

Todo:
Should this throw a VerifyError instead? Is it better to let caller do this?
< Invalid basetype due to malformed tag or other error (not in spec)

Definition at line 192 of file method.c.

References BASETYPE_CHAR_ARRAY, BASETYPE_CHAR_B, BASETYPE_CHAR_C, BASETYPE_CHAR_D, BASETYPE_CHAR_F, BASETYPE_CHAR_I, BASETYPE_CHAR_J, BASETYPE_CHAR_L, BASETYPE_CHAR_S, BASETYPE_CHAR_Z, CONSTANT_Utf8_info::bytes, CLASS_OBJECT_LINKAGE, CONSTANT_Utf8_info::length, LOCAL_BASETYPE_ERROR, METHOD_CHAR_CLOSE_PARM, METHOD_CHAR_VOID, and PTR_THIS_CP_Utf8.


Variable Documentation

char* method_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/method.c $ $Id: method.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable." [static]
 

Definition at line 40 of file method.c.


Generated on Fri Sep 30 18:50:08 2005 by  doxygen 1.4.4