109 lines
3.5 KiB
C++
109 lines
3.5 KiB
C++
#ifndef __CAVM_ATTRIBUTES_H
|
|
#define __CAVM_ATTRIBUTES_H
|
|
|
|
#include <ClassFormat.h>
|
|
#include <SpecTypes.h>
|
|
#include <Utils/CRC32_CompileTime.hpp>
|
|
#include <cstdint>
|
|
|
|
namespace Attributes
|
|
{
|
|
enum class ClassAttributes : uint32_t
|
|
{
|
|
SOURCE_FILE = "SourceFile"_crc32,
|
|
INNER_CLASSES = "InnerClasses"_crc32,
|
|
ENCLOSING_METHOD = "EnclosingMethod"_crc32,
|
|
SOURCE_DEBUG_EXTENSION = "SourceDebugExtension"_crc32,
|
|
BOOTSTRAP_METHODS = "BootstrapMethods"_crc32,
|
|
MODULE = "Module"_crc32,
|
|
MODULE_PACKAGES = "ModulePackages"_crc32,
|
|
MODULE_MAIN_CLASS = "ModuleMainClass"_crc32,
|
|
NEST_HOST = "NestHost"_crc32,
|
|
NEST_MEMBERS = "NestMembers"_crc32,
|
|
RECORD = "Record"_crc32,
|
|
PERMITTED_SUBCLASSES = "PermittedSubclasses"_crc32,
|
|
SYNTHETIC = "Synthetic"_crc32,
|
|
DEPRECATED = "Deprecated"_crc32,
|
|
SIGNATURE = "Signature"_crc32,
|
|
RUNTIME_VISIBLE_ANNOTATIONS = "RuntimeVisibleAnnotations"_crc32,
|
|
};
|
|
|
|
enum class FieldAttributes : uint32_t
|
|
{
|
|
CONSTANT_VALUE = "ConstantValue"_crc32,
|
|
SYNTHETIC = "Synthetic"_crc32,
|
|
DEPRECATED = "Deprecated"_crc32,
|
|
SIGNATURE = "Signature"_crc32,
|
|
RUNTIME_VISIBLE_ANNOTATIONS = "RuntimeVisibleAnnotations"_crc32,
|
|
RUNTIME_INVISIBLE_ANNOTATIONS = "RuntimeInvisibleAnnotations"_crc32,
|
|
RUNTIME_VISIBLE_TYPE_ANNOTATIONS = "RuntimeVisibleTypeAnnotations"_crc32,
|
|
RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = "RuntimeInvisibleTypeAnnotations"_crc32,
|
|
};
|
|
|
|
enum class MethodAttributes : uint32_t
|
|
{
|
|
CODE = "Code"_crc32,
|
|
EXCEPTIONS = "Exceptions"_crc32,
|
|
RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = "RuntimeVisibleParameterAnnotations"_crc32,
|
|
RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = "RuntimeInvisibleParameterAnnotations"_crc32,
|
|
ANNOTATION_DEFAULT = "AnnotationDefault"_crc32,
|
|
METHOD_PARAMETERS = "MethodParameters"_crc32,
|
|
SYNTHETIC = "Synthetic"_crc32,
|
|
DEPRECATED = "Deprecated"_crc32,
|
|
SIGNATURE = "Signature"_crc32,
|
|
RUNTIME_VISIBLE_ANNOTATIONS = "RuntimeVisibleAnnotations"_crc32,
|
|
RUNTIME_INVISIBLE_ANNOTATIONS = "RuntimeInvisibleAnnotations"_crc32,
|
|
RUNTIME_VISIBLE_TYPE_ANNOTATIONS = "RuntimeVisibleTypeAnnotations"_crc32,
|
|
RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = "RuntimeInvisibleTypeAnnotations"_crc32,
|
|
};
|
|
|
|
enum class RecordComponentAttributes : uint32_t
|
|
{
|
|
RUNTIME_VISIBLE_ANNOTATIONS = "RuntimeVisibleAnnotations"_crc32,
|
|
RUNTIME_INVISIBLE_ANNOTATIONS = "RuntimeInvisibleAnnotations"_crc32,
|
|
RUNTIME_VISIBLE_TYPE_ANNOTATIONS = "RuntimeVisibleTypeAnnotations"_crc32,
|
|
RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = "RuntimeInvisibleTypeAnnotations"_crc32,
|
|
};
|
|
|
|
enum class CodeAttributes : uint32_t
|
|
{
|
|
LINE_NUMBER_TABLE = "LineNumberTable"_crc32,
|
|
LOCAL_VARIABLE_TABLE = "LocalVariableTable"_crc32,
|
|
LOCAL_VARIABLE_TYPE_TABLE = "LocalVariableTypeTable"_crc32,
|
|
STACK_MAP_TABLE = "StackMapTable"_crc32,
|
|
RUNTIME_VISIBLE_TYPE_ANNOTATIONS = "RuntimeVisibleTypeAnnotations"_crc32,
|
|
RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = "RuntimeInvisibleTypeAnnotations"_crc32,
|
|
};
|
|
|
|
struct CODE_Attribute : BaseAttribute
|
|
{
|
|
private:
|
|
typedef struct
|
|
{
|
|
u2 start_pc;
|
|
u2 end_pc;
|
|
u2 handler_pc;
|
|
u2 catch_type;
|
|
} exception_table;
|
|
|
|
public:
|
|
u2 max_stack;
|
|
u2 max_locals;
|
|
u4 code_length;
|
|
std::vector<uint8_t> code;
|
|
u2 exception_table_length;
|
|
std::vector<exception_table> exceptions;
|
|
u2 attributes_count;
|
|
std::vector<attribute_info> attributes;
|
|
};
|
|
|
|
|
|
struct SOURCE_FILE_Attribute : BaseAttribute
|
|
{
|
|
u2 sourcefile_index;
|
|
};
|
|
|
|
attribute_info AttributesParser(JavaClassFormat &jc);
|
|
} // namespace Attributes
|
|
|
|
#endif |