|
41 | 41 | import com.oracle.truffle.api.CompilerDirectives;
|
42 | 42 | import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
|
43 | 43 | import com.oracle.truffle.api.dsl.Cached;
|
| 44 | +import com.oracle.truffle.api.dsl.Cached.Shared; |
44 | 45 | import com.oracle.truffle.api.dsl.CachedContext;
|
45 | 46 | import com.oracle.truffle.api.dsl.Fallback;
|
46 | 47 | import com.oracle.truffle.api.dsl.Specialization;
|
@@ -416,134 +417,134 @@ public boolean hasMembers() {
|
416 | 417 |
|
417 | 418 | @ExportMessage
|
418 | 419 | public Object getMembers(boolean includeInternal,
|
419 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 420 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
420 | 421 | @CachedContext(PythonLanguage.class) PythonContext context) throws UnsupportedMessageException {
|
421 | 422 | return lib.getMembers(context.getCore().lookupType(this), includeInternal);
|
422 | 423 | }
|
423 | 424 |
|
424 | 425 | @ExportMessage
|
425 | 426 | public boolean isMemberReadable(String key,
|
426 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 427 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
427 | 428 | @CachedContext(PythonLanguage.class) PythonContext context) {
|
428 | 429 | return lib.isMemberReadable(context.getCore().lookupType(this), key);
|
429 | 430 | }
|
430 | 431 |
|
431 | 432 | @ExportMessage
|
432 | 433 | public Object readMember(String key,
|
433 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 434 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
434 | 435 | @CachedContext(PythonLanguage.class) PythonContext context) throws UnsupportedMessageException, UnknownIdentifierException {
|
435 | 436 | return lib.readMember(context.getCore().lookupType(this), key);
|
436 | 437 | }
|
437 | 438 |
|
438 | 439 | @ExportMessage
|
439 | 440 | public boolean isMemberModifiable(String key,
|
440 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 441 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
441 | 442 | @CachedContext(PythonLanguage.class) PythonContext context) {
|
442 | 443 | return lib.isMemberModifiable(context.getCore().lookupType(this), key);
|
443 | 444 | }
|
444 | 445 |
|
445 | 446 | @ExportMessage
|
446 | 447 | public boolean isMemberInsertable(String key,
|
447 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 448 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
448 | 449 | @CachedContext(PythonLanguage.class) PythonContext context) {
|
449 | 450 | return lib.isMemberInsertable(context.getCore().lookupType(this), key);
|
450 | 451 | }
|
451 | 452 |
|
452 | 453 | @ExportMessage
|
453 | 454 | public void writeMember(String key, Object value,
|
454 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 455 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
455 | 456 | @CachedContext(PythonLanguage.class) PythonContext context) throws UnsupportedMessageException, UnknownIdentifierException, UnsupportedTypeException {
|
456 | 457 | lib.writeMember(context.getCore().lookupType(this), key, value);
|
457 | 458 | }
|
458 | 459 |
|
459 | 460 | @ExportMessage
|
460 | 461 | public boolean isMemberRemovable(String key,
|
461 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 462 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
462 | 463 | @CachedContext(PythonLanguage.class) PythonContext context) {
|
463 | 464 | return lib.isMemberRemovable(context.getCore().lookupType(this), key);
|
464 | 465 | }
|
465 | 466 |
|
466 | 467 | @ExportMessage
|
467 | 468 | public void removeMember(String key,
|
468 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 469 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
469 | 470 | @CachedContext(PythonLanguage.class) PythonContext context) throws UnsupportedMessageException, UnknownIdentifierException {
|
470 | 471 | lib.removeMember(context.getCore().lookupType(this), key);
|
471 | 472 | }
|
472 | 473 |
|
473 | 474 | @ExportMessage
|
474 | 475 | public boolean isMemberInvocable(String key,
|
475 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 476 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
476 | 477 | @CachedContext(PythonLanguage.class) PythonContext context) {
|
477 | 478 | return lib.isMemberInvocable(context.getCore().lookupType(this), key);
|
478 | 479 | }
|
479 | 480 |
|
480 | 481 | @ExportMessage
|
481 | 482 | public Object invokeMember(String key, Object[] arguments,
|
482 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 483 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
483 | 484 | @CachedContext(PythonLanguage.class) PythonContext context) throws UnsupportedMessageException, ArityException, UnknownIdentifierException, UnsupportedTypeException {
|
484 | 485 | return lib.invokeMember(context.getCore().lookupType(this), key, arguments);
|
485 | 486 | }
|
486 | 487 |
|
487 | 488 | @ExportMessage
|
488 | 489 | public boolean isMemberInternal(String key,
|
489 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 490 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
490 | 491 | @CachedContext(PythonLanguage.class) PythonContext context) {
|
491 | 492 | return lib.isMemberInternal(context.getCore().lookupType(this), key);
|
492 | 493 | }
|
493 | 494 |
|
494 | 495 | @ExportMessage
|
495 | 496 | public boolean hasMemberReadSideEffects(String key,
|
496 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 497 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
497 | 498 | @CachedContext(PythonLanguage.class) PythonContext context) {
|
498 | 499 | return lib.hasMemberReadSideEffects(context.getCore().lookupType(this), key);
|
499 | 500 | }
|
500 | 501 |
|
501 | 502 | @ExportMessage
|
502 | 503 | public boolean hasMemberWriteSideEffects(String key,
|
503 |
| - @CachedLibrary(limit = "1") InteropLibrary lib, |
| 504 | + @Shared("interop") @CachedLibrary(limit = "1") InteropLibrary lib, |
504 | 505 | @CachedContext(PythonLanguage.class) PythonContext context) {
|
505 | 506 | return lib.hasMemberWriteSideEffects(context.getCore().lookupType(this), key);
|
506 | 507 | }
|
507 | 508 |
|
508 | 509 | @ExportMessage
|
509 | 510 | static boolean isSequenceType(PythonBuiltinClassType type,
|
510 | 511 | @CachedContext(PythonLanguage.class) PythonContext context,
|
511 |
| - @CachedLibrary(limit = "1") PythonObjectLibrary lib) { |
| 512 | + @Shared("pol") @CachedLibrary(limit = "1") PythonObjectLibrary lib) { |
512 | 513 | return lib.isSequenceType(context.getCore().lookupType(type));
|
513 | 514 | }
|
514 | 515 |
|
515 | 516 | @ExportMessage
|
516 | 517 | static boolean isMappingType(PythonBuiltinClassType type,
|
517 | 518 | @CachedContext(PythonLanguage.class) PythonContext context,
|
518 |
| - @CachedLibrary(limit = "1") PythonObjectLibrary lib) { |
| 519 | + @Shared("pol") @CachedLibrary(limit = "1") PythonObjectLibrary lib) { |
519 | 520 | return lib.isMappingType(context.getCore().lookupType(type));
|
520 | 521 | }
|
521 | 522 |
|
522 | 523 | @ExportMessage
|
523 | 524 | static long hashWithState(PythonBuiltinClassType type, ThreadState state,
|
524 | 525 | @CachedContext(PythonLanguage.class) PythonContext context,
|
525 |
| - @CachedLibrary(limit = "1") PythonObjectLibrary lib) { |
| 526 | + @Shared("pol") @CachedLibrary(limit = "1") PythonObjectLibrary lib) { |
526 | 527 | return lib.hashWithState(context.getCore().lookupType(type), state);
|
527 | 528 | }
|
528 | 529 |
|
529 | 530 | @ExportMessage
|
530 | 531 | @SuppressWarnings("unused")
|
531 | 532 | static double asJavaDoubleWithState(PythonBuiltinClassType type, ThreadState state,
|
532 |
| - @Cached PRaiseNode raiseNode) { |
| 533 | + @Shared("raise") @Cached PRaiseNode raiseNode) { |
533 | 534 | throw raiseNode.raise(TypeError, ErrorMessages.MUST_BE_REAL_NUMBER, type);
|
534 | 535 | }
|
535 | 536 |
|
536 | 537 | @ExportMessage
|
537 | 538 | @SuppressWarnings("unused")
|
538 | 539 | static Object asPIntWithState(PythonBuiltinClassType type, ThreadState state,
|
539 |
| - @Cached PRaiseNode raiseNode) { |
| 540 | + @Shared("raise") @Cached PRaiseNode raiseNode) { |
540 | 541 | throw raiseNode.raise(TypeError, ErrorMessages.OBJ_CANNOT_BE_INTERPRETED_AS_INTEGER, type);
|
541 | 542 | }
|
542 | 543 |
|
543 | 544 | @ExportMessage
|
544 | 545 | @SuppressWarnings("unused")
|
545 | 546 | static long asJavaLongWithState(PythonBuiltinClassType type, ThreadState state,
|
546 |
| - @Cached PRaiseNode raiseNode) { |
| 547 | + @Shared("raise") @Cached PRaiseNode raiseNode) { |
547 | 548 | throw raiseNode.raise(TypeError, ErrorMessages.MUST_BE_NUMERIC, type);
|
548 | 549 | }
|
549 | 550 |
|
|
0 commit comments