changeset 52971:70fadc319521 asm-condy

refactoring ClassWriterExt and ignoring failing tests
author vromero
date Wed, 07 Nov 2018 23:19:25 -0500
parents 11d1fd3caa66
children 408e864e67db
files test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/share/GenCPFullOfMH.java test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/share/GenCPFullOfMT.java test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/share/GenManyIndyCorrectBootstrap.java test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/share/GenManyIndyIncorrectBootstrap.java test/hotspot/jtreg/vmTestbase/vm/mlvm/patches/java.base/jdk/internal/org/objectweb/asm/ClassWriterExt.java
diffstat 5 files changed, 91 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/share/GenCPFullOfMH.java	Wed Nov 07 23:04:52 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/share/GenCPFullOfMH.java	Wed Nov 07 23:19:25 2018 -0500
@@ -40,6 +40,8 @@
 
     @Override
     protected void generateCommonData(ClassWriterExt cw) {
+        cw.setCacheMHandles(false);
+
         cw.visitField(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC,
                 STATIC_FIELD_NAME,
                 STATIC_FIELD_SIGNATURE, null, false);
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/share/GenCPFullOfMT.java	Wed Nov 07 23:04:52 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/share/GenCPFullOfMT.java	Wed Nov 07 23:19:25 2018 -0500
@@ -39,6 +39,7 @@
 
     @Override
     protected void generateCommonData(ClassWriterExt cw) {
+        cw.setCacheMTypes(false);
         super.generateCommonData(cw);
     }
 
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/share/GenManyIndyCorrectBootstrap.java	Wed Nov 07 23:04:52 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/share/GenManyIndyCorrectBootstrap.java	Wed Nov 07 23:19:25 2018 -0500
@@ -80,6 +80,7 @@
      */
     @Override
     protected void generateCommonData(ClassWriterExt cw) {
+        cw.setCacheInvokeDynamic(false);
         super.generateCommonData(cw);
     }
 
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/share/GenManyIndyIncorrectBootstrap.java	Wed Nov 07 23:04:52 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/cp/share/GenManyIndyIncorrectBootstrap.java	Wed Nov 07 23:19:25 2018 -0500
@@ -115,6 +115,8 @@
      */
     @Override
     protected void generateCommonData(ClassWriterExt cw) {
+        cw.setCacheInvokeDynamic(false);
+
         cw.visitField(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC,
                 STATIC_BOOTSTRAP_FIELD_NAME,
                 STATIC_BOOTSTRAP_FIELD_SIGNATURE, null, null);
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/patches/java.base/jdk/internal/org/objectweb/asm/ClassWriterExt.java	Wed Nov 07 23:04:52 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/patches/java.base/jdk/internal/org/objectweb/asm/ClassWriterExt.java	Wed Nov 07 23:19:25 2018 -0500
@@ -26,6 +26,9 @@
 import java.lang.reflect.InaccessibleObjectException;
 
 public class ClassWriterExt extends ClassWriter {
+    private boolean cacheInvokeDynamic = true;
+    private boolean cacheMTypes = true;
+    private boolean cacheMHandles = true;
 
     public ClassWriterExt(ClassReader cr, int flags) {
         super(cr, flags);
@@ -34,6 +37,88 @@
     public ClassWriterExt(int flags) {
         super(flags);
     }
+/*
+    @Override
+    Item newInvokeDynamicItem(final String name, final String desc,
+                    final Handle bsm, final Object... bsmArgs) {
+        if (cacheInvokeDynamic) {
+            return super.newInvokeDynamicItem(name, desc, bsm, bsmArgs);
+        }
+        int type = ClassWriter.INDY;
+        disableItemHashTableFor(type);
+        Item result;
+        try {
+            return super.newInvokeDynamicItem(name, desc, bsm, bsmArgs);
+        } finally {
+            restoreItemHashTableFor(type);
+        }
+    }
+
+    @Override
+    Item newStringishItem(final int type, final String value) {
+        if (type != ClassWriter.MTYPE) {
+            return super.newStringishItem(type, value);
+        }
+        if (cacheMTypes) {
+            return super.newStringishItem(type, value);
+        }
+        disableItemHashTableFor(type);
+        try {
+            return super.newStringishItem(type, value);
+        } finally {
+            restoreItemHashTableFor(type);
+        }
+    }
+
+    @Override
+    Item newHandleItem(final int tag, final String owner, final String name,
+            final String desc, final boolean itf) {
+        if (cacheMHandles) {
+            return super.newHandleItem(tag, owner, name, desc, itf);
+        }
+        int type = ClassWriter.HANDLE_BASE + tag;
+        disableItemHashTableFor(type);
+        try {
+            return super.newHandleItem(tag, owner, name, desc, itf);
+        } finally {
+            restoreItemHashTableFor(type);
+        }
+    }
+
+    private void disableItemHashTableFor(int type) {
+        for (Item i : items) {
+            while (i != null) {
+                if (i.type == type) {
+                    i.type = -type;
+                }
+                i = i.next;
+            }
+        }
+    }
+
+    private void restoreItemHashTableFor(int type) {
+        for (Item i : items) {
+            while (i != null) {
+                if (i.type == -type) {
+                    i.type = type;
+                }
+                i = i.next;
+            }
+        }
+    }
+*/
+    public void setCacheInvokeDynamic(boolean value) {
+        if (!value) throw new Error("method isn't implemented yet");
+        cacheInvokeDynamic = value;
+    }
+    public void setCacheMTypes(boolean value) {
+        if (!value) throw new Error("method isn't implemented yet");
+        cacheMTypes = value;
+    }
+    public void setCacheMHandles(boolean value) {
+        if (!value) throw new Error("method isn't implemented yet");
+        cacheMHandles = value;
+    }
 
     public int getBytecodeLength(MethodVisitor mv) {
         ByteVector code;