hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/CodeSectionProcessor.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File jdk10hs Sdiff hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc

hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/CodeSectionProcessor.java

Print this page




  51 
  52     /**
  53      * Method that looks at code section of a compiled result {@code compClass} and records function
  54      * entry point symbols along with the text section contents. Note that the text section contents
  55      * are not yet ready to be written in the form of a binary text section since the contents may
  56      * need to be patched with references to other sections.
  57      *
  58      * @param compClass Graal compilation result.
  59      */
  60     void process(AOTCompiledClass compClass) {
  61         ArrayList<CompiledMethodInfo> compiledMethods = compClass.getCompiledMethods();
  62 
  63         for (CompiledMethodInfo methodInfo : compiledMethods) {
  64             CompilationResult compResult = methodInfo.getCompilationResult();
  65 
  66             byte[] targetCode = compResult.getTargetCode();
  67             int targetCodeSize = compResult.getTargetCodeSize();
  68             JavaMethodInfo compMethod = methodInfo.getMethodInfo();
  69 
  70             // Step through all foreign calls, for every call, clear destination.
  71             // Otherwise libelf may not patch them correctly.
  72             for (Infopoint infopoint : compResult.getInfopoints()) {
  73                 if (infopoint.reason == InfopointReason.CALL) {
  74                     final Call callInfopoint = (Call) infopoint;
  75                     if (callInfopoint.target instanceof HotSpotForeignCallLinkage) {
  76                         // TODO 4 is x86 size of relative displacement.
  77                         // For SPARC need something different.
  78                         int destOffset = infopoint.pcOffset + callInfopoint.size - 4;
  79                         targetCode[destOffset + 0] = 0;
  80                         targetCode[destOffset + 1] = 0;
  81                         targetCode[destOffset + 2] = 0;
  82                         targetCode[destOffset + 3] = 0;
  83                     }
  84                 }
  85             }
  86 
  87             String entry = compMethod.getSymbolName();
  88             assert entry != null : "missing name for compiled method";
  89 
  90             // Align and pad method entry
  91             CodeContainer codeSection = binaryContainer.getCodeContainer();




  51 
  52     /**
  53      * Method that looks at code section of a compiled result {@code compClass} and records function
  54      * entry point symbols along with the text section contents. Note that the text section contents
  55      * are not yet ready to be written in the form of a binary text section since the contents may
  56      * need to be patched with references to other sections.
  57      *
  58      * @param compClass Graal compilation result.
  59      */
  60     void process(AOTCompiledClass compClass) {
  61         ArrayList<CompiledMethodInfo> compiledMethods = compClass.getCompiledMethods();
  62 
  63         for (CompiledMethodInfo methodInfo : compiledMethods) {
  64             CompilationResult compResult = methodInfo.getCompilationResult();
  65 
  66             byte[] targetCode = compResult.getTargetCode();
  67             int targetCodeSize = compResult.getTargetCodeSize();
  68             JavaMethodInfo compMethod = methodInfo.getMethodInfo();
  69 
  70             // Step through all foreign calls, for every call, clear destination.

  71             for (Infopoint infopoint : compResult.getInfopoints()) {
  72                 if (infopoint.reason == InfopointReason.CALL) {
  73                     final Call callInfopoint = (Call) infopoint;
  74                     if (callInfopoint.target instanceof HotSpotForeignCallLinkage) {
  75                         // TODO 4 is x86 size of relative displacement.
  76                         // For SPARC need something different.
  77                         int destOffset = infopoint.pcOffset + callInfopoint.size - 4;
  78                         targetCode[destOffset + 0] = 0;
  79                         targetCode[destOffset + 1] = 0;
  80                         targetCode[destOffset + 2] = 0;
  81                         targetCode[destOffset + 3] = 0;
  82                     }
  83                 }
  84             }
  85 
  86             String entry = compMethod.getSymbolName();
  87             assert entry != null : "missing name for compiled method";
  88 
  89             // Align and pad method entry
  90             CodeContainer codeSection = binaryContainer.getCodeContainer();


hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/CodeSectionProcessor.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File