32 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.g1CardQueueIndexOffset;
33 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.g1SATBQueueBufferOffset;
34 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.g1SATBQueueIndexOffset;
35 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.g1SATBQueueMarkingOffset;
36 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.g1YoungCardValue;
37 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord;
38 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.verifyOop;
39 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.verifyOops;
40 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.wordSize;
41 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.FREQUENT_PROBABILITY;
42 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.LIKELY_PROBABILITY;
43 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.NOT_FREQUENT_PROBABILITY;
44 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.probability;
45 import static org.graalvm.compiler.replacements.SnippetTemplate.DEFAULT_REPLACER;
46
47 import org.graalvm.compiler.api.replacements.Snippet;
48 import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
49 import org.graalvm.compiler.core.common.CompressEncoding;
50 import org.graalvm.compiler.core.common.GraalOptions;
51 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
52 import org.graalvm.compiler.graph.Node.ConstantNodeParameter;
53 import org.graalvm.compiler.graph.Node.NodeIntrinsic;
54 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
55 import org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider;
56 import org.graalvm.compiler.hotspot.nodes.G1ArrayRangePostWriteBarrier;
57 import org.graalvm.compiler.hotspot.nodes.G1ArrayRangePreWriteBarrier;
58 import org.graalvm.compiler.hotspot.nodes.G1PostWriteBarrier;
59 import org.graalvm.compiler.hotspot.nodes.G1PreWriteBarrier;
60 import org.graalvm.compiler.hotspot.nodes.G1ReferentFieldReadBarrier;
61 import org.graalvm.compiler.hotspot.nodes.GetObjectAddressNode;
62 import org.graalvm.compiler.hotspot.nodes.GraalHotSpotVMConfigNode;
63 import org.graalvm.compiler.hotspot.nodes.HotSpotCompressionNode;
64 import org.graalvm.compiler.hotspot.nodes.SerialArrayRangeWriteBarrier;
65 import org.graalvm.compiler.hotspot.nodes.SerialWriteBarrier;
66 import org.graalvm.compiler.hotspot.nodes.VMErrorNode;
67 import org.graalvm.compiler.nodes.NamedLocationIdentity;
68 import org.graalvm.compiler.nodes.StructuredGraph;
69 import org.graalvm.compiler.nodes.ValueNode;
70 import org.graalvm.compiler.nodes.extended.FixedValueAnchorNode;
71 import org.graalvm.compiler.nodes.extended.ForeignCallNode;
389
390 public static final ForeignCallDescriptor G1WBPOSTCALL = new ForeignCallDescriptor("write_barrier_post", void.class, Word.class);
391
392 @NodeIntrinsic(ForeignCallNode.class)
393 public static native void g1PostBarrierStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word card);
394
395 public static class Templates extends AbstractTemplates {
396
397 private final SnippetInfo serialImpreciseWriteBarrier = snippet(WriteBarrierSnippets.class, "serialImpreciseWriteBarrier", GC_CARD_LOCATION);
398 private final SnippetInfo serialPreciseWriteBarrier = snippet(WriteBarrierSnippets.class, "serialPreciseWriteBarrier", GC_CARD_LOCATION);
399 private final SnippetInfo serialArrayRangeWriteBarrier = snippet(WriteBarrierSnippets.class, "serialArrayRangeWriteBarrier");
400 private final SnippetInfo g1PreWriteBarrier = snippet(WriteBarrierSnippets.class, "g1PreWriteBarrier", GC_INDEX_LOCATION, GC_LOG_LOCATION);
401 private final SnippetInfo g1ReferentReadBarrier = snippet(WriteBarrierSnippets.class, "g1PreWriteBarrier", GC_INDEX_LOCATION, GC_LOG_LOCATION);
402 private final SnippetInfo g1PostWriteBarrier = snippet(WriteBarrierSnippets.class, "g1PostWriteBarrier", GC_CARD_LOCATION, GC_INDEX_LOCATION, GC_LOG_LOCATION);
403 private final SnippetInfo g1ArrayRangePreWriteBarrier = snippet(WriteBarrierSnippets.class, "g1ArrayRangePreWriteBarrier", GC_INDEX_LOCATION, GC_LOG_LOCATION);
404 private final SnippetInfo g1ArrayRangePostWriteBarrier = snippet(WriteBarrierSnippets.class, "g1ArrayRangePostWriteBarrier", GC_CARD_LOCATION, GC_INDEX_LOCATION, GC_LOG_LOCATION);
405
406 private final CompressEncoding oopEncoding;
407 private final Counters counters;
408
409 public Templates(OptionValues options, SnippetCounter.Group.Factory factory, HotSpotProviders providers, TargetDescription target, CompressEncoding oopEncoding) {
410 super(options, providers, providers.getSnippetReflection(), target);
411 this.oopEncoding = oopEncoding;
412 this.counters = new Counters(factory);
413 }
414
415 public void lower(SerialWriteBarrier writeBarrier, LoweringTool tool) {
416 Arguments args;
417 if (writeBarrier.usePrecise()) {
418 args = new Arguments(serialPreciseWriteBarrier, writeBarrier.graph().getGuardsStage(), tool.getLoweringStage());
419 args.add("address", writeBarrier.getAddress());
420 } else {
421 args = new Arguments(serialImpreciseWriteBarrier, writeBarrier.graph().getGuardsStage(), tool.getLoweringStage());
422 OffsetAddressNode address = (OffsetAddressNode) writeBarrier.getAddress();
423 args.add("object", address.getBase());
424 }
425 args.addConst("counters", counters);
426 template(args).instantiate(providers.getMetaAccess(), writeBarrier, DEFAULT_REPLACER, args);
427 }
428
429 public void lower(SerialArrayRangeWriteBarrier arrayRangeWriteBarrier, LoweringTool tool) {
430 Arguments args = new Arguments(serialArrayRangeWriteBarrier, arrayRangeWriteBarrier.graph().getGuardsStage(), tool.getLoweringStage());
431 args.add("object", arrayRangeWriteBarrier.getObject());
432 args.add("startIndex", arrayRangeWriteBarrier.getStartIndex());
433 args.add("length", arrayRangeWriteBarrier.getLength());
434 template(args).instantiate(providers.getMetaAccess(), arrayRangeWriteBarrier, DEFAULT_REPLACER, args);
435 }
436
437 public void lower(G1PreWriteBarrier writeBarrierPre, HotSpotRegistersProvider registers, LoweringTool tool) {
438 Arguments args = new Arguments(g1PreWriteBarrier, writeBarrierPre.graph().getGuardsStage(), tool.getLoweringStage());
439 AddressNode address = writeBarrierPre.getAddress();
440 args.add("address", address);
441 if (address instanceof OffsetAddressNode) {
442 args.add("object", ((OffsetAddressNode) address).getBase());
443 } else {
444 args.add("object", null);
445 }
446
447 ValueNode expected = writeBarrierPre.getExpectedObject();
448 if (expected != null && expected.stamp() instanceof NarrowOopStamp) {
449 assert oopEncoding != null;
450 expected = HotSpotCompressionNode.uncompress(expected, oopEncoding);
451 }
452 args.add("expectedObject", expected);
453
454 args.addConst("doLoad", writeBarrierPre.doLoad());
455 args.addConst("nullCheck", writeBarrierPre.getNullCheck());
456 args.addConst("threadRegister", registers.getThreadRegister());
457 args.addConst("trace", traceBarrier(writeBarrierPre.graph()));
458 args.addConst("counters", counters);
459 template(args).instantiate(providers.getMetaAccess(), writeBarrierPre, DEFAULT_REPLACER, args);
460 }
461
462 public void lower(G1ReferentFieldReadBarrier readBarrier, HotSpotRegistersProvider registers, LoweringTool tool) {
463 Arguments args = new Arguments(g1ReferentReadBarrier, readBarrier.graph().getGuardsStage(), tool.getLoweringStage());
464 AddressNode address = readBarrier.getAddress();
465 args.add("address", address);
466 if (address instanceof OffsetAddressNode) {
467 args.add("object", ((OffsetAddressNode) address).getBase());
468 } else {
469 args.add("object", null);
470 }
471
472 ValueNode expected = readBarrier.getExpectedObject();
473 if (expected != null && expected.stamp() instanceof NarrowOopStamp) {
474 assert oopEncoding != null;
475 expected = HotSpotCompressionNode.uncompress(expected, oopEncoding);
476 }
477
478 args.add("expectedObject", expected);
479 args.addConst("doLoad", readBarrier.doLoad());
480 args.addConst("nullCheck", false);
481 args.addConst("threadRegister", registers.getThreadRegister());
482 args.addConst("trace", traceBarrier(readBarrier.graph()));
483 args.addConst("counters", counters);
484 template(args).instantiate(providers.getMetaAccess(), readBarrier, DEFAULT_REPLACER, args);
485 }
486
487 public void lower(G1PostWriteBarrier writeBarrierPost, HotSpotRegistersProvider registers, LoweringTool tool) {
488 StructuredGraph graph = writeBarrierPost.graph();
489 if (writeBarrierPost.alwaysNull()) {
490 graph.removeFixed(writeBarrierPost);
491 return;
492 }
493 Arguments args = new Arguments(g1PostWriteBarrier, graph.getGuardsStage(), tool.getLoweringStage());
494 AddressNode address = writeBarrierPost.getAddress();
495 args.add("address", address);
496 if (address instanceof OffsetAddressNode) {
497 args.add("object", ((OffsetAddressNode) address).getBase());
498 } else {
499 assert writeBarrierPost.usePrecise() : "found imprecise barrier that's not an object access " + writeBarrierPost;
500 args.add("object", null);
501 }
502
503 ValueNode value = writeBarrierPost.getValue();
504 if (value.stamp() instanceof NarrowOopStamp) {
505 assert oopEncoding != null;
506 value = HotSpotCompressionNode.uncompress(value, oopEncoding);
507 }
508 args.add("value", value);
509
510 args.addConst("usePrecise", writeBarrierPost.usePrecise());
511 args.addConst("threadRegister", registers.getThreadRegister());
512 args.addConst("trace", traceBarrier(writeBarrierPost.graph()));
513 args.addConst("counters", counters);
514 template(args).instantiate(providers.getMetaAccess(), writeBarrierPost, DEFAULT_REPLACER, args);
515 }
516
517 public void lower(G1ArrayRangePreWriteBarrier arrayRangeWriteBarrier, HotSpotRegistersProvider registers, LoweringTool tool) {
518 Arguments args = new Arguments(g1ArrayRangePreWriteBarrier, arrayRangeWriteBarrier.graph().getGuardsStage(), tool.getLoweringStage());
519 args.add("object", arrayRangeWriteBarrier.getObject());
520 args.add("startIndex", arrayRangeWriteBarrier.getStartIndex());
521 args.add("length", arrayRangeWriteBarrier.getLength());
522 args.addConst("threadRegister", registers.getThreadRegister());
523 template(args).instantiate(providers.getMetaAccess(), arrayRangeWriteBarrier, DEFAULT_REPLACER, args);
524 }
525
526 public void lower(G1ArrayRangePostWriteBarrier arrayRangeWriteBarrier, HotSpotRegistersProvider registers, LoweringTool tool) {
527 Arguments args = new Arguments(g1ArrayRangePostWriteBarrier, arrayRangeWriteBarrier.graph().getGuardsStage(), tool.getLoweringStage());
528 args.add("object", arrayRangeWriteBarrier.getObject());
529 args.add("startIndex", arrayRangeWriteBarrier.getStartIndex());
530 args.add("length", arrayRangeWriteBarrier.getLength());
531 args.addConst("threadRegister", registers.getThreadRegister());
532 template(args).instantiate(providers.getMetaAccess(), arrayRangeWriteBarrier, DEFAULT_REPLACER, args);
533 }
534 }
535
536 /**
537 * Log method of debugging purposes.
538 */
539 public static void log(boolean enabled, String format, long value) {
540 if (enabled) {
541 Log.printf(format, value);
542 }
543 }
544
545 public static void log(boolean enabled, String format, long value1, long value2) {
546 if (enabled) {
547 Log.printf(format, value1, value2);
548 }
549 }
550
551 public static void log(boolean enabled, String format, long value1, long value2, long value3) {
552 if (enabled) {
|
32 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.g1CardQueueIndexOffset;
33 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.g1SATBQueueBufferOffset;
34 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.g1SATBQueueIndexOffset;
35 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.g1SATBQueueMarkingOffset;
36 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.g1YoungCardValue;
37 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord;
38 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.verifyOop;
39 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.verifyOops;
40 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.wordSize;
41 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.FREQUENT_PROBABILITY;
42 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.LIKELY_PROBABILITY;
43 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.NOT_FREQUENT_PROBABILITY;
44 import static org.graalvm.compiler.nodes.extended.BranchProbabilityNode.probability;
45 import static org.graalvm.compiler.replacements.SnippetTemplate.DEFAULT_REPLACER;
46
47 import org.graalvm.compiler.api.replacements.Snippet;
48 import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
49 import org.graalvm.compiler.core.common.CompressEncoding;
50 import org.graalvm.compiler.core.common.GraalOptions;
51 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
52 import org.graalvm.compiler.debug.DebugHandlersFactory;
53 import org.graalvm.compiler.graph.Node.ConstantNodeParameter;
54 import org.graalvm.compiler.graph.Node.NodeIntrinsic;
55 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
56 import org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider;
57 import org.graalvm.compiler.hotspot.nodes.G1ArrayRangePostWriteBarrier;
58 import org.graalvm.compiler.hotspot.nodes.G1ArrayRangePreWriteBarrier;
59 import org.graalvm.compiler.hotspot.nodes.G1PostWriteBarrier;
60 import org.graalvm.compiler.hotspot.nodes.G1PreWriteBarrier;
61 import org.graalvm.compiler.hotspot.nodes.G1ReferentFieldReadBarrier;
62 import org.graalvm.compiler.hotspot.nodes.GetObjectAddressNode;
63 import org.graalvm.compiler.hotspot.nodes.GraalHotSpotVMConfigNode;
64 import org.graalvm.compiler.hotspot.nodes.HotSpotCompressionNode;
65 import org.graalvm.compiler.hotspot.nodes.SerialArrayRangeWriteBarrier;
66 import org.graalvm.compiler.hotspot.nodes.SerialWriteBarrier;
67 import org.graalvm.compiler.hotspot.nodes.VMErrorNode;
68 import org.graalvm.compiler.nodes.NamedLocationIdentity;
69 import org.graalvm.compiler.nodes.StructuredGraph;
70 import org.graalvm.compiler.nodes.ValueNode;
71 import org.graalvm.compiler.nodes.extended.FixedValueAnchorNode;
72 import org.graalvm.compiler.nodes.extended.ForeignCallNode;
390
391 public static final ForeignCallDescriptor G1WBPOSTCALL = new ForeignCallDescriptor("write_barrier_post", void.class, Word.class);
392
393 @NodeIntrinsic(ForeignCallNode.class)
394 public static native void g1PostBarrierStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word card);
395
396 public static class Templates extends AbstractTemplates {
397
398 private final SnippetInfo serialImpreciseWriteBarrier = snippet(WriteBarrierSnippets.class, "serialImpreciseWriteBarrier", GC_CARD_LOCATION);
399 private final SnippetInfo serialPreciseWriteBarrier = snippet(WriteBarrierSnippets.class, "serialPreciseWriteBarrier", GC_CARD_LOCATION);
400 private final SnippetInfo serialArrayRangeWriteBarrier = snippet(WriteBarrierSnippets.class, "serialArrayRangeWriteBarrier");
401 private final SnippetInfo g1PreWriteBarrier = snippet(WriteBarrierSnippets.class, "g1PreWriteBarrier", GC_INDEX_LOCATION, GC_LOG_LOCATION);
402 private final SnippetInfo g1ReferentReadBarrier = snippet(WriteBarrierSnippets.class, "g1PreWriteBarrier", GC_INDEX_LOCATION, GC_LOG_LOCATION);
403 private final SnippetInfo g1PostWriteBarrier = snippet(WriteBarrierSnippets.class, "g1PostWriteBarrier", GC_CARD_LOCATION, GC_INDEX_LOCATION, GC_LOG_LOCATION);
404 private final SnippetInfo g1ArrayRangePreWriteBarrier = snippet(WriteBarrierSnippets.class, "g1ArrayRangePreWriteBarrier", GC_INDEX_LOCATION, GC_LOG_LOCATION);
405 private final SnippetInfo g1ArrayRangePostWriteBarrier = snippet(WriteBarrierSnippets.class, "g1ArrayRangePostWriteBarrier", GC_CARD_LOCATION, GC_INDEX_LOCATION, GC_LOG_LOCATION);
406
407 private final CompressEncoding oopEncoding;
408 private final Counters counters;
409
410 public Templates(OptionValues options, Iterable<DebugHandlersFactory> factories, SnippetCounter.Group.Factory factory, HotSpotProviders providers, TargetDescription target,
411 CompressEncoding oopEncoding) {
412 super(options, factories, providers, providers.getSnippetReflection(), target);
413 this.oopEncoding = oopEncoding;
414 this.counters = new Counters(factory);
415 }
416
417 public void lower(SerialWriteBarrier writeBarrier, LoweringTool tool) {
418 Arguments args;
419 if (writeBarrier.usePrecise()) {
420 args = new Arguments(serialPreciseWriteBarrier, writeBarrier.graph().getGuardsStage(), tool.getLoweringStage());
421 args.add("address", writeBarrier.getAddress());
422 } else {
423 args = new Arguments(serialImpreciseWriteBarrier, writeBarrier.graph().getGuardsStage(), tool.getLoweringStage());
424 OffsetAddressNode address = (OffsetAddressNode) writeBarrier.getAddress();
425 args.add("object", address.getBase());
426 }
427 args.addConst("counters", counters);
428 template(writeBarrier.getDebug(), args).instantiate(providers.getMetaAccess(), writeBarrier, DEFAULT_REPLACER, args);
429 }
430
431 public void lower(SerialArrayRangeWriteBarrier arrayRangeWriteBarrier, LoweringTool tool) {
432 Arguments args = new Arguments(serialArrayRangeWriteBarrier, arrayRangeWriteBarrier.graph().getGuardsStage(), tool.getLoweringStage());
433 args.add("object", arrayRangeWriteBarrier.getObject());
434 args.add("startIndex", arrayRangeWriteBarrier.getStartIndex());
435 args.add("length", arrayRangeWriteBarrier.getLength());
436 template(arrayRangeWriteBarrier.getDebug(), args).instantiate(providers.getMetaAccess(), arrayRangeWriteBarrier, DEFAULT_REPLACER, args);
437 }
438
439 public void lower(G1PreWriteBarrier writeBarrierPre, HotSpotRegistersProvider registers, LoweringTool tool) {
440 Arguments args = new Arguments(g1PreWriteBarrier, writeBarrierPre.graph().getGuardsStage(), tool.getLoweringStage());
441 AddressNode address = writeBarrierPre.getAddress();
442 args.add("address", address);
443 if (address instanceof OffsetAddressNode) {
444 args.add("object", ((OffsetAddressNode) address).getBase());
445 } else {
446 args.add("object", null);
447 }
448
449 ValueNode expected = writeBarrierPre.getExpectedObject();
450 if (expected != null && expected.stamp() instanceof NarrowOopStamp) {
451 assert oopEncoding != null;
452 expected = HotSpotCompressionNode.uncompress(expected, oopEncoding);
453 }
454 args.add("expectedObject", expected);
455
456 args.addConst("doLoad", writeBarrierPre.doLoad());
457 args.addConst("nullCheck", writeBarrierPre.getNullCheck());
458 args.addConst("threadRegister", registers.getThreadRegister());
459 args.addConst("trace", traceBarrier(writeBarrierPre.graph()));
460 args.addConst("counters", counters);
461 template(writeBarrierPre.getDebug(), args).instantiate(providers.getMetaAccess(), writeBarrierPre, DEFAULT_REPLACER, args);
462 }
463
464 public void lower(G1ReferentFieldReadBarrier readBarrier, HotSpotRegistersProvider registers, LoweringTool tool) {
465 Arguments args = new Arguments(g1ReferentReadBarrier, readBarrier.graph().getGuardsStage(), tool.getLoweringStage());
466 AddressNode address = readBarrier.getAddress();
467 args.add("address", address);
468 if (address instanceof OffsetAddressNode) {
469 args.add("object", ((OffsetAddressNode) address).getBase());
470 } else {
471 args.add("object", null);
472 }
473
474 ValueNode expected = readBarrier.getExpectedObject();
475 if (expected != null && expected.stamp() instanceof NarrowOopStamp) {
476 assert oopEncoding != null;
477 expected = HotSpotCompressionNode.uncompress(expected, oopEncoding);
478 }
479
480 args.add("expectedObject", expected);
481 args.addConst("doLoad", readBarrier.doLoad());
482 args.addConst("nullCheck", false);
483 args.addConst("threadRegister", registers.getThreadRegister());
484 args.addConst("trace", traceBarrier(readBarrier.graph()));
485 args.addConst("counters", counters);
486 template(readBarrier.getDebug(), args).instantiate(providers.getMetaAccess(), readBarrier, DEFAULT_REPLACER, args);
487 }
488
489 public void lower(G1PostWriteBarrier writeBarrierPost, HotSpotRegistersProvider registers, LoweringTool tool) {
490 StructuredGraph graph = writeBarrierPost.graph();
491 if (writeBarrierPost.alwaysNull()) {
492 graph.removeFixed(writeBarrierPost);
493 return;
494 }
495 Arguments args = new Arguments(g1PostWriteBarrier, graph.getGuardsStage(), tool.getLoweringStage());
496 AddressNode address = writeBarrierPost.getAddress();
497 args.add("address", address);
498 if (address instanceof OffsetAddressNode) {
499 args.add("object", ((OffsetAddressNode) address).getBase());
500 } else {
501 assert writeBarrierPost.usePrecise() : "found imprecise barrier that's not an object access " + writeBarrierPost;
502 args.add("object", null);
503 }
504
505 ValueNode value = writeBarrierPost.getValue();
506 if (value.stamp() instanceof NarrowOopStamp) {
507 assert oopEncoding != null;
508 value = HotSpotCompressionNode.uncompress(value, oopEncoding);
509 }
510 args.add("value", value);
511
512 args.addConst("usePrecise", writeBarrierPost.usePrecise());
513 args.addConst("threadRegister", registers.getThreadRegister());
514 args.addConst("trace", traceBarrier(writeBarrierPost.graph()));
515 args.addConst("counters", counters);
516 template(graph.getDebug(), args).instantiate(providers.getMetaAccess(), writeBarrierPost, DEFAULT_REPLACER, args);
517 }
518
519 public void lower(G1ArrayRangePreWriteBarrier arrayRangeWriteBarrier, HotSpotRegistersProvider registers, LoweringTool tool) {
520 Arguments args = new Arguments(g1ArrayRangePreWriteBarrier, arrayRangeWriteBarrier.graph().getGuardsStage(), tool.getLoweringStage());
521 args.add("object", arrayRangeWriteBarrier.getObject());
522 args.add("startIndex", arrayRangeWriteBarrier.getStartIndex());
523 args.add("length", arrayRangeWriteBarrier.getLength());
524 args.addConst("threadRegister", registers.getThreadRegister());
525 template(arrayRangeWriteBarrier.getDebug(), args).instantiate(providers.getMetaAccess(), arrayRangeWriteBarrier, DEFAULT_REPLACER, args);
526 }
527
528 public void lower(G1ArrayRangePostWriteBarrier arrayRangeWriteBarrier, HotSpotRegistersProvider registers, LoweringTool tool) {
529 Arguments args = new Arguments(g1ArrayRangePostWriteBarrier, arrayRangeWriteBarrier.graph().getGuardsStage(), tool.getLoweringStage());
530 args.add("object", arrayRangeWriteBarrier.getObject());
531 args.add("startIndex", arrayRangeWriteBarrier.getStartIndex());
532 args.add("length", arrayRangeWriteBarrier.getLength());
533 args.addConst("threadRegister", registers.getThreadRegister());
534 template(arrayRangeWriteBarrier.getDebug(), args).instantiate(providers.getMetaAccess(), arrayRangeWriteBarrier, DEFAULT_REPLACER, args);
535 }
536 }
537
538 /**
539 * Log method of debugging purposes.
540 */
541 public static void log(boolean enabled, String format, long value) {
542 if (enabled) {
543 Log.printf(format, value);
544 }
545 }
546
547 public static void log(boolean enabled, String format, long value1, long value2) {
548 if (enabled) {
549 Log.printf(format, value1, value2);
550 }
551 }
552
553 public static void log(boolean enabled, String format, long value1, long value2, long value3) {
554 if (enabled) {
|