Beispiel #1
0
size_t ASPSOldGen::available_for_contraction() {
  size_t uncommitted_bytes = virtual_space()->uncommitted_size();
  if (uncommitted_bytes != 0) {
    return uncommitted_bytes;
  }

  ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
  const size_t gen_alignment = heap->old_gen_alignment();
  PSAdaptiveSizePolicy* policy = heap->size_policy();
  const size_t working_size =
    used_in_bytes() + (size_t) policy->avg_promoted()->padded_average();
  const size_t working_aligned = align_size_up(working_size, gen_alignment);
  const size_t working_or_min = MAX2(working_aligned, min_gen_size());
  if (working_or_min > reserved().byte_size()) {
    // If the used or minimum gen size (aligned up) is greater
    // than the total reserved size, then the space available
    // for contraction should (after proper alignment) be 0
    return 0;
  }
  const size_t max_contraction =
    reserved().byte_size() - working_or_min;

  // Use the "increment" fraction instead of the "decrement" fraction
  // to allow the other gen to expand more aggressively.  The
  // "decrement" fraction is conservative because its intent is to
  // only reduce the footprint.

  size_t result = policy->promo_increment_aligned_down(max_contraction);
  // Also adjust for inter-generational alignment
  size_t result_aligned = align_size_down(result, gen_alignment);
  if (PrintAdaptiveSizePolicy && Verbose) {
    gclog_or_tty->print_cr("\nASPSOldGen::available_for_contraction:"
      " %d K / 0x%x", result_aligned/K, result_aligned);
    gclog_or_tty->print_cr(" reserved().byte_size() %d K / 0x%x ",
      reserved().byte_size()/K, reserved().byte_size());
    size_t working_promoted = (size_t) policy->avg_promoted()->padded_average();
    gclog_or_tty->print_cr(" padded promoted %d K / 0x%x",
      working_promoted/K, working_promoted);
    gclog_or_tty->print_cr(" used %d K / 0x%x",
      used_in_bytes()/K, used_in_bytes());
    gclog_or_tty->print_cr(" min_gen_size() %d K / 0x%x",
      min_gen_size()/K, min_gen_size());
    gclog_or_tty->print_cr(" max_contraction %d K / 0x%x",
      max_contraction/K, max_contraction);
    gclog_or_tty->print_cr("    without alignment %d K / 0x%x",
      policy->promo_increment(max_contraction)/K,
      policy->promo_increment(max_contraction));
    gclog_or_tty->print_cr(" alignment 0x%x", gen_alignment);
  }
  assert(result_aligned <= max_contraction, "arithmetic is wrong");
  return result_aligned;
}
Beispiel #2
0
ULONG fmul64(ULONG ahi,ULONG alo,ULONG bhi,ULONG blo,
ULONG *desthi,ULONG *destlo,ULONG rnd,ULONG prec)
{
   ULONG         g,r,s,flag;
   FPLONG        a,b,res;

/* Reserved operand check */

   flag = reserved(ahi,alo,bhi,blo,0);
   if (flag != 0 ) return(flag);
   flag = (flag<<FLAGWIDTH) | reserved(ahi,alo,bhi,blo,1);
   if (flag != 0 ) return(flag);

   if (flag) {
      *desthi = 0;
      *destlo = 0;
      return(flag);
   }

/* Extract fields */

   a.sign   = BFEXTU(ahi,31,1);
   b.sign   = BFEXTU(bhi,31,1);
   a.exp    = BFEXTU(ahi,20,11);
   b.exp    = BFEXTU(bhi,20,11);
   a.manthi = BFEXTU(ahi,0,20);
   b.manthi = BFEXTU(bhi,0,20);
   a.mantlo = alo;
   b.mantlo = blo;

/* Insert Hidden Bits */

   if (a.exp != 0) a.manthi |= 0x00100000;
   if (b.exp != 0) b.manthi |= 0x00100000;

/* Perform Multiplication */

   multd(a.sign,a.exp,a.manthi,a.mantlo,b.sign,b.exp,b.manthi,b.mantlo,
      &res.sign,&res.exp,&res.manthi,&res.mantlo,&s);

/* Round */

   if (prec != SINGLE) {
      g = (res.mantlo>>1)&1;
      r = res.mantlo&1;
      res.mantlo >>= 2;
      res.mantlo |= res.manthi<<30;
      res.manthi >>= 2;

      flag |= roundd(res.exp,&res.sign,&res.manthi,&res.mantlo,g,r,s,rnd);
   }
Beispiel #3
0
/* This program reads a C program and count the number of reserved words */
int main (int argc, char * argv[]) {
	FILE * arq;
	char * reservadas [] = {
		"auto", "break",  "case", "char",  "const", "continue", "default", "do",
		"double", "else", "enum", "extern", "float", "for", "goto", "if", "int",
    	"long", "register", "return", "short", "signed", "sizeof", "static", "struct",
    	"switch", "typedef", "union", "unsigned", "void", "volatile", "while", ""};
	int count;
	char word[1000], *filename;
	if (argc != 2) {
		printf ("Use: %s <source C programa filename>\n", argv[0]);
		return 0; 
	}
	filename = argv[1];
	arq = fopen (filename, "r");
	if (arq == NULL) {
    	printf ("File %s could not be found\n", filename);
		return 0; 
	}
	count = 0;
	while (read_word (arq, word) == 1)
		if (reserved (word, reservadas) == 1) count++;
    printf ("File %s contains %d reserved words\n", filename, count);
    fclose (arq);
    return 0;
}
HeapRegion* HeapRegionManager::new_heap_region(uint hrm_index) {
  G1CollectedHeap* g1h = G1CollectedHeap::heap();
  HeapWord* bottom = g1h->bottom_addr_for_region(hrm_index);
  MemRegion mr(bottom, bottom + HeapRegion::GrainWords);
  assert(reserved().contains(mr), "invariant");
  return g1h->new_heap_region(hrm_index, mr);
}
//---------------------------------------------------------------------------
void File_AvsV::Data_Parse()
{
    //Parsing
    switch (Element_Code)
    {
        case 0xB0: video_sequence_start(); break;
        case 0xB1: video_sequence_end(); break;
        case 0xB2: user_data_start(); break;
        case 0xB5: extension_start(); break;
        case 0xB3:
        case 0xB6: picture_start(); break;
        case 0xB7: video_edit(); break;
        case 0xB4:
        case 0xB8: reserved(); break;
        default:
            if (Element_Code>=0x00
             && Element_Code<=0xAF) slice();
            else if (Element_Code==0xE0 && Element_Size>=2 && CC2(Buffer+Buffer_Offset)==0x0000)
            {
                Trusted=0; //This is surely an extract from MPEG-TS
                Trusted_IsNot("Unattended element");
            }
            else
                Trusted_IsNot("Unattended element");
    }

    if (File_Offset+Buffer_Offset+Element_Size==File_Size && Frame_Count>0 && Count_Get(Stream_Video)==0) //Finalize frames in case of there are less than Frame_Count_Valid frames
    {
        //No need of more
        Accept("AVS Video");
        Finish("AVS Video");
    }
}
Beispiel #6
0
lexid *lextable::enter(const char *str, int lextype)
{
  int h = hash(str);
  while (1) {
    int i = (h & LEXTABLESIZE - 1);
    lexid *entry = table[i];
    if (entry == NULL) {
      // there is no entry in the lex table
      // but is it a reserved word in a different case context?
      if (reserved(str)) {
	// yes, it is.  get the entry in the reserved words table
	return enter_reserved(str);
      } else {
	/* no, it is not.  Enter it and return */
	table[i] = entry = new lexid(str, lextype);
	return (entry);
      }
    } else if (strcmp(entry->getname(), str) == 0) {
      return (entry);
    } else {
      /* try again */
      h = rehash(h);
    }
  }
}
Beispiel #7
0
//---------------------------------------------------------------------------
void File_AvsV::Data_Parse()
{
    //Parsing
    switch (Element_Code)
    {
        case 0xB0: video_sequence_start(); break;
        case 0xB1: video_sequence_end(); break;
        case 0xB2: user_data_start(); break;
        case 0xB5: extension_start(); break;
        case 0xB3:
        case 0xB6: picture_start(); break;
        case 0xB7: video_edit(); break;
        case 0xB4:
        case 0xB8: reserved(); break;
        default:
            if (Element_Code>=0x00
             && Element_Code<=0xAF) slice();
            else
            {
                if (Frame_Count==0 && Buffer_TotalBytes>Buffer_TotalBytes_FirstSynched_Max)
                    Trusted=0;
                Trusted_IsNot("Unattended element");

            }
    }

    if (File_Offset+Buffer_Offset+Element_Size==File_Size && Frame_Count>0 && Count_Get(Stream_Video)==0) //Finalize frames in case of there are less than Frame_Count_Valid frames
    {
        //No need of more
        Accept("AVS Video");
        Finish("AVS Video");
    }
}
// Tortuous route to get here!
// m_HotKey looses focus and calls parent (CListCtrl) that calls here
void COptionsShortcuts::OnHotKeyKillFocus(const int item, const UINT id,
                                          const WORD wVirtualKeyCode, 
                                          const WORD wModifiers)
{
  CString str(L"");
  CString cs_warning;
  MapMenuShortcutsIter iter, inuse_iter;
  st_MenuShortcut st_mst;

  st_mst.siVirtKey  = wVirtualKeyCode;
  st_mst.cModifier = wVirtualKeyCode == 0 ? 0 : (unsigned char)wModifiers;

  // Stop compiler complaining - put this here even if not needed
  already_inuse inuse(st_mst);

  if (!CMenuShortcut::IsNormalShortcut(st_mst)) {
    // Invalid shortcut
    cs_warning.LoadString(IDS_SHCT_WARNING1);
    goto set_warning;
  }

  str = CMenuShortcut::FormatShortcut(st_mst);

  if (std::find_if(m_ReservedShortcuts.begin(),
                   m_ReservedShortcuts.end(),
                   reserved(st_mst)) != m_ReservedShortcuts.end()) {
    // Reserved shortcut ignored
    cs_warning.Format(IDS_SHCT_WARNING2, str);
    goto set_warning;
  }

  // Check not already in use (ignore if deleting current shortcut)
  iter = m_MapMenuShortcuts.find(id);
  if (st_mst.siVirtKey != 0) {
    inuse_iter = std::find_if(m_MapMenuShortcuts.begin(),
                              m_MapMenuShortcuts.end(),
                              inuse);
    if (inuse_iter != m_MapMenuShortcuts.end() && 
        inuse_iter->first != iter->first) {
      // Shortcut in use
      cs_warning.Format(IDS_SHCT_WARNING3, str, inuse_iter->second.name.c_str());
      goto set_warning;
    }
  }

  // Not reserved and not already in use - implement
  iter->second.siVirtKey = st_mst.siVirtKey;
  iter->second.cModifier = st_mst.cModifier;

  m_ShortcutLC.SetItemText(item, 0, str);  // SHCT_SHORTCUTKEYS
  m_ShortcutLC.RedrawItems(item, item);    // SHCT_MENUITEMTEXT
  m_ShortcutLC.SetColumnWidth(0, m_iColWidth);              // SHCT_SHORTCUTKEYS
  m_ShortcutLC.SetColumnWidth(1, LVSCW_AUTOSIZE_USEHEADER); // SHCT_MENUITEMTEXT
  m_ShortcutLC.UpdateWindow();
  return;

set_warning:
  m_stc_warning.SetWindowText(cs_warning);
  m_stc_warning.ShowWindow(SW_SHOW);
}
Beispiel #9
0
void Registers<Reg>::release(Reg reg){
    assert(descriptors[static_cast<int>(reg)] == retainVariable);

    descriptors.at(static_cast<int>(reg)) = nullptr;

    assert(!reserved(reg));
}
Beispiel #10
0
void Registers<Reg>::reserve(Reg reg){
    assert(!used(reg));

    descriptors.at(static_cast<int>(reg)) = retainVariable;

    assert(reserved(reg));
}
Beispiel #11
0
std::shared_ptr<Variable> Registers<Reg>::operator[](Reg reg){
    //This method should never be called when the register is not used
    assert(used(reg));
    assert(!reserved(reg));

    return descriptors.at(static_cast<int>(reg));
}
TUint8 DISIRouter::ReserveNewDynamicObjId()
    {
    // No tracing with mutex
#ifdef WITHOUT_WRAPPERS_IN_USE    
    TUint8 firstAllowedObjId = KFirstAllowedObjId;
#else
    TUint8 firstAllowedObjId = KLastKernelChannel;
#endif

    for( TInt i(firstAllowedObjId); i < KMaxAmountOfObjId; i++ )
        {
        if( !iClientTable[ i ] )
            {
            TBool reserved( EFalse );
            for( TUint8 j = 0; j < iStaticObjIdTable.Count(); j++ )
                {
                if( j == iStaticObjIdTable[ j ]->iObjId )
                    {
                    reserved = ETrue;
                    break;
                    }
                }
            if( !reserved )
                {
                return i;
                }
            }
        }
    return KNotInitializedId;
    }
Beispiel #13
0
void URI::addQueryParameter(const std::string& param, const std::string& val)
{
	std::string reserved(RESERVED_QUERY);
	reserved += "=&";
	if (!_query.empty()) _query += '&';
	encode(param, reserved, _query);
	_query += '=';
	encode(val, reserved, _query);
}
Beispiel #14
0
char* lex(char* ppg, std::map<std::string,int> &names, PreCompiler_Callback precomp) throw (InterpEx*) {
    reserved(names);
    int nextord = names.size();
    char* res = new char[strlen(ppg)*6]; //this should suffice, haha.
    char* toks = res;
    char* start = ppg;
    char* pos = ppg;
    whitespace(ppg);
    tolower(ppg);
    debug(std::cout << "lexing...\n";)
Beispiel #15
0
void parse_argument_list(){
	set_parse_err(argument_number >= MAX_ARGS,EMANYARGS);
	ignore_spaces();
		
	if(reserved(peek_token()))
		return;
	
	char * arg = malloc(MAX_ARGLEN+1);
	program_call[programs]
		.arguments[argument_number] = arg;
	
	char c; int i;

	for(i = 0, c = next_token(); 
		i < MAX_ARGLEN && !reserved(c);
		i++, c = next_token() ){
		
		arg[i] = c;
	}
	set_parse_err(i >= MAX_ARGLEN,EARGLONG);
	
	arg[i] = '\0';
	argument_number++;
	ignore_spaces();
	
	switch(c = peek_token()){
		case EOS:
		case '|':
			break;	
		default:
			if(!reserved(c)){
				parse_argument_list();
			}else{
				set_parse_err(true,EINVCHAR);		
			}
			break;
	}
}
void PSOldGen::resize(size_t desired_free_space) {
  ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
  assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
  const size_t alignment = heap->min_alignment();

  const size_t size_before = _virtual_space.committed_size();
  size_t new_size = used_in_bytes() + desired_free_space;
  new_size = align_size_up(new_size, alignment);

  assert(_max_gen_size == reserved().byte_size(), "max new size problem?");

  // Adjust according to our min and max
  new_size = MAX2(MIN2(new_size, _max_gen_size), _min_gen_size);

  const size_t current_size = capacity_in_bytes();
  if (new_size == current_size) {
    // No change requested
    return;
  }
  if (new_size > current_size) {
    size_t change_bytes = new_size - current_size;
    expand(change_bytes);
  } else {
    size_t change_bytes = current_size - new_size;
    // shrink doesn't grab this lock, expand does. Is that right?
    MutexLocker x(ExpandHeap_lock);
    shrink(change_bytes);
  }

  if (PrintAdaptiveSizePolicy) {
    gclog_or_tty->print_cr("AdaptiveSizePolicy::old generation size: "
                  "collection: %d "
                  "(" SIZE_FORMAT ") -> (" SIZE_FORMAT ") ",
                  heap->total_collections(),
                  size_before, _virtual_space.committed_size());
  }
}
size_t DefNewGeneration::max_capacity() const {
  const size_t alignment = GenCollectedHeap::heap()->collector_policy()->space_alignment();
  const size_t reserved_bytes = reserved().byte_size();
  return reserved_bytes - compute_survivor_size(reserved_bytes, alignment);
}
Beispiel #18
0
/*===========================
 * lextok -- lex the next token
 *=========================*/
static int
lextok (PACTX pactx, YYSTYPE * lvalp, INT c, INT t)
{
	INT retval, mul;
	extern INT Yival;
	extern FLOAT Yfval;
	static char tokbuf[512]; /* token buffer */
	STRING p = tokbuf;

	if (t == LETTER) {
		p = tokbuf;
		while (is_iden_char(c, t)) {
			if (p-tokbuf < (int)sizeof(tokbuf) - 3) {
				*p++ = c;
			} else {
				/* token overlong -- ignore end of it */
				/* TODO: How can we force a parse error from here ? */
			}
			t = chartype(c = inchar(pactx));
		}
		*p = 0;
		unreadchar(pactx, c);

		if (reserved(tokbuf, &retval))  return retval;
		/* IDEN values have to be passed from yacc.y to free_iden */
		*lvalp = (PNODE) strsave(tokbuf);
		return IDEN;
	}
	if (t == '-' || t == DIGIT || t == '.') {
		BOOLEAN whole = FALSE;
		BOOLEAN frac = FALSE;
		FLOAT fdiv;
		mul = 1;
		if (t == '-') {
			t = chartype(c = inchar(pactx));
			if (t != '.' && t != DIGIT) {
				unreadchar(pactx, c);
				return '-';
			}
			mul = -1;
		}
		Yival = 0;
		while (t == DIGIT) {
			whole = TRUE;
			Yival = Yival*10 + c - '0';
			t = chartype(c = inchar(pactx));
		}
		if (t != '.') {
			unreadchar(pactx, c);
			Yival *= mul;
			*lvalp = NULL;
			return ICONS;
		}
		t = chartype(c = inchar(pactx));
		Yfval = 0.0;
		fdiv = 1.0;
		while (t == DIGIT) {
			frac = TRUE;
			Yfval = Yfval*10 + c - '0';
			fdiv *= 10.;
			t = chartype(c = inchar(pactx));
		}
		unreadchar(pactx, c);
		if (!whole && !frac) {
			unreadchar(pactx, c);
			if (mul == -1) {
				unreadchar(pactx, '.');
				return '-';
			} else
				return '.';
		}
		Yfval = mul*(Yival + Yfval/fdiv);
		*lvalp = NULL;
		return FCONS;
	}
	if (c == '"') {
		INT start_line = pactx->lineno;
		p = tokbuf;
		while (TRUE) {
			while ((c = inchar(pactx)) != EOF && c != '"' && c != '\\') {
				if (p-tokbuf > sizeof(tokbuf)/sizeof(tokbuf[0]) - 3) {
					/* Overflowing tokbuf buffer */
					/* TODO: (Perry, 2006-06-30) I don't know how to fail gracefully from here inside parser */
					char msg[512];
					snprintf(msg, sizeof(msg)/sizeof(msg[0])
						, _("String constant overflowing internal buffer tokbuf len=%d, file: %s, start line: %ld")
						, sizeof(tokbuf)/sizeof(tokbuf[0])
						, pactx->fullpath
						, start_line + 1
						);
					FATAL2(msg);
					*p = c = 0;
				}
				*p++ = c;
			}
			if (c == 0 || c == '"') {
				*p = 0;
				*lvalp = make_internal_string_node(pactx, tokbuf);
				return SCONS;
			}
			switch (c = inchar(pactx)) {
			case 'n': *p++ = '\n'; break;
			case 't': *p++ = '\t'; break;
			case 'v': *p++ = '\v'; break;
			case 'r': *p++ = '\r'; break;
			case 'b': *p++ = '\b'; break;
			case 'f': *p++ = '\f'; break;
			case '"': *p++ = '"'; break;
			case '\\': *p++ = '\\'; break;
			case EOF:
				*p = 0;
				*lvalp = make_internal_string_node(pactx, tokbuf);
				return SCONS;
			default:
				*p++ = c; break;
			}
		}
	}
	if (c == EOF) return 0;
	return c;
}
void DefNewGeneration::compute_new_size() {
  // This is called after a gc that includes the following generation
  // (which is required to exist.)  So from-space will normally be empty.
  // Note that we check both spaces, since if scavenge failed they revert roles.
  // If not we bail out (otherwise we would have to relocate the objects)
  if (!from()->is_empty() || !to()->is_empty()) {
    return;
  }

  int next_level = level() + 1;
  GenCollectedHeap* gch = GenCollectedHeap::heap();
  assert(next_level < gch->_n_gens,
         "DefNewGeneration cannot be an oldest gen");

  Generation* next_gen = gch->_gens[next_level];
  size_t old_size = next_gen->capacity();
  size_t new_size_before = _virtual_space.committed_size();
  size_t min_new_size = spec()->init_size();
  size_t max_new_size = reserved().byte_size();
  assert(min_new_size <= new_size_before &&
         new_size_before <= max_new_size,
         "just checking");
  // All space sizes must be multiples of Generation::GenGrain.
  size_t alignment = Generation::GenGrain;

  // Compute desired new generation size based on NewRatio and
  // NewSizeThreadIncrease
  size_t desired_new_size = old_size/NewRatio;
  int threads_count = Threads::number_of_non_daemon_threads();
  size_t thread_increase_size = threads_count * NewSizeThreadIncrease;
  desired_new_size = align_size_up(desired_new_size + thread_increase_size, alignment);

  // Adjust new generation size
  desired_new_size = MAX2(MIN2(desired_new_size, max_new_size), min_new_size);
  assert(desired_new_size <= max_new_size, "just checking");

  bool changed = false;
  if (desired_new_size > new_size_before) {
    size_t change = desired_new_size - new_size_before;
    assert(change % alignment == 0, "just checking");
    if (expand(change)) {
       changed = true;
    }
    // If the heap failed to expand to the desired size,
    // "changed" will be false.  If the expansion failed
    // (and at this point it was expected to succeed),
    // ignore the failure (leaving "changed" as false).
  }
  if (desired_new_size < new_size_before && eden()->is_empty()) {
    // bail out of shrinking if objects in eden
    size_t change = new_size_before - desired_new_size;
    assert(change % alignment == 0, "just checking");
    _virtual_space.shrink_by(change);
    changed = true;
  }
  if (changed) {
    // The spaces have already been mangled at this point but
    // may not have been cleared (set top = bottom) and should be.
    // Mangling was done when the heap was being expanded.
    compute_space_boundaries(eden()->used(),
                             SpaceDecorator::Clear,
                             SpaceDecorator::DontMangle);
    MemRegion cmr((HeapWord*)_virtual_space.low(),
                  (HeapWord*)_virtual_space.high());
    Universe::heap()->barrier_set()->resize_covered_region(cmr);
    if (Verbose && PrintGC) {
      size_t new_size_after  = _virtual_space.committed_size();
      size_t eden_size_after = eden()->capacity();
      size_t survivor_size_after = from()->capacity();
      gclog_or_tty->print("New generation size " SIZE_FORMAT "K->"
        SIZE_FORMAT "K [eden="
        SIZE_FORMAT "K,survivor=" SIZE_FORMAT "K]",
        new_size_before/K, new_size_after/K,
        eden_size_after/K, survivor_size_after/K);
      if (WizardMode) {
        gclog_or_tty->print("[allowed " SIZE_FORMAT "K extra for %d threads]",
          thread_increase_size/K, threads_count);
      }
      gclog_or_tty->cr();
    }
  }
}
Beispiel #20
0
void hyperstone_device::opaf()
{
	LOCAL_DECODE_INIT;
	no_decode(decode);
	reserved(decode);
}
Beispiel #21
0
int proceso( int num, int padre )
{
	int v1 ;
	int retcode = 0;
	int no_devuelve = 0 ;
	int (*externa)(struct _fun_params*);
	int temp,oo;
	unsigned int utemp;
	int cpas=0;
	#ifdef DBG
		int actual_lin;
	#endif
	int _status=reservedptr("status");
	int _param_offset;

	num_proc = num ;
	imem = procs_s[num_proc].imem ;
	
	//printf("num_proc: %d\n",num);

	
	while( retcode == 0 )
	{
	
		//printf("imem: %i\tnum_proc: %i\tsp: %i\tpila[sp]: %i \n" , imem , num_proc , sp , pila[sp]) ;
		
		switch ( mem[ imem++ ] )
		{
		case lnop://0
			break;
		case lcar://1
			pila[++sp]=mem[imem++] ;
			break;
		case lasi://2
			mem[ pila[sp-1] ] = pila[sp--] ;
			//printf("Cargado %i en %i\n" , pila[sp+1], pila[sp] ) ;
			break ;
		case lori://3
			pila[sp-1]|=pila[sp];
			sp--;
			break;
		case lxor://4
			pila[sp-1]^=pila[sp];
			sp--;
			break;
		case land://5
			pila[sp-1]&=pila[sp];
			sp--;
			break;
		case ligu://6
			pila[sp-1] = ( pila[sp-1] == pila[sp] ) ;
			sp--;
			break;
		case ldis://7
			pila[sp-1] = ( pila[sp-1] != pila[sp] ) ;
			sp--;
			break;
		case lmay://8
			pila[sp-1] = ( pila[sp-1] > pila[sp] ) ;
			sp--;
			break;
		case lmen://9
			pila[sp-1] = ( pila[sp-1] < pila[sp] ) ;
			sp--;
			break;
		case lmei://10
			pila[sp-1] = ( pila[sp-1] <= pila[sp] ) ;
			sp--;
			break;
		case lmai://11
			pila[sp-1] = ( pila[sp-1] >= pila[sp] ) ;
			sp--;
			break;
		case ladd://12
			pila[sp-1] += pila[sp] ;
			sp--;
			break;
		case lsub://13
			pila[sp-1] -= pila[sp] ;
			sp--;
			break;
		case lmul://14
			pila[sp-1] *= pila[sp] ;
			sp--;
			break;
		case ldiv://15
			if(pila[sp]==0) error(145); // división entre cero
			pila[sp-1] /= pila[sp] ;
			sp--;
			break;
		case lmod://16
			if(pila[sp]==0) error(145); // división entre cero
			pila[sp-1] %= pila[sp] ;
			sp--;
			break;
		case lneg://17
			pila[sp] = -pila[sp] ;
			break ;
		case lptr://18
			pila[sp] = mem[ pila[sp] ] ;
			break ;
		case lnot://19
			pila[sp]^=-1; 
			break ;
		case laid://20
			pila[sp]+= procs_s[num_proc].id ;
			break ;
		case lcid://21
			pila[++sp] = procs_s[num_proc].id ;
			break ;
		case lrng://22 POR HACER (debug)
			imem++;
			break ;
		case ljmp://23
			imem = mem[ imem ] ;
			//printf("Nueva posicion: %i\n", imem ) ;
			break ;
		case ljpf://24 
			if (!(pila[sp]&1))
				imem = mem[ imem ] ;
			else
				imem++;
			sp--; 
			break ;
		case lfun://25 NO USADO
			break ;
		case lcal://26
			devolver++ ;
			v1 = busca_proc_libre() ;
			procs_s[v1].imem = mem[imem++] ;
			temp = proceso_actual ;
			proceso_actual = lista_mete(v1) ;
			procs_s[num_proc].imem = imem ;			
			proceso(v1,num_proc) ;
			proceso_actual = temp ;
			num_proc = num ;
			imem = procs_s[num_proc].imem ;
			break ;
		case lret://27
			lista_quita(proceso_actual);
			//printf("Ret: %i\n" , num_proc) ;
			retcode = 1 ;
			break ;
		case lasp://28
			sp--;
			break;
		case lfrm://29
			procs_s[num_proc].imem = imem ;
			reserved("type_scan",procs_s[num_proc].id)=0;		/* resetea get_id() */
			reserved("id_scan",procs_s[num_proc].id)=0;
			if ( first_loaded )
			{
				Call_Entrypoint(EDIV_first_load);
				first_loaded = 0 ;
			}
			//printf("Frame en: %i\n" , imem ) ;
			retcode = 1 ;
			break ;
		case lcbp://30
			reserved("parameters",procs_s[num_proc].id)=mem[imem++];
			reserved("param_offset",procs_s[num_proc].id)=sp-reserved("parameters",procs_s[num_proc].id)+1;
			/**/procs_s[num_proc].num_params = mem[ imem-1 ] ;
			break;
		case lcpa://31
			mem[pila[sp]]=pila[reserved("param_offset",procs_s[num_proc].id)++];
			sp--;
			cpas++;
			if(cpas==reserved("parameters",procs_s[num_proc].id))
				sp-=cpas;
			break;
		case ltyp://32
			if ( procs_s[num_proc].tipo != 0 ) {
				critical_error(3); // redefinición del tipo de proceso
			}
			procs_s[num_proc].id = (mem[2] + ( num_proc * iloc_len ))|1;
			if(procs_s[num_proc].id>imem_max-iloc_len)
				critical_error(8);	// demasiados procesos en ejecución
			memcpy(&mem[procs_s[num_proc].id],&mem[iloc],iloc_pub_len<<2);
			reserved("process_id",procs_s[num_proc].id)=procs_s[num_proc].id;
			if(padre!=-1) {
				int bigbro;
				if(bigbro=local("son",procs_s[padre].id)) {
					local("smallbro",bigbro)=procs_s[num_proc].id;
					local("bigbro",procs_s[num_proc].id)=bigbro;
				}
				local("son",procs_s[padre].id)=procs_s[num_proc].id;
				local("father",procs_s[num_proc].id)=procs_s[padre].id;
			}
			else {
				local("father",procs_s[num_proc].id)=0;
			}
			procs_s[num_proc].tipo = mem[ imem++ ] ;
			reserved("process_type",procs_s[num_proc].id) = procs_s[num_proc].tipo ;
			mem[procs_s[num_proc].id+_status] = 2;
			inicio_privadas=mem[6];
			break ;
		case lpri://33 POR HACER?
			memcpy(&mem[procs_s[num_proc].id+inicio_privadas],&mem[imem+1],(mem[imem]-imem-1)<<2);
			inicio_privadas+=(mem[imem]-imem-1); imem=mem[imem];
			break ;
		case lcse://34
			if ( pila[sp-1] == pila[sp] ) 
				imem++; 
			else 
				imem=mem[imem];
			sp--;
			break ;
		case lcsr://35
			if ( pila[sp-2] >= pila[sp-1] && pila[sp-2] <= pila[sp] )
				imem++ ;
			else 
				imem = mem[imem]; 
			sp-=2; 
			break ;
		case lshr://36
			pila[sp-1] >>= pila[sp] ; 
			sp-- ;
			break ;
		case lshl://37
			pila[sp-1] <<= pila[sp] ; 
			sp-- ;
			break ;
		case lipt://38
			pila[sp] = ++mem[ pila[sp] ] ;
			break ;
		case lpti://39 COMPORTAMIENTO EXTRAÑO SI SE PONE EN UNA LINEA
			mem[ pila[sp] ]++;
			pila[sp] = mem[ pila[sp] ]-1 ;
			break ;
		case ldpt://40
			pila[sp] = --mem[ pila[sp] ] ;
			break ;
		case lptd://41 COMPORTAMIENTO EXTRAÑO SI SE PONE EN UNA LINEA
			mem[ pila[sp] ]--;
			pila[sp] = mem[ pila[sp] ]+1 ;
			break ;
		case lada://42
			pila[ sp-1 ] = mem[ pila[ sp-1 ] ] += pila[sp] ;
			sp--;
			break;
		case lsua://43
			pila[ sp-1 ] = mem[ pila[ sp-1 ] ] -= pila[sp] ;
			sp--;
			break;
		case lmua://44
			pila[ sp-1 ] = mem[ pila[ sp-1 ] ] *= pila[sp] ;
			sp--;
			break;
		case ldia://45
			pila[ sp-1 ] = mem[ pila[ sp-1 ] ] /= pila[sp] ;
			sp--;
			break;
		case lmoa://46
			pila[ sp-1 ] = mem[ pila[ sp-1 ] ] %= pila[sp] ;
			sp--;
			break;
		case lana://47
			pila[ sp-1 ] = mem[ pila[ sp-1 ] ] &= pila[sp] ;
			sp--;
			break;
		case lora://48
			pila[ sp-1 ] = mem[ pila[ sp-1 ] ] |= pila[sp] ;
			sp--;
			break;
		case lxoa://49
			pila[ sp-1 ] = mem[ pila[ sp-1 ] ] ^= pila[sp] ;
			sp--;
			break;
		case lsra://50
			pila[ sp-1 ] = mem[ pila[ sp-1 ] ] >>= pila[sp] ;
			sp--;
			break;
		case lsla://51
			pila[ sp-1 ] = mem[ pila[ sp-1 ] ] <<= pila[sp] ;
			sp--;
			break;
		case lpar://52 POR HACER?
			//imem++;
			inicio_privadas+=mem[imem++];
			break;
		case lrtf://53
			lista_quita(num_proc) ;
			no_devuelve = 1 ;
			//printf("Return: %i\n" , num_proc) ;
			retcode = 1 ;
			break ;
		case lclo://54 POR HACER
			break ;
		case lfrf://55 POR HACER
			sp--;
			break ;
		case limp://56
			carga_dll((char*)&mem[mem[imem++]]);
			break ;
		case lext://57
			externa=extfuncs[mem[imem]];
			// corresponder con FUNCTION_PARAMS
			//temp = externa(pila,&sp,mem,varindex,&procs_s,Call_Entrypoint);
			fp.num_params=extparms[mem[imem++]];
			temp = externa(&fp) ;
			pila[++sp]= temp ;
			break ;
		case ldbg://58
			#ifdef DBG
				Call_Entrypoint(EDIV_debug,imem,nombre_program,lin,0);
			#endif
			break ;

		/* OPCODES OPTIMIZADOS */

		case lcar2://60
			pila[++sp]=mem[imem++];
			pila[++sp]=mem[imem++];
			break;
		case lcar3://61
			pila[++sp]=mem[imem++];
			pila[++sp]=mem[imem++];
			pila[++sp]=mem[imem++];
			break;
		case lcar4://62
			pila[++sp]=mem[imem++];
			pila[++sp]=mem[imem++];
			pila[++sp]=mem[imem++];
			pila[++sp]=mem[imem++];
			break;
		case lasiasp://63
			mem[pila[sp-1]]=pila[sp];
			sp-=2;
			break;
		case lcaraid://64
			pila[++sp]=mem[imem++]+procs_s[num_proc].id;
			break;
		case lcarptr://65
			pila[++sp]=mem[mem[imem++]];
			break;
		case laidptr://66
			pila[sp]=mem[pila[sp]+procs_s[num_proc].id];
			break;
		case lcaraidptr://67
			pila[++sp]=mem[mem[imem++]+procs_s[num_proc].id];
			break;
		case lcaraidcpa://68
			mem[mem[imem++]+procs_s[num_proc].id]=pila[reserved("param_offset",procs_s[num_proc].id)++];
			//sp--;
			cpas++;
			if(cpas==reserved("parameters",procs_s[num_proc].id))
				sp-=cpas;
			break;
		case laddptr://69
			pila[sp-1]=mem[pila[sp-1]+pila[sp]];
			sp--;
			break;
		case lfunasp://70 NO USADO
			break;
		case lcaradd://71
			pila[sp]+=mem[imem++];
			break;
		case lcaraddptr://72
			pila[sp]=mem[pila[sp]+mem[imem++]];
			break;
		case lcarmul://73
			pila[sp]*=mem[imem++];
			break;
		case lcarmuladd://74
			pila[sp-1]+=pila[sp]*mem[imem++];
			sp--;
			break;
		case lcarasiasp://75
			mem[pila[sp]]=mem[imem++];
			sp--;
			break;
		case lcarsub://76
			pila[sp]-=mem[imem++];
			break;
		case lcardiv://77 no hay nunca "cardiv 0"
			pila[sp]/=mem[imem++];
			break;

		/* OPERACIONES CON DATOS DE TIPO BYTE */

		case lptrchr:
			pila[sp-1]=(unsigned int)memb[pila[sp-1]*4+pila[sp]];
			sp--;
			break;
		case lasichr:
			pila[sp-2]=(unsigned int)(memb[pila[sp-2]*4+pila[sp-1]]=(byte)pila[sp]);
			sp-=2;
			break;
		case liptchr:
			pila[sp-1]=(unsigned int)++memb[pila[sp-1]*4+pila[sp]];
			sp--;
			break;
		case lptichr:
			/* o_O yo lo flipo con el visual studio! mirad la tonteria que he
			 * tenido ke hacer! (variable utemp)
			 * visto lo visto, hay que testear cuidadosamente TODOS los opcodes!
			 */
			utemp=pila[sp-1];
			pila[sp-1]=(unsigned int)memb[utemp*4+pila[sp]]++;
			sp--;
			break;
		case ldptchr:
			pila[sp-1]=(unsigned int)--memb[pila[sp-1]*4+pila[sp]];
			sp--;
			break;
		case lptdchr:
			/* y aqui la misma chapuza en teoria innecesaria! */
			utemp=pila[sp-1];
			pila[sp-1]=(unsigned int)memb[utemp*4+pila[sp]]--;
			sp--;
			break;
		case ladachr:
			pila[sp-2]=(unsigned int)(memb[pila[sp-2]*4+pila[sp-1]]+=(byte)pila[sp]);
			sp-=2;
			break;
		case lsuachr:
			pila[sp-2]=(unsigned int)(memb[pila[sp-2]*4+pila[sp-1]]-=(byte)pila[sp]);
			sp-=2;
			break;
		case lmuachr:
			pila[sp-2]=(unsigned int)(memb[pila[sp-2]*4+pila[sp-1]]*=(byte)pila[sp]);
			sp-=2;
			break;
		case ldiachr:
			/*#ifdef DBG
				if (pila[sp]==0) {
					memb[pila[sp-2]*4+pila[sp-1]]=0;
					sp-=2; pila[sp]=0;
					v_function=-2; e(145);
					if (call_to_debug) { process_stoped=id; return; }
					break;
				}
			#endif*/
			pila[sp-2]=(unsigned int)(memb[pila[sp-2]*4+pila[sp-1]]/=(byte)pila[sp]);
			sp-=2;
			break;
		case lmoachr:
			/*#ifdef DBG
				if (pila[sp]==0) {
					memb[pila[sp-2]*4+pila[sp-1]]=0;
					sp-=2; pila[sp]=0;
					v_function=-2; e(145);
					if (call_to_debug) { process_stoped=id; return; }
					break;
				}
			#endif*/
			pila[sp-2]=(unsigned int)(memb[pila[sp-2]*4+pila[sp-1]]%=(byte)pila[sp]);
			sp-=2;
			break;
		case lanachr:
			pila[sp-2]=(unsigned int)(memb[pila[sp-2]*4+pila[sp-1]]&=(byte)pila[sp]);
			sp-=2;
			break;
		case lorachr:
			pila[sp-2]=(unsigned int)(memb[pila[sp-2]*4+pila[sp-1]]|=(byte)pila[sp]);
			sp-=2;
			break;
		case lxoachr:
			pila[sp-2]=(unsigned int)(memb[pila[sp-2]*4+pila[sp-1]]^=(byte)pila[sp]);
			sp-=2;
			break;
		case lsrachr:
			pila[sp-2]=(unsigned int)(memb[pila[sp-2]*4+pila[sp-1]]>>=(byte)pila[sp]);
			sp-=2;
			break;
		case lslachr:
			pila[sp-2]=(unsigned int)(memb[pila[sp-2]*4+pila[sp-1]]<<=(byte)pila[sp]);
			sp-=2;
			break;
		case lcpachr:
			_param_offset=reservedptr("param_offset");
			if ((unsigned int)pila[mem[procs_s[num_proc].id+_param_offset]]<256) {
				memb[pila[sp-1]*4+pila[sp]]=(byte)pila[mem[procs_s[num_proc].id+_param_offset]];
			}
			else {
				if (pila[mem[procs_s[num_proc].id+_param_offset]]<imem_max+258*4)
					memb[pila[sp-1]*4+pila[sp]]=memb[pila[mem[procs_s[num_proc].id+_param_offset]]*4];
				else
					memb[pila[sp-1]*4+pila[sp]]=(byte)pila[mem[procs_s[num_proc].id+_param_offset]];
			}
			sp-=2;
			mem[procs_s[num_proc].id+_param_offset]++;
			break;

		/* OPERACIONES CON DATOS DE TIPO WORD */

		case lptrwor:
			pila[sp-1]=(unsigned int)memw[pila[sp-1]*2+pila[sp]];
			sp--;
			break;
		case lasiwor:
			pila[sp-2]=(unsigned int)(memw[pila[sp-2]*2+pila[sp-1]]=(word)pila[sp]);
			sp-=2;
			break;
		case liptwor:
			pila[sp-1]=(unsigned int)++memw[pila[sp-1]*2+pila[sp]];
			sp--;
			break;
		case lptiwor:
			utemp=pila[sp-1];
			pila[sp-1]=(unsigned int)memw[utemp*2+pila[sp]]++;
			sp--;
			break;
		case ldptwor:
			pila[sp-1]=(unsigned int)--memw[pila[sp-1]*2+pila[sp]];
			sp--;
			break;
		case lptdwor:
			utemp=pila[sp-1];
			pila[sp-1]=(unsigned int)memw[utemp*2+pila[sp]]--;
			sp--;
			break;
		case ladawor:
			pila[sp-2]=(unsigned int)(memw[pila[sp-2]*2+pila[sp-1]]+=(word)pila[sp]);
			sp-=2;
			break;
		case lsuawor:
			pila[sp-2]=(unsigned int)(memw[pila[sp-2]*2+pila[sp-1]]-=(word)pila[sp]);
			sp-=2;
			break;
		case lmuawor:
			pila[sp-2]=(unsigned int)(memw[pila[sp-2]*2+pila[sp-1]]*=(word)pila[sp]);
			sp-=2;
			break;
		case ldiawor:
/*			#ifdef DEBUG
				if (pila[sp]==0) {
					memw[pila[sp-2]*2+pila[sp-1]]=0;
					sp-=2; pila[sp]=0;
					v_function=-2; e(145);
					if (call_to_debug) { process_stoped=id; return; }
					break;
				}
			#endif*/
			pila[sp-2]=(unsigned int)(memw[pila[sp-2]*2+pila[sp-1]]/=(word)pila[sp]);
			sp-=2;
			break;
		case lmoawor:
/*			#ifdef DEBUG
				if (pila[sp]==0) {
					memw[pila[sp-2]*2+pila[sp-1]]=0;
					sp-=2; pila[sp]=0;
					v_function=-2; e(145);
					if (call_to_debug) { process_stoped=id; return; }
					break;
				}
			#endif*/
			pila[sp-2]=(unsigned int)(memw[pila[sp-2]*2+pila[sp-1]]%=(word)pila[sp]);
			sp-=2;
			break;
		case lanawor:
			pila[sp-2]=(unsigned int)(memw[pila[sp-2]*2+pila[sp-1]]&=(word)pila[sp]);
			sp-=2;
			break;
		case lorawor:
			pila[sp-2]=(unsigned int)(memw[pila[sp-2]*2+pila[sp-1]]|=(word)pila[sp]);
			sp-=2;
			break;
		case lxoawor:
			pila[sp-2]=(unsigned int)(memw[pila[sp-2]*2+pila[sp-1]]^=(word)pila[sp]);
			sp-=2;
			break;
		case lsrawor:
			pila[sp-2]=(unsigned int)(memw[pila[sp-2]*2+pila[sp-1]]>>=(word)pila[sp]);
			sp-=2;
			break;
		case lslawor:
			pila[sp-2]=(unsigned int)(memw[pila[sp-2]*2+pila[sp-1]]<<=(word)pila[sp]);
			sp-=2;
			break;
		case lcpawor:
			_param_offset=reservedptr("param_offset");
			if ((unsigned)pila[mem[procs_s[num_proc].id+_param_offset]]<256) {
				memw[pila[sp-1]*2+pila[sp]]=(word)pila[mem[procs_s[num_proc].id+_param_offset]];
			} else {
				if (pila[mem[procs_s[num_proc].id+_param_offset]]<imem_max+258*4)
					memw[pila[sp-1]*2+pila[sp]]=memw[pila[mem[procs_s[num_proc].id+_param_offset]]*2];
				else
					memw[pila[sp-1]*2+pila[sp]]=(word)pila[mem[procs_s[num_proc].id+_param_offset]];
			} sp-=2; mem[procs_s[num_proc].id+_param_offset]++; break;


		/* OPERACIONES CON DATOS DE TIPO STRING */
		/* Nota: un puntero a cadena menor a 256 se trata siempre como "%c" */

		case lstrcpy:
/*			#ifdef DEBUG
				if ((mem[pila[sp-1]-1]&0xFFF00000)!=0xDAD00000) {
					sp--; v_function=-2; e(164);
					if (call_to_debug) { process_stoped=id; return; }
					break;
				}
				if ((unsigned)pila[sp]>255) if ((mem[pila[sp-1]-1]&0xFFFFF)+1<strlen((char*)&mem[pila[sp]])) {
					sp--; v_function=-2; e(140);
					if (call_to_debug) { process_stoped=id; return; }
					break;
				}
			#endif*/
			if ((unsigned)pila[sp]>255)
				strcpy((char*)&mem[pila[sp-1]],(char*)&mem[pila[sp]]);
			else
				sprintf((char*)&mem[pila[sp-1]],"%c\0",pila[sp]);
			sp--;
			break;

		case lstrfix:
			if (pila[sp-1]>=(oo=strlen(&memb[pila[sp-2]*4]))) {
				for (;oo<pila[sp-1];oo++) {
					memb[pila[sp-2]*4+oo]=' ';
				} memb[pila[sp-2]*4+oo+1]=0;
			} break;

		case lstrcat:
/*			#ifdef DEBUG
				if ((mem[pila[sp-1]-1]&0xFFF00000)!=0xDAD00000) {
					sp--; v_function=-2; e(164);
					if (call_to_debug) { process_stoped=id; return; }
					break;
				}
				if ((unsigned)pila[sp]>255) oo=strlen((char*)&mem[pila[sp]]); else oo=1;
				if ((mem[pila[sp-1]-1]&0xFFFFF)+1<strlen((char*)&mem[pila[sp-1]])+oo) {
					sp--; v_function=-2; e(140);
					if (call_to_debug) { process_stoped=id; return; }
					break;
				}
			#endif*/
			if ((unsigned)pila[sp]>255) strcat((char*)&mem[pila[sp-1]],(char*)&mem[pila[sp]]);
			else sprintf((char*)&mem[pila[sp-1]],"%s%c\0",(char*)&mem[pila[sp-1]],pila[sp]);
			sp--;
			break;

		case lstradd: /* Strcat "en el aire" (ojo, el aire tiene tambien 0xDAD00402) */
/*			#ifdef DEBUG
				if ((unsigned)pila[sp-1]>255) oo=strlen((char*)&mem[pila[sp-1]]); else oo=1;
				if ((unsigned)pila[sp]>255) oo+=strlen((char*)&mem[pila[sp]]); else oo+=1;
				if (oo>=1028) {
					sp--; v_function=-2; e(140);
					if (call_to_debug) { process_stoped=id; return; }
					break;
				}
			#endif*/
			if ((unsigned)pila[sp-1]>255) {
				if ((unsigned)pila[sp]>255) {
					sprintf((char*)&mem[nullstring[nstring]],"%s%s\0",(char*)&mem[pila[sp-1]],(char*)&mem[pila[sp]]);
				} else {
					sprintf((char*)&mem[nullstring[nstring]],"%s%c\0",(char*)&mem[pila[sp-1]],pila[sp]);
				}
			} else {
				if ((unsigned)pila[sp]>255) {
					sprintf((char*)&mem[nullstring[nstring]],"%c%s\0",pila[sp-1],(char*)&mem[pila[sp]]);
				} else {
					sprintf((char*)&mem[nullstring[nstring]],"%c%c\0",pila[sp-1],pila[sp]);
				}
			}
			pila[--sp]=nullstring[nstring];
			nstring=((nstring+1)&3);
			break;

		case lstrdec: /* cambio de tamaño "en el aire" (no da error, hace lo que puede) */
			oo=strlen((char*)&mem[pila[sp-1]]);
			if (oo<1028) {
				strcpy((char*)&mem[nullstring[nstring]],(char*)&mem[pila[sp-1]]);
				if (pila[sp]>0) { /* Quitar caracteres */
					if (pila[sp]>=oo) memb[nullstring[nstring]*4]=0;
					else memb[nullstring[nstring]*4+oo-pila[sp]]=0;
				} else if (pila[sp]<0) { /* Añadir (?) caracteres (por homogeneidad) */
					pila[sp]=oo-pila[sp]; /* Nueva longitud */
					if (pila[sp]>1025) pila[sp]=1025;
					for (;oo<pila[sp];oo++) {
						memb[nullstring[nstring]*4+oo]=' ';
					} memb[nullstring[nstring]*4+oo]=0;
				}
			} else mem[nullstring[nstring]]=0;
			pila[--sp]=nullstring[nstring];
			nstring=((nstring+1)&3);
			break;

		case lstrsub: /* cambio de tamaño a un string */
			oo=strlen((char*)&mem[pila[sp-1]]);
/*			#ifdef DEBUG
				if ((mem[pila[sp-1]-1]&0xFFF00000)!=0xDAD00000) {
					sp--; v_function=-2; e(164);
					if (call_to_debug) { process_stoped=id; return; }
					break;
				}
				if ((mem[pila[sp-1]-1]&0xFFFFF)+1<oo-pila[sp]) {
					sp--; v_function=-2; e(140);
					if (call_to_debug) { process_stoped=id; return; }
					break;
				}
			#endif*/
			if (pila[sp]>0) { // Quitar caracteres
				if (pila[sp]>=oo) memb[pila[sp-1]*4]=0;
				else memb[pila[sp-1]*4+oo-pila[sp]]=0;
			} else if (pila[sp]<0) { /* Añadir (?) caracteres (por homogeneidad) */
				pila[sp]=oo-pila[sp]; /* Nueva longitud */
				for (;oo<pila[sp];oo++) {
					memb[pila[sp-1]*4+oo]=' ';
				} memb[pila[sp-1]*4+oo]=0;
			} sp--;
			break;

		case lstrlen:
			if ((unsigned)pila[sp]>255) pila[sp]=strlen((char*)&mem[pila[sp]]); else pila[sp]=1;
			break;

		case lstrigu:
			if ((unsigned)pila[sp-1]>255) {
				if ((unsigned)pila[sp]>255) {
					if (strcmp((char*)&mem[pila[sp-1]],(char*)&mem[pila[sp]])) pila[sp-1]=0; else pila[sp-1]=1;
				} else {
					if (strcmp((char*)&mem[pila[sp-1]],(char*)&pila[sp])) pila[sp-1]=0; else pila[sp-1]=1;
				}
			} else {
				if ((unsigned)pila[sp]>255) {
					if (strcmp((char*)&pila[sp-1],(char*)&mem[pila[sp]])) pila[sp-1]=0; else pila[sp-1]=1;
				} else {
					pila[sp-1]=(pila[sp-1]==pila[sp]);
				}
			} sp--; break;

		case lstrdis:
			if ((unsigned)pila[sp-1]>255) {
				if ((unsigned)pila[sp]>255) {
					if (strcmp((char*)&mem[pila[sp-1]],(char*)&mem[pila[sp]])) pila[sp-1]=1; else pila[sp-1]=0;
				} else {
					if (strcmp((char*)&mem[pila[sp-1]],(char*)&pila[sp])) pila[sp-1]=1; else pila[sp-1]=0;
				}
			} else {
				if ((unsigned)pila[sp]>255) {
					if (strcmp((char*)&pila[sp-1],(char*)&mem[pila[sp]])) pila[sp-1]=1; else pila[sp-1]=0;
				} else {
					pila[sp-1]=(pila[sp-1]!=pila[sp]);
				}
			} sp--; break;
			break;

		case lstrmay:
			if ((unsigned)pila[sp-1]>255) {
				if ((unsigned)pila[sp]>255) {
					if (strcmp((char*)&mem[pila[sp-1]],(char*)&mem[pila[sp]])>0) pila[sp-1]=1; else pila[sp-1]=0;
				} else {
					if (strcmp((char*)&mem[pila[sp-1]],(char*)&pila[sp])>0) pila[sp-1]=1; else pila[sp-1]=0;
				}
			} else {
				if ((unsigned)pila[sp]>255) {
					if (strcmp((char*)&pila[sp-1],(char*)&mem[pila[sp]])>0) pila[sp-1]=1; else pila[sp-1]=0;
				} else {
					pila[sp-1]=(pila[sp-1]>pila[sp]);
				}
			} sp--; break;
			break;

		case lstrmen:
			if ((unsigned)pila[sp-1]>255) {
				if ((unsigned)pila[sp]>255) {
					if (strcmp((char*)&mem[pila[sp-1]],(char*)&mem[pila[sp]])<0) pila[sp-1]=1; else pila[sp-1]=0;
				} else {
					if (strcmp((char*)&mem[pila[sp-1]],(char*)&pila[sp])<0) pila[sp-1]=1; else pila[sp-1]=0;
				}
			} else {
				if ((unsigned)pila[sp]>255) {
					if (strcmp((char*)&pila[sp-1],(char*)&mem[pila[sp]])<0) pila[sp-1]=1; else pila[sp-1]=0;
				} else {
					pila[sp-1]=(pila[sp-1]<pila[sp]);
				}
			} sp--; break;
			break;

		case lstrmei:
			if ((unsigned)pila[sp-1]>255) {
				if ((unsigned)pila[sp]>255) {
					if (strcmp((char*)&mem[pila[sp-1]],(char*)&mem[pila[sp]])<=0) pila[sp-1]=1; else pila[sp-1]=0;
				} else {
					if (strcmp((char*)&mem[pila[sp-1]],(char*)&pila[sp])<=0) pila[sp-1]=1; else pila[sp-1]=0;
				}
			} else {
				if ((unsigned)pila[sp]>255) {
					if (strcmp((char*)&pila[sp-1],(char*)&mem[pila[sp]])<=0) pila[sp-1]=1; else pila[sp-1]=0;
				} else {
					pila[sp-1]=(pila[sp-1]<=pila[sp]);
				}
			} sp--; break;
			break;

		case lstrmai:
			if ((unsigned)pila[sp-1]>255) {
				if ((unsigned)pila[sp]>255) {
					if (strcmp((char*)&mem[pila[sp-1]],(char*)&mem[pila[sp]])>=0) pila[sp-1]=1; else pila[sp-1]=0;
				} else {
					if (strcmp((char*)&mem[pila[sp-1]],(char*)&pila[sp])>=0) pila[sp-1]=1; else pila[sp-1]=0;
				}
			} else {
				if ((unsigned)pila[sp]>255) {
					if (strcmp((char*)&pila[sp-1],(char*)&mem[pila[sp]])>=0) pila[sp-1]=1; else pila[sp-1]=0;
				} else {
					pila[sp-1]=(pila[sp-1]>=pila[sp]);
				}
			} sp--; break;
			break;

		case lcpastr:
			_param_offset=reservedptr("param_offset");
/*			#ifdef DEBUG
				if ((mem[pila[sp]-1]&0xFFF00000)!=0xDAD00000) {
					sp--; mem[id+_Param]++; v_function=-2; e(164);
					if (call_to_debug) { process_stoped=id; return; }
					break;
				}
				if ((unsigned)pila[mem[id+_Param]]>255) {
					if ((mem[pila[sp]-1]&0xFFFFF)+1<strlen((char*)&mem[pila[mem[id+_Param]]])) {
						sp--; mem[id+_Param]++; v_function=-2; e(140);
						if (call_to_debug) { process_stoped=id; return; }
						break;
					}
				}
			#endif*/
			if ((unsigned)pila[mem[procs_s[num_proc].id+_param_offset]]>255)
				strcpy((char*)&mem[pila[sp]],(char*)&mem[pila[mem[procs_s[num_proc].id+_param_offset]]]);
			else sprintf((char*)&mem[pila[sp]],"%c\0",pila[mem[procs_s[num_proc].id+_param_offset]]);
			sp--; mem[procs_s[num_proc].id+_param_offset]++;
			break;

		/* Comprobación de punteros nulos */
		case lnul:
/*			#ifdef DEBUG
				if (!pila[sp]) {
					v_function=-2; e(165);
					if (call_to_debug) { process_stoped=id; return; }
				}
			#endif*/
			break;

		/* OPCODES NUEVOS DE EDIV */

		case lextasp:
			externa=extfuncs[mem[imem]];
			// corresponder con FUNCTION_PARAMS
			//temp = externa(pila,&sp,mem,varindex,&procs_s,Call_Entrypoint);
			fp.num_params=extparms[mem[imem++]];
			externa(&fp);
			break;

		}

		#ifdef DBG
			Call_Entrypoint(EDIV_trace,imem,nombre_program,lin,0);
			#ifdef _DEBUG
				actual_lin=localiza_lin(imem);
				if(actual_lin!=last_lin) {
					unsigned char* p=&prog[lin[actual_lin*4+3]];
//					printf("[%d|%d-%d] ",imem,lin[actual_lin*4+3],lin[actual_lin*4+4]);
					printf("[%d] ",imem);
					while(p<=&prog[lin[actual_lin*4+4]]) {
						putc(*p,stdout);
						p++;
					}
					printf("\n");
					last_lin=actual_lin;
				}
			#endif /* _DEBUG */
		#endif /* DBG */
	}

	if ( devolver > 0 && no_devuelve == 0 )
	{
		//pila[++sp] = 0 ;// AQUI SE DEBERA DEVOLVER EL ID
		pila[++sp]=procs_s[num_proc].id;
		devolver-- ;
	}

	Call_Entrypoint(EDIV_post_process);

	return 1 ;
}
Beispiel #22
0
/**
 * Parse a comma separated list, converting to bytecode
 *
 * \param c          Parsing context
 * \param vector     Vector of tokens to process
 * \param ctx        Pointer to vector iteration context
 * \param reserved   Callback to determine if an identifier is reserved
 * \param get_value  Callback to retrieve bytecode value for a token
 * \param style      Pointer to output style
 * \return CSS_OK      on success,
 *         CSS_INVALID if the input is invalid
 *
 * Post condition: \a *ctx is updated with the next token to process
 *                 If the input is invalid, then \a *ctx remains unchanged.
 */
css_error css__comma_list_to_style(css_language *c,
		const parserutils_vector *vector, int *ctx,
		bool (*reserved)(css_language *c, const css_token *ident),
		css_code_t (*get_value)(css_language *c, const css_token *token, bool first),
		css_style *result)
{
	int orig_ctx = *ctx;
	int prev_ctx = orig_ctx;
	const css_token *token;
	bool first = true;
	css_error error = CSS_OK;

	token = parserutils_vector_iterate(vector, ctx);
	if (token == NULL) {
		*ctx = orig_ctx;
		return CSS_INVALID;
	}

	while (token != NULL) {
		if (token->type == CSS_TOKEN_IDENT) {
			css_code_t value = get_value(c, token, first);

			if (reserved(c, token) == false) {
				lwc_string *str = NULL;
				uint32_t snumber;

				*ctx = prev_ctx;

				error = css__ident_list_to_string(c, vector, ctx,
						reserved, &str);
				if (error != CSS_OK)
					goto cleanup;

				error = css__stylesheet_string_add(c->sheet,
						str, &snumber);
				if (error != CSS_OK)
					goto cleanup;

				error = css__stylesheet_style_append(result, 
						value);
				if (error != CSS_OK)
					goto cleanup;

				error = css__stylesheet_style_append(result,
						snumber);
				if (error != CSS_OK)
					goto cleanup;
			} else {
				error = css__stylesheet_style_append(result,
						value);
				if (error != CSS_OK)
					goto cleanup;
			}
		} else if (token->type == CSS_TOKEN_STRING) {
			css_code_t value = get_value(c, token, first);
			uint32_t snumber;

			error = css__stylesheet_string_add(c->sheet, 
					lwc_string_ref(token->idata), &snumber);
			if (error != CSS_OK)
				goto cleanup;

			error = css__stylesheet_style_append(result, value);
			if (error != CSS_OK)
				goto cleanup;

			error = css__stylesheet_style_append(result, snumber);
			if (error != CSS_OK)
				goto cleanup;
		} else {
			error = CSS_INVALID;
			goto cleanup;
		}

		consumeWhitespace(vector, ctx);

		token = parserutils_vector_peek(vector, *ctx);
		if (token != NULL && tokenIsChar(token, ',')) {
			parserutils_vector_iterate(vector, ctx);

			consumeWhitespace(vector, ctx);

			token = parserutils_vector_peek(vector, *ctx);
			if (token == NULL || (token->type != CSS_TOKEN_IDENT &&
					token->type != CSS_TOKEN_STRING)) {
				error = CSS_INVALID;
				goto cleanup;
			}
		} else {
			break;
		}

		first = false;

		prev_ctx = *ctx;

		token = parserutils_vector_iterate(vector, ctx);
	}

cleanup:
	if (error != CSS_OK)
		*ctx = orig_ctx;

	return error;
}
 bool is_in_reserved(const void* p) const   {
     return reserved().contains((void *)p);
 }
Beispiel #24
0
size_t Generation::max_capacity() const {
    return reserved().byte_size();
}
Beispiel #25
0
/**
 * Create a string from a list of IDENT/S tokens
 *
 * \param c          Parsing context
 * \param vector     Vector containing tokens
 * \param ctx        Vector iteration context
 * \param reserved   Callback to determine if an identifier is reserved
 * \param result     Pointer to location to receive resulting string
 * \return CSS_OK on success, appropriate error otherwise.
 *
 * Post condition: \a *ctx is updated with the next token to process
 *                 If the input is invalid, then \a *ctx remains unchanged.
 *
 *                 The resulting string's reference is passed to the caller
 */
css_error css__ident_list_to_string(css_language *c,
		const parserutils_vector *vector, int *ctx,
		bool (*reserved)(css_language *c, const css_token *ident),
		lwc_string **result)
{
	int orig_ctx = *ctx;
	const css_token *token;
	css_error error = CSS_OK;
	parserutils_buffer *buffer;
	parserutils_error perror;
	lwc_string *interned;
	lwc_error lerror;

	perror = parserutils_buffer_create((parserutils_alloc) c->alloc, 
			c->pw, &buffer);
	if (perror != PARSERUTILS_OK)
		return css_error_from_parserutils_error(perror);

	/* We know this token exists, and is an IDENT */
	token = parserutils_vector_iterate(vector, ctx);

	/* Consume all subsequent IDENT or S tokens */	
	while (token != NULL && (token->type == CSS_TOKEN_IDENT ||
			token->type == CSS_TOKEN_S)) {
		if (token->type == CSS_TOKEN_IDENT) {
			/* IDENT -- if reserved, reject style */
			if (reserved != NULL && reserved(c, token)) {
				error = CSS_INVALID;
				goto cleanup;
			}

			perror = parserutils_buffer_append(buffer, 
					(const uint8_t *) lwc_string_data(token->idata), 
					lwc_string_length(token->idata));
		} else {
			/* S */
			perror = parserutils_buffer_append(buffer, 
					(const uint8_t *) " ", 1);
		}

		if (perror != PARSERUTILS_OK) {
			error = css_error_from_parserutils_error(perror);
			goto cleanup;
		}

		token = parserutils_vector_iterate(vector, ctx);
	}

	/* Rewind context by one step if we consumed an unacceptable token */
	if (token != NULL)
		*ctx = *ctx - 1;

	/* Strip trailing whitespace */
	while (buffer->length > 0 && buffer->data[buffer->length - 1] == ' ')
		buffer->length--;

	/* Intern the buffer contents */
	lerror = lwc_intern_string((char *) buffer->data, buffer->length, &interned);
	if (lerror != lwc_error_ok) {
		error = css_error_from_lwc_error(lerror);
		goto cleanup;
	}

	*result = interned;

cleanup:
	parserutils_buffer_destroy(buffer);

	if (error != CSS_OK)
		*ctx = orig_ctx;

	return error;
}
Beispiel #26
0
// No young generation references, clear this generation's cards.
void CardGeneration::clear_remembered_set() {
    _rs->clear(reserved());
}
Beispiel #27
0
int reserved (char *word, char ** reserved_words) {
	/* This function returns 1 if word is a reserved word; 0, otherwise */
	if (strcmp ("", *reserved_words) == 0) return 0;
	if (strcmp (word, *reserved_words) == 0) return 1;
	return reserved (word, reserved_words+1);
}
Beispiel #28
0
	/* images will be saved in the current directory by default */
	std::vector<string> capture(int startFrame, int endFrame, bool output = false, const char* path = "", string filename = "") {
		/* total number of frames */
		size_t total = endFrame - startFrame;
		/* dynamical array of images for storing all the frames */
		/* store string rather than Image objects because those objects will eat all the memory */
		std::vector<string> images;

		this->setFrames(startFrame, false);

#ifdef FFMPEG

		/* use ffmpeg to improve speed */
		string videoPath(this->path);
		string framePath(path);
		string cmd = "ffmpeg -r \"" + Common::doubleToStr(this->getVideo().get(CV_CAP_PROP_FPS)) + "\" -ss " + Common::doubleToStr(startFrame / this->getVideo().get(CV_CAP_PROP_FPS)) + " -i " + videoPath + " -vframes \"" + Common::intToStr(total + 1) + "\" \"" + framePath + "f" + filename + "_%1d.png\"";

		/* excute the command */
		FILE* captureProcess = popen(cmd.c_str(), "w");

		if (captureProcess == NULL) {
			ostringstream os;
			os << "Failed to capture frames from the video";
			Common::errorPrint(os.str().c_str());
			/* exit */
			exit(-1);
		}

		pclose(captureProcess);

		size_t i = 1;
		for (; i <= total + 1; i++) {
			/* save the image when output is [true] */
			if (output && i >= startFrame) {
				string num = Common::intToStr(i);
				string reserved(path);
				images.push_back(reserved + "f" + filename + "_" + num + ".png");
			}
		}

#endif

#ifndef FFMPEG

		/* this loop will cost too much time */
		size_t i = startFrame;
		for (; i <= endFrame; i++) {
			Mat reservedImg;
			this->vdo.read(reservedImg);
			/* save the image when output is [true] */
			if (output && i >= startFrame) {
				string num = Common::intToStr(i);
				string reserved(path);

				imwrite((reserved + filename + num + ".png").c_str(), reservedImg);
				images.push_back(reserved + "f" + filename + "_" + num + ".png");
				cout << "save image: " + num << endl;
			}
		}

#endif

		return images;
	}
Beispiel #29
0
bool valid(char c){ return alpha(c) || reserved(c); }
// Similar to PSYoungGen::resize_generation() but
//  allows sum of eden_size and 2 * survivor_size to exceed _max_gen_size
//  expands at the low end of the virtual space
//  moves the boundary between the generations in order to expand
//  some additional diagnostics
// If no additional changes are required, this can be deleted
// and the changes factored back into PSYoungGen::resize_generation().
bool ASPSYoungGen::resize_generation(size_t eden_size, size_t survivor_size) {
  const size_t alignment = virtual_space()->alignment();
  size_t orig_size = virtual_space()->committed_size();
  bool size_changed = false;

  // There used to be a guarantee here that
  //   (eden_size + 2*survivor_size)  <= _max_gen_size
  // This requirement is enforced by the calculation of desired_size
  // below.  It may not be true on entry since the size of the
  // eden_size is no bounded by the generation size.

  assert(max_size() == reserved().byte_size(), "max gen size problem?");
  assert(min_gen_size() <= orig_size && orig_size <= max_size(),
         "just checking");

  // Adjust new generation size
  const size_t eden_plus_survivors =
    align_size_up(eden_size + 2 * survivor_size, alignment);
  size_t desired_size = MAX2(MIN2(eden_plus_survivors, gen_size_limit()),
                             min_gen_size());
  assert(desired_size <= gen_size_limit(), "just checking");

  if (desired_size > orig_size) {
    // Grow the generation
    size_t change = desired_size - orig_size;
    HeapWord* prev_low = (HeapWord*) virtual_space()->low();
    if (!virtual_space()->expand_by(change)) {
      return false;
    }
    if (ZapUnusedHeapArea) {
      // Mangle newly committed space immediately because it
      // can be done here more simply that after the new
      // spaces have been computed.
      HeapWord* new_low = (HeapWord*) virtual_space()->low();
      assert(new_low < prev_low, "Did not grow");

      MemRegion mangle_region(new_low, prev_low);
      SpaceMangler::mangle_region(mangle_region);
    }
    size_changed = true;
  } else if (desired_size < orig_size) {
    size_t desired_change = orig_size - desired_size;

    // How much is available for shrinking.
    size_t available_bytes = limit_gen_shrink(desired_change);
    size_t change = MIN2(desired_change, available_bytes);
    virtual_space()->shrink_by(change);
    size_changed = true;
  } else {
    if (Verbose && PrintGC) {
      if (orig_size == gen_size_limit()) {
        gclog_or_tty->print_cr("ASPSYoung generation size at maximum: "
          SIZE_FORMAT "K", orig_size/K);
      } else if (orig_size == min_gen_size()) {
        gclog_or_tty->print_cr("ASPSYoung generation size at minium: "
          SIZE_FORMAT "K", orig_size/K);
      }
    }
  }

  if (size_changed) {
    reset_after_change();
    if (Verbose && PrintGC) {
      size_t current_size  = virtual_space()->committed_size();
      gclog_or_tty->print_cr("ASPSYoung generation size changed: "
        SIZE_FORMAT "K->" SIZE_FORMAT "K",
        orig_size/K, current_size/K);
    }
  }

  guarantee(eden_plus_survivors <= virtual_space()->committed_size() ||
            virtual_space()->committed_size() == max_size(), "Sanity");

  return true;
}