6161import com .oracle .truffle .espresso .impl .PrimitiveKlass ;
6262import com .oracle .truffle .espresso .meta .EspressoError ;
6363import com .oracle .truffle .espresso .meta .Meta ;
64+ import com .oracle .truffle .espresso .nodes .EspressoInlineNode ;
6465import com .oracle .truffle .espresso .nodes .interop .LookupInternalTypeConverterNode ;
6566import com .oracle .truffle .espresso .nodes .interop .LookupTypeConverterNode ;
6667import com .oracle .truffle .espresso .nodes .interop .MethodArgsUtils ;
@@ -4275,7 +4276,7 @@ static StaticObject doCached(
42754276 */
42764277 @ GenerateInline
42774278 @ GenerateCached (false )
4278- abstract static class ToHostArguments extends SubstitutionNode {
4279+ abstract static class ToHostArguments extends EspressoInlineNode {
42794280 private static final Object [] EMPTY_ARRAY = new Object [0 ];
42804281
42814282 abstract Object [] execute (Node node , boolean unwrapArguments , @ JavaType (Object [].class ) StaticObject arguments );
@@ -4284,48 +4285,53 @@ abstract static class ToHostArguments extends SubstitutionNode {
42844285 "!unwrapArguments" ,
42854286 "arguments.isEspressoObject()"
42864287 })
4287- Object [] doEspressoNoUnwrap (
4288+ static Object [] doEspressoNoUnwrap (
42884289 @ SuppressWarnings ("unused" ) boolean unwrapArguments ,
4289- @ JavaType (Object [].class ) StaticObject arguments ) {
4290- return arguments .<StaticObject []> unwrap (getLanguage ());
4290+ @ JavaType (Object [].class ) StaticObject arguments ,
4291+ @ Bind ("$node" ) Node node ) {
4292+ return arguments .<StaticObject []> unwrap (EspressoLanguage .get (node ));
42914293 }
42924294
42934295 @ Specialization (guards = {
42944296 "unwrapArguments" ,
42954297 "arguments.isEspressoObject()" ,
42964298 })
4297- Object [] doEspressoUnwrap (
4299+ static Object [] doEspressoUnwrap (
42984300 @ SuppressWarnings ("unused" ) boolean unwrapArguments ,
4299- @ JavaType (Object [].class ) StaticObject arguments ) {
4300- EspressoLanguage language = getLanguage ();
4301+ @ JavaType (Object [].class ) StaticObject arguments ,
4302+ @ Bind ("$node" ) Node node ) {
4303+ EspressoLanguage language = EspressoLanguage .get (node );
43014304 Object [] rawArgs = arguments .unwrap (language );
43024305 if (rawArgs .length == 0 ) {
43034306 return EMPTY_ARRAY ;
43044307 }
43054308 Object [] hostArgs = new Object [rawArgs .length ];
4309+ Meta meta = EspressoContext .get (node ).getMeta ();
43064310 for (int i = 0 ; i < rawArgs .length ; ++i ) {
4307- hostArgs [i ] = InteropUtils .unwrap (language , (StaticObject ) rawArgs [i ], getMeta () );
4311+ hostArgs [i ] = InteropUtils .unwrap (language , (StaticObject ) rawArgs [i ], meta );
43084312 }
43094313 return hostArgs ;
43104314 }
43114315
43124316 @ Specialization (guards = {
43134317 "arguments.isForeignObject()" ,
43144318 })
4315- Object [] doForeign (
4319+ static Object [] doForeign (
43164320 boolean unwrapArguments ,
43174321 @ JavaType (Object [].class ) StaticObject arguments ,
43184322 @ Cached (inline = false ) GetArraySize getArraySize ,
4319- @ Cached (inline = false ) ReadArrayElement readArrayElement ) {
4320- EspressoLanguage language = getLanguage ();
4323+ @ Cached (inline = false ) ReadArrayElement readArrayElement ,
4324+ @ Bind ("$node" ) Node node ) {
4325+ EspressoLanguage language = EspressoLanguage .get (node );
43214326 int argsLength = Math .toIntExact (getArraySize .execute (arguments ));
43224327 if (argsLength == 0 ) {
43234328 return EMPTY_ARRAY ;
43244329 }
43254330 Object [] hostArgs = new Object [argsLength ];
4331+ Meta meta = EspressoContext .get (node ).getMeta ();
43264332 for (int i = 0 ; i < argsLength ; ++i ) {
43274333 StaticObject elem = readArrayElement .execute (arguments , i );
4328- hostArgs [i ] = unwrapArguments ? InteropUtils .unwrap (language , elem , getMeta () ) : elem ;
4334+ hostArgs [i ] = unwrapArguments ? InteropUtils .unwrap (language , elem , meta ) : elem ;
43294335 }
43304336 return hostArgs ;
43314337 }
@@ -4336,7 +4342,7 @@ Object[] doForeign(
43364342 */
43374343 @ GenerateInline
43384344 @ GenerateCached (false )
4339- abstract static class ThrowInteropExceptionAsGuest extends SubstitutionNode {
4345+ abstract static class ThrowInteropExceptionAsGuest extends EspressoInlineNode {
43404346 static final int LIMIT = 2 ;
43414347
43424348 abstract RuntimeException execute (Node node , InteropException hostException );
@@ -4347,8 +4353,8 @@ static RuntimeException doUnsupportedMessageException(
43474353 UnsupportedMessageException e ,
43484354 @ CachedLibrary (limit = "LIMIT" ) @ Shared InteropLibrary causeInterop ,
43494355 @ Cached @ Shared InlinedConditionProfile noCauseProfile ,
4350- @ Cached (value = "create(getMeta().polyglot.UnsupportedMessageException_create.getCallTargetForceInit())" , inline = false ) DirectCallNode create ,
4351- @ Cached (value = "create(getMeta().polyglot.UnsupportedMessageException_create_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithCause ) {
4356+ @ Cached (value = "create(getMeta(node ).polyglot.UnsupportedMessageException_create.getCallTargetForceInit())" , inline = false ) DirectCallNode create ,
4357+ @ Cached (value = "create(getMeta(node ).polyglot.UnsupportedMessageException_create_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithCause ) {
43524358 Throwable cause = e .getCause ();
43534359 assert cause == null || cause instanceof AbstractTruffleException ;
43544360 EspressoContext context = EspressoContext .get (node );
@@ -4367,8 +4373,8 @@ static RuntimeException doUnknownIdentifierException(
43674373 UnknownIdentifierException e ,
43684374 @ CachedLibrary (limit = "LIMIT" ) @ Shared InteropLibrary causeInterop ,
43694375 @ Cached @ Shared InlinedConditionProfile noCauseProfile ,
4370- @ Cached (value = "create(getMeta().polyglot.UnknownIdentifierException_create_String.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithIdentifier ,
4371- @ Cached (value = "create(getMeta().polyglot.UnknownIdentifierException_create_String_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithIdentifierAndCause ) {
4376+ @ Cached (value = "create(getMeta(node ).polyglot.UnknownIdentifierException_create_String.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithIdentifier ,
4377+ @ Cached (value = "create(getMeta(node ).polyglot.UnknownIdentifierException_create_String_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithIdentifierAndCause ) {
43724378 EspressoContext context = EspressoContext .get (node );
43734379 Meta meta = context .getMeta ();
43744380 StaticObject unknownIdentifier = meta .toGuestString (e .getUnknownIdentifier ());
@@ -4390,8 +4396,8 @@ static RuntimeException doArityException(
43904396 ArityException e ,
43914397 @ CachedLibrary (limit = "LIMIT" ) @ Shared InteropLibrary causeInterop ,
43924398 @ Cached @ Shared InlinedConditionProfile noCauseProfile ,
4393- @ Cached (value = "create(getMeta().polyglot.ArityException_create_int_int_int.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithArityRange ,
4394- @ Cached (value = "create(getMeta().polyglot.ArityException_create_int_int_int_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithArityRangeAndCause ) {
4399+ @ Cached (value = "create(getMeta(node ).polyglot.ArityException_create_int_int_int.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithArityRange ,
4400+ @ Cached (value = "create(getMeta(node ).polyglot.ArityException_create_int_int_int_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithArityRangeAndCause ) {
43954401 int expectedMinArity = e .getExpectedMinArity ();
43964402 int expectedMaxArity = e .getExpectedMaxArity ();
43974403 int actualArity = e .getActualArity ();
@@ -4419,8 +4425,8 @@ static RuntimeException doUnsupportedTypeException(
44194425 UnsupportedTypeException e ,
44204426 @ CachedLibrary (limit = "LIMIT" ) @ Shared InteropLibrary causeInterop ,
44214427 @ Cached @ Shared InlinedConditionProfile noCauseProfile ,
4422- @ Cached (value = "create(getMeta().polyglot.UnsupportedTypeException_create_Object_array_String.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithValuesHint ,
4423- @ Cached (value = "create(getMeta().polyglot.UnsupportedTypeException_create_Object_array_String_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithValuesHintAndCause ) {
4428+ @ Cached (value = "create(getMeta(node ).polyglot.UnsupportedTypeException_create_Object_array_String.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithValuesHint ,
4429+ @ Cached (value = "create(getMeta(node ).polyglot.UnsupportedTypeException_create_Object_array_String_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithValuesHintAndCause ) {
44244430 Object [] hostValues = e .getSuppliedValues ();
44254431 EspressoContext context = EspressoContext .get (node );
44264432 Meta meta = context .getMeta ();
@@ -4451,8 +4457,8 @@ static RuntimeException doInvalidArrayIndexException(
44514457 InvalidArrayIndexException e ,
44524458 @ CachedLibrary (limit = "LIMIT" ) @ Shared InteropLibrary causeInterop ,
44534459 @ Cached @ Shared InlinedConditionProfile noCauseProfile ,
4454- @ Cached (value = "create(getMeta().polyglot.InvalidArrayIndexException_create_long.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithIndex ,
4455- @ Cached (value = "create(getMeta().polyglot.InvalidArrayIndexException_create_long_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithIndexAndCause ) {
4460+ @ Cached (value = "create(getMeta(node ).polyglot.InvalidArrayIndexException_create_long.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithIndex ,
4461+ @ Cached (value = "create(getMeta(node ).polyglot.InvalidArrayIndexException_create_long_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithIndexAndCause ) {
44564462 long invalidIndex = e .getInvalidIndex ();
44574463 Throwable cause = e .getCause ();
44584464 EspressoContext context = EspressoContext .get (node );
@@ -4473,8 +4479,8 @@ static RuntimeException doInvalidBufferOffsetException(
44734479 InvalidBufferOffsetException e ,
44744480 @ CachedLibrary (limit = "LIMIT" ) @ Shared InteropLibrary causeInterop ,
44754481 @ Cached @ Shared InlinedConditionProfile noCauseProfile ,
4476- @ Cached (value = "create(getMeta().polyglot.InvalidBufferOffsetException_create_long_long.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithOffsetLength ,
4477- @ Cached (value = "create(getMeta().polyglot.InvalidBufferOffsetException_create_long_long_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithOffsetLengthAndCause ) {
4482+ @ Cached (value = "create(getMeta(node ).polyglot.InvalidBufferOffsetException_create_long_long.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithOffsetLength ,
4483+ @ Cached (value = "create(getMeta(node ).polyglot.InvalidBufferOffsetException_create_long_long_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithOffsetLengthAndCause ) {
44784484 long byteOffset = e .getByteOffset ();
44794485 long length = e .getLength ();
44804486 Throwable cause = e .getCause ();
@@ -4497,8 +4503,8 @@ static RuntimeException doStopIterationException(
44974503 StopIterationException e ,
44984504 @ CachedLibrary (limit = "LIMIT" ) @ Shared InteropLibrary causeInterop ,
44994505 @ Cached @ Shared InlinedConditionProfile noCauseProfile ,
4500- @ Cached (value = "create(getMeta().polyglot.StopIterationException_create.getCallTargetForceInit())" , inline = false ) DirectCallNode create ,
4501- @ Cached (value = "create(getMeta().polyglot.StopIterationException_create_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithCause ) {
4506+ @ Cached (value = "create(getMeta(node ).polyglot.StopIterationException_create.getCallTargetForceInit())" , inline = false ) DirectCallNode create ,
4507+ @ Cached (value = "create(getMeta(node ).polyglot.StopIterationException_create_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithCause ) {
45024508 Throwable cause = e .getCause ();
45034509 EspressoContext context = EspressoContext .get (node );
45044510 Meta meta = context .getMeta ();
@@ -4517,8 +4523,8 @@ static RuntimeException doUnknownKeyException(
45174523 @ CachedLibrary (limit = "LIMIT" ) @ Exclusive InteropLibrary keyInterop ,
45184524 @ CachedLibrary (limit = "LIMIT" ) @ Shared InteropLibrary causeInterop ,
45194525 @ Cached @ Shared InlinedConditionProfile noCauseProfile ,
4520- @ Cached (value = "create(getMeta().polyglot.UnknownKeyException_create_Object.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithKey ,
4521- @ Cached (value = "create(getMeta().polyglot.UnknownKeyException_create_Object_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithKeyAndCause ) {
4526+ @ Cached (value = "create(getMeta(node ).polyglot.UnknownKeyException_create_Object.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithKey ,
4527+ @ Cached (value = "create(getMeta(node ).polyglot.UnknownKeyException_create_Object_Throwable.getCallTargetForceInit())" , inline = false ) DirectCallNode createWithKeyAndCause ) {
45224528 EspressoContext context = EspressoContext .get (node );
45234529 Meta meta = context .getMeta ();
45244530 StaticObject unknownKey = InteropUtils .maybeWrapAsObject (e .getUnknownKey (), keyInterop , context );
0 commit comments