Mercurial > hg > graal-compiler
comparison src/share/vm/compiler/disassembler.cpp @ 6933:3d701c802d01
8000489: older builds of hsdis don't work anymore after 6879063
Summary: The old function not defined properly, need a definition for export in dll. Also changes made to let new jvm work with old hsdis.
Reviewed-by: jrose, sspitsyn, kmo
Contributed-by: yumin.qi@oracle.com
author | minqi |
---|---|
date | Fri, 02 Nov 2012 13:30:47 -0700 |
parents | f2e12eb74117 |
children | 070d523b96a7 |
comparison
equal
deleted
inserted
replaced
6931:ca8168203393 | 6933:3d701c802d01 |
---|---|
53 | 53 |
54 void* Disassembler::_library = NULL; | 54 void* Disassembler::_library = NULL; |
55 bool Disassembler::_tried_to_load_library = false; | 55 bool Disassembler::_tried_to_load_library = false; |
56 | 56 |
57 // This routine is in the shared library: | 57 // This routine is in the shared library: |
58 Disassembler::decode_func_virtual Disassembler::_decode_instructions_virtual = NULL; | |
58 Disassembler::decode_func Disassembler::_decode_instructions = NULL; | 59 Disassembler::decode_func Disassembler::_decode_instructions = NULL; |
59 | 60 |
60 static const char hsdis_library_name[] = "hsdis-"HOTSPOT_LIB_ARCH; | 61 static const char hsdis_library_name[] = "hsdis-"HOTSPOT_LIB_ARCH; |
61 static const char decode_instructions_name[] = "decode_instructions_virtual"; | 62 static const char decode_instructions_virtual_name[] = "decode_instructions_virtual"; |
62 | 63 static const char decode_instructions_name[] = "decode_instructions"; |
64 static bool use_new_version = true; | |
63 #define COMMENT_COLUMN 40 LP64_ONLY(+8) /*could be an option*/ | 65 #define COMMENT_COLUMN 40 LP64_ONLY(+8) /*could be an option*/ |
64 #define BYTES_COMMENT ";..." /* funky byte display comment */ | 66 #define BYTES_COMMENT ";..." /* funky byte display comment */ |
65 | 67 |
66 bool Disassembler::load_library() { | 68 bool Disassembler::load_library() { |
67 if (_decode_instructions != NULL) { | 69 if (_decode_instructions_virtual != NULL || _decode_instructions != NULL) { |
68 // Already succeeded. | 70 // Already succeeded. |
69 return true; | 71 return true; |
70 } | 72 } |
71 if (_tried_to_load_library) { | 73 if (_tried_to_load_library) { |
72 // Do not try twice. | 74 // Do not try twice. |
121 strcpy(&buf[0], hsdis_library_name); | 123 strcpy(&buf[0], hsdis_library_name); |
122 strcat(&buf[0], os::dll_file_extension()); | 124 strcat(&buf[0], os::dll_file_extension()); |
123 _library = os::dll_load(buf, ebuf, sizeof ebuf); | 125 _library = os::dll_load(buf, ebuf, sizeof ebuf); |
124 } | 126 } |
125 if (_library != NULL) { | 127 if (_library != NULL) { |
128 _decode_instructions_virtual = CAST_TO_FN_PTR(Disassembler::decode_func_virtual, | |
129 os::dll_lookup(_library, decode_instructions_virtual_name)); | |
130 } | |
131 if (_decode_instructions_virtual == NULL) { | |
132 // could not spot in new version, try old version | |
126 _decode_instructions = CAST_TO_FN_PTR(Disassembler::decode_func, | 133 _decode_instructions = CAST_TO_FN_PTR(Disassembler::decode_func, |
127 os::dll_lookup(_library, decode_instructions_name)); | 134 os::dll_lookup(_library, decode_instructions_name)); |
135 use_new_version = false; | |
136 } else { | |
137 use_new_version = true; | |
128 } | 138 } |
129 _tried_to_load_library = true; | 139 _tried_to_load_library = true; |
130 if (_decode_instructions == NULL) { | 140 if (_decode_instructions_virtual == NULL && _decode_instructions == NULL) { |
131 tty->print_cr("Could not load %s; %s; %s", buf, | 141 tty->print_cr("Could not load %s; %s; %s", buf, |
132 ((_library != NULL) | 142 ((_library != NULL) |
133 ? "entry point is missing" | 143 ? "entry point is missing" |
134 : (WizardMode || PrintMiscellaneous) | 144 : (WizardMode || PrintMiscellaneous) |
135 ? (const char*)ebuf | 145 ? (const char*)ebuf |
448 if (_print_raw) { | 458 if (_print_raw) { |
449 // Print whatever the library wants to print, w/o fancy callbacks. | 459 // Print whatever the library wants to print, w/o fancy callbacks. |
450 // This is mainly for debugging the library itself. | 460 // This is mainly for debugging the library itself. |
451 FILE* out = stdout; | 461 FILE* out = stdout; |
452 FILE* xmlout = (_print_raw > 1 ? out : NULL); | 462 FILE* xmlout = (_print_raw > 1 ? out : NULL); |
453 return (address) | 463 return use_new_version ? |
454 (*Disassembler::_decode_instructions)((uintptr_t)start, (uintptr_t)end, | 464 (address) |
455 start, end - start, | 465 (*Disassembler::_decode_instructions_virtual)((uintptr_t)start, (uintptr_t)end, |
466 start, end - start, | |
467 NULL, (void*) xmlout, | |
468 NULL, (void*) out, | |
469 options(), 0/*nice new line*/) | |
470 : | |
471 (address) | |
472 (*Disassembler::_decode_instructions)(start, end, | |
456 NULL, (void*) xmlout, | 473 NULL, (void*) xmlout, |
457 NULL, (void*) out, | 474 NULL, (void*) out, |
458 options()); | 475 options()); |
459 } | 476 } |
460 | 477 |
461 return (address) | 478 return use_new_version ? |
462 (*Disassembler::_decode_instructions)((uintptr_t)start, (uintptr_t)end, | 479 (address) |
463 start, end - start, | 480 (*Disassembler::_decode_instructions_virtual)((uintptr_t)start, (uintptr_t)end, |
481 start, end - start, | |
482 &event_to_env, (void*) this, | |
483 &printf_to_env, (void*) this, | |
484 options(), 0/*nice new line*/) | |
485 : | |
486 (address) | |
487 (*Disassembler::_decode_instructions)(start, end, | |
464 &event_to_env, (void*) this, | 488 &event_to_env, (void*) this, |
465 &printf_to_env, (void*) this, | 489 &printf_to_env, (void*) this, |
466 options()); | 490 options()); |
467 } | 491 } |
468 | 492 |