src/share/vm/shark/sharkBuilder.cpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2008, 2009, 2010 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/_sharkBuilder.cpp.incl"











  28 
  29 using namespace llvm;
  30 
  31 SharkBuilder::SharkBuilder(SharkCodeBuffer* code_buffer)
  32   : IRBuilder<>(SharkContext::current()),
  33     _code_buffer(code_buffer) {
  34 }
  35 
  36 // Helpers for accessing structures
  37 Value* SharkBuilder::CreateAddressOfStructEntry(Value*      base,
  38                                                 ByteSize    offset,
  39                                                 const Type* type,
  40                                                 const char* name) {
  41   return CreateBitCast(CreateStructGEP(base, in_bytes(offset)), type, name);
  42 }
  43 
  44 LoadInst* SharkBuilder::CreateValueOfStructEntry(Value*      base,
  45                                                  ByteSize    offset,
  46                                                  const Type* type,
  47                                                  const char* name) {


   1 /*
   2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2008, 2009, 2010 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/ciMethod.hpp"
  28 #include "memory/resourceArea.hpp"
  29 #include "oops/methodOop.hpp"
  30 #include "runtime/os.hpp"
  31 #include "runtime/synchronizer.hpp"
  32 #include "runtime/thread.hpp"
  33 #include "shark/llvmHeaders.hpp"
  34 #include "shark/llvmValue.hpp"
  35 #include "shark/sharkBuilder.hpp"
  36 #include "shark/sharkContext.hpp"
  37 #include "shark/sharkRuntime.hpp"
  38 #include "utilities/debug.hpp"
  39 
  40 using namespace llvm;
  41 
  42 SharkBuilder::SharkBuilder(SharkCodeBuffer* code_buffer)
  43   : IRBuilder<>(SharkContext::current()),
  44     _code_buffer(code_buffer) {
  45 }
  46 
  47 // Helpers for accessing structures
  48 Value* SharkBuilder::CreateAddressOfStructEntry(Value*      base,
  49                                                 ByteSize    offset,
  50                                                 const Type* type,
  51                                                 const char* name) {
  52   return CreateBitCast(CreateStructGEP(base, in_bytes(offset)), type, name);
  53 }
  54 
  55 LoadInst* SharkBuilder::CreateValueOfStructEntry(Value*      base,
  56                                                  ByteSize    offset,
  57                                                  const Type* type,
  58                                                  const char* name) {