- return (java_doublearray *)
- builtin_newarray(size,
- primitivetype_table[ARRAYTYPE_DOUBLE].arrayclass);
-}
-
-
-/* builtin_multianewarray_intern ***********************************************
-
- Creates a multi-dimensional array on the heap. The dimensions are
- passed in an array of longs.
-
- Arguments:
- n............number of dimensions to create
- arrayvftbl...vftbl of the array class
- dims.........array containing the size of each dimension to create
-
- Return value: pointer to the array or NULL if no memory is
- available
-
-******************************************************************************/
-
-static java_arrayheader *builtin_multianewarray_intern(int n,
- classinfo *arrayclass,
- long *dims)
-{
- s4 size;
- java_arrayheader *a;
- classinfo *componentclass;
- s4 i;
-
- /* create this dimension */
-
- size = (s4) dims[0];
- a = builtin_newarray(size, arrayclass);
-
- if (!a)
- return NULL;
-
- /* if this is the last dimension return */
-
- if (!--n)
- return a;
-
- /* get the class of the components to create */
-
- componentclass = arrayclass->vftbl->arraydesc->componentvftbl->class;
-
- /* The verifier guarantees that the dimension count is in the range. */
-
- /* create the component arrays */
-
- for (i = 0; i < size; i++) {
- java_arrayheader *ea =
-#if defined(__MIPS__) && (SIZEOF_VOID_P == 4)
- /* we save an s4 to a s8 slot, 8-byte aligned */
-
- builtin_multianewarray_intern(n, componentclass, dims + 2);
-#else
- builtin_multianewarray_intern(n, componentclass, dims + 1);
-#endif
-
- if (!ea)
- return NULL;
-
- ((java_objectarray *) a)->data[i] = (java_objectheader *) ea;
- }
-
- return a;
-}
-
-
-/* builtin_multianewarray ******************************************************
-
- Wrapper for builtin_multianewarray_intern which checks all
- dimensions before we start allocating.
-
-******************************************************************************/
-
-java_arrayheader *builtin_multianewarray(int n, classinfo *arrayclass,
- long *dims)
-{
- s4 i;
- s4 size;
-
- /* check all dimensions before doing anything */
-
- for (i = 0; i < n; i++) {
-#if defined(__MIPS__) && (SIZEOF_VOID_P == 4)
- /* we save an s4 to a s8 slot, 8-byte aligned */
- size = (s4) dims[i * 2];
-#else
- size = (s4) dims[i];
-#endif
-
- if (size < 0) {
- exceptions_throw_negativearraysizeexception();
- return NULL;
- }
- }
-
- /* now call the real function */
-
- return builtin_multianewarray_intern(n, arrayclass, dims);
-}
-
-
-/*****************************************************************************
- METHOD LOGGING
-
- Various functions for printing a message at method entry or exit (for
- debugging)
-
-*****************************************************************************/
-
-#if !defined(NDEBUG)
-static s4 methodindent = 0;
-static u4 callcount = 0;
-
-java_objectheader *builtin_trace_exception(java_objectheader *xptr,
- methodinfo *m,
- void *pos,
- s4 indent)
-{
- char *logtext;
- s4 logtextlen;
- s4 dumpsize;
- codeinfo *code;
-
-#if defined(ENABLE_DEBUG_FILTER)
- if (! show_filters_test_verbosecall_exit(m)) return xptr;
-#endif
-
-#if defined(ENABLE_VMLOG)
- return xptr;
-#endif
-
- if (opt_verbosecall && indent)
- methodindent--;
-
- /* calculate message length */
-
- if (xptr) {
- logtextlen =
- strlen("Exception ") + utf_bytes(xptr->vftbl->class->name);
- }
- else {
- logtextlen = strlen("Some Throwable");
- }
-
- logtextlen += strlen(" thrown in ");
-
- if (m) {
- logtextlen +=
- utf_bytes(m->class->name) +
- strlen(".") +
- utf_bytes(m->name) +
- utf_bytes(m->descriptor) +
- strlen("(NOSYNC,NATIVE");
-
-#if SIZEOF_VOID_P == 8
- logtextlen +=
- strlen(")(0x123456789abcdef0) at position 0x123456789abcdef0 (");
-#else
- logtextlen += strlen(")(0x12345678) at position 0x12345678 (");
-#endif
-
- if (m->class->sourcefile == NULL)
- logtextlen += strlen("<NO CLASSFILE INFORMATION>");
- else
- logtextlen += utf_bytes(m->class->sourcefile);
-
- logtextlen += strlen(":65536)");
-
- }
- else {
- logtextlen += strlen("call_java_method");
- }
-
- logtextlen += strlen("0");
-
- /* allocate memory */
-
- dumpsize = dump_size();
-
- logtext = DMNEW(char, logtextlen);
-
- if (xptr) {
- strcpy(logtext, "Exception ");
- utf_cat_classname(logtext, xptr->vftbl->class->name);
-
- } else {
- strcpy(logtext, "Some Throwable");
- }
-
- strcat(logtext, " thrown in ");
-
- if (m) {
- utf_cat_classname(logtext, m->class->name);
- strcat(logtext, ".");
- utf_cat(logtext, m->name);
- utf_cat(logtext, m->descriptor);
-
- if (m->flags & ACC_SYNCHRONIZED)
- strcat(logtext, "(SYNC");
- else
- strcat(logtext, "(NOSYNC");
-
- if (m->flags & ACC_NATIVE) {
- strcat(logtext, ",NATIVE");
-
- code = m->code;
-
-#if SIZEOF_VOID_P == 8
- sprintf(logtext + strlen(logtext),
- ")(0x%016lx) at position 0x%016lx",
- (ptrint) code->entrypoint, (ptrint) pos);
-#else
- sprintf(logtext + strlen(logtext),
- ")(0x%08x) at position 0x%08x",
- (ptrint) code->entrypoint, (ptrint) pos);