< prev index next >

src/share/vm/shark/sharkNativeWrapper.cpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 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.


  33 void SharkNativeWrapper::initialize(const char *name) {
  34   // Create the function
  35   _function = Function::Create(
  36     SharkType::entry_point_type(),
  37     GlobalVariable::InternalLinkage,
  38     name);
  39 
  40   // Get our arguments
  41   Function::arg_iterator ai = function()->arg_begin();
  42   Argument *method = ai++;
  43   method->setName("method");
  44   Argument *base_pc = ai++;
  45   base_pc->setName("base_pc");
  46   code_buffer()->set_base_pc(base_pc);
  47   Argument *thread = ai++;
  48   thread->setName("thread");
  49   set_thread(thread);
  50 
  51   // Create and push our stack frame
  52   builder()->SetInsertPoint(CreateBlock());

  53   _stack = SharkStack::CreateBuildAndPushFrame(this, method);
  54   NOT_PRODUCT(method = NULL);
  55 
  56   // Create the oopmap.  We use the one oopmap for every call site in
  57   // the wrapper, which results in the odd mild inefficiency but is a
  58   // damn sight easier to code.
  59   OopMap *oopmap = new OopMap(
  60     SharkStack::oopmap_slot_munge(stack()->oopmap_frame_size()),
  61     SharkStack::oopmap_slot_munge(arg_size()));
  62 
  63   // Set up the oop_tmp slot if required:
  64   //  - For static methods we use it to handlize the class argument
  65   //    for the call, and to protect the same during slow path locks
  66   //    (if synchronized).
  67   //  - For methods returning oops, we use it to protect the return
  68   //    value across safepoints or slow path unlocking.
  69   if (is_static() || is_returning_oop()) {
  70     _oop_tmp_slot = stack()->slot_addr(
  71       stack()->oop_tmp_slot_offset(),
  72       SharkType::oop_type(),


   1 /*
   2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 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.


  33 void SharkNativeWrapper::initialize(const char *name) {
  34   // Create the function
  35   _function = Function::Create(
  36     SharkType::entry_point_type(),
  37     GlobalVariable::InternalLinkage,
  38     name);
  39 
  40   // Get our arguments
  41   Function::arg_iterator ai = function()->arg_begin();
  42   Argument *method = ai++;
  43   method->setName("method");
  44   Argument *base_pc = ai++;
  45   base_pc->setName("base_pc");
  46   code_buffer()->set_base_pc(base_pc);
  47   Argument *thread = ai++;
  48   thread->setName("thread");
  49   set_thread(thread);
  50 
  51   // Create and push our stack frame
  52   builder()->SetInsertPoint(CreateBlock());
  53 #error Needs to be updated for tagged jweak; see JNIHandles.
  54   _stack = SharkStack::CreateBuildAndPushFrame(this, method);
  55   NOT_PRODUCT(method = NULL);
  56 
  57   // Create the oopmap.  We use the one oopmap for every call site in
  58   // the wrapper, which results in the odd mild inefficiency but is a
  59   // damn sight easier to code.
  60   OopMap *oopmap = new OopMap(
  61     SharkStack::oopmap_slot_munge(stack()->oopmap_frame_size()),
  62     SharkStack::oopmap_slot_munge(arg_size()));
  63 
  64   // Set up the oop_tmp slot if required:
  65   //  - For static methods we use it to handlize the class argument
  66   //    for the call, and to protect the same during slow path locks
  67   //    (if synchronized).
  68   //  - For methods returning oops, we use it to protect the return
  69   //    value across safepoints or slow path unlocking.
  70   if (is_static() || is_returning_oop()) {
  71     _oop_tmp_slot = stack()->slot_addr(
  72       stack()->oop_tmp_slot_offset(),
  73       SharkType::oop_type(),


< prev index next >