Example #1
0
void gc_init(u4 heapmaxsize, u4 heapstartsize)
{
	heapmaxsize = MEMORY_ALIGN(heapmaxsize, ALIGNSIZE);

#if defined(HAVE_MMAP)
	mmapptr = mmap((void *) MMAP_HEAPADDRESS,
				   (size_t) heapmaxsize,
				   PROT_READ | PROT_WRITE,
				   MAP_PRIVATE |
# if defined(MAP_ANONYMOUS)
				   MAP_ANONYMOUS,
# elif defined(MAP_ANON)
				   MAP_ANON,
# else
				   0,
# endif
				   -1,
				   (off_t) 0);

	if (mmapptr == MAP_FAILED)
		vm_abort("gc_init: out of memory");

#else
	mmapptr = malloc(heapmaxsize);
	
	if (!mmapptr)
		vm_abort("heap_allocate: out of memory");
#endif
	
	mmapsize = heapmaxsize;
	mmaptop = (void *) ((ptrint) mmapptr + mmapsize);

}
Example #2
0
void vm_exit_during_initialization(symbolHandle ex, const char* message) {
  ResourceMark rm;
  vm_notify_during_shutdown(ex->as_C_string(), message);

  // Failure during initialization, we don't want to dump core
  vm_abort(false);
}
/**
 * Aborts the VM due to an unexpected exception.
 */
void JVMCICompiler::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) {
  Thread* THREAD = Thread::current();
  CLEAR_PENDING_EXCEPTION;

  java_lang_Throwable::java_printStackTrace(exception, THREAD);

  // Give other aborting threads to also print their stack traces.
  // This can be very useful when debugging class initialization
  // failures.
  assert(THREAD->is_Java_thread(), "compiler threads should be Java threads");
  const bool interruptible = true;
  os::sleep(THREAD, 200, interruptible);

  vm_abort(dump_core);
}
Example #4
0
void *heap_allocate(u4 size, bool references, methodinfo *finalizer)
{
	void *m;

	mmapptr = (void *) MEMORY_ALIGN((ptrint) mmapptr, ALIGNSIZE);
	
	m = mmapptr;
	mmapptr = (void *) ((ptrint) mmapptr + size);

	if (mmapptr > mmaptop)
		vm_abort("heap_allocate: out of memory");

	MSET(m, 0, u1, size);

	return m;
}
void vm_exit_during_initialization(Handle exception) {
  tty->print_cr("Error occurred during initialization of VM");
  // If there are exceptions on this thread it must be cleared
  // first and here. Any future calls to EXCEPTION_MARK requires
  // that no pending exceptions exist.
  Thread *THREAD = Thread::current();
  if (HAS_PENDING_EXCEPTION) {
    CLEAR_PENDING_EXCEPTION;
  }
  java_lang_Throwable::print(exception, tty);
  tty->cr();
  java_lang_Throwable::print_stack_trace(exception(), tty);
  tty->cr();
  vm_notify_during_shutdown(NULL, NULL);
vm_abort(false);
}
Example #6
0
// Just passing the flow to VMError to handle error
void report_vm_out_of_memory(const char* file_name, int line_no, size_t size, const char* message) {
  if (Debugging || assert_is_suppressed(file_name, line_no))  return;

  // We try to gather additional information for the first out of memory
  // error only; gathering additional data might cause an allocation and a
  // recursive out_of_memory condition.

  const jint exiting = 1;
  // If we succeed in changing the value, we're the first one in.
  bool first_time_here = Atomic::xchg(exiting, &_exiting_out_of_mem) != exiting;

  if (first_time_here) {
    Thread* thread = ThreadLocalStorage::get_thread_slow();
    VMError(thread, size, message, file_name, line_no).report_and_die();
  }

  // Dump core and abort
  vm_abort(true);
}
Example #7
0
void vm_exit_during_initialization(const char* error, const char* message) {
  vm_notify_during_shutdown(error, message);

  // Failure during initialization, we don't want to dump core
  vm_abort(false);
}
Example #8
0
void intrp_asm_abstractmethoderror(void)
{
	vm_abort("intrp_asm_abstractmethoderror: IMPLEMENT ME!");
}
void vm_exit_during_initialization(const char* error, const char* message) {
  vm_notify_during_shutdown(error, message);
vm_abort(false);
}
void vm_exit_during_initialization(symbolHandle ex, const char* message) {
  ResourceMark rm;
  vm_notify_during_shutdown(ex->as_C_string(), message);
vm_abort(false);
}
Example #11
0
void HPI::initialize() // REMOVEME
{
	TRACESUBSYSTEMINITIALIZATION("hpi_init");

	// Load libhpi.so
	VM* vm = VM::get_current();
	Properties& properties = vm->get_properties();
	const char* boot_library_path = properties.get("sun.boot.library.path");

	// Use Buffer to assemble library path.
	Buffer<> buf;

	buf.write(boot_library_path);
	buf.write("/native_threads/libhpi.so");

	Utf8String u = buf.utf8_str();

    if (opt_TraceHPI)
		log_println("HPI::initialize: Loading HPI %s ", buf.c_str());

	NativeLibrary nl(u);
	void* handle = nl.open();

	if (handle == NULL)
		if (opt_TraceHPI)
			os::abort("HPI::initialize: HPI open failed");

	// Resolve the DLL_Initialize function from the library.
	void* dll_initialize = os::dlsym(handle, "DLL_Initialize");

    jint (JNICALL *DLL_Initialize)(GetInterfaceFunc*, void*);
    DLL_Initialize = (jint (JNICALL *)(GetInterfaceFunc*, void*)) (uintptr_t) dll_initialize;

    if (opt_TraceHPI && DLL_Initialize == NULL)
		log_println("hpi_init: HPI dlsym of DLL_Initialize failed: %s", os::dlerror());

    if (DLL_Initialize == NULL || (*DLL_Initialize)(&_get_interface, &callbacks) < 0) {
        if (opt_TraceHPI)
			vm_abort("hpi_init: HPI DLL_Initialize failed");
    }

	NativeLibraries& nls = vm->get_nativelibraries();
	nls.add(nl);

    if (opt_TraceHPI)
		log_println("HPI::initialize: HPI loaded successfully");

	// Resolve the interfaces.
	/* NOTE: The intptr_t-case is only to prevent the a compiler
	   warning with -O2: warning: dereferencing type-punned pointer
	   will break strict-aliasing rules */

	int result;

	result = (*_get_interface)((void**) (uintptr_t) &_file, "File", 1);

	if (result != 0)
		os::abort("hpi_init: Can't find HPI_FileInterface");

	result = (*_get_interface)((void**) (uintptr_t) &_library, "Library", 1);

	if (result != 0)
		os::abort("hpi_init: Can't find HPI_LibraryInterface");

	result = (*_get_interface)((void**) (uintptr_t) &_system, "System", 1);

	if (result != 0)
		os::abort("hpi_init: Can't find HPI_SystemInterface");
}