comparison graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java @ 11234:73eb4d8a4015

Change scope of logging methods
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Wed, 07 Aug 2013 14:06:10 +0200
parents 8d4bd13c6983
children cc5473cf32bb
comparison
equal deleted inserted replaced
11233:5a9d68c3a7d7 11234:73eb4d8a4015
320 private static native void g1PreBarrierStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Object object); 320 private static native void g1PreBarrierStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Object object);
321 321
322 public static final ForeignCallDescriptor G1WBPOSTCALL = new ForeignCallDescriptor("write_barrier_post", void.class, Word.class); 322 public static final ForeignCallDescriptor G1WBPOSTCALL = new ForeignCallDescriptor("write_barrier_post", void.class, Word.class);
323 323
324 @NodeIntrinsic(ForeignCallNode.class) 324 @NodeIntrinsic(ForeignCallNode.class)
325 private static native void g1PostBarrierStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word card); 325 public static native void g1PostBarrierStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word card);
326 326
327 public static class Templates extends AbstractTemplates { 327 public static class Templates extends AbstractTemplates {
328 328
329 private final SnippetInfo serialWriteBarrier = snippet(WriteBarrierSnippets.class, "serialWriteBarrier"); 329 private final SnippetInfo serialWriteBarrier = snippet(WriteBarrierSnippets.class, "serialWriteBarrier");
330 private final SnippetInfo serialArrayRangeWriteBarrier = snippet(WriteBarrierSnippets.class, "serialArrayRangeWriteBarrier"); 330 private final SnippetInfo serialArrayRangeWriteBarrier = snippet(WriteBarrierSnippets.class, "serialArrayRangeWriteBarrier");
406 } 406 }
407 407
408 /** 408 /**
409 * Log method of debugging purposes. 409 * Log method of debugging purposes.
410 */ 410 */
411 private static void log(boolean enabled, String format, long value) { 411 public static void log(boolean enabled, String format, long value) {
412 if (enabled) { 412 if (enabled) {
413 Log.printf(format, value); 413 Log.printf(format, value);
414 } 414 }
415 } 415 }
416 416
417 private static void log(boolean enabled, String format, long value1, long value2) { 417 public static void log(boolean enabled, String format, long value1, long value2) {
418 if (enabled) { 418 if (enabled) {
419 Log.printf(format, value1, value2); 419 Log.printf(format, value1, value2);
420 } 420 }
421 } 421 }
422 422
423 private static void log(boolean enabled, String format, long value1, long value2, long value3) { 423 public static void log(boolean enabled, String format, long value1, long value2, long value3) {
424 if (enabled) { 424 if (enabled) {
425 Log.printf(format, value1, value2, value3); 425 Log.printf(format, value1, value2, value3);
426 } 426 }
427 } 427 }
428 428
429 private static boolean traceBarrier() { 429 public static boolean traceBarrier() {
430 return GraalOptions.GCDebugStartCycle.getValue() > 0 && ((int) Word.unsigned(HotSpotReplacementsUtil.gcTotalCollectionsAddress()).readLong(0) > GraalOptions.GCDebugStartCycle.getValue()); 430 return GraalOptions.GCDebugStartCycle.getValue() > 0 && ((int) Word.unsigned(HotSpotReplacementsUtil.gcTotalCollectionsAddress()).readLong(0) > GraalOptions.GCDebugStartCycle.getValue());
431 } 431 }
432 432
433 /** 433 /**
434 * Validation helper method which performs sanity checks on write operations. The addresses of 434 * Validation helper method which performs sanity checks on write operations. The addresses of
435 * both the object and the value being written are checked in order to determine if they reside 435 * both the object and the value being written are checked in order to determine if they reside
436 * in a valid heap region. If an object is stale, an invalid access is performed in order to 436 * in a valid heap region. If an object is stale, an invalid access is performed in order to
437 * prematurely crash the VM and debug the stack trace of the faulty method. 437 * prematurely crash the VM and debug the stack trace of the faulty method.
438 */ 438 */
439 private static void validateObject(Object parent, Object child) { 439 public static void validateObject(Object parent, Object child) {
440 if (verifyOops() && child != null && !validateOop(VALIDATE_OBJECT, parent, child)) { 440 if (verifyOops() && child != null && !validateOop(VALIDATE_OBJECT, parent, child)) {
441 log(true, "Verification ERROR, Parent: %p Child: %p\n", Word.fromObject(parent).rawValue(), Word.fromObject(child).rawValue()); 441 log(true, "Verification ERROR, Parent: %p Child: %p\n", Word.fromObject(parent).rawValue(), Word.fromObject(child).rawValue());
442 DirectObjectStoreNode.storeWord(null, 0, 0, Word.zero()); 442 DirectObjectStoreNode.storeWord(null, 0, 0, Word.zero());
443 } 443 }
444 } 444 }