Showing the changes to java/pkg (2 of 2 files). Show all
Unified · Split
| @@ -71,8 +71,6 @@ init( jni_p : JNI ) · 70 unmodified lines | |||
| 71 | 71 | ||
| 72 | currentThread_rThread( ) : JThread | 72 | currentThread_rThread( ) : JThread |
| 73 | {#>> | 73 | {#>> |
| 74 | e := ref Sys->Exception; | ||
| 75 | if ( sys->rescue("*",e) == Sys->HANDLER ) | ||
| 76 | { | 74 | { |
| 77 | # get the java thread object assocciated | 75 | # get the java thread object assocciated |
| 78 | # with this thread. it is stored in the | 76 | # with this thread. it is stored in the |
| @@ -80,10 +78,12 @@ currentThread_rThread( ) : JThread · 1 unmodified line | |||
| 80 | thd_obj := jldr->getthreaddata().this; | 78 | thd_obj := jldr->getthreaddata().this; |
| 81 | if ( thd_obj != nil ) | 79 | if ( thd_obj != nil ) |
| 82 | return( cast->JObjToJThd(thd_obj) ); | 80 | return( cast->JObjToJThd(thd_obj) ); |
| 83 | sys->unrescue(); | ||
| 84 | } | 81 | } |
| 85 | else | 82 | exception e |
| 86 | sys->rescued(Sys->ONCE, nil); | 83 | { |
| 84 | "*" => | ||
| 85 | ; # ignore | ||
| 86 | } | ||
| 87 | 87 | ||
| 88 | 88 | ||
| 89 | # either we could not find the thread data | 89 | # either we could not find the thread data |
| @@ -118,7 +118,7 @@ sleep_J_V( p0 : big) · 28 unmodified lines | |||
| 118 | jldr->sleep( millis ); | 118 | jldr->sleep( millis ); |
| 119 | }#<< | 119 | }#<< |
| 120 | 120 | ||
| 121 | start_V( this : JThread) | 121 | start0_V( this : JThread) |
| 122 | {#>> | 122 | {#>> |
| 123 | thdobj := cast->JThdToJObj(this); | 123 | thdobj := cast->JThdToJObj(this); |
| 124 | 124 | ||
| @@ -249,10 +249,7 @@ lowinit_rThread_V( p0 : JThread) · 124 unmodified lines | |||
| 249 | # java.lang.Thread object. 'p0' is the "root thread" object | 249 | # java.lang.Thread object. 'p0' is the "root thread" object |
| 250 | # which must be associated witht the Dis thread which is | 250 | # which must be associated witht the Dis thread which is |
| 251 | # calling this fuction -- i.e. associate the 'p0' java thread | 251 | # calling this fuction -- i.e. associate the 'p0' java thread |
| 252 | # object with the current Dis thread. 'p1' is the same thread | 252 | # object with the current Dis thread. |
| 253 | # object, just with the type JObject which allows us to store | ||
| 254 | # it off in the JavaClassLoader->ThreadData structure associated | ||
| 255 | # with the calling Dis thread. | ||
| 256 | 253 | ||
| 257 | # since this is the root thread make a root thread group by | 254 | # since this is the root thread make a root thread group by |
| 258 | # creating an instance of ThreadGroup and calling its private | 255 | # creating an instance of ThreadGroup and calling its private |
| @@ -273,6 +270,32 @@ lowinit_rThread_V( p0 : JThread) · 14 unmodified lines | |||
| 273 | 270 | ||
| 274 | }#<< | 271 | }#<< |
| 275 | 272 | ||
| 273 | holdsLock_rObject_Z( p0 : JObject) : int | ||
| 274 | {#>> | ||
| 275 | if (p0 == nil) | ||
| 276 | jni->ThrowException( "java.lang.NullPointerException", "obj arg is null" ); | ||
| 277 | |||
| 278 | # TODO: implement | ||
| 279 | return 0; | ||
| 280 | }#<< | ||
| 281 | |||
| 282 | dumpThreads_aThread_aaStackTraceElement( p0 : JArrayJObject) : JArray | ||
| 283 | {#>> | ||
| 284 | # TODO: implement | ||
| 285 | return nil; | ||
| 286 | }#<< | ||
| 287 | |||
| 288 | getThreads_aThread( ) : JArrayJObject | ||
| 289 | {#>> | ||
| 290 | # TODO: implement | ||
| 291 | return nil; | ||
| 292 | }#<< | ||
| 293 | |||
| 294 | registerNatives_V( ) | ||
| 295 | {#>> | ||
| 296 | # currently empty... | ||
| 297 | }#<< | ||
| 298 | |||
| 276 | 299 | ||
| 277 | 300 | ||
| 278 | 301 | ||
| @@ -324,8 +347,6 @@ javathreadinit( jthd : JNI->JThread, ok : chan of int ) · 45 unmodified lines | |||
| 324 | 347 | ||
| 325 | # we need to catch any exceptions in order | 348 | # we need to catch any exceptions in order |
| 326 | # to clean up the thread object's state | 349 | # to clean up the thread object's state |
| 327 | ee := ref Sys->Exception; | ||
| 328 | if ( sys->rescue( "*", ee ) == Sys->HANDLER ) | ||
| 329 | { | 350 | { |
| 330 | 351 | ||
| 331 | # call Thread.run() or Runnable.run() | 352 | # call Thread.run() or Runnable.run() |
| @@ -334,17 +355,14 @@ javathreadinit( jthd : JNI->JThread, ok : chan of int ) · 2 unmodified lines | |||
| 334 | # call Thread.exit() | 355 | # call Thread.exit() |
| 335 | (mod,idx) := jni->FindMethod( threadclass, "exit", "()V", JNI->METH_PRIVATE ); | 356 | (mod,idx) := jni->FindMethod( threadclass, "exit", "()V", JNI->METH_PRIVATE ); |
| 336 | jni->jassist->mcall1( mod, idx, thdobj ); | 357 | jni->jassist->mcall1( mod, idx, thdobj ); |
| 337 | sys->unrescue(); | ||
| 338 | } | 358 | } |
| 339 | else | 359 | exception e |
| 340 | { | 360 | { |
| 341 | # clear exception | 361 | "*" => |
| 342 | sys->rescued( Sys->ONCE, nil ); | 362 | # thread threw an unhandled exception so |
| 343 | 363 | # call the ThreadGroup.uncaughtException() | |
| 344 | # thread threw an unhandled exception so | 364 | # method. |
| 345 | # call the ThreadGroup.uncaughtException() | 365 | UncaughtException( jthd, thdobj, e ); |
| 346 | # method. | ||
| 347 | UncaughtException( jthd, thdobj, ee ); | ||
| 348 | } | 366 | } |
| 349 | 367 | ||
| 350 | # java thread clean up | 368 | # java thread clean up |
| @@ -408,7 +426,7 @@ Run( jthd : JNI->JThread, thdobj : JObject ) · 57 unmodified lines | |||
| 408 | # The method is passed an instance of the Thread along with the | 426 | # The method is passed an instance of the Thread along with the |
| 409 | # "throwable" (i.e. exception). | 427 | # "throwable" (i.e. exception). |
| 410 | # | 428 | # |
| 411 | UncaughtException( jthd : JThread, thdobj : JObject, ee : ref Sys->Exception ) | 429 | UncaughtException( jthd : JThread, thdobj : JObject, ee : string ) |
| 412 | { | 430 | { |
| 413 | tgrp_cl := jni->GetObjectClassData( jthd.group ); | 431 | tgrp_cl := jni->GetObjectClassData( jthd.group ); |
| 414 | 432 | ||
| @@ -421,8 +439,6 @@ UncaughtException( jthd : JThread, thdobj : JObject, ee : ref Sys->Exception ) · 6 unmodified lines | |||
| 421 | { | 439 | { |
| 422 | # call method, protected against exceptions | 440 | # call method, protected against exceptions |
| 423 | # since we must still clean-up the thread | 441 | # since we must still clean-up the thread |
| 424 | eee := ref Sys->Exception; | ||
| 425 | if ( sys->rescue( "*", eee ) == Sys->HANDLER ) | ||
| 426 | { | 442 | { |
| 427 | # find the uncaughtException method for the thd-grp | 443 | # find the uncaughtException method for the thd-grp |
| 428 | (mod,idx) := jni->FindMethod( tgrp_cl, "uncaughtException", | 444 | (mod,idx) := jni->FindMethod( tgrp_cl, "uncaughtException", |
| @@ -441,13 +457,12 @@ UncaughtException( jthd : JThread, thdobj : JObject, ee : ref Sys->Exception ) · 12 unmodified lines | |||
| 441 | # do the call | 457 | # do the call |
| 442 | ##LATER nil := jni->LowCall( mod, idx, jthd.group, args ); | 458 | ##LATER nil := jni->LowCall( mod, idx, jthd.group, args ); |
| 443 | } | 459 | } |
| 444 | sys->unrescue(); | ||
| 445 | } | 460 | } |
| 446 | else | 461 | exception e |
| 447 | { | 462 | { |
| 448 | # if we get an exception here just return | 463 | "*" => |
| 449 | # and let the thread finish cleanup. | 464 | # if we get an exception here just return |
| 450 | sys->rescued( Sys->ONCE, nil ); | 465 | # and let the thread finish cleanup. |
| 451 | } | 466 | } |
| 452 | } | 467 | } |
| 453 | 468 | ||
| @@ -1,16 +1,20 @@ | |||
| 1 | # javal v1.3 generated file: edit with care | 1 | # generated file edit with care |
| 2 | 2 | ||
| 3 | Thread_L : module | 3 | Thread_L : module |
| 4 | { | 4 | { |
| 5 | 5 | ||
| 6 | init : fn( jni_p : JNI ); | 6 | init : fn( jni_p : JNI ); |
| 7 | isInterrupted_Z_Z : fn( this : JThread, p0 : int) : int; | ||
| 7 | currentThread_rThread : fn( ) : JThread; | 8 | currentThread_rThread : fn( ) : JThread; |
| 9 | registerNatives_V : fn( ); | ||
| 10 | holdsLock_rObject_Z : fn( p0 : JObject) : int; | ||
| 8 | yield_V : fn( ); | 11 | yield_V : fn( ); |
| 9 | sleep_J_V : fn( p0 : big); | 12 | sleep_J_V : fn( p0 : big); |
| 10 | start_V : fn( this : JThread); | 13 | start0_V : fn( this : JThread); |
| 11 | isInterrupted_Z_Z : fn( this : JThread, p0 : int) : int; | ||
| 12 | isAlive_Z : fn( this : JThread) : int; | 14 | isAlive_Z : fn( this : JThread) : int; |
| 13 | countStackFrames_I : fn( this : JThread) : int; | 15 | countStackFrames_I : fn( this : JThread) : int; |
| 16 | dumpThreads_aThread_aaStackTraceElement : fn( p0 : JArrayJObject) : JArray; | ||
| 17 | getThreads_aThread : fn( ) : JArrayJObject; | ||
| 14 | setPriority0_I_V : fn( this : JThread, p0 : int); | 18 | setPriority0_I_V : fn( this : JThread, p0 : int); |
| 15 | stop0_rObject_V : fn( this : JThread, p0 : JObject); | 19 | stop0_rObject_V : fn( this : JThread, p0 : JObject); |
| 16 | suspend0_V : fn( this : JThread); | 20 | suspend0_V : fn( this : JThread); |