src/share/vm/shark/sharkNativeWrapper.cpp

Print this page
rev 3810 : [mq]: shark.patch

@@ -57,11 +57,10 @@
   // the wrapper, which results in the odd mild inefficiency but is a
   // damn sight easier to code.
   OopMap *oopmap = new OopMap(
     SharkStack::oopmap_slot_munge(stack()->oopmap_frame_size()),
     SharkStack::oopmap_slot_munge(arg_size()));
-  oopmap->set_oop(SharkStack::slot2reg(stack()->method_slot_offset()));
 
   // Set up the oop_tmp slot if required:
   //  - For static methods we use it to handlize the class argument
   //    for the call, and to protect the same during slow path locks
   //    (if synchronized).

@@ -81,13 +80,13 @@
     Unimplemented();
     _lock_slot_offset = 23;
   }
 
   // Start building the argument list
-  std::vector<const Type*> param_types;
+  std::vector<Type*> param_types;
   std::vector<Value*> param_values;
-  const PointerType *box_type = PointerType::getUnqual(SharkType::oop_type());
+  PointerType *box_type = PointerType::getUnqual(SharkType::oop_type());
 
   // First argument is the JNIEnv
   param_types.push_back(SharkType::jniEnv_type());
   param_values.push_back(
     builder()->CreateAddressOfStructEntry(

@@ -147,11 +146,11 @@
 
       builder()->SetInsertPoint(not_null);
       builder()->CreateBr(merge);
 
       builder()->SetInsertPoint(merge);
-      phi = builder()->CreatePHI(box_type, "boxed_object");
+      phi = builder()->CreatePHI(box_type, 0, "boxed_object");
       phi->addIncoming(ConstantPointerNull::get(box_type), null);
       phi->addIncoming(box, not_null);
       box = phi;
 
       param_types.push_back(box_type);

@@ -168,11 +167,11 @@
     case T_DOUBLE:
       adjusted_offset--;
       // fall through
 
     default:
-      const Type *param_type = SharkType::to_stackType(arg_type(i));
+      Type *param_type = SharkType::to_stackType(arg_type(i));
 
       param_types.push_back(param_type);
       param_values.push_back(
         builder()->CreateLoad(stack()->slot_addr(adjusted_offset, param_type)));
     }

@@ -199,11 +198,11 @@
   // Change the thread state to _thread_in_native
   CreateSetThreadState(_thread_in_native);
 
   // Make the call
   BasicType result_type = target()->result_type();
-  const Type* return_type;
+  Type* return_type;
   if (result_type == T_VOID)
     return_type = SharkType::void_type();
   else if (is_returning_oop())
     return_type = box_type;
   else

@@ -211,19 +210,19 @@
   Value* native_function = builder()->CreateIntToPtr(
      LLVMValue::intptr_constant((intptr_t) target()->native_function()),
      PointerType::getUnqual(
        FunctionType::get(return_type, param_types, false)));
   Value *result = builder()->CreateCall(
-    native_function, param_values.begin(), param_values.end());
+    native_function, llvm::makeArrayRef(param_values));
 
   // Start the transition back to _thread_in_Java
   CreateSetThreadState(_thread_in_native_trans);
 
   // Make sure new state is visible in the GC thread
   if (os::is_MP()) {
     if (UseMembar)
-      builder()->CreateMemoryBarrier(SharkBuilder::BARRIER_STORELOAD);
+      builder()->CreateFence(llvm::SequentiallyConsistent, llvm::CrossThread);
     else
       CreateWriteMemorySerializePage();
   }
 
   // Handle safepoint operations, pending suspend requests,

@@ -303,11 +302,11 @@
     builder()->SetInsertPoint(not_null);
     Value *unboxed_result = builder()->CreateLoad(result);
     builder()->CreateBr(merge);
 
     builder()->SetInsertPoint(merge);
-    PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), "result");
+    PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), 0, "result");
     phi->addIncoming(LLVMValue::null(), null);
     phi->addIncoming(unboxed_result, not_null);
     result = phi;
   }