367 CompileLog* log() { return _log; } |
367 CompileLog* log() { return _log; } |
368 |
368 |
369 void copy_to(nmethod* nm); |
369 void copy_to(nmethod* nm); |
370 |
370 |
371 void log_all_dependencies(); |
371 void log_all_dependencies(); |
372 void log_dependency(DepType dept, int nargs, ciBaseObject* args[]) { |
372 |
373 write_dependency_to(log(), dept, nargs, args); |
373 void log_dependency(DepType dept, GrowableArray<ciBaseObject*>* args) { |
374 } |
374 ResourceMark rm; |
|
375 int argslen = args->length(); |
|
376 write_dependency_to(log(), dept, args); |
|
377 guarantee(argslen == args->length(), |
|
378 "args array cannot grow inside nested ResoureMark scope"); |
|
379 } |
|
380 |
375 void log_dependency(DepType dept, |
381 void log_dependency(DepType dept, |
376 ciBaseObject* x0, |
382 ciBaseObject* x0, |
377 ciBaseObject* x1 = NULL, |
383 ciBaseObject* x1 = NULL, |
378 ciBaseObject* x2 = NULL) { |
384 ciBaseObject* x2 = NULL) { |
379 if (log() == NULL) return; |
385 if (log() == NULL) { |
380 ciBaseObject* args[max_arg_count]; |
386 return; |
381 args[0] = x0; |
387 } |
382 args[1] = x1; |
388 ResourceMark rm; |
383 args[2] = x2; |
389 GrowableArray<ciBaseObject*>* ciargs = |
384 assert(2 < max_arg_count, ""); |
390 new GrowableArray<ciBaseObject*>(dep_args(dept)); |
385 log_dependency(dept, dep_args(dept), args); |
391 assert (x0 != NULL, "no log x0"); |
|
392 ciargs->push(x0); |
|
393 |
|
394 if (x1 != NULL) { |
|
395 ciargs->push(x1); |
|
396 } |
|
397 if (x2 != NULL) { |
|
398 ciargs->push(x2); |
|
399 } |
|
400 assert(ciargs->length() == dep_args(dept), ""); |
|
401 log_dependency(dept, ciargs); |
386 } |
402 } |
387 |
403 |
388 class DepArgument : public ResourceObj { |
404 class DepArgument : public ResourceObj { |
389 private: |
405 private: |
390 bool _is_oop; |
406 bool _is_oop; |
403 |
419 |
404 oop oop_value() const { assert(_is_oop && _valid, "must be"); return (oop) _value; } |
420 oop oop_value() const { assert(_is_oop && _valid, "must be"); return (oop) _value; } |
405 Metadata* metadata_value() const { assert(!_is_oop && _valid, "must be"); return (Metadata*) _value; } |
421 Metadata* metadata_value() const { assert(!_is_oop && _valid, "must be"); return (Metadata*) _value; } |
406 }; |
422 }; |
407 |
423 |
|
424 static void print_dependency(DepType dept, |
|
425 GrowableArray<DepArgument>* args, |
|
426 Klass* witness = NULL); |
|
427 |
|
428 private: |
|
429 // helper for encoding common context types as zero: |
|
430 static ciKlass* ctxk_encoded_as_null(DepType dept, ciBaseObject* x); |
|
431 |
|
432 static Klass* ctxk_encoded_as_null(DepType dept, Metadata* x); |
|
433 |
408 static void write_dependency_to(CompileLog* log, |
434 static void write_dependency_to(CompileLog* log, |
409 DepType dept, |
435 DepType dept, |
410 int nargs, ciBaseObject* args[], |
436 GrowableArray<ciBaseObject*>* args, |
411 Klass* witness = NULL); |
437 Klass* witness = NULL); |
412 static void write_dependency_to(CompileLog* log, |
438 static void write_dependency_to(CompileLog* log, |
413 DepType dept, |
439 DepType dept, |
414 int nargs, DepArgument args[], |
440 GrowableArray<DepArgument>* args, |
415 Klass* witness = NULL); |
441 Klass* witness = NULL); |
416 static void write_dependency_to(xmlStream* xtty, |
442 static void write_dependency_to(xmlStream* xtty, |
417 DepType dept, |
443 DepType dept, |
418 int nargs, DepArgument args[], |
444 GrowableArray<DepArgument>* args, |
419 Klass* witness = NULL); |
445 Klass* witness = NULL); |
420 static void print_dependency(DepType dept, |
|
421 int nargs, DepArgument args[], |
|
422 Klass* witness = NULL); |
|
423 |
|
424 private: |
|
425 // helper for encoding common context types as zero: |
|
426 static ciKlass* ctxk_encoded_as_null(DepType dept, ciBaseObject* x); |
|
427 |
|
428 static Klass* ctxk_encoded_as_null(DepType dept, Metadata* x); |
|
429 |
|
430 public: |
446 public: |
431 // Use this to iterate over an nmethod's dependency set. |
447 // Use this to iterate over an nmethod's dependency set. |
432 // Works on new and old dependency sets. |
448 // Works on new and old dependency sets. |
433 // Usage: |
449 // Usage: |
434 // |
450 // |