1.1 --- a/src/share/vm/adlc/main.cpp Tue Nov 23 15:01:43 2010 -0500 1.2 +++ b/src/share/vm/adlc/main.cpp Tue Nov 23 13:22:55 2010 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -34,6 +34,17 @@ 1.11 1.12 ArchDesc* globalAD = NULL; // global reference to Architecture Description object 1.13 1.14 +const char* get_basename(const char* filename) { 1.15 + const char *basename = filename; 1.16 + const char *cp; 1.17 + for (cp = basename; *cp; cp++) { 1.18 + if (*cp == '/') { 1.19 + basename = cp+1; 1.20 + } 1.21 + } 1.22 + return basename; 1.23 +} 1.24 + 1.25 //------------------------------main------------------------------------------- 1.26 int main(int argc, char *argv[]) 1.27 { 1.28 @@ -193,16 +204,69 @@ 1.29 AD.addSunCopyright(legal_text, legal_sz, AD._CPP_PIPELINE_file._fp); // .cpp 1.30 AD.addSunCopyright(legal_text, legal_sz, AD._VM_file._fp); // .hpp 1.31 AD.addSunCopyright(legal_text, legal_sz, AD._DFA_file._fp); // .cpp 1.32 + // Add include guards for all .hpp files 1.33 + AD.addIncludeGuardStart(AD._HPP_file, "GENERATED_ADFILES_AD_HPP"); // .hpp 1.34 + AD.addIncludeGuardStart(AD._VM_file, "GENERATED_ADFILES_ADGLOBALS_HPP"); // .hpp 1.35 + // Add includes 1.36 + AD.addInclude(AD._CPP_file, "precompiled.hpp"); 1.37 + AD.addInclude(AD._CPP_file, "adfiles", get_basename(AD._VM_file._name)); 1.38 + AD.addInclude(AD._CPP_file, "adfiles", get_basename(AD._HPP_file._name)); 1.39 + AD.addInclude(AD._CPP_file, "memory/allocation.inline.hpp"); 1.40 + AD.addInclude(AD._CPP_file, "asm/assembler.hpp"); 1.41 + AD.addInclude(AD._CPP_file, "code/vmreg.hpp"); 1.42 + AD.addInclude(AD._CPP_file, "gc_interface/collectedHeap.inline.hpp"); 1.43 + AD.addInclude(AD._CPP_file, "oops/compiledICHolderOop.hpp"); 1.44 + AD.addInclude(AD._CPP_file, "oops/markOop.hpp"); 1.45 + AD.addInclude(AD._CPP_file, "oops/methodOop.hpp"); 1.46 + AD.addInclude(AD._CPP_file, "oops/oop.inline.hpp"); 1.47 + AD.addInclude(AD._CPP_file, "oops/oop.inline2.hpp"); 1.48 + AD.addInclude(AD._CPP_file, "opto/cfgnode.hpp"); 1.49 + AD.addInclude(AD._CPP_file, "opto/locknode.hpp"); 1.50 + AD.addInclude(AD._CPP_file, "opto/opcodes.hpp"); 1.51 + AD.addInclude(AD._CPP_file, "opto/regalloc.hpp"); 1.52 + AD.addInclude(AD._CPP_file, "opto/regmask.hpp"); 1.53 + AD.addInclude(AD._CPP_file, "opto/runtime.hpp"); 1.54 + AD.addInclude(AD._CPP_file, "runtime/biasedLocking.hpp"); 1.55 + AD.addInclude(AD._CPP_file, "runtime/sharedRuntime.hpp"); 1.56 + AD.addInclude(AD._CPP_file, "runtime/stubRoutines.hpp"); 1.57 + AD.addInclude(AD._CPP_file, "utilities/growableArray.hpp"); 1.58 +#ifdef TARGET_ARCH_x86 1.59 + AD.addInclude(AD._CPP_file, "assembler_x86.inline.hpp"); 1.60 + AD.addInclude(AD._CPP_file, "nativeInst_x86.hpp"); 1.61 + AD.addInclude(AD._CPP_file, "vmreg_x86.inline.hpp"); 1.62 +#endif 1.63 +#ifdef TARGET_ARCH_sparc 1.64 + AD.addInclude(AD._CPP_file, "assembler_sparc.inline.hpp"); 1.65 + AD.addInclude(AD._CPP_file, "nativeInst_sparc.hpp"); 1.66 + AD.addInclude(AD._CPP_file, "vmreg_sparc.inline.hpp"); 1.67 +#endif 1.68 + AD.addInclude(AD._HPP_file, "memory/allocation.hpp"); 1.69 + AD.addInclude(AD._HPP_file, "opto/machnode.hpp"); 1.70 + AD.addInclude(AD._HPP_file, "opto/node.hpp"); 1.71 + AD.addInclude(AD._HPP_file, "opto/regalloc.hpp"); 1.72 + AD.addInclude(AD._HPP_file, "opto/subnode.hpp"); 1.73 + AD.addInclude(AD._CPP_CLONE_file, "precompiled.hpp"); 1.74 + AD.addInclude(AD._CPP_CLONE_file, "adfiles", get_basename(AD._HPP_file._name)); 1.75 + AD.addInclude(AD._CPP_EXPAND_file, "precompiled.hpp"); 1.76 + AD.addInclude(AD._CPP_EXPAND_file, "adfiles", get_basename(AD._HPP_file._name)); 1.77 + AD.addInclude(AD._CPP_FORMAT_file, "precompiled.hpp"); 1.78 + AD.addInclude(AD._CPP_FORMAT_file, "adfiles", get_basename(AD._HPP_file._name)); 1.79 + AD.addInclude(AD._CPP_GEN_file, "precompiled.hpp"); 1.80 + AD.addInclude(AD._CPP_GEN_file, "adfiles", get_basename(AD._HPP_file._name)); 1.81 + AD.addInclude(AD._CPP_GEN_file, "opto/cfgnode.hpp"); 1.82 + AD.addInclude(AD._CPP_GEN_file, "opto/locknode.hpp"); 1.83 + AD.addInclude(AD._CPP_MISC_file, "precompiled.hpp"); 1.84 + AD.addInclude(AD._CPP_MISC_file, "adfiles", get_basename(AD._HPP_file._name)); 1.85 + AD.addInclude(AD._CPP_PEEPHOLE_file, "precompiled.hpp"); 1.86 + AD.addInclude(AD._CPP_PEEPHOLE_file, "adfiles", get_basename(AD._HPP_file._name)); 1.87 + AD.addInclude(AD._CPP_PIPELINE_file, "precompiled.hpp"); 1.88 + AD.addInclude(AD._CPP_PIPELINE_file, "adfiles", get_basename(AD._HPP_file._name)); 1.89 + AD.addInclude(AD._DFA_file, "precompiled.hpp"); 1.90 + AD.addInclude(AD._DFA_file, "adfiles", get_basename(AD._HPP_file._name)); 1.91 + AD.addInclude(AD._DFA_file, "opto/matcher.hpp"); 1.92 + AD.addInclude(AD._DFA_file, "opto/opcodes.hpp"); 1.93 // Make sure each .cpp file starts with include lines: 1.94 // files declaring and defining generators for Mach* Objects (hpp,cpp) 1.95 - AD.machineDependentIncludes(AD._CPP_file); // .cpp 1.96 - AD.machineDependentIncludes(AD._CPP_CLONE_file); // .cpp 1.97 - AD.machineDependentIncludes(AD._CPP_EXPAND_file); // .cpp 1.98 - AD.machineDependentIncludes(AD._CPP_FORMAT_file); // .cpp 1.99 - AD.machineDependentIncludes(AD._CPP_GEN_file); // .cpp 1.100 - AD.machineDependentIncludes(AD._CPP_MISC_file); // .cpp 1.101 - AD.machineDependentIncludes(AD._CPP_PEEPHOLE_file); // .cpp 1.102 - AD.machineDependentIncludes(AD._CPP_PIPELINE_file); // .cpp 1.103 // Generate the result files: 1.104 // enumerations, class definitions, object generators, and the DFA 1.105 // file containing enumeration of machine operands & instructions (hpp) 1.106 @@ -244,8 +308,10 @@ 1.107 AD.addPreprocessorChecks(AD._CPP_PIPELINE_file._fp); // .cpp 1.108 1.109 // define the finite automata that selects lowest cost production 1.110 - AD.machineDependentIncludes(AD._DFA_file); // .cpp 1.111 AD.buildDFA(AD._DFA_file._fp); 1.112 + // Add include guards for all .hpp files 1.113 + AD.addIncludeGuardEnd(AD._HPP_file, "GENERATED_ADFILES_AD_HPP"); // .hpp 1.114 + AD.addIncludeGuardEnd(AD._VM_file, "GENERATED_ADFILES_ADGLOBALS_HPP"); // .hpp 1.115 1.116 AD.close_files(0); // Close all input/output files 1.117