From 44e46fd3d173d91a8cf8f79221cf522e2bd24fba Mon Sep 17 00:00:00 2001 From: Weaxs <459312872@qq.com> Date: Mon, 2 Sep 2024 18:38:48 +0800 Subject: [PATCH 1/3] fix: EspressoFinalReference NoSuchMethodError --- .../truffle/espresso/ref/ClassAssembler.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ref/ClassAssembler.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ref/ClassAssembler.java index 5ff9a21447be..128a6ec165d0 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ref/ClassAssembler.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ref/ClassAssembler.java @@ -118,15 +118,15 @@ static byte[] assembleEspressoFinalReference() { AnnotationVisitor annotationVisitor0; classWriter.visit(V1_8, ACC_FINAL | ACC_SUPER, "com/oracle/truffle/espresso/ref/EspressoFinalReference", - "Ljava/lang/ref/PublicFinalReference;Lcom/oracle/truffle/espresso/ref/EspressoReference;", + "Ljava/lang/ref/PublicFinalReference;Lcom/oracle/truffle/espresso/ref/EspressoReference;", "java/lang/ref/PublicFinalReference", new String[]{"com/oracle/truffle/espresso/ref/EspressoReference"}); - fieldVisitor = classWriter.visitField(ACC_PRIVATE | ACC_FINAL, "guestReference", "Lcom/oracle/truffle/espresso/runtime/StaticObject;", null, null); + fieldVisitor = classWriter.visitField(ACC_PRIVATE | ACC_FINAL, "guestReference", "Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;", null, null); fieldVisitor.visitEnd(); methodVisitor = classWriter.visitMethod(0, "", - "(Lcom/oracle/truffle/espresso/runtime/StaticObject;Lcom/oracle/truffle/espresso/runtime/StaticObject;Ljava/lang/ref/ReferenceQueue;)V", - "(Lcom/oracle/truffle/espresso/runtime/StaticObject;Lcom/oracle/truffle/espresso/runtime/StaticObject;Ljava/lang/ref/ReferenceQueue;)V", + "(Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;Ljava/lang/ref/ReferenceQueue;)V", + "(Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;Ljava/lang/ref/ReferenceQueue;)V", null); annotationVisitor0 = methodVisitor.visitTypeAnnotation(369098752, null, "Lcom/oracle/truffle/espresso/substitutions/JavaType;", false); @@ -144,24 +144,24 @@ static byte[] assembleEspressoFinalReference() { methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/ref/PublicFinalReference", "", "(Ljava/lang/Object;Ljava/lang/ref/ReferenceQueue;)V", false); methodVisitor.visitVarInsn(ALOAD, 0); methodVisitor.visitVarInsn(ALOAD, 1); - methodVisitor.visitFieldInsn(PUTFIELD, "com/oracle/truffle/espresso/ref/EspressoFinalReference", "guestReference", "Lcom/oracle/truffle/espresso/runtime/StaticObject;"); + methodVisitor.visitFieldInsn(PUTFIELD, "com/oracle/truffle/espresso/ref/EspressoFinalReference", "guestReference", "Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;"); methodVisitor.visitInsn(RETURN); methodVisitor.visitMaxs(3, 4); methodVisitor.visitEnd(); - methodVisitor = classWriter.visitMethod(ACC_PUBLIC, "getGuestReference", "()Lcom/oracle/truffle/espresso/runtime/StaticObject;", null, null); + methodVisitor = classWriter.visitMethod(ACC_PUBLIC, "getGuestReference", "()Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;", null, null); methodVisitor.visitCode(); methodVisitor.visitVarInsn(ALOAD, 0); - methodVisitor.visitFieldInsn(GETFIELD, "com/oracle/truffle/espresso/ref/EspressoFinalReference", "guestReference", "Lcom/oracle/truffle/espresso/runtime/StaticObject;"); + methodVisitor.visitFieldInsn(GETFIELD, "com/oracle/truffle/espresso/ref/EspressoFinalReference", "guestReference", "Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;"); methodVisitor.visitInsn(ARETURN); methodVisitor.visitMaxs(1, 1); methodVisitor.visitEnd(); - methodVisitor = classWriter.visitMethod(ACC_PUBLIC | ACC_BRIDGE | ACC_SYNTHETIC, "get", "()Lcom/oracle/truffle/espresso/runtime/StaticObject;", null, null); + methodVisitor = classWriter.visitMethod(ACC_PUBLIC | ACC_BRIDGE | ACC_SYNTHETIC, "get", "()Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;", null, null); methodVisitor.visitCode(); methodVisitor.visitVarInsn(ALOAD, 0); methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/ref/PublicFinalReference", "get", "()Ljava/lang/Object;", false); - methodVisitor.visitTypeInsn(CHECKCAST, "com/oracle/truffle/espresso/runtime/StaticObject"); + methodVisitor.visitTypeInsn(CHECKCAST, "com/oracle/truffle/espresso/runtime/staticobject/StaticObject"); methodVisitor.visitInsn(ARETURN); methodVisitor.visitMaxs(1, 1); methodVisitor.visitEnd(); From c28ef4e894145ce973bd49be483461684d1fd80c Mon Sep 17 00:00:00 2001 From: Weaxs <459312872@qq.com> Date: Tue, 10 Sep 2024 16:13:01 +0800 Subject: [PATCH 2/3] ClassAssembler style fix --- .../com/oracle/truffle/espresso/ref/ClassAssembler.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ref/ClassAssembler.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ref/ClassAssembler.java index 128a6ec165d0..c8aa1fb2ab4d 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ref/ClassAssembler.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ref/ClassAssembler.java @@ -125,8 +125,12 @@ static byte[] assembleEspressoFinalReference() { fieldVisitor.visitEnd(); methodVisitor = classWriter.visitMethod(0, "", - "(Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;Ljava/lang/ref/ReferenceQueue;)V", - "(Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;Ljava/lang/ref/ReferenceQueue;)V", + "(Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;" + + "Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;" + + "Ljava/lang/ref/ReferenceQueue;)V", + "(Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;" + + "Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;" + + "Ljava/lang/ref/ReferenceQueue;)V", null); annotationVisitor0 = methodVisitor.visitTypeAnnotation(369098752, null, "Lcom/oracle/truffle/espresso/substitutions/JavaType;", false); From b11c08363e19e0f9e3d330cf140d5a1ed9122a1d Mon Sep 17 00:00:00 2001 From: Weaxs <459312872@qq.com> Date: Tue, 10 Sep 2024 16:29:11 +0800 Subject: [PATCH 3/3] recovery --- .../com/oracle/truffle/espresso/ref/ClassAssembler.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ref/ClassAssembler.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ref/ClassAssembler.java index c8aa1fb2ab4d..128a6ec165d0 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ref/ClassAssembler.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ref/ClassAssembler.java @@ -125,12 +125,8 @@ static byte[] assembleEspressoFinalReference() { fieldVisitor.visitEnd(); methodVisitor = classWriter.visitMethod(0, "", - "(Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;" + - "Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;" + - "Ljava/lang/ref/ReferenceQueue;)V", - "(Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;" + - "Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;" + - "Ljava/lang/ref/ReferenceQueue;)V", + "(Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;Ljava/lang/ref/ReferenceQueue;)V", + "(Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;Lcom/oracle/truffle/espresso/runtime/staticobject/StaticObject;Ljava/lang/ref/ReferenceQueue;)V", null); annotationVisitor0 = methodVisitor.visitTypeAnnotation(369098752, null, "Lcom/oracle/truffle/espresso/substitutions/JavaType;", false);