Ejemplo n.º 1
0
 public void lower(ArrayCopySlowPathNode arraycopy, LoweringTool tool) {
   StructuredGraph graph = arraycopy.graph();
   if (!graph.getGuardsStage().areFrameStatesAtDeopts()) {
     // Can't be lowered yet
     return;
   }
   SnippetInfo snippetInfo = arraycopy.getSnippet();
   Arguments args = new Arguments(snippetInfo, graph.getGuardsStage(), tool.getLoweringStage());
   args.add("nonNullSrc", arraycopy.getSource());
   args.add("srcPos", arraycopy.getSourcePosition());
   args.add("nonNullDest", arraycopy.getDestination());
   args.add("destPos", arraycopy.getDestinationPosition());
   if (snippetInfo == arraycopyUnrolledWorkSnippet) {
     args.addConst("length", ((Integer) arraycopy.getArgument()).intValue());
     args.addConst("elementKind", arraycopy.getElementKind());
   } else {
     args.add("length", arraycopy.getLength());
   }
   if (snippetInfo == arraycopyPredictedObjectWorkSnippet) {
     HotSpotResolvedObjectType arrayKlass =
         (HotSpotResolvedObjectType) tool.getMetaAccess().lookupJavaType(Object[].class);
     ValueNode objectArrayKlass =
         ConstantNode.forConstant(
             KlassPointerStamp.klassNonNull(),
             arrayKlass.klass(),
             tool.getMetaAccess(),
             arraycopy.graph());
     args.add("objectArrayKlass", objectArrayKlass);
     args.addConst("counter", arraycopyCallCounters.get(JavaKind.Object));
     args.addConst("copiedCounter", arraycopyCallCopiedCounters.get(JavaKind.Object));
   }
   instantiate(args, arraycopy);
 }
Ejemplo n.º 2
0
 @Override
 ConstantPool getConstantPool() {
   HotSpotResolvedObjectType type =
       HotSpotResolvedObjectType.fromObjectClass(OBJECT_TYPE_BASE.getClass());
   long ptrToClass = UNSAFE.getKlassPointer(OBJECT_TYPE_BASE);
   return CompilerToVMHelper.getConstantPool(type, getPtrToCpAddress() - ptrToClass);
 }