1 // prims.cc - Code for core of runtime environment.
3 /* Copyright (C) 1998, 1999, 2000 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
13 #ifdef USE_WIN32_SIGNALLING
15 #endif /* USE_WIN32_SIGNALLING */
18 #undef __INSIDE_CYGWIN__
20 #endif /* USE_WINSOCK */
34 #include <java-signal.h>
35 #include <java-threads.h>
41 #ifndef DISABLE_GETENV_PROPERTIES
43 #include <java-props.h>
44 #define PROCESS_GCJ_PROPERTIES process_gcj_properties()
46 #define PROCESS_GCJ_PROPERTIES
47 #endif // DISABLE_GETENV_PROPERTIES
49 #include <java/lang/Class.h>
50 #include <java/lang/ClassLoader.h>
51 #include <java/lang/Runtime.h>
52 #include <java/lang/String.h>
53 #include <java/lang/Thread.h>
54 #include <java/lang/ThreadGroup.h>
55 #include <gnu/gcj/runtime/FirstThread.h>
56 #include <java/lang/ArrayIndexOutOfBoundsException.h>
57 #include <java/lang/ArithmeticException.h>
58 #include <java/lang/ClassFormatError.h>
59 #include <java/lang/NegativeArraySizeException.h>
60 #include <java/lang/NullPointerException.h>
61 #include <java/lang/OutOfMemoryError.h>
62 #include <java/lang/System.h>
63 #include <java/lang/reflect/Modifier.h>
64 #include <java/io/PrintStream.h>
70 // We allocate a single OutOfMemoryError exception which we keep
71 // around for use if we run out of memory.
72 static java::lang::OutOfMemoryError *no_memory;
74 // Largest representable size_t.
75 #define SIZE_T_MAX ((size_t) (~ (size_t) 0))
77 // Properties set at compile time.
78 const char **_Jv_Compiler_Properties;
80 // The JAR file to add to the beginning of java.class.path.
81 const char *_Jv_Jar_Class_Path;
83 #ifndef DISABLE_GETENV_PROPERTIES
84 // Property key/value pairs.
85 property_pair *_Jv_Environment_Properties;
88 // The name of this executable.
89 static char * _Jv_execName;
91 // Stash the argv pointer to benefit native libraries that need it.
92 const char **_Jv_argv;
96 // Pointer to JVMPI notification functions.
97 void (*_Jv_JVMPI_Notify_OBJECT_ALLOC) (JVMPI_Event *event);
98 void (*_Jv_JVMPI_Notify_THREAD_START) (JVMPI_Event *event);
99 void (*_Jv_JVMPI_Notify_THREAD_END) (JVMPI_Event *event);
103 extern "C" void _Jv_ThrowSignal (void *) __attribute ((noreturn));
105 // Just like _Jv_Throw, but fill in the stack trace first. Although
106 // this is declared extern in order that its name not be mangled, it
107 // is not intended to be used outside this file.
109 _Jv_ThrowSignal (void *e)
111 java::lang::Throwable *throwable = (java::lang::Throwable *)e;
112 throwable->fillInStackTrace ();
113 _Jv_Throw (throwable);
117 static java::lang::NullPointerException *nullp;
119 SIGNAL_HANDLER (catch_segv)
121 MAKE_THROW_FRAME (nullp);
122 _Jv_ThrowSignal (nullp);
126 static java::lang::ArithmeticException *arithexception;
129 SIGNAL_HANDLER (catch_fpe)
131 #ifdef HANDLE_DIVIDE_OVERFLOW
132 HANDLE_DIVIDE_OVERFLOW;
134 MAKE_THROW_FRAME (arithexception);
136 _Jv_ThrowSignal (arithexception);
143 _Jv_equalUtf8Consts (Utf8Const* a, Utf8Const *b)
146 _Jv_ushort *aptr, *bptr;
149 if (a->hash != b->hash)
152 if (b->length != len)
154 aptr = (_Jv_ushort *)a->data;
155 bptr = (_Jv_ushort *)b->data;
156 len = (len + 1) >> 1;
158 if (*aptr++ != *bptr++)
163 /* True iff A is equal to STR.
164 HASH is STR->hashCode().
168 _Jv_equal (Utf8Const* a, jstring str, jint hash)
170 if (a->hash != (_Jv_ushort) hash)
172 jint len = str->length();
174 jchar *sptr = _Jv_GetStringChars (str);
175 unsigned char* ptr = (unsigned char*) a->data;
176 unsigned char* limit = ptr + a->length;
179 int ch = UTF8_GET (ptr, limit);
188 /* Like _Jv_equal, but stop after N characters. */
190 _Jv_equaln (Utf8Const *a, jstring str, jint n)
192 jint len = str->length();
194 jchar *sptr = _Jv_GetStringChars (str);
195 unsigned char* ptr = (unsigned char*) a->data;
196 unsigned char* limit = ptr + a->length;
197 for (; n-- > 0; i++, sptr++)
199 int ch = UTF8_GET (ptr, limit);
208 /* Count the number of Unicode chars encoded in a given Ut8 string. */
210 _Jv_strLengthUtf8(char* str, int len)
213 unsigned char* limit;
216 ptr = (unsigned char*) str;
219 for (; ptr < limit; str_length++) {
220 if (UTF8_GET (ptr, limit) < 0) {
227 /* Calculate a hash value for a string encoded in Utf8 format.
228 * This returns the same hash value as specified or java.lang.String.hashCode.
231 hashUtf8String (char* str, int len)
233 unsigned char* ptr = (unsigned char*) str;
234 unsigned char* limit = ptr + len;
239 int ch = UTF8_GET (ptr, limit);
240 /* Updated specification from
241 http://www.javasoft.com/docs/books/jls/clarify.html. */
242 hash = (31 * hash) + ch;
248 _Jv_makeUtf8Const (char* s, int len)
252 Utf8Const* m = (Utf8Const*) _Jv_AllocBytes (sizeof(Utf8Const) + len + 1);
255 memcpy (m->data, s, len);
258 m->hash = hashUtf8String (s, len) & 0xFFFF;
263 _Jv_makeUtf8Const (jstring string)
265 jint hash = string->hashCode ();
266 jint len = _Jv_GetStringUTFLength (string);
268 Utf8Const* m = (Utf8Const*)
269 _Jv_AllocBytesChecked (sizeof(Utf8Const) + len + 1);
274 _Jv_GetStringUTFRegion (string, 0, string->length (), m->data);
284 _Jv_Abort (const char *function, const char *file, int line,
288 _Jv_Abort (const char *, const char *, int, const char *message)
293 "libgcj failure: %s\n in function %s, file %s, line %d\n",
294 message, function, file, line);
296 java::io::PrintStream *err = java::lang::System::err;
297 err->print(JvNewStringLatin1 ("libgcj failure: "));
298 err->println(JvNewStringLatin1 (message));
305 fail_on_finalization (jobject)
307 JvFail ("object was finalized");
311 _Jv_GCWatch (jobject obj)
313 _Jv_RegisterFinalizer (obj, fail_on_finalization);
317 _Jv_ThrowBadArrayIndex(jint bad_index)
319 JvThrow (new java::lang::ArrayIndexOutOfBoundsException
320 (java::lang::String::valueOf(bad_index)));
324 _Jv_ThrowNullPointerException ()
326 throw new java::lang::NullPointerException ();
329 // Allocate some unscanned memory and throw an exception if no memory.
331 _Jv_AllocBytesChecked (jsize size)
333 void *r = _Jv_AllocBytes (size);
335 _Jv_Throw (no_memory);
339 // Allocate a new object of class KLASS. SIZE is the size of the object
340 // to allocate. You might think this is redundant, but it isn't; some
341 // classes, such as String, aren't of fixed size.
343 _Jv_AllocObject (jclass klass, jint size)
345 _Jv_InitClass (klass);
347 jobject obj = (jobject) _Jv_AllocObj (size, klass);
348 if (__builtin_expect (! obj, false))
351 // If this class has inherited finalize from Object, then don't
352 // bother registering a finalizer. We know that finalize() is the
353 // very first method after the dummy entry. If this turns out to be
354 // unreliable, a more robust implementation can be written. Such an
355 // implementation would look for Object.finalize in Object's method
356 // table at startup, and then use that information to find the
357 // appropriate index in the method vector.
358 if (klass->vtable->get_finalizer()
359 != java::lang::Object::class$.vtable->get_finalizer())
360 _Jv_RegisterFinalizer (obj, _Jv_FinalizeObject);
363 // Service JVMPI request.
365 if (__builtin_expect (_Jv_JVMPI_Notify_OBJECT_ALLOC != 0, false))
369 event.event_type = JVMPI_EVENT_OBJECT_ALLOC;
371 event.u.obj_alloc.arena_id = 0;
372 event.u.obj_alloc.class_id = (jobjectID) klass;
373 event.u.obj_alloc.is_array = 0;
374 event.u.obj_alloc.size = size;
375 event.u.obj_alloc.obj_id = (jobjectID) obj;
378 (*_Jv_JVMPI_Notify_OBJECT_ALLOC) (&event);
386 // Allocate a new array of Java objects. Each object is of type
387 // `elementClass'. `init' is used to initialize each slot in the
390 _Jv_NewObjectArray (jsize count, jclass elementClass, jobject init)
392 if (__builtin_expect (count < 0, false))
393 JvThrow (new java::lang::NegativeArraySizeException);
395 JvAssert (! elementClass->isPrimitive ());
397 jobjectArray obj = NULL;
398 size_t size = (size_t) _Jv_GetArrayElementFromElementType (obj,
401 // Check for overflow.
402 if (__builtin_expect ((size_t) count >
403 (SIZE_T_MAX - size) / sizeof (jobject), false))
406 size += count * sizeof (jobject);
408 // FIXME: second argument should be "current loader" //
409 jclass klass = _Jv_FindArrayClass (elementClass, 0);
411 obj = (jobjectArray) _Jv_AllocArray (size, klass);
412 if (__builtin_expect (! obj, false))
415 jsize *lp = const_cast<jsize *> (&obj->length);
417 jobject *ptr = elements(obj);
418 // We know the allocator returns zeroed memory. So don't bother
428 // Allocate a new array of primitives. ELTYPE is the type of the
429 // element, COUNT is the size of the array.
431 _Jv_NewPrimArray (jclass eltype, jint count)
433 int elsize = eltype->size();
434 if (__builtin_expect (count < 0, false))
435 JvThrow (new java::lang::NegativeArraySizeException ());
437 JvAssert (eltype->isPrimitive ());
438 jobject dummy = NULL;
439 size_t size = (size_t) _Jv_GetArrayElementFromElementType (dummy, eltype);
441 // Check for overflow.
442 if (__builtin_expect ((size_t) count >
443 (SIZE_T_MAX - size) / elsize, false))
446 jclass klass = _Jv_FindArrayClass (eltype, 0);
448 __JArray *arr = (__JArray*) _Jv_AllocObj (size + elsize * count, klass);
449 if (__builtin_expect (! arr, false))
452 jsize *lp = const_cast<jsize *> (&arr->length);
454 // Note that we assume we are given zeroed memory by the allocator.
460 _Jv_NewArray (jint type, jint size)
464 case 4: return JvNewBooleanArray (size);
465 case 5: return JvNewCharArray (size);
466 case 6: return JvNewFloatArray (size);
467 case 7: return JvNewDoubleArray (size);
468 case 8: return JvNewByteArray (size);
469 case 9: return JvNewShortArray (size);
470 case 10: return JvNewIntArray (size);
471 case 11: return JvNewLongArray (size);
473 JvFail ("newarray - bad type code");
474 return NULL; // Placate compiler.
478 _Jv_NewMultiArray (jclass type, jint dimensions, jint *sizes)
480 JvAssert (type->isArray());
481 jclass element_type = type->getComponentType();
483 if (element_type->isPrimitive())
484 result = _Jv_NewPrimArray (element_type, sizes[0]);
486 result = _Jv_NewObjectArray (sizes[0], element_type, NULL);
490 JvAssert (! element_type->isPrimitive());
491 JvAssert (element_type->isArray());
492 jobject *contents = elements ((jobjectArray) result);
493 for (int i = 0; i < sizes[0]; ++i)
494 contents[i] = _Jv_NewMultiArray (element_type, dimensions - 1,
502 _Jv_NewMultiArray (jclass array_type, jint dimensions, ...)
505 jint sizes[dimensions];
506 va_start (args, dimensions);
507 for (int i = 0; i < dimensions; ++i)
509 jint size = va_arg (args, jint);
514 return _Jv_NewMultiArray (array_type, dimensions, sizes);
519 class _Jv_PrimClass : public java::lang::Class
522 // FIXME: calling convention is weird. If we use the natural types
523 // then the compiler will complain because they aren't Java types.
524 _Jv_PrimClass (jobject cname, jbyte sig, jint len, jobject array_vtable)
526 using namespace java::lang::reflect;
528 // We must initialize every field of the class. We do this in
529 // the same order they are declared in Class.h.
531 name = _Jv_makeUtf8Const ((char *) cname, -1);
532 accflags = Modifier::PUBLIC | Modifier::FINAL;
535 constants.tags = NULL;
536 constants.data = NULL;
539 vtable_method_count = 0;
543 static_field_count = 0;
544 vtable = JV_PRIMITIVE_VTABLE;
548 state = JV_STATE_DONE;
551 // Note that we have to set `methods' to NULL.
553 _Jv_FindArrayClass (this, NULL, (_Jv_VTable *) array_vtable);
557 // We use this to define both primitive classes and the vtables for
558 // arrays of primitive classes. The latter are given names so that we
559 // can refer to them from the compiler, allowing us to construct
560 // arrays of primitives statically.
561 #define DECLARE_PRIM_TYPE(NAME, SIG, LEN) \
562 _Jv_ArrayVTable _Jv_##NAME##VTable; \
563 _Jv_PrimClass _Jv_##NAME##Class((jobject) #NAME, (jbyte) SIG, (jint) LEN, \
564 (jobject) &_Jv_##NAME##VTable)
566 DECLARE_PRIM_TYPE(byte, 'B', 1);
567 DECLARE_PRIM_TYPE(short, 'S', 2);
568 DECLARE_PRIM_TYPE(int, 'I', 4);
569 DECLARE_PRIM_TYPE(long, 'J', 8);
570 DECLARE_PRIM_TYPE(boolean, 'Z', 1);
571 DECLARE_PRIM_TYPE(char, 'C', 2);
572 DECLARE_PRIM_TYPE(float, 'F', 4);
573 DECLARE_PRIM_TYPE(double, 'D', 8);
574 DECLARE_PRIM_TYPE(void, 'V', 0);
577 _Jv_FindClassFromSignature (char *sig, java::lang::ClassLoader *loader)
582 return JvPrimClass (byte);
584 return JvPrimClass (short);
586 return JvPrimClass (int);
588 return JvPrimClass (long);
590 return JvPrimClass (boolean);
592 return JvPrimClass (char);
594 return JvPrimClass (float);
596 return JvPrimClass (double);
598 return JvPrimClass (void);
602 for (i = 1; sig[i] && sig[i] != ';'; ++i)
604 _Jv_Utf8Const *name = _Jv_makeUtf8Const (&sig[1], i - 1);
605 return _Jv_FindClass (name, loader);
609 return _Jv_FindArrayClass (_Jv_FindClassFromSignature (&sig[1], loader),
612 JvFail ("couldn't understand class signature");
613 return NULL; // Placate compiler.
619 JvConvertArgv (int argc, const char **argv)
623 jobjectArray ar = JvNewObjectArray(argc, &StringClass, NULL);
624 jobject* ptr = elements(ar);
625 for (int i = 0; i < argc; i++)
627 const char *arg = argv[i];
628 // FIXME - should probably use JvNewStringUTF.
629 *ptr++ = JvNewStringLatin1(arg, strlen(arg));
631 return (JArray<jstring>*) ar;
634 // FIXME: These variables are static so that they will be
635 // automatically scanned by the Boehm collector. This is needed
636 // because with qthreads the collector won't scan the initial stack --
637 // it will only scan the qthreads stacks.
639 // Command line arguments.
640 static jobject arg_vec;
642 // The primary thread.
643 static java::lang::Thread *main_thread;
646 _Jv_ThisExecutable (void)
652 _Jv_ThisExecutable (const char *name)
656 _Jv_execName = new char[strlen (name) + 1];
657 strcpy (_Jv_execName, name);
661 #ifdef USE_WIN32_SIGNALLING
663 extern "C" int* win32_get_restart_frame (void *);
666 win32_exception_handler (LPEXCEPTION_POINTERS e)
669 if (e->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
670 setjmp_buf = win32_get_restart_frame (nullp);
671 else if (e->ExceptionRecord->ExceptionCode == EXCEPTION_INT_DIVIDE_BY_ZERO)
672 setjmp_buf = win32_get_restart_frame (arithexception);
674 return EXCEPTION_CONTINUE_SEARCH;
676 e->ContextRecord->Ebp = setjmp_buf[0];
677 // FIXME: Why does i386-signal.h increment the PC here, do we need to do it?
678 e->ContextRecord->Eip = setjmp_buf[1];
679 // FIXME: Is this the stack pointer? Do we need it?
680 e->ContextRecord->Esp = setjmp_buf[2];
682 return EXCEPTION_CONTINUE_EXECUTION;
694 arithexception = new java::lang::ArithmeticException
695 (JvNewStringLatin1 ("/ by zero"));
698 no_memory = new java::lang::OutOfMemoryError;
701 LTDL_SET_PRELOADED_SYMBOLS ();
705 // Initialise winsock for networking
707 if (WSAStartup (MAKEWORD (1, 1), &data))
708 MessageBox (NULL, "Error initialising winsock library.", "Error", MB_OK | MB_ICONEXCLAMATION);
709 #endif /* USE_WINSOCK */
711 #ifdef USE_WIN32_SIGNALLING
712 // Install exception handler
713 SetUnhandledExceptionFilter (win32_exception_handler);
715 // We only want this on POSIX systems.
716 struct sigaction act;
717 act.sa_handler = SIG_IGN;
718 sigemptyset (&act.sa_mask);
720 sigaction (SIGPIPE, &act, NULL);
721 #endif /* USE_WIN32_SIGNALLING */
726 #ifndef DISABLE_GETENV_PROPERTIES
729 next_property_key (char *s, size_t *length)
735 // Skip over whitespace
739 // If we've reached the end, return NULL. Also return NULL if for
740 // some reason we've come across a malformed property string.
746 // Determine the length of the property key.
764 next_property_value (char *s, size_t *length)
780 // If we've reached the end, return NULL.
784 // Determine the length of the property value.
803 process_gcj_properties ()
805 char *props = getenv("GCJ_PROPERTIES");
808 size_t property_count = 0;
813 // Whip through props quickly in order to count the number of
815 while (p && (p = next_property_key (p, &length)))
817 // Skip to the end of the key
820 p = next_property_value (p, &length);
827 // Allocate an array of property value/key pairs.
828 _Jv_Environment_Properties =
829 (property_pair *) malloc (sizeof(property_pair)
830 * (property_count + 1));
832 // Go through the properties again, initializing _Jv_Properties
836 while (p && (p = next_property_key (p, &length)))
838 _Jv_Environment_Properties[property_count].key = p;
839 _Jv_Environment_Properties[property_count].key_length = length;
841 // Skip to the end of the key
844 p = next_property_value (p, &length);
846 _Jv_Environment_Properties[property_count].value = p;
847 _Jv_Environment_Properties[property_count].value_length = length;
854 memset ((void *) &_Jv_Environment_Properties[property_count],
855 0, sizeof (property_pair));
859 // Null terminate the strings.
860 while (_Jv_Environment_Properties[i].key)
862 _Jv_Environment_Properties[i].key[_Jv_Environment_Properties[i].key_length] = 0;
863 _Jv_Environment_Properties[i++].value[_Jv_Environment_Properties[i].value_length] = 0;
867 #endif // DISABLE_GETENV_PROPERTIES
870 JvRunMain (jclass klass, int argc, const char **argv)
872 PROCESS_GCJ_PROPERTIES;
878 #ifdef HAVE_PROC_SELF_EXE
880 sprintf (exec_name, "/proc/%d/exe", getpid ());
881 _Jv_ThisExecutable (exec_name);
883 _Jv_ThisExecutable (argv[0]);
886 arg_vec = JvConvertArgv (argc - 1, argv + 1);
887 main_thread = new gnu::gcj::runtime::FirstThread (klass, arg_vec);
889 main_thread->start();
892 int status = (int) java::lang::ThreadGroup::had_uncaught_exception;
894 java::lang::Runtime::getRuntime ()->exit (status);
898 _Jv_RunMain (const char *name, int argc, const char **argv, bool is_jar)
901 PROCESS_GCJ_PROPERTIES;
905 #ifdef HAVE_PROC_SELF_EXE
907 sprintf (exec_name, "/proc/%d/exe", getpid ());
908 _Jv_ThisExecutable (exec_name);
913 // name specifies a jar file. We must now extract the
914 // Main-Class attribute from the jar's manifest file. This is
915 // done by gnu.gcj.runtime.FirstThread.main.
916 _Jv_Jar_Class_Path = strdup (name);
917 arg_vec = JvConvertArgv (1, &_Jv_Jar_Class_Path);
920 new gnu::gcj::runtime::FirstThread (&gnu::gcj::runtime::FirstThread::class$,
922 main_thread->start();
925 // FirstThread.main extracts the main class name and stores it
927 class_name = gnu::gcj::runtime::FirstThread::jarMainClassName;
929 // We need a new ClassLoader because the classpath must be the
930 // jar file only. The easiest way to do this is to lose our
931 // reference to the previous classloader.
932 java::lang::ClassLoader::system = NULL;
935 class_name = JvNewStringLatin1 (name);
937 arg_vec = JvConvertArgv (argc - 1, argv + 1);
941 main_thread = new gnu::gcj::runtime::FirstThread (class_name, arg_vec);
942 main_thread->start();
946 int status = (int) java::lang::ThreadGroup::had_uncaught_exception;
948 java::lang::Runtime::getRuntime ()->exit (status);
953 // Parse a string and return a heap size.
955 parse_heap_size (const char *spec)
958 unsigned long val = strtoul (spec, &end, 10);
959 if (*end == 'k' || *end == 'K')
961 else if (*end == 'm' || *end == 'M')
966 // Set the initial heap size. This might be ignored by the GC layer.
967 // This must be called before _Jv_RunMain.
969 _Jv_SetInitialHeapSize (const char *arg)
971 size_t size = parse_heap_size (arg);
972 _Jv_GCSetInitialHeapSize (size);
975 // Set the maximum heap size. This might be ignored by the GC layer.
976 // This must be called before _Jv_RunMain.
978 _Jv_SetMaximumHeapSize (const char *arg)
980 size_t size = parse_heap_size (arg);
981 _Jv_GCSetMaximumHeapSize (size);
987 _Jv_Malloc (jsize size)
989 if (__builtin_expect (size == 0, false))
991 void *ptr = malloc ((size_t) size);
992 if (__builtin_expect (ptr == NULL, false))
998 _Jv_Realloc (void *ptr, jsize size)
1000 if (__builtin_expect (size == 0, false))
1002 ptr = realloc (ptr, (size_t) size);
1003 if (__builtin_expect (ptr == NULL, false))
1004 JvThrow (no_memory);
1009 _Jv_MallocUnchecked (jsize size)
1011 if (__builtin_expect (size == 0, false))
1013 return malloc ((size_t) size);
1017 _Jv_Free (void* ptr)
1024 // In theory, these routines can be #ifdef'd away on machines which
1025 // support divide overflow signals. However, we never know if some
1026 // code might have been compiled with "-fuse-divide-subroutine", so we
1027 // always include them in libgcj.
1030 _Jv_divI (jint dividend, jint divisor)
1032 if (__builtin_expect (divisor == 0, false))
1033 _Jv_ThrowSignal (arithexception);
1035 if (dividend == (jint) 0x80000000L && divisor == -1)
1038 return dividend / divisor;
1042 _Jv_remI (jint dividend, jint divisor)
1044 if (__builtin_expect (divisor == 0, false))
1045 _Jv_ThrowSignal (arithexception);
1047 if (dividend == (jint) 0x80000000L && divisor == -1)
1050 return dividend % divisor;
1054 _Jv_divJ (jlong dividend, jlong divisor)
1056 if (__builtin_expect (divisor == 0, false))
1057 _Jv_ThrowSignal (arithexception);
1059 if (dividend == (jlong) 0x8000000000000000LL && divisor == -1)
1062 return dividend / divisor;
1066 _Jv_remJ (jlong dividend, jlong divisor)
1068 if (__builtin_expect (divisor == 0, false))
1069 _Jv_ThrowSignal (arithexception);
1071 if (dividend == (jlong) 0x8000000000000000LL && divisor == -1)
1074 return dividend % divisor;