/[dotgnu-pnet]/pnet/engine/cvmc_setup.c
ViewVC logotype

Diff of /pnet/engine/cvmc_setup.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.41 by tum, Wed Jun 9 03:39:21 2004 UTC revision 1.42 by ktreichel, Tue Aug 23 10:45:52 2005 UTC
# Line 144  static int CVMEntryAllocArgs(CVMEntryCon Line 144  static int CVMEntryAllocArgs(CVMEntryCon
144                  }                  }
145                  else                  else
146                  {                  {
147                          offset += GetTypeSize(type);                          offset += GetTypeSize(coder->process, type);
148                  }                  }
149          }          }
150    
# Line 194  static int CVMEntryAllocLocals(CVMEntryC Line 194  static int CVMEntryAllocLocals(CVMEntryC
194                  {                  {
195                          type = ILTypeGetLocal(signature, current);                          type = ILTypeGetLocal(signature, current);
196                          coder->localOffsets[current] = offset;                          coder->localOffsets[current] = offset;
197                          offset += GetTypeSize(type);                          offset += GetTypeSize(coder->process, type);
198                  }                  }
199    
200                  /* Record the number of words used for local variables */                  /* Record the number of words used for local variables */
# Line 208  static int CVMEntryAllocLocals(CVMEntryC Line 208  static int CVMEntryAllocLocals(CVMEntryC
208   * Make space for an extra local.  If "type" is NULL, then allocate   * Make space for an extra local.  If "type" is NULL, then allocate
209   * a single word for a pointer argument.   * a single word for a pointer argument.
210   */   */
211  static void CVMEntryNeedExtraLocal(CVMEntryContext *ctx, ILType *type)  static void CVMEntryNeedExtraLocal(ILExecProcess *process, CVMEntryContext *ctx,
212                                                                            ILType *type)
213  {  {
214          ctx->extraLocals += (type ? GetTypeSize(type) : 1);          ctx->extraLocals += (type ? GetTypeSize(process, type) : 1);
215  }  }
216    
217  /*  /*
# Line 218  static void CVMEntryNeedExtraLocal(CVMEn Line 219  static void CVMEntryNeedExtraLocal(CVMEn
219   * If "type" is NULL, then allocate a single word for a   * If "type" is NULL, then allocate a single word for a
220   * pointer argument.   * pointer argument.
221   */   */
222  static ILUInt32 CVMEntryAllocExtraLocal(CVMEntryContext *ctx, ILType *type)  static ILUInt32 CVMEntryAllocExtraLocal(ILExecProcess *process, CVMEntryContext *ctx, ILType *type)
223  {  {
224          ILUInt32 size = (type ? GetTypeSize(type) : 1);          ILUInt32 size = (type ? GetTypeSize(process, type) : 1);
225          ILUInt32 offset = ctx->extraOffset;          ILUInt32 offset = ctx->extraOffset;
226          ctx->firstExtraIsTop = (offset == 0 && ctx->extraLocals == size);          ctx->firstExtraIsTop = (offset == 0 && ctx->extraLocals == size);
227          ctx->extraOffset += size;          ctx->extraOffset += size;
# Line 442  static void CVMEntryPushLeadIn(CVMEntryC Line 443  static void CVMEntryPushLeadIn(CVMEntryC
443                  if(coder)                  if(coder)
444                  {                  {
445                          /* Allocate space for the return value */                          /* Allocate space for the return value */
446                          offset = CVMEntryAllocExtraLocal(ctx, returnType);                          offset = CVMEntryAllocExtraLocal(coder->process, ctx, returnType);
447                          ctx->returnOffset = offset;                          ctx->returnOffset = offset;
448    
449                          /* Pass the pointer to the native method */                          /* Pass the pointer to the native method */
# Line 456  static void CVMEntryPushLeadIn(CVMEntryC Line 457  static void CVMEntryPushLeadIn(CVMEntryC
457                          {                          {
458                                  CVM_OUT_WIDE(COP_WADDR, offset);                                  CVM_OUT_WIDE(COP_WADDR, offset);
459                                  CVM_ADJUST(1);                                  CVM_ADJUST(1);
460                                  offset = CVMEntryAllocExtraLocal(ctx, 0);                                  offset = CVMEntryAllocExtraLocal(coder->process, ctx, 0);
461                                  if(offset < 4)                                  if(offset < 4)
462                                  {                                  {
463                                          CVM_OUT_NONE(COP_PSTORE_0 + offset);                                          CVM_OUT_NONE(COP_PSTORE_0 + offset);
# Line 473  static void CVMEntryPushLeadIn(CVMEntryC Line 474  static void CVMEntryPushLeadIn(CVMEntryC
474                  else                  else
475                  {                  {
476                          /* Inform the context that we need space for the return value */                          /* Inform the context that we need space for the return value */
477                          CVMEntryNeedExtraLocal(ctx, returnType);                          CVMEntryNeedExtraLocal((ILExecProcess *)0, ctx, returnType);
478                          if(!useRawCalls)                          if(!useRawCalls)
479                          {                          {
480                                  /* We also need space for the pointer to the value */                                  /* We also need space for the pointer to the value */
481                                  CVMEntryNeedExtraLocal(ctx, 0);                                  CVMEntryNeedExtraLocal((ILExecProcess *)0, ctx, 0);
482                          }                          }
483                  }                  }
484          }          }
# Line 486  static void CVMEntryPushLeadIn(CVMEntryC Line 487  static void CVMEntryPushLeadIn(CVMEntryC
487                  /* Allocate space for the return value */                  /* Allocate space for the return value */
488                  if(coder)                  if(coder)
489                  {                  {
490                          ctx->returnOffset = CVMEntryAllocExtraLocal(ctx, returnType);                          ctx->returnOffset = CVMEntryAllocExtraLocal(coder->process, ctx, returnType);
491                  }                  }
492                  else                  else
493                  {                  {
494                          CVMEntryNeedExtraLocal(ctx, returnType);                          CVMEntryNeedExtraLocal((ILExecProcess *)0, ctx, returnType);
495                  }                  }
496          }          }
497          else if(isConstructor)          else if(isConstructor)
# Line 498  static void CVMEntryPushLeadIn(CVMEntryC Line 499  static void CVMEntryPushLeadIn(CVMEntryC
499                  /* We need space to return the object pointer */                  /* We need space to return the object pointer */
500                  if(coder)                  if(coder)
501                  {                  {
502                          ctx->returnOffset = CVMEntryAllocExtraLocal(ctx, 0);                          ctx->returnOffset = CVMEntryAllocExtraLocal(coder->process, ctx, 0);
503                  }                  }
504                  else                  else
505                  {                  {
506                          CVMEntryNeedExtraLocal(ctx, 0);                          CVMEntryNeedExtraLocal((ILExecProcess *)0, ctx, 0);
507                  }                  }
508          }          }
509    
# Line 667  static void CVMEntryPushNativeArgs(CVMEn Line 668  static void CVMEntryPushNativeArgs(CVMEn
668                             we use the non-raw version of function invocation */                             we use the non-raw version of function invocation */
669                          if(!useRawCalls && isInternal && ILType_IsValueType(paramType))                          if(!useRawCalls && isInternal && ILType_IsValueType(paramType))
670                          {                          {
671                                  CVMEntryNeedExtraLocal(ctx, 0);                                  CVMEntryNeedExtraLocal((ILExecProcess *)0, ctx, 0);
672                          }                          }
673                          continue;                          continue;
674                  }                  }
# Line 866  static void CVMEntryPushNativeArgs(CVMEn Line 867  static void CVMEntryPushNativeArgs(CVMEn
867    
868                                          default:                                          default:
869                                          {                                          {
870                                                  size = GetTypeSize(paramType);                                                  size = GetTypeSize(coder->process, paramType);
871                                                  CVM_OUT_DWIDE(COP_MLOAD, offset, size);                                                  CVM_OUT_DWIDE(COP_MLOAD, offset, size);
872                                                  CVM_ADJUST(size);                                                  CVM_ADJUST(size);
873                                                  ctx->nativeArgWords += size;                                                  ctx->nativeArgWords += size;
# Line 905  static void CVMEntryPushNativeArgs(CVMEn Line 906  static void CVMEntryPushNativeArgs(CVMEn
906                                  /* Push a pointer to the value type onto the native stack */                                  /* Push a pointer to the value type onto the native stack */
907                                  CVM_OUT_WIDE(COP_WADDR, coder->argOffsets[param - thisAdjust]);                                  CVM_OUT_WIDE(COP_WADDR, coder->argOffsets[param - thisAdjust]);
908                                  CVM_ADJUST(1);                                  CVM_ADJUST(1);
909                                  offset = CVMEntryAllocExtraLocal(ctx, 0);                                  offset = CVMEntryAllocExtraLocal(coder->process, ctx, 0);
910                                  if(offset < 4)                                  if(offset < 4)
911                                  {                                  {
912                                          CVM_OUT_NONE(COP_PSTORE_0 + offset);                                          CVM_OUT_NONE(COP_PSTORE_0 + offset);
# Line 1173  static void CVMEntryCallNative(CVMEntryC Line 1174  static void CVMEntryCallNative(CVMEntryC
1174    
1175                          default:                          default:
1176                          {                          {
1177                                  size = GetTypeSize(returnType);                                  size = GetTypeSize(coder->process, returnType);
1178                                  if(ctx->returnOffset != 0 || !(ctx->firstExtraIsTop))                                  if(ctx->returnOffset != 0 || !(ctx->firstExtraIsTop))
1179                                  {                                  {
1180                                          CVM_OUT_DWIDE(COP_MLOAD, ctx->returnOffset, size);                                          CVM_OUT_DWIDE(COP_MLOAD, ctx->returnOffset, size);
# Line 1187  static void CVMEntryCallNative(CVMEntryC Line 1188  static void CVMEntryCallNative(CVMEntryC
1188          else if(ILType_IsValueType(returnType))          else if(ILType_IsValueType(returnType))
1189          {          {
1190                  /* Load the value type onto the stack and return */                  /* Load the value type onto the stack and return */
1191                  size = GetTypeSize(returnType);                  size = GetTypeSize(coder->process, returnType);
1192                  if(ctx->returnOffset != 0 || !(ctx->firstExtraIsTop))                  if(ctx->returnOffset != 0 || !(ctx->firstExtraIsTop))
1193                  {                  {
1194                          CVM_OUT_DWIDE(COP_MLOAD, ctx->returnOffset, size);                          CVM_OUT_DWIDE(COP_MLOAD, ctx->returnOffset, size);

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26