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 cfmacros.h.
#include "heap.h"
Go to the source code of this file.
UTF string manipulation macros. | ||||||||||||||||||||||||||||||||||
Probe CONSTANT_Utf8_info constant_pool entries for field data and addresses. Return information about (CONSTANT_Utf8_info) entry, namely:
| ||||||||||||||||||||||||||||||||||
#define | CP1_CLASS_NAME_STRLEN(pcfs, cpidx) CP1_NAME_STRLEN(CONSTANT_Class_info, pcfs, cpidx, name_index) | |||||||||||||||||||||||||||||||||
#define | CP1_NAME_STRLEN(type, pcfs, cpidx, strname_idx) CP_THIS_STRLEN(pcfs, (PTR_CP_ENTRY_TYPE(type,pcfs,cpidx)->strname_idx)) | |||||||||||||||||||||||||||||||||
#define | CP2_CLASS_NAME_STRLEN(type, pcfs, cpidx, strname_idx) | |||||||||||||||||||||||||||||||||
#define | CP_THIS_STRLEN(pcfs, cpidx) PTR_CP_ENTRY_TYPE(CONSTANT_Utf8_info, pcfs, cpidx)->length | |||||||||||||||||||||||||||||||||
#define | PTR_CP1_CLASS_NAME(pcfs, cpidx) PTR_CP1_NAME(CONSTANT_Class_info, pcfs, cpidx, name_index) | |||||||||||||||||||||||||||||||||
#define | PTR_CP1_CLASS_NAME_STRNAME(pcfs, cpidx) PTR_CP1_NAME_STRNAME(CONSTANT_Class_info, pcfs, cpidx, name_index) | |||||||||||||||||||||||||||||||||
#define | PTR_CP1_NAME(type, pcfs, cpidx, strname_idx) PTR_CP_THIS(pcfs, (PTR_CP_ENTRY_TYPE(type, pcfs,cpidx)->strname_idx)) | |||||||||||||||||||||||||||||||||
#define | PTR_CP1_NAME_STRNAME(type, pcfs, cpidx, strname_idx) | |||||||||||||||||||||||||||||||||
#define | PTR_CP2_CLASS_NAME(type, pcfs, cpidx, strname_idx) | |||||||||||||||||||||||||||||||||
#define | PTR_CP2_CLASS_NAME_STRNAME(type, pcfs, cpidx, strname_idx) | |||||||||||||||||||||||||||||||||
#define | PTR_CP_THIS(pcfs, cpidx) PTR_CP_ENTRY_TYPE(CONSTANT_Utf8_info, pcfs, cpidx) | |||||||||||||||||||||||||||||||||
#define | PTR_CP_THIS_STRNAME(pcfs, cpidx) | |||||||||||||||||||||||||||||||||
Architecture-dependent byte swapping macros. | ||||||||||||||||||||||||||||||||||
Inline the logic to swap bytes on multi-byte elements.
This is only meaningful on CONFIG_LITTLE_ENDIAN architectures. (Notice that if
| ||||||||||||||||||||||||||||||||||
#define | CP_ITEM_SWAP_U2(type, member) | |||||||||||||||||||||||||||||||||
#define | CP_ITEM_SWAP_U4(type, member) | |||||||||||||||||||||||||||||||||
General navigation and parsing macros. | ||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||
#define | CP_TAG(pcfs, cpidx) ((PTR_CP_ENTRY(pcfs, cpidx))->tag) | |||||||||||||||||||||||||||||||||
Report the (u1) tag value of the class file pcf constant_pool entry at this index cpidx. | ||||||||||||||||||||||||||||||||||
#define | PTR_CP_ENTRY(pcfs, cpidx) (&(pcfs->constant_pool[cpidx])->cp) | |||||||||||||||||||||||||||||||||
Report the (cp_info *) of the address of the class file pcfs constant_pool entry at this index cpidx. | ||||||||||||||||||||||||||||||||||
#define | PTR_CP_INFO(pcfs, cpidx) ((u1 *) (&PTR_CP_ENTRY(pcfs, cpidx)->info)) | |||||||||||||||||||||||||||||||||
Point into a (cp_info) data structure and return start of info field as a (u1 *). | ||||||||||||||||||||||||||||||||||
Generic prefix bytes. | ||||||||||||||||||||||||||||||||||
Fill in empty area at start of selected structures for address alignment purposes.
Fill pattern bytes are provided for (cp_info) and (attribute_info) structure alignment within (cp_info_dup) and (attribute_info_dup) structures. This assures that 2- and 4-byte alignments needed for the beginning of those structures is followed (after the first element, the Real machine architectures that have issues with non-aligned multi-byte accesses do not like the fact that ClassFile structures such as cp_info begin with a single byte field followed by multi-byte fields. In like manner, structures like attribute_info have only 2- and 4-byte fields, yet may contain an odd number of bytes in their info fields. Due to the streaming nature of Java class files, subsequent attributes may thus be misaligned, even though they may only contain fields with an even number of bytes. Thus the cp_info_dup and attribute_info_dup structures were devised to suppress problems like this. When the class file is read, all structure accesses are performed on blocks of allocated memory that start on 4- or 8-byte address boundaries and pad the first few bytes so that all 2- and 4-byte accesses are on 2- or 4-byte boundaries. There are three FILL_INFO_DUPx fill fields for padding and three FILL_INFO_NOTUSED_Ux fill fields for assigning values to notusedXX fields.
| ||||||||||||||||||||||||||||||||||
#define | FILL_INFO_DUP0 0xbe | |||||||||||||||||||||||||||||||||
#define | FILL_INFO_DUP1 0xef | |||||||||||||||||||||||||||||||||
#define | FILL_INFO_DUP2 0x99 | |||||||||||||||||||||||||||||||||
#define | FILL_INFO_NOTUSED_U1 0x9a | |||||||||||||||||||||||||||||||||
#define | FILL_INFO_NOTUSED_U2 0x9ace | |||||||||||||||||||||||||||||||||
#define | FILL_INFO_NOTUSED_U4 0x9aceface | |||||||||||||||||||||||||||||||||
Responses to generic failure types | ||||||||||||||||||||||||||||||||||
Generic return type for error test, including either return value of a typed rnull pointer (GENERIC_FAILUREx_PTR() only), a generic value (GENERIC_FAILUREx_VALUE() only), or throw an error (GENERIC_FAILUREx_THROWERROR() only), plus a error message. If expr is rtrue, return the return value or throw the error (depending on the specific macro), else continue with inline code.
The versions GENERAL_FAILURE1_xxx() and GENERAL_FAILURE2_xxx() also may pass a formatting parameter for The following is a grand union of the parameters for all of these macros. A given macro may or may not use some of them:
| ||||||||||||||||||||||||||||||||||
#define | GENERIC_FAILURE1_PTR(expr, dml, fn, msg, parm1, rettype,heap1ptr, heap2ptr) | |||||||||||||||||||||||||||||||||
#define | GENERIC_FAILURE1_THROWERROR(expr, dml, fn, msg, parm1, retval, retclass, heap1ptr, heap2ptr) | |||||||||||||||||||||||||||||||||
#define | GENERIC_FAILURE1_VALUE(expr, dml, fn, msg, parm1, retval,heap1ptr, heap2ptr) | |||||||||||||||||||||||||||||||||
#define | GENERIC_FAILURE2_PTR(expr, dml, fn, msg, parm1, parm2, rettype, heap1ptr, heap2ptr) | |||||||||||||||||||||||||||||||||
#define | GENERIC_FAILURE2_THROWERROR(expr, dml, fn, msg, parm1, parm2,retval, retclass, heap1ptr, heap2ptr) | |||||||||||||||||||||||||||||||||
#define | GENERIC_FAILURE2_VALUE(expr, dml, fn, msg, parm1, parm2, retval, heap1ptr, heap2ptr) | |||||||||||||||||||||||||||||||||
#define | GENERIC_FAILURE_PTR(expr, dml, fn, msg, rettype,heap1ptr, heap2ptr) | |||||||||||||||||||||||||||||||||
#define | GENERIC_FAILURE_THROWERROR(expr, dml, fn, msg, retval, retclass, heap1ptr, heap2ptr) | |||||||||||||||||||||||||||||||||
#define | GENERIC_FAILURE_VALUE(expr, dml, fn, msg, retval, heap1ptr,heap2ptr) | |||||||||||||||||||||||||||||||||
Support for failed system calls | ||||||||||||||||||||||||||||||||||
Recover from error when loading and parsing class file by returning an rnull pointer, properly cast.
| ||||||||||||||||||||||||||||||||||
#define | LOAD_SYSCALL_FAILURE(expr, msg, heap1ptr, heap2ptr) | |||||||||||||||||||||||||||||||||
#define | LOAD_SYSCALL_FAILURE_ATTRIB(expr, msg, heap1ptr, heap2ptr) | |||||||||||||||||||||||||||||||||
Non-aligned multi-byte field access | ||||||||||||||||||||||||||||||||||
Cast arbitrary pointers to type (u2 *) and (u4 *) for referencing items in class file data image. These pointers DO NOT need to be 2- or 4-byte aligned.
| ||||||||||||||||||||||||||||||||||
#define | MAKE_PU2(ptr, loc) ptr = (u2 *) (loc) | |||||||||||||||||||||||||||||||||
#define | MAKE_PU4(ptr, loc) ptr = (u4 *) (loc) | |||||||||||||||||||||||||||||||||
Pointer casting for very common constructions. | ||||||||||||||||||||||||||||||||||
Report the (cp_info *) of a PTR_CP_ENTRY(), but cast as a pointer to one of the following data types. The PTR_CP_ENTRY_TYPE() macro may used to choose any arbitrary type at all.
If
| ||||||||||||||||||||||||||||||||||
#define | PTR_CP_ENTRY_CLASS(pcfs, cpidx) ((CONSTANT_Class_info *) PTR_CP_ENTRY(pcfs, cpidx)) | |||||||||||||||||||||||||||||||||
#define | PTR_CP_ENTRY_TYPE(type, pcfs, cpidx) ((type *) PTR_CP_ENTRY(pcfs, cpidx)) | |||||||||||||||||||||||||||||||||
#define | PTR_CP_ENTRY_UTF8(pcfs, cpidx) ((CONSTANT_Utf8_info *) PTR_CP_ENTRY(pcfs, cpidx)) | |||||||||||||||||||||||||||||||||
Typed constant_pool pointers | ||||||||||||||||||||||||||||||||||
Convert generic constant_pool[] entry into a CONSTANT_xxxxx_info typed pointer, stripping off the generic prefix bytes.
Adjust a generic constant_pool entry (cp_info_dup *) into its corresponding CONSTANT_xxxxx_info typed pointer by changing the pointer to point not to the beginning of the (cp_info_dup) structure, but to its
| ||||||||||||||||||||||||||||||||||
#define | PTR_THIS_CP_Class(pcpinfodup) ((CONSTANT_Class_info *) &(pcpinfodup)->cp) | |||||||||||||||||||||||||||||||||
#define | PTR_THIS_CP_Double(pcpinfodup) ((CONSTANT_Double_info *) &(pcpinfodup)->cp) | |||||||||||||||||||||||||||||||||
#define | PTR_THIS_CP_Fieldref(pcpinfodup) ((CONSTANT_Fieldref_info *) &(pcpinfodup)->cp) | |||||||||||||||||||||||||||||||||
#define | PTR_THIS_CP_Float(pcpinfodup) ((CONSTANT_Float_info *) &(pcpinfodup)->cp) | |||||||||||||||||||||||||||||||||
#define | PTR_THIS_CP_Integer(pcpinfodup) ((CONSTANT_Integer_info *) &(pcpinfodup)->cp) | |||||||||||||||||||||||||||||||||
#define | PTR_THIS_CP_InterfaceMethodref(pcpinfodup) ((CONSTANT_InterfaceMethodref_info *) &(pcpinfodup)->cp) | |||||||||||||||||||||||||||||||||
#define | PTR_THIS_CP_Long(pcpinfodup) ((CONSTANT_Long_info *) &(pcpinfodup)->cp) | |||||||||||||||||||||||||||||||||
#define | PTR_THIS_CP_Methodref(pcpinfodup) ((CONSTANT_Methodref_info *) &(pcpinfodup)->cp) | |||||||||||||||||||||||||||||||||
#define | PTR_THIS_CP_NameAndType(pcpinfodup) ((CONSTANT_NameAndType_info *) &(pcpinfodup)->cp) | |||||||||||||||||||||||||||||||||
#define | PTR_THIS_CP_String(pcpinfodup) ((CONSTANT_String_info *) &(pcpinfodup)->cp) | |||||||||||||||||||||||||||||||||
#define | PTR_THIS_CP_Utf8(pcpinfodup) ((CONSTANT_Utf8_info *) &(pcpinfodup)->cp) | |||||||||||||||||||||||||||||||||
Functions | ||||||||||||||||||||||||||||||||||
ARCH_COPYRIGHT_APACHE (cfmacros, h,"$URL: https://svn.apache.org/path/name/cfmacros.h $ $Id: cfmacros.h 0 09/28/2005 dlydick $") |
|
Definition at line 81 of file cfmacros.h. Referenced by classfile_allocate_primative(), classfile_loadclassdata(), linkage_resolve_class(), and opcode_run(). |
|
Definition at line 84 of file cfmacros.h. Referenced by classfile_loadclassdata(), and linkage_resolve_class(). |
|
Definition at line 87 of file cfmacros.h. Referenced by classfile_loadclassdata(), and linkage_resolve_class(). |
|
Definition at line 90 of file cfmacros.h. Referenced by classfile_loadclassdata(), and linkage_resolve_class(). |
|
Definition at line 93 of file cfmacros.h. |
|
Definition at line 96 of file cfmacros.h. |
|
Definition at line 99 of file cfmacros.h. |
|
Definition at line 102 of file cfmacros.h. |
|
Definition at line 105 of file cfmacros.h. |
|
Definition at line 108 of file cfmacros.h. Referenced by linkage_resolve_class(), and opcode_run(). |
|
Definition at line 111 of file cfmacros.h. Referenced by attribute_name_common_find(), class_load_primative(), classfile_allocate_primative(), classfile_loadclassdata(), field_find_by_cp_entry(), linkage_resolve_class(), method_find_by_cp_entry(), method_return_type(), nts_prchar2utf(), nts_prchar2utf_classname(), opcode_run(), and unicode_cnv2utf(). |
|
Report the (cp_info *) of the address of the class file
Definition at line 136 of file cfmacros.h. |
|
Report the (u1) tag value of the class file
Definition at line 147 of file cfmacros.h. Referenced by cfmsgs_typemsg(), classfile_loadclassdata(), and linkage_resolve_class(). |
|
Point into a (cp_info) data structure and return start of info field as a (u1 *).
Definition at line 158 of file cfmacros.h. |
|
Definition at line 207 of file cfmacros.h. Referenced by cfmsgs_typemsg(). |
|
Definition at line 210 of file cfmacros.h. Referenced by utf_pcfs_strcmp(). |
|
Definition at line 213 of file cfmacros.h. |
|
Definition at line 379 of file cfmacros.h. |
|
Definition at line 382 of file cfmacros.h. Referenced by cfmsgs_typemsg(), jvmutil_print_stack_common(), utf_pcfs_strcmp(), utf_prchar_pcfs_strcmp(), and utf_utf_strcmp(). |
|
Value: ((rchar *) &PTR_CP_ENTRY_TYPE(CONSTANT_Utf8_info, pcfs, cpidx) \ ->bytes[0]) Definition at line 385 of file cfmacros.h. Referenced by cfmsgs_typemsg(), jvmutil_print_stack_common(), utf_pcfs_strcmp(), utf_prchar_pcfs_strcmp(), and utf_utf_strcmp(). |
|
Definition at line 396 of file cfmacros.h. |
|
Definition at line 399 of file cfmacros.h. Referenced by cfmsgs_typemsg(), jvmutil_print_errtype_stack(), and jvmutil_print_stack_common(). |
|
Value: PTR_CP_THIS_STRNAME(pcfs, (PTR_CP_ENTRY_TYPE(type, pcfs, cpidx) \ ->strname_idx)) Definition at line 402 of file cfmacros.h. Referenced by cfmsgs_typemsg(), jvmutil_print_errtype_stack(), and jvmutil_print_stack_common(). |
|
Definition at line 413 of file cfmacros.h. |
|
Definition at line 417 of file cfmacros.h. |
|
Definition at line 420 of file cfmacros.h. Referenced by thread_new(). |
|
Value: PTR_CP_THIS(pcfs, \ (PTR_CP_ENTRY_TYPE(CONSTANT_Class_info, \ pcfs, \ (PTR_CP_ENTRY_TYPE(type, pcfs, cpidx) \ ->strname_idx)) \ ->name_index)) Definition at line 430 of file cfmacros.h. |
|
Value: CP_THIS_STRLEN(pcfs, \ (PTR_CP_ENTRY_TYPE(CONSTANT_Class_info, \ pcfs, \ (PTR_CP_ENTRY_TYPE(type, pcfs, cpidx) \ ->strname_idx)) \ ->name_index)) Definition at line 438 of file cfmacros.h. Referenced by cfmsgs_typemsg(). |
|
Value: PTR_CP_THIS_STRNAME(pcfs, \ (PTR_CP_ENTRY_TYPE(CONSTANT_Class_info, \ pcfs, \ (PTR_CP_ENTRY_TYPE(type, pcfs, cpidx) \ ->strname_idx)) \ ->name_index)) Definition at line 446 of file cfmacros.h. Referenced by cfmsgs_typemsg(). |
|
Definition at line 478 of file cfmacros.h. Referenced by cfattrib_loadattribute(), and classfile_loadclassdata(). |
|
Definition at line 479 of file cfmacros.h. Referenced by classfile_loadclassdata(). |
|
Value: if (expr) \ { \ HEAP_FREE_DATA((rvoid *) heap1ptr); /* Ignored if rnull */ \ HEAP_FREE_DATA((rvoid *) heap2ptr); /* Ignored if rnull */ \ sysDbgMsg(dml, fn, msg); \ return((rettype *) rnull); \ } Definition at line 552 of file cfmacros.h. Referenced by cfattrib_loadattribute(). |
|
Value: if (expr) \ { \ HEAP_FREE_DATA((rvoid *) heap1ptr); /* Ignored if rnull */ \ HEAP_FREE_DATA((rvoid *) heap2ptr); /* Ignored if rnull */ \ sysDbgMsg(dml, fn, msg, parm1); \ return((rettype *) rnull); \ } Definition at line 562 of file cfmacros.h. Referenced by classfile_loadclassdata(). |
|
Value: if (expr) \ { \ HEAP_FREE_DATA((rvoid *) heap1ptr); /* Ignored if rnull */ \ HEAP_FREE_DATA((rvoid *) heap2ptr); /* Ignored if rnull */ \ sysDbgMsg(dml, fn, msg, parm1, parm2); \ return((rettype *) rnull); \ } Definition at line 572 of file cfmacros.h. |
|
Value: if (expr) \ { \ HEAP_FREE_DATA((rvoid *) heap1ptr); /* Ignored if rnull */ \ HEAP_FREE_DATA((rvoid *) heap2ptr); /* Ignored if rnull */ \ sysDbgMsg(dml, fn, msg); \ return(retval); \ } Definition at line 582 of file cfmacros.h. |
|
Value: if (expr) \ { \ HEAP_FREE_DATA((rvoid *) heap1ptr); /* Ignored if rnull */ \ HEAP_FREE_DATA((rvoid *) heap2ptr); /* Ignored if rnull */ \ sysDbgMsg(dml, fn, msg, parm1); \ return(retval); \ } Definition at line 592 of file cfmacros.h. Referenced by linkage_resolve_class(). |
|
Value: if (expr) \ { \ HEAP_FREE_DATA((rvoid *) heap1ptr); /* Ignored if rnull */ \ HEAP_FREE_DATA((rvoid *) heap2ptr); /* Ignored if rnull */ \ sysDbgMsg(dml, fn, msg, parm1, parm2); \ return(retval); \ } Definition at line 602 of file cfmacros.h. |
|
Value: if (expr) \ { \ HEAP_FREE_DATA((rvoid *) heap1ptr); /* Ignored if rnull */ \ HEAP_FREE_DATA((rvoid *) heap2ptr); /* Ignored if rnull */ \ sysDbgMsg(dml, fn, msg); \ exit_throw_exception(retval, retclass); \ /*NOTREACHED*/ \ } Definition at line 612 of file cfmacros.h. |
|
Value: if (expr) \ { \ HEAP_FREE_DATA((rvoid *) heap1ptr); /* Ignored if rnull */ \ HEAP_FREE_DATA((rvoid *) heap2ptr); /* Ignored if rnull */ \ sysDbgMsg(dml, fn, msg, parm1); \ exit_throw_exception(retval, retclass); \ /*NOTREACHED*/ \ } Definition at line 623 of file cfmacros.h. |
|
Value: if (expr) \ { \ HEAP_FREE_DATA((rvoid *) heap1ptr); /* Ignored if rnull */ \ HEAP_FREE_DATA((rvoid *) heap2ptr); /* Ignored if rnull */ \ sysDbgMsg(dml, fn, msg, parm1, parm2); \ exit_throw_exception(retval, retclass); \ /*NOTREACHED*/ \ } Definition at line 634 of file cfmacros.h. |
|
Value: if (expr) \ { \ HEAP_FREE_METHOD((rvoid *) heap1ptr); \ HEAP_FREE_METHOD((rvoid *) heap2ptr); \ } \ GENERIC_FAILURE_PTR(expr, \ DMLMIN, \ "classfile_loadclassdata", \ msg, \ ClassFile, \ rnull, \ rnull); Definition at line 689 of file cfmacros.h. Referenced by classfile_loadclassdata(). |
|
Value: if (expr) \ { \ HEAP_FREE_METHOD((rvoid *) heap1ptr); \ HEAP_FREE_METHOD((rvoid *) heap2ptr); \ } \ GENERIC_FAILURE_PTR(expr, \ DMLMIN, \ "cfattrib_loadattribute", \ msg, \ u1, \ rnull, \ rnull); Definition at line 703 of file cfmacros.h. Referenced by cfattrib_loadattribute(). |
|
Definition at line 771 of file cfmacros.h. Referenced by classfile_loadclassdata(). |
|
Definition at line 772 of file cfmacros.h. Referenced by classfile_loadclassdata(). |
|
Definition at line 835 of file cfmacros.h. Referenced by cfattrib_loadattribute(), classfile_loadclassdata(), nts_prchar2utf(), and nts_prchar2utf_classname(). |
|
Definition at line 836 of file cfmacros.h. Referenced by cfattrib_loadattribute(), classfile_loadclassdata(), nts_prchar2utf(), and nts_prchar2utf_classname(). |
|
Definition at line 837 of file cfmacros.h. Referenced by classfile_loadclassdata(), nts_prchar2utf(), and nts_prchar2utf_classname(). |
|
Definition at line 842 of file cfmacros.h. |
|
Definition at line 843 of file cfmacros.h. |
|
Definition at line 844 of file cfmacros.h. |
|
|