Hotspot call

 

 

Source: /src/share/vm/runtime/stubRoutines.hpp

static CallStub call_stub() { 
    return CAST_TO_FN_PTR(CallStub, _call_stub_entry); 
}

Wherein CAST_TO_FN_PTR macro defined in /src/share/vm/runtime/utilities/globalDefinitions.hpp file, defined as follows:

#define CAST_TO_FN_PTR(func_type, value) ((func_type)(castable_address(value)))  

 After call_stub function macro replacement and expansion will become the following form:

static CallStub call_stub(){
    return (CallStub)(castable_address(_call_stub_entry));
}

 CallStub defined in /src/share/vm/runtime/stubRoutines.hpp file, specifically defined as follows:

// Calls to Java
typedef void (*CallStub)(
    address   link,
    intptr_t* result,
    BasicType result_type,
    Method* method,
    address   entry_point,
    intptr_t* parameters,
    int       size_of_parameters,
    TRAPS
); 

Are as defined above type, a function pointer, the function pointed to eight formal parameters declared. 

castable_address called in call_stub () function () function is implemented in the globalDefinitions.hpp file, as follows:

inline address_word  castable_address(address x)  { 
    return address_word(x) ; 
}

address_word certain custom type is defined in particular globalDefinitions.hpp file as follows:

// unsigned integer which will hold a pointer
// except for some implementations of a C++
// linkage pointer to function. Should never
// need one of those to be placed in this type anyway.
typedef uintptr_t     address_word;
                                   

  

  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  

 

Guess you like

Origin www.cnblogs.com/mazhimazhi/p/11109736.html