src/share/vm/shark/sharkConstant.cpp

Print this page


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




  28 
  29 using namespace llvm;
  30 
  31 SharkConstant* SharkConstant::for_ldc(ciBytecodeStream *iter) {
  32   ciConstant constant = iter->get_constant();
  33   ciType *type = NULL;
  34   if (constant.basic_type() == T_OBJECT) {
  35     ciEnv *env = ciEnv::current();
  36     if (constant.as_object()->is_klass())
  37       type = env->Class_klass();
  38     else
  39       type = env->String_klass();
  40   }
  41   return new SharkConstant(constant, type);
  42 }
  43 
  44 SharkConstant* SharkConstant::for_field(ciBytecodeStream *iter) {
  45   bool will_link;
  46   ciField *field = iter->get_field(will_link);
  47   assert(will_link, "typeflow responsibility");


   1 /*
   2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2009 Red Hat, Inc.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "ci/ciInstance.hpp"
  28 #include "ci/ciStreams.hpp"
  29 #include "shark/sharkBuilder.hpp"
  30 #include "shark/sharkConstant.hpp"
  31 #include "shark/sharkValue.hpp"
  32 
  33 using namespace llvm;
  34 
  35 SharkConstant* SharkConstant::for_ldc(ciBytecodeStream *iter) {
  36   ciConstant constant = iter->get_constant();
  37   ciType *type = NULL;
  38   if (constant.basic_type() == T_OBJECT) {
  39     ciEnv *env = ciEnv::current();
  40     if (constant.as_object()->is_klass())
  41       type = env->Class_klass();
  42     else
  43       type = env->String_klass();
  44   }
  45   return new SharkConstant(constant, type);
  46 }
  47 
  48 SharkConstant* SharkConstant::for_field(ciBytecodeStream *iter) {
  49   bool will_link;
  50   ciField *field = iter->get_field(will_link);
  51   assert(will_link, "typeflow responsibility");