src/share/vm/prims/nativeLookup.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 # include "incls/_precompiled.incl"
  26 # include "incls/_nativeLookup.cpp.incl"


























  27 
  28 
  29 static void mangle_name_on(outputStream* st, symbolOop name, int begin, int end) {
  30   char* bytes = (char*)name->bytes() + begin;
  31   char* end_bytes = (char*)name->bytes() + end;
  32   while (bytes < end_bytes) {
  33     jchar c;
  34     bytes = UTF8::next(bytes, &c);
  35     if (c <= 0x7f && isalnum(c)) {
  36       st->put((char) c);
  37     } else {
  38            if (c == '_') st->print("_1");
  39       else if (c == '/') st->print("_");
  40       else if (c == ';') st->print("_2");
  41       else if (c == '[') st->print("_3");
  42       else               st->print("_%.5x", c);
  43     }
  44   }
  45 }
  46 


   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/javaClasses.hpp"
  27 #include "classfile/systemDictionary.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "memory/oopFactory.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "memory/universe.inline.hpp"
  32 #include "oops/instanceKlass.hpp"
  33 #include "oops/methodOop.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "oops/symbolOop.hpp"
  36 #include "prims/jvm_misc.hpp"
  37 #include "prims/nativeLookup.hpp"
  38 #include "runtime/arguments.hpp"
  39 #include "runtime/handles.inline.hpp"
  40 #include "runtime/hpi.hpp"
  41 #include "runtime/javaCalls.hpp"
  42 #include "runtime/sharedRuntime.hpp"
  43 #include "runtime/signature.hpp"
  44 #ifdef TARGET_OS_FAMILY_linux
  45 # include "os_linux.inline.hpp"
  46 #endif
  47 #ifdef TARGET_OS_FAMILY_solaris
  48 # include "os_solaris.inline.hpp"
  49 #endif
  50 #ifdef TARGET_OS_FAMILY_windows
  51 # include "os_windows.inline.hpp"
  52 #endif
  53 
  54 
  55 static void mangle_name_on(outputStream* st, symbolOop name, int begin, int end) {
  56   char* bytes = (char*)name->bytes() + begin;
  57   char* end_bytes = (char*)name->bytes() + end;
  58   while (bytes < end_bytes) {
  59     jchar c;
  60     bytes = UTF8::next(bytes, &c);
  61     if (c <= 0x7f && isalnum(c)) {
  62       st->put((char) c);
  63     } else {
  64            if (c == '_') st->print("_1");
  65       else if (c == '/') st->print("_");
  66       else if (c == ';') st->print("_2");
  67       else if (c == '[') st->print("_3");
  68       else               st->print("_%.5x", c);
  69     }
  70   }
  71 }
  72