OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.jvmti/] [interp/] [getstacktrace.java] - Blame information for rev 765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
public class getstacktrace
2
  extends Thread
3
{
4
  public boolean done = false;
5
 
6
  // num_frames is the number of frames > the original run () call so if
7
  // num_frames = 1, the thread will have 2 frames, the original Thread.run
8
  // call, plus one additional
9
  public int num_frames, thread_num;
10
 
11
  public static int num_threads = 1;
12
 
13
  static
14
    {
15
      System.loadLibrary("natgetstacktrace");
16
    }
17
 
18
  public void run ()
19
  {
20
    thread_num = num_threads++;
21
    num_frames = thread_num;
22
 
23
    if (num_frames <= 1)
24
      {
25
        natRunner ();
26
      }
27
    else
28
      {
29
        if (thread_num % 2 == 0)
30
          natPlaceholder ();
31
        else
32
          placeholder ();
33
      }
34
  }
35
 
36
  public void placeholder ()
37
  {
38
    num_frames--;
39
    if (num_frames <= 1)
40
      {
41
        if (thread_num % 2 == 1)
42
          natRunner ();
43
        else
44
          runner ();
45
      }
46
    else
47
      {
48
        if (thread_num % 2 == 0)
49
          natPlaceholder ();
50
        else
51
          placeholder ();
52
      }
53
  }
54
 
55
  public void runner ()
56
  {
57
    done = true;
58
    while (done)
59
      yield ();
60
  }
61
 
62
  public native void natPlaceholder ();
63
  public native void natRunner ();
64
 
65
  public static native int do_getstacktrace_tests (Thread[] threads);
66
 
67
  public static void main (String[] args)
68
  {
69
    System.out.println ("JVMTI GetStackTrace Interpreted Test");
70
 
71
    getstacktrace[] threads = new getstacktrace[10];
72
 
73
    for (int i = 0; i < threads.length; i++)
74
      {
75
        threads[i] = new getstacktrace ();
76
        threads[i].start ();
77
        while (!threads[i].done)
78
          yield ();
79
      }
80
 
81
    do_getstacktrace_tests (threads);
82
 
83
    for (int i = 0; i < threads.length; i++)
84
      {
85
        threads[i].done = false;
86
      }
87
  }
88
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.