Showing the changes to java (2 of 2 files). Show all
Unified · Split
| @@ -71,8 +71,6 @@ init( jni_p : JNI ) · 70 unmodified lines | ||
| 71 | 71 | |
| 72 | 72 | currentThread_rThread( ) : JThread |
| 73 | 73 | {#>> |
| 74 | − e := ref Sys->Exception; | |
| 75 | − if ( sys->rescue("*",e) == Sys->HANDLER ) | |
| 76 | 74 | { |
| 77 | 75 | # get the java thread object assocciated |
| 78 | 76 | # with this thread. it is stored in the |
| @@ -80,10 +78,12 @@ currentThread_rThread( ) : JThread · 1 unmodified line | ||
| 80 | 78 | thd_obj := jldr->getthreaddata().this; |
| 81 | 79 | if ( thd_obj != nil ) |
| 82 | 80 | return( cast->JObjToJThd(thd_obj) ); |
| 83 | − sys->unrescue(); | |
| 84 | 81 | } |
| 85 | − else | |
| 86 | − sys->rescued(Sys->ONCE, nil); | |
| 82 | + exception e | |
| 83 | + { | |
| 84 | + "*" => | |
| 85 | + ; # ignore | |
| 86 | + } | |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | # either we could not find the thread data |
| @@ -118,7 +118,7 @@ sleep_J_V( p0 : big) · 28 unmodified lines | ||
| 118 | 118 | jldr->sleep( millis ); |
| 119 | 119 | }#<< |
| 120 | 120 | |
| 121 | −start_V( this : JThread) | |
| 121 | +start0_V( this : JThread) | |
| 122 | 122 | {#>> |
| 123 | 123 | thdobj := cast->JThdToJObj(this); |
| 124 | 124 | |
| @@ -249,10 +249,7 @@ lowinit_rThread_V( p0 : JThread) · 124 unmodified lines | ||
| 249 | 249 | # java.lang.Thread object. 'p0' is the "root thread" object |
| 250 | 250 | # which must be associated witht the Dis thread which is |
| 251 | 251 | # calling this fuction -- i.e. associate the 'p0' java thread |
| 252 | − # object with the current Dis thread. 'p1' is the same 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. | |
| 252 | + # object with the current Dis thread. | |
| 256 | 253 | |
| 257 | 254 | # since this is the root thread make a root thread group by |
| 258 | 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 | 348 | # we need to catch any exceptions in order |
| 326 | 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 | 352 | # call Thread.run() or Runnable.run() |
| @@ -334,17 +355,14 @@ javathreadinit( jthd : JNI->JThread, ok : chan of int ) · 2 unmodified lines | ||
| 334 | 355 | # call Thread.exit() |
| 335 | 356 | (mod,idx) := jni->FindMethod( threadclass, "exit", "()V", JNI->METH_PRIVATE ); |
| 336 | 357 | jni->jassist->mcall1( mod, idx, thdobj ); |
| 337 | − sys->unrescue(); | |
| 338 | 358 | } |
| 339 | − else | |
| 359 | + exception e | |
| 340 | 360 | { |
| 341 | − # clear exception | |
| 342 | − sys->rescued( Sys->ONCE, nil ); | |
| 343 | − | |
| 344 | − # thread threw an unhandled exception so | |
| 345 | − # call the ThreadGroup.uncaughtException() | |
| 346 | − # method. | |
| 347 | − UncaughtException( jthd, thdobj, ee ); | |
| 361 | + "*" => | |
| 362 | + # thread threw an unhandled exception so | |
| 363 | + # call the ThreadGroup.uncaughtException() | |
| 364 | + # method. | |
| 365 | + UncaughtException( jthd, thdobj, e ); | |
| 348 | 366 | } |
| 349 | 367 | |
| 350 | 368 | # java thread clean up |
| @@ -408,7 +426,7 @@ Run( jthd : JNI->JThread, thdobj : JObject ) · 57 unmodified lines | ||
| 408 | 426 | # The method is passed an instance of the Thread along with the |
| 409 | 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 | 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 | 440 | # call method, protected against exceptions |
| 423 | 441 | # since we must still clean-up the thread |
| 424 | − eee := ref Sys->Exception; | |
| 425 | − if ( sys->rescue( "*", eee ) == Sys->HANDLER ) | |
| 426 | 442 | { |
| 427 | 443 | # find the uncaughtException method for the thd-grp |
| 428 | 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 | 457 | # do the call |
| 442 | 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 | |
| 449 | − # and let the thread finish cleanup. | |
| 450 | − sys->rescued( Sys->ONCE, nil ); | |
| 463 | + "*" => | |
| 464 | + # if we get an exception here just return | |
| 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 | 3 | Thread_L : module |
| 4 | 4 | { |
| 5 | 5 | |
| 6 | 6 | init : fn( jni_p : JNI ); |
| 7 | + isInterrupted_Z_Z : fn( this : JThread, p0 : int) : int; | |
| 7 | 8 | currentThread_rThread : fn( ) : JThread; |
| 9 | + registerNatives_V : fn( ); | |
| 10 | + holdsLock_rObject_Z : fn( p0 : JObject) : int; | |
| 8 | 11 | yield_V : fn( ); |
| 9 | 12 | sleep_J_V : fn( p0 : big); |
| 10 | − start_V : fn( this : JThread); | |
| 11 | − isInterrupted_Z_Z : fn( this : JThread, p0 : int) : int; | |
| 13 | + start0_V : fn( this : JThread); | |
| 12 | 14 | isAlive_Z : fn( this : JThread) : int; |
| 13 | 15 | countStackFrames_I : fn( this : JThread) : int; |
| 16 | + dumpThreads_aThread_aaStackTraceElement : fn( p0 : JArrayJObject) : JArray; | |
| 17 | + getThreads_aThread : fn( ) : JArrayJObject; | |
| 14 | 18 | setPriority0_I_V : fn( this : JThread, p0 : int); |
| 15 | 19 | stop0_rObject_V : fn( this : JThread, p0 : JObject); |
| 16 | 20 | suspend0_V : fn( this : JThread); |