544 }
545
546 static boolean contains(Module m) {
547 return HASHED_MODULES.contains(m.getName());
548 }
549 }
550
551
552 /*
553 * Returns an array of StackTraceElements of the given depth
554 * filled from the given backtrace.
555 */
556 static StackTraceElement[] of(Object x, int depth) {
557 StackTraceElement[] stackTrace = new StackTraceElement[depth];
558 for (int i = 0; i < depth; i++) {
559 stackTrace[i] = new StackTraceElement();
560 }
561
562 // VM to fill in StackTraceElement
563 initStackTraceElements(stackTrace, x, depth);
564 return of(stackTrace);
565 }
566
567 /*
568 * Returns a StackTraceElement from a given StackFrameInfo.
569 */
570 static StackTraceElement of(StackFrameInfo sfi) {
571 StackTraceElement ste = new StackTraceElement();
572 initStackTraceElement(ste, sfi);
573
574 ste.computeFormat();
575 return ste;
576 }
577
578 static StackTraceElement[] of(StackTraceElement[] stackTrace) {
579 // ensure the proper StackTraceElement initialization
580 for (StackTraceElement ste : stackTrace) {
581 ste.computeFormat();
582 }
583 return stackTrace;
584 }
585
586 /*
587 * Sets the given stack trace elements with the backtrace
588 * of the given Throwable.
589 */
590 private static native void initStackTraceElements(StackTraceElement[] elements,
591 Object x, int depth);
592 /*
593 * Sets the given stack trace element with the given StackFrameInfo
594 */
595 private static native void initStackTraceElement(StackTraceElement element,
596 StackFrameInfo sfi);
597
598 @java.io.Serial
|
544 }
545
546 static boolean contains(Module m) {
547 return HASHED_MODULES.contains(m.getName());
548 }
549 }
550
551
552 /*
553 * Returns an array of StackTraceElements of the given depth
554 * filled from the given backtrace.
555 */
556 static StackTraceElement[] of(Object x, int depth) {
557 StackTraceElement[] stackTrace = new StackTraceElement[depth];
558 for (int i = 0; i < depth; i++) {
559 stackTrace[i] = new StackTraceElement();
560 }
561
562 // VM to fill in StackTraceElement
563 initStackTraceElements(stackTrace, x, depth);
564 return finishInit(stackTrace);
565 }
566
567 /*
568 * Returns a StackTraceElement from a given StackFrameInfo.
569 */
570 static StackTraceElement of(StackFrameInfo sfi) {
571 StackTraceElement ste = new StackTraceElement();
572 initStackTraceElement(ste, sfi);
573
574 ste.computeFormat();
575 return ste;
576 }
577
578 static StackTraceElement[] finishInit(StackTraceElement[] stackTrace) {
579 // ensure the proper StackTraceElement initialization
580 for (StackTraceElement ste : stackTrace) {
581 ste.computeFormat();
582 }
583 return stackTrace;
584 }
585
586 /*
587 * Sets the given stack trace elements with the backtrace
588 * of the given Throwable.
589 */
590 private static native void initStackTraceElements(StackTraceElement[] elements,
591 Object x, int depth);
592 /*
593 * Sets the given stack trace element with the given StackFrameInfo
594 */
595 private static native void initStackTraceElement(StackTraceElement element,
596 StackFrameInfo sfi);
597
598 @java.io.Serial
|