Mercurial > hg > graal-jvmci-8
comparison src/share/vm/code/dependencies.hpp @ 20316:3c048df3ef8b
8040920: Uninitialised memory in hotspot/src/share/vm/code/dependencies.cpp
Summary: Fixed parfait initialization issue.
Reviewed-by: kvn, twisti
author | morris |
---|---|
date | Thu, 07 Aug 2014 18:09:12 -0700 |
parents | da91efe96a93 |
children | c4f1e23c4139 d5b74c583ec1 |
comparison
equal
deleted
inserted
replaced
20315:f5b4600d7368 | 20316:3c048df3ef8b |
---|---|
366 CompileLog* log() { return _log; } | 366 CompileLog* log() { return _log; } |
367 | 367 |
368 void copy_to(nmethod* nm); | 368 void copy_to(nmethod* nm); |
369 | 369 |
370 void log_all_dependencies(); | 370 void log_all_dependencies(); |
371 void log_dependency(DepType dept, int nargs, ciBaseObject* args[]) { | 371 |
372 write_dependency_to(log(), dept, nargs, args); | 372 void log_dependency(DepType dept, GrowableArray<ciBaseObject*>* args) { |
373 } | 373 ResourceMark rm; |
374 int argslen = args->length(); | |
375 write_dependency_to(log(), dept, args); | |
376 guarantee(argslen == args->length(), | |
377 "args array cannot grow inside nested ResoureMark scope"); | |
378 } | |
379 | |
374 void log_dependency(DepType dept, | 380 void log_dependency(DepType dept, |
375 ciBaseObject* x0, | 381 ciBaseObject* x0, |
376 ciBaseObject* x1 = NULL, | 382 ciBaseObject* x1 = NULL, |
377 ciBaseObject* x2 = NULL) { | 383 ciBaseObject* x2 = NULL) { |
378 if (log() == NULL) return; | 384 if (log() == NULL) { |
379 ciBaseObject* args[max_arg_count]; | 385 return; |
380 args[0] = x0; | 386 } |
381 args[1] = x1; | 387 ResourceMark rm; |
382 args[2] = x2; | 388 GrowableArray<ciBaseObject*>* ciargs = |
383 assert(2 < max_arg_count, ""); | 389 new GrowableArray<ciBaseObject*>(dep_args(dept)); |
384 log_dependency(dept, dep_args(dept), args); | 390 assert (x0 != NULL, "no log x0"); |
391 ciargs->push(x0); | |
392 | |
393 if (x1 != NULL) { | |
394 ciargs->push(x1); | |
395 } | |
396 if (x2 != NULL) { | |
397 ciargs->push(x2); | |
398 } | |
399 assert(ciargs->length() == dep_args(dept), ""); | |
400 log_dependency(dept, ciargs); | |
385 } | 401 } |
386 | 402 |
387 class DepArgument : public ResourceObj { | 403 class DepArgument : public ResourceObj { |
388 private: | 404 private: |
389 bool _is_oop; | 405 bool _is_oop; |
402 | 418 |
403 oop oop_value() const { assert(_is_oop && _valid, "must be"); return (oop) _value; } | 419 oop oop_value() const { assert(_is_oop && _valid, "must be"); return (oop) _value; } |
404 Metadata* metadata_value() const { assert(!_is_oop && _valid, "must be"); return (Metadata*) _value; } | 420 Metadata* metadata_value() const { assert(!_is_oop && _valid, "must be"); return (Metadata*) _value; } |
405 }; | 421 }; |
406 | 422 |
423 static void print_dependency(DepType dept, | |
424 GrowableArray<DepArgument>* args, | |
425 Klass* witness = NULL); | |
426 | |
427 private: | |
428 // helper for encoding common context types as zero: | |
429 static ciKlass* ctxk_encoded_as_null(DepType dept, ciBaseObject* x); | |
430 | |
431 static Klass* ctxk_encoded_as_null(DepType dept, Metadata* x); | |
432 | |
407 static void write_dependency_to(CompileLog* log, | 433 static void write_dependency_to(CompileLog* log, |
408 DepType dept, | 434 DepType dept, |
409 int nargs, ciBaseObject* args[], | 435 GrowableArray<ciBaseObject*>* args, |
410 Klass* witness = NULL); | 436 Klass* witness = NULL); |
411 static void write_dependency_to(CompileLog* log, | 437 static void write_dependency_to(CompileLog* log, |
412 DepType dept, | 438 DepType dept, |
413 int nargs, DepArgument args[], | 439 GrowableArray<DepArgument>* args, |
414 Klass* witness = NULL); | 440 Klass* witness = NULL); |
415 static void write_dependency_to(xmlStream* xtty, | 441 static void write_dependency_to(xmlStream* xtty, |
416 DepType dept, | 442 DepType dept, |
417 int nargs, DepArgument args[], | 443 GrowableArray<DepArgument>* args, |
418 Klass* witness = NULL); | 444 Klass* witness = NULL); |
419 static void print_dependency(DepType dept, | |
420 int nargs, DepArgument args[], | |
421 Klass* witness = NULL); | |
422 | |
423 private: | |
424 // helper for encoding common context types as zero: | |
425 static ciKlass* ctxk_encoded_as_null(DepType dept, ciBaseObject* x); | |
426 | |
427 static Klass* ctxk_encoded_as_null(DepType dept, Metadata* x); | |
428 | |
429 public: | 445 public: |
430 // Use this to iterate over an nmethod's dependency set. | 446 // Use this to iterate over an nmethod's dependency set. |
431 // Works on new and old dependency sets. | 447 // Works on new and old dependency sets. |
432 // Usage: | 448 // Usage: |
433 // | 449 // |