src/hotspot/share/oops/method.hpp
changeset 54042 6dd6f988b4e4
parent 53904 9c3fe09f69bc
child 54432 532e88de77eb
equal deleted inserted replaced
54041:bba6644b6fe3 54042:6dd6f988b4e4
  1020   CompressedLineNumberWriteStream(u_char* buffer, int initial_size) : CompressedWriteStream(buffer, initial_size), _bci(0), _line(0) {}
  1020   CompressedLineNumberWriteStream(u_char* buffer, int initial_size) : CompressedWriteStream(buffer, initial_size), _bci(0), _line(0) {}
  1021 
  1021 
  1022   // Write (bci, line number) pair to stream
  1022   // Write (bci, line number) pair to stream
  1023   void write_pair_regular(int bci_delta, int line_delta);
  1023   void write_pair_regular(int bci_delta, int line_delta);
  1024 
  1024 
  1025   inline void write_pair_inline(int bci, int line) {
  1025   // If (bci delta, line delta) fits in (5-bit unsigned, 3-bit unsigned)
  1026     int bci_delta = bci - _bci;
  1026   // we save it as one byte, otherwise we write a 0xFF escape character
  1027     int line_delta = line - _line;
  1027   // and use regular compression. 0x0 is used as end-of-stream terminator.
  1028     _bci = bci;
  1028   void write_pair_inline(int bci, int line);
  1029     _line = line;
  1029 
  1030     // Skip (0,0) deltas - they do not add information and conflict with terminator.
       
  1031     if (bci_delta == 0 && line_delta == 0) return;
       
  1032     // Check if bci is 5-bit and line number 3-bit unsigned.
       
  1033     if (((bci_delta & ~0x1F) == 0) && ((line_delta & ~0x7) == 0)) {
       
  1034       // Compress into single byte.
       
  1035       jubyte value = ((jubyte) bci_delta << 3) | (jubyte) line_delta;
       
  1036       // Check that value doesn't match escape character.
       
  1037       if (value != 0xFF) {
       
  1038         write_byte(value);
       
  1039         return;
       
  1040       }
       
  1041     }
       
  1042     write_pair_regular(bci_delta, line_delta);
       
  1043   }
       
  1044 
       
  1045 // Windows AMD64 + Apr 2005 PSDK with /O2 generates bad code for write_pair.
       
  1046 // Disabling optimization doesn't work for methods in header files
       
  1047 // so we force it to call through the non-optimized version in the .cpp.
       
  1048 // It's gross, but it's the only way we can ensure that all callers are
       
  1049 // fixed.  _MSC_VER is defined by the windows compiler
       
  1050 #if defined(_M_AMD64) && _MSC_VER >= 1400
       
  1051   void write_pair(int bci, int line);
  1030   void write_pair(int bci, int line);
  1052 #else
       
  1053   void write_pair(int bci, int line) { write_pair_inline(bci, line); }
       
  1054 #endif
       
  1055 
  1031 
  1056   // Write end-of-stream marker
  1032   // Write end-of-stream marker
  1057   void write_terminator()                        { write_byte(0); }
  1033   void write_terminator()                        { write_byte(0); }
  1058 };
  1034 };
  1059 
  1035