This file contains the attribute manipulation functions. All other work is performed in classfile.c.
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.
Definition in file cfattrib.c.
#include "arch.h"
#include <string.h>
#include "jvmcfg.h"
#include "cfmacros.h"
#include "classfile.h"
#include "util.h"
#include "utf.h"
Go to the source code of this file.
Code_attribute deferencing support. | |||||||
#define | DST_AI(dst) ((Code_attribute *) &dst->ai) | ||||||
Conveniently reference the Code_attribute contained in a attribute_info_dup *dst , namely, with less pointer indirection. | |||||||
#define | PTR_DST_AI(dst) ((Code_attribute *) &(*dst)->ai) | ||||||
Conveniently reference the Code_attribute contained in an indirect attribute_info_dup **dst . | |||||||
Attribute test utilities. | |||||||
| |||||||
classfile_attribute_enum | cfattrib_atr2enum (ClassFile *pcfs, u2 attribute_name_index) | ||||||
Map UTF8 string names for attributes in a constant_pool to LOCAL_xxx_ATTRIBUTE constants for the purpose of switch(int) instead of switch("string") code constructions. | |||||||
rboolean | cfattrib_iscodeattribute (ClassFile *pcfs, u2 attribute_name_index) | ||||||
Short version of cfattrib_atr2enum(), but only check if an index refers to a Code_attribute area. | |||||||
Defines | |||||||
#define | CMP_ATTRIBUTE(string) utf_prchar_pcfs_strcmp(string, pcfs, attribute_name_index) | ||||||
Convenient shorthand for attribute string comparison. | |||||||
Functions | |||||||
static void | cfattrib_c_dummy (void) | ||||||
u1 * | cfattrib_loadattribute (ClassFile *pcfs, attribute_info_dup **dst, attribute_info *src) | ||||||
Load an attribute and verify that it has either valid contents or is ignored as an unknown attribute. | |||||||
rvoid | cfattrib_unloadattribute (ClassFile *pcfs, attribute_info_dup *dst) | ||||||
UnLoad an attribute and free its heap area. | |||||||
Variables | |||||||
static char * | cfattrib_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/cfattrib.c $ $Id: cfattrib.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable." |
|
Convenient shorthand for attribute string comparison.
Definition at line 68 of file cfattrib.c. Referenced by cfattrib_atr2enum(), and cfattrib_iscodeattribute(). |
|
Conveniently reference the Code_attribute contained in an indirect After putting in the 4-byte access alignment changes, it became obvious that what was once (*dst)->member had become quite cumbersome. Therefore, in order to simplify access through (attribute_info_dup *)->ai.member constructions, including appropriate casting, the following macro is offered to take care of the most common usage. The few other references are unchanged, and the code is easier to understand.
Notice that DST_AI() references a Definition at line 257 of file cfattrib.c. Referenced by cfattrib_loadattribute(). |
|
Conveniently reference the Code_attribute contained in a
This is a counterpart for cfattrib_unloadattribute() where no indirection is needed. Notice that PTR_DST_AI() references a Definition at line 271 of file cfattrib.c. |
|
Definition at line 45 of file cfattrib.c. |
|
|
Short version of cfattrib_atr2enum(), but only check if an index refers to a Code_attribute area.
Definition at line 217 of file cfattrib.c. References CMP_ATTRIBUTE, CONSTANT_UTF8_CODE_ATTRIBUTE, rfalse, and rtrue. |
|
Load an attribute and verify that it has either valid contents or is ignored as an unknown attribute. If the attribute index is valid at all (for either a known or even an unknown but properly formed attribute), it will be copied into its destination area.
< Convenient alias for DML5 < Convenient alias for DML1
Definition at line 304 of file cfattrib.c. References attribute_info::attribute_length, attribute_info::attribute_name_index, cfattrib_atr2enum(), cfattrib_loadattribute(), cfmsgs_typemsg(), ClassFile::constant_pool_count, DMLNORM, FILL_INFO_DUP0, FILL_INFO_DUP1, GENERIC_FAILURE_PTR, GETRI4, GETRS2, HEAP_GET_METHOD, attribute_info::info, LOAD_SYSCALL_FAILURE_ATTRIB, LOCAL_ANNOTATIONDEFAULT_ATTRIBUTE, LOCAL_CODE_ATTRIBUTE, LOCAL_CONSTANTVALUE_ATTRIBUTE, LOCAL_DEPRECATED_ATTRIBUTE, LOCAL_ENCLOSINGMETHOD_ATTRIBUTE, LOCAL_EXCEPTIONS_ATTRIBUTE, LOCAL_INNERCLASSES_ATTRIBUTE, LOCAL_LINENUMBERTABLE_ATTRIBUTE, LOCAL_LOCALVARIABLETABLE_ATTRIBUTE, LOCAL_LOCALVARIABLETYPETABLE_ATTRIBUTE, LOCAL_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE, LOCAL_SIGNATURE_ATTRIBUTE, LOCAL_SOURCEFILE_ATTRIBUTE, LOCAL_SYNTHETIC_ATTRIBUTE, LOCAL_UNKNOWN_ATTRIBUTE, MACHINE_JINT_SWAP, MACHINE_JSHORT_SWAP, MAKE_PU2, PTR_DST_AI, rfalse, rnull, rtrue, and sysDbgMsg(). Referenced by cfattrib_loadattribute(), and classfile_loadclassdata(). |
|
UnLoad an attribute and free its heap area.
Definition at line 705 of file cfattrib.c. |
|
Definition at line 45 of file cfattrib.c. |