#include <string.h>
#include <mono/metadata/opcodes.h>
+#if defined(__native_client__) || defined(__native_client_codegen__)
+volatile int __nacl_thread_suspension_needed = 0;
+void __nacl_suspend_thread_if_needed() {}
+#endif
+
#define MINI_OP(a,b,dest,src1,src2) b,
#define MINI_OP3(a,b,dest,src1,src2,src3) b,
/* keep in sync with the enum in mini.h */
char spec [MONO_INST_MAX];
} OpDesc;
-static int nacl;
+static int nacl = 0;
static GHashTable *table;
static GHashTable *template_table;
line = 0;
while ((str = fgets (buf, sizeof (buf), f))) {
gboolean is_template = FALSE;
+ gboolean nacl_length_set = FALSE;
+
++line;
eat_whitespace (str);
if (!str [0])
p += 7;
*/
} else if (strncmp (p, "len:", 4) == 0) {
+ unsigned long size;
p += 4;
- desc->spec [MONO_INST_LEN] += strtoul (p, &p, 10);
- } else if (strncmp (p, "nacl:", 5) == 0){
+ size = strtoul (p, &p, 10);
+ if (!nacl_length_set) {
+ desc->spec [MONO_INST_LEN] = size;
+ }
+ } else if (strncmp (p, "nacl:", 5) == 0) {
unsigned long size;
p += 5;
size = strtoul (p, &p, 10);
- if (nacl)
- desc->spec [MONO_INST_LEN] += size;
+ if (nacl) {
+ desc->spec [MONO_INST_LEN] = size;
+ nacl_length_set = TRUE;
+ }
} else if (strncmp (p, "template:", 9) == 0) {
char *tname;
int i;
return 1;
} else {
int i = 3;
- if (strcmp (argv [1], "--nacl") == 0){
+ if (strcmp (argv [1], "--nacl") == 0) {
nacl = 1;
i++;
}