From 56c38bbc63f599a55c8f59854b51781dd5cc4ccc Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Sat, 30 May 2020 18:36:12 +0200 Subject: [PATCH] improvements for getComponentType() --- .../jwebassembly/module/TypeManager.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/de/inetsoftware/jwebassembly/module/TypeManager.java b/src/de/inetsoftware/jwebassembly/module/TypeManager.java index 44bb99a..1527852 100644 --- a/src/de/inetsoftware/jwebassembly/module/TypeManager.java +++ b/src/de/inetsoftware/jwebassembly/module/TypeManager.java @@ -69,16 +69,22 @@ public class TypeManager { static final int TYPE_DESCRIPTION_INSTANCEOF_OFFSET = 4; /** - * Byte position in the type description that contains the offset to class name idx. Length 4 bytes. + * Byte position in the type description that contains the offset to class name idx in the string constant table. Length 4 bytes. */ static final int TYPE_DESCRIPTION_TYPE_NAME = 8; + /** + * Byte position in the type description that contains the type of the array (component type). Length 4 bytes. + */ + static final int TYPE_DESCRIPTION_ARRAY_TYPE = 12; + /** * The reserved position on start of the vtable: *
  • offset of interface call table (itable) *
  • offset of instanceof list + *
  • offset of class name idx in the string constant table */ - private static final int VTABLE_FIRST_FUNCTION_INDEX = 3; + private static final int VTABLE_FIRST_FUNCTION_INDEX = 4; private static final FunctionName CLASS_CONSTANT_FUNCTION = new FunctionName( "java/lang/Class.classConstant(I)Ljava/lang/Class;" ); @@ -833,6 +839,9 @@ public class TypeManager { // header position TYPE_DESCRIPTION_TYPE_NAME header.writeInt32( classNameIdx ); // string id of the className + // header position TYPE_DESCRIPTION_ARRAY_TYPE + header.writeInt32( -1 ); + data.writeTo( dataStream ); }