comparison truffle/com.oracle.truffle.tck/src/com/oracle/truffle/tck/TruffleTCK.java @ 22141:46384e637592

Make sure the proper TruffleVM execution context is re-set before invoking an operation on a JavaInterop wrapper obtained via Symbol.as method.
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Mon, 14 Sep 2015 11:02:52 +0200
parents 92906003d607
children cf604b9633c9
comparison
equal deleted inserted replaced
22140:92906003d607 22141:46384e637592
581 Thread.sleep(wait); 581 Thread.sleep(wait);
582 return null; 582 return null;
583 } 583 }
584 TruffleVM.Symbol s = vm().findGlobalSymbol(compoundObjectName); 584 TruffleVM.Symbol s = vm().findGlobalSymbol(compoundObjectName);
585 assert s != null : "Symbol " + compoundObjectName + " is not found!"; 585 assert s != null : "Symbol " + compoundObjectName + " is not found!";
586 CompoundObject obj = s.invoke(null).as(CompoundObject.class); 586 final TruffleVM.Symbol value = s.invoke(null);
587 CompoundObject obj = value.as(CompoundObject.class);
588 assertNotNull("Compound object for " + value + " found", obj);
587 int traverse = RANDOM.nextInt(10); 589 int traverse = RANDOM.nextInt(10);
588 while (traverse-- >= 0) { 590 for (int i = 1; i <= traverse; i++) {
589 obj = obj.returnsThis(); 591 obj = obj.returnsThis();
592 assertNotNull("Remains non-null even after " + i + " iteration", obj);
590 } 593 }
591 return obj; 594 return obj;
592 } 595 }
593 596
594 interface CompoundObject { 597 interface CompoundObject {