├── .gitattributes ├── .gitignore ├── .java-version ├── LICENSE ├── README.md ├── acceptance-testing-template ├── build.gradle └── src │ └── main │ ├── java │ ├── io │ │ └── vproxy │ │ │ └── pni │ │ │ └── test │ │ │ ├── AlignClass.java │ │ │ ├── AllowHeapAccess.java │ │ │ ├── AlwaysAlignedClass.java │ │ │ ├── CustomNativeType.java │ │ │ ├── DefiningCFunction.java │ │ │ ├── GCCCompatibility.java │ │ │ ├── NativeCheck.java │ │ │ ├── NoAlloc.java │ │ │ ├── PNIBitField.java │ │ │ ├── PNIFunc.java │ │ │ ├── PNIGeneric.java │ │ │ ├── PNIInvokeUpcall.java │ │ │ ├── PNIInvokeUpcallNull.java │ │ │ ├── PNINull.java │ │ │ ├── PNIObjectStruct.java │ │ │ ├── PNIPointerArrayField.java │ │ │ ├── PNIPointerOnlyStruct.java │ │ │ ├── PNIPrimitiveStruct.java │ │ │ ├── PNIRawArrays.java │ │ │ ├── PNIRefAndFuncFields.java │ │ │ ├── PNIStructUnion.java │ │ │ ├── PNIStructUnionAnnotation.java │ │ │ ├── PNIUpcall.java │ │ │ ├── PNIUpcallNull.java │ │ │ ├── SizeofClass.java │ │ │ ├── SuperClass.java │ │ │ └── ToStringClass.java │ └── module-info.java │ └── kotlin │ └── io │ └── vproxy │ └── pni │ └── test │ └── Kotlin.kt ├── acceptance-testing ├── build.gradle └── src │ └── test │ ├── c-generated │ ├── .gitkeep │ ├── io_vproxy_pni_test_AlignBaseClass.h │ ├── io_vproxy_pni_test_AlignBaseClass.impl.h │ ├── io_vproxy_pni_test_AlignChildClass.h │ ├── io_vproxy_pni_test_AlignChildClass.impl.h │ ├── io_vproxy_pni_test_AlignClass.h │ ├── io_vproxy_pni_test_AlignClass.impl.h │ ├── io_vproxy_pni_test_AlignField.h │ ├── io_vproxy_pni_test_AlignField.impl.h │ ├── io_vproxy_pni_test_AlignField2.h │ ├── io_vproxy_pni_test_AlignField2.impl.h │ ├── io_vproxy_pni_test_AlignField3.h │ ├── io_vproxy_pni_test_AlignField3.impl.h │ ├── io_vproxy_pni_test_AllowHeapAccess.h │ ├── io_vproxy_pni_test_AllowHeapAccess.impl.h │ ├── io_vproxy_pni_test_AlwaysAlignedBase.h │ ├── io_vproxy_pni_test_AlwaysAlignedChild.h │ ├── io_vproxy_pni_test_AlwaysAlignedClass.h │ ├── io_vproxy_pni_test_AlwaysAlignedField.h │ ├── io_vproxy_pni_test_AlwaysAlignedGrandChild.h │ ├── io_vproxy_pni_test_AlwaysAlignedSizeof.extra.c │ ├── io_vproxy_pni_test_AlwaysAlignedSizeof.h │ ├── io_vproxy_pni_test_AlwaysAlignedUnion.h │ ├── io_vproxy_pni_test_BaseClass.h │ ├── io_vproxy_pni_test_BaseClass.impl.h │ ├── io_vproxy_pni_test_BitField.h │ ├── io_vproxy_pni_test_BitField.impl.h │ ├── io_vproxy_pni_test_ChildClass.h │ ├── io_vproxy_pni_test_ChildClass.impl.h │ ├── io_vproxy_pni_test_ChildOfLargeAlign.h │ ├── io_vproxy_pni_test_ChildOfPacked.h │ ├── io_vproxy_pni_test_ChildOfPacked.impl.h │ ├── io_vproxy_pni_test_CustomNativeTypeFunc.h │ ├── io_vproxy_pni_test_CustomNativeTypeFunc.impl.h │ ├── io_vproxy_pni_test_CustomNativeTypeStruct.h │ ├── io_vproxy_pni_test_CustomNativeTypeStruct.impl.h │ ├── io_vproxy_pni_test_CustomNativeTypeUpcall.c │ ├── io_vproxy_pni_test_CustomNativeTypeUpcall.h │ ├── io_vproxy_pni_test_DefiningCFunction.h │ ├── io_vproxy_pni_test_DefiningCFunction.impl.h │ ├── io_vproxy_pni_test_Empty.h │ ├── io_vproxy_pni_test_EmptyChild.h │ ├── io_vproxy_pni_test_Func.h │ ├── io_vproxy_pni_test_Func.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityAlignField.h │ ├── io_vproxy_pni_test_GCCCompatibilityAlignField.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityAlignFieldPacked.h │ ├── io_vproxy_pni_test_GCCCompatibilityAlignFieldPacked.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityArrayZero.h │ ├── io_vproxy_pni_test_GCCCompatibilityArrayZero.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityNonPackedArray.h │ ├── io_vproxy_pni_test_GCCCompatibilityNonPackedArray.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityNonPackedContainNonPacked.h │ ├── io_vproxy_pni_test_GCCCompatibilityNonPackedContainNonPacked.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityNonPackedContainPacked.h │ ├── io_vproxy_pni_test_GCCCompatibilityNonPackedContainPacked.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityNormal.h │ ├── io_vproxy_pni_test_GCCCompatibilityNormal.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityPacked.h │ ├── io_vproxy_pni_test_GCCCompatibilityPacked.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedAlignField.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedAlignField.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedAlignFieldSmallerAlign.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedAlignFieldSmallerAlign.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedArray.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedArray.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedContainNonPacked.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedContainNonPacked.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityUnion.h │ ├── io_vproxy_pni_test_GCCompatibilityBitField.h │ ├── io_vproxy_pni_test_GCCompatibilityBitField.impl.h │ ├── io_vproxy_pni_test_GCCompatibilityNormalContainUnion.h │ ├── io_vproxy_pni_test_GCCompatibilityNormalContainUnion.impl.h │ ├── io_vproxy_pni_test_GCCompatibilityPackedContainUnion.h │ ├── io_vproxy_pni_test_GCCompatibilityPackedContainUnion.impl.h │ ├── io_vproxy_pni_test_GCCompatibilityStructAlign.h │ ├── io_vproxy_pni_test_GCCompatibilityStructAlign.impl.h │ ├── io_vproxy_pni_test_Generic.h │ ├── io_vproxy_pni_test_Generic.impl.h │ ├── io_vproxy_pni_test_GrandChildClass.h │ ├── io_vproxy_pni_test_GrandChildClass.impl.h │ ├── io_vproxy_pni_test_InvokeUpcall.h │ ├── io_vproxy_pni_test_InvokeUpcall.impl.h │ ├── io_vproxy_pni_test_InvokeUpcallNull.h │ ├── io_vproxy_pni_test_InvokeUpcallNull.impl.h │ ├── io_vproxy_pni_test_KtDowncall.h │ ├── io_vproxy_pni_test_KtDowncall.impl.h │ ├── io_vproxy_pni_test_KtStruct.h │ ├── io_vproxy_pni_test_KtStruct.impl.h │ ├── io_vproxy_pni_test_KtStructInherit.h │ ├── io_vproxy_pni_test_KtStructInherit.impl.h │ ├── io_vproxy_pni_test_KtUpcall.c │ ├── io_vproxy_pni_test_KtUpcall.h │ ├── io_vproxy_pni_test_LargeAlignBase.h │ ├── io_vproxy_pni_test_NativeCheck.h │ ├── io_vproxy_pni_test_NativeCheck.impl.h │ ├── io_vproxy_pni_test_NoAlloc.h │ ├── io_vproxy_pni_test_NoAlloc.impl.h │ ├── io_vproxy_pni_test_NoAllocUpcall.c │ ├── io_vproxy_pni_test_NoAllocUpcall.h │ ├── io_vproxy_pni_test_Null.h │ ├── io_vproxy_pni_test_Null.impl.h │ ├── io_vproxy_pni_test_ObjectStruct.h │ ├── io_vproxy_pni_test_PackedBaseClass.h │ ├── io_vproxy_pni_test_PackedBaseClass.impl.h │ ├── io_vproxy_pni_test_PointerArrayField.h │ ├── io_vproxy_pni_test_PointerArrayField.impl.h │ ├── io_vproxy_pni_test_PointerOnlyStruct.h │ ├── io_vproxy_pni_test_PointerOnlyStruct.impl.h │ ├── io_vproxy_pni_test_PointerOnlyStructWithLen.extra.c │ ├── io_vproxy_pni_test_PointerOnlyStructWithLen.h │ ├── io_vproxy_pni_test_PrimitiveStruct.h │ ├── io_vproxy_pni_test_RawArrays.h │ ├── io_vproxy_pni_test_RawArrays.impl.h │ ├── io_vproxy_pni_test_RefAndFuncFields.h │ ├── io_vproxy_pni_test_RefAndFuncFields.impl.h │ ├── io_vproxy_pni_test_ReferenceEmptyChild.h │ ├── io_vproxy_pni_test_SizeofEmbed.extra.c │ ├── io_vproxy_pni_test_SizeofEmbed.h │ ├── io_vproxy_pni_test_SizeofStruct.extra.c │ ├── io_vproxy_pni_test_SizeofStruct.h │ ├── io_vproxy_pni_test_SizeofStructExpr.extra.c │ ├── io_vproxy_pni_test_SizeofStructExpr.h │ ├── io_vproxy_pni_test_SizeofUnion.extra.c │ ├── io_vproxy_pni_test_SizeofUnion.h │ ├── io_vproxy_pni_test_StructA.h │ ├── io_vproxy_pni_test_StructB.h │ ├── io_vproxy_pni_test_StructD.h │ ├── io_vproxy_pni_test_StructM.h │ ├── io_vproxy_pni_test_StructN.h │ ├── io_vproxy_pni_test_ToStringArray.h │ ├── io_vproxy_pni_test_ToStringClass.h │ ├── io_vproxy_pni_test_ToStringClass2.h │ ├── io_vproxy_pni_test_ToStringClassRecurse.h │ ├── io_vproxy_pni_test_ToStringUnion.h │ ├── io_vproxy_pni_test_UnionC.h │ ├── io_vproxy_pni_test_UnionEmbedded.h │ ├── io_vproxy_pni_test_UnionO.h │ ├── io_vproxy_pni_test_UnionP.h │ ├── io_vproxy_pni_test_Upcall.c │ ├── io_vproxy_pni_test_Upcall.h │ ├── io_vproxy_pni_test_UpcallNull.c │ ├── io_vproxy_pni_test_UpcallNull.h │ ├── io_vproxy_pni_test_Userdata.h │ ├── jni.h │ ├── pni.c │ └── pni.h │ ├── c │ ├── align.c │ ├── gcc_compatibility.c │ ├── gcc_compatibility.h │ ├── io_vproxy_pni_test_AllowHeapAccess.c │ ├── io_vproxy_pni_test_CustomNativeType.c │ ├── io_vproxy_pni_test_DefiningCFunction.c │ ├── io_vproxy_pni_test_Func.c │ ├── io_vproxy_pni_test_Generic.c │ ├── io_vproxy_pni_test_InvokeUpcall.c │ ├── io_vproxy_pni_test_InvokeUpcallNull.c │ ├── io_vproxy_pni_test_Kt.c │ ├── io_vproxy_pni_test_NativeCheck.c │ ├── io_vproxy_pni_test_Null.c │ ├── io_vproxy_pni_test_ObjectStruct.c │ ├── io_vproxy_pni_test_PointerArrayField.c │ ├── io_vproxy_pni_test_PointerOnlyStruct.c │ ├── io_vproxy_pni_test_PrimitiveStruct.c │ ├── io_vproxy_pni_test_RawArrays.c │ ├── io_vproxy_pni_test_RefAndFuncFields.c │ ├── io_vproxy_pni_test_StructA.c │ ├── io_vproxy_pni_test_StructM.c │ ├── io_vproxy_pni_test_StructN.c │ ├── io_vproxy_pni_test_StructUnionAnnotation.h │ ├── io_vproxy_pni_test_UnionP.c │ ├── make-test.sh │ ├── noalloc.c │ ├── sizeof.c │ ├── sizeof.h │ └── super_class.c │ ├── generated │ ├── .gitkeep │ └── io │ │ └── vproxy │ │ └── pni │ │ └── test │ │ ├── AlignBaseClass.java │ │ ├── AlignChildClass.java │ │ ├── AlignClass.java │ │ ├── AlignField.java │ │ ├── AlignField2.java │ │ ├── AlignField3.java │ │ ├── AllowHeapAccess.java │ │ ├── AlwaysAlignedBase.java │ │ ├── AlwaysAlignedChild.java │ │ ├── AlwaysAlignedClass.java │ │ ├── AlwaysAlignedField.java │ │ ├── AlwaysAlignedGrandChild.java │ │ ├── AlwaysAlignedSizeof.java │ │ ├── AlwaysAlignedUnion.java │ │ ├── BaseClass.java │ │ ├── BitField.java │ │ ├── ChildClass.java │ │ ├── ChildOfLargeAlign.java │ │ ├── ChildOfPacked.java │ │ ├── CustomNativeTypeFunc.java │ │ ├── CustomNativeTypeStruct.java │ │ ├── CustomNativeTypeUpcall.java │ │ ├── DefiningCFunction.java │ │ ├── Empty.java │ │ ├── EmptyChild.java │ │ ├── Func.java │ │ ├── GCCCompatibilityAlignField.java │ │ ├── GCCCompatibilityAlignFieldPacked.java │ │ ├── GCCCompatibilityArrayZero.java │ │ ├── GCCCompatibilityNonPackedArray.java │ │ ├── GCCCompatibilityNonPackedContainNonPacked.java │ │ ├── GCCCompatibilityNonPackedContainPacked.java │ │ ├── GCCCompatibilityNormal.java │ │ ├── GCCCompatibilityPacked.java │ │ ├── GCCCompatibilityPackedAlignField.java │ │ ├── GCCCompatibilityPackedAlignFieldSmallerAlign.java │ │ ├── GCCCompatibilityPackedArray.java │ │ ├── GCCCompatibilityPackedContainNonPacked.java │ │ ├── GCCCompatibilityUnion.java │ │ ├── GCCompatibilityBitField.java │ │ ├── GCCompatibilityNormalContainUnion.java │ │ ├── GCCompatibilityPackedContainUnion.java │ │ ├── GCCompatibilityStructAlign.java │ │ ├── Generic.java │ │ ├── GrandChildClass.java │ │ ├── InvokeUpcall.java │ │ ├── InvokeUpcallNull.java │ │ ├── KtDowncall.java │ │ ├── KtStruct.java │ │ ├── KtStructInherit.java │ │ ├── KtUpcall.java │ │ ├── LargeAlignBase.java │ │ ├── NativeCheck.java │ │ ├── NoAlloc.java │ │ ├── NoAllocUpcall.java │ │ ├── Null.java │ │ ├── ObjectStruct.java │ │ ├── PackedBaseClass.java │ │ ├── PointerArrayField.java │ │ ├── PointerOnlyStruct.java │ │ ├── PointerOnlyStructWithLen.java │ │ ├── PrimitiveStruct.java │ │ ├── RawArrays.java │ │ ├── RefAndFuncFields.java │ │ ├── ReferenceEmptyChild.java │ │ ├── SizeofEmbed.java │ │ ├── SizeofStruct.java │ │ ├── SizeofStructExpr.java │ │ ├── SizeofUnion.java │ │ ├── StructA.java │ │ ├── StructB.java │ │ ├── StructD.java │ │ ├── StructM.java │ │ ├── StructN.java │ │ ├── ToStringArray.java │ │ ├── ToStringClass.java │ │ ├── ToStringClass2.java │ │ ├── ToStringClassRecurse.java │ │ ├── ToStringUnion.java │ │ ├── UnionC.java │ │ ├── UnionEmbedded.java │ │ ├── UnionO.java │ │ ├── UnionP.java │ │ ├── Upcall.java │ │ ├── UpcallNull.java │ │ └── Userdata.java │ └── java │ └── io │ └── vproxy │ └── pni │ └── test │ ├── cases │ ├── Suite.java │ ├── TestAlign.java │ ├── TestAllowHeapAccess.java │ ├── TestAlwaysAligned.java │ ├── TestBeforeAll.java │ ├── TestCustomNativeType.java │ ├── TestDefiningCFunction.java │ ├── TestFunc.java │ ├── TestGCCCompatibility.java │ ├── TestGeneratedFileFormat.java │ ├── TestGeneric.java │ ├── TestGraalRuntime.java │ ├── TestKt.java │ ├── TestNoAlloc.java │ ├── TestNull.java │ ├── TestObjectStruct.java │ ├── TestPointerArray.java │ ├── TestPointerOnly.java │ ├── TestPrimitiveStruct.java │ ├── TestRawArrays.java │ ├── TestRefAndFunc.java │ ├── TestSizeof.java │ ├── TestStructUnion.java │ ├── TestStructUnionAnnotation.java │ ├── TestSuperClass.java │ ├── TestToString.java │ ├── TestUpcall.java │ ├── TestUpcallNull.java │ └── TestUtils.java │ └── impl │ ├── UpcallImpl.java │ └── UpcallNullImpl.java ├── api ├── build.gradle └── src │ └── main │ ├── c │ ├── jnimock │ │ └── jni.h │ ├── make.sh │ ├── pni.c │ └── pni.h │ ├── java │ ├── io │ │ └── vproxy │ │ │ └── pni │ │ │ ├── AbstractNativeObject.java │ │ │ ├── Allocator.java │ │ │ ├── CallSite.java │ │ │ ├── GraalHelper.java │ │ │ ├── MetadataAllocationCallback.java │ │ │ ├── NativeObject.java │ │ │ ├── NativeObjectTuple.java │ │ │ ├── ObjectHolder.java │ │ │ ├── PNIBuf.java │ │ │ ├── PNIEnv.java │ │ │ ├── PNIExceptionNativeRepresentation.java │ │ │ ├── PNIFunc.java │ │ │ ├── PNILinkOptions.java │ │ │ ├── PNILookupOptions.java │ │ │ ├── PNIRef.java │ │ │ ├── PNIString.java │ │ │ ├── PanamaHack.java │ │ │ ├── PanamaUtils.java │ │ │ ├── PooledAllocator.java │ │ │ ├── PooledAllocatorProvider.java │ │ │ ├── annotation │ │ │ ├── Align.java │ │ │ ├── AlwaysAligned.java │ │ │ ├── Bit.java │ │ │ ├── Downcall.java │ │ │ ├── GenerateMember.java │ │ │ ├── Impl.java │ │ │ ├── Include.java │ │ │ ├── Len.java │ │ │ ├── LinkerOption.java │ │ │ ├── Name.java │ │ │ ├── NativeReturnType.java │ │ │ ├── NativeType.java │ │ │ ├── NoAlloc.java │ │ │ ├── Pointer.java │ │ │ ├── PointerOnly.java │ │ │ ├── Raw.java │ │ │ ├── Sizeof.java │ │ │ ├── SpecifyGeneratedMembers.java │ │ │ ├── Struct.java │ │ │ ├── Style.java │ │ │ ├── Styles.java │ │ │ ├── Suppress.java │ │ │ ├── Union.java │ │ │ ├── Unsigned.java │ │ │ └── Upcall.java │ │ │ ├── array │ │ │ ├── BoolArray.java │ │ │ ├── CharArray.java │ │ │ ├── DoubleArray.java │ │ │ ├── FloatArray.java │ │ │ ├── IntArray.java │ │ │ ├── LongArray.java │ │ │ ├── PointerArray.java │ │ │ ├── RefArray.java │ │ │ └── ShortArray.java │ │ │ ├── exception │ │ │ └── PNIException.java │ │ │ ├── impl │ │ │ ├── AbstractAllocator.java │ │ │ ├── AllocateAndForgetUnsafeAllocator.java │ │ │ ├── ArenaAllocator.java │ │ │ ├── DummyAllocator.java │ │ │ ├── ForceNoInlineConcurrentLongMap.java │ │ │ ├── MetadataAllocator.java │ │ │ ├── NoCloseArenaAllocator.java │ │ │ ├── SegmentAllocatorAllocator.java │ │ │ ├── UnsafeAllocator.java │ │ │ └── Utils.java │ │ │ └── unsafe │ │ │ └── SunUnsafe.java │ └── module-info.java │ ├── jdk21 │ └── io │ │ └── vproxy │ │ └── pni │ │ └── hack │ │ ├── GetSetUtf8String.java │ │ ├── PanamaHackStorage.java │ │ └── VarHandleW.java │ └── jdk22 │ └── io │ └── vproxy │ └── pni │ └── hack │ ├── GetSetUtf8String.java │ ├── PanamaHackStorage.java │ └── VarHandleW.java ├── build.gradle ├── doc └── toc-icon.png ├── graal-test-template ├── build.gradle └── src │ └── main │ └── java │ └── io │ └── vproxy │ └── pni │ └── graal │ └── test │ ├── PNIInvoke.java │ └── PNIUpcall.java ├── graal-test ├── build.gradle └── src │ └── main │ ├── c-generated-2 │ ├── io_vproxy_pni_test_AlignBaseClass.h │ ├── io_vproxy_pni_test_AlignBaseClass.impl.h │ ├── io_vproxy_pni_test_AlignChildClass.h │ ├── io_vproxy_pni_test_AlignChildClass.impl.h │ ├── io_vproxy_pni_test_AlignClass.h │ ├── io_vproxy_pni_test_AlignClass.impl.h │ ├── io_vproxy_pni_test_AlignField.h │ ├── io_vproxy_pni_test_AlignField.impl.h │ ├── io_vproxy_pni_test_AlignField2.h │ ├── io_vproxy_pni_test_AlignField2.impl.h │ ├── io_vproxy_pni_test_AlignField3.h │ ├── io_vproxy_pni_test_AlignField3.impl.h │ ├── io_vproxy_pni_test_AllowHeapAccess.h │ ├── io_vproxy_pni_test_AllowHeapAccess.impl.h │ ├── io_vproxy_pni_test_AlwaysAlignedBase.h │ ├── io_vproxy_pni_test_AlwaysAlignedChild.h │ ├── io_vproxy_pni_test_AlwaysAlignedClass.h │ ├── io_vproxy_pni_test_AlwaysAlignedField.h │ ├── io_vproxy_pni_test_AlwaysAlignedGrandChild.h │ ├── io_vproxy_pni_test_AlwaysAlignedSizeof.extra.c │ ├── io_vproxy_pni_test_AlwaysAlignedSizeof.h │ ├── io_vproxy_pni_test_AlwaysAlignedUnion.h │ ├── io_vproxy_pni_test_BaseClass.h │ ├── io_vproxy_pni_test_BaseClass.impl.h │ ├── io_vproxy_pni_test_BitField.h │ ├── io_vproxy_pni_test_BitField.impl.h │ ├── io_vproxy_pni_test_ChildClass.h │ ├── io_vproxy_pni_test_ChildClass.impl.h │ ├── io_vproxy_pni_test_ChildOfLargeAlign.h │ ├── io_vproxy_pni_test_ChildOfPacked.h │ ├── io_vproxy_pni_test_ChildOfPacked.impl.h │ ├── io_vproxy_pni_test_CustomNativeTypeFunc.h │ ├── io_vproxy_pni_test_CustomNativeTypeFunc.impl.h │ ├── io_vproxy_pni_test_CustomNativeTypeStruct.h │ ├── io_vproxy_pni_test_CustomNativeTypeStruct.impl.h │ ├── io_vproxy_pni_test_CustomNativeTypeUpcall.c │ ├── io_vproxy_pni_test_CustomNativeTypeUpcall.h │ ├── io_vproxy_pni_test_DefiningCFunction.h │ ├── io_vproxy_pni_test_DefiningCFunction.impl.h │ ├── io_vproxy_pni_test_Empty.h │ ├── io_vproxy_pni_test_EmptyChild.h │ ├── io_vproxy_pni_test_Func.h │ ├── io_vproxy_pni_test_Func.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityAlignField.h │ ├── io_vproxy_pni_test_GCCCompatibilityAlignField.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityAlignFieldPacked.h │ ├── io_vproxy_pni_test_GCCCompatibilityAlignFieldPacked.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityArrayZero.h │ ├── io_vproxy_pni_test_GCCCompatibilityArrayZero.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityNonPackedArray.h │ ├── io_vproxy_pni_test_GCCCompatibilityNonPackedArray.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityNonPackedContainNonPacked.h │ ├── io_vproxy_pni_test_GCCCompatibilityNonPackedContainNonPacked.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityNonPackedContainPacked.h │ ├── io_vproxy_pni_test_GCCCompatibilityNonPackedContainPacked.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityNormal.h │ ├── io_vproxy_pni_test_GCCCompatibilityNormal.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityPacked.h │ ├── io_vproxy_pni_test_GCCCompatibilityPacked.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedAlignField.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedAlignField.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedAlignFieldSmallerAlign.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedAlignFieldSmallerAlign.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedArray.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedArray.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedContainNonPacked.h │ ├── io_vproxy_pni_test_GCCCompatibilityPackedContainNonPacked.impl.h │ ├── io_vproxy_pni_test_GCCCompatibilityUnion.h │ ├── io_vproxy_pni_test_GCCompatibilityBitField.h │ ├── io_vproxy_pni_test_GCCompatibilityBitField.impl.h │ ├── io_vproxy_pni_test_GCCompatibilityNormalContainUnion.h │ ├── io_vproxy_pni_test_GCCompatibilityNormalContainUnion.impl.h │ ├── io_vproxy_pni_test_GCCompatibilityPackedContainUnion.h │ ├── io_vproxy_pni_test_GCCompatibilityPackedContainUnion.impl.h │ ├── io_vproxy_pni_test_GCCompatibilityStructAlign.h │ ├── io_vproxy_pni_test_GCCompatibilityStructAlign.impl.h │ ├── io_vproxy_pni_test_Generic.h │ ├── io_vproxy_pni_test_Generic.impl.h │ ├── io_vproxy_pni_test_GrandChildClass.h │ ├── io_vproxy_pni_test_GrandChildClass.impl.h │ ├── io_vproxy_pni_test_InvokeUpcall.h │ ├── io_vproxy_pni_test_InvokeUpcall.impl.h │ ├── io_vproxy_pni_test_InvokeUpcallNull.h │ ├── io_vproxy_pni_test_InvokeUpcallNull.impl.h │ ├── io_vproxy_pni_test_KtDowncall.h │ ├── io_vproxy_pni_test_KtDowncall.impl.h │ ├── io_vproxy_pni_test_KtStruct.h │ ├── io_vproxy_pni_test_KtStruct.impl.h │ ├── io_vproxy_pni_test_KtStructInherit.h │ ├── io_vproxy_pni_test_KtStructInherit.impl.h │ ├── io_vproxy_pni_test_KtUpcall.c │ ├── io_vproxy_pni_test_KtUpcall.h │ ├── io_vproxy_pni_test_LargeAlignBase.h │ ├── io_vproxy_pni_test_NativeCheck.h │ ├── io_vproxy_pni_test_NativeCheck.impl.h │ ├── io_vproxy_pni_test_NoAlloc.h │ ├── io_vproxy_pni_test_NoAlloc.impl.h │ ├── io_vproxy_pni_test_NoAllocUpcall.c │ ├── io_vproxy_pni_test_NoAllocUpcall.h │ ├── io_vproxy_pni_test_Null.h │ ├── io_vproxy_pni_test_Null.impl.h │ ├── io_vproxy_pni_test_ObjectStruct.h │ ├── io_vproxy_pni_test_PackedBaseClass.h │ ├── io_vproxy_pni_test_PackedBaseClass.impl.h │ ├── io_vproxy_pni_test_PointerArrayField.h │ ├── io_vproxy_pni_test_PointerArrayField.impl.h │ ├── io_vproxy_pni_test_PointerOnlyStruct.h │ ├── io_vproxy_pni_test_PointerOnlyStruct.impl.h │ ├── io_vproxy_pni_test_PointerOnlyStructWithLen.extra.c │ ├── io_vproxy_pni_test_PointerOnlyStructWithLen.h │ ├── io_vproxy_pni_test_PrimitiveStruct.h │ ├── io_vproxy_pni_test_RawArrays.h │ ├── io_vproxy_pni_test_RawArrays.impl.h │ ├── io_vproxy_pni_test_RefAndFuncFields.h │ ├── io_vproxy_pni_test_RefAndFuncFields.impl.h │ ├── io_vproxy_pni_test_ReferenceEmptyChild.h │ ├── io_vproxy_pni_test_SizeofEmbed.extra.c │ ├── io_vproxy_pni_test_SizeofEmbed.h │ ├── io_vproxy_pni_test_SizeofStruct.extra.c │ ├── io_vproxy_pni_test_SizeofStruct.h │ ├── io_vproxy_pni_test_SizeofStructExpr.extra.c │ ├── io_vproxy_pni_test_SizeofStructExpr.h │ ├── io_vproxy_pni_test_SizeofUnion.extra.c │ ├── io_vproxy_pni_test_SizeofUnion.h │ ├── io_vproxy_pni_test_StructA.h │ ├── io_vproxy_pni_test_StructB.h │ ├── io_vproxy_pni_test_StructD.h │ ├── io_vproxy_pni_test_StructM.h │ ├── io_vproxy_pni_test_StructN.h │ ├── io_vproxy_pni_test_ToStringArray.h │ ├── io_vproxy_pni_test_ToStringClass.h │ ├── io_vproxy_pni_test_ToStringClass2.h │ ├── io_vproxy_pni_test_ToStringClassRecurse.h │ ├── io_vproxy_pni_test_ToStringUnion.h │ ├── io_vproxy_pni_test_UnionC.h │ ├── io_vproxy_pni_test_UnionEmbedded.h │ ├── io_vproxy_pni_test_UnionO.h │ ├── io_vproxy_pni_test_UnionP.h │ ├── io_vproxy_pni_test_Upcall.c │ ├── io_vproxy_pni_test_Upcall.h │ ├── io_vproxy_pni_test_UpcallNull.c │ ├── io_vproxy_pni_test_UpcallNull.h │ └── io_vproxy_pni_test_Userdata.h │ ├── c-generated │ ├── io_vproxy_pni_graal_test_Invoke.h │ ├── io_vproxy_pni_graal_test_Invoke.impl.h │ ├── io_vproxy_pni_graal_test_Upcall.c │ ├── io_vproxy_pni_graal_test_Upcall.h │ ├── jni.h │ ├── pni.c │ └── pni.h │ ├── c │ ├── graal-test.c │ └── make-graal-test.sh │ ├── generated-2 │ └── io │ │ └── vproxy │ │ └── pni │ │ └── test │ │ ├── AlignBaseClass.java │ │ ├── AlignChildClass.java │ │ ├── AlignClass.java │ │ ├── AlignField.java │ │ ├── AlignField2.java │ │ ├── AlignField3.java │ │ ├── AllowHeapAccess.java │ │ ├── AlwaysAlignedBase.java │ │ ├── AlwaysAlignedChild.java │ │ ├── AlwaysAlignedClass.java │ │ ├── AlwaysAlignedField.java │ │ ├── AlwaysAlignedGrandChild.java │ │ ├── AlwaysAlignedSizeof.java │ │ ├── AlwaysAlignedUnion.java │ │ ├── BaseClass.java │ │ ├── BitField.java │ │ ├── ChildClass.java │ │ ├── ChildOfLargeAlign.java │ │ ├── ChildOfPacked.java │ │ ├── CustomNativeTypeFunc.java │ │ ├── CustomNativeTypeStruct.java │ │ ├── CustomNativeTypeUpcall.java │ │ ├── DefiningCFunction.java │ │ ├── Empty.java │ │ ├── EmptyChild.java │ │ ├── Feature.java │ │ ├── Func.java │ │ ├── GCCCompatibilityAlignField.java │ │ ├── GCCCompatibilityAlignFieldPacked.java │ │ ├── GCCCompatibilityArrayZero.java │ │ ├── GCCCompatibilityNonPackedArray.java │ │ ├── GCCCompatibilityNonPackedContainNonPacked.java │ │ ├── GCCCompatibilityNonPackedContainPacked.java │ │ ├── GCCCompatibilityNormal.java │ │ ├── GCCCompatibilityPacked.java │ │ ├── GCCCompatibilityPackedAlignField.java │ │ ├── GCCCompatibilityPackedAlignFieldSmallerAlign.java │ │ ├── GCCCompatibilityPackedArray.java │ │ ├── GCCCompatibilityPackedContainNonPacked.java │ │ ├── GCCCompatibilityUnion.java │ │ ├── GCCompatibilityBitField.java │ │ ├── GCCompatibilityNormalContainUnion.java │ │ ├── GCCompatibilityPackedContainUnion.java │ │ ├── GCCompatibilityStructAlign.java │ │ ├── Generic.java │ │ ├── GrandChildClass.java │ │ ├── InvokeUpcall.java │ │ ├── InvokeUpcallNull.java │ │ ├── KtDowncall.java │ │ ├── KtStruct.java │ │ ├── KtStructInherit.java │ │ ├── KtUpcall.java │ │ ├── LargeAlignBase.java │ │ ├── NativeCheck.java │ │ ├── NoAlloc.java │ │ ├── NoAllocUpcall.java │ │ ├── Null.java │ │ ├── ObjectStruct.java │ │ ├── PackedBaseClass.java │ │ ├── PointerArrayField.java │ │ ├── PointerOnlyStruct.java │ │ ├── PointerOnlyStructWithLen.java │ │ ├── PrimitiveStruct.java │ │ ├── RawArrays.java │ │ ├── RefAndFuncFields.java │ │ ├── ReferenceEmptyChild.java │ │ ├── SizeofEmbed.java │ │ ├── SizeofStruct.java │ │ ├── SizeofStructExpr.java │ │ ├── SizeofUnion.java │ │ ├── StructA.java │ │ ├── StructB.java │ │ ├── StructD.java │ │ ├── StructM.java │ │ ├── StructN.java │ │ ├── ToStringArray.java │ │ ├── ToStringClass.java │ │ ├── ToStringClass2.java │ │ ├── ToStringClassRecurse.java │ │ ├── ToStringUnion.java │ │ ├── UnionC.java │ │ ├── UnionEmbedded.java │ │ ├── UnionO.java │ │ ├── UnionP.java │ │ ├── Upcall.java │ │ ├── UpcallNull.java │ │ └── Userdata.java │ ├── generated │ └── io │ │ └── vproxy │ │ └── pni │ │ └── graal │ │ └── test │ │ ├── Feature.java │ │ ├── Invoke.java │ │ └── Upcall.java │ ├── java-2 │ └── .gitkeep │ └── java │ └── io │ └── vproxy │ └── pni │ └── graal │ └── test │ ├── Feature2.java │ ├── Main.java │ ├── Suite.java │ ├── TestFunctionPointer.java │ ├── TestRefAndFunc.java │ └── TestUpcall.java ├── graal ├── build.gradle └── src │ └── main │ └── java │ ├── io │ └── vproxy │ │ └── pni │ │ └── graal │ │ ├── GraalPNIFunc.java │ │ ├── GraalPNIRef.java │ │ └── GraalUtils.java │ └── module-info.java ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── performance ├── build.gradle └── src │ └── main │ └── java │ └── io │ └── vproxy │ └── pni │ └── perf │ ├── FieldAccess.java │ ├── RefCreateDeletePre16384.java │ ├── RefCreateDeletePre16384AndRef4096.java │ ├── RefCreateDeletePre4096.java │ ├── RefGet16384.java │ └── RefGet4096.java ├── playground ├── README.md ├── build.gradle └── src │ └── main │ ├── c-generated │ └── .gitkeep │ ├── c │ └── make-playground.sh │ ├── generated │ └── io │ │ └── vproxy │ │ └── pni │ │ └── playground │ │ └── .gitkeep │ ├── java │ └── io │ │ └── vproxy │ │ └── pni │ │ └── playground │ │ └── .gitkeep │ └── template │ └── io │ └── vproxy │ └── pni │ └── playground │ └── .gitkeep ├── pni ├── build.gradle └── src │ └── main │ └── java │ ├── io │ └── vproxy │ │ └── pni │ │ └── exec │ │ ├── CompilationFlag.java │ │ ├── CompilerOptions.java │ │ ├── Generator.java │ │ ├── Main.java │ │ ├── WarnType.java │ │ ├── ast │ │ ├── AstAnno.java │ │ ├── AstAnnoValue.java │ │ ├── AstClass.java │ │ ├── AstField.java │ │ ├── AstGenericDef.java │ │ ├── AstMethod.java │ │ ├── AstParam.java │ │ ├── AstTypeDesc.java │ │ └── BitFieldInfo.java │ │ ├── extension │ │ ├── Extension.java │ │ └── ExtensionValidationException.java │ │ ├── generator │ │ ├── CExtraFileGenerator.java │ │ ├── CFileGenerator.java │ │ ├── CImplFileGenerator.java │ │ ├── CUpcallImplFileGenerator.java │ │ ├── GraalNativeImageFeatureFileGenerator.java │ │ ├── JavaFileGenerator.java │ │ └── StaticFileGenerator.java │ │ ├── internal │ │ ├── ASTReader.java │ │ ├── AllocationForParam.java │ │ ├── AllocationForReturnedValue.java │ │ ├── JavaReader.java │ │ ├── PNILogger.java │ │ ├── ParamOpts.java │ │ ├── PointerInfo.java │ │ ├── Utils.java │ │ └── VarOpts.java │ │ └── type │ │ ├── AnnoAlignTypeInfo.java │ │ ├── AnnoAlwaysAlignedTypeInfo.java │ │ ├── AnnoBitTypeInfo.java │ │ ├── AnnoDowncallTypeInfo.java │ │ ├── AnnoGenerateMemberTypeInfo.java │ │ ├── AnnoImplTypeInfo.java │ │ ├── AnnoIncludeTypeInfo.java │ │ ├── AnnoLenTypeInfo.java │ │ ├── AnnoLinkerOptionCriticalTypeInfo.java │ │ ├── AnnoNameTypeInfo.java │ │ ├── AnnoNativeReturnTypeTypeInfo.java │ │ ├── AnnoNativeTypeTypeInfo.java │ │ ├── AnnoNoAllocTypeInfo.java │ │ ├── AnnoPointerOnlyTypeInfo.java │ │ ├── AnnoPointerTypeInfo.java │ │ ├── AnnoRawTypeInfo.java │ │ ├── AnnoSizeofTypeInfo.java │ │ ├── AnnoSpecifyGeneratedMembersTypeInfo.java │ │ ├── AnnoStructTypeInfo.java │ │ ├── AnnoStyleTypeInfo.java │ │ ├── AnnoSuppressTypeInfo.java │ │ ├── AnnoUnionTypeInfo.java │ │ ├── AnnoUnsignedTypeInfo.java │ │ ├── AnnoUpcallTypeInfo.java │ │ ├── ArrayTypeInfo.java │ │ ├── BooleanTypeInfo.java │ │ ├── BuiltInAnnoTypeInfo.java │ │ ├── BuiltInExceptionTypeInfo.java │ │ ├── BuiltInReferenceTypeInfo.java │ │ ├── ByteBufferTypeInfo.java │ │ ├── ByteTypeInfo.java │ │ ├── CharTypeInfo.java │ │ ├── ClassTypeInfo.java │ │ ├── DoubleTypeInfo.java │ │ ├── FloatTypeInfo.java │ │ ├── IntTypeInfo.java │ │ ├── LongTypeInfo.java │ │ ├── MemorySegmentTypeInfo.java │ │ ├── NoGenReferenceTypeInfo.java │ │ ├── PNIFuncGenericTypeInfo.java │ │ ├── PNIFuncTypeInfo.java │ │ ├── PNIRefGenericTypeInfo.java │ │ ├── PNIRefTypeInfo.java │ │ ├── PrimitiveIntegerTypeInfo.java │ │ ├── PrimitiveTypeInfo.java │ │ ├── ShortTypeInfo.java │ │ ├── StringTypeInfo.java │ │ ├── TypeInfo.java │ │ ├── TypePool.java │ │ ├── VoidRefTypeInfo.java │ │ └── VoidTypeInfo.java │ └── module-info.java ├── sample ├── build.gradle └── src │ └── main │ ├── c │ ├── io_vproxy_pni_sample_MBuf.h │ ├── io_vproxy_pni_sample_NativeFunctions.c │ ├── io_vproxy_pni_sample_NativeFunctions.h │ ├── io_vproxy_pni_sample_NativeFunctions.impl.h │ ├── io_vproxy_pni_sample_SampleFunctions.h │ ├── io_vproxy_pni_sample_UserData.h │ ├── jni.h │ ├── make-sample.sh │ ├── pni.c │ └── pni.h │ └── java │ └── io │ └── vproxy │ └── pni │ └── sample │ ├── Feature.java │ ├── IOTemplate.java │ ├── MBuf.java │ ├── Main.java │ ├── NativeFunctions.java │ ├── README.java │ ├── SampleFunctions.java │ └── UserData.java ├── settings.gradle └── unittest ├── build.gradle └── src └── test └── java └── io └── vproxy └── pni └── test ├── AfterAll.java ├── JavaFile.java ├── Suite.java ├── TestAllocator.java ├── TestCompilationFlags.java ├── TestCorner.java ├── TestDescParsing.java ├── TestObjectHolder.java ├── TestRef.java ├── TestTypes.java ├── TestTypesNoGen.java ├── TestUtils.java ├── TestValidation.java ├── TestWarningFlags.java └── Utils.java /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.java-version: -------------------------------------------------------------------------------- 1 | 21 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright 2023 wkgcass 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /acceptance-testing-template/build.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | } 3 | -------------------------------------------------------------------------------- /acceptance-testing-template/src/main/java/io/vproxy/pni/test/AllowHeapAccess.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.test; 2 | 3 | import io.vproxy.pni.annotation.*; 4 | 5 | import java.lang.foreign.MemorySegment; 6 | 7 | @Downcall 8 | interface PNIAllowHeapAccess { 9 | @Impl( 10 | // language="c" 11 | c = """ 12 | env->return_ = *((int*)mem); 13 | return 0; 14 | """ 15 | ) 16 | @LinkerOption.Critical(allowHeapAccess = true) 17 | int intValue(MemorySegment mem); 18 | 19 | @Impl( 20 | c = """ 21 | return *((int*)mem); 22 | """ 23 | ) 24 | @LinkerOption.Critical(allowHeapAccess = true) 25 | @Style(Styles.critical) 26 | int intValueCritical(MemorySegment mem); 27 | } 28 | -------------------------------------------------------------------------------- /acceptance-testing-template/src/main/java/io/vproxy/pni/test/NoAlloc.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.test; 2 | 3 | import io.vproxy.pni.annotation.Downcall; 4 | import io.vproxy.pni.annotation.Impl; 5 | import io.vproxy.pni.annotation.NoAlloc; 6 | import io.vproxy.pni.annotation.Upcall; 7 | 8 | @Downcall 9 | interface PNINoAlloc { 10 | @NoAlloc 11 | PNIObjectStruct execNoAlloc(); 12 | 13 | @Impl( 14 | include = "io_vproxy_pni_test_NoAllocUpcall.h", 15 | c = """ 16 | env->return_ = JavaCritical_io_vproxy_pni_test_NoAllocUpcall_execNoAlloc(); 17 | return 0; 18 | """ 19 | ) 20 | @NoAlloc 21 | PNIObjectStruct invokeUpcall(); 22 | } 23 | 24 | @Upcall 25 | interface PNINoAllocUpcall { 26 | @NoAlloc 27 | PNIObjectStruct execNoAlloc(); 28 | } 29 | -------------------------------------------------------------------------------- /acceptance-testing-template/src/main/java/io/vproxy/pni/test/PNIPointerOnlyStruct.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.test; 2 | 3 | import io.vproxy.pni.annotation.*; 4 | 5 | @Struct 6 | @PointerOnly 7 | abstract class PNIPointerOnlyStruct { 8 | @Impl( 9 | // language="c" 10 | c = """ 11 | return *((long*)self); 12 | """ 13 | ) 14 | @Style(Styles.critical) 15 | abstract long retrieve(); 16 | } 17 | 18 | @Struct 19 | @PointerOnly 20 | @Sizeof("return 32;") 21 | class PNIPointerOnlyStructWithLen { 22 | } 23 | -------------------------------------------------------------------------------- /acceptance-testing-template/src/main/java/io/vproxy/pni/test/SizeofClass.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.test; 2 | 3 | import io.vproxy.pni.annotation.*; 4 | 5 | @Struct 6 | @Sizeof("return 16;") 7 | class PNISizeofStruct { 8 | int a; 9 | short b; 10 | } 11 | 12 | @Struct(skip = true) 13 | @Name("SizeofStructExpr") 14 | @Sizeof("SizeofStructExpr") 15 | @Include("sizeof.h") 16 | class PNISizeofStructExpr { 17 | byte b; 18 | short s; 19 | } 20 | 21 | @Union 22 | @Sizeof("return 24;") 23 | class PNISizeofUnion { 24 | PNISizeofStruct st; 25 | int a; 26 | } 27 | 28 | @Struct 29 | @Sizeof( 30 | // language="c" 31 | """ 32 | size_t ret = 16; 33 | ret += JavaCritical_io_vproxy_pni_test_SizeofStructExpr___getLayoutByteSize(); 34 | return ret; 35 | """) 36 | abstract class PNISizeofEmbed { 37 | byte x; 38 | @Pointer PNISizeofUnion un; 39 | PNISizeofStructExpr st; 40 | } 41 | -------------------------------------------------------------------------------- /acceptance-testing-template/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module io.vproxy.pni.test.template { 2 | requires io.vproxy.pni; 3 | requires kotlin.stdlib; 4 | } 5 | -------------------------------------------------------------------------------- /acceptance-testing/build.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | } 3 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vproxy-tools/panama-native-interface/a1d044fd82c397b523c97c887632ff1092bbfb72/acceptance-testing/src/test/c-generated/.gitkeep -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AlignBaseClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignBaseClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int16_t JNICALL JavaCritical_io_vproxy_pni_test_AlignBaseClass_aaaa(AlignBaseClass * self) { 8 | return self->a; 9 | } 10 | 11 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignBaseClass_size0(AlignBaseClass * self) { 12 | return sizeof(*self); 13 | } 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | // metadata.generator-version: pni test 19 | // sha256:60e943c5ad359a1b6e6cc0f89e44adc7ff5aba05b1ee2912bfc9a1865812fbdb 20 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AlignChildClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignChildClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AlignChildClass_bbbb(AlignChildClass * self) { 8 | return self->b; 9 | } 10 | 11 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AlignChildClass_cccc(AlignChildClass * self) { 12 | return self->c; 13 | } 14 | 15 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignChildClass_size(AlignChildClass * self) { 16 | return sizeof(*self); 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:e54f216104ccdbada6d699cd3ba399c5dbea709a249fb8ed6bc57d62f151fe4b 24 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AlignClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int8_t JNICALL JavaCritical_io_vproxy_pni_test_AlignClass_aaaa(AlignClass * self) { 8 | return self->a; 9 | } 10 | 11 | JNIEXPORT int16_t JNICALL JavaCritical_io_vproxy_pni_test_AlignClass_bbbb(AlignClass * self) { 12 | return self->b; 13 | } 14 | 15 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignClass_cccc(AlignClass * self) { 16 | return self->c; 17 | } 18 | 19 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignClass_size(AlignClass * self) { 20 | return sizeof(*self); 21 | } 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | // metadata.generator-version: pni test 27 | // sha256:66048a0bd3b18c410a54650af3a60f1e3ed5eb245b35dd5e0107778917dc275e 28 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AlignField.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignField.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int8_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField_aaaa(AlignField * self) { 8 | return self->a; 9 | } 10 | 11 | JNIEXPORT int8_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField_bbbb(AlignField * self) { 12 | return self->b; 13 | } 14 | 15 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField_cccc(AlignField * self) { 16 | return self->c; 17 | } 18 | 19 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField_size(AlignField * self) { 20 | return sizeof(*self); 21 | } 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | // metadata.generator-version: pni test 27 | // sha256:ce2fc9d436357bdf186cdeabe1a2f22987dea7ac3b82c91c463aec7a9d633f77 28 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AlignField2.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignField2.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int8_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField2_aaaa(AlignField2 * self) { 8 | return self->a; 9 | } 10 | 11 | JNIEXPORT int8_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField2_bbbb(AlignField2 * self) { 12 | return self->b; 13 | } 14 | 15 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField2_cccc(AlignField2 * self) { 16 | return self->c; 17 | } 18 | 19 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField2_size(AlignField2 * self) { 20 | return sizeof(*self); 21 | } 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | // metadata.generator-version: pni test 27 | // sha256:b25fc88f23064d619678172de512586ce62d140d0913d99aa39d5fc5de5bd8b2 28 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AlignField3.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignField3.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int16_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField3_aaaa(AlignField3 * self) { 8 | return self->a; 9 | } 10 | 11 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField3_bbbb(AlignField3 * self) { 12 | return self->b; 13 | } 14 | 15 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField3_cccc(AlignField3 * self) { 16 | return self->c; 17 | } 18 | 19 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField3_size(AlignField3 * self) { 20 | return sizeof(*self); 21 | } 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | // metadata.generator-version: pni test 27 | // sha256:48619d785cb654e8182cf009bd697463c5deb881848cdf9bafcffb8d4c359587 28 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AllowHeapAccess.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_AllowHeapAccess */ 3 | #ifndef _Included_io_vproxy_pni_test_AllowHeapAccess 4 | #define _Included_io_vproxy_pni_test_AllowHeapAccess 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_AllowHeapAccess_intValue(PNIEnv_int * env, void * mem); 21 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AllowHeapAccess_intValueCritical(void * mem); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif // _Included_io_vproxy_pni_test_AllowHeapAccess 27 | // metadata.generator-version: pni test 28 | // sha256:567c0475ebad9f14ba92304509e344b6c891a2484f050dd8eeddf17f1f2b197e 29 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AllowHeapAccess.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AllowHeapAccess.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_AllowHeapAccess_intValue(PNIEnv_int * env, void * mem) { 8 | env->return_ = *((int*)mem); 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AllowHeapAccess_intValueCritical(void * mem) { 13 | return *((int*)mem); 14 | } 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | // metadata.generator-version: pni test 20 | // sha256:c2ba96d72d485ed83022cbdc17caa2285804286cee447fa20ce3e9a0d4a63801 21 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AlwaysAlignedBase.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_AlwaysAlignedBase */ 3 | #ifndef _Included_io_vproxy_pni_test_AlwaysAlignedBase 4 | #define _Included_io_vproxy_pni_test_AlwaysAlignedBase 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct AlwaysAlignedBase; 10 | typedef struct AlwaysAlignedBase AlwaysAlignedBase; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(AlwaysAlignedBase, AlwaysAlignedBase *) 24 | PNIBufExpand(AlwaysAlignedBase, AlwaysAlignedBase, 1) 25 | 26 | struct AlwaysAlignedBase { 27 | int8_t a; 28 | }; 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif // _Included_io_vproxy_pni_test_AlwaysAlignedBase 34 | // metadata.generator-version: pni test 35 | // sha256:b7f7dce8ce4c52d9b718a5d9b69aa7dc0e46daf34ed053585bc785110ec56bdc 36 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AlwaysAlignedClass.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_AlwaysAlignedClass */ 3 | #ifndef _Included_io_vproxy_pni_test_AlwaysAlignedClass 4 | #define _Included_io_vproxy_pni_test_AlwaysAlignedClass 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct AlwaysAlignedClass; 10 | typedef struct AlwaysAlignedClass AlwaysAlignedClass; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(AlwaysAlignedClass, AlwaysAlignedClass *) 24 | PNIBufExpand(AlwaysAlignedClass, AlwaysAlignedClass, 16) 25 | 26 | struct AlwaysAlignedClass { 27 | int8_t a; 28 | int16_t b; 29 | int64_t c; 30 | }; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_AlwaysAlignedClass 36 | // metadata.generator-version: pni test 37 | // sha256:368b8e4afa3468df3a3513c79046ff765f4c3a64af028c0f95e000ab5b733b9f 38 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AlwaysAlignedSizeof.extra.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlwaysAlignedSizeof.h" 2 | 3 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_AlwaysAlignedSizeof___getLayoutByteSize() { 4 | return sizeof(SizeofStructExpr); 5 | } 6 | // metadata.generator-version: pni test 7 | // sha256:8599f5af0f6e04b3d4ed88075ad0ae89cad110514593c0198cd60751c5a50498 8 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AlwaysAlignedSizeof.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_AlwaysAlignedSizeof */ 3 | #ifndef _Included_io_vproxy_pni_test_AlwaysAlignedSizeof 4 | #define _Included_io_vproxy_pni_test_AlwaysAlignedSizeof 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "sizeof.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_AlwaysAlignedSizeof___getLayoutByteSize(); 22 | 23 | PNIEnvExpand(SizeofStructExpr, SizeofStructExpr *) 24 | PNIBufExpand(SizeofStructExpr, SizeofStructExpr, JavaCritical_io_vproxy_pni_test_AlwaysAlignedSizeof___getLayoutByteSize()) 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | #endif // _Included_io_vproxy_pni_test_AlwaysAlignedSizeof 30 | // metadata.generator-version: pni test 31 | // sha256:fdbb45df7d233df9f0d5bf4cbc281b68a4e1614ac12467b29c06cc2a070c4e0f 32 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_AlwaysAlignedUnion.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_AlwaysAlignedUnion */ 3 | #ifndef _Included_io_vproxy_pni_test_AlwaysAlignedUnion 4 | #define _Included_io_vproxy_pni_test_AlwaysAlignedUnion 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | union AlwaysAlignedUnion; 10 | typedef union AlwaysAlignedUnion AlwaysAlignedUnion; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(AlwaysAlignedUnion, AlwaysAlignedUnion *) 24 | PNIBufExpand(AlwaysAlignedUnion, AlwaysAlignedUnion, 8) 25 | 26 | union AlwaysAlignedUnion { 27 | int16_t a; 28 | int32_t b; 29 | int64_t c; 30 | }; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_AlwaysAlignedUnion 36 | // metadata.generator-version: pni test 37 | // sha256:fff030a231ff9089167f2af94a29aafe2ca48c457d2c2a7b1fdcf523c825244c 38 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_BaseClass.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_BaseClass */ 3 | #ifndef _Included_io_vproxy_pni_test_BaseClass 4 | #define _Included_io_vproxy_pni_test_BaseClass 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct BaseClass; 10 | typedef struct BaseClass BaseClass; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(BaseClass, BaseClass *) 24 | PNIBufExpand(BaseClass, BaseClass, 1) 25 | 26 | struct BaseClass { 27 | int8_t a; 28 | }; 29 | 30 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_BaseClass_aaa(PNIEnv_void * env, BaseClass * self, int8_t a); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_BaseClass 36 | // metadata.generator-version: pni test 37 | // sha256:ac414a6598b1ffa1ccba07d8e5e7d126d1cc7c7cc08be704926882e6c999664c 38 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_BaseClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_BaseClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_BaseClass_aaa(PNIEnv_void * env, BaseClass * self, int8_t a) { 8 | self->a = a; 9 | return 0; 10 | } 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | // metadata.generator-version: pni test 16 | // sha256:5687d2461f27bb845a808030e9471567b31950e3da86a18335c413c373e03884 17 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_ChildClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_ChildClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_ChildClass_xxx(PNIEnv_void * env, ChildClass * self, int16_t x) { 8 | self->x = x; 9 | return 0; 10 | } 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | // metadata.generator-version: pni test 16 | // sha256:e40a99b37929525284ce4de320ace215f01100c848a94b59ba417355c12d2606 17 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_ChildOfPacked.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_ChildOfPacked.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_ChildOfPacked_xxx(PNIEnv_void * env, ChildOfPacked * self, int32_t x) { 8 | self->x = x; 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_ChildOfPacked_ooo(PNIEnv_void * env, ChildOfPacked * self, ObjectStruct * o) { 13 | self->o = *o; 14 | return 0; 15 | } 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | // metadata.generator-version: pni test 21 | // sha256:1f5a7a0e7ff466023073bfe9d095f1e036bf6e216a6caef40bb1c3233bfa3836 22 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_CustomNativeTypeFunc.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_CustomNativeTypeFunc.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int64_t* JNICALL JavaCritical_io_vproxy_pni_test_CustomNativeTypeFunc_exec(SizeofStructExpr* o) { 8 | return &(o->p1); 9 | } 10 | 11 | JNIEXPORT int64_t* JNICALL JavaCritical_io_vproxy_pni_test_CustomNativeTypeFunc_invoke(SizeofStructExpr * s) { 12 | return JavaCritical_io_vproxy_pni_test_CustomNativeTypeUpcall_exec(s); 13 | } 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | // metadata.generator-version: pni test 19 | // sha256:560491e980f7e29055f911f8176743c5426f8d6541133894a8373431af88ac69 20 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_CustomNativeTypeStruct.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_CustomNativeTypeStruct.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_CustomNativeTypeStruct_getP1(PNIEnv_long * env, CustomNativeTypeStruct * self) { 8 | env->return_ = self->field->p1; 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_CustomNativeTypeStruct_getArr(PNIEnv_buf_ptr * env, CustomNativeTypeStruct * self) { 13 | env->return_.bufLen = ptrPNIBufLen(3); 14 | env->return_.buf = &self->array; 15 | return 0; 16 | } 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | // metadata.generator-version: pni test 22 | // sha256:7958fa6bb6109a91c404703fce933e13cde931e60a3e8bb0a0385d78958b8005 23 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_CustomNativeTypeUpcall.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_CustomNativeTypeUpcall.h" 2 | #include 3 | #include 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | static int64_t* (*_exec)(SizeofStructExpr*); 10 | 11 | JNIEXPORT void JNICALL JavaCritical_io_vproxy_pni_test_CustomNativeTypeUpcall_INIT( 12 | int64_t* (*exec)(SizeofStructExpr*) 13 | ) { 14 | _exec = exec; 15 | } 16 | 17 | JNIEXPORT int64_t* JNICALL JavaCritical_io_vproxy_pni_test_CustomNativeTypeUpcall_exec(SizeofStructExpr* o) { 18 | if (_exec == NULL) { 19 | printf("JavaCritical_io_vproxy_pni_test_CustomNativeTypeUpcall_exec function pointer is null"); 20 | fflush(stdout); 21 | exit(1); 22 | } 23 | return _exec(o); 24 | } 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | // metadata.generator-version: pni test 30 | // sha256:3ebeb73d5cfb3ab23476a909c0a7f1d249b6ab981c78b92827f6ab9c294ff7c7 31 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_CustomNativeTypeUpcall.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_CustomNativeTypeUpcall */ 3 | #ifndef _Included_io_vproxy_pni_test_CustomNativeTypeUpcall 4 | #define _Included_io_vproxy_pni_test_CustomNativeTypeUpcall 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "sizeof.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT int64_t* JNICALL JavaCritical_io_vproxy_pni_test_CustomNativeTypeUpcall_exec(SizeofStructExpr* o); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif // _Included_io_vproxy_pni_test_CustomNativeTypeUpcall 27 | // metadata.generator-version: pni test 28 | // sha256:7d124f76a574ad5ba3d54b0ce0874e3eb7b5be69e3aeb18943ef27898d0b17dd 29 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_Empty.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_Empty */ 3 | #ifndef _Included_io_vproxy_pni_test_Empty 4 | #define _Included_io_vproxy_pni_test_Empty 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct Empty; 10 | typedef struct Empty Empty; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(Empty, Empty *) 24 | PNIBufExpand(Empty, Empty, (0 /* !!invalid!! */)) 25 | 26 | struct Empty { 27 | }; 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | #endif // _Included_io_vproxy_pni_test_Empty 33 | // metadata.generator-version: pni test 34 | // sha256:06c1e7dc355b3f3d0310d1dde826f6691de5dcd88a995a77cf075edde176b9ca 35 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_EmptyChild.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_EmptyChild */ 3 | #ifndef _Included_io_vproxy_pni_test_EmptyChild 4 | #define _Included_io_vproxy_pni_test_EmptyChild 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct EmptyChild; 10 | typedef struct EmptyChild EmptyChild; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | #include "io_vproxy_pni_test_LargeAlignBase.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | PNIEnvExpand(EmptyChild, EmptyChild *) 25 | PNIBufExpand(EmptyChild, EmptyChild, 8) 26 | 27 | struct EmptyChild { 28 | LargeAlignBase SUPER; 29 | }; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif // _Included_io_vproxy_pni_test_EmptyChild 35 | // metadata.generator-version: pni test 36 | // sha256:f091e8889ea77137a08bc2c3cee020d7266ca0ab9442c63f233cfb7c21508d8d 37 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityAlignField.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityAlignField.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityAlignField_init(PNIEnv_void * env, GCCCompatibilityAlignField * self) { 8 | self->b1 = 1; 9 | self->s = 2; 10 | self->n2 = 3; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityAlignField_size(PNIEnv_long * env, GCCCompatibilityAlignField * self) { 15 | env->return_ = sizeof(GCCCompatibilityAlignField); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:877c576b31c7da67d854d4fe233a893fbd1e9aa52ccf95435ab8fc2f0734516a 24 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityAlignFieldPacked.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityAlignFieldPacked.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityAlignFieldPacked_init(PNIEnv_void * env, GCCCompatibilityAlignFieldPacked * self) { 8 | self->b1 = 96; 9 | init_GCCCompatibilityStruct(self->packed); 10 | self->n2 = 97; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityAlignFieldPacked_size(PNIEnv_long * env, GCCCompatibilityAlignFieldPacked * self) { 15 | env->return_ = sizeof(GCCCompatibilityAlignFieldPacked); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:b81b1cb768814a034fffbad0b7ad9290db1df44a151652c6288e28e5e1369e6c 24 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityArrayZero.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityArrayZero.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityArrayZero_init(PNIEnv_void * env, GCCCompatibilityArrayZero * self) { 8 | self->b1 = 102; 9 | self->n2 = 103; 10 | return 0; 11 | } 12 | 13 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityArrayZero_size(PNIEnv_long * env, GCCCompatibilityArrayZero * self) { 14 | env->return_ = sizeof(GCCCompatibilityArrayZero); 15 | return 0; 16 | } 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | // metadata.generator-version: pni test 22 | // sha256:5bee2e4ea14d1216ff19f95a5ddbe0cc7fd2ca25366ca2cf816e56b05189948c 23 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityNonPackedArray.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityNonPackedArray.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNonPackedArray_init(PNIEnv_void * env, GCCCompatibilityNonPackedArray * self) { 8 | self->b1 = 100; 9 | init_GCCCompatibilityStruct(self->array[0]); 10 | init_GCCCompatibilityStruct(self->array[1]); 11 | self->n2 = 101; 12 | return 0; 13 | } 14 | 15 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNonPackedArray_size(PNIEnv_long * env, GCCCompatibilityNonPackedArray * self) { 16 | env->return_ = sizeof(GCCCompatibilityNonPackedArray); 17 | return 0; 18 | } 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | // metadata.generator-version: pni test 24 | // sha256:6dc3f75dccb0a1880a044bb0846c06c5a2523233c39cc22f28f4984b18ffda79 25 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityNonPackedContainNonPacked.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityNonPackedContainNonPacked.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNonPackedContainNonPacked_init(PNIEnv_void * env, GCCCompatibilityNonPackedContainNonPacked * self) { 8 | self->b1 = 92; 9 | init_GCCCompatibilityStruct(self->normal); 10 | self->n2 = 93; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNonPackedContainNonPacked_size(PNIEnv_long * env, GCCCompatibilityNonPackedContainNonPacked * self) { 15 | env->return_ = sizeof(GCCCompatibilityNonPackedContainNonPacked); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:122936ffd6b6e16faa5118ae21e60e47c7386f53d037d97c020ffecbe3dd4070 24 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityNonPackedContainPacked.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityNonPackedContainPacked.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNonPackedContainPacked_init(PNIEnv_void * env, GCCCompatibilityNonPackedContainPacked * self) { 8 | self->b1 = 90; 9 | init_GCCCompatibilityStruct(self->packed); 10 | self->n2 = 91; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNonPackedContainPacked_size(PNIEnv_long * env, GCCCompatibilityNonPackedContainPacked * self) { 15 | env->return_ = sizeof(GCCCompatibilityNonPackedContainPacked); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:ad40befb7efd9f4ada850f9754c599d382067e32cf47d0de902b01ebe15ed4df 24 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityNormal.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityNormal.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNormal_init(PNIEnv_void * env, GCCCompatibilityNormal * self) { 8 | init_GCCCompatibilityNormal(self); 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNormal_size(PNIEnv_long * env, GCCCompatibilityNormal * self) { 13 | env->return_ = sizeof(GCCCompatibilityNormal); 14 | return 0; 15 | } 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | // metadata.generator-version: pni test 21 | // sha256:4cde761d103921534abd91f8a590686c7d59c0c28bdda72ecb77255a02450c25 22 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityPacked.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityPacked.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPacked_init(PNIEnv_void * env, GCCCompatibilityPacked * self) { 8 | init_GCCCompatibilityPacked(self); 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPacked_size(PNIEnv_long * env, GCCCompatibilityPacked * self) { 13 | env->return_ = sizeof(GCCCompatibilityPacked); 14 | return 0; 15 | } 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | // metadata.generator-version: pni test 21 | // sha256:98076d0530de448618c9df89f26e668c62c13cc8675de0d9048d949490c272b1 22 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityPackedAlignField.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityPackedAlignField.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedAlignField_init(PNIEnv_void * env, GCCCompatibilityPackedAlignField * self) { 8 | self->b1 = 4; 9 | self->s = 5; 10 | self->n2 = 6; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedAlignField_size(PNIEnv_long * env, GCCCompatibilityPackedAlignField * self) { 15 | env->return_ = sizeof(GCCCompatibilityPackedAlignField); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:83000221c37c5d927775585d229a0d1e6de49ac5072db2797078ac025b136625 24 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityPackedAlignFieldSmallerAlign.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityPackedAlignFieldSmallerAlign.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedAlignFieldSmallerAlign_init(PNIEnv_void * env, GCCCompatibilityPackedAlignFieldSmallerAlign * self) { 8 | self->b1 = 7; 9 | self->l = 8; 10 | self->n2 = 9; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedAlignFieldSmallerAlign_size(PNIEnv_long * env, GCCCompatibilityPackedAlignFieldSmallerAlign * self) { 15 | env->return_ = sizeof(GCCCompatibilityPackedAlignFieldSmallerAlign); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:ef9fbc8918f3cd3a1487687beb13702f89ca121e29360dc334679cd7798f5133 24 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityPackedArray.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityPackedArray.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedArray_init(PNIEnv_void * env, GCCCompatibilityPackedArray * self) { 8 | self->b1 = 98; 9 | init_GCCCompatibilityStruct(self->array[0]); 10 | init_GCCCompatibilityStruct(self->array[1]); 11 | self->n2 = 99; 12 | return 0; 13 | } 14 | 15 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedArray_size(PNIEnv_long * env, GCCCompatibilityPackedArray * self) { 16 | env->return_ = sizeof(GCCCompatibilityPackedArray); 17 | return 0; 18 | } 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | // metadata.generator-version: pni test 24 | // sha256:06a00b92276acdac1abcba5ae438d496e0cba8fc9eaf8bb978961e9846c65ca6 25 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityPackedContainNonPacked.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityPackedContainNonPacked.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedContainNonPacked_init(PNIEnv_void * env, GCCCompatibilityPackedContainNonPacked * self) { 8 | self->b1 = 94; 9 | init_GCCCompatibilityStruct(self->normal); 10 | self->n2 = 95; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedContainNonPacked_size(PNIEnv_long * env, GCCCompatibilityPackedContainNonPacked * self) { 15 | env->return_ = sizeof(GCCCompatibilityPackedContainNonPacked); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:94a957ab38fad65b7e815001eb52d45514eb710a68c82ab0f913442a90a2393d 24 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCCompatibilityUnion.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_GCCCompatibilityUnion */ 3 | #ifndef _Included_io_vproxy_pni_test_GCCCompatibilityUnion 4 | #define _Included_io_vproxy_pni_test_GCCCompatibilityUnion 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | PNIEnvExpand(GCCCompatibilityUnion, GCCCompatibilityUnion *) 21 | PNIBufExpand(GCCCompatibilityUnion, GCCCompatibilityUnion, 8) 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif // _Included_io_vproxy_pni_test_GCCCompatibilityUnion 27 | // metadata.generator-version: pni test 28 | // sha256:c6b63a10c2e7b205f33569fa36e5445bc0b8583ca4fe9386c027e80de46cf5cb 29 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GCCompatibilityStructAlign.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCompatibilityStructAlign.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCompatibilityStructAlign_init(PNIEnv_void * env, GCCompatibilityStructAlign * self) { 8 | self->n = 1; 9 | self->l = 2; 10 | return 0; 11 | } 12 | 13 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCompatibilityStructAlign_size(PNIEnv_long * env, GCCompatibilityStructAlign * self) { 14 | env->return_ = sizeof(GCCompatibilityStructAlign); 15 | return 0; 16 | } 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | // metadata.generator-version: pni test 22 | // sha256:ceb48338897495c9a8ddc116353d92aba7703aee2ed8c2e7b018197c9a0ea317 23 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_GrandChildClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GrandChildClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GrandChildClass_yyy(PNIEnv_void * env, GrandChildClass * self, int64_t y) { 8 | self->y = y; 9 | return 0; 10 | } 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | // metadata.generator-version: pni test 16 | // sha256:f97130190d242be4abfcbf6265bffff7aa341c3d5d7ff0c42d98bf15e35d6b7d 17 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_KtDowncall.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_KtDowncall */ 3 | #ifndef _Included_io_vproxy_pni_test_KtDowncall 4 | #define _Included_io_vproxy_pni_test_KtDowncall 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_KtStruct.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_KtDowncall_retrieveLong(KtStruct * o); 22 | JNIEXPORT KtStruct * JNICALL JavaCritical_io_vproxy_pni_test_KtDowncall_invokeHelloWorld(int32_t i, int64_t l, KtStruct * return_); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif // _Included_io_vproxy_pni_test_KtDowncall 28 | // metadata.generator-version: pni test 29 | // sha256:d77fdf36a6537a49873b08c306383f6102e2b3d1e77eccb9daf629461ae7f494 30 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_KtDowncall.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_KtDowncall.h" 2 | #include "io_vproxy_pni_test_KtStruct.h" 3 | #include "io_vproxy_pni_test_KtUpcall.h" 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_KtDowncall_retrieveLong(KtStruct * o) { 10 | return o->aLong; 11 | } 12 | 13 | JNIEXPORT KtStruct * JNICALL JavaCritical_io_vproxy_pni_test_KtDowncall_invokeHelloWorld(int32_t i, int64_t l, KtStruct * return_) { 14 | return JavaCritical_io_vproxy_pni_test_KtUpcall_helloworld(i, l, return_); 15 | } 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | // metadata.generator-version: pni test 21 | // sha256:11c036cf1accefdcd9e00477011c07d0fed9106912bd8ce55b6d3aa30e18afd1 22 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_KtStruct.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_KtStruct.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_KtStruct_retrieveInt(PNIEnv_int * env, KtStruct * self) { 8 | env->return_ = self->aInt; 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_KtStruct_retrieveLong(PNIEnv_long * env, KtStruct * self) { 13 | env->return_ = self->aLong; 14 | return 0; 15 | } 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | // metadata.generator-version: pni test 21 | // sha256:aaa1d2f8b008e749b634c04eb0b0c450d8c1f45f2d186bfe57e25e6d1367ee38 22 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_KtStructInherit.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_KtStructInherit.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_KtStructInherit_retrieveObj(PNIEnv_PrimitiveStruct * env, KtStructInherit * self) { 8 | env->return_ = &self->obj; 9 | return 0; 10 | } 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | // metadata.generator-version: pni test 16 | // sha256:6ca020ce3a2525f675dbf6e29ff6a178f81c0789d9c1cec5d0d5126965dc0c10 17 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_KtUpcall.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_KtUpcall.h" 2 | #include 3 | #include 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | static KtStruct * (*_helloworld)(int32_t,int64_t,KtStruct *); 10 | 11 | JNIEXPORT void JNICALL JavaCritical_io_vproxy_pni_test_KtUpcall_INIT( 12 | KtStruct * (*helloworld)(int32_t,int64_t,KtStruct *) 13 | ) { 14 | _helloworld = helloworld; 15 | } 16 | 17 | JNIEXPORT KtStruct * JNICALL JavaCritical_io_vproxy_pni_test_KtUpcall_helloworld(int32_t i, int64_t l, KtStruct * return_) { 18 | if (_helloworld == NULL) { 19 | printf("JavaCritical_io_vproxy_pni_test_KtUpcall_helloworld function pointer is null"); 20 | fflush(stdout); 21 | exit(1); 22 | } 23 | return _helloworld(i, l, return_); 24 | } 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | // metadata.generator-version: pni test 30 | // sha256:048776dd0b94238775168f2bfea9c838122d9976aed2cae6a7d49d3fe2aaf21e 31 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_KtUpcall.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_KtUpcall */ 3 | #ifndef _Included_io_vproxy_pni_test_KtUpcall 4 | #define _Included_io_vproxy_pni_test_KtUpcall 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_KtStruct.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT KtStruct * JNICALL JavaCritical_io_vproxy_pni_test_KtUpcall_helloworld(int32_t i, int64_t l, KtStruct * return_); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif // _Included_io_vproxy_pni_test_KtUpcall 27 | // metadata.generator-version: pni test 28 | // sha256:f4d5fc02c0eb8e3a7c72d2fe53b2e5dd25897011efc3103ed97c854e40b4c818 29 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_LargeAlignBase.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_LargeAlignBase */ 3 | #ifndef _Included_io_vproxy_pni_test_LargeAlignBase 4 | #define _Included_io_vproxy_pni_test_LargeAlignBase 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct LargeAlignBase; 10 | typedef struct LargeAlignBase LargeAlignBase; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(LargeAlignBase, LargeAlignBase *) 24 | PNIBufExpand(LargeAlignBase, LargeAlignBase, 8) 25 | 26 | struct LargeAlignBase { 27 | int64_t x; 28 | }; 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif // _Included_io_vproxy_pni_test_LargeAlignBase 34 | // metadata.generator-version: pni test 35 | // sha256:34d8a9813c4e536badc8f428939c0ea59147fa389aa92613c96f43af8520dc89 36 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_NativeCheck.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_NativeCheck */ 3 | #ifndef _Included_io_vproxy_pni_test_NativeCheck 4 | #define _Included_io_vproxy_pni_test_NativeCheck 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_Userdata.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NativeCheck_checkUserdataForRef(PNIEnv_void * env, PNIRef * ref, int32_t * x, int64_t * y, int16_t * z); 22 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NativeCheck_checkUserdataForFunc(PNIEnv_void * env, PNIFunc * func, int32_t * x, int64_t * y, int16_t * z); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif // _Included_io_vproxy_pni_test_NativeCheck 28 | // metadata.generator-version: pni test 29 | // sha256:3c5b86a91c0eb5288c1964ad484aab0cffd8b79dc74a6974fded3d9420e70722 30 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_NativeCheck.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_NativeCheck.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NativeCheck_checkUserdataForRef(PNIEnv_void * env, PNIRef * ref, int32_t * x, int64_t * y, int16_t * z) { 8 | Userdata* ud = ref->userdata; 9 | *x = ud->x; 10 | *y = ud->y; 11 | *z = ud->z; 12 | return 0; 13 | } 14 | 15 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NativeCheck_checkUserdataForFunc(PNIEnv_void * env, PNIFunc * func, int32_t * x, int64_t * y, int16_t * z) { 16 | Userdata* ud = func->userdata; 17 | *x = ud->x; 18 | *y = ud->y; 19 | *z = ud->z; 20 | return 0; 21 | } 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | // metadata.generator-version: pni test 27 | // sha256:0b946d5a4f8528ed74a6656e61e6a6751bf7da31b39a2e691bfb89495c00d14b 28 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_NoAlloc.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_NoAlloc */ 3 | #ifndef _Included_io_vproxy_pni_test_NoAlloc 4 | #define _Included_io_vproxy_pni_test_NoAlloc 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_ObjectStruct.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NoAlloc_execNoAlloc(PNIEnv_ObjectStruct * env); 22 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NoAlloc_invokeUpcall(PNIEnv_ObjectStruct * env); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif // _Included_io_vproxy_pni_test_NoAlloc 28 | // metadata.generator-version: pni test 29 | // sha256:575fd5c31777eadf05cf878b6d96b202eca50c46f7e5d682e907841833abf4e2 30 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_NoAlloc.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_NoAlloc.h" 2 | #include "io_vproxy_pni_test_NoAllocUpcall.h" 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NoAlloc_invokeUpcall(PNIEnv_ObjectStruct * env) { 9 | env->return_ = JavaCritical_io_vproxy_pni_test_NoAllocUpcall_execNoAlloc(); 10 | return 0; 11 | } 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | // metadata.generator-version: pni test 17 | // sha256:a969834968f885e20e23af68d742fbd62339c150a63ff01216feb57aa6a6e63d 18 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_NoAllocUpcall.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_NoAllocUpcall.h" 2 | #include 3 | #include 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | static ObjectStruct * (*_execNoAlloc)(void); 10 | 11 | JNIEXPORT void JNICALL JavaCritical_io_vproxy_pni_test_NoAllocUpcall_INIT( 12 | ObjectStruct * (*execNoAlloc)(void) 13 | ) { 14 | _execNoAlloc = execNoAlloc; 15 | } 16 | 17 | JNIEXPORT ObjectStruct * JNICALL JavaCritical_io_vproxy_pni_test_NoAllocUpcall_execNoAlloc(void) { 18 | if (_execNoAlloc == NULL) { 19 | printf("JavaCritical_io_vproxy_pni_test_NoAllocUpcall_execNoAlloc function pointer is null"); 20 | fflush(stdout); 21 | exit(1); 22 | } 23 | return _execNoAlloc(); 24 | } 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | // metadata.generator-version: pni test 30 | // sha256:5f1de7520f5a3137cfe3469a02387e5e9653342a3b8d128f5c9434522dbb0947 31 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_NoAllocUpcall.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_NoAllocUpcall */ 3 | #ifndef _Included_io_vproxy_pni_test_NoAllocUpcall 4 | #define _Included_io_vproxy_pni_test_NoAllocUpcall 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_ObjectStruct.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT ObjectStruct * JNICALL JavaCritical_io_vproxy_pni_test_NoAllocUpcall_execNoAlloc(void); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif // _Included_io_vproxy_pni_test_NoAllocUpcall 27 | // metadata.generator-version: pni test 28 | // sha256:49776a126bf2667e99ad34e42dfb3708f2a5f43ce6a95e2156f3e09cd196c2ab 29 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_PackedBaseClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_PackedBaseClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_PackedBaseClass_aaa(PNIEnv_void * env, PackedBaseClass * self, int8_t a) { 8 | self->a = a; 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_PackedBaseClass_bbb(PNIEnv_void * env, PackedBaseClass * self, int16_t b) { 13 | self->b = b; 14 | return 0; 15 | } 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | // metadata.generator-version: pni test 21 | // sha256:4498f4525e2809b785a5f75cec89c9290280352f4a3d6882fedc002f20ca850e 22 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_PointerOnlyStruct.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_PointerOnlyStruct.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_PointerOnlyStruct_retrieve(PointerOnlyStruct * self) { 8 | return *((long*)self); 9 | } 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | // metadata.generator-version: pni test 15 | // sha256:7adc63ad409317dd1dba66439ba2442bfd4a2e4fb4cb1e5847e65c848af83ee2 16 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_PointerOnlyStructWithLen.extra.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_PointerOnlyStructWithLen.h" 2 | 3 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_PointerOnlyStructWithLen___getLayoutByteSize() { 4 | return 32; 5 | } 6 | // metadata.generator-version: pni test 7 | // sha256:b95e0410f90667e218489fe80486b0f9efa1daf8ae34ad19079bdfd8d24ca956 8 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_SizeofEmbed.extra.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_SizeofEmbed.h" 2 | 3 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_SizeofEmbed___getLayoutByteSize() { 4 | size_t ret = 16; 5 | ret += JavaCritical_io_vproxy_pni_test_SizeofStructExpr___getLayoutByteSize(); 6 | return ret; 7 | } 8 | // metadata.generator-version: pni test 9 | // sha256:eb5c12b41b7f3d3e0f3e73b0c3e4a7cdb2ac35210722e868edef6a5362671019 10 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_SizeofStruct.extra.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_SizeofStruct.h" 2 | 3 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_SizeofStruct___getLayoutByteSize() { 4 | return 16; 5 | } 6 | // metadata.generator-version: pni test 7 | // sha256:0d15a4c6f4f9b33c82f0d14e3b73da7b900646a8cafe7ab47ca8b260a4f4ef30 8 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_SizeofStructExpr.extra.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_SizeofStructExpr.h" 2 | 3 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_SizeofStructExpr___getLayoutByteSize() { 4 | return sizeof(SizeofStructExpr); 5 | } 6 | // metadata.generator-version: pni test 7 | // sha256:bea3677de8eb22f36044cc33447cf8f751d8e84ac8b93aac3db72e908ced74e1 8 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_SizeofStructExpr.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_SizeofStructExpr */ 3 | #ifndef _Included_io_vproxy_pni_test_SizeofStructExpr 4 | #define _Included_io_vproxy_pni_test_SizeofStructExpr 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "sizeof.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_SizeofStructExpr___getLayoutByteSize(); 22 | 23 | PNIEnvExpand(SizeofStructExpr, SizeofStructExpr *) 24 | PNIBufExpand(SizeofStructExpr, SizeofStructExpr, JavaCritical_io_vproxy_pni_test_SizeofStructExpr___getLayoutByteSize()) 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | #endif // _Included_io_vproxy_pni_test_SizeofStructExpr 30 | // metadata.generator-version: pni test 31 | // sha256:6bba9f20403b346456a31ef26d9035117181a4e08b8a6403ec3722dd4cfde78a 32 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_SizeofUnion.extra.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_SizeofUnion.h" 2 | 3 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_SizeofUnion___getLayoutByteSize() { 4 | return 24; 5 | } 6 | // metadata.generator-version: pni test 7 | // sha256:01fbe1d0d0ad9b97cdc1c6d54c934d4fdd36aaed272ec7125a3586dc4f8b84df 8 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_StructD.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_StructD */ 3 | #ifndef _Included_io_vproxy_pni_test_StructD 4 | #define _Included_io_vproxy_pni_test_StructD 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct StructD; 10 | typedef struct StructD StructD; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(StructD, StructD *) 24 | PNIBufExpand(StructD, StructD, 16) 25 | 26 | struct StructD { 27 | int32_t n; 28 | double d; 29 | }; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif // _Included_io_vproxy_pni_test_StructD 35 | // metadata.generator-version: pni test 36 | // sha256:4dfdb06fa36b10f2e8ec963cb2172adbb1d1ec1f42334ddc6ae0e94f45d9c5f4 37 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_StructM.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_StructM */ 3 | #ifndef _Included_io_vproxy_pni_test_StructM 4 | #define _Included_io_vproxy_pni_test_StructM 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct StructM; 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #include 16 | #include 17 | #include "io_vproxy_pni_test_StructN.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(StructM, struct StructM *) 24 | PNIBufExpand(StructM, struct StructM, 16) 25 | 26 | struct StructM { 27 | struct N_st n_st; 28 | }; 29 | 30 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_StructM_nnn(PNIEnv_void * env, struct StructM * self, struct N_st * n_st); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_StructM 36 | // metadata.generator-version: pni test 37 | // sha256:6a429fda389afeea660424f1c54b3d74848457dd4b0dca7d85503cd78196149f 38 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_StructN.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_StructN */ 3 | #ifndef _Included_io_vproxy_pni_test_StructN 4 | #define _Included_io_vproxy_pni_test_StructN 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_StructUnionAnnotation.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | PNIEnvExpand(N_st, struct N_st *) 22 | PNIBufExpand(N_st, struct N_st, 16) 23 | 24 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_StructN_retrieveS(PNIEnv_short * env, struct N_st * self); 25 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_StructN_retrieveL(PNIEnv_long * env, struct N_st * self); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | #endif // _Included_io_vproxy_pni_test_StructN 31 | // metadata.generator-version: pni test 32 | // sha256:9bc612ec2ead2ddc51980351f70cd2426cc7d1cecccbed62d61c753bf68ea46f 33 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_ToStringArray.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_ToStringArray */ 3 | #ifndef _Included_io_vproxy_pni_test_ToStringArray 4 | #define _Included_io_vproxy_pni_test_ToStringArray 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct ToStringArray; 10 | typedef struct ToStringArray ToStringArray; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(ToStringArray, ToStringArray *) 24 | PNIBufExpand(ToStringArray, ToStringArray, 64) 25 | 26 | struct ToStringArray { 27 | ToStringClass arrc[0]; 28 | ToStringClass arrcLen2[2]; 29 | PNIBuf_ToStringClass parrc; 30 | }; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_ToStringArray 36 | // metadata.generator-version: pni test 37 | // sha256:88bb51f496b828dd5015a310cb04de384890fc6b852288fa9cddaed3f5acda82 38 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_ToStringClass.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_ToStringClass */ 3 | #ifndef _Included_io_vproxy_pni_test_ToStringClass 4 | #define _Included_io_vproxy_pni_test_ToStringClass 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct ToStringClass; 10 | typedef struct ToStringClass ToStringClass; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | #include "io_vproxy_pni_test_ToStringClassRecurse.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | PNIEnvExpand(ToStringClass, ToStringClass *) 25 | PNIBufExpand(ToStringClass, ToStringClass, 24) 26 | 27 | struct ToStringClass { 28 | int64_t num; 29 | ToStringClassRecurse cr; 30 | }; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_ToStringClass 36 | // metadata.generator-version: pni test 37 | // sha256:a315f50bd8e766068e182211e338d28dab9d2f63975745e80f3e7bb83e764028 38 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_ToStringClass2.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_ToStringClass2 */ 3 | #ifndef _Included_io_vproxy_pni_test_ToStringClass2 4 | #define _Included_io_vproxy_pni_test_ToStringClass2 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct ToStringClass2; 10 | typedef struct ToStringClass2 ToStringClass2; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(ToStringClass2, ToStringClass2 *) 24 | PNIBufExpand(ToStringClass2, ToStringClass2, 40) 25 | 26 | struct ToStringClass2 { 27 | int64_t num; 28 | PNIRef * ref; 29 | PNIFunc * func; 30 | PNIBuf_ToStringClass arrc; 31 | }; 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | #endif // _Included_io_vproxy_pni_test_ToStringClass2 37 | // metadata.generator-version: pni test 38 | // sha256:96a6e336fa09af3abc9caf28762aacb825ef42dad11d7d5eb6ecc05887d09509 39 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_UnionC.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_UnionC */ 3 | #ifndef _Included_io_vproxy_pni_test_UnionC 4 | #define _Included_io_vproxy_pni_test_UnionC 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | union UnionC; 10 | typedef union UnionC UnionC; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(UnionC, UnionC *) 24 | PNIBufExpand(UnionC, UnionC, 8) 25 | 26 | union UnionC { 27 | int32_t n; 28 | int64_t l; 29 | }; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif // _Included_io_vproxy_pni_test_UnionC 35 | // metadata.generator-version: pni test 36 | // sha256:eda297c5239137523e1577fe3ffe6c9185b81f0f5db08aeaa6f575f0cd6b9f1a 37 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_UnionEmbedded.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_UnionEmbedded */ 3 | #ifndef _Included_io_vproxy_pni_test_UnionEmbedded 4 | #define _Included_io_vproxy_pni_test_UnionEmbedded 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif // _Included_io_vproxy_pni_test_UnionEmbedded 24 | // metadata.generator-version: pni test 25 | // sha256:f775a97a09212a249e2877d2867b916518f1073766f15a7ff9458b3588c1eeaf 26 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_UnionO.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_UnionO */ 3 | #ifndef _Included_io_vproxy_pni_test_UnionO 4 | #define _Included_io_vproxy_pni_test_UnionO 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | union UnionO; 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #include 16 | #include 17 | #include "io_vproxy_pni_test_UnionP.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(UnionO, union UnionO *) 24 | PNIBufExpand(UnionO, union UnionO, 8) 25 | 26 | union UnionO { 27 | int16_t s; 28 | int32_t i; 29 | UnionP p; 30 | }; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_UnionO 36 | // metadata.generator-version: pni test 37 | // sha256:1743a25ed3e78afb9b2e4382a0ccd59dc39462033a6260f112d66279ad72b096 38 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_UnionP.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_UnionP */ 3 | #ifndef _Included_io_vproxy_pni_test_UnionP 4 | #define _Included_io_vproxy_pni_test_UnionP 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_StructUnionAnnotation.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | PNIEnvExpand(UnionP, UnionP *) 22 | PNIBufExpand(UnionP, UnionP, 8) 23 | 24 | JNIEXPORT int JNICALL UnionP_retrieve_i(PNIEnv_int * env, UnionP * self); 25 | JNIEXPORT int JNICALL UnionP_retrieve_l(PNIEnv_long * env, UnionP * self); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | #endif // _Included_io_vproxy_pni_test_UnionP 31 | // metadata.generator-version: pni test 32 | // sha256:be213ab6409b21777960762d0f954d96ce94541fe877f67bd3f4daa0d8ed5aeb 33 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/io_vproxy_pni_test_Userdata.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_Userdata */ 3 | #ifndef _Included_io_vproxy_pni_test_Userdata 4 | #define _Included_io_vproxy_pni_test_Userdata 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct Userdata; 10 | typedef struct Userdata Userdata; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(Userdata, Userdata *) 24 | PNIBufExpand(Userdata, Userdata, 24) 25 | 26 | struct Userdata { 27 | int32_t x; 28 | int64_t y; 29 | int16_t z; 30 | }; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_Userdata 36 | // metadata.generator-version: pni test 37 | // sha256:bf76395673d4b6b392185070fb0ebfb30316b8b1cdd7f9f554569ae8bb6662c2 38 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c-generated/jni.h: -------------------------------------------------------------------------------- 1 | #ifndef PNI_JNIMOCK_H 2 | #define PNI_JNIMOCK_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef WIN32 8 | #define JNIEXPORT __declspec(dllexport) 9 | #else 10 | #define JNIEXPORT __attribute__((visibility("default"))) 11 | #endif 12 | 13 | #ifdef WIN32 14 | #define JNICALL __stdcall 15 | #else 16 | #define JNICALL 17 | #endif 18 | 19 | #include 20 | 21 | typedef int8_t jbyte; 22 | typedef uint16_t jchar; 23 | typedef double jdouble; 24 | typedef float jfloat; 25 | typedef int32_t jint; 26 | typedef int64_t jlong; 27 | typedef int16_t jshort; 28 | typedef uint8_t jboolean; 29 | 30 | #define JNI_FALSE (0) 31 | #define JNI_TRUE (1) 32 | 33 | #define JNI_OK (0) 34 | #define JNI_ERR (-1) 35 | 36 | #endif // PNI_JNIMOCK_H 37 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/align.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignClass.impl.h" 2 | #include "io_vproxy_pni_test_AlignField.impl.h" 3 | #include "io_vproxy_pni_test_AlignField2.impl.h" 4 | #include "io_vproxy_pni_test_AlignField3.impl.h" 5 | #include "io_vproxy_pni_test_AlignBaseClass.impl.h" 6 | #include "io_vproxy_pni_test_AlignChildClass.impl.h" 7 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_AllowHeapAccess.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AllowHeapAccess.impl.h" 2 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_CustomNativeType.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_CustomNativeTypeFunc.impl.h" 2 | #include "io_vproxy_pni_test_CustomNativeTypeStruct.impl.h" 3 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_DefiningCFunction.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_DefiningCFunction.impl.h" 2 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_Func.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_Func.impl.h" 2 | 3 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_Func_func1(PNIEnv_int * env) { 4 | env->return_ = JavaCritical_io_vproxy_pni_test_Func_func1Critical(); 5 | return 0; 6 | } 7 | 8 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_Func_func1Critical(void) { 9 | return 10; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_Func_func2(PNIEnv_void * env) { 13 | return PNIThrowException(env, "java.io.IOException", "hello"); 14 | } 15 | 16 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_Func_func3(PNIEnv_void * env, char * ex) { 17 | if (ex == NULL) { 18 | return 0; 19 | } 20 | return PNIThrowException(env, ex, "aaa"); 21 | } 22 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_Generic.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_Generic.impl.h" 2 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_InvokeUpcall.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_InvokeUpcall.impl.h" 2 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_InvokeUpcallNull.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_InvokeUpcallNull.impl.h" 2 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_Kt.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_KtDowncall.impl.h" 2 | #include "io_vproxy_pni_test_KtStruct.impl.h" 3 | #include "io_vproxy_pni_test_KtStructInherit.impl.h" 4 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_NativeCheck.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_NativeCheck.impl.h" 2 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_Null.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_Null.impl.h" 2 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_PointerArrayField.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_PointerArrayField.impl.h" 2 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_PointerOnlyStruct.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_PointerOnlyStruct.impl.h" 2 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_RawArrays.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_RawArrays.impl.h" 2 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_RefAndFuncFields.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_RefAndFuncFields.impl.h" 2 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_StructM.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_StructM.h" 2 | 3 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_StructM_nnn(PNIEnv_void * env, struct StructM * self, struct N_st * n_st) { 4 | self->n_st = *n_st; 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_StructN.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_StructN.h" 2 | 3 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_StructN_retrieveS(PNIEnv_short * env, struct N_st * self) { 4 | env->return_ = self->s; 5 | return 0; 6 | } 7 | 8 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_StructN_retrieveL(PNIEnv_long * env, struct N_st * self) { 9 | env->return_ = self->l; 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_StructUnionAnnotation.h: -------------------------------------------------------------------------------- 1 | #ifndef _Included_io_vproxy_pni_test_StructUnionAnnotation 2 | #define _Included_io_vproxy_pni_test_StructUnionAnnotation 3 | 4 | #include 5 | 6 | struct N_st { 7 | uint16_t s; /* padding */ uint32_t : 32; uint16_t : 16; 8 | uint64_t l; 9 | } __attribute__((packed)); 10 | 11 | typedef union { 12 | uint32_t i; 13 | uint64_t l; 14 | } __attribute__((packed)) UnionP; 15 | 16 | #endif // _Included_io_vproxy_pni_test_StructUnionAnnotation 17 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/io_vproxy_pni_test_UnionP.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_UnionP.h" 2 | 3 | JNIEXPORT int JNICALL UnionP_retrieve_i(PNIEnv_int * env, UnionP * self) { 4 | env->return_ = self->i; 5 | return 0; 6 | } 7 | 8 | JNIEXPORT int JNICALL UnionP_retrieve_l(PNIEnv_long * env, UnionP * self) { 9 | env->return_ = self->l; 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/noalloc.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_NoAlloc.h" 2 | #include "io_vproxy_pni_test_NoAlloc.impl.h" 3 | 4 | static ObjectStruct objectStruct; 5 | 6 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NoAlloc_execNoAlloc(PNIEnv_ObjectStruct * env) { 7 | ++objectStruct.lenStr[0]; 8 | env->return_ = &objectStruct; 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/sizeof.c: -------------------------------------------------------------------------------- 1 | #include "sizeof.h" 2 | #include "io_vproxy_pni_test_SizeofStruct.h" 3 | #include "io_vproxy_pni_test_SizeofStructExpr.h" 4 | #include "io_vproxy_pni_test_SizeofUnion.h" 5 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/sizeof.h: -------------------------------------------------------------------------------- 1 | #ifndef _SIZEOF_H 2 | #define _SIZEOF_H 3 | 4 | #include 5 | 6 | typedef struct { 7 | int8_t b; 8 | int16_t s; 9 | int64_t p1; 10 | } SizeofStructExpr; 11 | 12 | #endif // _SIZEOF_H 13 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/c/super_class.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_BaseClass.impl.h" 2 | #include "io_vproxy_pni_test_ChildClass.impl.h" 3 | #include "io_vproxy_pni_test_ChildOfPacked.impl.h" 4 | #include "io_vproxy_pni_test_GrandChildClass.impl.h" 5 | #include "io_vproxy_pni_test_PackedBaseClass.impl.h" 6 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/generated/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vproxy-tools/panama-native-interface/a1d044fd82c397b523c97c887632ff1092bbfb72/acceptance-testing/src/test/generated/.gitkeep -------------------------------------------------------------------------------- /acceptance-testing/src/test/java/io/vproxy/pni/test/cases/TestBeforeAll.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.test.cases; 2 | 3 | import io.vproxy.pni.test.Upcall; 4 | import io.vproxy.pni.test.UpcallNull; 5 | import io.vproxy.pni.test.impl.UpcallImpl; 6 | import io.vproxy.pni.test.impl.UpcallNullImpl; 7 | import org.junit.BeforeClass; 8 | import org.junit.Test; 9 | 10 | public class TestBeforeAll { 11 | @BeforeClass 12 | public static void beforeClass() { 13 | TestUtils.loadLib(); 14 | Upcall.setImpl(UpcallImpl.get()); 15 | UpcallNull.setImpl(UpcallNullImpl.get()); 16 | } 17 | 18 | @Test 19 | public void dummy() { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /acceptance-testing/src/test/java/io/vproxy/pni/test/cases/TestGraalRuntime.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.test.cases; 2 | 3 | import io.vproxy.pni.graal.GraalUtils; 4 | import io.vproxy.r.org.graalvm.nativeimage.ImageInfoDelegate; 5 | import org.junit.Test; 6 | 7 | public class TestGraalRuntime { 8 | @Test 9 | public void init() { 10 | GraalUtils.init(); 11 | } 12 | 13 | @Test 14 | public void setThread() { 15 | GraalUtils.setThread(); 16 | } 17 | 18 | @Test 19 | public void imageInfo() { 20 | System.out.println("inImageCode = " + ImageInfoDelegate.inImageCode()); 21 | System.out.println("inImageRuntimeCode = " + ImageInfoDelegate.inImageRuntimeCode()); 22 | System.out.println("inImageBuildtimeCode = " + ImageInfoDelegate.inImageBuildtimeCode()); 23 | System.out.println("isExecutable = " + ImageInfoDelegate.isExecutable()); 24 | System.out.println("isSharedLibrary = " + ImageInfoDelegate.isSharedLibrary()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /api/build.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | } 3 | -------------------------------------------------------------------------------- /api/src/main/c/jnimock/jni.h: -------------------------------------------------------------------------------- 1 | #ifndef PNI_JNIMOCK_H 2 | #define PNI_JNIMOCK_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef WIN32 8 | #define JNIEXPORT __declspec(dllexport) 9 | #else 10 | #define JNIEXPORT __attribute__((visibility("default"))) 11 | #endif 12 | 13 | #ifdef WIN32 14 | #define JNICALL __stdcall 15 | #else 16 | #define JNICALL 17 | #endif 18 | 19 | #include 20 | 21 | typedef int8_t jbyte; 22 | typedef uint16_t jchar; 23 | typedef double jdouble; 24 | typedef float jfloat; 25 | typedef int32_t jint; 26 | typedef int64_t jlong; 27 | typedef int16_t jshort; 28 | typedef uint8_t jboolean; 29 | 30 | #define JNI_FALSE (0) 31 | #define JNI_TRUE (1) 32 | 33 | #define JNI_OK (0) 34 | #define JNI_ERR (-1) 35 | 36 | #endif // PNI_JNIMOCK_H 37 | -------------------------------------------------------------------------------- /api/src/main/c/make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | os=`uname` 4 | 5 | target="pni" 6 | include_platform_dir="" 7 | 8 | if [[ "Linux" == "$os" ]] 9 | then 10 | target="lib$target.so" 11 | include_platform_dir="linux" 12 | elif [[ "Darwin" == "$os" ]] 13 | then 14 | target="lib$target.dylib" 15 | include_platform_dir="darwin" 16 | else 17 | target="$target.dll" 18 | include_platform_dir="win32" 19 | fi 20 | 21 | rm -f "$target" 22 | 23 | gcc -std=gnu99 -O2 \ 24 | $GCC_OPTS \ 25 | -I "./" \ 26 | -I "./jnimock/" \ 27 | -shared -Werror -fPIC \ 28 | pni.c \ 29 | -o "$target" 30 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/AbstractNativeObject.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni; 2 | 3 | import java.util.HashSet; 4 | 5 | public abstract class AbstractNativeObject implements NativeObject { 6 | @Override 7 | public String toString() { 8 | var sb = new StringBuilder(); 9 | toString(sb, 0, new HashSet<>(), false); 10 | return sb.toString(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/CallSite.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni; 2 | 3 | @FunctionalInterface 4 | public interface CallSite { 5 | int call(T ref); 6 | } 7 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/GraalHelper.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni; 2 | 3 | import java.lang.foreign.MemorySegment; 4 | 5 | public class GraalHelper { 6 | private GraalHelper() { 7 | } 8 | 9 | private static MemorySegment releaseRef; 10 | 11 | public static MemorySegment getReleaseRef() { 12 | return releaseRef; 13 | } 14 | 15 | public static void setReleaseRef(MemorySegment releaseRef) { 16 | GraalHelper.releaseRef = releaseRef; 17 | } 18 | 19 | private static MemorySegment invokeFunc; 20 | 21 | public static MemorySegment getInvokeFunc() { 22 | return invokeFunc; 23 | } 24 | 25 | public static void setInvokeFunc(MemorySegment invokeFunc) { 26 | GraalHelper.invokeFunc = invokeFunc; 27 | } 28 | 29 | private static MemorySegment releaseFunc; 30 | 31 | public static MemorySegment getReleaseFunc() { 32 | return releaseFunc; 33 | } 34 | 35 | public static void setReleaseFunc(MemorySegment releaseFunc) { 36 | GraalHelper.releaseFunc = releaseFunc; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/MetadataAllocationCallback.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni; 2 | 3 | import java.lang.foreign.MemorySegment; 4 | 5 | @FunctionalInterface 6 | public 7 | interface MetadataAllocationCallback { 8 | void allocated(AllocationInfo info); 9 | 10 | /** 11 | * @param allocator the original allocator which allocated the memory 12 | * @param metadataAllocator the metadata allocator 13 | * @param size the returned memory segment byte size, without extra data 14 | * @param meta memory segment for meta with byteSize of extraMemory 15 | */ 16 | record AllocationInfo( 17 | Allocator allocator, 18 | Allocator metadataAllocator, 19 | long size, 20 | MemorySegment meta 21 | ) { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/NativeObject.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni; 2 | 3 | import java.lang.foreign.MemorySegment; 4 | import java.util.Set; 5 | 6 | public interface NativeObject { 7 | MemorySegment MEMORY(); 8 | 9 | @Override 10 | String toString(); 11 | 12 | void toString(StringBuilder sb, int indent, Set visited, boolean corrupted); 13 | } 14 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/PNILinkOptions.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni; 2 | 3 | public class PNILinkOptions extends PNILookupOptions { 4 | private boolean critical = false; 5 | private boolean allowHeapAccess = false; 6 | 7 | public boolean isCritical() { 8 | return critical; 9 | } 10 | 11 | public boolean isAllowHeapAccess() { 12 | return allowHeapAccess; 13 | } 14 | 15 | public PNILinkOptions setCritical(boolean critical) { 16 | if (!critical) { 17 | clearCritical(); 18 | } 19 | this.critical = critical; 20 | return this; 21 | } 22 | 23 | private void clearCritical() { 24 | setAllowHeapAccess(false); 25 | } 26 | 27 | public PNILinkOptions setAllowHeapAccess(boolean allowHeapAccess) { 28 | if (allowHeapAccess) { 29 | setCritical(true); 30 | } 31 | this.allowHeapAccess = allowHeapAccess; 32 | return this; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/PNILookupOptions.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni; 2 | 3 | public class PNILookupOptions { 4 | } 5 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/PooledAllocatorProvider.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni; 2 | 3 | public interface PooledAllocatorProvider { 4 | Allocator create(); 5 | } 6 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Align.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Ensures the minimal memory alignment or makes it packed. 10 | */ 11 | @Target({ElementType.TYPE, ElementType.FIELD}) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface Align { 14 | long value() default 1; 15 | 16 | boolean packed() default false; 17 | } 18 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/AlwaysAligned.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Assumes that this type/field will always be accessed with alignment.
10 | * This annotation affects to generate aligned or unaligned layout.
11 | * e.g.:
    12 | *
  • {@link java.lang.foreign.ValueLayout#JAVA_INT_UNALIGNED}
  • 13 | *
  • {@link java.lang.foreign.ValueLayout#JAVA_INT}
  • 14 | *
15 | */ 16 | @Target({ElementType.TYPE, ElementType.FIELD}) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | public @interface AlwaysAligned { 19 | boolean value() default true; 20 | } 21 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Bit.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.FIELD) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface Bit { 11 | Field[] value(); 12 | 13 | @Target({}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @interface Field { 16 | String name(); 17 | 18 | int bits(); 19 | 20 | boolean bool() default false; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Downcall.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Mark the interface to only generate functions, without struct nor union. 10 | */ 11 | @Target(ElementType.TYPE) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface Downcall { 14 | } 15 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/GenerateMember.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Used in conjunction with {@link SpecifyGeneratedMembers} 10 | */ 11 | @Target({ElementType.FIELD, ElementType.METHOD}) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface GenerateMember { 14 | } 15 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Impl.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.METHOD) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface Impl { 11 | String[] include() default {}; 12 | 13 | String c(); 14 | } 15 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Include.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.TYPE) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface Include { 11 | String[] value(); 12 | } 13 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Len.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Only used for array types. Define the length of the array, 10 | * so that it will be considered as embedded into the struct. 11 | */ 12 | @Target(ElementType.FIELD) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface Len { 15 | /** 16 | * @return 0 or positive values to define the length of the array, negative values to disable effect of this annotation 17 | */ 18 | long value(); 19 | } 20 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/LinkerOption.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | public class LinkerOption { 9 | private LinkerOption() { 10 | } 11 | 12 | /** 13 | * Mark the function to be critical, see Linker.Option.isTrivial in jdk 21, 14 | * or Linker.Option.critical in jdk 22. 15 | */ 16 | @Target(ElementType.METHOD) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | public @interface Critical { 19 | boolean allowHeapAccess() default false; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Name.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Use the name defined by this annotation when generating C struct or field or function. 10 | */ 11 | @Target({ 12 | ElementType.TYPE, 13 | ElementType.FIELD, 14 | ElementType.METHOD, 15 | ElementType.PARAMETER, 16 | }) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | public @interface Name { 19 | String value(); 20 | } 21 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/NativeReturnType.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.METHOD) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface NativeReturnType { 11 | String value(); 12 | } 13 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/NativeType.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target({ElementType.FIELD, ElementType.PARAMETER}) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface NativeType { 11 | String value(); 12 | } 13 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/NoAlloc.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.METHOD) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface NoAlloc { 11 | } 12 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Pointer.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Consider the field to be a pointer in C code. 10 | */ 11 | @Target(ElementType.FIELD) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface Pointer { 14 | } 15 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/PointerOnly.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.TYPE) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface PointerOnly { 11 | } 12 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Raw.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | import java.nio.ByteBuffer; 8 | import java.lang.foreign.MemorySegment; 9 | 10 | /** 11 | * Annotate the data type to be converted to its raw form. 12 | *
    13 | *
  • This annotation currently only applies to {@link ByteBuffer} parameters, 14 | * which will be converted to {@link MemorySegment}. 15 | * This has the same effect as setting {@link ByteBuffer#position()} to 0 16 | * and {@link ByteBuffer#limit()} to {@link ByteBuffer#capacity()}, 17 | * without actually modifying the buffer.
  • 18 | *
19 | */ 20 | @Target(ElementType.PARAMETER) 21 | @Retention(RetentionPolicy.RUNTIME) 22 | public @interface Raw { 23 | } 24 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/SpecifyGeneratedMembers.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * This annotation is used to manually specify which 10 | * members (fields/methods) should be generated.
11 | * This is useful for some JVM languages such as Kotlin, 12 | * which automatically generates methods or even fields. 13 | */ 14 | @Target(ElementType.TYPE) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | public @interface SpecifyGeneratedMembers { 17 | } 18 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Struct.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Generate a C struct for the class. 10 | */ 11 | @Target(ElementType.TYPE) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface Struct { 14 | /** 15 | * @return Use typedef for the struct. 16 | */ 17 | boolean typedef() default true; 18 | 19 | /** 20 | * @return Skip generating the type. This is useful if it's defined in another C header file. 21 | */ 22 | boolean skip() default false; 23 | } 24 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Style.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.METHOD) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface Style { 11 | Styles value(); 12 | } 13 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Styles.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | public enum Styles { 4 | pni, 5 | critical, 6 | } 7 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Suppress.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface Suppress { 11 | String[] value(); 12 | } 13 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Union.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Generate a c union for the class. 10 | */ 11 | @Target(ElementType.TYPE) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface Union { 14 | /** 15 | * @return Use typedef for the union. 16 | */ 17 | boolean typedef() default true; 18 | 19 | /** 20 | * @return Do not generate a union type, simply embed it into another struct. 21 | */ 22 | boolean embedded() default false; 23 | 24 | /** 25 | * @return Skip generating the type. This is useful if it's defined in another C header file. 26 | */ 27 | boolean skip() default false; 28 | } 29 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Unsigned.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Make the field or argument to be unsigned. 10 | *
Only effective for integer types. 11 | */ 12 | @Target({ 13 | ElementType.FIELD, 14 | ElementType.PARAMETER, 15 | }) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | public @interface Unsigned { 18 | } 19 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/annotation/Upcall.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Mark the class/interface to only generate functions, without struct nor union. 10 | */ 11 | @Target(ElementType.TYPE) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface Upcall { 14 | } 15 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/exception/PNIException.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exception; 2 | 3 | public class PNIException extends RuntimeException { 4 | public PNIException(String msg) { 5 | super(msg); 6 | } 7 | 8 | public PNIException(Throwable t) { 9 | super(t); 10 | } 11 | 12 | public PNIException(String msg, Throwable t) { 13 | super(msg, t); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/impl/AbstractAllocator.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.impl; 2 | 3 | import io.vproxy.pni.Allocator; 4 | import io.vproxy.pni.PNIRef; 5 | 6 | public abstract class AbstractAllocator implements Allocator { 7 | private PNIRef ref = null; 8 | 9 | @Override 10 | public PNIRef ref() { 11 | if (ref != null) 12 | return ref; 13 | synchronized (this) { 14 | if (ref != null) 15 | return ref; 16 | ref = PNIRef.of(this); 17 | } 18 | return ref; 19 | } 20 | 21 | @Override 22 | public void close() { 23 | PNIRef ref; 24 | synchronized (this) { 25 | ref = this.ref; 26 | if (ref == null) 27 | return; 28 | this.ref = null; 29 | } 30 | ref.close(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/impl/ArenaAllocator.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.impl; 2 | 3 | import io.vproxy.pni.Allocator; 4 | 5 | import java.lang.foreign.Arena; 6 | import java.lang.foreign.MemorySegment; 7 | 8 | public class ArenaAllocator extends AbstractAllocator implements Allocator { 9 | private final Arena arena; 10 | 11 | public ArenaAllocator(Arena arena) { 12 | this.arena = arena; 13 | } 14 | 15 | @Override 16 | public MemorySegment allocate(long size) { 17 | return arena.allocate(size); 18 | } 19 | 20 | @Override 21 | public MemorySegment allocate(long size, int alignment) { 22 | return arena.allocate(size, alignment); 23 | } 24 | 25 | @Override 26 | public void close() { 27 | super.close(); 28 | arena.close(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/impl/DummyAllocator.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.impl; 2 | 3 | import io.vproxy.pni.Allocator; 4 | 5 | import java.lang.foreign.MemorySegment; 6 | 7 | public class DummyAllocator extends AbstractAllocator implements Allocator { 8 | private static final DummyAllocator INSTANCE = new DummyAllocator(); 9 | 10 | private DummyAllocator() { 11 | } 12 | 13 | public static DummyAllocator get() { 14 | return INSTANCE; 15 | } 16 | 17 | @Override 18 | public MemorySegment allocate(long size) { 19 | return MemorySegment.NULL; 20 | } 21 | 22 | @Override 23 | public MemorySegment allocate(long size, int alignment) { 24 | return MemorySegment.NULL; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/impl/ForceNoInlineConcurrentLongMap.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.impl; 2 | 3 | import java.util.concurrent.ConcurrentMap; 4 | 5 | public class ForceNoInlineConcurrentLongMap { 6 | private final ConcurrentMap map; 7 | 8 | public ForceNoInlineConcurrentLongMap(ConcurrentMap map) { 9 | this.map = map; 10 | } 11 | 12 | public V get(long key) { 13 | return map.get(key); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/impl/NoCloseArenaAllocator.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.impl; 2 | 3 | import io.vproxy.pni.Allocator; 4 | 5 | import java.lang.foreign.Arena; 6 | import java.lang.foreign.MemorySegment; 7 | 8 | public class NoCloseArenaAllocator extends AbstractAllocator implements Allocator { 9 | private final Arena arena; 10 | 11 | public NoCloseArenaAllocator(Arena arena) { 12 | this.arena = arena; 13 | } 14 | 15 | @Override 16 | public MemorySegment allocate(long size) { 17 | return arena.allocate(size); 18 | } 19 | 20 | @Override 21 | public MemorySegment allocate(long size, int alignment) { 22 | return arena.allocate(size, alignment); 23 | } 24 | 25 | public static final NoCloseArenaAllocator GLOBAL = new NoCloseArenaAllocator(Arena.global()); 26 | } 27 | -------------------------------------------------------------------------------- /api/src/main/java/io/vproxy/pni/impl/SegmentAllocatorAllocator.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.impl; 2 | 3 | import io.vproxy.pni.Allocator; 4 | 5 | import java.lang.foreign.MemorySegment; 6 | import java.lang.foreign.SegmentAllocator; 7 | 8 | public class SegmentAllocatorAllocator extends AbstractAllocator implements Allocator { 9 | private final SegmentAllocator allocator; 10 | 11 | public SegmentAllocatorAllocator(SegmentAllocator allocator) { 12 | this.allocator = allocator; 13 | } 14 | 15 | @Override 16 | public MemorySegment allocate(long size) { 17 | return allocator.allocate(size); 18 | } 19 | 20 | @Override 21 | public MemorySegment allocate(long size, int alignment) { 22 | return allocator.allocate(size, alignment); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /api/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module io.vproxy.pni { 2 | requires jdk.unsupported; 3 | 4 | exports io.vproxy.pni; 5 | exports io.vproxy.pni.annotation; 6 | exports io.vproxy.pni.exception; 7 | exports io.vproxy.pni.array; 8 | exports io.vproxy.pni.hack; 9 | } 10 | -------------------------------------------------------------------------------- /api/src/main/jdk21/io/vproxy/pni/hack/GetSetUtf8String.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.hack; 2 | 3 | import java.lang.foreign.MemorySegment; 4 | 5 | public class GetSetUtf8String { 6 | public static GetSetUtf8String of() { 7 | return new GetSetUtf8String(); 8 | } 9 | 10 | private GetSetUtf8String() { 11 | } 12 | 13 | public String getUtf8String(MemorySegment seg, long index) { 14 | return seg.getUtf8String(index); 15 | } 16 | 17 | public void setUtf8String(MemorySegment seg, long index, String value) { 18 | seg.setUtf8String(index, value); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /api/src/main/jdk21/io/vproxy/pni/hack/PanamaHackStorage.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.hack; 2 | 3 | import java.lang.foreign.Linker; 4 | 5 | public class PanamaHackStorage { 6 | public static final Linker.Option CriticalOption = Linker.Option.isTrivial(); 7 | public static final Linker.Option CriticalOptionAllowHeapAccess = Linker.Option.isTrivial(); 8 | 9 | private PanamaHackStorage() { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /api/src/main/jdk22/io/vproxy/pni/hack/GetSetUtf8String.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.hack; 2 | 3 | import java.lang.foreign.MemorySegment; 4 | 5 | public class GetSetUtf8String { 6 | public static GetSetUtf8String of() { 7 | return new GetSetUtf8String(); 8 | } 9 | 10 | private GetSetUtf8String() { 11 | } 12 | 13 | public String getUtf8String(MemorySegment seg, long index) { 14 | return seg.getString(index); 15 | } 16 | 17 | public void setUtf8String(MemorySegment seg, long index, String value) { 18 | seg.setString(index, value); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /api/src/main/jdk22/io/vproxy/pni/hack/PanamaHackStorage.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.hack; 2 | 3 | import java.lang.foreign.Linker; 4 | 5 | public class PanamaHackStorage { 6 | public static final Linker.Option CriticalOption = Linker.Option.critical(false); 7 | public static final Linker.Option CriticalOptionAllowHeapAccess = Linker.Option.critical(true); 8 | 9 | private PanamaHackStorage() { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /doc/toc-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vproxy-tools/panama-native-interface/a1d044fd82c397b523c97c887632ff1092bbfb72/doc/toc-icon.png -------------------------------------------------------------------------------- /graal-test-template/build.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | } 3 | -------------------------------------------------------------------------------- /graal-test-template/src/main/java/io/vproxy/pni/graal/test/PNIUpcall.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.graal.test; 2 | 3 | import io.vproxy.pni.PNIFunc; 4 | import io.vproxy.pni.PNIRef; 5 | import io.vproxy.pni.annotation.Upcall; 6 | 7 | import java.lang.foreign.MemorySegment; 8 | 9 | @Upcall 10 | public interface PNIUpcall { 11 | void doNothingUpcall(); 12 | 13 | int intUpcall(int a); 14 | 15 | int refUpcall(PNIRef ref); 16 | 17 | int funcUpcall(PNIFunc func); 18 | 19 | MemorySegment returnSegUpcall(); 20 | } 21 | -------------------------------------------------------------------------------- /graal-test/build.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | } 3 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AlignBaseClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignBaseClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int16_t JNICALL JavaCritical_io_vproxy_pni_test_AlignBaseClass_aaaa(AlignBaseClass * self) { 8 | return self->a; 9 | } 10 | 11 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignBaseClass_size0(AlignBaseClass * self) { 12 | return sizeof(*self); 13 | } 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | // metadata.generator-version: pni test 19 | // sha256:60e943c5ad359a1b6e6cc0f89e44adc7ff5aba05b1ee2912bfc9a1865812fbdb 20 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AlignChildClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignChildClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AlignChildClass_bbbb(AlignChildClass * self) { 8 | return self->b; 9 | } 10 | 11 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AlignChildClass_cccc(AlignChildClass * self) { 12 | return self->c; 13 | } 14 | 15 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignChildClass_size(AlignChildClass * self) { 16 | return sizeof(*self); 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:e54f216104ccdbada6d699cd3ba399c5dbea709a249fb8ed6bc57d62f151fe4b 24 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AlignClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int8_t JNICALL JavaCritical_io_vproxy_pni_test_AlignClass_aaaa(AlignClass * self) { 8 | return self->a; 9 | } 10 | 11 | JNIEXPORT int16_t JNICALL JavaCritical_io_vproxy_pni_test_AlignClass_bbbb(AlignClass * self) { 12 | return self->b; 13 | } 14 | 15 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignClass_cccc(AlignClass * self) { 16 | return self->c; 17 | } 18 | 19 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignClass_size(AlignClass * self) { 20 | return sizeof(*self); 21 | } 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | // metadata.generator-version: pni test 27 | // sha256:66048a0bd3b18c410a54650af3a60f1e3ed5eb245b35dd5e0107778917dc275e 28 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AlignField.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignField.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int8_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField_aaaa(AlignField * self) { 8 | return self->a; 9 | } 10 | 11 | JNIEXPORT int8_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField_bbbb(AlignField * self) { 12 | return self->b; 13 | } 14 | 15 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField_cccc(AlignField * self) { 16 | return self->c; 17 | } 18 | 19 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField_size(AlignField * self) { 20 | return sizeof(*self); 21 | } 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | // metadata.generator-version: pni test 27 | // sha256:ce2fc9d436357bdf186cdeabe1a2f22987dea7ac3b82c91c463aec7a9d633f77 28 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AlignField2.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignField2.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int8_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField2_aaaa(AlignField2 * self) { 8 | return self->a; 9 | } 10 | 11 | JNIEXPORT int8_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField2_bbbb(AlignField2 * self) { 12 | return self->b; 13 | } 14 | 15 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField2_cccc(AlignField2 * self) { 16 | return self->c; 17 | } 18 | 19 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField2_size(AlignField2 * self) { 20 | return sizeof(*self); 21 | } 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | // metadata.generator-version: pni test 27 | // sha256:b25fc88f23064d619678172de512586ce62d140d0913d99aa39d5fc5de5bd8b2 28 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AlignField3.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlignField3.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int16_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField3_aaaa(AlignField3 * self) { 8 | return self->a; 9 | } 10 | 11 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField3_bbbb(AlignField3 * self) { 12 | return self->b; 13 | } 14 | 15 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField3_cccc(AlignField3 * self) { 16 | return self->c; 17 | } 18 | 19 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_AlignField3_size(AlignField3 * self) { 20 | return sizeof(*self); 21 | } 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | // metadata.generator-version: pni test 27 | // sha256:48619d785cb654e8182cf009bd697463c5deb881848cdf9bafcffb8d4c359587 28 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AllowHeapAccess.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_AllowHeapAccess */ 3 | #ifndef _Included_io_vproxy_pni_test_AllowHeapAccess 4 | #define _Included_io_vproxy_pni_test_AllowHeapAccess 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_AllowHeapAccess_intValue(PNIEnv_int * env, void * mem); 21 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AllowHeapAccess_intValueCritical(void * mem); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif // _Included_io_vproxy_pni_test_AllowHeapAccess 27 | // metadata.generator-version: pni test 28 | // sha256:567c0475ebad9f14ba92304509e344b6c891a2484f050dd8eeddf17f1f2b197e 29 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AllowHeapAccess.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AllowHeapAccess.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_AllowHeapAccess_intValue(PNIEnv_int * env, void * mem) { 8 | env->return_ = *((int*)mem); 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int32_t JNICALL JavaCritical_io_vproxy_pni_test_AllowHeapAccess_intValueCritical(void * mem) { 13 | return *((int*)mem); 14 | } 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | // metadata.generator-version: pni test 20 | // sha256:c2ba96d72d485ed83022cbdc17caa2285804286cee447fa20ce3e9a0d4a63801 21 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AlwaysAlignedBase.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_AlwaysAlignedBase */ 3 | #ifndef _Included_io_vproxy_pni_test_AlwaysAlignedBase 4 | #define _Included_io_vproxy_pni_test_AlwaysAlignedBase 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct AlwaysAlignedBase; 10 | typedef struct AlwaysAlignedBase AlwaysAlignedBase; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(AlwaysAlignedBase, AlwaysAlignedBase *) 24 | PNIBufExpand(AlwaysAlignedBase, AlwaysAlignedBase, 1) 25 | 26 | struct AlwaysAlignedBase { 27 | int8_t a; 28 | }; 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif // _Included_io_vproxy_pni_test_AlwaysAlignedBase 34 | // metadata.generator-version: pni test 35 | // sha256:b7f7dce8ce4c52d9b718a5d9b69aa7dc0e46daf34ed053585bc785110ec56bdc 36 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AlwaysAlignedClass.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_AlwaysAlignedClass */ 3 | #ifndef _Included_io_vproxy_pni_test_AlwaysAlignedClass 4 | #define _Included_io_vproxy_pni_test_AlwaysAlignedClass 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct AlwaysAlignedClass; 10 | typedef struct AlwaysAlignedClass AlwaysAlignedClass; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(AlwaysAlignedClass, AlwaysAlignedClass *) 24 | PNIBufExpand(AlwaysAlignedClass, AlwaysAlignedClass, 16) 25 | 26 | struct AlwaysAlignedClass { 27 | int8_t a; 28 | int16_t b; 29 | int64_t c; 30 | }; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_AlwaysAlignedClass 36 | // metadata.generator-version: pni test 37 | // sha256:368b8e4afa3468df3a3513c79046ff765f4c3a64af028c0f95e000ab5b733b9f 38 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AlwaysAlignedSizeof.extra.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_AlwaysAlignedSizeof.h" 2 | 3 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_AlwaysAlignedSizeof___getLayoutByteSize() { 4 | return sizeof(SizeofStructExpr); 5 | } 6 | // metadata.generator-version: pni test 7 | // sha256:8599f5af0f6e04b3d4ed88075ad0ae89cad110514593c0198cd60751c5a50498 8 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AlwaysAlignedSizeof.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_AlwaysAlignedSizeof */ 3 | #ifndef _Included_io_vproxy_pni_test_AlwaysAlignedSizeof 4 | #define _Included_io_vproxy_pni_test_AlwaysAlignedSizeof 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "sizeof.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_AlwaysAlignedSizeof___getLayoutByteSize(); 22 | 23 | PNIEnvExpand(SizeofStructExpr, SizeofStructExpr *) 24 | PNIBufExpand(SizeofStructExpr, SizeofStructExpr, JavaCritical_io_vproxy_pni_test_AlwaysAlignedSizeof___getLayoutByteSize()) 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | #endif // _Included_io_vproxy_pni_test_AlwaysAlignedSizeof 30 | // metadata.generator-version: pni test 31 | // sha256:fdbb45df7d233df9f0d5bf4cbc281b68a4e1614ac12467b29c06cc2a070c4e0f 32 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_AlwaysAlignedUnion.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_AlwaysAlignedUnion */ 3 | #ifndef _Included_io_vproxy_pni_test_AlwaysAlignedUnion 4 | #define _Included_io_vproxy_pni_test_AlwaysAlignedUnion 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | union AlwaysAlignedUnion; 10 | typedef union AlwaysAlignedUnion AlwaysAlignedUnion; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(AlwaysAlignedUnion, AlwaysAlignedUnion *) 24 | PNIBufExpand(AlwaysAlignedUnion, AlwaysAlignedUnion, 8) 25 | 26 | union AlwaysAlignedUnion { 27 | int16_t a; 28 | int32_t b; 29 | int64_t c; 30 | }; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_AlwaysAlignedUnion 36 | // metadata.generator-version: pni test 37 | // sha256:fff030a231ff9089167f2af94a29aafe2ca48c457d2c2a7b1fdcf523c825244c 38 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_BaseClass.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_BaseClass */ 3 | #ifndef _Included_io_vproxy_pni_test_BaseClass 4 | #define _Included_io_vproxy_pni_test_BaseClass 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct BaseClass; 10 | typedef struct BaseClass BaseClass; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(BaseClass, BaseClass *) 24 | PNIBufExpand(BaseClass, BaseClass, 1) 25 | 26 | struct BaseClass { 27 | int8_t a; 28 | }; 29 | 30 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_BaseClass_aaa(PNIEnv_void * env, BaseClass * self, int8_t a); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_BaseClass 36 | // metadata.generator-version: pni test 37 | // sha256:ac414a6598b1ffa1ccba07d8e5e7d126d1cc7c7cc08be704926882e6c999664c 38 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_BaseClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_BaseClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_BaseClass_aaa(PNIEnv_void * env, BaseClass * self, int8_t a) { 8 | self->a = a; 9 | return 0; 10 | } 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | // metadata.generator-version: pni test 16 | // sha256:5687d2461f27bb845a808030e9471567b31950e3da86a18335c413c373e03884 17 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_ChildClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_ChildClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_ChildClass_xxx(PNIEnv_void * env, ChildClass * self, int16_t x) { 8 | self->x = x; 9 | return 0; 10 | } 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | // metadata.generator-version: pni test 16 | // sha256:e40a99b37929525284ce4de320ace215f01100c848a94b59ba417355c12d2606 17 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_ChildOfPacked.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_ChildOfPacked.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_ChildOfPacked_xxx(PNIEnv_void * env, ChildOfPacked * self, int32_t x) { 8 | self->x = x; 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_ChildOfPacked_ooo(PNIEnv_void * env, ChildOfPacked * self, ObjectStruct * o) { 13 | self->o = *o; 14 | return 0; 15 | } 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | // metadata.generator-version: pni test 21 | // sha256:1f5a7a0e7ff466023073bfe9d095f1e036bf6e216a6caef40bb1c3233bfa3836 22 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_CustomNativeTypeFunc.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_CustomNativeTypeFunc.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int64_t* JNICALL JavaCritical_io_vproxy_pni_test_CustomNativeTypeFunc_exec(SizeofStructExpr* o) { 8 | return &(o->p1); 9 | } 10 | 11 | JNIEXPORT int64_t* JNICALL JavaCritical_io_vproxy_pni_test_CustomNativeTypeFunc_invoke(SizeofStructExpr * s) { 12 | return JavaCritical_io_vproxy_pni_test_CustomNativeTypeUpcall_exec(s); 13 | } 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | // metadata.generator-version: pni test 19 | // sha256:560491e980f7e29055f911f8176743c5426f8d6541133894a8373431af88ac69 20 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_CustomNativeTypeStruct.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_CustomNativeTypeStruct.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_CustomNativeTypeStruct_getP1(PNIEnv_long * env, CustomNativeTypeStruct * self) { 8 | env->return_ = self->field->p1; 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_CustomNativeTypeStruct_getArr(PNIEnv_buf_ptr * env, CustomNativeTypeStruct * self) { 13 | env->return_.bufLen = ptrPNIBufLen(3); 14 | env->return_.buf = &self->array; 15 | return 0; 16 | } 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | // metadata.generator-version: pni test 22 | // sha256:7958fa6bb6109a91c404703fce933e13cde931e60a3e8bb0a0385d78958b8005 23 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_CustomNativeTypeUpcall.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_CustomNativeTypeUpcall.h" 2 | #include 3 | #include 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | static int64_t* (*_exec)(void *,SizeofStructExpr*); 10 | 11 | JNIEXPORT void JNICALL JavaCritical_io_vproxy_pni_test_CustomNativeTypeUpcall_INIT( 12 | int64_t* (*exec)(void *,SizeofStructExpr*) 13 | ) { 14 | _exec = exec; 15 | } 16 | 17 | JNIEXPORT int64_t* JNICALL JavaCritical_io_vproxy_pni_test_CustomNativeTypeUpcall_exec(SizeofStructExpr* o) { 18 | if (_exec == NULL) { 19 | printf("JavaCritical_io_vproxy_pni_test_CustomNativeTypeUpcall_exec function pointer is null"); 20 | fflush(stdout); 21 | exit(1); 22 | } 23 | return _exec(GetPNIGraalThread(), o); 24 | } 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | // metadata.generator-version: pni test 30 | // sha256:ecc0c6a01b5255fa98d6dca66d2912d4bcb17a65b00a704aeb0bc65f74f420d7 31 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_CustomNativeTypeUpcall.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_CustomNativeTypeUpcall */ 3 | #ifndef _Included_io_vproxy_pni_test_CustomNativeTypeUpcall 4 | #define _Included_io_vproxy_pni_test_CustomNativeTypeUpcall 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "sizeof.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT int64_t* JNICALL JavaCritical_io_vproxy_pni_test_CustomNativeTypeUpcall_exec(SizeofStructExpr* o); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif // _Included_io_vproxy_pni_test_CustomNativeTypeUpcall 27 | // metadata.generator-version: pni test 28 | // sha256:7d124f76a574ad5ba3d54b0ce0874e3eb7b5be69e3aeb18943ef27898d0b17dd 29 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_Empty.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_Empty */ 3 | #ifndef _Included_io_vproxy_pni_test_Empty 4 | #define _Included_io_vproxy_pni_test_Empty 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct Empty; 10 | typedef struct Empty Empty; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(Empty, Empty *) 24 | PNIBufExpand(Empty, Empty, (0 /* !!invalid!! */)) 25 | 26 | struct Empty { 27 | }; 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | #endif // _Included_io_vproxy_pni_test_Empty 33 | // metadata.generator-version: pni test 34 | // sha256:06c1e7dc355b3f3d0310d1dde826f6691de5dcd88a995a77cf075edde176b9ca 35 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_EmptyChild.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_EmptyChild */ 3 | #ifndef _Included_io_vproxy_pni_test_EmptyChild 4 | #define _Included_io_vproxy_pni_test_EmptyChild 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct EmptyChild; 10 | typedef struct EmptyChild EmptyChild; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | #include "io_vproxy_pni_test_LargeAlignBase.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | PNIEnvExpand(EmptyChild, EmptyChild *) 25 | PNIBufExpand(EmptyChild, EmptyChild, 8) 26 | 27 | struct EmptyChild { 28 | LargeAlignBase SUPER; 29 | }; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif // _Included_io_vproxy_pni_test_EmptyChild 35 | // metadata.generator-version: pni test 36 | // sha256:f091e8889ea77137a08bc2c3cee020d7266ca0ab9442c63f233cfb7c21508d8d 37 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityAlignField.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityAlignField.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityAlignField_init(PNIEnv_void * env, GCCCompatibilityAlignField * self) { 8 | self->b1 = 1; 9 | self->s = 2; 10 | self->n2 = 3; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityAlignField_size(PNIEnv_long * env, GCCCompatibilityAlignField * self) { 15 | env->return_ = sizeof(GCCCompatibilityAlignField); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:877c576b31c7da67d854d4fe233a893fbd1e9aa52ccf95435ab8fc2f0734516a 24 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityAlignFieldPacked.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityAlignFieldPacked.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityAlignFieldPacked_init(PNIEnv_void * env, GCCCompatibilityAlignFieldPacked * self) { 8 | self->b1 = 96; 9 | init_GCCCompatibilityStruct(self->packed); 10 | self->n2 = 97; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityAlignFieldPacked_size(PNIEnv_long * env, GCCCompatibilityAlignFieldPacked * self) { 15 | env->return_ = sizeof(GCCCompatibilityAlignFieldPacked); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:b81b1cb768814a034fffbad0b7ad9290db1df44a151652c6288e28e5e1369e6c 24 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityArrayZero.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityArrayZero.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityArrayZero_init(PNIEnv_void * env, GCCCompatibilityArrayZero * self) { 8 | self->b1 = 102; 9 | self->n2 = 103; 10 | return 0; 11 | } 12 | 13 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityArrayZero_size(PNIEnv_long * env, GCCCompatibilityArrayZero * self) { 14 | env->return_ = sizeof(GCCCompatibilityArrayZero); 15 | return 0; 16 | } 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | // metadata.generator-version: pni test 22 | // sha256:5bee2e4ea14d1216ff19f95a5ddbe0cc7fd2ca25366ca2cf816e56b05189948c 23 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityNonPackedArray.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityNonPackedArray.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNonPackedArray_init(PNIEnv_void * env, GCCCompatibilityNonPackedArray * self) { 8 | self->b1 = 100; 9 | init_GCCCompatibilityStruct(self->array[0]); 10 | init_GCCCompatibilityStruct(self->array[1]); 11 | self->n2 = 101; 12 | return 0; 13 | } 14 | 15 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNonPackedArray_size(PNIEnv_long * env, GCCCompatibilityNonPackedArray * self) { 16 | env->return_ = sizeof(GCCCompatibilityNonPackedArray); 17 | return 0; 18 | } 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | // metadata.generator-version: pni test 24 | // sha256:6dc3f75dccb0a1880a044bb0846c06c5a2523233c39cc22f28f4984b18ffda79 25 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityNonPackedContainNonPacked.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityNonPackedContainNonPacked.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNonPackedContainNonPacked_init(PNIEnv_void * env, GCCCompatibilityNonPackedContainNonPacked * self) { 8 | self->b1 = 92; 9 | init_GCCCompatibilityStruct(self->normal); 10 | self->n2 = 93; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNonPackedContainNonPacked_size(PNIEnv_long * env, GCCCompatibilityNonPackedContainNonPacked * self) { 15 | env->return_ = sizeof(GCCCompatibilityNonPackedContainNonPacked); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:122936ffd6b6e16faa5118ae21e60e47c7386f53d037d97c020ffecbe3dd4070 24 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityNonPackedContainPacked.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityNonPackedContainPacked.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNonPackedContainPacked_init(PNIEnv_void * env, GCCCompatibilityNonPackedContainPacked * self) { 8 | self->b1 = 90; 9 | init_GCCCompatibilityStruct(self->packed); 10 | self->n2 = 91; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNonPackedContainPacked_size(PNIEnv_long * env, GCCCompatibilityNonPackedContainPacked * self) { 15 | env->return_ = sizeof(GCCCompatibilityNonPackedContainPacked); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:ad40befb7efd9f4ada850f9754c599d382067e32cf47d0de902b01ebe15ed4df 24 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityNormal.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityNormal.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNormal_init(PNIEnv_void * env, GCCCompatibilityNormal * self) { 8 | init_GCCCompatibilityNormal(self); 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityNormal_size(PNIEnv_long * env, GCCCompatibilityNormal * self) { 13 | env->return_ = sizeof(GCCCompatibilityNormal); 14 | return 0; 15 | } 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | // metadata.generator-version: pni test 21 | // sha256:4cde761d103921534abd91f8a590686c7d59c0c28bdda72ecb77255a02450c25 22 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityPacked.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityPacked.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPacked_init(PNIEnv_void * env, GCCCompatibilityPacked * self) { 8 | init_GCCCompatibilityPacked(self); 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPacked_size(PNIEnv_long * env, GCCCompatibilityPacked * self) { 13 | env->return_ = sizeof(GCCCompatibilityPacked); 14 | return 0; 15 | } 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | // metadata.generator-version: pni test 21 | // sha256:98076d0530de448618c9df89f26e668c62c13cc8675de0d9048d949490c272b1 22 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityPackedAlignField.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityPackedAlignField.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedAlignField_init(PNIEnv_void * env, GCCCompatibilityPackedAlignField * self) { 8 | self->b1 = 4; 9 | self->s = 5; 10 | self->n2 = 6; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedAlignField_size(PNIEnv_long * env, GCCCompatibilityPackedAlignField * self) { 15 | env->return_ = sizeof(GCCCompatibilityPackedAlignField); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:83000221c37c5d927775585d229a0d1e6de49ac5072db2797078ac025b136625 24 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityPackedAlignFieldSmallerAlign.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityPackedAlignFieldSmallerAlign.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedAlignFieldSmallerAlign_init(PNIEnv_void * env, GCCCompatibilityPackedAlignFieldSmallerAlign * self) { 8 | self->b1 = 7; 9 | self->l = 8; 10 | self->n2 = 9; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedAlignFieldSmallerAlign_size(PNIEnv_long * env, GCCCompatibilityPackedAlignFieldSmallerAlign * self) { 15 | env->return_ = sizeof(GCCCompatibilityPackedAlignFieldSmallerAlign); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:ef9fbc8918f3cd3a1487687beb13702f89ca121e29360dc334679cd7798f5133 24 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityPackedArray.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityPackedArray.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedArray_init(PNIEnv_void * env, GCCCompatibilityPackedArray * self) { 8 | self->b1 = 98; 9 | init_GCCCompatibilityStruct(self->array[0]); 10 | init_GCCCompatibilityStruct(self->array[1]); 11 | self->n2 = 99; 12 | return 0; 13 | } 14 | 15 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedArray_size(PNIEnv_long * env, GCCCompatibilityPackedArray * self) { 16 | env->return_ = sizeof(GCCCompatibilityPackedArray); 17 | return 0; 18 | } 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | // metadata.generator-version: pni test 24 | // sha256:06a00b92276acdac1abcba5ae438d496e0cba8fc9eaf8bb978961e9846c65ca6 25 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityPackedContainNonPacked.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCCompatibilityPackedContainNonPacked.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedContainNonPacked_init(PNIEnv_void * env, GCCCompatibilityPackedContainNonPacked * self) { 8 | self->b1 = 94; 9 | init_GCCCompatibilityStruct(self->normal); 10 | self->n2 = 95; 11 | return 0; 12 | } 13 | 14 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCCompatibilityPackedContainNonPacked_size(PNIEnv_long * env, GCCCompatibilityPackedContainNonPacked * self) { 15 | env->return_ = sizeof(GCCCompatibilityPackedContainNonPacked); 16 | return 0; 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | // metadata.generator-version: pni test 23 | // sha256:94a957ab38fad65b7e815001eb52d45514eb710a68c82ab0f913442a90a2393d 24 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCCompatibilityUnion.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_GCCCompatibilityUnion */ 3 | #ifndef _Included_io_vproxy_pni_test_GCCCompatibilityUnion 4 | #define _Included_io_vproxy_pni_test_GCCCompatibilityUnion 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | PNIEnvExpand(GCCCompatibilityUnion, GCCCompatibilityUnion *) 21 | PNIBufExpand(GCCCompatibilityUnion, GCCCompatibilityUnion, 8) 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif // _Included_io_vproxy_pni_test_GCCCompatibilityUnion 27 | // metadata.generator-version: pni test 28 | // sha256:c6b63a10c2e7b205f33569fa36e5445bc0b8583ca4fe9386c027e80de46cf5cb 29 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GCCompatibilityStructAlign.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GCCompatibilityStructAlign.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCompatibilityStructAlign_init(PNIEnv_void * env, GCCompatibilityStructAlign * self) { 8 | self->n = 1; 9 | self->l = 2; 10 | return 0; 11 | } 12 | 13 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GCCompatibilityStructAlign_size(PNIEnv_long * env, GCCompatibilityStructAlign * self) { 14 | env->return_ = sizeof(GCCompatibilityStructAlign); 15 | return 0; 16 | } 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | // metadata.generator-version: pni test 22 | // sha256:ceb48338897495c9a8ddc116353d92aba7703aee2ed8c2e7b018197c9a0ea317 23 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_GrandChildClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_GrandChildClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_GrandChildClass_yyy(PNIEnv_void * env, GrandChildClass * self, int64_t y) { 8 | self->y = y; 9 | return 0; 10 | } 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | // metadata.generator-version: pni test 16 | // sha256:f97130190d242be4abfcbf6265bffff7aa341c3d5d7ff0c42d98bf15e35d6b7d 17 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_KtDowncall.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_KtDowncall */ 3 | #ifndef _Included_io_vproxy_pni_test_KtDowncall 4 | #define _Included_io_vproxy_pni_test_KtDowncall 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_KtStruct.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_KtDowncall_retrieveLong(KtStruct * o); 22 | JNIEXPORT KtStruct * JNICALL JavaCritical_io_vproxy_pni_test_KtDowncall_invokeHelloWorld(int32_t i, int64_t l, KtStruct * return_); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif // _Included_io_vproxy_pni_test_KtDowncall 28 | // metadata.generator-version: pni test 29 | // sha256:d77fdf36a6537a49873b08c306383f6102e2b3d1e77eccb9daf629461ae7f494 30 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_KtDowncall.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_KtDowncall.h" 2 | #include "io_vproxy_pni_test_KtStruct.h" 3 | #include "io_vproxy_pni_test_KtUpcall.h" 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_KtDowncall_retrieveLong(KtStruct * o) { 10 | return o->aLong; 11 | } 12 | 13 | JNIEXPORT KtStruct * JNICALL JavaCritical_io_vproxy_pni_test_KtDowncall_invokeHelloWorld(int32_t i, int64_t l, KtStruct * return_) { 14 | return JavaCritical_io_vproxy_pni_test_KtUpcall_helloworld(i, l, return_); 15 | } 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | // metadata.generator-version: pni test 21 | // sha256:11c036cf1accefdcd9e00477011c07d0fed9106912bd8ce55b6d3aa30e18afd1 22 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_KtStruct.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_KtStruct.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_KtStruct_retrieveInt(PNIEnv_int * env, KtStruct * self) { 8 | env->return_ = self->aInt; 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_KtStruct_retrieveLong(PNIEnv_long * env, KtStruct * self) { 13 | env->return_ = self->aLong; 14 | return 0; 15 | } 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | // metadata.generator-version: pni test 21 | // sha256:aaa1d2f8b008e749b634c04eb0b0c450d8c1f45f2d186bfe57e25e6d1367ee38 22 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_KtStructInherit.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_KtStructInherit.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_KtStructInherit_retrieveObj(PNIEnv_PrimitiveStruct * env, KtStructInherit * self) { 8 | env->return_ = &self->obj; 9 | return 0; 10 | } 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | // metadata.generator-version: pni test 16 | // sha256:6ca020ce3a2525f675dbf6e29ff6a178f81c0789d9c1cec5d0d5126965dc0c10 17 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_KtUpcall.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_KtUpcall.h" 2 | #include 3 | #include 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | static KtStruct * (*_helloworld)(void *,int32_t,int64_t,KtStruct *); 10 | 11 | JNIEXPORT void JNICALL JavaCritical_io_vproxy_pni_test_KtUpcall_INIT( 12 | KtStruct * (*helloworld)(void *,int32_t,int64_t,KtStruct *) 13 | ) { 14 | _helloworld = helloworld; 15 | } 16 | 17 | JNIEXPORT KtStruct * JNICALL JavaCritical_io_vproxy_pni_test_KtUpcall_helloworld(int32_t i, int64_t l, KtStruct * return_) { 18 | if (_helloworld == NULL) { 19 | printf("JavaCritical_io_vproxy_pni_test_KtUpcall_helloworld function pointer is null"); 20 | fflush(stdout); 21 | exit(1); 22 | } 23 | return _helloworld(GetPNIGraalThread(), i, l, return_); 24 | } 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | // metadata.generator-version: pni test 30 | // sha256:c66ada5779e64603c629b950ccb9fbf843f82eb8dc844db26d60f5b9fce35d1c 31 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_KtUpcall.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_KtUpcall */ 3 | #ifndef _Included_io_vproxy_pni_test_KtUpcall 4 | #define _Included_io_vproxy_pni_test_KtUpcall 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_KtStruct.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT KtStruct * JNICALL JavaCritical_io_vproxy_pni_test_KtUpcall_helloworld(int32_t i, int64_t l, KtStruct * return_); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif // _Included_io_vproxy_pni_test_KtUpcall 27 | // metadata.generator-version: pni test 28 | // sha256:f4d5fc02c0eb8e3a7c72d2fe53b2e5dd25897011efc3103ed97c854e40b4c818 29 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_LargeAlignBase.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_LargeAlignBase */ 3 | #ifndef _Included_io_vproxy_pni_test_LargeAlignBase 4 | #define _Included_io_vproxy_pni_test_LargeAlignBase 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct LargeAlignBase; 10 | typedef struct LargeAlignBase LargeAlignBase; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(LargeAlignBase, LargeAlignBase *) 24 | PNIBufExpand(LargeAlignBase, LargeAlignBase, 8) 25 | 26 | struct LargeAlignBase { 27 | int64_t x; 28 | }; 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif // _Included_io_vproxy_pni_test_LargeAlignBase 34 | // metadata.generator-version: pni test 35 | // sha256:34d8a9813c4e536badc8f428939c0ea59147fa389aa92613c96f43af8520dc89 36 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_NativeCheck.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_NativeCheck */ 3 | #ifndef _Included_io_vproxy_pni_test_NativeCheck 4 | #define _Included_io_vproxy_pni_test_NativeCheck 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_Userdata.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NativeCheck_checkUserdataForRef(PNIEnv_void * env, PNIRef * ref, int32_t * x, int64_t * y, int16_t * z); 22 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NativeCheck_checkUserdataForFunc(PNIEnv_void * env, PNIFunc * func, int32_t * x, int64_t * y, int16_t * z); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif // _Included_io_vproxy_pni_test_NativeCheck 28 | // metadata.generator-version: pni test 29 | // sha256:3c5b86a91c0eb5288c1964ad484aab0cffd8b79dc74a6974fded3d9420e70722 30 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_NativeCheck.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_NativeCheck.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NativeCheck_checkUserdataForRef(PNIEnv_void * env, PNIRef * ref, int32_t * x, int64_t * y, int16_t * z) { 8 | Userdata* ud = ref->userdata; 9 | *x = ud->x; 10 | *y = ud->y; 11 | *z = ud->z; 12 | return 0; 13 | } 14 | 15 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NativeCheck_checkUserdataForFunc(PNIEnv_void * env, PNIFunc * func, int32_t * x, int64_t * y, int16_t * z) { 16 | Userdata* ud = func->userdata; 17 | *x = ud->x; 18 | *y = ud->y; 19 | *z = ud->z; 20 | return 0; 21 | } 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | // metadata.generator-version: pni test 27 | // sha256:0b946d5a4f8528ed74a6656e61e6a6751bf7da31b39a2e691bfb89495c00d14b 28 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_NoAlloc.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_NoAlloc */ 3 | #ifndef _Included_io_vproxy_pni_test_NoAlloc 4 | #define _Included_io_vproxy_pni_test_NoAlloc 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_ObjectStruct.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NoAlloc_execNoAlloc(PNIEnv_ObjectStruct * env); 22 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NoAlloc_invokeUpcall(PNIEnv_ObjectStruct * env); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif // _Included_io_vproxy_pni_test_NoAlloc 28 | // metadata.generator-version: pni test 29 | // sha256:575fd5c31777eadf05cf878b6d96b202eca50c46f7e5d682e907841833abf4e2 30 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_NoAlloc.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_NoAlloc.h" 2 | #include "io_vproxy_pni_test_NoAllocUpcall.h" 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_NoAlloc_invokeUpcall(PNIEnv_ObjectStruct * env) { 9 | env->return_ = JavaCritical_io_vproxy_pni_test_NoAllocUpcall_execNoAlloc(); 10 | return 0; 11 | } 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | // metadata.generator-version: pni test 17 | // sha256:a969834968f885e20e23af68d742fbd62339c150a63ff01216feb57aa6a6e63d 18 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_NoAllocUpcall.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_NoAllocUpcall.h" 2 | #include 3 | #include 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | static ObjectStruct * (*_execNoAlloc)(void *); 10 | 11 | JNIEXPORT void JNICALL JavaCritical_io_vproxy_pni_test_NoAllocUpcall_INIT( 12 | ObjectStruct * (*execNoAlloc)(void *) 13 | ) { 14 | _execNoAlloc = execNoAlloc; 15 | } 16 | 17 | JNIEXPORT ObjectStruct * JNICALL JavaCritical_io_vproxy_pni_test_NoAllocUpcall_execNoAlloc(void) { 18 | if (_execNoAlloc == NULL) { 19 | printf("JavaCritical_io_vproxy_pni_test_NoAllocUpcall_execNoAlloc function pointer is null"); 20 | fflush(stdout); 21 | exit(1); 22 | } 23 | return _execNoAlloc(GetPNIGraalThread()); 24 | } 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | // metadata.generator-version: pni test 30 | // sha256:50e462ec3bad926eb961f0d5d6b0ca072cf89fa6310812eb3c1e2ed0eaf9ef20 31 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_NoAllocUpcall.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_NoAllocUpcall */ 3 | #ifndef _Included_io_vproxy_pni_test_NoAllocUpcall 4 | #define _Included_io_vproxy_pni_test_NoAllocUpcall 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_ObjectStruct.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT ObjectStruct * JNICALL JavaCritical_io_vproxy_pni_test_NoAllocUpcall_execNoAlloc(void); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif // _Included_io_vproxy_pni_test_NoAllocUpcall 27 | // metadata.generator-version: pni test 28 | // sha256:49776a126bf2667e99ad34e42dfb3708f2a5f43ce6a95e2156f3e09cd196c2ab 29 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_PackedBaseClass.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_PackedBaseClass.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_PackedBaseClass_aaa(PNIEnv_void * env, PackedBaseClass * self, int8_t a) { 8 | self->a = a; 9 | return 0; 10 | } 11 | 12 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_PackedBaseClass_bbb(PNIEnv_void * env, PackedBaseClass * self, int16_t b) { 13 | self->b = b; 14 | return 0; 15 | } 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | // metadata.generator-version: pni test 21 | // sha256:4498f4525e2809b785a5f75cec89c9290280352f4a3d6882fedc002f20ca850e 22 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_PointerOnlyStruct.impl.h: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_PointerOnlyStruct.h" 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | JNIEXPORT int64_t JNICALL JavaCritical_io_vproxy_pni_test_PointerOnlyStruct_retrieve(PointerOnlyStruct * self) { 8 | return *((long*)self); 9 | } 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | // metadata.generator-version: pni test 15 | // sha256:7adc63ad409317dd1dba66439ba2442bfd4a2e4fb4cb1e5847e65c848af83ee2 16 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_PointerOnlyStructWithLen.extra.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_PointerOnlyStructWithLen.h" 2 | 3 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_PointerOnlyStructWithLen___getLayoutByteSize() { 4 | return 32; 5 | } 6 | // metadata.generator-version: pni test 7 | // sha256:b95e0410f90667e218489fe80486b0f9efa1daf8ae34ad19079bdfd8d24ca956 8 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_SizeofEmbed.extra.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_SizeofEmbed.h" 2 | 3 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_SizeofEmbed___getLayoutByteSize() { 4 | size_t ret = 16; 5 | ret += JavaCritical_io_vproxy_pni_test_SizeofStructExpr___getLayoutByteSize(); 6 | return ret; 7 | } 8 | // metadata.generator-version: pni test 9 | // sha256:eb5c12b41b7f3d3e0f3e73b0c3e4a7cdb2ac35210722e868edef6a5362671019 10 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_SizeofStruct.extra.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_SizeofStruct.h" 2 | 3 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_SizeofStruct___getLayoutByteSize() { 4 | return 16; 5 | } 6 | // metadata.generator-version: pni test 7 | // sha256:0d15a4c6f4f9b33c82f0d14e3b73da7b900646a8cafe7ab47ca8b260a4f4ef30 8 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_SizeofStructExpr.extra.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_SizeofStructExpr.h" 2 | 3 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_SizeofStructExpr___getLayoutByteSize() { 4 | return sizeof(SizeofStructExpr); 5 | } 6 | // metadata.generator-version: pni test 7 | // sha256:bea3677de8eb22f36044cc33447cf8f751d8e84ac8b93aac3db72e908ced74e1 8 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_SizeofStructExpr.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_SizeofStructExpr */ 3 | #ifndef _Included_io_vproxy_pni_test_SizeofStructExpr 4 | #define _Included_io_vproxy_pni_test_SizeofStructExpr 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "sizeof.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_SizeofStructExpr___getLayoutByteSize(); 22 | 23 | PNIEnvExpand(SizeofStructExpr, SizeofStructExpr *) 24 | PNIBufExpand(SizeofStructExpr, SizeofStructExpr, JavaCritical_io_vproxy_pni_test_SizeofStructExpr___getLayoutByteSize()) 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | #endif // _Included_io_vproxy_pni_test_SizeofStructExpr 30 | // metadata.generator-version: pni test 31 | // sha256:6bba9f20403b346456a31ef26d9035117181a4e08b8a6403ec3722dd4cfde78a 32 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_SizeofUnion.extra.c: -------------------------------------------------------------------------------- 1 | #include "io_vproxy_pni_test_SizeofUnion.h" 2 | 3 | JNIEXPORT size_t JNICALL JavaCritical_io_vproxy_pni_test_SizeofUnion___getLayoutByteSize() { 4 | return 24; 5 | } 6 | // metadata.generator-version: pni test 7 | // sha256:01fbe1d0d0ad9b97cdc1c6d54c934d4fdd36aaed272ec7125a3586dc4f8b84df 8 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_StructD.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_StructD */ 3 | #ifndef _Included_io_vproxy_pni_test_StructD 4 | #define _Included_io_vproxy_pni_test_StructD 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct StructD; 10 | typedef struct StructD StructD; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(StructD, StructD *) 24 | PNIBufExpand(StructD, StructD, 16) 25 | 26 | struct StructD { 27 | int32_t n; 28 | double d; 29 | }; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif // _Included_io_vproxy_pni_test_StructD 35 | // metadata.generator-version: pni test 36 | // sha256:4dfdb06fa36b10f2e8ec963cb2172adbb1d1ec1f42334ddc6ae0e94f45d9c5f4 37 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_StructM.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_StructM */ 3 | #ifndef _Included_io_vproxy_pni_test_StructM 4 | #define _Included_io_vproxy_pni_test_StructM 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct StructM; 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #include 16 | #include 17 | #include "io_vproxy_pni_test_StructN.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(StructM, struct StructM *) 24 | PNIBufExpand(StructM, struct StructM, 16) 25 | 26 | struct StructM { 27 | struct N_st n_st; 28 | }; 29 | 30 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_StructM_nnn(PNIEnv_void * env, struct StructM * self, struct N_st * n_st); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_StructM 36 | // metadata.generator-version: pni test 37 | // sha256:6a429fda389afeea660424f1c54b3d74848457dd4b0dca7d85503cd78196149f 38 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_StructN.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_StructN */ 3 | #ifndef _Included_io_vproxy_pni_test_StructN 4 | #define _Included_io_vproxy_pni_test_StructN 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_StructUnionAnnotation.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | PNIEnvExpand(N_st, struct N_st *) 22 | PNIBufExpand(N_st, struct N_st, 16) 23 | 24 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_StructN_retrieveS(PNIEnv_short * env, struct N_st * self); 25 | JNIEXPORT int JNICALL Java_io_vproxy_pni_test_StructN_retrieveL(PNIEnv_long * env, struct N_st * self); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | #endif // _Included_io_vproxy_pni_test_StructN 31 | // metadata.generator-version: pni test 32 | // sha256:9bc612ec2ead2ddc51980351f70cd2426cc7d1cecccbed62d61c753bf68ea46f 33 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_ToStringArray.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_ToStringArray */ 3 | #ifndef _Included_io_vproxy_pni_test_ToStringArray 4 | #define _Included_io_vproxy_pni_test_ToStringArray 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct ToStringArray; 10 | typedef struct ToStringArray ToStringArray; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(ToStringArray, ToStringArray *) 24 | PNIBufExpand(ToStringArray, ToStringArray, 64) 25 | 26 | struct ToStringArray { 27 | ToStringClass arrc[0]; 28 | ToStringClass arrcLen2[2]; 29 | PNIBuf_ToStringClass parrc; 30 | }; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_ToStringArray 36 | // metadata.generator-version: pni test 37 | // sha256:88bb51f496b828dd5015a310cb04de384890fc6b852288fa9cddaed3f5acda82 38 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_ToStringClass.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_ToStringClass */ 3 | #ifndef _Included_io_vproxy_pni_test_ToStringClass 4 | #define _Included_io_vproxy_pni_test_ToStringClass 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct ToStringClass; 10 | typedef struct ToStringClass ToStringClass; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | #include "io_vproxy_pni_test_ToStringClassRecurse.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | PNIEnvExpand(ToStringClass, ToStringClass *) 25 | PNIBufExpand(ToStringClass, ToStringClass, 24) 26 | 27 | struct ToStringClass { 28 | int64_t num; 29 | ToStringClassRecurse cr; 30 | }; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_ToStringClass 36 | // metadata.generator-version: pni test 37 | // sha256:a315f50bd8e766068e182211e338d28dab9d2f63975745e80f3e7bb83e764028 38 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_ToStringClass2.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_ToStringClass2 */ 3 | #ifndef _Included_io_vproxy_pni_test_ToStringClass2 4 | #define _Included_io_vproxy_pni_test_ToStringClass2 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct ToStringClass2; 10 | typedef struct ToStringClass2 ToStringClass2; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(ToStringClass2, ToStringClass2 *) 24 | PNIBufExpand(ToStringClass2, ToStringClass2, 40) 25 | 26 | struct ToStringClass2 { 27 | int64_t num; 28 | PNIRef * ref; 29 | PNIFunc * func; 30 | PNIBuf_ToStringClass arrc; 31 | }; 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | #endif // _Included_io_vproxy_pni_test_ToStringClass2 37 | // metadata.generator-version: pni test 38 | // sha256:96a6e336fa09af3abc9caf28762aacb825ef42dad11d7d5eb6ecc05887d09509 39 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_UnionC.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_UnionC */ 3 | #ifndef _Included_io_vproxy_pni_test_UnionC 4 | #define _Included_io_vproxy_pni_test_UnionC 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | union UnionC; 10 | typedef union UnionC UnionC; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(UnionC, UnionC *) 24 | PNIBufExpand(UnionC, UnionC, 8) 25 | 26 | union UnionC { 27 | int32_t n; 28 | int64_t l; 29 | }; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif // _Included_io_vproxy_pni_test_UnionC 35 | // metadata.generator-version: pni test 36 | // sha256:eda297c5239137523e1577fe3ffe6c9185b81f0f5db08aeaa6f575f0cd6b9f1a 37 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_UnionEmbedded.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_UnionEmbedded */ 3 | #ifndef _Included_io_vproxy_pni_test_UnionEmbedded 4 | #define _Included_io_vproxy_pni_test_UnionEmbedded 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif // _Included_io_vproxy_pni_test_UnionEmbedded 24 | // metadata.generator-version: pni test 25 | // sha256:f775a97a09212a249e2877d2867b916518f1073766f15a7ff9458b3588c1eeaf 26 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_UnionO.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_UnionO */ 3 | #ifndef _Included_io_vproxy_pni_test_UnionO 4 | #define _Included_io_vproxy_pni_test_UnionO 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | union UnionO; 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #include 16 | #include 17 | #include "io_vproxy_pni_test_UnionP.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(UnionO, union UnionO *) 24 | PNIBufExpand(UnionO, union UnionO, 8) 25 | 26 | union UnionO { 27 | int16_t s; 28 | int32_t i; 29 | UnionP p; 30 | }; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_UnionO 36 | // metadata.generator-version: pni test 37 | // sha256:1743a25ed3e78afb9b2e4382a0ccd59dc39462033a6260f112d66279ad72b096 38 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_UnionP.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_UnionP */ 3 | #ifndef _Included_io_vproxy_pni_test_UnionP 4 | #define _Included_io_vproxy_pni_test_UnionP 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_test_StructUnionAnnotation.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | PNIEnvExpand(UnionP, UnionP *) 22 | PNIBufExpand(UnionP, UnionP, 8) 23 | 24 | JNIEXPORT int JNICALL UnionP_retrieve_i(PNIEnv_int * env, UnionP * self); 25 | JNIEXPORT int JNICALL UnionP_retrieve_l(PNIEnv_long * env, UnionP * self); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | #endif // _Included_io_vproxy_pni_test_UnionP 31 | // metadata.generator-version: pni test 32 | // sha256:be213ab6409b21777960762d0f954d96ce94541fe877f67bd3f4daa0d8ed5aeb 33 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated-2/io_vproxy_pni_test_Userdata.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_test_Userdata */ 3 | #ifndef _Included_io_vproxy_pni_test_Userdata 4 | #define _Included_io_vproxy_pni_test_Userdata 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct Userdata; 10 | typedef struct Userdata Userdata; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | PNIEnvExpand(Userdata, Userdata *) 24 | PNIBufExpand(Userdata, Userdata, 24) 25 | 26 | struct Userdata { 27 | int32_t x; 28 | int64_t y; 29 | int16_t z; 30 | }; 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif // _Included_io_vproxy_pni_test_Userdata 36 | // metadata.generator-version: pni test 37 | // sha256:bf76395673d4b6b392185070fb0ebfb30316b8b1cdd7f9f554569ae8bb6662c2 38 | -------------------------------------------------------------------------------- /graal-test/src/main/c-generated/jni.h: -------------------------------------------------------------------------------- 1 | #ifndef PNI_JNIMOCK_H 2 | #define PNI_JNIMOCK_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef WIN32 8 | #define JNIEXPORT __declspec(dllexport) 9 | #else 10 | #define JNIEXPORT __attribute__((visibility("default"))) 11 | #endif 12 | 13 | #ifdef WIN32 14 | #define JNICALL __stdcall 15 | #else 16 | #define JNICALL 17 | #endif 18 | 19 | #include 20 | 21 | typedef int8_t jbyte; 22 | typedef uint16_t jchar; 23 | typedef double jdouble; 24 | typedef float jfloat; 25 | typedef int32_t jint; 26 | typedef int64_t jlong; 27 | typedef int16_t jshort; 28 | typedef uint8_t jboolean; 29 | 30 | #define JNI_FALSE (0) 31 | #define JNI_TRUE (1) 32 | 33 | #define JNI_OK (0) 34 | #define JNI_ERR (-1) 35 | 36 | #endif // PNI_JNIMOCK_H 37 | -------------------------------------------------------------------------------- /graal-test/src/main/c/make-graal-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | os=`uname` 4 | 5 | target="graaltest" 6 | include_platform_dir="" 7 | 8 | if [[ "Linux" == "$os" ]] 9 | then 10 | target="lib$target.so" 11 | include_platform_dir="linux" 12 | elif [[ "Darwin" == "$os" ]] 13 | then 14 | target="lib$target.dylib" 15 | include_platform_dir="darwin" 16 | else 17 | target="$target.dll" 18 | include_platform_dir="win32" 19 | fi 20 | 21 | rm -f "$target" 22 | 23 | gcc -std=gnu99 -O2 \ 24 | $GCC_OPTS \ 25 | -I "./" \ 26 | -I "../c-generated" \ 27 | -I "../c-generated-2" \ 28 | -I "../../../../acceptance-testing/src/test/c" \ 29 | -shared -Werror -fPIC \ 30 | -DPNI_GRAAL=1 \ 31 | ../c-generated/pni.c \ 32 | graal-test.c \ 33 | ../c-generated-2/*.c \ 34 | -o "$target" 35 | -------------------------------------------------------------------------------- /graal-test/src/main/java-2/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vproxy-tools/panama-native-interface/a1d044fd82c397b523c97c887632ff1092bbfb72/graal-test/src/main/java-2/.gitkeep -------------------------------------------------------------------------------- /graal-test/src/main/java/io/vproxy/pni/graal/test/Suite.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.graal.test; 2 | 3 | import org.junit.runner.RunWith; 4 | 5 | @RunWith(org.junit.runners.Suite.class) 6 | @org.junit.runners.Suite.SuiteClasses({ 7 | TestFunctionPointer.class, 8 | TestRefAndFunc.class, 9 | TestUpcall.class, 10 | io.vproxy.pni.test.cases.Suite.class, 11 | }) 12 | public class Suite { 13 | } 14 | -------------------------------------------------------------------------------- /graal-test/src/main/java/io/vproxy/pni/graal/test/TestRefAndFunc.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.graal.test; 2 | 3 | import io.vproxy.pni.PNIFunc; 4 | import io.vproxy.pni.PNIRef; 5 | import io.vproxy.pni.graal.GraalUtils; 6 | import org.junit.Before; 7 | import org.junit.Test; 8 | 9 | import static org.junit.Assert.assertEquals; 10 | 11 | public class TestRefAndFunc { 12 | @Before 13 | public void setUp() { 14 | GraalUtils.setThread(); 15 | } 16 | 17 | @Test 18 | public void ref() { 19 | var count = PNIRef.currentRefStorageSize(); 20 | var ref = PNIRef.of(123); 21 | Invoke.get().releaseRef(ref); 22 | assertEquals(count, PNIRef.currentRefStorageSize()); 23 | } 24 | 25 | @Test 26 | public void func() { 27 | var count = PNIFunc.currentFuncStorageSize(); 28 | var res = Invoke.get().callFunc(v -> 123); 29 | assertEquals(123, res); 30 | assertEquals(count, PNIFunc.currentFuncStorageSize()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /graal/build.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | } 3 | -------------------------------------------------------------------------------- /graal/src/main/java/io/vproxy/pni/graal/GraalPNIRef.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.graal; 2 | 3 | import io.vproxy.pni.PNIRef; 4 | import org.graalvm.nativeimage.IsolateThread; 5 | import org.graalvm.nativeimage.c.function.CEntryPoint; 6 | import org.graalvm.nativeimage.c.function.CEntryPointLiteral; 7 | import org.graalvm.nativeimage.c.function.CFunctionPointer; 8 | 9 | import java.lang.foreign.MemorySegment; 10 | 11 | public class GraalPNIRef { 12 | private static final CEntryPointLiteral releaseFunc 13 | = CEntryPointLiteral.create(GraalPNIRef.class, "release", IsolateThread.class, long.class); 14 | 15 | public static MemorySegment getReleaseFunctionPointer() { 16 | return MemorySegment.ofAddress(releaseFunc.getFunctionPointer().rawValue()); 17 | } 18 | 19 | @SuppressWarnings("unused") 20 | @CEntryPoint 21 | public static void release(IsolateThread thread, long index) { 22 | PNIRef.release(index); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /graal/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module io.vproxy.pni.graal { 2 | requires org.graalvm.nativeimage; 3 | requires transitive io.vproxy.pni; 4 | 5 | exports io.vproxy.pni.graal; 6 | } 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vproxy-tools/panama-native-interface/a1d044fd82c397b523c97c887632ff1092bbfb72/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jul 17 19:37:41 CST 2023 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /performance/build.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | } 3 | -------------------------------------------------------------------------------- /playground/README.md: -------------------------------------------------------------------------------- 1 | # Panama Native Interface Playground 2 | 3 | An empty project for playing and trying new features. 4 | 5 | Gradle and C compiling script are pre-configured, following the instructions below to quickly try and test PNI features. 6 | 7 | ## How to use 8 | 9 | 1. Follow instructions in the project root's `README.md` to configure your building environment. 10 | 2. Add template classes inside `src/main/template/io/vproxy/pni/playground` 11 | 3. Run `./gradlew generatePlayground` to generate Java classes and C headers. 12 | 4. Add and edit file `src/main/c/playground.c`, which should contain implementations of native functions. 13 | 5. Add `Main.java` inside `src/main/java/io/vproxy/pni/playground` and load library using `System.loadLibrary("pniplayground");` 14 | 6. Run `./gradlew runPlayground` to re-generate, compile, and execute the program. 15 | -------------------------------------------------------------------------------- /playground/build.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | } 3 | -------------------------------------------------------------------------------- /playground/src/main/c-generated/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vproxy-tools/panama-native-interface/a1d044fd82c397b523c97c887632ff1092bbfb72/playground/src/main/c-generated/.gitkeep -------------------------------------------------------------------------------- /playground/src/main/c/make-playground.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | os=`uname` 4 | 5 | target="pniplayground" 6 | include_platform_dir="" 7 | 8 | if [[ "Linux" == "$os" ]] 9 | then 10 | target="lib$target.so" 11 | include_platform_dir="linux" 12 | elif [[ "Darwin" == "$os" ]] 13 | then 14 | target="lib$target.dylib" 15 | include_platform_dir="darwin" 16 | else 17 | target="$target.dll" 18 | include_platform_dir="win32" 19 | fi 20 | 21 | rm -f "$target" 22 | 23 | gcc -std=gnu99 -O2 \ 24 | $GCC_OPTS \ 25 | -I "./" \ 26 | -I "../c-generated" \ 27 | -shared -Werror -lc -lpthread -fPIC \ 28 | ../c-generated/pni.c \ 29 | playground.c \ 30 | -o "$target" 31 | -------------------------------------------------------------------------------- /playground/src/main/generated/io/vproxy/pni/playground/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vproxy-tools/panama-native-interface/a1d044fd82c397b523c97c887632ff1092bbfb72/playground/src/main/generated/io/vproxy/pni/playground/.gitkeep -------------------------------------------------------------------------------- /playground/src/main/java/io/vproxy/pni/playground/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vproxy-tools/panama-native-interface/a1d044fd82c397b523c97c887632ff1092bbfb72/playground/src/main/java/io/vproxy/pni/playground/.gitkeep -------------------------------------------------------------------------------- /playground/src/main/template/io/vproxy/pni/playground/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vproxy-tools/panama-native-interface/a1d044fd82c397b523c97c887632ff1092bbfb72/playground/src/main/template/io/vproxy/pni/playground/.gitkeep -------------------------------------------------------------------------------- /pni/build.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | } 3 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/ast/AstAnnoValue.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.ast; 2 | 3 | public class AstAnnoValue { 4 | public String name; 5 | public Object value; 6 | 7 | public AstAnnoValue(String name, Object value) { 8 | this.name = name; 9 | this.value = value; 10 | } 11 | 12 | public void toString(StringBuilder sb) { 13 | sb.append(name).append("=").append(value); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/ast/AstGenericDef.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.ast; 2 | 3 | public class AstGenericDef { 4 | public String name; 5 | public AstTypeDesc desc; 6 | 7 | public AstGenericDef(String name, AstTypeDesc desc) { 8 | this.name = name; 9 | this.desc = desc; 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return name + " extends " + desc; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/ast/BitFieldInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.ast; 2 | 3 | public class BitFieldInfo { 4 | public final String name; 5 | public final int offset; 6 | public final int bit; 7 | public final boolean bool; 8 | 9 | public BitFieldInfo(String name, int offset, int bit, boolean bool) { 10 | this.name = name; 11 | this.offset = offset; 12 | this.bit = bit; 13 | this.bool = bool; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/extension/Extension.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.extension; 2 | 3 | import io.vproxy.pni.exec.CompilerOptions; 4 | import io.vproxy.pni.exec.ast.AstClass; 5 | 6 | import java.util.List; 7 | 8 | public interface Extension { 9 | void validate(CompilerOptions opts) throws ExtensionValidationException; 10 | 11 | void generate(List templates, CompilerOptions opts); 12 | } 13 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/extension/ExtensionValidationException.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.extension; 2 | 3 | public class ExtensionValidationException extends Exception { 4 | public ExtensionValidationException() { 5 | super(); 6 | } 7 | 8 | public ExtensionValidationException(String message) { 9 | super(message); 10 | } 11 | 12 | public ExtensionValidationException(Throwable cause) { 13 | super(cause); 14 | } 15 | 16 | public ExtensionValidationException(String message, Throwable cause) { 17 | super(message, cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/internal/ParamOpts.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.internal; 2 | 3 | public class ParamOpts { 4 | private final boolean dependOnAllocator; 5 | 6 | private ParamOpts(boolean dependOnAllocator) { 7 | this.dependOnAllocator = dependOnAllocator; 8 | } 9 | 10 | public boolean isDependOnAllocator() { 11 | return dependOnAllocator; 12 | } 13 | 14 | public static ParamOpts of(boolean dependOnAllocator) { 15 | return new ParamOpts(dependOnAllocator); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/internal/PointerInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.internal; 2 | 3 | public class PointerInfo { 4 | public final boolean isMarked; 5 | public final boolean isDefaultTrue; 6 | 7 | public PointerInfo(boolean isMarked, boolean isDefaultTrue) { 8 | this.isMarked = isMarked; 9 | this.isDefaultTrue = isDefaultTrue; 10 | } 11 | 12 | public boolean isPointer() { 13 | return isMarked || isDefaultTrue; 14 | } 15 | 16 | public static PointerInfo ofField(boolean pointer) { 17 | return new PointerInfo(pointer, false); 18 | } 19 | 20 | public static PointerInfo ofMethod(boolean pointer) { 21 | return new PointerInfo(pointer, true); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoAlignTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoAlignTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoAlignTypeInfo() { 5 | super("io.vproxy.pni.annotation.Align", "io/vproxy/pni/annotation/Align", "Lio/vproxy/pni/annotation/Align;"); 6 | } 7 | 8 | private static final AnnoAlignTypeInfo INSTANCE = new AnnoAlignTypeInfo(); 9 | 10 | public static AnnoAlignTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoAlwaysAlignedTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoAlwaysAlignedTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoAlwaysAlignedTypeInfo() { 5 | super("io.vproxy.pni.annotation.AlwaysAligned", "io/vproxy/pni/annotation/AlwaysAligned", "Lio/vproxy/pni/annotation/AlwaysAligned;"); 6 | } 7 | 8 | private static final AnnoAlwaysAlignedTypeInfo INSTANCE = new AnnoAlwaysAlignedTypeInfo(); 9 | 10 | public static AnnoAlwaysAlignedTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoBitTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoBitTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoBitTypeInfo() { 5 | super("io.vproxy.pni.annotation.Bit", "io/vproxy/pni/annotation/Bit", "Lio/vproxy/pni/annotation/Bit;"); 6 | } 7 | 8 | private static final AnnoBitTypeInfo INSTANCE = new AnnoBitTypeInfo(); 9 | 10 | public static AnnoBitTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoDowncallTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoDowncallTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoDowncallTypeInfo() { 5 | super("io.vproxy.pni.annotation.Downcall", "io/vproxy/pni/annotation/Downcall", "Lio/vproxy/pni/annotation/Downcall;"); 6 | } 7 | 8 | private static final AnnoDowncallTypeInfo INSTANCE = new AnnoDowncallTypeInfo(); 9 | 10 | public static AnnoDowncallTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoGenerateMemberTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoGenerateMemberTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoGenerateMemberTypeInfo() { 5 | super("io.vproxy.pni.annotation.GenerateMember", "io/vproxy/pni/annotation/GenerateMember", "Lio/vproxy/pni/annotation/GenerateMember;"); 6 | } 7 | 8 | private static final AnnoGenerateMemberTypeInfo INSTANCE = new AnnoGenerateMemberTypeInfo(); 9 | 10 | public static AnnoGenerateMemberTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoImplTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoImplTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoImplTypeInfo() { 5 | super("io.vproxy.pni.annotation.Impl", "io/vproxy/pni/annotation/Impl", "Lio/vproxy/pni/annotation/Impl;"); 6 | } 7 | 8 | private static final AnnoImplTypeInfo INSTANCE = new AnnoImplTypeInfo(); 9 | 10 | public static AnnoImplTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoIncludeTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoIncludeTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoIncludeTypeInfo() { 5 | super("io.vproxy.pni.annotation.Include", "io/vproxy/pni/annotation/Include", "Lio/vproxy/pni/annotation/Include;"); 6 | } 7 | 8 | private static final AnnoIncludeTypeInfo INSTANCE = new AnnoIncludeTypeInfo(); 9 | 10 | public static AnnoIncludeTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoLenTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoLenTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoLenTypeInfo() { 5 | super("io.vproxy.pni.annotation.Len", "io/vproxy/pni/annotation/Len", "Lio/vproxy/pni/annotation/Len;"); 6 | } 7 | 8 | private static final AnnoLenTypeInfo INSTANCE = new AnnoLenTypeInfo(); 9 | 10 | public static AnnoLenTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoLinkerOptionCriticalTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoLinkerOptionCriticalTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoLinkerOptionCriticalTypeInfo() { 5 | super("io.vproxy.pni.annotation.LinkerOption$Critical", "io/vproxy/pni/annotation/LinkerOption$Critical", "Lio/vproxy/pni/annotation/LinkerOption$Critical;"); 6 | } 7 | 8 | private static final AnnoLinkerOptionCriticalTypeInfo INSTANCE = new AnnoLinkerOptionCriticalTypeInfo(); 9 | 10 | public static AnnoLinkerOptionCriticalTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoNameTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoNameTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoNameTypeInfo() { 5 | super("io.vproxy.pni.annotation.Name", "io/vproxy/pni/annotation/Name", "Lio/vproxy/pni/annotation/Name;"); 6 | } 7 | 8 | private static final AnnoNameTypeInfo INSTANCE = new AnnoNameTypeInfo(); 9 | 10 | public static AnnoNameTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoNativeReturnTypeTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoNativeReturnTypeTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoNativeReturnTypeTypeInfo() { 5 | super("io.vproxy.pni.annotation.NativeReturnType", "io/vproxy/pni/annotation/NativeReturnType", "Lio/vproxy/pni/annotation/NativeReturnType;"); 6 | } 7 | 8 | private static final AnnoNativeReturnTypeTypeInfo INSTANCE = new AnnoNativeReturnTypeTypeInfo(); 9 | 10 | public static AnnoNativeReturnTypeTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoNativeTypeTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoNativeTypeTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoNativeTypeTypeInfo() { 5 | super("io.vproxy.pni.annotation.NativeType", "io/vproxy/pni/annotation/NativeType", "Lio/vproxy/pni/annotation/NativeType;"); 6 | } 7 | 8 | private static final AnnoNativeTypeTypeInfo INSTANCE = new AnnoNativeTypeTypeInfo(); 9 | 10 | public static AnnoNativeTypeTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoNoAllocTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoNoAllocTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoNoAllocTypeInfo() { 5 | super("io.vproxy.pni.annotation.NoAlloc", "io/vproxy/pni/annotation/NoAlloc", "Lio/vproxy/pni/annotation/NoAlloc;"); 6 | } 7 | 8 | private static final AnnoNoAllocTypeInfo INSTANCE = new AnnoNoAllocTypeInfo(); 9 | 10 | public static AnnoNoAllocTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoPointerOnlyTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoPointerOnlyTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoPointerOnlyTypeInfo() { 5 | super("io.vproxy.pni.annotation.PointerOnly", "io/vproxy/pni/annotation/PointerOnly", "Lio/vproxy/pni/annotation/PointerOnly;"); 6 | } 7 | 8 | private static final AnnoPointerOnlyTypeInfo INSTANCE = new AnnoPointerOnlyTypeInfo(); 9 | 10 | public static AnnoPointerOnlyTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoPointerTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoPointerTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoPointerTypeInfo() { 5 | super("io.vproxy.pni.annotation.Pointer", "io/vproxy/pni/annotation/Pointer", "Lio/vproxy/pni/annotation/Pointer;"); 6 | } 7 | 8 | private static final AnnoPointerTypeInfo INSTANCE = new AnnoPointerTypeInfo(); 9 | 10 | public static AnnoPointerTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoRawTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoRawTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoRawTypeInfo() { 5 | super("io.vproxy.pni.annotation.Raw", "io/vproxy/pni/annotation/Raw", "Lio/vproxy/pni/annotation/Raw;"); 6 | } 7 | 8 | private static final AnnoRawTypeInfo INSTANCE = new AnnoRawTypeInfo(); 9 | 10 | public static AnnoRawTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoSizeofTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoSizeofTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoSizeofTypeInfo() { 5 | super("io.vproxy.pni.annotation.Sizeof", "io/vproxy/pni/annotation/Sizeof", "Lio/vproxy/pni/annotation/Sizeof;"); 6 | } 7 | 8 | private static final AnnoSizeofTypeInfo INSTANCE = new AnnoSizeofTypeInfo(); 9 | 10 | public static AnnoSizeofTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoSpecifyGeneratedMembersTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoSpecifyGeneratedMembersTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoSpecifyGeneratedMembersTypeInfo() { 5 | super("io.vproxy.pni.annotation.SpecifyGeneratedMembers", "io/vproxy/pni/annotation/SpecifyGeneratedMembers", "Lio/vproxy/pni/annotation/SpecifyGeneratedMembers;"); 6 | } 7 | 8 | private static final AnnoSpecifyGeneratedMembersTypeInfo INSTANCE = new AnnoSpecifyGeneratedMembersTypeInfo(); 9 | 10 | public static AnnoSpecifyGeneratedMembersTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoStructTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoStructTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoStructTypeInfo() { 5 | super("io.vproxy.pni.annotation.Struct", "io/vproxy/pni/annotation/Struct", "Lio/vproxy/pni/annotation/Struct;"); 6 | } 7 | 8 | private static final AnnoStructTypeInfo INSTANCE = new AnnoStructTypeInfo(); 9 | 10 | public static AnnoStructTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoStyleTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoStyleTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoStyleTypeInfo() { 5 | super("io.vproxy.pni.annotation.Style", "io/vproxy/pni/annotation/Style", "Lio/vproxy/pni/annotation/Style;"); 6 | } 7 | 8 | private static final AnnoStyleTypeInfo INSTANCE = new AnnoStyleTypeInfo(); 9 | 10 | public static AnnoStyleTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoSuppressTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoSuppressTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoSuppressTypeInfo() { 5 | super("io.vproxy.pni.annotation.Suppress", "io/vproxy/pni/annotation/Suppress", "Lio/vproxy/pni/annotation/Suppress;"); 6 | } 7 | 8 | private static final AnnoSuppressTypeInfo INSTANCE = new AnnoSuppressTypeInfo(); 9 | 10 | public static AnnoSuppressTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoUnionTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoUnionTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoUnionTypeInfo() { 5 | super("io.vproxy.pni.annotation.Union", "io/vproxy/pni/annotation/Union", "Lio/vproxy/pni/annotation/Union;"); 6 | } 7 | 8 | private static final AnnoUnionTypeInfo INSTANCE = new AnnoUnionTypeInfo(); 9 | 10 | public static AnnoUnionTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoUnsignedTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoUnsignedTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoUnsignedTypeInfo() { 5 | super("io.vproxy.pni.annotation.Unsigned", "io/vproxy/pni/annotation/Unsigned", "Lio/vproxy/pni/annotation/Unsigned;"); 6 | } 7 | 8 | private static final AnnoUnsignedTypeInfo INSTANCE = new AnnoUnsignedTypeInfo(); 9 | 10 | public static AnnoUnsignedTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/AnnoUpcallTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class AnnoUpcallTypeInfo extends BuiltInAnnoTypeInfo { 4 | private AnnoUpcallTypeInfo() { 5 | super("io.vproxy.pni.annotation.Upcall", "io/vproxy/pni/annotation/Upcall", "Lio/vproxy/pni/annotation/Upcall;"); 6 | } 7 | 8 | private static final AnnoUpcallTypeInfo INSTANCE = new AnnoUpcallTypeInfo(); 9 | 10 | public static AnnoUpcallTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/BuiltInAnnoTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class BuiltInAnnoTypeInfo extends NoGenReferenceTypeInfo { 4 | public BuiltInAnnoTypeInfo(String name, String internalName, String desc) { 5 | super(name, internalName, desc); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/BuiltInExceptionTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class BuiltInExceptionTypeInfo extends NoGenReferenceTypeInfo { 4 | public BuiltInExceptionTypeInfo(String name, String internalName, String desc) { 5 | super(name, internalName, desc); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/BuiltInReferenceTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public abstract class BuiltInReferenceTypeInfo extends TypeInfo { 4 | private final String name; 5 | private final String internalName; 6 | private final String desc; 7 | 8 | public BuiltInReferenceTypeInfo(String name, String internalName, String desc) { 9 | this.name = name; 10 | this.internalName = internalName; 11 | this.desc = desc; 12 | } 13 | 14 | @Override 15 | public String name() { 16 | return name; 17 | } 18 | 19 | @Override 20 | public String internalName() { 21 | return internalName; 22 | } 23 | 24 | @Override 25 | public String desc() { 26 | return desc; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /pni/src/main/java/io/vproxy/pni/exec/type/VoidRefTypeInfo.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.exec.type; 2 | 3 | public class VoidRefTypeInfo extends NoGenReferenceTypeInfo { 4 | private VoidRefTypeInfo() { 5 | super("java.lang.Void", "java/lang/Void", "Ljava/lang/Void;"); 6 | } 7 | 8 | private static final VoidRefTypeInfo INSTANCE = new VoidRefTypeInfo(); 9 | 10 | public static VoidRefTypeInfo get() { 11 | return INSTANCE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pni/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module io.vproxy.pni.exec { 2 | requires io.vproxy.base; 3 | requires org.objectweb.asm; 4 | requires org.objectweb.asm.tree; 5 | 6 | exports io.vproxy.pni.exec; 7 | exports io.vproxy.pni.exec.ast; 8 | exports io.vproxy.pni.exec.extension; 9 | exports io.vproxy.pni.exec.generator; 10 | exports io.vproxy.pni.exec.internal; 11 | exports io.vproxy.pni.exec.type; 12 | } 13 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | } 3 | -------------------------------------------------------------------------------- /sample/src/main/c/io_vproxy_pni_sample_MBuf.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_sample_MBuf */ 3 | #ifndef _Included_io_vproxy_pni_sample_MBuf 4 | #define _Included_io_vproxy_pni_sample_MBuf 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | struct mbuf_t; 10 | typedef struct mbuf_t mbuf_t; 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #include 17 | #include 18 | #include "io_vproxy_pni_sample_UserData.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | PNIEnvExpand(mbuf_t, mbuf_t *) 25 | PNIBufExpand(mbuf_t, mbuf_t, 32) 26 | 27 | struct mbuf_t { 28 | void * bufAddr; 29 | uint32_t pktLen; 30 | uint32_t pktOff; 31 | uint32_t bufLen; 32 | union { 33 | void * userdata; 34 | uint64_t udata64; 35 | }; 36 | }; 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | #endif // _Included_io_vproxy_pni_sample_MBuf 42 | // metadata.generator-version: pni test 43 | // sha256:e513cbed641492f56d87b30e17e6bf6c2a3a074788c90a28dfd82bb294b05416 44 | -------------------------------------------------------------------------------- /sample/src/main/c/io_vproxy_pni_sample_NativeFunctions.c: -------------------------------------------------------------------------------- 1 | #ifdef WIN32 2 | #include 3 | #include 4 | typedef int32_t socklen_t; 5 | #else 6 | #include 7 | #include 8 | #define closesocket close 9 | #endif 10 | 11 | #include "io_vproxy_pni_sample_NativeFunctions.impl.h" 12 | -------------------------------------------------------------------------------- /sample/src/main/c/io_vproxy_pni_sample_SampleFunctions.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_sample_SampleFunctions */ 3 | #ifndef _Included_io_vproxy_pni_sample_SampleFunctions 4 | #define _Included_io_vproxy_pni_sample_SampleFunctions 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | #include "io_vproxy_pni_sample_MBuf.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | JNIEXPORT int JNICALL Java_io_vproxy_pni_sample_SampleFunctions_read(PNIEnv_int * env, int32_t fd, mbuf_t * buf); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif // _Included_io_vproxy_pni_sample_SampleFunctions 27 | // metadata.generator-version: pni test 28 | // sha256:a5dd7d7d43a0572718f6ea87f14e05f7cb34c283b1ab3af2e6d4add1f115ba47 29 | -------------------------------------------------------------------------------- /sample/src/main/c/io_vproxy_pni_sample_UserData.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | /* Header for class io_vproxy_pni_sample_UserData */ 3 | #ifndef _Included_io_vproxy_pni_sample_UserData 4 | #define _Included_io_vproxy_pni_sample_UserData 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | #include 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif // _Included_io_vproxy_pni_sample_UserData 24 | // metadata.generator-version: pni test 25 | // sha256:7dc067ef16b344c155692b89dd48ace8b0dbce876be96ccfa7be9f46941c2b36 26 | -------------------------------------------------------------------------------- /sample/src/main/c/jni.h: -------------------------------------------------------------------------------- 1 | #ifndef PNI_JNIMOCK_H 2 | #define PNI_JNIMOCK_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef WIN32 8 | #define JNIEXPORT __declspec(dllexport) 9 | #else 10 | #define JNIEXPORT __attribute__((visibility("default"))) 11 | #endif 12 | 13 | #ifdef WIN32 14 | #define JNICALL __stdcall 15 | #else 16 | #define JNICALL 17 | #endif 18 | 19 | #include 20 | 21 | typedef int8_t jbyte; 22 | typedef uint16_t jchar; 23 | typedef double jdouble; 24 | typedef float jfloat; 25 | typedef int32_t jint; 26 | typedef int64_t jlong; 27 | typedef int16_t jshort; 28 | typedef uint8_t jboolean; 29 | 30 | #define JNI_FALSE (0) 31 | #define JNI_TRUE (1) 32 | 33 | #define JNI_OK (0) 34 | #define JNI_ERR (-1) 35 | 36 | #endif // PNI_JNIMOCK_H 37 | -------------------------------------------------------------------------------- /sample/src/main/c/make-sample.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | os=`uname` 4 | 5 | target="pnisample" 6 | include_platform_dir="" 7 | extra_ld="" 8 | 9 | if [[ "Linux" == "$os" ]] 10 | then 11 | target="lib$target.so" 12 | include_platform_dir="linux" 13 | elif [[ "Darwin" == "$os" ]] 14 | then 15 | target="lib$target.dylib" 16 | include_platform_dir="darwin" 17 | else 18 | target="$target.dll" 19 | include_platform_dir="win32" 20 | extra_ld="-lws2_32" 21 | fi 22 | 23 | rm -f "$target" 24 | 25 | gcc -std=gnu99 -O2 \ 26 | $GCC_OPTS \ 27 | -I "./" \ 28 | -shared -Werror -fPIC \ 29 | pni.c \ 30 | io_vproxy_pni_sample_NativeFunctions.c \ 31 | $extra_ld \ 32 | -o "$target" 33 | -------------------------------------------------------------------------------- /sample/src/main/java/io/vproxy/pni/sample/README.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.sample; 2 | 3 | import io.vproxy.pni.annotation.*; 4 | 5 | import java.io.IOException; 6 | import java.lang.foreign.MemorySegment; 7 | 8 | @Struct 9 | @Name("mbuf_t") 10 | @AlwaysAligned 11 | class PNIMBuf { 12 | MemorySegment bufAddr; 13 | @Unsigned int pktLen; 14 | @Unsigned int pktOff; 15 | @Unsigned int bufLen; 16 | PNIUserData userdata; 17 | } 18 | 19 | @Union(embedded = true) 20 | @AlwaysAligned 21 | class PNIUserData { 22 | MemorySegment userdata; 23 | @Unsigned long udata64; 24 | } 25 | 26 | @Downcall 27 | interface PNISampleFunctions { 28 | int read(int fd, PNIMBuf buf) throws IOException; 29 | } 30 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'panama-native-interface' 2 | include 'api' 3 | include 'sample' 4 | include 'pni' 5 | include 'acceptance-testing' 6 | include 'acceptance-testing-template' 7 | include 'playground' 8 | include 'unittest' 9 | include 'performance' 10 | include 'graal' 11 | include 'graal-test' 12 | include 'graal-test-template' 13 | 14 | -------------------------------------------------------------------------------- /unittest/build.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | } 3 | -------------------------------------------------------------------------------- /unittest/src/test/java/io/vproxy/pni/test/AfterAll.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.test; 2 | 3 | import org.junit.Test; 4 | 5 | public class AfterAll { 6 | @Test 7 | public void last() throws Exception { 8 | System.gc(); 9 | Thread.sleep(2_000); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /unittest/src/test/java/io/vproxy/pni/test/JavaFile.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.test; 2 | 3 | public class JavaFile { 4 | private String name; 5 | private String content; 6 | 7 | public JavaFile() { 8 | } 9 | 10 | public String getName() { 11 | return name; 12 | } 13 | 14 | public JavaFile setName(String name) { 15 | this.name = name; 16 | return this; 17 | } 18 | 19 | public String getContent() { 20 | return content; 21 | } 22 | 23 | public JavaFile setContent(String content) { 24 | this.content = content; 25 | return this; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /unittest/src/test/java/io/vproxy/pni/test/Suite.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.test; 2 | 3 | import org.junit.runner.RunWith; 4 | 5 | @org.junit.runners.Suite.SuiteClasses({ 6 | TestTypes.class, 7 | TestCorner.class, 8 | TestTypesNoGen.class, 9 | TestDescParsing.class, 10 | TestObjectHolder.class, 11 | TestValidation.class, 12 | TestAllocator.class, 13 | TestWarningFlags.class, 14 | TestRef.class, 15 | TestUtils.class, 16 | TestCompilationFlags.class, 17 | AfterAll.class 18 | }) 19 | @RunWith(org.junit.runners.Suite.class) 20 | public class Suite { 21 | } 22 | -------------------------------------------------------------------------------- /unittest/src/test/java/io/vproxy/pni/test/TestUtils.java: -------------------------------------------------------------------------------- 1 | package io.vproxy.pni.test; 2 | 3 | import io.vproxy.pni.impl.Utils; 4 | import org.junit.Test; 5 | 6 | import static org.junit.Assert.assertEquals; 7 | 8 | public class TestUtils { 9 | @Test 10 | public void smallestPositivePowerOf2GE() { 11 | assertEquals(4096, Utils.smallestPositivePowerOf2GE(4096)); 12 | assertEquals(4096, Utils.smallestPositivePowerOf2GE(4095)); 13 | assertEquals(0, Utils.smallestPositivePowerOf2GE(-1)); 14 | assertEquals(0, Utils.smallestPositivePowerOf2GE(0)); 15 | assertEquals(1, Utils.smallestPositivePowerOf2GE(1)); 16 | assertEquals(16384, Utils.smallestPositivePowerOf2GE(10000)); 17 | assertEquals(0x40000000, Utils.smallestPositivePowerOf2GE(0x41234567)); 18 | } 19 | } 20 | --------------------------------------------------------------------------------